/* App shell: dashboard + onboarding. Follows the theme. */
body { background: var(--paper); color: var(--ink); min-height: 100vh; }
.btn.quiet { border-color: transparent; color: var(--muted); }
.btn.quiet:hover { color: var(--ink); background: transparent; }
.btn.danger { border-color: var(--crit); color: var(--crit-text); }
.btn.danger:hover { background: var(--crit); color: #fff; }
body :focus-visible { outline-color: var(--brand); }
.input { background: var(--panel); border-color: var(--rule); color: var(--ink); }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.hint, .small { color: var(--muted); }
.error-text { color: var(--crit-text); }
.input.bad { border-color: var(--crit); }
.hatch { background-color: var(--panel); background-image: repeating-linear-gradient(-45deg, var(--hatch) 0 1.5px, transparent 1.5px 8px); }

.bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 14px 16px; border-bottom: 1px solid var(--rule); position: sticky; top: 0; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(6px); z-index: 5; }
.bar-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; }
.bar-actions .btn { padding: .55em .9em; font-size: .93rem; }

.app-main { width: min(1240px, 100% - 32px); margin: 0 auto; padding: 24px 0 64px; outline: none; }

/* Dashboard */
/* Balance card: big and bold, hideable like a banking app */
.bal { background: var(--panel); border: 1px solid var(--rule); border-radius: 18px; padding: 18px 20px 16px; margin: 4px 0 18px; }
.bal-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.bal-label { font-size: .78rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bal-eye { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--rule); background: transparent; color: var(--muted); cursor: pointer; }
.bal-eye:hover { color: var(--ink); border-color: var(--muted); }
.bal-eye svg { width: 20px; height: 20px; }
.bal-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem 1rem; margin-top: 4px; }
.bal-amt { font-family: var(--fd); font-weight: 800; font-size: clamp(2.3rem, 7vw, 3.6rem); line-height: 1.05; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.bal.is-hidden .bal-amt { letter-spacing: .08em; }
.bal-move { display: inline-flex; align-items: baseline; gap: .4rem; font-family: var(--fd); font-weight: 700; font-size: clamp(1.05rem, 2.6vw, 1.35rem); font-variant-numeric: tabular-nums; }
.bal-move.up, .bal-word.up { color: var(--gain); }
.bal-move.down, .bal-word.down { color: var(--loss); }
.bal-move.flat { color: var(--muted); }
.bal-arrow { font-size: .9em; }
.bal-pct { font-size: .85em; opacity: .9; }
.bal-sub { margin: 8px 0 0; color: var(--muted); font-size: .9rem; }
.bal-word { font-weight: 650; }
.summary { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .6rem 2rem; margin: 6px 0 22px; }
.summary h1 { margin: 0; font-family: var(--fd); font-weight: 760; font-size: clamp(1.5rem, 3vw, 2.1rem); line-height: 1.1; letter-spacing: -0.015em; max-width: 30ch; }
.summary h1 .warm { color: var(--warn); } .summary h1 .hot { color: var(--crit); } .summary h1 .calm { color: var(--brand); }
.summary p { margin: 0; color: var(--muted); }
.demo-note { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1rem; padding: .8rem 1rem; border: 1px dashed var(--hatch); border-radius: var(--r-md); margin-bottom: 20px; color: var(--muted); }
.demo-note p { margin: 0; max-width: none; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); gap: 18px; align-items: start; }
.acct-tools { display: flex; gap: .3rem; margin-top: .8rem; }
.acct-tools .btn { padding: .35em .6em; font-size: .88rem; }

/* Onboarding */
.ob { max-width: 760px; margin: 0 auto; }
.ob-steps { list-style: none; display: flex; gap: 6px; padding: 0; margin: 4px 0 28px; }
.ob-steps li { flex: 1; font-size: .82rem; color: var(--muted); padding-top: 8px; border-top: 4px solid var(--rule); }
.ob-steps li.done { border-top-color: var(--brand); color: var(--ink); }
.ob-steps li.now { border-top-color: var(--ink); color: var(--ink); font-weight: 650; }
.ob h1 { font-family: var(--fd); font-weight: 760; font-size: clamp(1.7rem, 4vw, 2.5rem); line-height: 1.08; letter-spacing: -0.015em; margin: 0 0 .5rem; max-width: 22ch; }
.ob .lede { color: var(--muted); margin-bottom: 1.6rem; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-bottom: 1.4rem; }
.choice { text-align: left; font: inherit; color: inherit; background: var(--panel); border: 1.5px solid var(--rule); border-radius: var(--r-md); padding: 1rem 1.05rem; cursor: pointer; display: flex; flex-direction: column; gap: .3rem; }
.choice:hover { border-color: var(--muted); }
.choice[aria-pressed="true"] { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, var(--panel)); }
.choice b { font-family: var(--fd); font-size: 1.05rem; }
.choice span { color: var(--muted); font-size: .88rem; line-height: 1.4; }
.choice em { font-style: normal; font-size: .78rem; color: var(--warn); }
.choice em.ok { color: var(--brand); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 560px) { .row2 { grid-template-columns: 1fr; } }
.check { display: flex; gap: .6rem; align-items: flex-start; margin-bottom: .8rem; }
.check input { width: 18px; height: 18px; margin-top: .2rem; accent-color: var(--brand); }
.ob-nav { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-top: 1.4rem; }
.ob-nav .spacer { flex: 1; }
.panel-box { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: clamp(16px, 3vw, 26px); margin-bottom: 1.2rem; }
.panel-box h2 { font-size: 1.1rem; margin: 0 0 .9rem; font-family: var(--fd); }
.helpbox { border-left: 3px solid var(--brand); padding: .2rem 0 .2rem 1rem; margin: .4rem 0 1.2rem; color: var(--muted); font-size: .93rem; }
.helpbox summary { cursor: pointer; color: var(--ink); font-weight: 600; }
.helpbox ol { padding-left: 1.2rem; margin: .5rem 0; }
.helpbox li { margin: .25rem 0; }
.readonly-note { display: flex; gap: .8rem; align-items: flex-start; font-size: .92rem; color: var(--muted); }
.readonly-note i { flex: none; width: 34px; height: 22px; border-radius: 3px; margin-top: .15rem; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 4.6rem; }
.pw-wrap button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); font: inherit; font-size: .85rem; background: none; border: 0; color: var(--muted); cursor: pointer; padding: .3rem .5rem; }
.suggest { list-style: none; margin: .3rem 0 0; padding: 0; border: 1px solid var(--rule); border-radius: var(--r-md); overflow: hidden; }
.suggest:empty { display: none; }
.suggest button { width: 100%; text-align: left; font: inherit; font-size: .93rem; background: var(--panel); color: var(--ink); border: 0; border-bottom: 1px solid var(--rule); padding: .55rem .8rem; cursor: pointer; }
.suggest button:hover, .suggest button:focus { background: var(--raise); }
.suggest small { color: var(--muted); margin-left: .4rem; }

