/* Copied unchanged from the original Hart Treasures page (source/coin-ledger.html). Keep the look identical: change it there first. */
/* Layout: a collector's cabinet at night. Navy header plate, summary strip and spot prices, then trays of coins per collection.
   One dark look on purpose (the owner asked for a darker theme): navy, slate and muted green/blue/silver, no bright colours.
   Each collection has its own calm hue (--cat), used for its heading rule, card tint and chips. */
:root {
  --bg: #0e1520; --surface: #162131; --surface-2: #1c2a3e; --ink: #e2e8f0; --muted: #93a2b7; --line: #2a3a52;
  --navy: #1b3157; --navy-deep: #12213d; --heading: #c9d6e8;
  --velvet: #8eb0d8; --velvet-soft: #22324a;
  --gold: #c2ad76; --silver: #aab8c8; --copper: #b88a6c; --bronze: #a99470;
  --c-bullion: #9fb3c8; --c-agora: #6fa3ad; --c-base: #7fa58e; --c-jewel: #8a9fd0; --c-charms: #93a9cf; --c-other: #8ea0b5;
  --good: #7fbf9a; --bad: #d99088;
  --f-display: "Marcellus", "Trajan Pro", Georgia, serif;
  --f-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --cat: var(--c-other);
  color-scheme: dark;
}
body { background: radial-gradient(1200px 600px at 80% -10%, #18304f 0%, transparent 60%), var(--bg); background-attachment: fixed; color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.5; }
h1, h2, h3 { color: var(--heading); }
.cat-bullion { --cat: var(--c-bullion); } .cat-agora { --cat: var(--c-agora); } .cat-base { --cat: var(--c-base); }
.cat-jewel { --cat: var(--c-jewel); } .cat-charms { --cat: var(--c-charms); }
.wrap { max-width: 1180px; margin: 0 auto; padding-block: 24px 64px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
h1, h2, h3 { font-family: var(--f-display); font-weight: 400; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(28px, 4vw, 40px); letter-spacing: .04em; }
h2 { font-size: 22px; letter-spacing: .03em; }
.eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
.num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
header.top { display: flex; flex-wrap: wrap; gap: 16px; align-items: end; justify-content: space-between;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-deep) 55%, #173a3f 100%); border: 1px solid #2c4670; border-radius: 16px; padding: 22px 22px 18px; }
header.top h1 { color: #dbe5f2; }
/* the emblem: spins once when the page opens, and again when tapped */
.brand { display: flex; align-items: center; gap: 18px; min-width: 0; }
.logo-wrap { flex: none; width: clamp(64px, 11vw, 104px); perspective: 700px; cursor: pointer; }
.ht-logo { display: block; width: 100%; height: auto; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .45)); animation: ht-spin 1.9s cubic-bezier(.2, .7, .2, 1) .25s 1 both; }
.ht-logo.again { animation: ht-spin-again 1.5s cubic-bezier(.2, .7, .2, 1) 1 both; }
@keyframes ht-spin { from { transform: rotateY(-720deg) scale(.8); } to { transform: rotateY(0) scale(1); } }
@keyframes ht-spin-again { from { transform: rotateY(-720deg) scale(.9); } to { transform: rotateY(0) scale(1); } }
@media (prefers-reduced-motion: reduce) { .ht-logo, .ht-logo.again { animation: none; } }
header.top .eyebrow { color: #9fb6d3; }
nav.tabs { display: flex; flex-wrap: wrap; gap: 4px; background: rgba(10, 18, 32, .45); border: 1px solid #2c4670; border-radius: 20px; padding: 4px; }
nav.tabs button { border: 0; background: none; padding: 8px 16px; border-radius: 999px; font: 500 14px var(--f-body); color: #b4c3d8; cursor: pointer; }
nav.tabs button[aria-selected="true"] { background: linear-gradient(135deg, #3b5f8f, #2f6a6c); color: #eef3f9; }
button, .btn { font: 500 14px var(--f-body); cursor: pointer; border-radius: 8px; padding: 8px 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.btn-primary { background: linear-gradient(135deg, #3b5f8f, #33707a); border-color: #46699a; color: #eef3f9; }
.btn-ghost { background: none; border-color: transparent; color: var(--velvet); padding-inline: 6px; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--velvet); outline-offset: 2px; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: 15px var(--f-body); color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; box-sizing: border-box; }
label.f { display: grid; gap: 4px; font-size: 13px; color: var(--muted); min-width: 0; }
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-top: 24px; }
.summary > div { background: var(--surface); padding: 14px 16px; display: grid; gap: 2px; }
.summary .v { font-family: var(--f-mono); font-size: 20px; font-variant-numeric: tabular-nums; }
.pos { color: var(--good); } .neg { color: var(--bad); }
.spot { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-top: 16px; padding: 14px 16px; border: 1px dashed var(--line); border-radius: 12px; }
.spot label.f { width: 150px; }
.spot .note { font-size: 13px; color: var(--muted); flex: 1 1 220px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 28px 0 14px; }
.toolbar input[type="search"] { flex: 1 1 200px; width: auto; }
.toolbar select { width: auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.pocket { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: grid; gap: 12px; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.pocket:hover { border-color: var(--velvet); }
.pocket .head { display: flex; gap: 14px; align-items: center; }
.pocket .t { display: grid; gap: 2px; min-width: 0; }
.pocket .t strong { font-family: var(--f-display); font-weight: 400; font-size: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.chip.gold { border-color: var(--gold); color: var(--gold); }
.chip.silver { border-color: var(--silver); color: var(--silver); }
.chip.copper { border-color: var(--copper); color: var(--copper); }
.chip.bronze { border-color: var(--bronze); color: var(--bronze); }
.chip.ex { border-color: var(--velvet); color: var(--velvet); }
.chip.sold { border-color: var(--muted); color: var(--muted); }
.pocket.is-sold { opacity: .6; }
.pocket.is-sold .coin img { filter: grayscale(.7); }
.figs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.figs div { display: grid; gap: 0; } .figs span:first-child { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
/* the coin itself: uploaded image, or a struck disc placeholder in the metal's colour */
.coin { flex: none; width: 84px; aspect-ratio: 1; max-width: 100%; border-radius: 50%; overflow: hidden; display: grid; place-items: center; position: relative; }
.coin img { width: 100%; height: 100%; object-fit: cover; }
.coin.ph { background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--m) 35%, var(--surface)), var(--m) 60%, color-mix(in srgb, var(--m) 70%, var(--ink))); }
.coin.ph::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: repeating-conic-gradient(color-mix(in srgb, var(--ink) 25%, transparent) 0 1.5deg, transparent 1.5deg 4deg); -webkit-mask: radial-gradient(circle, transparent 64%, #000 66%); mask: radial-gradient(circle, transparent 64%, #000 66%); }
.coin.ph span { font-family: var(--f-display); font-size: 13px; color: var(--surface); text-align: center; line-height: 1.1; padding: 0 12px; position: relative; text-shadow: 0 1px 1px color-mix(in srgb, var(--ink) 50%, transparent); }
.coin.lg { width: 140px; } .coin.lg.ph span { font-size: 18px; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 14px; }
.status { font-size: 13px; color: var(--muted); margin-top: 8px; min-height: 1.2em; }
/* drawer */
dialog { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); padding: 0; width: min(640px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); }
dialog::backdrop { background: color-mix(in srgb, #000 45%, transparent); }
dialog form { display: grid; gap: 14px; padding: 20px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.dlg-head { display: flex; gap: 16px; align-items: center; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; }
.actions .r { display: flex; gap: 8px; margin-left: auto; }
.hint { font-size: 13px; color: var(--muted); margin: 0; }
.warn { color: var(--bad); }
/* catalogue */
.series { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: grid; gap: 14px; }
.series-head { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: baseline; }
.eras { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.era { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.era .coin { width: 64px; }
.era .t { display: grid; gap: 4px; min-width: 0; font-size: 13px; }
.era .yrs { font-family: var(--f-mono); font-size: 13px; color: var(--ink); }
.cat-list { display: grid; gap: 16px; }
.file-btn { position: relative; overflow: hidden; display: inline-block; font-size: 13px; color: var(--velvet); cursor: pointer; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
a { color: var(--velvet); }
.group { display: grid; gap: 12px; margin-bottom: 28px; }
.group-h { display: flex; gap: 10px; align-items: baseline; padding-bottom: 8px; border-bottom: 2px solid transparent;
  border-image: linear-gradient(90deg, var(--cat), color-mix(in srgb, var(--cat) 25%, transparent) 60%, transparent) 1; }
.group-h h2 { color: color-mix(in srgb, var(--cat) 55%, var(--heading)); }
.pocket, .series, .charm { background: linear-gradient(165deg, color-mix(in srgb, var(--cat) 13%, var(--surface)) 0%, var(--surface) 55%); border-color: color-mix(in srgb, var(--cat) 28%, var(--line)); }
.pocket:hover { border-color: color-mix(in srgb, var(--cat) 70%, var(--line)); }
/* coin flip: Britannia side at rest, monarch side on hover or focus */
.coin img.back { position: absolute; inset: 0; opacity: 0; transition: opacity .25s; }
.pocket:hover .coin img.back, .pocket:focus-visible .coin img.back { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .coin img.back { transition: none; } }
.sides { display: flex; gap: 12px; }
.side-lab { font-size: 11px; color: var(--muted); text-align: center; text-transform: uppercase; letter-spacing: .08em; }
.group-h .hint { margin-left: auto; }
.pocket .title { font-size: 14px; color: var(--ink); }
/* jewellery, watches and pens: small square thumbnail instead of a coin disc */
.coin.thumb { width: 56px; border-radius: 10px; }
/* home: drawers of section tiles (coin medallions that flip on hover) */
.cat-gold { --cat: var(--gold); }
.home { display: grid; gap: 30px; margin-top: 28px; }
.drawer { display: grid; gap: 14px; }
.drawer-h { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; padding-bottom: 8px; border-bottom: 2px solid transparent;
  border-image: linear-gradient(90deg, var(--cat), color-mix(in srgb, var(--cat) 25%, transparent) 60%, transparent) 1; }
.drawer-h h2 { font-size: 24px; color: color-mix(in srgb, var(--cat) 60%, var(--heading)); }
.drawer-h .sum { margin-left: auto; font-size: 14px; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.tile { display: grid; justify-items: center; align-content: start; gap: 8px; text-align: center; padding: 18px 12px 14px; border-radius: 16px; cursor: pointer; min-width: 0;
  background: linear-gradient(170deg, color-mix(in srgb, var(--cat) 16%, var(--surface)) 0%, var(--surface) 60%); border: 1px solid color-mix(in srgb, var(--cat) 30%, var(--line)); color: inherit; font: inherit; }
.tile:hover, .tile:focus-visible { border-color: color-mix(in srgb, var(--cat) 75%, var(--line)); }
.tile.empty-t { opacity: .72; }
.tile h3 { font-size: 17px; line-height: 1.2; }
.tile .meta { font-size: 12.5px; color: var(--muted); }
.medal { position: relative; width: min(128px, 70%); aspect-ratio: 1; max-width: 100%; border-radius: 50%; overflow: hidden; background: #f3f3f1;
  box-shadow: 0 10px 22px rgba(0, 0, 0, .45), 0 0 0 3px color-mix(in srgb, var(--cat) 45%, transparent); }
.medal img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity .35s; }
.medal img.back { opacity: 0; }
.tile:hover .medal img.back, .tile:focus-visible .medal img.back { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .medal img { transition: none; } }
.medal.ph { background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--m) 45%, #fff), color-mix(in srgb, var(--m) 85%, #0e1520) 70%); display: grid; place-items: center; }
.medal.ph span { font-family: var(--f-display); color: #0e1520; font-size: 14px; padding: 0 12px; line-height: 1.15; }
.medal.sq { border-radius: 20px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; margin-top: 24px; }
.crumbs h2 { font-size: 26px; }
@media (max-width: 520px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  header.top { padding: 16px; }
  nav.tabs button { padding: 7px 11px; font-size: 13px; }
}
/* decision log */
.dec-list { display: grid; gap: 12px; }
.dec { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: grid; gap: 8px; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.dec:hover { border-color: var(--velvet); }
.dec-top { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: baseline; }
.dec-top .num { color: var(--muted); font-size: 13px; }
.dec-top .chip { margin-left: auto; }
.dec h3 { font-family: var(--f-body); font-weight: 600; font-size: 15px; }
.dec dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; font-size: 14px; }
.dec dt { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; padding-top: 2px; }
.dec dd { margin: 0; white-space: pre-line; min-width: 0; }
.chip.open { border-color: var(--bad); color: var(--bad); }
.chip.decided { border-color: var(--good); color: var(--good); }
@media (max-width: 480px) { .dec dl { grid-template-columns: 1fr; } }
/* Pandora charm wall: picture tiles with an "I have this" tick */
.ch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.charm { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px; display: grid; gap: 6px; align-content: start; min-width: 0; }
.charm.have { border-color: var(--good); box-shadow: inset 0 0 0 1px var(--good); }
.ch-img { aspect-ratio: 3 / 4; max-width: 100%; border-radius: 8px; background-color: #f7f7f7; background-repeat: no-repeat; }
.ch-name { font-size: 13px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.ch-meta { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.ch-own { display: flex; gap: 6px; align-items: center; font-size: 13px; font-weight: 500; cursor: pointer; }
.ch-own input { width: 18px; height: 18px; accent-color: var(--good); margin: 0; }
.ch-wish { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; padding: 0; border-radius: 50%; background: var(--surface); color: var(--velvet); font-size: 16px; line-height: 1; }
.ch-wish[aria-pressed="true"] { background: var(--velvet); color: var(--surface); border-color: var(--velvet); }
.ch-mine { position: absolute; top: 12px; left: 12px; }
.ch-photo { display: flex; flex-wrap: wrap; gap: 2px 8px; }
/* jewellery box: owned charms with their value, above the catalogue */
.seg { display: inline-flex; gap: 4px; padding: 4px; margin: 14px 0 6px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); }
.seg button { border: 0; background: none; padding: 8px 16px; border-radius: 999px; color: var(--muted); }
.seg button[aria-selected="true"] { background: linear-gradient(135deg, #3b5f8f, #33707a); color: #eef3f9; }
.box-head { display: flex; flex-wrap: wrap; gap: 10px 32px; align-items: end; margin: 14px 0 4px; padding: 16px 18px; border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--cat) 35%, var(--line)); background: linear-gradient(165deg, color-mix(in srgb, var(--cat) 16%, var(--surface)), var(--surface) 60%); }
.box-head > div { display: grid; gap: 2px; }
.box-head b { font-size: 24px; font-weight: 400; }
.box-head .hint { flex: 1 1 260px; margin: 0; }
.box-val { display: grid; gap: 3px; font-size: 12px; color: var(--muted); }
.box-val input { padding: 6px 8px; font-size: 14px; }
/* ownership: a quick-view strip per section, and a line on each piece */
.own-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 12px 0 4px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.own-panel .eyebrow { flex-basis: 100%; }
.own-chip { display: grid; gap: 1px; padding: 6px 12px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--cat) 35%, var(--line)); background: color-mix(in srgb, var(--cat) 10%, var(--bg)); }
.own-chip b { font-weight: 500; font-size: 14px; }
.own-chip .num { font-size: 13px; color: var(--muted); }
.own-chip.muted { border-style: dashed; opacity: .8; }
.own-edit { display: grid; gap: 6px; padding: 10px 12px; border-radius: 10px; border: 1px dashed var(--line); }
.own-lab { font-size: 13px; color: var(--muted); }
.own-line { font-size: 12.5px; }
.own-btn { font-size: 12.5px; padding: 2px 0; text-align: left; }
.ch-photo .btn-ghost { font-size: 12px; padding: 2px 0; }
.photo-actions { justify-content: flex-start; gap: 8px 16px; }
/* Agoro wall: square product pictures with a quantity stepper */
.ag-img { aspect-ratio: 1; background-color: #fff; }
.qty { display: flex; align-items: center; gap: 8px; }
.qty button { width: 36px; height: 36px; padding: 0; border-radius: 50%; font-size: 18px; line-height: 1; }
.qty span { min-width: 2ch; text-align: center; font-size: 16px; }
.medal .spr { position: absolute; inset: 0; background-repeat: no-repeat; background-color: #fff; }
.coin.thumb::before { display: none; }
.coin.thumb.ph span { font-size: 11px; padding: 0 4px; }
@media (prefers-reduced-motion: no-preference) { .pocket { transition: border-color .15s; } }
