/* ============================================================
   VAULT HOLLANDIA NOIR — app components
   Built entirely on the tokens & atoms in styles.css.
   No new palette: same noir + gold + silver language.
   ============================================================ */

/* ---- light theme: same hues, parchment surfaces ---- */
:root[data-theme="light"] {
  --noir-0: #F3EFE6;
  --noir-1: #FBF8F1;
  --noir-2: #FFFFFF;
  --noir-3: #F0E8D8;
  --text: #2A2620;
  --text-mute: #6E665A;
  --line: rgba(138, 107, 43, 0.22);
  --line-strong: rgba(138, 107, 43, 0.4);
  --gold: #9A7726;
  --gold-bright: #B8902F;
  --silver: #6F757C;
  --silver-bright: #565C63;
}
:root[data-theme="light"] body { background:
  radial-gradient(1100px 700px at 88% -5%, rgba(201,162,75,0.10), transparent 60%),
  radial-gradient(950px 700px at -8% 105%, rgba(170,120,40,0.10), transparent 60%),
  var(--noir-0); }
:root[data-theme="light"] body::after { opacity: 0.025; }

html, body { min-height: 100dvh; }
#app { min-height: 100dvh; }

/* personal vault backdrop — a colour-graded photo behind everything, very subtle */
/* oversized vertically (inset -12dvh top/bottom) so the parallax shift has slack and never
   reveals the photo's edge; the top/bottom are masked to transparent so the image always
   fades into nothing rather than ending on a hard line */
#vault-backdrop { position: fixed; inset: -12dvh 0; z-index: -1; pointer-events: none; display: none;
  background-size: cover; background-position: center; will-change: transform;
  opacity: 0.16; filter: grayscale(0.25) sepia(0.3) brightness(0.5) contrast(1.04);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 16%, #000 84%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 16%, #000 84%, transparent 100%); }
#vault-backdrop.is-on { display: block; }
#vault-backdrop::after { content: ""; position: absolute; inset: 0;
  background: radial-gradient(120% 90% at 50% 0%, transparent, rgba(10,9,8,0.6) 70%, rgba(10,9,8,0.85)); }
:root[data-theme="light"] #vault-backdrop { opacity: 0.1; filter: sepia(0.2) brightness(1.05) contrast(1.02); }
:root[data-theme="light"] #vault-backdrop::after { background: radial-gradient(120% 90% at 50% 0%, transparent, rgba(243,239,230,0.55) 70%, rgba(243,239,230,0.8)); }
/* phones are often viewed at low brightness — lift the dark-mode backdrop a touch so it
   stays visible there. Desktop/light are unchanged. */
@media (max-width: 719px) {
  :root[data-theme="dark"] #vault-backdrop { opacity: 0.24; filter: grayscale(0.25) sepia(0.3) brightness(0.64) contrast(1.06); }
  :root[data-theme="dark"] #vault-backdrop::after { background: radial-gradient(120% 90% at 50% 0%, transparent, rgba(10,9,8,0.5) 72%, rgba(10,9,8,0.8)); }
}

/* elegant, on-brand scrollbars everywhere (replaces the chunky native bar) */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-deep); background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

/* shared field-label span (label.field > span) */
.field > span { display: block; font-size: 0.85rem; font-weight: 500; letter-spacing: 0.04em; margin-bottom: 0.4rem; color: var(--text); }
.field textarea {
  width: 100%; padding: 0.6rem 0.85rem; background: var(--noir-0);
  border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--text);
  font-family: var(--font-body); resize: vertical;
}
.field textarea:focus-visible { outline: 2px solid var(--ring); border-color: var(--gold); }
.field__lbl { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 0.4rem; }
.muted-note { color: var(--text-mute); font-size: 0.9rem; }
.empty-note { color: var(--text-mute); font-size: 0.9rem; padding: var(--space-3) 0; text-align: center; }

/* =================== APP SHELL =================== */
.appshell { display: block; }
.sidebar { display: none; }

.appmain {
  padding: var(--space-3) var(--space-3) calc(86px + env(safe-area-inset-bottom));
  max-width: var(--container);
  margin: 0 auto;
}
.view { animation: fadein var(--t-med) var(--ease-out); }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.view__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-bottom: var(--space-3); }
.view__head h2 { margin: 0; }
.section-sub { font-family: var(--font-display); font-size: 1.6rem; margin: var(--space-4) 0 var(--space-2); }

/* bottom nav (mobile) */
.bottomnav--app {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 55;
  display: flex; justify-content: space-around; align-items: center;
  background: rgba(10,9,8,0.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 0.4rem 0.5rem calc(0.4rem + env(safe-area-inset-bottom));
}
:root[data-theme="light"] .bottomnav--app { background: rgba(251,248,241,0.95); }
.bnav {
  display: flex; flex-direction: column; align-items: center; gap: 0.2rem;
  min-width: 60px; min-height: 50px; justify-content: center;
  background: none; border: none; color: var(--text-mute);
  font-size: 0.64rem; font-weight: 500; letter-spacing: 0.04em;
  transition: color var(--t-fast) var(--ease-out);
}
.bnav svg { width: 22px; height: 22px; }
.bnav.is-active { color: var(--gold-bright); }

@media (min-width: 900px) {
  .appshell { display: grid; grid-template-columns: 248px 1fr; min-height: 100dvh; }
  .sidebar {
    display: flex; flex-direction: column; gap: var(--space-2);
    padding: var(--space-3) var(--space-2);
    border-right: 1px solid var(--line);
    position: sticky; top: 0; height: 100dvh;
  }
  .sidebar .brand { padding: 0.4rem var(--space-1) var(--space-2); }
  .sidenav { display: flex; flex-direction: column; gap: 0.25rem; }
  .navbtn {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.7rem 0.9rem; min-height: 48px;
    background: none; border: 1px solid transparent; border-radius: var(--radius);
    color: var(--text-mute); font-weight: 500; font-size: 0.95rem; letter-spacing: 0.03em;
    text-align: left; transition: color var(--t-fast), background-color var(--t-fast), border-color var(--t-fast);
  }
  .navbtn svg { width: 20px; height: 20px; flex: none; }
  .navbtn:hover { color: var(--text); }
  .navbtn.is-active { color: var(--gold-bright); background: rgba(201,162,75,0.08); border-color: var(--line); }
  .sidebar__lock { margin-top: auto; justify-content: flex-start; }
  /* fill the grid column: explicit width stops auto-margins from
     collapsing the item to its content width */
  .appmain { width: 100%; max-width: 1120px; margin-inline: auto; min-width: 0; padding: var(--space-4) var(--space-4) var(--space-5); }
  .bottomnav--app { display: none; }
}

/* =================== DASHBOARD =================== */
/* hero: the total is the unmistakable primary, with room to breathe */
.dash-hero { padding: var(--space-2) 0 var(--space-4); margin-bottom: var(--space-3); border-bottom: 1px solid var(--line); }
.dash-hero__label { font-size: 0.76rem; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-mute); margin: var(--space-2) 0 0.1rem; }
.dash__total { font-family: var(--font-display); font-size: clamp(3rem, 9vw, 5.2rem); line-height: 1; margin: 0.1rem 0 0.7rem; }
.dash-hero__meta { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; font-family: var(--font-data); font-size: 0.95rem; }
.dash-hero__sep { color: var(--text-mute); opacity: 0.45; }
.dash__delta.is-gain { color: var(--gain); } .dash__delta.is-loss { color: var(--loss); }
.dash__alloc { color: var(--text-mute); }
.dash__alloc .metal-au { color: var(--gold); }
/* sections create rhythm: clear secondary/tertiary tiers, generous gaps */
.dash-sec { margin-bottom: var(--space-4); }
.dash-sec__eye { margin-bottom: var(--space-2); }