.phases { list-style: none; padding: 0; margin: 1.2rem 0; }
.phases li { display: flex; gap: .8rem; align-items: center; padding: .75rem 0; border-bottom: 1px solid var(--rule); color: var(--muted); }
.phases li i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--rule); flex: none; }
.phases li.done { color: var(--ink); } .phases li.done i { background: var(--brand); border-color: var(--brand); }
.phases li.now { color: var(--ink); font-weight: 600; } .phases li.now i { border-color: var(--brand); animation: pulse 1.4s ease-in-out infinite; }
.phases li.fail i { background: var(--crit); border-color: var(--crit); }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--brand) 25%, transparent); } }

/* Dialog + toast */
.dlg { background: var(--panel); color: var(--ink); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 24px; width: min(480px, 100% - 32px); }
.dlg::backdrop { background: rgb(4 10 12 / .7); }
.dlg h2 { font-size: 1.3rem; margin: 0 0 1rem; }
.dlg .ob-nav { margin-top: .6rem; }
.toast { visibility: hidden; position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 140%); background: var(--ink); color: var(--paper); padding: .7em 1.1em; border-radius: var(--r-md); font-weight: 600; transition: transform .25s; z-index: 20; max-width: calc(100% - 32px); }
.toast.show { visibility: visible; transform: translate(-50%, 0); }
.empty { text-align: center; padding: 60px 0; color: var(--muted); }

