/* ═════════ 韫椟录 · the ledger kept in the box ("a fine jade, hidden in its casket") ═════════ */
:root {
  /* the same world as the gate: green-black night, a cold green-grey for lines and chrome, old gold
     and brass for what matters, phosphor green for gains and blood for losses */
  --moss: #c9a96a;                       /* chrome accent: the inscription's old gold */
  --moss-dim: rgba(201, 169, 106, .14);
  --brass: #b08d57;
  --gold: #c9a96a;
  --panel: rgba(8, 11, 10, .86);
  --line: rgba(176, 141, 87, .2);         /* brass hairlines, as on the box */
  --up: #8fe3b0;                          /* phosphor */
  --down: #d65446;                        /* blood */
  --c-btc: #d9a648;                       /* ember gold */
  --c-stock: #8fe3b0;                     /* phosphor green */
  --c-bond: #c4d2d6;                      /* moonlight silver */
  --c-gold: #e4c76b;                      /* sunlit bullion */
  --c-cash: #9378cf;                      /* the violet in the gate's fog */
  --c-other: #7aa3b8;                     /* slate mist */
  --num: "Newsreader", "Noto Serif SC", "Songti SC", "STSong", serif;
  --fig: "Cormorant Garamond", "Noto Serif SC", serif;
}

/* optional Chinese convention: red up, green down */
.vault[data-palette="cn"] {
  --up: #e26458;
  --down: #74cf9b;
}

.vault {
  --ink-dim: #8f9c95;
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  opacity: 0;
  transition: opacity 1.6s ease .2s;
  background: #050706;
}
/* the night itself: a fixed layer (background-attachment: fixed repaints and judders on scroll) */
.vault::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 75% -5%, rgba(160, 190, 175, .16), transparent 60%),
    linear-gradient(180deg, #050706 0%, #060908 45%, #020303 100%);
}
.vault.in { opacity: 1; }

.moon {
  position: fixed; top: -60px; right: 8vw; width: 220px; height: 220px; border-radius: 50%; z-index: 0;
  background: radial-gradient(circle at 45% 45%, rgba(230, 238, 228, .24), rgba(185, 205, 190, .06) 45%, transparent 70%);
  filter: blur(6px);
  pointer-events: none;
}