.grid-2 { display: grid; gap: var(--space-2); margin-bottom: var(--space-3); }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* spot cards: side by side at ALL sizes */
.spotgrid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); margin-bottom: var(--space-3); }

.stat-card { position: relative; overflow: hidden; }
.stat-card__body { position: relative; z-index: 1; }
.stat-card .summary__label { display: flex; align-items: center; gap: 0.5rem; }
.stat-card__big { font-family: var(--font-display); font-size: clamp(2.2rem, 5.5vw, 3rem); line-height: 1; margin: 0.25rem 0; }
.stat-card--au .stat-card__big { color: var(--gold-bright); } .stat-card--ag .stat-card__big { color: var(--silver-bright); }
.stat-card__fine { font-family: var(--font-data); font-size: 0.82rem; color: var(--text-mute); margin-bottom: var(--space-2); }
.miniprog { display: flex; flex-direction: column; gap: 0.35rem; }
.miniprog__bar { height: 6px; border-radius: 3px; background: var(--noir-0); border: 1px solid var(--line); overflow: hidden; }
.miniprog__fill { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-deep), var(--gold)); transition: width 700ms var(--ease-out); }
.stat-card--ag .miniprog__fill { background: linear-gradient(90deg, var(--silver-deep), var(--silver)); }
.miniprog__label { font-size: 0.72rem; color: var(--text-mute); letter-spacing: 0.03em; }

/* market spot cards: a clean vertical stack (label · price/oz · per-gram) over a faint graph */
.spotcard { position: relative; overflow: hidden; }
.spotcard__body { position: relative; z-index: 1; }
.spotcard__price { font-family: var(--font-data); font-size: clamp(1.1rem, 3.2vw, 1.5rem); margin: 0.15rem 0 0; line-height: 1.2; }
.spotcard__unit, .spotcard__sub { font-size: 0.7rem; color: var(--text-mute); }
.spotcard__sub { display: block; font-family: var(--font-data); margin: 0.1rem 0 0; }
.spotcard__stale { font-size: 0.72rem; color: var(--loss); margin-top: 0.4rem; }

/* faint full-bleed graph behind a card (holdings + market cards) */
.cardspark { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 60%; z-index: 0; pointer-events: none; opacity: 0.16; }
.cardspark--au { color: var(--gold); } .cardspark--ag { color: var(--silver); }
.cardspark__area { fill: currentColor; opacity: 0.35; }
.cardspark__line { fill: none; stroke: currentColor; stroke-width: 1.5; vector-effect: non-scaling-stroke; opacity: 0.7; }

.iconbtn {
  width: 40px; height: 40px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 1px solid var(--line); border-radius: 50%; color: var(--text-mute);
  transition: color var(--t-fast), border-color var(--t-fast);
}
.iconbtn:hover { color: var(--gold-bright); border-color: var(--gold); }
.iconbtn svg { width: 18px; height: 18px; }
.iconbtn.is-spinning svg { animation: spin 800ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* allocation donut */
/* beta notice on the login / lock / onboarding surfaces */
.beta-note { display: flex; align-items: flex-start; gap: 0.6rem; margin: 0 auto var(--space-3); padding: 0.7rem 0.9rem; border: 1px solid var(--line-strong); border-radius: var(--radius); background: rgba(201, 162, 75, 0.06); color: var(--text-mute); font-size: 0.82rem; line-height: 1.5; text-align: left; }
.beta-note__tag { flex: none; font-family: var(--font-data); font-size: 0.64rem; font-weight: 700; letter-spacing: 0.12em; color: var(--gold-bright); border: 1px solid var(--gold-deep); border-radius: 99px; padding: 0.12rem 0.5rem; margin-top: 0.1rem; }
.lock .beta-note { max-width: 360px; }

/* allocation: donut on the left, legend always to its right (never wrapping under it) */
.alloc { display: flex; align-items: center; gap: var(--space-3); flex-wrap: nowrap; }
.alloc__legend { flex: 1 1 auto; min-width: 0; }
.donut { width: 134px; height: 134px; flex: none; }
.donut__rim { fill: none; stroke: var(--line-strong); stroke-width: 0.75; opacity: 0.5; }
.donut__track { fill: none; stroke: rgba(255,255,255,0.06); stroke-width: 9; }
:root[data-theme="light"] .donut__track { stroke: rgba(0,0,0,0.07); }
.donut__seg { fill: none; stroke-width: 9; stroke-linecap: round; transition: stroke-dasharray 700ms var(--ease-out), stroke-dashoffset 700ms var(--ease-out); }
.donut__total { font-family: var(--font-display); font-size: 23px; font-weight: 600; fill: var(--text); }
.donut__cur { font-family: var(--font-body); font-size: 7.5px; font-weight: 600; letter-spacing: 0.32em; fill: var(--gold); }
.alloc__legend p { display: flex; align-items: baseline; gap: 0.5rem; font-size: 0.92rem; color: var(--text-mute); margin-bottom: 0.5rem; }
.alloc__legend strong { color: var(--text); font-family: var(--font-data); font-weight: 500; }
.legend-val { font-family: var(--font-data); font-size: 0.78rem; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; transform: translateY(1px); flex: none; }
.legend-dot--au { background: linear-gradient(135deg, var(--gold-bright), var(--gold-deep)); }
.legend-dot--ag { background: linear-gradient(135deg, var(--silver-bright), var(--silver-deep)); }

/* portfolio chart */
.chart { width: 100%; height: auto; display: block; margin-top: var(--space-1); }
.chart__delta { font-family: var(--font-data); font-size: 0.85rem; margin-bottom: 0.3rem; }
.chart__delta.is-gain { color: var(--gain); } .chart__delta.is-loss { color: var(--loss); }
.chart__grid { stroke: var(--line); stroke-width: 1; }
.chart__tick { font-family: var(--font-data); font-size: 9px; fill: var(--text-mute); }
.chart__area { fill: rgba(201,162,75,0.12); }
.chart__line { fill: none; stroke: var(--gold); stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }

/* milestones */
.msrow { display: flex; align-items: center; gap: 0.6rem; padding: var(--space-2) 0; border-top: 1px solid var(--line); }
.msrow:first-of-type { border-top: none; }
.msrow__metal { font-family: var(--font-display); font-size: 1.2rem; width: 3.1rem; flex: none; }
/* the ladder scrolls horizontally; fade both edges instead of a hard cut */
.msrow__line { display: flex; gap: var(--space-2); overflow-x: auto; padding-bottom: 0.25rem;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent);
  mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent); }
.msrow__done { color: var(--gain); font-size: 0.85rem; align-self: center; }
.ms { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; flex: none; }
.ms__ring { width: 52px; height: 52px; }
.ms__track { fill: none; stroke: var(--noir-0); stroke-width: 4; }
.ms__fill { fill: none; stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset 700ms var(--ease-out); }
.ms__fill--au { stroke: var(--gold); } .ms__fill--ag { stroke: var(--silver); }
.ms__pct { font-family: var(--font-data); font-size: 11px; fill: var(--text-mute); }
.ms__label { font-size: 0.72rem; color: var(--text-mute); }