/* Firm search + lookup review */
.firm-search { position: relative; }
.input.big { font-size: 1.2rem; padding: .85em 1em; font-family: var(--fd); font-weight: 560; }
.firm-search .suggest { margin-top: -.6rem; margin-bottom: 1rem; }
.linkbtn { font: inherit; background: none; border: 0; padding: 0; color: var(--brand); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-weight: 600; }
.manual-link { margin-top: .4rem; }
.row3 { display: grid; grid-template-columns: 2fr 1fr 1.3fr; gap: 0 12px; }
@media (max-width: 640px) { .row3 { grid-template-columns: 1fr; } }
.firm-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .3rem 1rem; margin-bottom: .6rem; }
.firm-head h2 { margin: 0; font-size: 1.5rem; font-family: var(--fd); }
.firm-head p { margin: 0; }
table.rules { width: 100%; border-collapse: collapse; font-size: .96rem; margin-top: .3rem; }
.rules th, .rules td { text-align: left; vertical-align: top; padding: .62rem .6rem .62rem 0; border-top: 1px solid var(--rule); }
.rules th { width: 34%; font-weight: 600; color: var(--muted); }
.ns { color: var(--muted); font-style: italic; }
.unc { display: inline-block; font-size: .75rem; font-weight: 650; color: var(--warn-text); background: color-mix(in srgb, var(--warn) 16%, transparent); padding: .05em .5em; border-radius: 999px; margin-left: .3rem; vertical-align: 1px; }
.note { margin-top: .8rem; }
.sources a { color: var(--brand); }
.fineprint h2 { margin-bottom: .3rem; }
.fp-group { margin-top: 1.1rem; border-left: 4px solid var(--rule); padding-left: 1rem; }
.fp-group h3 { font-size: 1rem; margin: 0 0 .4rem; }
.fp-group ul { list-style: none; margin: 0; padding: 0; }
.fp-group li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .1rem 1rem; padding: .55rem 0; border-top: 1px solid var(--rule); font-size: .94rem; }
.fp-group li b { grid-column: 1; font-weight: 650; }
.fp-group li span { grid-column: 1; color: var(--muted); }
.fp-group li a { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: .85rem; color: var(--brand); }
.fp-group.sev-ends_account { border-left-color: var(--crit); } .fp-group.sev-ends_account h3 { color: var(--crit-text); }
.fp-group.sev-removes_profit, .fp-group.sev-blocks_payout { border-left-color: var(--warn); } .fp-group.sev-removes_profit h3, .fp-group.sev-blocks_payout h3 { color: var(--warn-text); }
.fp-group.sev-limits_trading { border-left-color: var(--brand); }
.fp-group.sev-missing { border-left-style: dashed; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.fp-group .pills li { display: inline-block; border: 1px dashed var(--rule); border-radius: 999px; padding: .2em .7em; font-size: .85rem; color: var(--muted); }
.check.ack { background: var(--raise); padding: .8rem 1rem; border-radius: var(--r-md); font-weight: 600; }
.lookup-wait .phases { margin: .4rem 0 .6rem; }

.dlg.wide { width: min(760px, 100% - 32px); max-height: 85vh; overflow: auto; }
fieldset.guardrails { border: 1px solid var(--rule); border-radius: var(--r-md); padding: .9rem 1rem .2rem; margin: .4rem 0 1rem; }
fieldset.guardrails legend { font-weight: 650; padding: 0 .4rem; }
fieldset.guardrails .hint { margin: 0 0 .8rem; }

/* ===== Account view (Rule check + onboarding) ===== */
.av-picker { display: grid; grid-template-columns: 2fr 1fr 1.3fr; gap: 10px; background: var(--panel); border: 1px solid var(--rule); border-radius: 16px; padding: 14px 16px 2px; box-shadow: var(--shadow); }
@media (max-width: 680px) { .av-picker { grid-template-columns: 1fr; } }
.acct-view { margin-top: 16px; }
.av-context { font-family: var(--fd); font-weight: 600; font-size: 1.05rem; margin: 0 0 .7rem; }
.av-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 980px) { .av-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.av-tile { background: var(--panel); border: 1px solid var(--rule); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: .15rem; min-height: 112px; }
.av-tile.hot { border-top: 3px solid var(--crit); }
.av-tile.warm { border-top: 3px solid var(--warn); }
.av-label { font-size: .8rem; color: var(--muted); font-weight: 600; }
.av-label i { font-style: normal; color: var(--warn-text); font-weight: 650; }
.av-tile b { font-family: var(--fd); font-weight: 650; font-size: 1.55rem; letter-spacing: -0.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.av-tile b.word { font-size: 1.25rem; }
.av-sub { font-size: .84rem; color: var(--muted); line-height: 1.35; }
.av-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; align-items: start; }
@media (max-width: 900px) { .av-cols { grid-template-columns: 1fr; } }
.av-card { background: var(--panel); border: 1px solid var(--rule); border-radius: 16px; padding: 16px 18px; }
.av-card h3, .av-fold > summary { font-family: var(--fd); font-size: 1.02rem; margin: 0 0 .4rem; display: flex; align-items: center; gap: .5rem; }
.av-card.danger { border-top: 4px solid var(--crit); }
.av-card.danger h3 { color: var(--crit-text); }
.av-card.caution { border-top: 4px solid var(--warn); }
.av-card.caution h3 { color: var(--warn-text); }
.n { display: inline-block; min-width: 1.6em; text-align: center; font-family: var(--f); font-size: .78rem; font-weight: 700; padding: .1em .45em; border-radius: 999px; background: var(--raise); color: var(--ink); }
.fp-item { border-top: 1px solid var(--rule); }
.fp-item > summary { list-style: none; cursor: pointer; padding: .65rem 1.6rem .65rem 0; position: relative; display: flex; flex-direction: column; gap: .1rem; }
.fp-item > summary::-webkit-details-marker { display: none; }
.fp-item > summary::after { content: "+"; position: absolute; right: 2px; top: .6rem; color: var(--muted); font-size: 1.1rem; }
.fp-item[open] > summary::after { content: "\2212"; }
.fp-item > summary b { font-weight: 650; font-size: .95rem; }
.fp-item > summary span { color: var(--muted); font-size: .9rem; line-height: 1.4; }
.fp-body { padding: 0 0 .8rem; font-size: .9rem; }
.fp-body p { margin: 0 0 .4rem; max-width: none; }
.fp-body a { color: var(--brand); font-size: .86rem; }
.av-rest { border-top: 1px solid var(--rule); }
.av-rest > summary { list-style: none; cursor: pointer; padding: .7rem 0 .2rem; color: var(--brand); font-weight: 600; font-size: .9rem; }
.av-rest > summary::-webkit-details-marker { display: none; }
.av-rest[open] > summary { display: none; }
.av-rest > .fp-item:first-of-type { border-top: 0; }
.av-more { margin-top: 14px; display: grid; gap: 10px; }
.av-fold { background: var(--panel); border: 1px solid var(--rule); border-radius: 14px; padding: 4px 18px; }
.av-fold > summary { cursor: pointer; padding: .7rem 0; margin: 0; list-style: none; }
.av-fold > summary::-webkit-details-marker { display: none; }
.av-fold > summary::after { content: "Show"; margin-left: auto; font-family: var(--f); font-size: .85rem; font-weight: 600; color: var(--brand); }
.av-fold[open] > summary::after { content: "Hide"; }
.av-fold[open] { padding-bottom: 10px; }
.av-fold.missing { border-style: dashed; }
.av-note { margin: .4rem 0 0; }

/* ---------- Firm picker ---------- */
.fpick { position: relative; max-width: 760px; }
.fpick-label { display: block; font-weight: 600; font-size: .92rem; margin: 0 0 .4rem; }
.fpick-field { display: flex; align-items: center; gap: .6rem; background: var(--panel); border: 1px solid var(--rule); border-radius: 16px; padding: 0 .6rem 0 1rem; transition: border-color .15s, box-shadow .15s; }
.fpick-field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.fpick.open .fpick-field { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.fpick-ico { width: 20px; height: 20px; color: var(--muted); flex: none; }
.fpick-input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font-family: var(--fd); font-weight: 560; font-size: 1.15rem; padding: .95em 0; outline: none; }
.fpick-input::placeholder { color: var(--muted); font-weight: 450; }
.fpick-toggle { flex: none; width: 36px; height: 36px; border-radius: 10px; border: 0; background: var(--raise); color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.fpick-toggle svg { width: 18px; height: 18px; transition: transform .15s; }
.fpick.open .fpick-toggle svg { transform: rotate(180deg); }
.fpick-panel { background: var(--panel); border: 1px solid var(--brand); border-top: 1px solid var(--rule); border-radius: 0 0 16px 16px; box-shadow: var(--shadow); overflow: hidden; }
.fpick-chips { display: flex; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--rule); overflow-x: auto; scrollbar-width: none; }
.fpick-chips button { font: inherit; font-size: .84rem; font-weight: 600; white-space: nowrap; border: 1px solid var(--rule); background: transparent; color: var(--muted); border-radius: 999px; padding: .3em .85em; cursor: pointer; }
.fpick-chips button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.fpick-list { list-style: none; margin: 0; padding: 4px 6px; max-height: min(420px, 55vh); overflow-y: auto; overscroll-behavior: contain; }
.fpick-group { font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: .8rem .6rem .35rem; }
.fpick-opt { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto auto; align-items: center; gap: .75rem; padding: .55rem .6rem; border-radius: 10px; cursor: pointer; }
.fpick-opt:hover, .fpick-opt[aria-selected="true"] { background: var(--raise); }
.fpick-logo { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-family: var(--fd); font-weight: 700; font-size: .82rem; letter-spacing: .02em;
  color: hsl(var(--h) 55% 92%); background: linear-gradient(140deg, hsl(var(--h) 45% 34%), hsl(calc(var(--h) + 30) 50% 22%)); }
.fpick-main { display: flex; flex-direction: column; min-width: 0; }
.fpick-main b { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fpick-main small { color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fpick-tags { display: flex; gap: 4px; }
.fpick-tags i { font-style: normal; font-size: .72rem; font-weight: 600; color: var(--muted); border: 1px solid var(--rule); border-radius: 6px; padding: .1em .45em; white-space: nowrap; }
.fpick-state { font-size: .78rem; color: var(--muted); text-align: right; white-space: nowrap; min-width: 7.5rem; }
.fpick-state small { display: block; font-size: .72rem; }
.fpick-state.ready { color: var(--brand); font-weight: 650; }
.fpick-state.ready::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); margin-right: .4em; vertical-align: 1px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.fpick-state.ready small { color: var(--muted); font-weight: 450; }
.fpick-state.unsure { color: var(--warn-text); }
.fpick-no { color: var(--warn-text); font-weight: 600; }
.fpick-empty { padding: 1rem .6rem; color: var(--muted); }
.fpick-foot { border-top: 1px solid var(--rule); padding: 10px 14px; font-size: .84rem; color: var(--muted); }
.fpick-unlisted { font: inherit; width: 100%; text-align: left; background: color-mix(in srgb, var(--brand) 10%, transparent); color: var(--ink); border: 1px dashed color-mix(in srgb, var(--brand) 55%, transparent); border-radius: 10px; padding: .6rem .8rem; cursor: pointer; }
.fpick-unlisted b { color: var(--brand); }
.fpick-unlisted small { display: block; color: var(--muted); font-size: .8rem; margin-top: .1rem; }
@media (max-width: 640px) {
  .fpick-opt { grid-template-columns: 34px minmax(0, 1fr) auto; }
  .fpick-tags { display: none; }
  .fpick-state { min-width: 0; }
  .fpick-state small, .fpick-state .long { display: none; }
  .fpick-logo { width: 34px; height: 34px; }
  .fpick-input { font-size: 1.05rem; }
}
.gate-msg { margin-top: 14px; max-width: 760px; background: var(--panel); border: 1px solid var(--rule); border-left: 4px solid var(--warn); border-radius: 14px; padding: 14px 18px; }
.gate-msg p { margin: 0 0 .4rem; }
.gate-msg .near { display: flex; flex-wrap: wrap; gap: 8px; margin-top: .4rem; }
.gate-msg .near button { font: inherit; font-weight: 600; display: inline-flex; align-items: center; gap: .5rem; background: var(--raise); color: var(--ink); border: 1px solid var(--rule); border-radius: 999px; padding: .25rem .8rem .25rem .3rem; cursor: pointer; }
.gate-msg .near .fpick-logo { width: 26px; height: 26px; font-size: .66rem; border-radius: 50%; }
.firm-head h2 { display: flex; align-items: center; gap: .6rem; }
.firm-head h2 .fpick-logo { width: 40px; height: 40px; font-size: .85rem; }
.check-pick { margin-top: 1.8rem; }

/* ---------- App sections ---------- */
.app-tabs { display: flex; gap: 4px; margin: 0 0 18px; border-bottom: 1px solid var(--rule); overflow-x: auto; scrollbar-width: none; }
.app-tabs a { padding: .7em 1em; font-weight: 650; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; white-space: nowrap; }
.app-tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--brand); }
.app-tabs a:hover { color: var(--ink); }
.eyebrow { margin: 0; font-size: .78rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--brand); }