.forest { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
/* the same dead wood as at the gate (img/forest-*.svg), standing at both edges, still while the
   ledger scrolls; their inner edges melt into the clearing */
.forest::before, .forest::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: min(34vw, 46vh);
  background: url(/img/forest-l.svg) left bottom / auto 100% no-repeat;
  -webkit-mask-image: linear-gradient(to right, #000 45%, transparent);
  mask-image: linear-gradient(to right, #000 45%, transparent);
  opacity: .85;
}
.forest::before { left: 0; }
.forest::after {
  right: 0; background-image: url(/img/forest-r.svg); background-position: right bottom;
  -webkit-mask-image: linear-gradient(to left, #000 45%, transparent);
  mask-image: linear-gradient(to left, #000 45%, transparent);
}
.mist { position: absolute; left: -20%; right: -20%; height: 30vh; filter: blur(24px); }
.mist.m1 { bottom: 18vh; background: radial-gradient(ellipse 50% 50% at 50% 50%, rgba(160, 190, 175, .10), transparent 70%); animation: drift 46s ease-in-out infinite alternate; }
.mist.m2 { bottom: 2vh;  background: radial-gradient(ellipse 45% 50% at 40% 50%, rgba(160, 190, 175, .12), transparent 70%); animation: drift 34s ease-in-out infinite alternate-reverse; }

.ledger {
  position: relative; z-index: 2;
  max-width: 1180px; margin: 0 auto;
  padding:
    calc(28px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    calc(60px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  display: grid; gap: 18px;
  grid-template-columns: minmax(0, 1fr); /* let wide tables scroll inside their panel */
}

/* header */
.v-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding: 6px 0 10px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand { gap: 16px; }
/* the sign on the box's faces, glowing as it does there: this is the inside of that box */
.brand-sig {
  width: 46px; height: 46px; color: var(--eerie, #8fe3b0);
  filter: drop-shadow(0 0 4px rgba(143, 227, 176, .7)) drop-shadow(0 0 12px rgba(143, 227, 176, .3));
  animation: brandBreath 4.5s ease-in-out infinite;
}
@keyframes brandBreath { 0%, 100% { opacity: .6; } 50% { opacity: 1; } }
/* the title in the inscription's old gold; beneath it, in the name's own face, its motto —
   FESTINA LENTE, make haste slowly — after the looped knot that parts the inscription on the sword */
.brand h1 {
  margin: 0; font: 500 24px/1.1 var(--cn); letter-spacing: .32em; color: var(--gold);
  text-shadow: 0 0 8px rgba(214, 178, 105, .3), 0 1px 1px #000;
}
.brand p {
  display: flex; align-items: center; gap: 8px;
  margin: 7px 0 0; font: 400 12px/1 "Cinzel Decorative", "Cinzel", serif; letter-spacing: .34em; text-transform: uppercase;
  color: rgba(201, 169, 106, .62);
}
.brand p::before {
  content: ""; flex: none; width: 10px; height: 10px; background: currentColor;
  -webkit-mask: url(/img/knot.svg) center / contain no-repeat; mask: url(/img/knot.svg) center / contain no-repeat;
}
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }

button.ghost, button.seal, select {
  font: 500 13px/1 var(--cn); letter-spacing: .12em;
  padding: 10px 14px; border-radius: 2px; cursor: pointer;
  color: #d3dbd3; background: rgba(10, 15, 13, .76);
  border: 1px solid var(--line);
  transition: border-color .2s, box-shadow .2s, background .2s;
}
select {
  appearance: none; -webkit-appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%23c9a96a' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 12px 12px;
}
button.ghost:hover, select:hover { border-color: rgba(201, 169, 106, .5); }
button.seal { background: rgba(201, 169, 106, .08); border-color: rgba(201, 169, 106, .4); color: var(--gold); }
button.seal:hover { box-shadow: 0 0 18px rgba(201, 169, 106, .25); background: rgba(201, 169, 106, .14); }
button:disabled { opacity: .5; cursor: progress; }
button:focus-visible, select:focus-visible { outline: 1px solid var(--gold); outline-offset: 2px; }

.status {
  font-size: 12px; letter-spacing: .1em; color: var(--ink-dim); padding-right: 6px;
  /* fixed slot: "已解封" → "誊写中…" → "已封存 · 10:21" must not shove the buttons around */
  display: inline-block; min-width: 11.5em; text-align: right; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
#btc-price { width: 8.5em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.status::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: currentColor; vertical-align: 1px; box-shadow: 0 0 8px currentColor; }
.status.ok { color: var(--up); }
.status.pending { color: #e2c46a; }
.status.bad { color: var(--down); }

/* summary */
/* net worth on the left, the four P/L cards in a 2×2 beside it */
.summary { display: grid; grid-template-columns: 1.25fr repeat(2, minmax(0, 1fr)); gap: 14px; }
.summary .hero { grid-row: span 2; display: flex; flex-direction: column; justify-content: center; }
.stat .big { white-space: nowrap; }
.stat, .panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 2px;
  /* no backdrop-filter: blurring the animated sky/fireflies under every panel each frame made
     panels flicker on some GPUs; a denser panel reads the same and is far cheaper */
  box-shadow: 0 20px 50px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .03);
}
/* keep ornate brass corners for primary book-pages (panels + Hero net worth), leaving secondary
   cards cleaner so boundaries don't compete */
.panel, .summary .hero {
  background:
    url(/img/corner-tl.svg) 4px 4px / 15px 15px no-repeat,
    url(/img/corner-br.svg) right 4px bottom 4px / 15px 15px no-repeat,
    var(--panel);
}
.stat { padding: 18px 18px 16px; overflow: hidden; }
.stat:not(.hero) {
  border-color: rgba(176, 141, 87, .14);
  box-shadow: 0 14px 36px rgba(0, 0, 0, .35), inset 2px 0 0 rgba(176, 141, 87, .3);
}
.stat:not(.hero).up { box-shadow: 0 14px 36px rgba(0, 0, 0, .35), inset 2px 0 0 rgba(143, 227, 176, .55); }
.stat:not(.hero).down { box-shadow: 0 14px 36px rgba(0, 0, 0, .35), inset 2px 0 0 rgba(214, 84, 70, .58); }
.vault[data-palette="cn"] .stat:not(.hero).up { box-shadow: 0 14px 36px rgba(0, 0, 0, .35), inset 2px 0 0 rgba(226, 100, 88, .58); }
.vault[data-palette="cn"] .stat:not(.hero).down { box-shadow: 0 14px 36px rgba(0, 0, 0, .35), inset 2px 0 0 rgba(116, 207, 155, .55); }
.stat::after {
  content: ""; position: absolute; inset: auto -30% -60% auto; width: 160px; height: 160px; border-radius: 50%;
  background: radial-gradient(circle, rgba(170, 192, 178,.10), transparent 70%);
}
.stat.down::after { background: radial-gradient(circle, rgba(214, 84, 70, .12), transparent 70%); }
.stat h3, .panel h2 { margin: 0; font: 500 13px/1 var(--cn); letter-spacing: .25em; color: #cdb98d; }
.panel h2::before {
  content: ""; display: inline-block; width: 11px; height: 11px; margin: 0 9px 0 0; vertical-align: -1px;
  background: var(--brass);
  -webkit-mask: url(/img/knot.svg) center / contain no-repeat; mask: url(/img/knot.svg) center / contain no-repeat;
}
.stat h3 small, .panel h2 small { margin-left: 8px; font: 400 10px/1 "Cinzel", var(--cn); letter-spacing: .2em; color: var(--ink-dim); }
.big { margin: 14px 0 6px; font: 600 clamp(22px, 2.6vw, 32px)/1.1 var(--fig); color: #ecefe8; font-variant-numeric: lining-nums tabular-nums; letter-spacing: .02em; }
.hero .big { font-size: clamp(28px, 3.4vw, 42px); text-shadow: 0 0 22px rgba(170, 192, 178, .25); }
/* the net worth is the heart of the page: centred, in old gold, a blade of light beneath it */
.summary .hero { align-items: center; text-align: center; }
.summary .hero .big { color: var(--gold); text-shadow: 0 0 18px rgba(214, 178, 105, .3), 0 1px 1px #000; font-size: clamp(32px, 4vw, 50px); }
.summary .hero .big::after {
  content: ""; display: block; height: 1px; margin: 14px auto 0; width: 80%;
  background: linear-gradient(90deg, transparent, rgba(201, 169, 106, .55) 30%, rgba(255, 236, 190, .8) 50%, rgba(201, 169, 106, .55) 70%, transparent);
}
.summary .hero::after { background: radial-gradient(circle, rgba(214, 178, 105, .1), transparent 70%); }
.stat.up .big { color: var(--up); }
.stat.down .big { color: var(--down); }
.sub { margin: 0; font-size: 12px; color: var(--ink-dim); letter-spacing: .06em; font-family: var(--num); font-variant-numeric: tabular-nums; }
.sub + .sub { margin-top: 5px; font-size: 11px; opacity: .88; }
.hero-mix {
  display: flex; width: min(220px, 76%); height: 3px; margin-top: 10px; gap: 2px;
  border-radius: 2px; overflow: hidden; opacity: .88;
}
.hero-mix i { display: block; height: 100%; width: var(--w, 0); transition: width .8s ease; }
.hero-mix .inv { background: linear-gradient(90deg, var(--gold), var(--up)); }
.hero-mix .csh { background: var(--c-cash); }

.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: stretch; }
.grid2 > .panel { display: flex; flex-direction: column; }
.grid2 .alloc { flex: 1; align-content: center; }
.panel { padding: 20px 18px 18px; }
.panel > h2, .panel-head { margin-bottom: 16px; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.panel-head h2 { margin: 0; }

/* allocation */
.alloc { display: grid; grid-template-columns: 180px 1fr; gap: 22px; align-items: center; }
.donut { width: 180px; height: 180px; transform: rotate(-90deg); overflow: visible; }
.donut circle { fill: none; stroke-width: 15; }
.donut .track { stroke: rgba(255, 255, 255, .04); }
.donut .inner-ring { stroke: rgba(176, 141, 87, .28); stroke-width: .9; stroke-dasharray: 2 4; }
.donut .arc { transition: stroke-dasharray .8s ease, stroke-width .22s ease, opacity .25s ease; filter: drop-shadow(0 0 5px currentColor); cursor: pointer; }
.donut .arc:hover, .donut .arc.on { stroke-width: 19; filter: drop-shadow(0 0 8px currentColor); }
.donut.filtered .arc:not(.on) { opacity: .28; }
.donut text { transform: rotate(90deg); transform-origin: 90px 90px; text-anchor: middle; fill: #ecefe8; }
.d-label { font: 400 9px "Cinzel", serif; letter-spacing: .3em; fill: var(--ink-dim) !important; }
.d-value { font: 600 18px var(--fig); font-variant-numeric: lining-nums tabular-nums; }
.arc.btc, .dot.btc, .bar i.btc { color: var(--c-btc); stroke: var(--c-btc); background: var(--c-btc); }
.arc.stock, .dot.stock, .bar i.stock { color: var(--c-stock); stroke: var(--c-stock); background: var(--c-stock); }
.arc.bond, .dot.bond, .bar i.bond { color: var(--c-bond); stroke: var(--c-bond); background: var(--c-bond); }
.arc.gold, .dot.gold, .bar i.gold { color: var(--c-gold); stroke: var(--c-gold); background: var(--c-gold); }
.arc.cash, .dot.cash, .bar i.cash { color: var(--c-cash); stroke: var(--c-cash); background: var(--c-cash); }
.arc.other, .dot.other, .bar i.other { color: var(--c-other); stroke: var(--c-other); background: var(--c-other); }

.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.legend li {
  display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "dot name pct" "bar bar bar" "rebal rebal val";
  gap: 5px 10px; align-items: center;
  padding: 5px 8px; margin: 0 -8px; border-radius: 3px; cursor: pointer;
  border: 1px solid transparent; transition: background .2s, border-color .2s;
}
.legend li:hover { background: rgba(170, 192, 178, .05); }
.legend li.on { background: rgba(201, 169, 106, .08); border-color: rgba(201, 169, 106, .35); }
.legend .dot { grid-area: dot; }
.lg-name { grid-area: name; font-size: 13.5px; letter-spacing: .12em; }
.lg-name small { margin-left: 8px; font: 10px "Cinzel", serif; color: var(--ink-dim); letter-spacing: .12em; }
.lg-pct { grid-area: pct; font: 600 18px var(--fig); color: #ecefe8; font-variant-numeric: lining-nums tabular-nums; }
.lg-val { grid-area: val; justify-self: end; font: 400 12px var(--num); color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.lg-rebal { grid-area: rebal; font: 400 11px var(--num); color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.lg-rebal b { font-weight: 500; }
.lg-rebal b.up { color: var(--up); }
.lg-rebal b.down { color: var(--down); }
.bar { grid-area: bar; position: relative; height: 4px; background: rgba(255, 255, 255, .05); border-radius: 2px; overflow: visible; }
.bar i { display: block; height: 100%; width: var(--w, 0); border-radius: 2px; box-shadow: 0 0 8px currentColor; transition: width .8s ease; }
.bar .tgt-mark {
  position: absolute; top: -3px; bottom: -3px; width: 2px; left: var(--t, 0%);
  background: var(--gold); box-shadow: 0 0 5px rgba(201, 169, 106, .8); border-radius: 1px; pointer-events: none;
}
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 10px; box-shadow: 0 0 8px currentColor; flex: none; }
.panel-act { font-size: 11.5px !important; padding: 6px 10px !important; letter-spacing: .1em !important; }

/* trend */
.trend .spark { width: 100%; height: 160px; display: block; }
.spark path { fill: none; stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.spark .val { stroke: var(--moss); filter: drop-shadow(0 0 4px rgba(201, 169, 106, .5)); }
.spark .cost { stroke: rgba(169, 163, 214, .6); stroke-dasharray: 4 4; }
.spark .area { fill: url(#areaGrad); stroke: none; }
.trend-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  min-height: 150px; padding: 18px 12px; text-align: center;
  color: var(--ink-dim); font-size: 12.5px; letter-spacing: .12em;
}
.trend-empty svg { width: 42px; height: 42px; color: rgba(201, 169, 106, .32); }
.trend-meta { display: flex; justify-content: space-between; margin: 8px 0 6px; font-size: 11px; color: var(--ink-dim); letter-spacing: .08em; }
.trend-meta .lg { display: inline-block; width: 14px; height: 2px; margin: 0 6px 3px 12px; vertical-align: middle; }
.trend-meta .lg.val { background: var(--moss); }
.trend-meta .lg.cost { background: rgba(169, 163, 214, .7); }
.trend b { font-weight: 500; color: #e2e7df; }

/* tables */
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; min-width: 640px; }
th, td { padding: 11px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid rgba(170, 192, 178, .06); font-size: 13px; }
td { font-family: var(--num); font-variant-numeric: lining-nums tabular-nums; }
thead th { font-weight: 500; font-size: 12px; letter-spacing: .16em; color: #cdb888; border-bottom-color: var(--line); }
tbody th, tfoot th, thead th:first-child { text-align: left; font-weight: 500; }
tbody th small { display: block; margin: 3px 0 0 18px; font-size: 10.5px; letter-spacing: .1em; color: var(--ink-dim); font-weight: 400; font-family: var(--num); }
tbody tr { transition: background .2s; }
tbody tr:hover { background: rgba(201, 169, 106, .04); }
@media (min-width: 1025px) {
  tbody tr:not(.sub-row):hover th:first-child { box-shadow: inset 2px 0 0 rgba(201, 169, 106, .6); }
}
tbody tr.clickable { cursor: pointer; }
tbody tr.is-closed { opacity: .62; }
tfoot th, tfoot td { border-bottom: none; border-top: 1px solid rgba(170, 192, 178, .22); color: #ecefe8; font-weight: 500; padding-top: 13px; }
td.up, b.up { color: var(--up); }
td.down, b.down { color: var(--down); }
td.empty, p.empty { text-align: center; color: var(--ink-dim); font-size: 13px; letter-spacing: .15em; padding: 26px 10px; }
.cell-stack small { display: block; margin-top: 2px; font-size: 11px; color: var(--ink-dim); font-weight: 400; }
.cell-stack.up small, .cell-stack.down small { color: inherit; opacity: .85; }
.div-tag { display: inline-block; margin-left: 5px; padding: 1px 5px; border-radius: 2px; font-size: 10px; color: var(--gold); border: 1px solid rgba(201, 169, 106, .35); vertical-align: 1px; }
.closed-tag { display: inline-block; margin-left: 6px; padding: 1px 5px; border-radius: 2px; font-size: 10px; color: var(--ink-dim); border: 1px solid var(--line); vertical-align: 1px; }
.acts { width: 1%; }
button.icon { all: unset; cursor: pointer; padding: 4px 8px; color: var(--ink-dim); font-size: 14px; border-radius: 2px; }
button.icon:hover { color: var(--moss); background: rgba(170, 192, 178,.08); }
button.icon[data-act="del"]:hover { color: var(--down); background: rgba(255,107,122,.08); }

.v-foot { text-align: center; font-size: 11px; letter-spacing: .2em; color: rgba(111, 124, 117, .8); padding-top: 18px; }
.v-foot p { margin: 0; }
.v-foot .site-mark { margin: 0 0 12px; }

/* dialogs */
.dlg {
  width: min(440px, calc(100vw - 32px));
  padding: 0; border: 1px solid rgba(176, 141, 87, .35); border-radius: 2px;
  /* framed like the ledger's panels: brass corner pieces on green-black */
  background:
    url(/img/corner-tl.svg) 5px 5px / 18px 18px no-repeat,
    url(/img/corner-br.svg) right 5px bottom 5px / 18px 18px no-repeat,
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(201, 169, 106, .06), transparent 70%),
    linear-gradient(180deg, #0c100e, #060807);
  color: var(--ink);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .8), 0 0 40px rgba(176, 141, 87, .08);
}
.dlg::backdrop { background: rgba(0, 3, 2, .74); backdrop-filter: blur(3px); animation: fadeIn .18s ease-out; }
.dlg[open] { animation: dlgIn .2s cubic-bezier(.2, .8, .2, 1); }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes dlgIn { from { opacity: 0; transform: translateY(8px) scale(.97); } }
.dlg form { display: grid; gap: 12px; padding: 22px; }
.dlg h3 { margin: 0 0 4px; font: 500 17px var(--cn); letter-spacing: .3em; color: var(--gold); text-shadow: 0 0 8px rgba(214, 178, 105, .25); }
.dlg h3::before {
  content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 10px; vertical-align: -1px; background: var(--brass);
  -webkit-mask: url(/img/knot.svg) center / contain no-repeat; mask: url(/img/knot.svg) center / contain no-repeat;
}
.dlg label { display: grid; gap: 6px; font-size: 12px; letter-spacing: .15em; color: rgba(205, 185, 141, .75); }
.dlg label[hidden] { display: none; }
.dlg input, .dlg select {
  width: 100%; padding: 10px 4px 9px; border-radius: 0;
  /* written on a line, like the incantation at the gate: no box, a brass rule beneath */
  background: transparent; color: #ecefe8;
  border: 0; border-bottom: 1px solid rgba(176, 141, 87, .45);
  font: 15px var(--cn); letter-spacing: .04em;
  transition: border-color .2s, box-shadow .2s;
}
.dlg select {
  background-color: rgba(0, 0, 0, .25); padding-inline: 8px 28px;
  background-position: right 8px center;
}
.dlg select option { background: #0c100e; }
.dlg input:focus-visible, .dlg select:focus-visible { outline: none; border-bottom-color: var(--gold); box-shadow: 0 6px 10px -8px rgba(214, 178, 105, .8); }
.dlg-acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.hint { margin: 0; font-size: 12px; color: #c9a86a; line-height: 1.7; }
.msg { margin: 0; min-height: 1.2em; font-size: 12px; color: var(--up); }
.msg.bad { color: var(--down); }

@media (max-width: 560px) {
  /* phones: bottom sheet with grabber, sticky header & action bar for comfortable thumb reach */
  .dlg, .dlg.wide {
    margin: auto 0 0; width: 100vw; max-width: 100vw; max-height: 88dvh;
    border-radius: 12px 12px 0 0; border-bottom: 0; border-inline: 0;
  }
  .dlg::before {
    content: ""; display: block; width: 36px; height: 3px; margin: 10px auto 0;
    border-radius: 999px; background: rgba(201, 169, 106, .35);
  }
  .dlg[open] { animation: sheetIn .24s cubic-bezier(.2, .85, .25, 1); }
  @keyframes sheetIn { from { opacity: 0; transform: translateY(28px); } }
  .dlg form, .dlg .dlg-body {
    max-height: calc(88dvh - 14px); overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: 0 18px calc(16px + env(safe-area-inset-bottom));
  }
  .dlg h3 {
    position: sticky; top: 0; z-index: 2; margin: 0 -18px 4px; padding: 14px 18px 12px;
    background: linear-gradient(180deg, #0c100e 82%, rgba(12, 16, 14, 0));
  }
  .dlg-acts {
    position: sticky; bottom: calc(-16px - env(safe-area-inset-bottom)); z-index: 2;
    margin: 8px -18px calc(-16px - env(safe-area-inset-bottom));
    padding: 12px 18px calc(14px + env(safe-area-inset-bottom));
    background: linear-gradient(0deg, #060807 82%, rgba(6, 8, 7, 0));
    border-top: 1px solid rgba(176, 141, 87, .16);
  }
}

@media (max-width: 900px) {
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary .hero { grid-column: 1 / -1; grid-row: auto; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  /* Hero full-width + compact 2x2 P/L grid: saves one full row on phones */
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .summary .hero { grid-column: 1 / -1; }
  .stat { padding: 14px 14px 12px; }
  .stat:not(.hero) { padding: 12px 12px 11px; }
  .stat h3 { font-size: 12px; letter-spacing: .16em; }
  .stat h3 small { display: none; }
  .stat:not(.hero) .big { font-size: 20px; margin: 8px 0 4px; }
  .stat:not(.hero) .sub { font-size: 11px; letter-spacing: .02em; }
  .alloc { grid-template-columns: 1fr; justify-items: center; }
  .legend { width: 100%; }
  .brand h1 { font-size: 20px; }
}

/* trade history (expanded under a position row) */
button.icon sup { font-size: 9px; margin-left: 2px; color: var(--ink-dim); }
button.icon.on { color: var(--moss); background: rgba(170, 192, 178,.08); }
.hist-sum { margin: 0 0 6px; font-size: 12px; letter-spacing: .1em; color: var(--ink-dim); }
.kind { display: inline-block; padding: 2px 8px; border-radius: 2px; font-size: 11px; letter-spacing: .15em; border: 1px solid var(--line); }
.kind.buy { color: var(--up); border-color: rgba(126, 226, 166, .3); }
.kind.sell { color: var(--down); border-color: rgba(255, 107, 122, .3); }
.kind.div { color: #e2c46a; border-color: rgba(226, 196, 106, .38); }
.kind.set { color: #c9a86a; border-color: rgba(201, 168, 106, .3); }
.dlg .hint[hidden], .dlg .msg:empty { display: none; }
td.plats { max-width: 170px; overflow: hidden; text-overflow: ellipsis; color: #b9c9c0; font-family: var(--cn); }
.hist-sum + table { margin-top: 2px; }
button.expand, span.expand { all: unset; cursor: pointer; display: inline-block; width: 16px; margin-left: -4px; color: var(--ink-dim); font-size: 11px; text-align: center; }
button.expand:hover, tr.open button.expand { color: var(--moss); }
button.expand:focus-visible { outline: 1px solid var(--moss); }
tbody th small { margin-left: 30px; }
.dlg.wide { width: min(920px, calc(100vw - 32px)); }
.dlg-body { display: grid; gap: 12px; padding: 22px; }
.dlg-body .hist-sum { margin: 0; }
.dlg-body table.trades { min-width: 740px; }
.dlg-body table.trades th, .dlg-body table.trades td { padding: 9px 9px; font-size: 12.5px; }
.dlg-body table.trades thead th { font-size: 10.5px; }
.dlg-body td.note { text-align: left; color: var(--ink-dim); white-space: normal; min-width: 80px; font-family: var(--cn); }
span.expand { cursor: default; }

/* tablets & phones: keep the asset / platform column pinned while tables scroll sideways */
@media (max-width: 1024px) {
  .scroll tbody th:first-child, .scroll thead th:first-child, .scroll tfoot th:first-child {
    position: sticky; left: 0; z-index: 1;
    background: #080b0a;
    box-shadow: 1px 0 0 var(--line);
  }
  .scroll tbody tr:hover th:first-child { background: #0d1310; }
  .scroll tr.sub-row th:first-child { background: #060908; box-shadow: inset 2px 0 0 rgba(170, 192, 178, .35), 1px 0 0 var(--line); }
}
@media (min-width: 700px) and (max-width: 1024px) {
  .ledger { gap: 16px; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .summary .hero { grid-column: 1 / -1; grid-row: auto; }
  .stat { padding: 14px 14px 12px; }
  .grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .alloc { grid-template-columns: 1fr; justify-items: center; }
  .legend { width: 100%; }
}
/* touch screens: larger hit targets */
@media (pointer: coarse) {
  button.icon { padding: 9px 10px; }
  button.expand { width: 28px; padding: 8px 0; margin-left: -8px; }
  span.expand { width: 20px; }
  button.ghost, button.seal, select { padding: 12px 14px; }
  .dlg input, .dlg select { padding: 12px; font-size: 16px; }
}
@media (max-width: 520px) {
  .v-head { gap: 12px; }
  .panel { padding: 16px 12px 14px; }
}

/* expanded per-platform rows: same columns as the asset row above */
tr.sub-row th, tr.sub-row td { padding-top: 8px; padding-bottom: 8px; font-size: 12.5px; color: #b3bcb3; background: rgba(0, 0, 0, .22); border-bottom-color: rgba(170, 192, 178, .04); }
tr.sub-row th { font-weight: 400; padding-left: 30px; box-shadow: inset 2px 0 0 rgba(170, 192, 178, .35); }
tr.sub-row th small { display: inline; margin: 0 0 0 6px; }
tr.sub-row td.up { color: var(--up); }
tr.sub-row td.down { color: var(--down); }
tr.sub-row:hover { background: transparent; }
.sub-mark { margin-right: 8px; color: rgba(170, 192, 178, .5); }
/* date, platform, action and note read left-to-right; amounts stay right-aligned */
.dlg-body table.trades th:nth-child(-n+3), .dlg-body table.trades td:nth-child(-n+3),
.dlg-body table.trades th.note-h, .dlg-body table.trades td.note { text-align: left; }

/* ═════════ night sky ═════════ */
.forest .stars { position: absolute; inset: 0; width: 100%; height: 100%; }

/* ═════════ veil: woodland mist hiding amounts until looked at ═════════ */
/* :where() keeps these selectors light so a revealed row/card always wins */
.vault.veiled .ledger :where(.stat .big, .stat .sub, .lg-pct, .lg-val, .lg-rebal, .d-value, .trend .sub b, .trend .ylab, .trend-tip, .trend-metrics b, .scroll td:not(.acts):not(.empty)) {
  filter: blur(5px);
  opacity: .55;
  transition: filter .35s ease, opacity .35s ease;
}
/* hover reveals only after the pointer rests a moment, so sweeping across rows doesn't flicker */
@media (hover: hover) {
  .vault.veiled .ledger :where(.stat, .alloc, .trend, tr):hover :where(.big, .sub, .lg-pct, .lg-val, .lg-rebal, .d-value, b, td, .ylab, .trend-tip) { transition-delay: .22s; }
}
.vault.veiled .ledger .reveal :where(.big, .sub, .lg-pct, .lg-val, .lg-rebal, .d-value, b, td, .ylab, .trend-tip) { filter: none; opacity: 1; }
@media (hover: hover) {
  .vault.veiled .ledger :where(.stat, .alloc, .trend, tr):hover :where(.big, .sub, .lg-pct, .lg-val, .lg-rebal, .d-value, b, td, .ylab, .trend-tip) { filter: none; opacity: 1; }
}
/* unified compact eye icon on both desktop & mobile */
.v-head .tools #veil.veil-btn {
  display: inline-flex; align-items: center; justify-content: center; position: relative;
  width: 38px; height: 35px; padding: 0; font-size: 0; line-height: 0; letter-spacing: 0;
}
.v-head .tools #veil.veil-btn::before {
  content: ""; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px; background: currentColor;
  -webkit-mask: url(/img/eye-closed.svg) center / contain no-repeat; mask: url(/img/eye-closed.svg) center / contain no-repeat;
}
.v-head .tools #veil.veil-btn[aria-pressed="false"] { color: #e2c46a; border-color: rgba(226, 196, 106, .42); }
.v-head .tools #veil.veil-btn[aria-pressed="false"]::before {
  -webkit-mask-image: url(/img/eye-open.svg); mask-image: url(/img/eye-open.svg);
}

/* ═════════ the little sealed box: tap to seal the vault ═════════ */
.seal-box {
  all: unset; cursor: pointer; flex: none;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 8px 8px 2px; /* headroom for the raised lid */
}
.seal-box:focus-visible { outline: 1px solid var(--moss); outline-offset: 4px; }
.mini-scene { --s: 34px; --h: 17px; display: block; width: var(--s); height: var(--s); perspective: 260px; }
.box.mini { display: block; animation: miniSpin 16s linear infinite; }
@keyframes miniSpin { from { transform: rotateX(-35deg) rotateY(0); } to { transform: rotateX(-35deg) rotateY(360deg); } }
.box.mini .face {
  border-width: 1px;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .5), inset 0 0 8px rgba(143, 227, 176, .18), 0 0 10px rgba(143, 227, 176, .18);
}
.box.mini .sig { width: 72%; height: 72%; }
/* ajar: the lid is lifted a little on its hinge, light showing through the gap */
.box.mini .face.top { transform: rotateX(90deg) translateZ(var(--h)) translateY(calc(var(--s) / -2)) rotateX(var(--lid, 15deg)) translateY(calc(var(--s) / 2)); }
/* the crack of light under a closed lid (gate.css) has no place on an open box */
.box.mini .face::before { display: none; }
.box.mini .face.top { transition: transform .45s cubic-bezier(.3, 1.4, .5, 1); }
/* what is left at the bottom of the box once everything else has flown out: a small warm light */
.box.mini .face.bottom {
  background: radial-gradient(circle, rgba(255, 240, 200, .95) 0%, rgba(255, 196, 110, .6) 26%, rgba(120, 70, 20, .25) 50%, #050505 74%);
  box-shadow: none; animation: hope 4.5s ease-in-out infinite alternate;
}
@keyframes hope { from { filter: brightness(.8); } to { filter: brightness(1.25); } }
/* …and it spills, faintly, out of the gap under the lid */
.seal-box .mini-scene { position: relative; }
.seal-box .mini-scene::after {
  content: ""; position: absolute; left: 10%; right: 10%; top: -14%; height: 46%; pointer-events: none;
  background: radial-gradient(ellipse at 50% 70%, rgba(255, 214, 140, .55), rgba(255, 170, 80, .18) 45%, transparent 72%);
  filter: blur(2px); mix-blend-mode: screen;
  animation: hope 4.5s ease-in-out infinite alternate;
}
.vault.snap .seal-box .mini-scene::after { opacity: 0; }
/* the light in the little box: it is lit only once hope has come to rest there */
.vault.emerging .seal-box .mini-scene::after, .vault:not(.hoped) .seal-box .mini-scene::after { opacity: 0; transition: opacity 1.2s ease; }
.vault.hoped .seal-box .mini-scene::after { transition: opacity 1.2s ease; }
/* the last thing left after everything has flown out of the box */
.hope-mote {
  position: fixed; z-index: 62; width: 9px; height: 9px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, #fff8e4 0%, #ffd890 40%, rgba(255, 180, 90, 0) 72%);
  box-shadow: 0 0 10px 3px rgba(255, 200, 120, .55), 0 0 26px 8px rgba(255, 170, 80, .22);
}
/* sealed, in the dark: the light left in the box glows on above the black, then fades */
.vault.dark .hope-ember {
  position: fixed; z-index: 71; width: 14px; height: 10px; pointer-events: none; border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255, 226, 160, .95), rgba(255, 180, 90, .35) 45%, transparent 72%);
  filter: blur(1px);
  animation: hopeFade .75s ease-in forwards;
}
@keyframes hopeFade { 0% { opacity: .9; } 40% { opacity: 1; } 100% { opacity: 0; } }
.seal-label { font: 400 10px/1 var(--cn); letter-spacing: .35em; padding-left: .35em; color: var(--ink-dim); }
.seal-box:hover .box.mini { animation-duration: 3s; }
.seal-box:hover .seal-label { color: #8fe3b0; }

/* ═════════ smoke transitions ═════════ */
/* out of the box: the ledger's parts fly into place (js/rite.js flight); the wood fades up around
   them; nothing can be pressed until they have landed; then the numbers flicker awake */
.vault.emerging { opacity: 1; transition: none; } /* the night is there at once, under the fading gate */
.vault.emerging .forest, .vault.emerging .moon { animation: forestIn 2.2s ease-out both; }
.vault.emerging .ledger { pointer-events: none; }
.vault.woke .stat .big { animation: wake .8s ease-out; }
@keyframes wake {
  0% { opacity: .15; } 18% { opacity: 1; text-shadow: 0 0 14px currentColor; } 32% { opacity: .3; }
  52% { opacity: 1; } 68% { opacity: .55; } 100% { opacity: 1; }
}
/* back into the box: its lid gapes, then snaps shut on what it swallowed; the light goes out */
.vault.inhale .box.mini { --lid: 70deg; animation-play-state: paused; }
.vault.inhale .ledger { pointer-events: none; }
.vault.inhale .forest, .vault.inhale .moon { transition: opacity 1.6s ease-in; opacity: .35; }
.vault.snap .box.mini { --lid: 0deg; }
.vault.snap .box.mini .face.top { transition-duration: .12s; transition-timing-function: ease-in; }
.vault.dark::after {
  content: ""; position: fixed; inset: 0; z-index: 70; pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, #111314, #090a0b 75%); /* the gate's cover, so the reload never shows */
  animation: toDark .35s ease-in forwards;
}
@keyframes toDark { from { opacity: 0; } }

.vault.emerge .ledger { animation: emerge 1.7s cubic-bezier(.2, .7, .3, 1) both; transform-origin: 50% 50vh; }
.vault.emerge .forest, .vault.emerge .moon { animation: forestIn 2.2s ease-out both; }
@keyframes emerge { from { transform: translateY(16px) scale(.985); filter: blur(6px); opacity: 0; } }
@keyframes forestIn { from { transform: scale(1.06); opacity: 0; } }
.vault.devour .ledger { animation: devourBack 1.4s ease-in forwards; }
.vault.devour .forest, .vault.devour .moon { transition: opacity 1s ease-in; opacity: 0; }
@keyframes devourBack { to { transform: scale(.97); filter: blur(8px) brightness(.35); opacity: 0; } }

.whisper-line { margin: 0 0 14px !important; font-size: 12px; letter-spacing: .35em; color: rgba(201, 169, 106, .55); }
/* at the foot of the ledger, the gate's burnt strip again — quiet here: no flame, no smoke, only
   the paper, its last warmth at the rim, and the name in faded gold */
.v-foot .site-mark {
  position: relative; display: inline-flex; gap: 0;
  margin: 6px auto 14px; padding: 13px 38px 12px calc(38px + .42em);
  font-size: 12px; color: #8c713f; text-shadow: 0 0 1px rgba(230, 200, 140, .2), 0 0 3px rgba(210, 170, 90, .12);
  rotate: -1.5deg;
}
.v-foot .site-mark::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: url(/img/burnt-paper.svg) center / 100% 100% no-repeat;
  filter: drop-shadow(0 8px 6px rgba(0, 0, 0, .8)) brightness(.85);
}
.v-foot .site-mark .mark-line { display: none; }

@media (prefers-reduced-motion: reduce) {
  .vault.emerge .ledger, .vault.emerge .forest, .vault.emerge .moon, .vault.devour .ledger, .box.mini, .box.mini .face.bottom, .seal-box .mini-scene::after { animation: none; }
}

/* ═════════ small things: scrollbars, selection ═════════ */
.vault { scrollbar-color: rgba(176, 141, 87, .45) transparent; scrollbar-width: thin; }
.vault ::-webkit-scrollbar { width: 8px; height: 8px; }
.vault ::-webkit-scrollbar-track { background: transparent; }
.vault ::-webkit-scrollbar-thumb { background: rgba(176, 141, 87, .4); border-radius: 4px; border: 2px solid transparent; background-clip: padding-box; }
.vault ::-webkit-scrollbar-thumb:hover { background-color: rgba(201, 169, 106, .6); }
.vault ::selection { background: rgba(201, 169, 106, .35); color: #fff6e0; }

/* numbers that have just changed (a quote came in) catch the light for a moment */
.glint-up { animation: glintUp 1.6s ease-out; }
.glint-down { animation: glintDown 1.6s ease-out; }
@keyframes glintUp { 0% { text-shadow: 0 0 10px rgba(143, 227, 176, .9), 0 0 2px rgba(255, 236, 190, .9); } 100% { text-shadow: none; } }
@keyframes glintDown { 0% { text-shadow: 0 0 10px rgba(214, 84, 70, .9), 0 0 2px rgba(255, 220, 200, .8); } 100% { text-shadow: none; } }

/* ═════════ asset logos ═════════ */
.asset-icon {
  display: inline-grid; place-items: center; flex: none;
  width: 24px; height: 24px; margin-right: 10px; vertical-align: -7px;
  border-radius: 50%; overflow: hidden;
  /* set like a medallion: a thin brass ring round it, the colours a little dimmed for the night */
  box-shadow: 0 0 0 1px rgba(176, 141, 87, .7), 0 0 0 3px rgba(0, 0, 0, .55), 0 0 0 4px rgba(176, 141, 87, .22), 0 0 10px rgba(0, 0, 0, .5);
}
.asset-icon svg { width: 100%; height: 100%; display: block; filter: saturate(.72) brightness(.88); }
/* third-party logos are drawn for light backgrounds: sit them on a dim silver disc */
.asset-icon.logo { background: #b9b3a4; } /* old parchment rather than bright silver */
.asset-icon.logo img { width: 78%; height: 78%; object-fit: contain; filter: saturate(.7) brightness(.9); }
.asset-icon.mono {
  --hue: 200;
  background: hsl(var(--hue) 28% 22%);
  color: hsl(var(--hue) 45% 78%);
  font: 600 10px/1 "Cinzel", var(--cn); letter-spacing: .02em;
}
/* name + its small caption stack together, so the caption always sits under the name */
tbody th .nm { display: inline-block; vertical-align: middle; }
tbody th .nm small { margin-left: 0; }
tbody th .asset-icon { vertical-align: middle; }

/* today's change & currency */
.stat .sub b { font-weight: 500; color: #e2e7df; }
.stat .sub b.up { color: var(--up); }
.stat .sub b.down { color: var(--down); }
td.today small { display: block; margin-top: 2px; font-size: 11px; opacity: .8; }
td.today.stale { color: var(--ink-dim); opacity: .7; }
.fx-line { margin: -6px 2px 0; text-align: right; font-size: 11px; letter-spacing: .12em; color: var(--ink-dim); }
.ccy-btn { min-width: 6.2em; }
.ccy-btn:disabled { opacity: .45; }
/* 9 streamlined columns: fits desktop cleanly without horizontal scroll */
#positions th, #positions td { padding-left: 9px; padding-right: 9px; }

/* ═════════ holdings: table on wide screens, cards on narrow ones ═════════ */
.pos-cards { display: none; }
@media (max-width: 899px) {
  .pos-table { display: none; }
  .pos-cards { display: block; }
}

/* sortable headers */
.sort-h { all: unset; cursor: pointer; white-space: nowrap; letter-spacing: inherit; position: relative; }
/* the arrow hangs outside the label so the label itself stays flush with the numbers below */
.sort-h i { position: absolute; right: 100%; margin-right: 3px; font-style: normal; color: var(--moss); }
.sort-h.chip i { position: static; margin: 0 0 0 4px; }
.sort-h:hover, .sort-h.on { color: #f0e4c8; }
.sort-h:focus-visible { outline: 1px solid var(--moss); outline-offset: 3px; }

/* share: of total, with share within its category + micro weight bar underneath */
td.share small { display: block; margin-top: 2px; font-size: 11px; color: var(--ink-dim); }
.share-bar { display: block; width: 46px; height: 2px; margin: 4px 0 0 auto; background: rgba(255, 255, 255, .06); border-radius: 1px; overflow: hidden; }
.share-bar i { display: block; height: 100%; width: var(--w, 0); background: linear-gradient(90deg, rgba(201, 169, 106, .45), var(--gold)); }
button.icon.more { font-size: 18px; line-height: 1; padding: 2px 8px; letter-spacing: 0; }

/* sort chips (narrow screens) */
.sort-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.sort-h.chip {
  min-height: 32px; box-sizing: border-box; display: inline-flex; align-items: center;
  padding: 6px 12px; border-radius: 999px; font-size: 12px; letter-spacing: .12em;
  border: 1px solid var(--line); color: var(--ink-dim); background: rgba(10, 15, 13, .72);
}
.sort-h.chip.on { color: var(--gold); border-color: rgba(201, 169, 106, .45); background: rgba(201, 169, 106, .1); }

/* cards */
.cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
@media (min-width: 600px) and (max-width: 899px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }
.card {
  background: rgba(9, 13, 11, .78); border: 1px solid rgba(176, 141, 87, .16); border-radius: 3px;
  padding: 12px 14px; font-variant-numeric: tabular-nums;
  box-shadow: inset 2px 0 0 rgba(176, 141, 87, .24);
  transition: border-color .2s;
}
.card.up { box-shadow: inset 2px 0 0 rgba(143, 227, 176, .52); }
.card.down { box-shadow: inset 2px 0 0 rgba(214, 84, 70, .55); }
.vault[data-palette="cn"] .card.up { box-shadow: inset 2px 0 0 rgba(226, 100, 88, .55); }
.vault[data-palette="cn"] .card.down { box-shadow: inset 2px 0 0 rgba(116, 207, 155, .52); }
.card.open { border-color: rgba(201, 169, 106, .35); }
.card-main { display: flex; align-items: center; gap: 10px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.card-main:focus-visible { outline: 1px solid var(--moss); outline-offset: 4px; }
.card-main .asset-icon { width: 30px; height: 30px; margin: 0; }
.card-name { flex: 1; min-width: 0; }
.card-name b { display: block; font-size: 15px; font-weight: 500; color: #ecefe8; letter-spacing: .04em; }
.card-name small { display: block; margin-top: 2px; font-size: 11px; color: var(--ink-dim); letter-spacing: .1em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-val { text-align: right; flex: none; }
.card-chev { flex: none; font-size: 10px; color: rgba(201, 169, 106, .55); margin-left: 2px; transition: color .2s; }
.card.open .card-chev { color: var(--gold); }
.card-val b { display: block; font: 600 18px/1.2 var(--fig); color: #ecefe8; font-variant-numeric: lining-nums tabular-nums; }
.card-val small { display: block; margin-top: 2px; font-size: 11.5px; font-family: var(--num); }
.card-val small.up, .card-line .up { color: var(--up); }
.card-val small.down, .card-line .down { color: var(--down); }
.card-val small.stale { color: var(--ink-dim); }
.card-line { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; font-size: 12px; color: #b3bcb3; font-family: var(--num); }
.card-line + .card-line { margin-top: 4px; }
.card-line { flex-wrap: wrap; row-gap: 2px; }
.card-line > span { white-space: nowrap; }
.card-line .dim { color: var(--ink-dim); margin-left: auto; }
.card-plats { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 12px; color: #b3bcb3; font-family: var(--num); }
.card-plats div { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.card-acts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.card-acts button { min-height: 44px; padding: 0; font-size: 13px; }
.card.is-closed { opacity: .66; }
.cards > .empty { grid-column: 1 / -1; }

/* veil: cards hide their amounts until opened, matching the woodland mist */
.vault.veiled .ledger :where(.card .amt) { filter: blur(5px); opacity: .55; transition: filter .35s ease, opacity .35s ease; }
.vault.veiled .ledger .card.open :where(.amt) { filter: none; opacity: 1; }

/* the "⋯" menu */
.row-menu {
  position: fixed; z-index: 40; min-width: 9em;
  display: grid; padding: 6px 4px;
  /* a small slip of old dark paper, brass-edged */
  background: linear-gradient(170deg, #17120c, #0d0a07); border: 1px solid rgba(176, 141, 87, .4); border-radius: 2px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .7), inset 0 0 0 3px rgba(0, 0, 0, .35), inset 0 0 0 4px rgba(176, 141, 87, .15);
}
.row-menu[hidden] { display: none; }
.row-menu button { all: unset; cursor: pointer; padding: 9px 14px; font-size: 13px; letter-spacing: .15em; color: #e0d4b8; border-radius: 1px; }
.row-menu button:hover, .row-menu button:focus-visible { background: rgba(201, 169, 106, .12); color: #f1e3bf; }
.row-menu button.danger { border-top: 1px solid rgba(176, 141, 87, .2); margin-top: 3px; padding-top: 11px; }
.row-menu button.danger { color: var(--down); }

/* undo bar */
.undo {
  position: fixed; z-index: 50; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%) rotate(-1deg);
  display: flex; align-items: center; gap: 16px; overflow: hidden;
  max-width: calc(100vw - 32px); padding: 16px 30px 17px 34px;
  /* a scrap of the burnt strip from the gate */
  background: url(/img/burnt-paper.svg) center / 100% 100% no-repeat;
  filter: drop-shadow(0 12px 14px rgba(0, 0, 0, .8));
  font-size: 13px; letter-spacing: .08em; color: #ead9b0; text-shadow: 0 1px 2px #000, 0 0 6px rgba(0, 0, 0, .8);
}
.undo[hidden] { display: none; }
.undo span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.undo button { all: unset; cursor: pointer; flex: none; padding: 6px 10px; color: #ffe2a0; letter-spacing: .15em; border: 1px solid rgba(255, 226, 160, .45); border-radius: 1px; background: rgba(0, 0, 0, .35); }
.undo button b { font-variant-numeric: tabular-nums; }
.undo-bar { position: absolute; left: 34px; right: 30px; bottom: 9px; height: 1px; background: rgba(255, 170, 80, .75); box-shadow: 0 0 4px rgba(255, 140, 50, .8); transform-origin: 0 50%; } /* an ember burning down the strip */
.undo.run .undo-bar { animation: undoBar 5s linear forwards; }
@keyframes undoBar { to { transform: scaleX(0); } }

/* ═════════ footprints: modes, ranges, benchmarks ═════════ */
.trend-head { margin-bottom: 10px !important; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.seg button {
  all: unset; cursor: pointer; padding: 6px 12px; min-height: 18px;
  font-size: 12px; letter-spacing: .15em; color: var(--ink-dim);
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { color: #f0e4c8; background: rgba(201, 169, 106, .14); }
.seg button:focus-visible, .bench-ctl button:focus-visible { outline: 1px solid var(--moss); outline-offset: -2px; }
.trend-ctl { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 10px; }
.bench-ctl { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; letter-spacing: .15em; color: var(--ink-dim); }
.bench-ctl[hidden] { display: none; }
.bench-ctl button {
  all: unset; cursor: pointer; padding: 5px 10px; border-radius: 999px; font-size: 12px; letter-spacing: .1em;
  border: 1px solid var(--line); color: var(--ink-dim);
}
.bench-ctl button[data-bench="SPY"].on { color: #6fc9c4; border-color: rgba(111, 201, 196, .5); }
.bench-ctl button[data-bench="BTC-USD"].on { color: #e2a64a; border-color: rgba(226, 166, 74, .5); }
.trend-plot { position: relative; touch-action: pan-y; cursor: crosshair; }
.spark .bench { stroke-width: 1.3; opacity: .85; }
.spark .bench.spy { stroke: #6fc9c4; }
.spark .bench.btcb { stroke: #e2a64a; }
.spark .grid-h { stroke: rgba(176, 141, 87, .12); stroke-dasharray: 2 5; stroke-width: 1; vector-effect: non-scaling-stroke; }
.spark .zero { stroke: rgba(170, 192, 178, .28); stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.spark .guide { stroke: rgba(230, 237, 243, .45); stroke-width: 1; vector-effect: non-scaling-stroke; }
.spark .pt { fill: var(--gold); stroke: #050706; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.spark .pt.cost { fill: rgba(169, 163, 214, .95); }
.spark .pt.spy { fill: #6fc9c4; }
.spark .pt.btcb { fill: #e2a64a; }
.ylab { position: absolute; left: 2px; font: 400 10px var(--num); letter-spacing: .02em; color: var(--ink-dim); pointer-events: none; font-variant-numeric: tabular-nums; }
.ylab.hi { top: 0; }
.ylab.mid { top: 50%; transform: translateY(-50%); opacity: .7; }
.ylab.lo { bottom: 0; }
.trend-tip {
  position: absolute; z-index: 6; top: 6px; left: 0; pointer-events: none;
  padding: 6px 10px; border-radius: 2px;
  background: rgba(8, 12, 10, .94); border: 1px solid rgba(176, 141, 87, .42);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .7);
  font: 400 11px/1.55 var(--num); color: #dce3dc; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.trend-tip[hidden] { display: none; }
.trend-tip b { font-weight: 600; }
.trend-tip b.up { color: var(--up); }
.trend-tip b.down { color: var(--down); }
.trend-metrics {
  display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px;
  font: 400 11.5px/1.4 var(--num); color: var(--ink-dim); font-variant-numeric: tabular-nums;
}
.trend-metrics b { font-weight: 500; color: #e2e7df; }
.trend-metrics b.up { color: var(--up); }
.trend-metrics b.down { color: var(--down); }
.trend-meta .legend-line { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 0 4px; }
.trend-meta .lg.spy { background: #6fc9c4; }
.trend-meta .lg.btcb { background: #e2a64a; }
.trend .readout { min-height: 1.5em; font-variant-numeric: tabular-nums; }
.trend-note { margin: 4px 0 0; font-size: 10.5px; letter-spacing: .08em; color: rgba(111, 124, 117, .85); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.trend-head-acts { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
@media (max-width: 600px) {
  /* dates stay at the two ends; the legend drops to its own line beneath */
  .trend-meta { flex-wrap: wrap; }
  .trend-meta .legend-line { order: 3; flex-basis: 100%; justify-content: flex-start; margin-top: 4px; }
  .trend-meta .legend-line > span:first-child .lg { margin-left: 0; }
}

/* 备份 / 匣务: a small red dot once the last export is old (or there has never been one) */
.backup-btn, .manage-btn { position: relative; }
.backup-btn.due::after, .manage-btn.due::after {
  content: ""; position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%;
  background: #d8473b; box-shadow: 0 0 6px rgba(216, 71, 59, .8);
}
.manage-menu .backup-btn.due::after { top: 50%; right: 12px; translate: 0 -50%; }
#backup-last { margin: 0; }

/* ═════════ header on tablets and phones ═════════ */
/* The little box keeps the top-right corner beside the title; the slim tools bar gets a row of its own. */
@media (max-width: 1100px) {
  .v-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "brand seal" "tools tools"; align-items: center; row-gap: 14px; }
  .v-head .brand { grid-area: brand; }
  .v-head .seal-box { grid-area: seal; }
  .v-head .tools { grid-area: tools; margin-left: 0; }
  .v-head .status { min-width: 0; text-align: left; margin-right: auto; }
}
@media (max-width: 700px) {
  /* slim 2-row header: status on top, 5 crisp controls below — no nested fold-out needed */
  .v-head .tools { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 38px 38px auto; gap: 7px; align-items: center; }
  .v-head .status { grid-column: 1 / -1; padding: 0; }
  .v-head .tools #veil.veil-btn, .v-head .tools #theme-toggle.theme-btn { width: 38px; min-height: 38px; }
  .v-head .tools button, .v-head .tools #btc-price { min-width: 0; width: auto; padding-inline: 8px; letter-spacing: .06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 600px) {
  /* phones: title + primary CTA on row 1, clean 2-col filters on row 2 */
  #positions-panel .panel-head { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 8px; align-items: center; }
  #positions-panel .panel-head h2 { grid-row: 1; grid-column: 1; }
  #positions-panel .panel-head .tools { display: contents; }
  #positions-panel #add { grid-row: 1; grid-column: 2; justify-self: end; padding: 9px 12px; }
  #positions-panel #filter { grid-row: 2; grid-column: 1; width: 100%; }
  #positions-panel #plat-filter { grid-row: 2; grid-column: 2; width: 100%; }
  #positions-panel #closed-toggle { grid-row: 3; grid-column: 1 / -1; }
}

/* ═════════ enhanced dialogs, forms, target allocation, trade timeline, backup ═════════ */
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 460px) { .form-row { grid-template-columns: 1fr; } }
.dlg input[type="number"], .dlg input[type="date"] { font-family: var(--num); font-variant-numeric: tabular-nums; }
.dlg .check-row {
  display: flex; flex-direction: row; align-items: center; gap: 8px;
  cursor: pointer; color: #d3dbd3; font-size: 12.5px; letter-spacing: .06em;
}
.dlg .check-row input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--gold); flex: none; }

/* single-asset trade history KPI strip + mini price timeline chart */
.hist-kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px;
  padding: 10px 12px; border: 1px solid rgba(176, 141, 87, .14); border-radius: 2px; background: rgba(0, 0, 0, .26);
}
.hist-kpi { display: grid; gap: 3px; }
.hist-kpi span { font-size: 11px; letter-spacing: .12em; color: var(--ink-dim); }
.hist-kpi b { font: 600 16px var(--fig); color: #ecefe8; font-variant-numeric: lining-nums tabular-nums; }
.hist-kpi b.up { color: var(--up); }
.hist-kpi b.down { color: var(--down); }
.hist-chart-box {
  position: relative; padding: 10px 12px 8px;
  border: 1px solid rgba(176, 141, 87, .14); border-radius: 2px; background: rgba(0, 0, 0, .2);
}
.hist-chart-box svg { width: 100%; height: 120px; display: block; overflow: visible; }
.hist-chart-box .hc-avg { stroke: rgba(169, 163, 214, .75); stroke-dasharray: 4 4; stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.hist-chart-box .hc-cur { stroke: var(--gold); stroke-width: 1.2; opacity: .85; vector-effect: non-scaling-stroke; }
.hist-chart-box .hc-path { fill: none; stroke: rgba(201, 169, 106, .38); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.hist-chart-box .hc-buy { fill: var(--up); }
.hist-chart-box .hc-sell { fill: var(--down); }
.hist-chart-box .hc-div { fill: #e2c46a; }
.hist-chart-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; margin-top: 6px; font: 400 11px var(--num); color: var(--ink-dim); }
.hist-chart-meta .dot-sm { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin: 0 4px 0 10px; vertical-align: middle; }
.hist-chart-meta .dot-sm.buy { background: var(--up); }
.hist-chart-meta .dot-sm.sell { background: var(--down); }
.hist-chart-meta .dot-sm.div { background: #e2c46a; }

/* closed positions toggle + active filter chips */
button.ghost.on { color: var(--gold); border-color: rgba(201, 169, 106, .5); background: rgba(201, 169, 106, .1); }
.filter-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: -4px 0 10px; padding: 6px 10px; border-radius: 2px;
  background: rgba(201, 169, 106, .08); border: 1px solid rgba(201, 169, 106, .25);
  font-size: 12px; color: #e0d4b8;
}
.filter-banner[hidden] { display: none; }
.filter-banner button { all: unset; cursor: pointer; color: var(--gold); padding: 2px 6px; font-size: 12px; }

/* backup dialog sections */
.dlg-sec { display: grid; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.dlg-sec:first-of-type { padding-top: 0; border-top: none; }
.dlg-sec h4 { margin: 0; font: 500 13px var(--cn); letter-spacing: .2em; color: #cdb98d; }
.dlg-sec-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.file-input { font-size: 12.5px !important; padding: 8px 0 !important; border-bottom: 1px dashed var(--line) !important; }

/* target allocation dialog */
.target-grid { display: grid; gap: 10px; }
.target-row { display: grid; grid-template-columns: 1fr 90px; align-items: center; gap: 12px; }
.target-row span { font-size: 13px; letter-spacing: .12em; display: flex; align-items: center; }
.target-row input { text-align: right; }
.target-sum { font: 500 12.5px var(--num); color: var(--ink-dim); text-align: right; }
.target-sum.ok { color: var(--up); }
.target-sum.bad { color: var(--down); }

/* preferences dialog */
.pref-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid rgba(176, 141, 87, .12); }
.pref-item:last-of-type { border-bottom: none; }
.pref-item > div b { display: block; font-size: 13.5px; font-weight: 500; color: #ecefe8; letter-spacing: .1em; }
.pref-item > div small { display: block; margin-top: 3px; font-size: 11.5px; color: var(--ink-dim); }

/* ═════════ 一匣四卷 · chapter navigation & sibling views ═════════ */
.vault-nav {
  display: flex; align-items: center; gap: 4px;
  margin-top: -6px;
  border-bottom: 1px solid rgba(176, 141, 87, .22);
}
.vault-nav button {
  all: unset; cursor: pointer; position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px 11px;
  font: 500 13.5px/1 var(--cn); letter-spacing: .22em;
  color: var(--ink-dim);
  transition: color .2s ease;
}
.vault-nav button:hover { color: #e2d8be; }
.vault-nav button.on { color: var(--gold); text-shadow: 0 0 10px rgba(201, 169, 106, .35); }
.vault-nav button.on::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold) 25%, #ffe6ad 50%, var(--gold) 75%, transparent);
  box-shadow: 0 0 8px rgba(201, 169, 106, .6);
}
.vault-nav button:focus-visible { outline: 1px solid var(--gold); outline-offset: -2px; }
.nav-badge {
  font-style: normal; font: 600 10px/1 var(--num); letter-spacing: 0;
  padding: 2px 5px; border-radius: 999px;
  background: rgba(201, 169, 106, .16); color: var(--gold);
  border: 1px solid rgba(201, 169, 106, .35);
}
.nav-badge[hidden] { display: none; }
.view-pane { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
.view-pane[hidden] { display: none; }
@media (max-width: 600px) {
  .vault-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; }
  .vault-nav button { padding: 10px 4px 11px; font-size: 12px; letter-spacing: .08em; white-space: nowrap; }
  .vault-nav button.on::after { left: 6px; right: 6px; }
}

/* textarea & decision context inside dialogs */
.dlg textarea {
  width: 100%; padding: 9px 10px; border-radius: 2px; resize: vertical;
  background: rgba(0, 0, 0, .28); color: #ecefe8;
  border: 1px solid rgba(176, 141, 87, .32);
  font: 13.5px/1.6 var(--cn); letter-spacing: .04em;
  transition: border-color .2s;
}
.dlg textarea:focus-visible { outline: none; border-color: var(--gold); }
.ctx-fold {
  border-top: 1px dashed rgba(176, 141, 87, .24);
  padding-top: 10px;
}
.ctx-fold > summary {
  cursor: pointer; list-style: none; user-select: none;
  font: 500 12.5px var(--cn); letter-spacing: .16em; color: rgba(201, 169, 106, .82);
}
.ctx-fold > summary::-webkit-details-marker { display: none; }
.ctx-fold[open] > summary { color: var(--gold); margin-bottom: 10px; }
.ctx-body { display: grid; gap: 11px; }
.ctx-grp { display: grid; gap: 6px; }
.ctx-lbl { font-size: 11.5px; letter-spacing: .14em; color: rgba(205, 185, 141, .75); }
.tag-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-pills .pill {
  all: unset; cursor: pointer; padding: 5px 10px; border-radius: 999px;
  font: 400 12px/1 var(--cn); letter-spacing: .08em;
  color: var(--ink-dim); background: rgba(10, 15, 13, .72);
  border: 1px solid rgba(176, 141, 87, .24);
  transition: border-color .18s, color .18s, background .18s;
}
.tag-pills .pill:hover { color: #ecefe8; border-color: rgba(201, 169, 106, .5); }
.tag-pills .pill.on { color: #f6e7c1; background: rgba(201, 169, 106, .18); border-color: rgba(201, 169, 106, .65); }
.tag-pills .pill.imp.on { color: #ffb3a7; background: rgba(214, 84, 70, .18); border-color: rgba(214, 84, 70, .65); }

.thesis-recall, .guardrail-box {
  padding: 10px 12px; border-radius: 2px; font-size: 12px; line-height: 1.65;
}
.thesis-recall[hidden], .guardrail-box[hidden] { display: none; }
.thesis-recall {
  background: rgba(201, 169, 106, .08); border: 1px solid rgba(201, 169, 106, .3);
  border-left: 2px solid var(--gold); color: #e4d6b5;
}
.thesis-recall b { display: block; color: var(--gold); letter-spacing: .14em; margin-bottom: 2px; }
.thesis-recall small { display: block; margin-top: 4px; color: var(--ink-dim); }
.guardrail-box {
  background: rgba(214, 84, 70, .09); border: 1px solid rgba(214, 84, 70, .35);
  border-left: 2px solid var(--down); color: #f0cfc8;
}
.guardrail-box b { display: block; color: #f29b8e; letter-spacing: .15em; margin-bottom: 4px; }
.guardrail-box ul { margin: 0; padding-left: 16px; display: grid; gap: 3px; }

/* ═════════ 卷二 · 交易志 ═════════ */
.journal-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.journal-bar select { min-width: 118px; }
@media (max-width: 600px) {
  .journal-bar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .journal-bar select { width: 100%; min-width: 0; }
}
.thesis-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.thesis-grid .th-k { display: block; font-size: 11px; letter-spacing: .16em; color: var(--gold); margin-bottom: 4px; }
.thesis-grid p { margin: 0; font: 400 13.5px/1.78 var(--cn); letter-spacing: .025em; color: #d8dfd8; white-space: pre-wrap; }

.j-list { display: grid; gap: 12px; }
.j-item {
  padding: 13px 15px; border-radius: 2px;
  background: rgba(9, 13, 11, .75); border: 1px solid rgba(176, 141, 87, .16);
  display: grid; gap: 8px; transition: border-color .2s;
}
.j-item:hover { border-color: rgba(201, 169, 106, .35); }
.j-item.pending { box-shadow: inset 2px 0 0 rgba(201, 169, 106, .4); }
.j-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.j-left, .j-right { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.j-date { font: 400 12.5px var(--num); color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.j-asset {
  all: unset; cursor: pointer; font: 600 14.5px var(--cn); color: #ecefe8; letter-spacing: .04em;
  border-bottom: 1px dashed rgba(201, 169, 106, .35);
}
.j-asset:hover { color: var(--gold); }
.j-plat { font-size: 12px; color: var(--ink-dim); }
.j-amt { font: 600 16px var(--fig); color: #ecefe8; font-variant-numeric: lining-nums tabular-nums; }
.j-sub { font: 400 12px var(--num); color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.j-pnl { font: 500 13px var(--num); font-variant-numeric: tabular-nums; }
.j-pnl.up { color: var(--up); }
.j-pnl.down { color: var(--down); }
.j-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.j-pill {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font: 400 11px/1.3 var(--cn); letter-spacing: .06em;
  border: 1px solid rgba(176, 141, 87, .25); color: #d6ccaf; background: rgba(201, 169, 106, .07);
}
.j-pill.calm { color: var(--up); border-color: rgba(143, 227, 176, .32); background: rgba(143, 227, 176, .08); }
.j-pill.imp { color: #f09589; border-color: rgba(214, 84, 70, .42); background: rgba(214, 84, 70, .1); }
.j-pill.warn { color: #e6c273; border-color: rgba(226, 196, 106, .42); background: rgba(226, 196, 106, .09); }
.j-pill.plan { color: #b9c9c0; border-color: rgba(170, 192, 178, .28); background: transparent; }
.j-pill.dim { color: var(--ink-dim); border-color: rgba(176, 141, 87, .16); background: transparent; }
.j-pill.star { color: var(--gold); border-color: transparent; background: transparent; padding-inline: 2px; letter-spacing: .04em; }
.j-ctx { margin-left: auto; font: 400 11px var(--num); color: var(--ink-dim); }
.j-note, .j-review { margin: 0; font: 400 13px/1.78 var(--cn); letter-spacing: .025em; color: #c7d0c9; white-space: pre-wrap; }
.j-note b, .j-review b { font-weight: 500; color: #cdb98d; margin-right: 6px; font-size: 11.5px; letter-spacing: .12em; }
.j-review { padding: 7px 10px; background: rgba(201, 169, 106, .05); border-left: 2px solid rgba(201, 169, 106, .35); border-radius: 0 2px 2px 0; }
.j-acts { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 4px; border-top: 1px solid rgba(170, 192, 178, .06); }
.j-todo { font-size: 11px; letter-spacing: .1em; color: rgba(201, 169, 106, .75); }
.j-btns { display: inline-flex; gap: 6px; }

/* ═════════ 卷三 · 行为镜 ═════════ */
.mirror-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 900px) { .mirror-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
table.mini-tbl { min-width: 440px; }
.freq-chart svg { width: 100%; height: 150px; display: block; }
.freq-chart .zero { stroke: rgba(176, 141, 87, .2); stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.freq-chart .fq-bar { fill: rgba(201, 169, 106, .28); stroke: rgba(201, 169, 106, .55); stroke-width: 1; }
.freq-chart .fq-line { fill: none; stroke: var(--up); stroke-width: 1.8; vector-effect: non-scaling-stroke; filter: drop-shadow(0 0 4px rgba(143, 227, 176, .5)); }
.freq-chart .fq-dot { fill: var(--up); stroke: #050706; stroke-width: 1.4; }
.freq-chart .fq-lbl { font: 400 10px var(--num); fill: var(--ink-dim); text-anchor: middle; }

/* ═════════ 卷四 · 问策台 ═════════ */
.ai-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 10px; }
.ai-controls label { display: grid; gap: 6px; font-size: 12px; letter-spacing: .14em; color: rgba(205, 185, 141, .78); }
.ai-controls label[hidden] { display: none; }
.ai-controls select { width: 100%; }
.ai-anon { display: flex; align-items: center; gap: 8px; margin: 10px 0 12px; font-size: 12.5px; color: #d3dbd3; cursor: pointer; }
.ai-anon input { width: 16px; height: 16px; accent-color: var(--gold); flex: none; }
.ai-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ai-preview-fold { margin-top: 12px; border-top: 1px solid rgba(176, 141, 87, .16); padding-top: 10px; }
.ai-preview-fold > summary { cursor: pointer; font-size: 12px; letter-spacing: .12em; color: var(--ink-dim); }
.ai-preview {
  margin: 10px 0 0; padding: 12px; max-height: 300px; overflow: auto;
  background: rgba(0, 0, 0, .35); border: 1px solid rgba(176, 141, 87, .18); border-radius: 2px;
  font: 400 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; color: #cfd8d1; white-space: pre-wrap;
}

.rule-list, .archive-list { display: grid; gap: 10px; }
.rule-item {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-radius: 2px;
  background: rgba(9, 13, 11, .72); border: 1px solid rgba(176, 141, 87, .16);
}
.rule-item.off { opacity: .5; }
.rule-main { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; flex: 1; }
.rule-main input { margin-top: 3px; width: 15px; height: 15px; accent-color: var(--gold); flex: none; }
.rule-main b { display: block; font-size: 13px; font-weight: 500; color: #ecefe8; line-height: 1.5; }
.rule-main small { display: block; margin-top: 2px; font-size: 11px; color: var(--ink-dim); }

.archive-card {
  padding: 12px 14px; border-radius: 2px;
  background: rgba(9, 13, 11, .75); border: 1px solid rgba(176, 141, 87, .16);
  display: grid; gap: 8px;
}
.ar-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.ar-head h4 { margin: 0; font: 500 14px var(--cn); letter-spacing: .08em; color: var(--gold); }
.ar-head small { display: block; margin-top: 3px; font: 400 11px var(--num); color: var(--ink-dim); }
.ar-body { margin: 0; font: 400 13px/1.78 var(--cn); letter-spacing: .025em; color: #cdd6cf; white-space: pre-wrap; max-height: 180px; overflow: auto; }

/* extend woodland-mist veil across sibling chapters too */
.vault.veiled .ledger :where(.j-item .amt, .mirror-kpis .amt, .ai-preview.amt) {
  filter: blur(5px); opacity: .55; transition: filter .35s ease, opacity .35s ease;
}
.vault.veiled .ledger :where(.j-item, .stat, .ai-preview-fold).reveal :where(.amt) { filter: none; opacity: 1; }
@media (hover: hover) {
  .vault.veiled .ledger :where(.j-item, .stat, .ai-preview-fold):hover :where(.amt) { filter: none; opacity: 1; transition-delay: .22s; }
}

/* ═════════ quick day/night toggle button ═════════ */
.v-head .tools #theme-toggle.theme-btn {
  display: inline-flex; align-items: center; justify-content: center; position: relative;
  width: 38px; height: 35px; padding: 0; font-size: 0; line-height: 0; letter-spacing: 0;
}
.v-head .tools #theme-toggle.theme-btn::before {
  content: ""; position: absolute; inset: 0; margin: auto; width: 17px; height: 17px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='4.2'/%3E%3Cpath d='M12 2.5v2.2M12 19.3v2.2M4.9 4.9l1.6 1.6M17.5 17.5l1.6 1.6M2.5 12h2.2M19.3 12h2.2M4.9 19.1l1.6-1.6M17.5 6.5l1.6-1.6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='4.2'/%3E%3Cpath d='M12 2.5v2.2M12 19.3v2.2M4.9 4.9l1.6 1.6M17.5 17.5l1.6 1.6M2.5 12h2.2M19.3 12h2.2M4.9 19.1l1.6-1.6M17.5 6.5l1.6-1.6'/%3E%3C/svg%3E") center / contain no-repeat;
}
.v-head .tools #theme-toggle.theme-btn[aria-pressed="true"]::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.5 14.5A8.5 8.5 0 1 1 9.5 3.5a6.8 6.8 0 0 0 11 11z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.5 14.5A8.5 8.5 0 1 1 9.5 3.5a6.8 6.8 0 0 0 11 11z'/%3E%3C/svg%3E");
}

/* ═════════ 素笺 · 古籍宣纸 (Warm Antique Xuan-Paper Day Mode) ═════════ */
.vault[data-theme="light"] {
  --ink: #24211a;
  --ink-dim: #534a3b;
  --moss: #8c6223;
  --moss-dim: rgba(140, 98, 35, .13);
  --brass: #7e5720;
  --gold: #8c6223;
  --panel: rgba(244, 236, 219, .92);
  --line: rgba(136, 98, 44, .25);
  --up: #1f7247;
  --down: #b0382f;
  --c-btc: #b07419;
  --c-stock: #26754f;
  --c-bond: #4f6c78;
  --c-gold: #b88720;
  --c-cash: #684f9c;
  --c-other: #467087;
  background: #e6dbc4;
  color: var(--ink);
  -webkit-font-smoothing: auto;
  scrollbar-color: rgba(136, 98, 44, .38) transparent;
}
.vault[data-theme="light"][data-palette="cn"] {
  --up: #b53a30;
  --down: #1f7247;
}
.vault[data-theme="light"]::before {
  background:
    radial-gradient(ellipse 80% 50% at 78% -6%, rgba(214, 178, 112, .26), transparent 62%),
    linear-gradient(180deg, #eae0ca 0%, #e2d5ba 52%, #d6c6a6 100%);
}
.vault[data-theme="light"] .moon {
  background: radial-gradient(circle at 45% 45%, rgba(232, 198, 132, .36), rgba(216, 182, 118, .10) 48%, transparent 72%);
}
.vault[data-theme="light"] .forest .stars { opacity: 0; }
.vault[data-theme="light"] .forest::before,
.vault[data-theme="light"] .forest::after {
  width: min(38vw, 52vh);
  opacity: .30;
}
.vault[data-theme="light"] .forest::before { background-image: url(/img/forest-day-l.svg); }
.vault[data-theme="light"] .forest::after { background-image: url(/img/forest-day-r.svg); }
.vault[data-theme="light"] .mist.m1 { background: radial-gradient(ellipse 50% 50% at 50% 50%, rgba(248, 240, 222, .45), transparent 70%); }
.vault[data-theme="light"] .mist.m2 { background: radial-gradient(ellipse 45% 50% at 40% 50%, rgba(214, 194, 156, .35), transparent 70%); }

/* header & brand */
.vault[data-theme="light"] .brand-sig {
  color: #295941;
  filter: drop-shadow(0 1px 2px rgba(41, 89, 65, .2));
  animation: none;
}
.vault[data-theme="light"] .brand h1 {
  color: #5b3e14;
  font-weight: 700;
  text-shadow: 0 1px 0 rgba(255, 248, 232, .65);
}
.vault[data-theme="light"] .brand p { color: rgba(110, 77, 28, .75); }
.vault[data-theme="light"] .seal-label { color: #645b4c; }
.vault[data-theme="light"] .seal-box:hover .seal-label { color: #1f7247; }

/* controls */
.vault[data-theme="light"] button.ghost,
.vault[data-theme="light"] select {
  color: #2c271f;
  background-color: rgba(248, 241, 226, .88);
  border-color: rgba(136, 98, 44, .3);
}
.vault[data-theme="light"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%237e5720' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px 12px;
}
.vault[data-theme="light"] button.ghost:hover,
.vault[data-theme="light"] select:hover { border-color: rgba(136, 98, 44, .6); background-color: #f9f3e5; }
.vault[data-theme="light"] button.ghost.on { color: #6e4d1c; border-color: rgba(140, 98, 35, .58); background-color: rgba(140, 98, 35, .14); }
.vault[data-theme="light"] button.seal {
  background: #2b3830; border-color: #2b3830; color: #f4ecd9;
}
.vault[data-theme="light"] button.seal:hover {
  background: #1f2a23; box-shadow: 0 4px 14px rgba(43, 56, 48, .24);
}
.vault[data-theme="light"] .status::before { box-shadow: none; }
.vault[data-theme="light"] .status.pending { color: #8c6223; }
.vault[data-theme="light"] .v-head .tools #veil.veil-btn[aria-pressed="false"] {
  color: #6e4d1c; border-color: rgba(140, 98, 35, .48); background-color: rgba(140, 98, 35, .11);
}
.vault[data-theme="light"] .v-head .tools #theme-toggle.theme-btn[aria-pressed="true"] {
  color: #5b3e14; border-color: rgba(136, 98, 44, .34); background-color: rgba(248, 241, 226, .88);
}
/* turn night fireflies into subtle sunlit golden dust motes in daytime mode */
body:has(.vault[data-theme="light"]:not([hidden])) .motes {
  opacity: .24;
  filter: sepia(.9) saturate(.65) brightness(.72);
  transition: opacity .5s ease, filter .5s ease;
}

/* panels, stats & hero */
.vault[data-theme="light"] .stat,
.vault[data-theme="light"] .panel {
  box-shadow: 0 8px 24px rgba(54, 42, 24, .08), inset 0 1px 0 rgba(255, 250, 238, .65);
}
.vault[data-theme="light"] .stat:not(.hero) {
  border-color: rgba(136, 98, 44, .22);
  box-shadow: 0 5px 18px rgba(54, 42, 24, .06), inset 2px 0 0 rgba(136, 98, 44, .36);
}
.vault[data-theme="light"] .stat:not(.hero).up { box-shadow: 0 5px 18px rgba(54, 42, 24, .06), inset 2px 0 0 rgba(31, 114, 71, .62); }
.vault[data-theme="light"] .stat:not(.hero).down { box-shadow: 0 5px 18px rgba(54, 42, 24, .06), inset 2px 0 0 rgba(176, 56, 47, .62); }
.vault[data-theme="light"][data-palette="cn"] .stat:not(.hero).up { box-shadow: 0 5px 18px rgba(54, 42, 24, .06), inset 2px 0 0 rgba(181, 58, 48, .62); }
.vault[data-theme="light"][data-palette="cn"] .stat:not(.hero).down { box-shadow: 0 5px 18px rgba(54, 42, 24, .06), inset 2px 0 0 rgba(31, 114, 71, .62); }
.vault[data-theme="light"] .stat::after { background: radial-gradient(circle, rgba(140, 98, 35, .07), transparent 70%); }
.vault[data-theme="light"] .stat.down::after { background: radial-gradient(circle, rgba(176, 56, 47, .07), transparent 70%); }
.vault[data-theme="light"] .stat h3,
.vault[data-theme="light"] .panel h2 { color: #4d3614; font-weight: 700; font-size: 13.5px; }
.vault[data-theme="light"] .stat h3 small,
.vault[data-theme="light"] .panel h2 small { color: #6b5d47; font-weight: 600; }
.vault[data-theme="light"] .big { color: #24211a; }
.vault[data-theme="light"] .summary .hero .big {
  color: #7c5318;
  text-shadow: 0 1px 0 rgba(255, 250, 238, .75);
}
.vault[data-theme="light"] .summary .hero .big::after {
  background: linear-gradient(90deg, transparent, rgba(140, 98, 35, .45) 30%, rgba(140, 98, 35, .85) 50%, rgba(140, 98, 35, .45) 70%, transparent);
}
.vault[data-theme="light"] .stat.up .big { color: var(--up); }
.vault[data-theme="light"] .stat.down .big { color: var(--down); }
.vault[data-theme="light"] .stat .sub b,
.vault[data-theme="light"] .trend b,
.vault[data-theme="light"] .trend-metrics b { color: #24211a; }
.vault[data-theme="light"] .stat .sub b.up,
.vault[data-theme="light"] .trend-metrics b.up { color: var(--up); }
.vault[data-theme="light"] .stat .sub b.down,
.vault[data-theme="light"] .trend-metrics b.down { color: var(--down); }

/* allocation donut & legend */
.vault[data-theme="light"] .donut .track { stroke: rgba(46, 38, 26, .09); }
.vault[data-theme="light"] .donut .inner-ring { stroke: rgba(136, 98, 44, .32); }
.vault[data-theme="light"] .donut .arc { filter: drop-shadow(0 1px 2px rgba(54, 42, 24, .14)); }
.vault[data-theme="light"] .donut .arc:hover,
.vault[data-theme="light"] .donut .arc.on { filter: drop-shadow(0 2px 5px rgba(54, 42, 24, .22)); }
.vault[data-theme="light"] .donut text,
.vault[data-theme="light"] .lg-pct { fill: #24211a; color: #24211a; }
.vault[data-theme="light"] .legend li:hover { background: rgba(140, 98, 35, .07); }
.vault[data-theme="light"] .legend li.on { background: rgba(140, 98, 35, .13); border-color: rgba(140, 98, 35, .42); }
.vault[data-theme="light"] .bar,
.vault[data-theme="light"] .share-bar { background: rgba(46, 38, 26, .10); }
.vault[data-theme="light"] .bar i,
.vault[data-theme="light"] .dot { box-shadow: none; }
.vault[data-theme="light"] .bar .tgt-mark { box-shadow: 0 0 0 1px rgba(248, 241, 226, .8); }

/* trend chart */
.vault[data-theme="light"] .seg button.on { color: #24211a; background: rgba(140, 98, 35, .17); }
.vault[data-theme="light"] .bench-ctl button[data-bench="SPY"].on { color: #1d706c; border-color: rgba(29, 112, 108, .5); }
.vault[data-theme="light"] .bench-ctl button[data-bench="BTC-USD"].on { color: #b07419; border-color: rgba(176, 116, 25, .5); }
.vault[data-theme="light"] .spark .val { filter: none; }
.vault[data-theme="light"] .spark .cost { stroke: rgba(104, 79, 156, .65); }
.vault[data-theme="light"] .spark .bench.spy,
.vault[data-theme="light"] .spark .pt.spy { stroke: #1d706c; fill: #1d706c; }
.vault[data-theme="light"] .spark .bench.btcb,
.vault[data-theme="light"] .spark .pt.btcb { stroke: #b07419; fill: #b07419; }
.vault[data-theme="light"] .trend-meta .lg.spy { background: #1d706c; }
.vault[data-theme="light"] .trend-meta .lg.btcb { background: #b07419; }
.vault[data-theme="light"] .trend-meta .lg.cost { background: rgba(104, 79, 156, .7); }
.vault[data-theme="light"] .spark .grid-h { stroke: rgba(136, 98, 44, .16); }
.vault[data-theme="light"] .spark .zero { stroke: rgba(46, 38, 26, .24); }
.vault[data-theme="light"] .spark .guide { stroke: rgba(46, 38, 26, .34); }
.vault[data-theme="light"] .spark .pt { stroke: #f4ecdb; }
.vault[data-theme="light"] .trend-tip {
  background: rgba(246, 239, 224, .97);
  border-color: rgba(136, 98, 44, .42);
  box-shadow: 0 8px 22px rgba(54, 42, 24, .16);
  color: #24211a;
}
.vault[data-theme="light"] .trend-note { color: #6e6454; }

/* tables & cards */
.vault[data-theme="light"] th,
.vault[data-theme="light"] td { border-bottom-color: rgba(136, 98, 44, .14); color: #2b261e; }
.vault[data-theme="light"] thead th { color: #6c4f22; border-bottom-color: var(--line); }
.vault[data-theme="light"] tbody tr:hover { background: rgba(140, 98, 35, .07); }
.vault[data-theme="light"] tfoot th,
.vault[data-theme="light"] tfoot td { color: #24211a; border-top-color: rgba(136, 98, 44, .34); }
.vault[data-theme="light"] tr.sub-row th,
.vault[data-theme="light"] tr.sub-row td { color: #524a3d; background: rgba(136, 98, 44, .06); border-bottom-color: rgba(136, 98, 44, .10); }
.vault[data-theme="light"] td.plats { color: #524a3d; }
.vault[data-theme="light"] td.up,
.vault[data-theme="light"] tr.sub-row td.up { color: var(--up); }
.vault[data-theme="light"] td.down,
.vault[data-theme="light"] tr.sub-row td.down { color: var(--down); }
.vault[data-theme="light"] .sort-h:hover,
.vault[data-theme="light"] .sort-h.on { color: #24211a; }
.vault[data-theme="light"] .sort-h.chip { background-color: rgba(248, 241, 226, .88); }
.vault[data-theme="light"] .sort-h.chip.on { color: #6e4d1c; border-color: rgba(140, 98, 35, .52); background-color: rgba(140, 98, 35, .14); }
.vault[data-theme="light"] .asset-icon {
  box-shadow: 0 0 0 1px rgba(136, 98, 44, .46), 0 1px 4px rgba(54, 42, 24, .15);
}
.vault[data-theme="light"] .asset-icon svg { filter: saturate(.92); }
.vault[data-theme="light"] .asset-icon.logo { background: #f4ecdb; }
.vault[data-theme="light"] .asset-icon.logo img { filter: none; }
.vault[data-theme="light"] .card {
  background: rgba(249, 242, 228, .92);
  border-color: rgba(136, 98, 44, .22);
  box-shadow: inset 2px 0 0 rgba(136, 98, 44, .32), 0 4px 12px rgba(54, 42, 24, .05);
}
.vault[data-theme="light"] .card.up { box-shadow: inset 2px 0 0 rgba(31, 114, 71, .6), 0 4px 12px rgba(54, 42, 24, .05); }
.vault[data-theme="light"] .card.down { box-shadow: inset 2px 0 0 rgba(176, 56, 47, .6), 0 4px 12px rgba(54, 42, 24, .05); }
.vault[data-theme="light"][data-palette="cn"] .card.up { box-shadow: inset 2px 0 0 rgba(181, 58, 48, .6), 0 4px 12px rgba(54, 42, 24, .05); }
.vault[data-theme="light"][data-palette="cn"] .card.down { box-shadow: inset 2px 0 0 rgba(31, 114, 71, .6), 0 4px 12px rgba(54, 42, 24, .05); }
.vault[data-theme="light"] .card-name b,
.vault[data-theme="light"] .card-val b { color: #24211a; }
.vault[data-theme="light"] .card-line,
.vault[data-theme="light"] .card-plats { color: #524a3d; }
.vault[data-theme="light"] .kind.buy { border-color: rgba(31, 114, 71, .38); }
.vault[data-theme="light"] .kind.sell { border-color: rgba(176, 56, 47, .38); }
.vault[data-theme="light"] .kind.div { color: #8c5e10; border-color: rgba(176, 116, 25, .42); }
.vault[data-theme="light"] .kind.set { color: #6e4d1c; border-color: rgba(140, 98, 35, .38); }
.vault[data-theme="light"] .filter-banner { background: rgba(140, 98, 35, .12); border-color: rgba(140, 98, 35, .34); color: #573f19; }

@media (max-width: 1024px) {
  .vault[data-theme="light"] .scroll tbody th:first-child,
  .vault[data-theme="light"] .scroll thead th:first-child,
  .vault[data-theme="light"] .scroll tfoot th:first-child { background: #f2ead7; }
  .vault[data-theme="light"] .scroll tbody tr:hover th:first-child { background: #eae0c9; }
  .vault[data-theme="light"] .scroll tr.sub-row th:first-child { background: #ede3cd; }
}

/* menus & dialogs */
.vault[data-theme="light"] .row-menu {
  background: linear-gradient(180deg, #f5edd9, #eae0c9);
  border-color: rgba(136, 98, 44, .42);
  box-shadow: 0 14px 34px rgba(54, 42, 24, .18);
}
.vault[data-theme="light"] .row-menu button { color: #2c271f; }
.vault[data-theme="light"] .row-menu button:hover,
.vault[data-theme="light"] .row-menu button:focus-visible { background: rgba(140, 98, 35, .14); color: #24211a; }
.vault[data-theme="light"] .row-menu button.danger { color: var(--down); }

.vault[data-theme="light"] .dlg {
  background:
    url(/img/corner-tl.svg) 5px 5px / 18px 18px no-repeat,
    url(/img/corner-br.svg) right 5px bottom 5px / 18px 18px no-repeat,
    linear-gradient(180deg, #f5edd9, #e8dcc2);
  color: #24211a;
  border-color: rgba(136, 98, 44, .42);
  box-shadow: 0 24px 64px rgba(54, 42, 24, .24);
}
.vault[data-theme="light"] .dlg::backdrop { background: rgba(38, 30, 18, .46); }
.vault[data-theme="light"] .dlg h3 { color: #6e4d1c; text-shadow: none; }
.vault[data-theme="light"] .dlg label,
.vault[data-theme="light"] .ctx-lbl,
.vault[data-theme="light"] .dlg-sec h4 { color: #644a22; }
.vault[data-theme="light"] .dlg input,
.vault[data-theme="light"] .dlg select { color: #24211a; border-bottom-color: rgba(136, 98, 44, .42); }
.vault[data-theme="light"] .dlg select { background-color: rgba(252, 247, 236, .75); }
.vault[data-theme="light"] .dlg select option { background: #f5edd9; color: #24211a; }
.vault[data-theme="light"] .dlg textarea { background: rgba(252, 247, 236, .78); color: #24211a; border-color: rgba(136, 98, 44, .36); }
.vault[data-theme="light"] .dlg .check-row,
.vault[data-theme="light"] .pref-item > div b { color: #24211a; }
.vault[data-theme="light"] .hint { color: #705426; }
.vault[data-theme="light"] .hist-kpis,
.vault[data-theme="light"] .hist-chart-box { background: rgba(136, 98, 44, .07); border-color: rgba(136, 98, 44, .2); }
.vault[data-theme="light"] .hist-kpi b { color: #24211a; }
.vault[data-theme="light"] .hist-kpi b.up { color: var(--up); }
.vault[data-theme="light"] .hist-kpi b.down { color: var(--down); }
@media (max-width: 560px) {
  .vault[data-theme="light"] .dlg h3 { background: linear-gradient(180deg, #f5edd9 84%, rgba(245, 237, 217, 0)); }
  .vault[data-theme="light"] .dlg-acts { background: linear-gradient(0deg, #e8dcc2 84%, rgba(232, 220, 194, 0)); border-top-color: rgba(136, 98, 44, .2); }
}

/* 4-chapter nav, journal, mirror, counsel */
.vault[data-theme="light"] .vault-nav { border-bottom-color: rgba(136, 98, 44, .28); }
.vault[data-theme="light"] .vault-nav button { color: #5b503e; font-weight: 500; }
.vault[data-theme="light"] .vault-nav button:hover { color: #24211a; }
.vault[data-theme="light"] .vault-nav button.on { color: #5b3e14; font-weight: 700; text-shadow: none; }
.vault[data-theme="light"] .vault-nav button.on::after {
  background: linear-gradient(90deg, transparent, #8c6223 25%, #ad7e34 50%, #8c6223 75%, transparent);
  box-shadow: none;
}
.vault[data-theme="light"] .ctx-fold > summary { color: #6e4d1c; }
.vault[data-theme="light"] .tag-pills .pill { color: #524a3d; background: #f3ead5; border-color: rgba(136, 98, 44, .28); }
.vault[data-theme="light"] .tag-pills .pill:hover { color: #24211a; border-color: rgba(136, 98, 44, .58); }
.vault[data-theme="light"] .tag-pills .pill.on { color: #614316; background: rgba(140, 98, 35, .18); border-color: rgba(140, 98, 35, .64); }
.vault[data-theme="light"] .tag-pills .pill.imp.on { color: #9e2d25; background: rgba(176, 56, 47, .15); border-color: rgba(176, 56, 47, .58); }
.vault[data-theme="light"] .thesis-recall { background: rgba(140, 98, 35, .11); border-color: rgba(140, 98, 35, .34); color: #473517; }
.vault[data-theme="light"] .guardrail-box { background: rgba(176, 56, 47, .10); border-color: rgba(176, 56, 47, .36); color: #75231d; }
.vault[data-theme="light"] .guardrail-box b { color: #9e2d25; }

.vault[data-theme="light"] .thesis-grid p { color: #302b22; }
.vault[data-theme="light"] .j-item,
.vault[data-theme="light"] .rule-item,
.vault[data-theme="light"] .archive-card {
  background: rgba(249, 242, 228, .90);
  border-color: rgba(136, 98, 44, .22);
}
.vault[data-theme="light"] .j-item:hover { border-color: rgba(136, 98, 44, .46); }
.vault[data-theme="light"] .j-asset,
.vault[data-theme="light"] .j-amt,
.vault[data-theme="light"] .rule-main b { color: #24211a; }
.vault[data-theme="light"] .j-note,
.vault[data-theme="light"] .j-review,
.vault[data-theme="light"] .ar-body,
.vault[data-theme="light"] .ai-anon { color: #302b22; }
.vault[data-theme="light"] .j-note b,
.vault[data-theme="light"] .j-review b,
.vault[data-theme="light"] .ai-controls label { color: #6c4f22; }
.vault[data-theme="light"] .j-review { background: rgba(140, 98, 35, .08); border-left-color: rgba(140, 98, 35, .48); }
.vault[data-theme="light"] .j-acts { border-top-color: rgba(136, 98, 44, .14); }
.vault[data-theme="light"] .j-pill { color: #543e1b; background: rgba(140, 98, 35, .11); border-color: rgba(140, 98, 35, .28); }
.vault[data-theme="light"] .j-pill.calm { color: #1f7247; background: rgba(31, 114, 71, .11); border-color: rgba(31, 114, 71, .36); }
.vault[data-theme="light"] .j-pill.imp { color: #b0382f; background: rgba(176, 56, 47, .11); border-color: rgba(176, 56, 47, .4); }
.vault[data-theme="light"] .j-pill.warn { color: #8c5e10; background: rgba(176, 116, 25, .15); border-color: rgba(176, 116, 25, .42); }
.vault[data-theme="light"] .j-pill.plan { color: #474135; border-color: rgba(71, 65, 53, .3); background: transparent; }
.vault[data-theme="light"] .j-pill.dim { color: var(--ink-dim); border-color: rgba(136, 98, 44, .22); background: transparent; }

.vault[data-theme="light"] .freq-chart .fq-bar { fill: rgba(140, 98, 35, .28); stroke: rgba(140, 98, 35, .58); }
.vault[data-theme="light"] .freq-chart .fq-line { filter: none; }
.vault[data-theme="light"] .freq-chart .fq-dot { stroke: #f4ecdb; }
.vault[data-theme="light"] .ai-preview { background: #efe6d2; color: #2c271f; border-color: rgba(136, 98, 44, .28); }
.vault[data-theme="light"] .v-foot,
.vault[data-theme="light"] .whisper-line { color: #695e4c; }
.vault[data-theme="light"] .v-foot .site-mark {
  color: #f0dba6;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .55);
}
.vault[data-theme="light"] .v-foot .site-mark::before { filter: drop-shadow(0 4px 6px rgba(54, 42, 24, .24)) brightness(1.06); }
.vault[data-theme="light"] ::selection { background: rgba(140, 98, 35, .26); color: #24211a; }