/* alert banner */
.banner { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
  background: var(--noir-3); border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 0.7rem 1rem; margin-bottom: var(--space-2); font-size: 0.9rem; }

/* celebration burst */
.celebrate { position: fixed; inset: 0; pointer-events: none; z-index: 80; display: flex; align-items: center; justify-content: center; }
.celebrate__ring { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--gold); animation: burst 1.2s var(--ease-out) forwards; }
.celebrate__ring--ag { border-color: var(--silver); }
@keyframes burst { 0% { transform: scale(0.2); opacity: 0.9; } 100% { transform: scale(14); opacity: 0; } }

/* =================== LEDGER / STACK =================== */
.ledger-wrap { overflow-x: auto; padding: var(--space-2); }
.ledger { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.ledger th { text-align: left; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-mute); padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.ledger td { padding: 0.6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ledger .num, .ledger td.num { text-align: right; font-family: var(--font-data); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ledger__spacer td { padding: 0; height: 10px; border-bottom: none; background: repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px 7px); opacity: 0.4; }
.ledger__date { color: var(--text-mute); white-space: nowrap; }
.ledger__notes { color: var(--text-mute); font-size: 0.82rem; max-width: 14rem; }
.ledger__foot td { font-family: var(--font-data); border-top: 1px solid var(--line-strong); border-bottom: none; padding-top: 0.7rem; }
.ledger--coll .subnum { display: block; font-size: 0.72rem; color: var(--text-mute); }

/* premium metal dots — silver reads as a tiny coin, gold as a tiny bar */
.mdot { display: inline-block; margin-right: 0.5rem; flex: none; vertical-align: middle; }
.mdot--ag {
  width: 13px; height: 13px; border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #FBFCFD, #C4C9CF 55%, #7E848C);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.35), inset 0 -1px 2px rgba(0,0,0,0.3);
}
.mdot--au {
  width: 13px; height: 13px; border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #FCEEB5, #D8AE52 55%, #8A6326);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.3), inset 0 -1px 2px rgba(0,0,0,0.3);
}

.piece { display: flex; align-items: center; gap: 0.6rem; min-width: 9rem; }
.piece__name { font-weight: 500; }
.piece__meta { display: block; font-size: 0.74rem; color: var(--text-mute); }
.thumb { width: 38px; height: 38px; border-radius: 6px; object-fit: cover; flex: none; cursor: zoom-in; border: 1px solid var(--line); }
.thumb--empty { background: var(--noir-3); cursor: default; }
.thumb--lg { width: 90px; height: 90px; border-radius: 8px; margin-top: 0.5rem; cursor: default; }

.rowacts { display: flex; gap: 0.4rem; justify-content: flex-end; }
td.is-gain { color: var(--gain); } td.is-loss { color: var(--loss); } td.is-neutral { color: var(--text); }

.empty-card { text-align: center; padding: var(--space-4); }
.empty__title { font-family: var(--font-display); font-size: 1.5rem; margin-bottom: 0.3rem; }
.empty__text { color: var(--text-mute); }

/* sold list */
.sold-list { display: flex; flex-direction: column; gap: var(--space-2); }
.sold-item { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap; padding: var(--space-2) var(--space-3); }
.sold-item__nums { display: flex; align-items: center; gap: var(--space-2); font-family: var(--font-data); font-size: 0.88rem; flex-wrap: wrap; }
.sold-item__nums .is-gain { color: var(--gain); } .sold-item__nums .is-loss { color: var(--loss); }

/* =================== COLLECTION =================== */
.coll-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--space-2); margin-bottom: var(--space-3); }
.coll-card { position: relative; display: flex; flex-direction: column; gap: 0.3rem; text-align: left;
  background: linear-gradient(160deg, var(--noir-2), var(--noir-1) 70%); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--space-2); min-height: 96px;
  transition: border-color var(--t-fast), transform var(--t-fast); }
.coll-card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.coll-card.is-active { border-color: var(--gold); }
.coll-card__thumb { width: 100%; height: 70px; border-radius: 6px; object-fit: cover; margin-bottom: 0.3rem; }
.coll-card__thumb--empty { background: var(--noir-3); display: block; }
.coll-card__name { font-weight: 600; }
.coll-card__count { font-size: 0.74rem; color: var(--text-mute); font-family: var(--font-data); }
.coll-card__note { font-size: 0.74rem; color: var(--text-mute); }
.coll-card__del { position: absolute; top: 0.4rem; right: 0.5rem; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; color: var(--text-mute); border-radius: 50%; font-size: 0.8rem; }
.coll-card__del:hover { color: var(--loss); background: rgba(208,138,126,0.1); }
.coll-card--new { align-items: center; justify-content: center; border-style: dashed; }
.coll-card__plus { font-size: 2rem; color: var(--gold); line-height: 1; }

/* =================== WIZARD + TAP CARDS =================== */
.wiz__dots { display: flex; gap: 0.4rem; justify-content: center; margin-bottom: var(--space-3); }
.wiz__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); transition: background var(--t-fast), transform var(--t-fast); }
.wiz__dot.is-active { background: var(--gold); transform: scale(1.4); }
.wiz__dot.is-done { background: var(--gold-deep); }
.wiz__q { font-family: var(--font-display); font-size: 1.5rem; margin-bottom: var(--space-2); }
.wiz__body { min-height: 180px; }

.tapgrid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.tapcard { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; padding: var(--space-3) var(--space-2);
  background: var(--noir-0); border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--text);
  min-height: 92px; justify-content: center; transition: border-color var(--t-fast), transform var(--t-fast); }
.tapcard:hover { border-color: var(--gold-deep); }
.tapcard.is-sel { border-color: var(--gold); background: rgba(201,162,75,0.08); }
.tapcard__title { font-family: var(--font-display); font-size: 1.3rem; }
.tapcard__sub { font-size: 0.76rem; color: var(--text-mute); font-family: var(--font-data); }