/* ---------- Journal ---------- */
.journal { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
.journal > *, .j-log, .j-day { min-width: 0; }
.j-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px 24px; }
.j-head h1 { margin: .2rem 0 .3rem; font-size: clamp(1.6rem, 3vw, 2.1rem); }
.j-head .small { margin: 0; max-width: 62ch; }
.j-head .small a { color: var(--brand); font-weight: 600; }
.j-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.acct-pick select { min-width: 200px; }
.j-empty { background: var(--panel); border: 1px dashed var(--rule); border-radius: var(--r-lg); padding: 40px; text-align: center; }
.j-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 0; }
.j-totals div { background: var(--panel); border: 1px solid var(--rule); border-radius: 14px; padding: 14px 16px; }
.j-totals dt { font-size: .8rem; color: var(--muted); font-weight: 600; }
.j-totals dd { margin: .2rem 0 0; font-family: var(--fd); font-size: 1.5rem; font-weight: 720; font-variant-numeric: tabular-nums; }
.j-totals dd small { display: block; font-family: var(--f); font-size: .78rem; font-weight: 500; color: var(--muted); }
.journal .up { color: var(--brand); } .journal .down { color: var(--crit-text); }
.j-insights h2, .j-log h2 { font-size: 1.15rem; margin: 0 0 10px; }
.ins-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.ins { background: var(--panel); border: 1px solid var(--rule); border-left: 4px solid var(--rule); border-radius: 14px; padding: 14px 16px; }
.ins.good { border-left-color: var(--brand); } .ins.bad { border-left-color: var(--crit); } .ins.info { border-left-color: var(--warn); }
.ins h3 { margin: 0 0 .3rem; font-size: 1rem; font-family: var(--fd); }
.ins p { margin: 0; font-size: .92rem; color: var(--muted); max-width: none; }
.j-log-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.j-log-head h2 { margin: 0; }
.j-seg button[aria-selected="true"] { background: var(--brand); color: var(--brand-ink); }
.j-day, .j-roll { background: var(--panel); border: 1px solid var(--rule); border-radius: 16px; padding: 16px 18px; margin-bottom: 12px; }
.j-day > header, .j-roll > header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.j-day h3, .j-roll h3 { margin: 0; font-family: var(--fd); font-size: 1.08rem; }
.j-day header .small { margin: .15rem 0 0; }
.j-day-right { display: flex; align-items: center; gap: 10px; }
.j-day-right > b, .j-roll header > b { font-family: var(--fd); font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.badge.ok { background: color-mix(in srgb, var(--brand) 16%, transparent); color: var(--brand); }
.badge.bad { background: color-mix(in srgb, var(--crit) 15%, transparent); color: var(--crit-text); }
.j-trades { overflow-x: auto; margin-top: 10px; }
.j-trades table { width: 100%; border-collapse: collapse; font-size: .88rem; font-variant-numeric: tabular-nums; min-width: 640px; }
.j-trades th { text-align: left; font-size: .76rem; color: var(--muted); font-weight: 600; padding: .4rem .5rem .4rem 0; border-bottom: 1px solid var(--rule); }
.j-trades td { padding: .5rem .5rem .5rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.j-trades td small { display: block; color: var(--muted); font-size: .74rem; }
.j-trades tr.broke td:first-child { box-shadow: inset 3px 0 0 var(--crit); padding-left: .5rem; }
.tag { display: inline-block; font-size: .7rem; font-weight: 650; padding: .15em .5em; border-radius: 6px; background: color-mix(in srgb, var(--crit) 13%, transparent); color: var(--crit-text); margin: 0 4px 3px 0; white-space: nowrap; }
.j-breaks { list-style: none; padding: 0; margin: 10px 0 0; }
.j-breaks li { font-size: .86rem; padding: .35rem 0; color: var(--crit-text); border-top: 1px dashed var(--rule); }
.j-breaks time { display: inline-block; min-width: 4.6rem; color: var(--muted); }
.j-note { margin-top: 12px; display: grid; gap: 8px; }
.moods { display: flex; flex-wrap: wrap; gap: 6px; }
.moods button { font: inherit; font-size: .8rem; text-transform: capitalize; border: 1px solid var(--rule); background: transparent; color: var(--muted); border-radius: 999px; padding: .2em .8em; cursor: pointer; }
.moods button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.j-note textarea { resize: vertical; min-height: 56px; font: inherit; font-size: .92rem; }
.j-note .j-save { justify-self: start; }
.j-roll-body { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; margin-top: 10px; align-items: end; }
@media (max-width: 720px) { .j-roll-body { grid-template-columns: 1fr; } }
.j-mini { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin: 0; }
.j-mini div { background: var(--raise); border-radius: 10px; padding: .5em .7em; }
.j-mini dt { font-size: .74rem; color: var(--muted); }
.j-mini dd { margin: .1rem 0 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.j-bars { display: flex; align-items: center; gap: 4px; height: 110px; padding-bottom: 16px; position: relative; border-bottom: 1px solid var(--rule); }
.j-bars span { flex: 1; height: 100%; position: relative; min-width: 6px; }
.j-bars span i { position: absolute; left: 10%; right: 10%; border-radius: 4px 4px 0 0; height: calc(var(--h) / 2); bottom: 50%; background: var(--brand); }
.j-bars span.r i { top: 50%; bottom: auto; border-radius: 0 0 4px 4px; background: var(--crit); }
.j-bars span.broke i { background-image: repeating-linear-gradient(45deg, transparent 0 3px, rgb(0 0 0 / .25) 3px 5px); }
.j-bars small { position: absolute; bottom: -16px; left: 0; right: 0; text-align: center; font-size: .66rem; color: var(--muted); }

/* ---------- Plan editor ---------- */
.presets { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.presets > span { font-size: .85rem; color: var(--muted); font-weight: 600; margin-right: 4px; }
.chip { font: inherit; font-size: .88rem; font-weight: 600; border: 1px solid var(--rule); background: var(--panel); color: var(--ink); border-radius: 999px; padding: .35em .9em; cursor: pointer; }
.chip:hover { border-color: var(--brand); color: var(--brand); }
.plan-form { display: grid; gap: 14px; }
.pf-card { background: var(--panel); border: 1px solid var(--rule); border-radius: 16px; padding: 18px 20px; }
.pf-card h2 { margin: 0 0 .3rem; font-size: 1.1rem; }
.pf-card > .small { margin: 0 0 .8rem; max-width: 70ch; }
.pf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 4px 14px; }
.pf-card .check { display: flex; gap: .6rem; align-items: flex-start; margin-top: .5rem; }
.pf-card .check small { display: block; color: var(--muted); font-size: .82rem; }
.pf-rules { margin: 0 0 .5rem; padding-left: 1.4rem; display: grid; gap: 8px; }
.pf-rules li { display: flex; gap: 8px; align-items: center; }
.pf-rules .input { flex: 1; }
.pf-del { width: 34px; height: 34px; flex: none; border-radius: 50%; border: 1px solid var(--rule); background: transparent; color: var(--muted); font-size: 1.1rem; cursor: pointer; }
.pf-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; position: sticky; bottom: 0; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(6px); padding: 12px 0; }
.pf-actions > div { display: flex; gap: 8px; }
.journal .seg { display: inline-flex; background: var(--raise); border: 1px solid var(--rule); border-radius: 12px; padding: 3px; }
.journal .seg button { font: inherit; font-weight: 600; font-size: .88rem; border: 0; background: transparent; color: var(--muted); border-radius: 9px; padding: .45em .9em; cursor: pointer; }
.journal .seg button[aria-selected="true"] { background: var(--brand); color: var(--brand-ink); }
.j-day .badge { display: inline-block; white-space: nowrap; font-size: .74rem; font-weight: 700; padding: .25em .7em; border-radius: 999px; }
@media (max-width: 560px) { .j-day > header { flex-direction: column; } .j-day-right { width: 100%; justify-content: space-between; } }

/* ---------- Profile ---------- */
.profile .pf-card h2.sub { margin-top: 1.2rem; }
.tier-badge { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: .2em .6em; border-radius: 999px; background: var(--brand); color: var(--brand-ink); margin-right: .4rem; }
.key-card.fresh { border-color: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 20%, transparent); }
.key-warn { color: var(--warn-text); }
.key-box { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: .6rem 0; }
.key-box code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.15rem; font-weight: 700; letter-spacing: .06em; background: var(--raise); padding: .55em .8em; border-radius: 10px; }
.key-box code.masked { color: transparent; text-shadow: 0 0 9px var(--ink); user-select: none; }
.key-actions { display: flex; gap: 14px; align-items: center; }
.alert-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 2px 14px; margin: .4rem 0 .8rem; }
.alert-groups .check, .profile .check { display: flex; gap: .55rem; align-items: flex-start; margin: .3rem 0; }
.alert-groups small { display: block; color: var(--muted); font-size: .78rem; }
.tg-list { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: .6rem 0; }
.tg-list span { font-size: .84rem; padding: .3em .7em; border-radius: 999px; background: var(--raise); color: var(--muted); }
.tg-list span.on { color: var(--brand); background: color-mix(in srgb, var(--brand) 14%, transparent); }
.upg, .data-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.signin { max-width: 620px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .06em; }
.check.agree { display: flex; gap: .6rem; align-items: flex-start; font-size: .9rem; margin: .8rem 0; padding: .7rem .8rem; border: 1px solid var(--rule); border-radius: 10px; background: var(--raise); }
.check.agree a { color: var(--brand); }
.app-legal { max-width: 1200px; margin: 40px auto 24px; padding: 16px 20px 0; border-top: 1px solid var(--rule); }
.app-legal p { font-size: .78rem; color: var(--muted); max-width: none; margin: 0; }
.app-legal a { color: var(--muted); }
.disclaim { font-size: .82rem; color: var(--muted); border-left: 3px solid var(--rule); padding: .5rem .8rem; margin: .8rem 0; max-width: none; background: var(--raise); border-radius: 0 8px 8px 0; }
.pbadge { font-style: normal; font-family: var(--f); font-size: .66rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; padding: .15em .5em; border-radius: 999px; vertical-align: 2px; margin-left: .3rem; background: color-mix(in srgb, var(--brand) 16%, transparent); color: var(--brand); }
.pbadge.sponsored { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn-text); }
.offer-box { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; background: var(--panel); border: 1px dashed color-mix(in srgb, var(--warn) 60%, var(--rule)); border-radius: 14px; padding: 12px 16px; margin: 12px 0; }
.offer-box.verified { border-color: color-mix(in srgb, var(--brand) 55%, var(--rule)); }
.offer-box img { width: 40px; height: 40px; border-radius: 10px; object-fit: contain; background: #fff; }
.offer-box .o-body { flex: 1; min-width: 220px; }
.offer-box .o-body small { display: block; font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.offer-box .o-body p { margin: .15rem 0 0; max-width: none; }
.offer-box code { font-weight: 700; background: var(--raise); padding: .15em .45em; border-radius: 6px; }
.profile .pf-actions { position: static; background: none; backdrop-filter: none; padding: 8px 0 0; }
.gift-redeem { display: flex; flex-wrap: wrap; gap: .5rem; margin: .4rem 0; }
.gift-redeem .input { flex: 1 1 200px; max-width: 280px; font-family: ui-monospace, Menlo, monospace; letter-spacing: .04em; }
.gift-pf .check small { display: block; color: var(--muted); font-weight: 400; }
.bk-new { background: color-mix(in srgb, var(--brand) 10%, var(--panel)); border: 1px solid color-mix(in srgb, var(--brand) 40%, var(--rule)); border-radius: 12px; padding: .8rem 1rem; margin: .8rem 0; }
.bk-new p { margin: 0 0 .4rem; }
.bk-list { list-style: none; margin: .8rem 0; padding: 0; display: grid; gap: .5rem; }
.bk-list li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; background: var(--raise); border-radius: 10px; padding: .6rem .8rem; }
.bk-list small { display: block; color: var(--muted); font-size: .82rem; }
.dz-link { display: flex; flex-wrap: wrap; gap: .5rem; }
.dz-link .input { flex: 1 1 240px; min-width: 0; }
@media (max-width: 520px) { .app-tabs { gap: 0; } .app-tabs a { padding: .65em .45em; font-size: .84rem; flex: 1 1 auto; text-align: center; } }
.view-switch { display: flex; justify-content: flex-end; align-items: center; gap: .6rem; margin: 0 0 12px; font-size: .88rem; color: var(--muted); font-weight: 600; }
.view-switch .seg { display: inline-flex; background: var(--raise); border: 1px solid var(--rule); border-radius: 12px; padding: 3px; }
.view-switch .seg button { font: inherit; font-weight: 600; font-size: .88rem; border: 0; background: transparent; color: var(--muted); border-radius: 9px; padding: .4em .9em; cursor: pointer; }
.view-switch .seg button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); }
.grid.simple { grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); }
.acct.simple .nearest { margin-bottom: .9rem; }
.simple-walls { display: grid; gap: .9rem; }
.simple-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; margin: 1rem 0 0; }
.simple-facts div { background: var(--raise); border-radius: var(--r-md); padding: .5rem .65rem; min-width: 0; }
.simple-facts dt { font-size: .74rem; color: var(--muted); font-weight: 600; }
.simple-facts dd { margin: .1rem 0 0; font-weight: 700; font-size: .9rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.simple-facts .up { color: var(--brand); } .simple-facts .down { color: var(--crit-text); }
.acct.simple .co-exp { margin-top: .9rem; }
.bill-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .6rem 0; }
.bill-leave { margin-top: .8rem; padding: 1rem 1.1rem; border: 1px solid var(--rule); border-radius: 12px; background: var(--raise); }
.bill-leave h3 { margin: 0 0 .3rem; font-size: 1rem; font-family: var(--fd); }
.bill-leave h3 + p { margin-top: 0; }
.bill-leave p { font-size: .92rem; }
.bill-leave .field { max-width: 360px; }
.swap-note { background: color-mix(in srgb, var(--brand) 9%, var(--panel)); border: 1px solid color-mix(in srgb, var(--brand) 35%, var(--rule)); border-radius: 12px; padding: .8rem 1rem; font-size: .93rem; }
.trial-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1.2rem; margin: 0 0 14px; padding: .8rem 1rem; border-radius: 14px; background: color-mix(in srgb, var(--brand) 10%, var(--panel)); border: 1px solid color-mix(in srgb, var(--brand) 40%, var(--rule)); }
.trial-banner p { margin: 0; max-width: 70ch; font-size: .93rem; }
.trial-banner .co-act { margin: 0; }
.suggest { max-height: 290px; overflow-y: auto; }
.suggest button.on { background: var(--raise); box-shadow: inset 3px 0 0 var(--brand); }
.suggest .sug-note { padding: .55rem .8rem; font-size: .88rem; color: var(--muted); background: var(--panel); }