/* =================== SETTINGS =================== */
.setblock { margin-bottom: var(--space-3); }
.setblock .btn { margin-bottom: 0.4rem; }
.setblock__row { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.setblock__divider { height: 1px; background: var(--line); margin: var(--space-2) 0; }
.setblock__dev { display: block; margin-top: 0.9rem; background: none; border: none; padding: 0; color: var(--text-mute); font: inherit; font-size: 0.78rem; letter-spacing: 0.04em; opacity: 0.55; cursor: pointer; }
.setblock__dev:hover { opacity: 1; color: var(--gold); }
.lock__userfield { display: block; text-align: left; width: 100%; max-width: 320px; margin: 0 auto var(--space-2); }
.dev-beds { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0.6rem 0 0.9rem; }
.dev-bed { display: flex; flex-direction: column; gap: 0.35rem; align-items: center; }
.dev-bed__img { width: 132px; height: 74px; border-radius: var(--radius); background-size: cover; background-position: center; border: 1px solid var(--line-strong); }
.enc-status { display: flex; align-items: flex-start; gap: 0.55rem; margin: 0.7rem 0; font-size: 0.85rem; color: var(--text-mute); }
.enc-status__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--loss); flex: none; margin-top: 0.35rem; }
.enc-status__dot.is-on { background: var(--gain); }
/* notifications / dev broadcasts */
.notif-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 1.25rem; height: 1.25rem; padding: 0 0.35rem; margin-left: 0.4rem; border-radius: 99px; background: var(--gold); color: var(--noir-0); font-size: 0.75rem; font-weight: 700; line-height: 1; }
.notif-badge[hidden] { display: none; }
.ann-list { display: flex; flex-direction: column; gap: 0.7rem; margin: 0.3rem 0 0.2rem; max-height: 60vh; overflow-y: auto; }
.ann-card { border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 0.8rem 0.9rem; background: var(--noir-0); }
.ann-card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.3rem; }
.ann-card__title { font-family: var(--font-display); font-size: 1.1rem; margin: 0; color: var(--text); }
.ann-card__date { font-size: 0.78rem; color: var(--text-mute); white-space: nowrap; flex: none; }
.ann-card__body { font-size: 0.9rem; color: var(--text); line-height: 1.55; margin: 0; white-space: normal; }
.ann-card__del { margin-top: 0.6rem; }
.install-steps { list-style: none; counter-reset: step; margin: 0.6rem 0 0; padding: 0; }
.install-steps li { counter-increment: step; position: relative; padding: 0.5rem 0 0.5rem 2.3rem; border-top: 1px solid var(--line); font-size: 0.9rem; color: var(--text); line-height: 1.5; }
.install-steps li:first-child { border-top: none; }
.install-steps li::before { content: counter(step); position: absolute; left: 0; top: 0.45rem; width: 1.6rem; text-align: center; font-family: var(--font-display); font-style: italic; font-size: 1.15rem; color: var(--gold); }
.step-ic { width: 17px; height: 17px; vertical-align: -4px; margin: 0 1px; color: var(--gold-bright); }
.reveal-btn { display: inline-block; margin-top: 0.35rem; background: none; border: none; padding: 0; color: var(--gold); font: inherit; font-size: 0.8rem; letter-spacing: 0.02em; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.reveal-btn:hover { color: var(--gold-bright); }
.dash-sec__asof { font-weight: 400; letter-spacing: 0.02em; color: var(--text-mute); text-transform: none; }
.qty-badge { display: inline-block; margin-left: 0.4rem; padding: 0.05em 0.45em; border-radius: 999px; background: var(--gold-soft, rgba(201,162,75,0.16)); color: var(--gold); font-family: var(--font-data); font-size: 0.72em; font-weight: 600; vertical-align: middle; }
.qty-each { color: var(--text-mute); font-size: 0.72em; }
.lock__remember { display: flex; align-items: center; gap: 0.5rem; justify-content: center; max-width: 320px; margin: 0 auto var(--space-2); font-size: 0.85rem; color: var(--text-mute); cursor: pointer; }
.lock__remember input { width: 17px; height: 17px; accent-color: var(--gold); flex: none; cursor: pointer; }
.lock__as { margin-top: -0.4rem; margin-bottom: 0.6rem; font-size: 0.85rem; color: var(--text-mute); }
.lock__as strong { color: var(--text); font-weight: 600; }
.lock__forgot { margin-top: var(--space-3); background: none; border: none; color: var(--gold); font: inherit; font-size: 0.82rem; letter-spacing: 0.02em; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.lock__forgot:hover { color: var(--gold-bright); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.seg__btn { padding: 0.55rem 1.1rem; min-height: 44px; background: none; border: none; color: var(--text-mute); font-weight: 500; font-family: var(--font-data); transition: background var(--t-fast), color var(--t-fast); }
.seg__btn.is-on { background: linear-gradient(120deg, var(--gold-bright), var(--gold) 60%); color: #221A08; }
.alert-list { list-style: none; padding: 0; margin: 0 0 var(--space-2); display: flex; flex-direction: column; gap: 0.4rem; }
.alert-item { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); font-family: var(--font-data); font-size: 0.88rem; padding: 0.4rem 0; border-bottom: 1px solid var(--line); }
.alert-item .fired { color: var(--gold); font-style: normal; font-size: 0.74rem; }
.alert-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.alert-form select, .alert-form input { min-height: 44px; padding: 0.4rem 0.6rem; background: var(--noir-0); border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--text); font-family: var(--font-data); }
.alert-form input { width: 110px; }
.backup-area { width: 100%; min-height: 200px; font-family: var(--font-data); font-size: 0.78rem; background: var(--noir-0); color: var(--text); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 0.7rem; resize: vertical; }
.form-grid { display: grid; gap: var(--space-2); }
@media (min-width: 640px) { .form-grid { grid-template-columns: 1fr 1fr; } .field--full { grid-column: 1 / -1; } }

/* =================== LOCK SCREEN =================== */
.lock { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: var(--space-4) var(--space-3); gap: 0.6rem; max-width: 420px; margin: 0 auto; }
.lock__seal { width: min(40vw, 150px); margin-bottom: var(--space-2); }
.lock__eyebrow { margin-bottom: 0.2rem; }
.lock__title { font-family: var(--font-display); font-size: clamp(1.6rem, 5vw, 2.2rem); margin-bottom: var(--space-2); }
.lock__dots { display: flex; gap: 0.8rem; margin: var(--space-2) 0; }
.lock__dot { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--line-strong); transition: background var(--t-fast), border-color var(--t-fast); }
.lock__dot.is-filled { background: var(--gold); border-color: var(--gold); }
.lock__msg { min-height: 1.4em; font-size: 0.86rem; color: var(--text-mute); font-family: var(--font-data); }
.lock__back { margin-top: var(--space-2); }
.lock__dots.shake { animation: shake 0.4s; }
@keyframes shake { 0%,100% { transform: translateX(0); } 20%,60% { transform: translateX(-8px); } 40%,80% { transform: translateX(8px); } }

.numpad { display: grid; grid-template-columns: repeat(3, 76px); justify-content: center; gap: var(--space-2); margin-top: var(--space-2); }
.numpad__key { width: 76px; height: 76px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--noir-2); border: 1px solid var(--line);
  color: var(--text); font-family: var(--font-display); font-size: 1.8rem; line-height: 1; padding: 0;
  /* lining figures: same height, all on the baseline (Cormorant defaults to old-style) */
  font-variant-numeric: lining-nums; font-feature-settings: "lnum" 1;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast); }
.numpad__d { display: block; line-height: 1; transform: translateY(-0.02em); }
.numpad__key:hover { border-color: var(--gold-deep); }
.numpad__key:active { transform: scale(0.94); background: var(--noir-3); }
.numpad__key:disabled { opacity: 0.35; }
.numpad__key--back svg { width: 26px; height: 26px; }
.numpad__spacer { width: 76px; height: 76px; }

/* =================== ONBOARDING =================== */
.onb { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: var(--space-4) var(--space-3); max-width: 460px; margin: 0 auto; gap: var(--space-3); }
.onb__seal { width: min(34vw, 120px); margin: 0 auto var(--space-2); }
.onb__title { font-family: var(--font-display); font-size: clamp(1.8rem, 6vw, 2.6rem); margin-bottom: 0.4rem; }
.onb__sub { color: var(--text-mute); }
.onb__body { width: 100%; display: flex; flex-direction: column; gap: var(--space-2); text-align: left; }
.onb__choices { gap: var(--space-2); }
.choice-card { display: flex; flex-direction: column; gap: 0.3rem; text-align: left; padding: var(--space-3);
  background: linear-gradient(160deg, var(--noir-2), var(--noir-1) 70%); border: 1px solid var(--line-strong);
  border-radius: var(--radius); color: var(--text); transition: border-color var(--t-fast), transform var(--t-fast); }