.lead-pick { margin-bottom: .4rem; }
.lead-label { display: block; font-weight: 600; font-size: .95rem; margin-bottom: .1rem; }
.check-row { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; margin-top: .35rem; }
.check-row .check { margin: 0; }

/* Trade calculator */
.calc-head { margin-bottom: 1.2rem; }
.calc-head h2 { margin: 0 0 .25rem; }
.calc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
@media (max-width: 860px) { .calc { grid-template-columns: minmax(0, 1fr); } }
.calc-in { min-width: 0; }
.calc-in .seg { display: inline-flex; margin-bottom: 1rem; background: var(--raise); border: 1px solid var(--rule); border-radius: 12px; padding: 3px; }
.calc-in .seg button { font: inherit; font-weight: 600; font-size: .9rem; border: 0; background: transparent; color: var(--muted); border-radius: 9px; padding: .5em 1.1em; cursor: pointer; }
.calc-in .seg button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); }
.calc-side button[data-side="sell"][aria-pressed="true"] { background: var(--crit); color: #fff; }
.calc-mode { margin: .35rem 0 .5rem !important; flex-wrap: wrap; }
label.field > span.calc-px { display: flex; gap: 8px; font-weight: 400; margin: 0; }
.calc-px .input { flex: 1; min-width: 0; }
.calc-px .btn { white-space: nowrap; }
.calc-out { min-width: 0; position: sticky; top: calc(env(safe-area-inset-top, 0px) + 80px); background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r-md, 14px); padding: 1.1rem 1.2rem; }
@media (max-width: 860px) { .calc-out { position: static; } }
.calc-big { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 1rem; }
@media (max-width: 420px) { .calc-big { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.calc-big > div { background: var(--raise); border-radius: 10px; padding: .7rem .8rem; min-width: 0; }
.calc-big span { display: block; font-size: .82rem; color: var(--muted); }
.calc-big b { display: block; font-size: 1.3rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.calc-big b.down { color: var(--crit-text); } .calc-big b.up { color: var(--brand); }
.calc-big small { color: var(--muted); font-size: .8rem; }
.calc-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem 1rem; margin: 0 0 1rem; }
.calc-facts dt { font-size: .8rem; color: var(--muted); }
.calc-facts dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.calc-facts small { font-weight: 400; color: var(--muted); }
.calc-out h4 { margin: .4rem 0 .4rem; font-size: .95rem; }
.calc-checks { list-style: none; margin: 0 0 .8rem; padding: 0; display: grid; gap: .35rem; }
.calc-checks li { padding: .5rem .7rem; border-radius: 9px; font-size: .92rem; background: color-mix(in srgb, var(--brand) 9%, transparent); }
.calc-checks li.warn { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn-text); }
.calc-checks li.bad { background: color-mix(in srgb, var(--crit) 11%, transparent); color: var(--crit-text); font-weight: 600; }
.calc-warn { margin: 0 0 .5rem; padding: .5rem .7rem; border-radius: 9px; background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn-text); font-size: .92rem; }
.calc-src { color: var(--muted); margin: 0; }
.calc-bal { max-width: 320px; }

/* Phones: a small summary pinned to the bottom, so the result shows while the form is being filled in. */
.calc-mini { display: none; }
@media (max-width: 860px) {
  .calc-mini:not([hidden]) { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; gap: 14px; justify-content: center; flex-wrap: wrap;
    padding: .6rem 16px calc(.6rem + env(safe-area-inset-bottom, 0px)); background: var(--panel); border-top: 1px solid var(--rule); box-shadow: 0 -6px 18px rgb(0 0 0 / .08); font-size: .9rem; font-variant-numeric: tabular-nums; }
  .calc-mini { color: var(--ink); text-decoration: none; }
  .calc-mini b.down { color: var(--crit-text); } .calc-mini b.up { color: var(--brand); }
  .calc { padding-bottom: 64px; }
}

/* Guided tour */
.tour-btn { margin-right: auto; font-size: .9rem; }
.tour-shade { position: fixed; inset: 0; z-index: 60; }
.tour-shade.dim { background: rgb(5 15 17 / .55); }
.tour-ring { position: fixed; z-index: 61; border-radius: 14px; box-shadow: 0 0 0 3px var(--brand), 0 0 0 9999px rgb(5 15 17 / .55); pointer-events: none; transition: top .2s, left .2s, width .2s, height .2s; }
.tour-card { position: fixed; z-index: 62; background: var(--panel); color: var(--ink); border: 1px solid var(--rule); border-radius: 16px; padding: 1.1rem 1.2rem 1rem; box-shadow: 0 18px 50px rgb(0 0 0 / .25); max-width: calc(100vw - 32px); }
.tour-card.center { top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(420px, calc(100vw - 32px)); }
.tour-card.dock { left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); top: auto !important; width: auto; }
.tour-card h3 { margin: .15rem 0 .4rem; font-size: 1.15rem; }
.tour-card p { margin: 0 0 .8rem; font-size: .95rem; line-height: 1.5; }
.tour-step { font-size: .75rem !important; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--brand); margin: 0 !important; }
.tour-act { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.tour-act span { display: flex; gap: .5rem; }

/* Journal: where you make and lose money */
.j-breakdown { margin: 2rem 0; }
.bd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-top: 1rem; }
.bd-card { background: var(--panel); border: 1px solid var(--rule); border-radius: 14px; padding: .9rem 1rem; min-width: 0; }
.bd-card h3 { margin: 0 0 .5rem; font-size: 1rem; }
.bd-card table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.bd-card th { text-align: left; font-weight: 600; padding: .35rem .4rem .35rem 0; white-space: nowrap; }
.bd-card th small { display: block; font-weight: 400; color: var(--muted); font-size: .76rem; }
.bd-card td { padding: .35rem 0; vertical-align: middle; }
.bd-card td:nth-child(2) { width: 40%; padding-right: .5rem; }
.bd-card td:last-child { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.bd-bar { display: block; height: 8px; border-radius: 4px; min-width: 2px; }
.bd-bar.up { background: color-mix(in srgb, var(--brand) 70%, transparent); } .bd-bar.down { background: color-mix(in srgb, var(--crit) 70%, transparent); }
.bd-card tr.best th { color: var(--brand); } .bd-card tr.worst th { color: var(--crit-text); }

/* Challenge fee tracker */
.lg-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 1rem 0; }
.lg-totals div { background: var(--raise); border-radius: 12px; padding: .7rem .85rem; }
.lg-totals dt { font-size: .8rem; color: var(--muted); }
.lg-totals dd { margin: .15rem 0 0; font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.lg-totals dd small { display: block; font-size: .78rem; font-weight: 400; color: var(--muted); }
.lg-totals .up, .lg-list .up, .lg-firms .up { color: var(--brand); } .lg-totals .down, .lg-list .down, .lg-firms .down { color: var(--crit-text); }
.lg-firms { width: 100%; border-collapse: collapse; font-size: .9rem; margin-bottom: 1rem; display: block; overflow-x: auto; }
.lg-firms th, .lg-firms td { text-align: left; padding: .35rem .6rem .35rem 0; white-space: nowrap; }
.lg-list { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .3rem; }
.lg-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; gap: .6rem; align-items: center; font-size: .9rem; padding: .4rem 0; border-bottom: 1px solid var(--rule); }
.lg-list small { color: var(--muted); }
.lg-list time { color: var(--muted); font-variant-numeric: tabular-nums; }
.lg-list b { font-variant-numeric: tabular-nums; }
.lg-type { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: .1rem .45rem; border-radius: 999px; }
.lg-type.fee { background: color-mix(in srgb, var(--crit) 12%, transparent); color: var(--crit-text); }
.lg-type.payout { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); }
.lg-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0 12px; align-items: end; }
.lg-form .btn { margin-bottom: 1rem; }
@media (max-width: 520px) { .lg-list li { grid-template-columns: auto minmax(0, 1fr) auto; } .lg-list time, .lg-list .linkbtn { grid-column: 2; } }