.choice-card:hover { border-color: var(--gold); transform: translateY(-2px); }
.choice-card__title { font-family: var(--font-display); font-size: 1.4rem; }
.choice-card__sub { font-size: 0.86rem; color: var(--text-mute); }

/* =================== MODAL =================== */
.modal-overlay { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center;
  background: rgba(6,5,4,0.66); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); padding: var(--space-2); }
.modal-overlay[hidden] { display: none; }
.modal-box { width: 100%; max-width: 440px; max-height: 90dvh; overflow-y: auto; box-shadow: 0 24px 60px rgba(0,0,0,0.6); }
.modal-box--wide { max-width: 680px; }
.modal-title { font-family: var(--font-display); font-size: 1.5rem; margin-bottom: var(--space-2); }
.modal-actions { display: flex; gap: 0.6rem; justify-content: flex-end; align-items: center; margin-top: var(--space-3); flex-wrap: wrap; }
.btn--danger { background: transparent; border-color: var(--loss); color: var(--loss); }
.btn--danger:hover { background: rgba(208,138,126,0.1); }
.photo-full { width: 100%; border-radius: var(--radius); }
.toast[hidden] { display: none; }

/* =================== RTL =================== */
[dir="rtl"] .navbtn, [dir="rtl"] .sidebar__lock { text-align: right; }
[dir="rtl"] .modal-actions, [dir="rtl"] .rowacts { flex-direction: row-reverse; }
[dir="rtl"] .ledger th, [dir="rtl"] .ledger td { text-align: right; }
[dir="rtl"] .ledger .num { text-align: left; }
[dir="rtl"] .piece { flex-direction: row-reverse; }
[dir="rtl"] .mdot { margin-right: 0; margin-left: 0.5rem; }

/* =================== brand emblem =================== */
.brand__mark--img { width: 34px; height: 34px; object-fit: contain; }
.seal-emblem { display: block; width: 100%; height: auto; filter: drop-shadow(0 10px 26px rgba(0,0,0,0.55)); }
/* the seal no longer needs the 3D coin frame */
.lock__seal.coin, .onb__seal.coin { perspective: none; aspect-ratio: 1; }
.lock__seal .coin__inner, .onb__seal .coin__inner { position: static; }
.lock__seal .coin__face, .onb__seal .coin__face { position: static; backface-visibility: visible; -webkit-backface-visibility: visible; filter: none; }

/* =================== minted metal renders =================== */
.metal3d { display: block; width: 100%; height: auto; overflow: visible; }
.bar__brand { font-family: var(--font-display); font-size: 17px; font-weight: 600; letter-spacing: 0.12em; fill: #6E4E1C; }
.bar__fine { font-family: var(--font-body); font-size: 8.5px; font-weight: 600; letter-spacing: 0.18em; fill: #7A5A22; }
.coin__monogram--sm { font-size: 62px; }
.coin__legend--sm { font-size: 15px; letter-spacing: 0.2em; }
.metal3d__sheen { mix-blend-mode: screen; transform: translateX(-30%); animation: metalSheen 6s ease-in-out infinite; }
@keyframes metalSheen { 0%,70% { transform: translateX(-30%); opacity: 0; } 80% { opacity: 1; } 100% { transform: translateX(30%); opacity: 0; } }

/* settings showcase pair */
.showcase-set { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.showcase-set__item { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; text-align: center; }
.showcase-set__render { width: 100%; max-width: 180px; }
.showcase-set__btn { position: relative; overflow: hidden; }

/* =================== ledger footer =================== */
.foot-total { font-family: var(--font-display); font-size: 1.05rem; color: var(--text-mute); }
.foot-split { display: block; }
.foot-label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-mute); text-align: right; }
.foot-money { font-size: 1rem; }

/* milestones: the whole ladder is shown and scrolls horizontally; reached ones stay, marked done */
.ms.is-done .ms__track { stroke: color-mix(in srgb, var(--gain) 22%, var(--noir-0)); }
.ms.is-done .ms__label { color: var(--text); }
.ms__pct--done { fill: var(--gain); font-size: 15px; font-weight: 600; }
/* drop the clunky native number spinners (they clash with the rounded gold fields) */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.sortbar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; justify-content: space-between; margin-bottom: var(--space-2); }
.sortbar__keys { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.sortkey { display: inline-flex; align-items: center; gap: 0.25rem; min-height: 38px; padding: 0.35rem 0.8rem; border: 1px solid var(--line-strong); border-radius: var(--radius); background: none; color: var(--text-mute); font: inherit; font-size: 0.85rem; cursor: pointer; transition: color var(--t-fast), border-color var(--t-fast); }
.sortkey:hover { color: var(--text); border-color: var(--gold-deep); }
.sortkey.is-active { color: var(--gold); border-color: var(--gold); }
.sortkey__arr { font-size: 0.9em; }
.sortbar__metal .seg__btn { padding: 0.4rem 0.85rem; min-height: 38px; }
.market-meta { margin-top: var(--space-2); font-size: 0.82rem; color: var(--text-mute); text-align: center; }
.market-meta strong { color: var(--gold); font-family: var(--font-data); }
.market-meta__sep { opacity: 0.5; }
/* keep the ratio (and the timestamp) each on a single unbroken line; on a narrow phone
   the timestamp drops to its own line rather than splitting the ratio across two */
.market-meta__ratio, .market-meta__asof { white-space: nowrap; display: inline-block; }
@media (max-width: 480px) { .market-meta { font-size: 0.78rem; } }
.msrow__line .ms { animation: msIn 420ms var(--ease-out) both; }
@keyframes msIn { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }

/* =================== collections (showcase) =================== */
.coll-intro { margin-bottom: var(--space-3); max-width: 44rem; }
.backbtn { margin-bottom: var(--space-2); }
.showcase-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: var(--space-3); }
.showcase-card {
  display: flex; flex-direction: column; gap: 0.35rem; text-align: left;
  background: linear-gradient(160deg, var(--noir-2), var(--noir-1) 70%); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--space-2); transition: border-color var(--t-fast), transform var(--t-fast);
}
.showcase-card:hover { border-color: var(--gold); transform: translateY(-3px); }
.showcase-card__cover { position: relative; display: block; width: 100%; aspect-ratio: 4/3; border-radius: 10px; overflow: hidden; margin-bottom: 0.4rem; background: var(--noir-3); border: 1px solid var(--line); }
.showcase-card__cover::after { content: ""; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 0 1px rgba(234,210,138,0.12), inset 0 0 22px 5px rgba(10,9,8,0.5); background: linear-gradient(to bottom, transparent 60%, rgba(10,9,8,0.35)); }
.showcase-card__cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-mosaic { display: grid; width: 100%; height: 100%; gap: 2px; }
.cover-mosaic--1 { grid-template-columns: 1fr; }
.cover-mosaic--2 { grid-template-columns: 1fr 1fr; }
.cover-mosaic--3, .cover-mosaic--4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.cover-mosaic--3 img:first-child { grid-row: span 2; }
.cover-mosaic img { width: 100%; height: 100%; object-fit: cover; }
.cover-empty { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; padding: 14%; opacity: 0.5; }
.showcase-card__name { font-family: var(--font-display); font-size: 1.3rem; }
.showcase-card__count { font-family: var(--font-data); font-size: 0.74rem; color: var(--text-mute); }
.showcase-card__note { font-size: 0.78rem; color: var(--text-mute); }
.showcase-card--new { align-items: center; justify-content: center; border-style: dashed; min-height: 200px; }
.showcase-card__plus { font-size: 2.4rem; color: var(--gold); line-height: 1; }