/* Trade charts (journal) */
.j-charts { margin: 2rem 0; position: relative; }
.tc-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .6rem; margin: .8rem 0 1rem; }
.tc-kpis > div { background: var(--panel); border: 1px solid var(--rule); border-radius: 12px; padding: .6rem .8rem; min-width: 0; }
.tc-kpis dt { font-size: .78rem; color: var(--muted); }
.tc-kpis dd { margin: .15rem 0 0; font: 600 1.15rem/1.2 var(--fd); font-variant-numeric: tabular-nums; }
.tc-kpis dd small { display: block; font: 400 .78rem var(--f); color: var(--muted); margin-top: .1rem; }
.tc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: .8rem; }
.tc-card { margin: 0; background: var(--panel); border: 1px solid var(--rule); border-radius: 14px; padding: .9rem 1rem .6rem; min-width: 0; }
.tc-wide { grid-column: 1 / -1; }
.tc-card figcaption h3 { margin: 0; font-size: 1rem; }
.tc-card figcaption p { margin: .15rem 0 .4rem; }
.tc-svg { width: 100%; height: auto; display: block; touch-action: pan-y; }
.tc-svg .grid { stroke: var(--rule); stroke-width: 1; }
.tc-svg .lbl { font: 12px var(--f); fill: var(--muted); font-variant-numeric: tabular-nums; }
.tc-svg .lbl.strong { fill: var(--ink); font-weight: 600; }
.tc-svg .hit { fill: transparent; cursor: crosshair; }
.tc-svg .hit.on { fill: var(--ink); fill-opacity: .06; }
.tc-svg .xhair { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; }
.tc-svg .xhair.on { opacity: 1; }
.tc-svg .xdot { fill: var(--brand); stroke: var(--panel); stroke-width: 2; }
.tc-svg .xdot.loss { fill: var(--loss); }
.tc-tip { position: absolute; z-index: 5; pointer-events: none; background: var(--ink); color: var(--panel); border-radius: 8px; padding: .45rem .6rem; font-size: .8rem; line-height: 1.35; box-shadow: var(--shadow); max-width: 240px; font-variant-numeric: tabular-nums; }
.tc-tip b, .tc-tip span { display: block; }
.tc-table { margin-top: .8rem; }
.tc-table summary { cursor: pointer; color: var(--brand); font-size: .9rem; }
.tc-table table { margin-top: .5rem; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tc-table th, .tc-table td { padding: .25rem .9rem .25rem 0; text-align: left; border-bottom: 1px solid var(--rule); }
@media (max-width: 560px) { .tc-kpis { grid-template-columns: 1fr 1fr; } .tc-kpis > div:last-child:nth-child(odd) { grid-column: 1 / -1; } }

/* Rooms (chat) */
.rooms { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 1rem; align-items: start; margin-top: 1rem; }
.rm-side { display: grid; gap: .8rem; min-width: 0; }
.rm-side-h h2 { margin: 0; }
.rm-side-h p { margin: .2rem 0 0; }
.rm-rooms { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
.rm-rooms a { display: block; padding: .55rem .7rem; border-radius: 10px; border: 1px solid var(--rule); background: var(--panel); color: var(--ink); text-decoration: none; }
.rm-rooms a[aria-current="page"] { border-color: var(--brand); box-shadow: inset 3px 0 0 var(--brand); }
.rm-rooms small { display: block; color: var(--muted); font-size: .78rem; margin-top: .1rem; }
.rm-li-name { font-weight: 600; display: flex; align-items: center; gap: .4rem; }
.rm-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); display: inline-block; }
.rm-box { border: 1px solid var(--rule); border-radius: 10px; background: var(--panel); padding: .55rem .7rem; }
.rm-box summary { cursor: pointer; font-weight: 600; font-size: .92rem; }
.rm-form { display: flex; gap: .5rem; margin-top: .6rem; flex-wrap: wrap; }
.rm-form .input { flex: 1 1 140px; min-width: 0; }
.rm-form.col { flex-direction: column; }
.rm-form .hint { margin: 0; font-size: .78rem; color: var(--muted); }
.rm-me { margin: 0; }
.rm-main { min-width: 0; background: var(--panel); border: 1px solid var(--rule); border-radius: 14px; display: flex; flex-direction: column; overflow: hidden; }
.rm-empty { min-height: 320px; align-items: center; justify-content: center; text-align: center; padding: 2rem 1.2rem; }
.rm-empty > div { max-width: 46ch; }
.rm-head { display: flex; gap: .8rem; align-items: center; justify-content: space-between; padding: .8rem 1rem; border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.rm-head h2 { margin: 0; font-size: 1.15rem; }
.rm-head p { margin: .1rem 0 0; }
.rm-head > div { flex: 1 1 200px; min-width: 0; }
.rm-back { display: none; font-size: .9rem; }
.rm-members { position: relative; font-size: .88rem; }
.rm-members summary { cursor: pointer; color: var(--brand); }
.rm-members ul { position: absolute; right: 0; z-index: 4; list-style: none; margin: .3rem 0 0; padding: .5rem; min-width: 240px; background: var(--panel); border: 1px solid var(--rule); border-radius: 10px; box-shadow: var(--shadow); display: grid; gap: .35rem; }
.rm-members li { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.rm-host, .rm-sharing { font-size: .7rem; padding: .05rem .4rem; border-radius: 99px; border: 1px solid var(--rule); color: var(--muted); }
.rm-host { border-color: var(--brand); color: var(--brand); }
.rm-settings { border-bottom: 1px solid var(--rule); padding: .5rem 1rem; font-size: .92rem; }
.rm-settings summary { cursor: pointer; color: var(--brand); }
.rm-set-body { display: grid; gap: .9rem; padding: .7rem 0 .3rem; }
.rm-code { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: .4rem; }
.rm-code code { font: 600 1.05rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; padding: .45rem .6rem; background: var(--raise); border-radius: 8px; }
.rm-share { border: 1px solid var(--rule); border-radius: 10px; padding: .6rem .8rem; margin: 0; }
.rm-share legend { font-weight: 600; padding: 0 .3rem; }
.btn.danger { color: var(--crit-text); border-color: var(--crit); justify-self: start; }
.rm-disc { margin: 0; max-width: none; padding: .45rem 1rem; font-size: .78rem; color: var(--muted); background: var(--raise); }
.rm-pin { padding: .5rem 1rem; border-bottom: 1px solid var(--rule); font-size: .88rem; display: flex; gap: .4rem; align-items: baseline; flex-wrap: wrap; }
.rm-pin-l { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--brand); font-weight: 700; }
.rm-list { list-style: none; margin: 0; padding: .6rem 1rem 1rem; display: flex; flex-direction: column; gap: .55rem; overflow-y: auto; height: clamp(360px, calc(100vh - 330px), 760px); overscroll-behavior: contain; }
.rm-sys { text-align: center; font-size: .78rem; color: var(--muted); }
.rm-day { text-align: center; font-size: .75rem; color: var(--muted); display: flex; align-items: center; gap: .6rem; margin-top: .4rem; }
.rm-day::before, .rm-day::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
.rm-msg { max-width: min(560px, 92%); align-self: flex-start; }
.rm-msg.mine { align-self: flex-end; }
.rm-meta { display: flex; gap: .4rem; align-items: baseline; font-size: .8rem; margin-bottom: .15rem; }
.rm-msg.mine .rm-meta { justify-content: flex-end; }
.rm-name { font-weight: 600; }
.rm-meta time { color: var(--muted); font-size: .72rem; }
.rm-text { margin: 0; max-width: none; font-size: .95rem; padding: .5rem .75rem; background: var(--raise); border-radius: 4px 14px 14px 14px; line-height: 1.45; overflow-wrap: anywhere; }
.rm-msg.mine .rm-text { background: var(--brand); color: var(--brand-ink); border-radius: 14px 4px 14px 14px; }
.rm-msg.mine .rm-text a { color: inherit; }
.rm-gone { margin: 0; font-style: italic; color: var(--muted); font-size: .88rem; }
.rm-quote { margin: 0 0 .2rem; padding: .3rem .6rem; border-left: 3px solid var(--rule); font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-acts { display: flex; gap: .7rem; margin-top: .15rem; opacity: .0; transition: opacity .15s; }
.rm-msg.mine .rm-acts { justify-content: flex-end; }
.rm-msg:hover .rm-acts, .rm-msg:focus-within .rm-acts { opacity: 1; }
@media (hover: none) { .rm-acts { opacity: 1; } }
.rm-acts button { background: none; border: 0; padding: 0; font: inherit; font-size: .75rem; color: var(--muted); cursor: pointer; }
.rm-acts button:hover { color: var(--brand); }
.rm-trade { border: 1px solid var(--rule); border-left: 4px solid var(--brand); border-radius: 10px; padding: .55rem .75rem; background: var(--surface); min-width: min(320px, 100%); }
.rm-trade.win { border-left-color: var(--gain); }
.rm-trade.loss { border-left-color: var(--loss); }
.rm-trade.move { border-left-color: var(--muted); }
.rm-trade-h { display: flex; gap: .45rem; align-items: center; flex-wrap: wrap; }
.rm-kind { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--muted); }
.rm-side.buy { color: var(--gain); font-weight: 600; }
.rm-side.sell { color: var(--loss); font-weight: 600; }
.rm-verified { margin-left: auto; font-size: .7rem; padding: .05rem .45rem; border-radius: 99px; background: var(--raise); color: var(--muted); }
.rm-verified::before { content: "✓ "; color: var(--brand); }
.rm-trade dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: .3rem .8rem; margin: .45rem 0 0; }
.rm-trade dt { font-size: .7rem; color: var(--muted); }
.rm-trade dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; font-size: .9rem; }
.rm-compose { border-top: 1px solid var(--rule); padding: .6rem .8rem; display: grid; gap: .4rem; }
.rm-row { display: flex; gap: .5rem; align-items: flex-end; }
.rm-row textarea { flex: 1; resize: none; min-height: 42px; max-height: 160px; min-width: 0; }
.rm-replying { display: flex; gap: .6rem; justify-content: space-between; font-size: .8rem; color: var(--muted); }
.rm-replying span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-demo { margin: 0; padding: .7rem 1rem; border-top: 1px solid var(--rule); }
.rm-gate { max-width: 560px; margin: 2rem auto; display: grid; gap: .6rem; }
.rm-gate h2 { margin: 0; }
.rm-gate p { margin: 0; }
@media (max-width: 760px) {
  .rooms { grid-template-columns: 1fr; }
  .rooms.has-room .rm-side, .rooms:not(.has-room) .rm-empty { display: none; }
  .rm-back { display: inline; flex-basis: 100%; }
  .rm-list { height: calc(100dvh - 300px); min-height: 320px; }
  .rm-members ul { right: auto; left: 0; }
}