.showcase-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--space-3); }
.showcase-item { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-2); }
.showcase-item__viewer { position: relative; display: block; width: 100%; aspect-ratio: 1; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; background: radial-gradient(circle at 50% 35%, var(--noir-3), var(--noir-0)); padding: 0; cursor: zoom-in; transition: border-color var(--t-fast); }
.showcase-item__viewer:hover { border-color: var(--gold); }
/* soften harsh photo edges: gold hairline + vignette fading into the card */
.showcase-item__viewer::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(234,210,138,0.15), inset 0 0 24px 6px rgba(10,9,8,0.55);
  background: linear-gradient(to bottom, transparent 58%, rgba(10,9,8,0.4)); }
.showcase-item__img { width: 100%; height: 100%; object-fit: cover; }
.photo-preview { display: block; width: 100%; max-width: 240px; margin-top: 0.6rem; border-radius: 10px; border: 1px solid var(--line-strong); box-shadow: 0 8px 22px rgba(0,0,0,0.45); }
.showcase-item__noimg { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; padding: 16%; }
.showcase-item__3d { position: absolute; top: 8px; right: 8px; font-family: var(--font-data); font-size: 0.64rem; font-weight: 600; letter-spacing: 0.1em; color: #221A08; background: linear-gradient(120deg, var(--gold-bright), var(--gold)); padding: 0.15rem 0.45rem; border-radius: 5px; }
.showcase-item__body { display: flex; align-items: center; gap: 0.5rem; }
.showcase-item__acts { display: flex; gap: 0.4rem; }
.showcase-item__acts .btn { flex: 1; }

/* add-from-stack picker */
.pick-search { width: 100%; min-height: 44px; padding: 0.55rem 0.85rem; margin-bottom: var(--space-2);
  background: var(--noir-0); border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--text); font: inherit; }
.pick-search:focus-visible { outline: 2px solid var(--ring); border-color: var(--gold); }
.pick-list { max-height: 48vh; overflow-y: auto; display: flex; flex-direction: column; gap: 0.2rem; margin-bottom: var(--space-2); }
.pick-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.5rem; border-radius: var(--radius); cursor: pointer; transition: background var(--t-fast); }
.pick-row:hover { background: rgba(201,162,75,0.06); }
.pick-row input { width: 18px; height: 18px; flex: none; accent-color: var(--gold); }
.pick-row__name { font-weight: 500; flex: 1; min-width: 0; }
.pick-row__date { flex: none; font-family: var(--font-data); font-size: 0.74rem; color: var(--text-mute); white-space: nowrap; }
.pick-empty { color: var(--text-mute); text-align: center; padding: var(--space-2); font-size: 0.9rem; }
.photo-pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); align-items: start; }

/* =================== 3D coin viewer =================== */
.coin3d-stage { perspective: 1000px; display: flex; align-items: center; justify-content: center; height: min(64vw, 340px); margin: var(--space-2) 0; touch-action: none; cursor: grab; }
.coin3d-stage:active { cursor: grabbing; }
.coin3d { position: relative; width: min(54vw, 250px); height: min(54vw, 250px); transform-style: preserve-3d; will-change: transform; }
.coin3d__face { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: inset 0 0 0 3px rgba(0,0,0,0.25); }
.coin3d__face img, .coin3d__face svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.coin3d__front { transform: translateZ(11px); }
.coin3d__back { transform: rotateY(180deg) translateZ(11px); }
.coin3d__edge { position: absolute; inset: 0; border-radius: 50%; background: repeating-linear-gradient(90deg, #8d939b 0 2px, #cbd0d6 2px 4px); }
.coin3d__hint { text-align: center; font-size: 0.8rem; color: var(--text-mute); letter-spacing: 0.04em; }

/* crest face for photoless pieces (collection + 3D viewer) */
.crestface { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; padding: 14%; }
.crestface--ag { background: radial-gradient(circle at 38% 32%, #FBFCFD, #C4C9CF 58%, #7E848C); }
.crestface--au { background: radial-gradient(circle at 38% 32%, #FCEEB5, #D8AE52 55%, #8A6326); }
.crestface img { width: 100%; height: 100%; object-fit: contain; }

/* weight + unit input row */
.weight-row { display: grid; grid-template-columns: 1fr auto; gap: 0.5rem; }
.weight-row select { min-height: 48px; padding: 0.6rem 0.7rem; background: var(--noir-0); border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--text); font-family: var(--font-body); }
.field-note { margin: 0.4rem 0 0; font-size: 0.78rem; color: var(--text-mute); line-height: 1.45; }
.field-note strong { color: var(--text); font-weight: 600; }

/* =================== My Stack — responsive ledger (no h-scroll) =================== */
.stackledger { padding: 0; overflow: hidden; }
.sl-head, .sl-row {
  display: grid;
  grid-template-columns: 5.25rem 5.5rem minmax(0, 1.7fr) 7rem 5rem minmax(0, 1.5fr);
  gap: var(--space-2); align-items: center; padding: 0.7rem var(--space-3);
}
.sl-weight, .sl-price, .sl-spot { white-space: nowrap; }
.sl-head { padding-top: 0.9rem; border-bottom: 1px solid var(--line-strong); }
.sl-head span { font-size: 0.66rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-mute); }
.sl-date { padding: 0.55rem var(--space-3); font-family: var(--font-data); font-size: 0.72rem; letter-spacing: 0.06em;
  color: var(--gold); background: rgba(201, 162, 75, 0.05); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.sl-group:first-of-type .sl-date { border-top: none; }
.sl-row { position: relative; border-bottom: 1px solid var(--line); cursor: pointer; transition: background var(--t-fast), padding var(--t-fast); }
/* multi-select */
.sl-check { display: none; position: absolute; left: 0.6rem; top: 50%; transform: translateY(-50%);
  width: 21px; height: 21px; border-radius: 50%; border: 1.5px solid var(--line-strong); align-items: center; justify-content: center; }
.stackledger.is-selecting .sl-row { padding-left: 2.8rem; cursor: pointer; }
.stackledger.is-selecting .sl-check { display: flex; }
.stackledger.is-selecting .sl-row.is-selected { background: rgba(201,162,75,0.1); }
.stackledger.is-selecting .sl-row.is-selected .sl-check { background: var(--gold); border-color: var(--gold); }
.stackledger.is-selecting .sl-row.is-selected .sl-check::after { content: ""; width: 9px; height: 5px; margin-top: -2px; border-left: 2px solid #221A08; border-bottom: 2px solid #221A08; transform: rotate(-45deg); }
.selbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: flex; align-items: center; gap: var(--space-2);
  padding: 0.65rem var(--space-3) calc(0.65rem + env(safe-area-inset-bottom));
  background: rgba(10,9,8,0.96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line-strong); animation: selbarIn var(--t-med) var(--ease-out); }
:root[data-theme="light"] .selbar { background: rgba(251,248,241,0.97); }
@keyframes selbarIn { from { transform: translateY(100%); } to { transform: none; } }
.selbar__count { font-weight: 600; font-family: var(--font-data); font-size: 0.9rem; }
.selbar__cancel { width: 40px; height: 40px; }
.selbar__acts { margin-left: auto; display: flex; gap: 0.5rem; }
.sl-group:last-of-type .sl-row:last-child { border-bottom: none; }
.sl-row:hover, .sl-row:focus-visible { background: rgba(201, 162, 75, 0.05); }
.sl-cell { min-width: 0; }
.sl-metal { display: flex; align-items: center; gap: 0.45rem; }
.sl-weight, .sl-price, .sl-spot { font-family: var(--font-data); font-variant-numeric: tabular-nums; }
.sl-piece .piece__name { font-weight: 500; }
.sl-piece .piece__meta { display: block; font-size: 0.74rem; color: var(--text-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sl-notes { font-size: 0.82rem; color: var(--text-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sl-cell[data-label]::before { content: none; }
.sl-foot { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem 1.5rem; padding: 0.9rem var(--space-3); border-top: 1px solid var(--line-strong); }
.sl-foot__label { font-family: var(--font-display); font-size: 1.05rem; color: var(--text-mute); }
.sl-foot__weights { font-family: var(--font-data); }
.sl-foot__spent { margin-left: auto; font-family: var(--font-data); font-size: 0.85rem; color: var(--text-mute); }
.sl-foot__spent strong { color: var(--text); font-size: 1rem; }
.stack-hint { margin-top: var(--space-2); text-align: center; font-size: 0.8rem; color: var(--text-mute); letter-spacing: 0.02em; }

@media (max-width: 719px) {
  /* compact single-line rows on phones (like the desktop ledger, just tighter):
     metal dot + name on the left, weight + price on the right. Spot/notes/mint
     are in the piece's detail view; we keep the list scannable on one line. */
  .sl-head { display: none; }
  .sl-row { display: flex; align-items: center; gap: 0.55rem; padding: 0.62rem var(--space-3); grid-template-columns: none; }
  .sl-metal { order: 1; flex: none; font-size: 0; }            /* keeps the 13px metal dot, drops the word */
  .sl-piece { order: 2; flex: 1 1 auto; min-width: 0; overflow: hidden; }
  .sl-piece .piece__name { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sl-piece .piece__meta { display: none; }
  .sl-weight { order: 3; flex: none; font-size: 0.9rem; color: var(--text); }
  .sl-price { order: 4; flex: none; font-size: 0.86rem; color: var(--text-mute); }
  .sl-price .qty-each { display: none; }                       /* keep the lot price tight */
  .sl-spot, .sl-notes { display: none; }
  .sl-cell[data-label]::before { content: none; }
  .sl-foot { gap: 0.5rem 1rem; }
  .sl-foot__spent { margin-left: 0; }
  /* spot cards are narrow on phones — long live prices (€3,724.73) push "/ oz" onto
     its own line on one card but not the other. Stack the unit under the price on
     both, consistently, so it reads as intentional rather than an orphaned wrap. */
  .spotcard__price { line-height: 1.18; }
  .spotcard__unit { display: block; margin-top: 0.05rem; }
  /* allocation: shrink the donut so the legend fits beside it on a phone, and let a
     long legend line drop its value instead of overflowing */
  .donut { width: 108px; height: 108px; }
  .alloc { gap: var(--space-2); }
  /* beside a narrow donut the euro value can be long; drop it onto its own indented
     line so it reads cleanly and never overflows, however large the holding */
  .alloc__legend p { flex-wrap: wrap; font-size: 0.88rem; margin-bottom: 0.55rem; }
  .alloc__legend .legend-val { flex-basis: 100%; margin-left: 1rem; font-size: 0.8rem; }
  /* keep the small caption under each holding (e.g. "Next milestone: 1000 oz") on one line */
  .stat-card__fine { font-size: 0.78rem; }
  .miniprog__label { font-size: 0.66rem; white-space: nowrap; }
}

/* =================== styled upload button + photo slot =================== */
.uploadbtn { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 46px; padding: 0.5rem 1.2rem;
  border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--text); background: var(--noir-0);
  cursor: pointer; font-weight: 500; font-size: 0.9rem; letter-spacing: 0.02em;
  transition: border-color var(--t-fast), color var(--t-fast), background-color var(--t-fast); }
.uploadbtn:hover { border-color: var(--gold); color: var(--gold-bright); background: rgba(201, 162, 75, 0.05); }
.uploadbtn:focus-within { outline: 2px solid var(--ring); outline-offset: 2px; }
.uploadbtn svg { width: 18px; height: 18px; flex: none; }
.photo-slot { margin-top: 0.6rem; }
.photo-slot:empty { display: none; }
.backdrop-row { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.bg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 0.5rem; margin-top: 0.5rem; }
.bg-thumb { aspect-ratio: 16 / 10; border-radius: 8px; border: 1px solid var(--line-strong); background-size: cover; background-position: center; cursor: pointer; position: relative; opacity: 0.5; transition: opacity var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast); }
.bg-thumb:hover { opacity: 0.82; }
.bg-thumb.is-pinned { opacity: 1; border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.bg-thumb.is-pinned::after { content: "✓"; position: absolute; top: 2px; right: 5px; color: var(--gold-bright); font-weight: 600; font-size: 0.82rem; text-shadow: 0 1px 3px rgba(0,0,0,0.85); }
.backdrop-prev { width: 128px; height: 76px; border-radius: var(--radius); background-size: cover; background-position: center; border: 1px solid var(--line-strong); flex: none; }
.backdrop-prev--empty { background: var(--noir-0); }
.backdrop-acts { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

/* native file inputs that remain (e.g. restore JSON) */
input[type="file"]:not([hidden]) { color: var(--text-mute); font-size: 0.85rem; }
input[type="file"]::file-selector-button { font: inherit; margin-right: 0.8rem; padding: 0.5rem 1rem; min-height: 40px;
  border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--noir-2); color: var(--text);
  cursor: pointer; transition: border-color var(--t-fast); }
input[type="file"]::file-selector-button:hover { border-color: var(--gold); }

/* =================== photo cropper =================== */
.crop-overlay { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center;
  background: rgba(6, 5, 4, 0.8); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); padding: var(--space-2); }
.crop-box { width: 100%; max-width: 420px; max-height: 92dvh; overflow-y: auto; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6); }
.cropper { display: flex; justify-content: center; margin-bottom: var(--space-2); }
.cropper__frame { position: relative; width: min(78vw, 320px); aspect-ratio: 1; border-radius: 14px; overflow: hidden;
  background: var(--noir-0); border: 1px solid var(--line-strong); cursor: grab; touch-action: none;
  box-shadow: inset 0 0 0 1px rgba(234, 210, 138, 0.15); }
.cropper__frame:active { cursor: grabbing; }
.cropper__frame img { position: absolute; left: 0; top: 0; max-width: none; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.cropper__grid { position: absolute; inset: 0; pointer-events: none; opacity: 0.45;
  background-image: linear-gradient(rgba(255,255,255,0.2) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.2) 1px, transparent 1px);
  background-size: 33.33% 33.33%; background-position: center; }
.crop-zoom { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.3rem; color: var(--text-mute); }
.crop-zoom svg { width: 18px; height: 18px; flex: none; }
.crop-zoom input[type="range"] { flex: 1; accent-color: var(--gold); height: 4px; }

/* =================== support / about / vpn =================== */
.donate-btn { display: inline-flex; align-items: center; gap: 0.5rem; }
.setblock--support { border-color: var(--line-strong); }
.about { text-align: center; }
.about__seal { width: min(34vw, 110px); margin: 0 auto var(--space-2); }
.about__title { font-family: var(--font-display); font-size: 1.8rem; margin-bottom: 0.3rem; }
.about__lede { font-family: var(--font-display); font-style: italic; color: var(--gold); font-size: 1.1rem; margin-bottom: var(--space-2); }
.about .muted-note { text-align: left; }
.about__links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin-top: var(--space-3); }
.about__link { text-decoration: none; }
.welcome-body { white-space: pre-wrap; }
/* 2FA setup: the manual-entry key */
.totp-key { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin: 0.4rem 0 0.7rem; }
.totp-key code { font-family: var(--font-data); font-size: 1rem; letter-spacing: 0.08em; background: var(--noir-0); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 0.5rem 0.7rem; color: var(--gold); word-break: break-all; }
/* on phones the feedback email drops to its own line under the prompt text */
@media (max-width: 719px) { .feedback-mail { display: block; margin-top: 0.25rem; word-break: break-all; } }
.lock__vpn { margin-top: var(--space-3); font-size: 0.72rem; letter-spacing: 0.04em; color: var(--text-mute); opacity: 0.8; max-width: 18rem; }

/* =================== press feedback =================== */
.btn:active { transform: scale(0.95); filter: brightness(1.1); }
.numpad__key:active { transform: scale(0.9); background: var(--noir-3); border-color: var(--gold-deep); }
.navbtn:active, .bnav:active, .seg__btn:active, .iconbtn:active,
.tapcard:active, .choice-card:active, .uploadbtn:active,
.showcase-card:active, .coll-card:active, .sl-row:active {
  transform: scale(0.97); filter: brightness(1.07);
}
.bnav__add:active { transform: scale(0.9) !important; }
/* keyboard-activated press echo */
@keyframes pressEcho { 0% { transform: scale(0.96); } 100% { transform: scale(1); } }

/* =================== celebration FX =================== */
@keyframes fxStamp {
  0% { opacity: 0; transform: scale(1.55) rotate(-4deg); }
  55% { opacity: 1; transform: scale(0.93) rotate(0deg); }
  72% { transform: scale(1.05); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes fxSweep { from { left: -60%; } to { left: 120%; } }
@keyframes fxLabel { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fxImpact { 0% { opacity: 0; transform: scale(0.6); } 30% { opacity: 0.9; } 100% { opacity: 0; transform: scale(2.2); } }

/* open / seal the vault: light sweep + wax-stamped crest */
.vaultfx { position: fixed; inset: 0; z-index: 120; display: flex; align-items: center; justify-content: center;
  background: var(--noir-0); overflow: hidden; pointer-events: none; }
.vaultfx__wax { width: min(44vw, 190px); opacity: 0; transform: scale(1.55);
  filter: drop-shadow(0 14px 34px rgba(0,0,0,0.6)); }
.vaultfx__wax img { width: 100%; display: block; }
.vaultfx__sweep { position: absolute; top: -50%; left: -60%; width: 55%; height: 200%;
  background: linear-gradient(100deg, transparent, rgba(234,210,138,0.5), transparent); transform: skewX(-12deg); }
.vaultfx__label { position: absolute; bottom: 29%; font-family: var(--font-body); font-size: 0.78rem;
  letter-spacing: 0.28em; text-transform: uppercase; color: var(--gold); opacity: 0; }
.vaultfx--open { animation: fxOpenBg 1150ms var(--ease-out) forwards; }
@keyframes fxOpenBg { 0%, 66% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }
.vaultfx--open .vaultfx__sweep { animation: fxSweep 760ms var(--ease-out) 120ms; }
.vaultfx--open .vaultfx__wax { animation: fxStamp 620ms var(--ease-out) 200ms forwards; }
.vaultfx--open .vaultfx__label { animation: fxLabel 460ms ease 560ms forwards; }
.vaultfx--seal { animation: fxSealBg 1000ms var(--ease-out) forwards; }
@keyframes fxSealBg { 0% { opacity: 0; } 16% { opacity: 1; } 68% { opacity: 1; } 100% { opacity: 0; } }
.vaultfx--seal .vaultfx__sweep { animation: fxSweep 560ms var(--ease-out) 120ms; }
.vaultfx--seal .vaultfx__wax { animation: fxStamp 520ms var(--ease-out) 200ms forwards; }
.vaultfx--seal .vaultfx__label { animation: fxLabel 420ms ease 540ms forwards; }

/* milestone: wax stamp that holds, then fades */
.waxfx { position: fixed; inset: 0; z-index: 110; display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none; animation: waxFade 2000ms forwards; }
@keyframes waxFade { 0%, 74% { opacity: 1; } 100% { opacity: 0; } }
.waxfx__disc { position: relative; width: min(38vw, 150px); opacity: 0; transform: scale(1.5);
  animation: fxStamp 640ms var(--ease-out) forwards; filter: drop-shadow(0 14px 30px rgba(0,0,0,0.55)); }
.waxfx__disc img { width: 100%; display: block; }
/* ring is nested in the disc and centred on the logo */
.waxfx__ring { position: absolute; top: 50%; left: 50%; width: 142%; aspect-ratio: 1; border-radius: 50%;
  border: 2px solid var(--gold-bright); opacity: 0; transform: translate(-50%, -50%) scale(0.6);
  animation: fxRingImpact 950ms var(--ease-out) 300ms forwards; }
@keyframes fxRingImpact { 0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6); } 30% { opacity: 0.9; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.8); } }
.waxfx__label { margin-top: var(--space-2); max-width: 80vw; text-align: center; font-family: var(--font-body);
  font-size: 0.8rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); opacity: 0;
  animation: fxLabel 500ms ease 440ms forwards; }

/* sparkle burst for adding a piece / new collection */
.sparkfx { position: fixed; inset: 0; z-index: 110; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.sparkfx--coll::after { content: ""; position: absolute; width: 44px; height: 44px; border-radius: 50%;
  border: 2px solid var(--gold-bright); opacity: 0; animation: fxImpact 820ms var(--ease-out) forwards; }
.spark { position: absolute; width: 12px; height: 12px; opacity: 0;
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
  animation: sparkPop 950ms var(--ease-out) var(--d) forwards; }
.spark.is-au { background: var(--gold-bright); box-shadow: 0 0 8px rgba(234,210,138,0.85); }
.spark.is-ag { background: var(--silver-bright); box-shadow: 0 0 8px rgba(237,240,243,0.85); }
@keyframes sparkPop {
  0% { opacity: 0; transform: translate(0,0) scale(0.2); }
  25% { opacity: 1; transform: translate(calc(var(--dx) * 0.5), calc(var(--dy) * 0.5)) scale(1.1); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.3); }
}

/* =================== reduced motion =================== */
@media (prefers-reduced-motion: reduce) {
  .view, .celebrate__ring, .iconbtn.is-spinning svg, .metal3d__sheen, .msrow__line .ms,
  .vaultfx, .vaultfx *, .waxfx, .waxfx *, .spark { animation: none !important; }
  .metal3d__sheen { opacity: 0; }
  * { transition-duration: 0.01ms !important; }
}
