:root {
  color-scheme: dark;
  --bg: #07100e;
  --surface: #0c1815;
  --surface-2: #10211c;
  --surface-3: #132821;
  --line: rgba(218, 235, 226, 0.12);
  --line-strong: rgba(218, 235, 226, 0.22);
  --text: #edf6f1;
  --muted: #8fa49a;
  --accent: #e6b95f;
  --positive: #ff615d;
  --negative: #36c98a;
  --blue: #6aa8ff;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  font-family: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% -8%, rgba(230, 185, 95, 0.12), transparent 34rem),
    radial-gradient(circle at 92% 18%, rgba(54, 201, 138, 0.08), transparent 30rem),
    var(--bg);
  color: var(--text);
}
button, input, select { font: inherit; }
button { color: inherit; }

.shell { width: min(1900px, calc(100% - 32px)); margin: 0 auto; padding: 20px 0 30px; }
.topbar, .brand, .top-actions, .status-strip, .status-left, .status-right,
.screen-heading, .screen-heading > div, .panel-heading, .decision-meta, .level-item,
.ledger-heading, .plan-main, .form-actions { display: flex; align-items: center; }

.topbar { justify-content: space-between; gap: 20px; }
.brand { gap: 13px; }
.brand h1 { margin: 2px 0 0; font-size: clamp(21px, 1.8vw, 29px); letter-spacing: -.035em; }
.eyebrow { margin: 0; color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.brand-mark {
  display: flex; align-items: end; gap: 4px; width: 40px; height: 40px; padding: 9px;
  border: 1px solid rgba(230,185,95,.34); background: rgba(230,185,95,.08); border-radius: 12px;
}
.brand-mark span { flex: 1; border-radius: 2px; background: var(--accent); }
.brand-mark span:nth-child(1) { height: 40%; opacity: .55; }
.brand-mark span:nth-child(2) { height: 75%; opacity: .8; }
.brand-mark span:nth-child(3) { height: 100%; }

.top-actions { justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.mode-switch { display: flex; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.mode-button, .primary-button, .secondary-button, .text-button, .close-button {
  border: 0; cursor: pointer; transition: .18s ease; font-weight: 700;
}
.mode-button { padding: 8px 12px; color: var(--muted); background: transparent; border-radius: 8px; font-size: 12px; }
.mode-button.active { color: #07100e; background: var(--accent); }
.primary-button, .secondary-button { padding: 10px 13px; border-radius: 10px; font-size: 12px; }
.primary-button { color: #07100e; background: var(--accent); }
.secondary-button { color: var(--text); background: transparent; border: 1px solid var(--line-strong); }
.secondary-button:hover, .text-button:hover { color: var(--accent); border-color: rgba(230,185,95,.5); }
button:disabled { cursor: not-allowed; opacity: .55; }
button[aria-busy="true"] { cursor: wait; }
.text-button, .close-button { padding: 5px 7px; color: var(--muted); background: transparent; font-size: 10px; }

.status-strip {
  justify-content: space-between; gap: 16px; margin: 17px 0 10px; padding: 10px 13px;
  color: var(--muted); font-size: 11px; background: rgba(13,25,22,.74); border: 1px solid var(--line); border-radius: 11px;
}
.status-left, .status-right { gap: 8px; flex-wrap: wrap; }
.source-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--negative); box-shadow: 0 0 12px rgba(54,201,138,.72); }
.source-dot.error { background: var(--positive); box-shadow: 0 0 12px rgba(255,97,93,.72); }
.source-dot.warn { background: var(--accent); box-shadow: 0 0 12px rgba(230,185,95,.72); }
.separator { color: rgba(255,255,255,.18); }
.status-chip { display: inline-flex; padding: 4px 8px; border-radius: 999px; font-size: 9px; font-weight: 900; letter-spacing: .07em; white-space: nowrap; }
.status-chip.neutral { color: #b9c8c1; background: rgba(185,200,193,.09); }
.status-chip.good { color: #7ae0b0; background: rgba(54,201,138,.12); }
.status-chip.warn { color: #ffd27a; background: rgba(230,185,95,.12); }
.status-chip.bad { color: #ff918e; background: rgba(255,97,93,.12); }

.dual-screen { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; align-items: start; }
.screen { min-width: 0; overflow: hidden; background: rgba(7,16,14,.48); border: 1px solid var(--line); border-radius: 16px; }
.screen-heading { justify-content: space-between; gap: 12px; padding: 10px 13px; background: rgba(16,33,28,.66); border-bottom: 1px solid var(--line); }
.screen-heading > div { gap: 8px; }
.screen-heading span { color: var(--accent); font-size: 9px; font-weight: 800; letter-spacing: .1em; }
.screen-heading h2 { margin: 0; font-size: 13px; }
.screen-heading p { margin: 0; color: var(--muted); font-size: 9px; }
.screen-left, .screen-right { padding-bottom: 8px; }
.screen > :not(.screen-heading) { margin-left: 8px; margin-right: 8px; }
.screen-left > :nth-child(2) { margin-top: 8px; }
.screen-right > .screen-heading { margin-bottom: 8px; }

.panel {
  background: linear-gradient(145deg, rgba(17,34,29,.95), rgba(10,20,17,.97));
  border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow);
}
.panel-heading { justify-content: space-between; gap: 12px; padding: 11px 13px; }
.panel-heading.compact { padding-bottom: 8px; }
.panel-heading h2 { margin: 4px 0 0; font-size: 14px; }
.panel-heading > p, .panel-heading > div + p { margin: 0; color: var(--muted); font-size: 9px; text-align: right; }

.market-strip { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 6px; margin-bottom: 7px; }
.metric-tile { min-width: 0; padding: 9px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.metric-tile span { display: block; color: var(--muted); font-size: 9px; }
.metric-tile strong { display: block; overflow: hidden; margin-top: 3px; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.metric-tile small { display: block; overflow: hidden; margin-top: 3px; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.price-tile strong { color: var(--positive); font-size: 23px; line-height: 1; }
.price-tile small { font-weight: 800; }

.positive { color: var(--positive) !important; }
.negative { color: var(--negative) !important; }
.flat { color: var(--muted) !important; }

.decision-grid { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(190px,.65fr); gap: 7px; margin-bottom: 7px; }
.decision-card { position: relative; overflow: hidden; min-height: 244px; padding-bottom: 10px; }
.decision-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--blue); }
.decision-card.action-sell::before, .decision-card.action-risk::before { background: var(--positive); }
.decision-card.action-buy::before { background: var(--negative); }
.decision-card h2 { margin: 7px 13px 8px; font-size: clamp(22px,2vw,31px); line-height: 1.15; }
.confidence-number { color: var(--text); font-size: 11px; font-weight: 800; }
.decision-meta { gap: 6px; padding: 0 13px; flex-wrap: wrap; }
.decision-meta span { padding: 5px 7px; color: #b9c8c1; font-size: 9px; background: rgba(255,255,255,.045); border: 1px solid var(--line); border-radius: 6px; }
.confidence-track { height: 3px; margin: 12px 13px 0; overflow: hidden; background: rgba(255,255,255,.08); border-radius: 999px; }
.confidence-track span { display: block; width: 0; height: 100%; background: linear-gradient(90deg,var(--blue),var(--accent)); transition: width .35s ease; }
.reason-list { margin: 10px 13px 0; padding-left: 15px; color: #b8c8c0; font-size: 10px; line-height: 1.55; }
.gate-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 5px; margin: 9px 13px 0; }
.gate-item { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 6px 7px; background: rgba(255,255,255,.025); border-radius: 7px; font-size: 9px; }
.gate-item i { width: 7px; height: 7px; border-radius: 50%; background: var(--negative); }
.gate-item.blocked i { background: var(--positive); }
.gate-item small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.levels-card { padding: 13px; }
.levels-card > .eyebrow { margin-bottom: 15px; }
.level-item { justify-content: space-between; gap: 9px; }
.level-item div { display: flex; flex-direction: column; gap: 4px; }
.level-item span { font-size: 12px; font-weight: 750; }
.level-item small { color: var(--muted); font-size: 9px; }
.level-item strong { font-size: 25px; letter-spacing: -.04em; }
.sell-level strong { color: var(--positive); }
.buy-level strong { color: var(--negative); }
.level-divider { height: 1px; margin: 15px 0; background: var(--line); }
.risk-note { margin: 15px 0 0; color: var(--muted); font-size: 9px; line-height: 1.55; }

.benchmarks { margin-bottom: 7px; }
.benchmark-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; padding: 0 10px 10px; }
.benchmark-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; min-width: 0; padding: 9px; background: rgba(255,255,255,.025); border: 1px solid var(--line); border-radius: 8px; }
.benchmark-item h3 { margin: 0; overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.benchmark-item strong { grid-row: span 2; align-self: center; font-size: 15px; }
.benchmark-item p { margin: 0; color: var(--muted); font-size: 8px; }
.benchmark-item .relative { color: var(--accent); }
.skeleton { min-height: 54px; opacity: .45; }

.fund-panel { overflow: hidden; }
.table-scroll { overflow-x: auto; }
.fund-table { width: 100%; border-collapse: collapse; min-width: 650px; font-variant-numeric: tabular-nums; }
.fund-table th, .fund-table td { padding: 7px 6px; text-align: right; border-top: 1px solid var(--line); font-size: 9px; white-space: nowrap; }
.fund-table th:first-child, .fund-table td:first-child { text-align: left; }
.fund-table thead th { color: var(--muted); font-size: 8px; letter-spacing: .03em; }
.fund-table tbody tr.latest td { background: rgba(255,255,255,.035); }
.time-main { display: block; font-size: 10px; font-weight: 800; }
.time-sub, .cell-sub { display: block; margin-top: 2px; color: var(--muted); font-size: 8px; }
.segment-state { font-weight: 800; }

.plan-card { margin-bottom: 7px; padding: 12px; }
.plan-card.plan-sell { border-color: rgba(255,97,93,.25); }
.plan-card.plan-buy { border-color: rgba(54,201,138,.25); }
.plan-main { justify-content: space-between; gap: 16px; }
.plan-main h2 { margin: 5px 0 2px; font-size: clamp(22px,2vw,31px); }
.plan-main p:last-child { margin: 0; color: var(--muted); font-size: 10px; }
.plan-quantity { text-align: right; }
.plan-quantity span, .plan-quantity small { display: block; color: var(--muted); font-size: 9px; }
.plan-quantity strong { display: block; margin: 3px 0; color: var(--accent); font-size: 24px; font-variant-numeric: tabular-nums; }
.plan-details { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.plan-details div { padding: 8px; background: rgba(255,255,255,.025); border-radius: 7px; }
.plan-details span { display: block; color: var(--muted); font-size: 8px; }
.plan-details strong { display: block; margin-top: 3px; font-size: 9px; font-weight: 650; }

.ledger-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 7px; }
.ledger-card { padding: 11px; }
.ledger-heading { justify-content: space-between; gap: 10px; }
.ledger-heading h3 { margin: 3px 0 0; font-size: 13px; }
.ledger-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 10px; }
.ledger-metrics div { padding: 7px; background: rgba(255,255,255,.025); border-radius: 7px; }
.ledger-metrics span { display: block; color: var(--muted); font-size: 8px; }
.ledger-metrics strong { display: block; margin-top: 3px; font-size: 11px; font-variant-numeric: tabular-nums; }
.ledger-summary { display: flex; align-items: center; justify-content: space-between; margin-top: 7px; padding: 8px; background: rgba(230,185,95,.07); border-radius: 7px; }
.ledger-summary span { color: var(--muted); font-size: 9px; }
.ledger-summary strong { color: var(--accent); font-size: 15px; }
.ledger-note { margin: 7px 0 0; color: var(--muted); font-size: 8px; line-height: 1.45; }

.activity-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 7px; }
.trades-panel { min-height: 160px; overflow: hidden; }
.trade-list { padding: 0 11px 8px; }
.trade-item { display: grid; grid-template-columns: 35px 1fr auto; gap: 7px; align-items: start; padding: 7px 0; border-top: 1px solid var(--line); }
.trade-time { color: var(--muted); font-size: 8px; font-variant-numeric: tabular-nums; }
.trade-main strong { display: block; font-size: 9px; }
.trade-main small { display: block; margin-top: 2px; color: var(--muted); font-size: 8px; }
.trade-value { text-align: right; font-size: 9px; font-variant-numeric: tabular-nums; }
.trade-value small { display: block; margin-top: 2px; color: var(--muted); font-size: 8px; }
.empty-copy { margin: 0; padding: 20px 0; color: var(--muted); font-size: 9px; text-align: center; }

.review-panel { overflow: hidden; }
.review-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 5px; padding: 0 11px 10px; }
.review-grid div { padding: 8px; background: rgba(255,255,255,.025); border-radius: 7px; }
.review-grid span { display: block; color: var(--muted); font-size: 8px; }
.review-grid strong { display: block; margin-top: 3px; font-size: 10px; }
.review-note { margin: -3px 11px 10px; color: var(--muted); font-size: 8px; line-height: 1.45; }
.health-strip { display: grid; grid-template-columns: repeat(4,1fr); gap: 5px; padding: 0 11px 9px; }
.health-strip div { min-width: 0; padding: 7px 8px; background: rgba(106,168,255,.055); border-radius: 7px; }
.health-strip span { display: block; color: var(--muted); font-size: 8px; }
.health-strip strong { display: block; overflow: hidden; margin-top: 3px; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.health-table-scroll { overflow-x: auto; margin: 0 11px 8px; border: 1px solid var(--line); border-radius: 8px; }
.health-table { width: 100%; min-width: 640px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.health-table th, .health-table td { padding: 6px; border-top: 1px solid var(--line); font-size: 8px; text-align: right; white-space: nowrap; }
.health-table th:first-child, .health-table td:first-child, .health-table th:last-child, .health-table td:last-child { text-align: left; }
.health-table thead th { color: var(--muted); border-top: 0; }
.health-error { margin-top: 0; }
.fund-data-note { margin: 10px 12px; color: var(--muted); font-size: 9px; line-height: 1.6; }
.close-snapshots { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin: 0 10px 10px; }
.close-snapshots[hidden] { display: none; }
.close-snapshot { padding: 10px; border: 1px solid var(--line); background: rgba(230,185,95,.035); border-radius: 8px; }
.close-snapshot strong { color: var(--accent); font-size: 10px; }
.close-snapshot p { margin: 6px 0; font-size: 10px; }
.close-snapshot small { color: var(--muted); font-size: 9px; line-height: 1.6; }

footer { display: flex; justify-content: space-between; gap: 20px; margin-top: 9px; padding: 0 3px; color: #667970; font-size: 9px; }

.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: start center; overflow-y: auto; padding: 7vh 16px 30px; background: rgba(0,0,0,.68); }
.modal-card { width: min(720px,100%); max-height: 90vh; max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; background: #0d1a16; border: 1px solid var(--line-strong); border-radius: 15px; box-shadow: var(--shadow); }
.modal-card.small { width: min(520px,100%); }
.modal-card > header { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 15px 17px; border-bottom: 1px solid var(--line); }
.modal-card h2 { margin: 4px 0 0; font-size: 18px; }
.modal-card form { padding: 16px 17px 17px; }
.form-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
.form-grid label { display: grid; gap: 5px; color: var(--muted); font-size: 10px; }
.form-grid label.wide { grid-column: 1 / -1; }
.form-grid input, .form-grid select { width: 100%; padding: 9px 10px; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; outline: none; }
.form-grid input:focus, .form-grid select:focus { border-color: rgba(230,185,95,.6); }
.form-note { margin: 12px 0; padding: 9px 10px; color: var(--muted); font-size: 9px; line-height: 1.5; background: rgba(255,255,255,.025); border-radius: 8px; }
.form-warning { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding: 10px; color: #ffd27a; background: rgba(230,185,95,.1); border: 1px solid rgba(230,185,95,.2); border-radius: 8px; }
.form-warning[hidden] { display: none; }
.form-warning strong, .form-warning span { display: block; }
.form-warning strong { font-size: 10px; }
.form-warning span { margin-top: 3px; color: var(--muted); font-size: 9px; }
.form-warning .secondary-button { flex: 0 0 auto; }
.form-actions { justify-content: flex-end; gap: 8px; }
.entry-message { color: var(--accent); font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
.entry-message:empty { display: none; }
.ledger-entry-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-top: 14px; }
.ledger-entry-actions button { min-height: 46px; padding: 10px 6px; line-height: 1.5; }
#ledgerEntryStatus { min-height: 2.5em; color: var(--accent); }
#calibrateReceiptButton, #tradeReceiptButton { margin-bottom: 12px; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 40; max-width: 390px; padding: 11px 14px; color: var(--text); background: #172b25; border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); pointer-events: none; transition: .2s ease; font-size: 11px; }
.toast.show { opacity: 1; transform: translateY(0); }
.runtime-label { color: var(--muted); font-size: 11px; margin: 0 4px 9px; line-height: 1.5; }
.connection-banner { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 10px; padding: 13px 16px; border: 1px solid #ad4747; border-left: 4px solid #ff5c5c; border-radius: 12px; background: #321e1e; }
.connection-banner[hidden] { display: none; }
.connection-banner strong { color: #ff8d8d; font-size: 15px; }
.connection-banner p { margin: 5px 0 0; font-size: 12px; line-height: 1.6; }
.connection-banner button { flex: 0 0 auto; }
.alert-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 9px 12px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 12px; background: #10201a; font-size: 11px; }
.alert-controls > strong { color: var(--gold, #edbf5f); margin-right: 4px; }
.alert-controls small { color: var(--muted); font-size: 9px; }
.alert-controls button { padding: 7px 10px; min-height: 32px; font-size: 11px; }
.alert-audio-status { color: var(--muted); }
.alert-controls summary { cursor: pointer; padding: 7px 4px; }
.alert-settings { position: relative; }
.alert-settings > div { position: absolute; top: 36px; right: 0; width: min(440px, 85vw); z-index: 55; padding: 15px; border: 1px solid var(--line-strong); border-radius: 12px; background: #14281f; box-shadow: var(--shadow); display: grid; gap: 12px; }
.alert-settings label { display: flex; align-items: center; gap: 8px; }
.alert-settings input[type="checkbox"] { width: 15px; height: 15px; accent-color: #edbf5f; }
.alert-settings select { max-width: 280px; width: 70%; color: var(--text); background: #0b1813; padding: 6px; border: 1px solid var(--line); }
.alert-settings p { margin: 0; line-height: 1.6; color: var(--muted); }
.alert-history[open] { flex: 1 0 100%; }
#alertHistoryList { max-height: 220px; overflow: auto; }
.alert-history-row { padding: 8px 4px; border-top: 1px solid var(--line); }
.alert-history-row p { margin: 4px 0; color: var(--muted); line-height: 1.6; }
.alert-popup { position: fixed; right: 22px; top: 90px; z-index: 70; width: min(440px, calc(100vw - 28px)); max-height: 75vh; overflow: auto; padding: 18px; color: var(--text); background: #12261d; border: 2px solid #e8b657; border-radius: 15px; box-shadow: 0 12px 50px #0009; }
.alert-popup[hidden] { display: none; }
.alert-popup.critical { background: #321b1d; border-color: #f16a6a; }
.alert-popup.expired { border-color: #89988e; }
.alert-popup header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.alert-popup header strong { font-size: 19px; line-height: 1.5; }
.alert-popup small { display: block; margin-top: 10px; color: var(--muted); }
.alert-popup p { font-size: 14px; line-height: 1.8; overflow-wrap: anywhere; }
.alert-popup > strong { display: block; color: #efc06c; font-size: 13px; line-height: 1.6; }
.alert-popup > button { margin-top: 14px; }

@media (max-width: 1280px) {
  .dual-screen { grid-template-columns: 1fr; }
  .screen-left, .screen-right { padding-bottom: 8px; }
}
@media (max-width: 760px) {
  .shell { width: min(100% - 18px,1900px); padding-top: 12px; }
  .topbar, .status-strip, footer { align-items: flex-start; flex-direction: column; }
  .top-actions { width: 100%; justify-content: flex-start; }
  .decision-grid, .ledger-grid, .activity-grid { grid-template-columns: 1fr; }
  .market-strip { grid-template-columns: 1fr 1fr; }
  .benchmark-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .close-snapshots { grid-template-columns: 1fr; }
  .market-strip, .plan-details, .review-grid, .health-strip, .form-grid, .form-grid.two { grid-template-columns: 1fr; }
  .screen-heading { align-items: flex-start; flex-direction: column; }
  .plan-main { align-items: flex-start; flex-direction: column; }
  .plan-quantity { text-align: left; }
  .form-warning { align-items: flex-start; flex-direction: column; }
}

[hidden] { display: none !important; }
.auth-gate { min-height: 100vh; display: grid; place-items: center; padding: 28px 16px; }
.auth-card { width: min(520px, 100%); padding: 32px; background: #0d1c16; border: 1px solid var(--line-strong); border-radius: 22px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 25px; line-height: 1.4; margin: 10px 0; }
.auth-card h2 { font-size: 18px; margin: 22px 0 16px; }
.auth-intro, .auth-footnote { color: var(--muted); font-size: 12px; line-height: 1.8; }
.auth-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0; }
.auth-tabs .active { color: #0a1610; background: var(--accent); border-color: var(--accent); }
.auth-form { display: grid; gap: 15px; }
.auth-form label, .invite-controls label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; }
.auth-form input, .invite-controls select { width: 100%; min-width: 0; color: var(--text); background: #09150f; border: 1px solid var(--line-strong); border-radius: 8px; padding: 12px; font-size: 16px; }
.auth-form input:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.auth-form > button { min-height: 45px; }
.auth-help { font-size: 12px; color: var(--muted); line-height: 1.8; padding: 12px; background: #16251b; border-radius: 8px; }
.auth-help code { display: block; overflow-wrap: anywhere; white-space: normal; margin: 8px 0; color: var(--accent); }
.auth-message { min-height: 20px; font-size: 12px; line-height: 1.8; color: #f3c875; overflow-wrap: anywhere; }
.auth-footnote { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 22px; font-size: 11px; }
.account-bar { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 12px 14px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 12px; background: #102017; }
.account-bar > div { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.account-bar strong { color: var(--accent); font-size: 12px; }
.account-bar span { color: var(--muted); font-size: 11px; }
.account-panel { margin: 0 0 12px; padding: 18px; }
.account-panel header { display: flex; justify-content: space-between; align-items: center; }
.account-panel h2 { margin-top: 5px; }
.account-panel p, .account-panel summary { color: var(--muted); font-size: 12px; line-height: 1.8; }
.account-panel summary { cursor: pointer; padding: 12px 0; }
.invite-controls { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; }
.invite-output { color: var(--accent); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 1.8; }
.user-list { max-width: 700px; }
.account-user-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 12px; }
.password-form { max-width: 430px; padding: 10px 0; }
.viewer-notice { margin: 10px; padding: 22px; }
.viewer-notice p { color: var(--muted); font-size: 12px; line-height: 1.8; }
.backend-warning { margin: 10px 0; padding: 12px 14px; color: #f3cf87; background: #2b2617; border: 1px solid #685431; border-radius: 10px; font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.shared-panel { margin-top: 8px; border-color: rgba(230,185,95,.30); overflow: hidden; }
.shared-note { color: var(--muted); margin: 9px 13px; font-size: 11px; line-height: 1.65; overflow-wrap: anywhere; }
.shared-plan { display: flex; justify-content: space-between; gap: 10px; margin: 12px 13px 0; padding: 12px; background: rgba(230,185,95,.07); border-radius: 9px; }
.shared-plan > div:last-child { text-align: right; }
.shared-plan span { display: block; font-size: 10px; color: var(--muted); }
.shared-plan strong { display: block; font-size: 22px; margin: 5px 0; }
#sharedPlanQty { color: var(--accent); }
.shared-metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; margin: 12px 13px; }
.shared-metrics > div { min-width: 0; padding: 9px; border-radius: 8px; background: rgba(255,255,255,.03); }
.shared-metrics span { display: block; font-size: 10px; color: var(--muted); }
.shared-metrics strong { display: block; margin-top: 5px; font-size: 13px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.shared-details { margin: 0 13px; border-top: 1px solid var(--line); }
.shared-details summary { cursor: pointer; padding: 12px 0; color: var(--accent); font-size: 12px; }
.shared-details .shared-note { margin-left: 0; margin-right: 0; }
.shared-trade, .shared-days > div { display: grid; gap: 5px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 12px; }
.shared-trade span, .shared-trade small, .shared-days small { color: var(--muted); }
.shared-days { margin: 8px 0; }
.shared-admin { padding: 12px 0 4px; border-top: 1px solid var(--line); }
.shared-controls { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 13px; }
.mobile-nav, .mobile-fund-cards { display: none; }
.mobile-help { margin: 0 0 10px; padding: 0 14px; }
.mobile-help > summary { cursor: pointer; padding: 13px 0; color: var(--accent); font-size: 12px; font-weight: 700; }
.mobile-help p { color: var(--muted); font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.mobile-help-actions, .mobile-url-row { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.mobile-url-row label { flex: 1; min-width: 180px; color: var(--muted); font-size: 12px; }
.mobile-url-row input { display: block; width: 100%; margin-top: 5px; padding: 10px; background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); border-radius: 8px; font-size: 16px; }
.mobile-help-actions > button { min-height: 44px; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
#marketSection, #fundSection, #sharedSection, #privateSection, #reviewSection { scroll-margin-top: 12px; }
@media (max-width: 760px) {
  .auth-card { padding: 24px 20px; }
  .auth-card h1 { font-size: 22px; }
  .account-bar > div { width: 100%; }
  .alert-settings > div { position: fixed; top: 15vh; left: 14px; right: 14px; width: auto; max-height: 70vh; overflow: auto; }
  .shell { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
  .brand h1 { font-size: 23px; }
  .brand-mark { flex-shrink: 0; }
  .topbar { gap: 14px; margin-bottom: 12px; }
  .top-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .mode-switch { grid-column: 1 / -1; }
  .mode-switch button { flex: 1; }
  button, .alert-controls button, .text-button, .close-button, summary { min-height: 44px; }
  .primary-button, .secondary-button, .mode-button, .text-button, .close-button { font-size: 13px; }
  .top-actions #refreshButton { grid-column: 1 / -1; }
  .account-bar { padding: 12px; }
  .account-bar strong, .account-bar span { font-size: 12px; }
  .account-bar #accountScope { width: 100%; line-height: 1.6; }
  .account-bar .status-chip { white-space: normal; }
  .status-strip { gap: 8px; font-size: 12px; }
  .status-left, .status-right { line-height: 1.6; }
  .status-chip { font-size: 11px; letter-spacing: 0; }
  .screen-heading { padding: 13px 11px; gap: 6px; }
  .screen-heading h2 { font-size: 14px; }
  .screen-heading p, .screen-heading span { font-size: 11px; }
  .market-strip, .review-grid, .health-strip, .shared-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .metric-tile { padding: 12px 10px; }
  .metric-tile span, .metric-tile small { font-size: 12px; line-height: 1.5; white-space: normal; }
  .metric-tile strong { font-size: 18px; white-space: normal; overflow-wrap: anywhere; }
  .price-tile strong { font-size: 30px; }
  #outerInner { font-size: 14px; }
  .panel-heading { flex-wrap: wrap; }
  .panel-heading h2 { font-size: 16px; }
  .panel-heading > p { text-align: left; font-size: 11px; line-height: 1.6; }
  .eyebrow, .confidence-number { font-size: 11px; }
  .decision-card { min-height: 0; padding-bottom: 14px; }
  .decision-card h2 { font-size: 28px; line-height: 1.3; }
  .reason-list { font-size: 13px; line-height: 1.7; }
  .decision-meta span, .gate-item { font-size: 11px; }
  .gate-grid { grid-template-columns: 1fr; }
  .gate-item { justify-content: flex-start; flex-wrap: wrap; }
  .gate-item small { white-space: normal; line-height: 1.5; }
  .level-item span { font-size: 15px; }
  .level-item small, .risk-note { font-size: 12px; }
  .benchmark-item { padding: 12px; }
  .benchmark-item h3 { font-size: 13px; }
  .benchmark-item p { font-size: 11px; line-height: 1.6; }
  .benchmark-item strong { font-size: 20px; }
  .fund-panel > .table-scroll { display: none; }
  .mobile-fund-cards { display: grid; gap: 8px; padding: 0 10px 10px; color: var(--muted); font-size: 12px; }
  .fund-mobile-card { padding: 12px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-variant-numeric: tabular-nums; }
  .fund-mobile-card.latest { border-color: rgba(230,185,95,.55); background: #14251e; }
  .fund-mobile-card header { display: grid; grid-template-columns: 1fr 1fr auto; align-items: center; gap: 6px; }
  .fund-mobile-card header strong { display: block; font-size: 15px; color: var(--text); }
  .fund-mobile-card header small { display: block; margin-top: 4px; font-size: 11px; }
  .fund-mobile-card header > span { font-size: 11px; }
  .fund-mobile-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; padding-top: 12px; }
  .fund-mobile-grid span, .fund-mobile-grid strong, .fund-mobile-grid small { display: block; overflow-wrap: anywhere; }
  .fund-mobile-grid span { font-size: 11px; }
  .fund-mobile-grid strong { margin: 5px 0; font-size: 12px; color: var(--text); }
  .fund-mobile-grid small { font-size: 11px; }
  .fund-mobile-card footer { margin: 12px 0 0; padding: 9px 0 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.6; }
  .fund-data-note, .close-snapshot strong, .close-snapshot p, .close-snapshot small { font-size: 12px; }
  .plan-main { flex-direction: row; align-items: center; gap: 8px; }
  .plan-main h2 { font-size: 25px; }
  .plan-quantity { text-align: right; flex-shrink: 0; }
  .plan-main p:last-child, .plan-quantity span, .plan-quantity small { font-size: 11px; }
  .plan-details { grid-template-columns: 1fr; }
  .plan-details span, .plan-details strong { font-size: 12px; line-height: 1.55; }
  .ledger-heading h3 { font-size: 16px; }
  .ledger-metrics span, .ledger-summary span, .ledger-note { font-size: 12px; line-height: 1.5; }
  .ledger-metrics strong { font-size: 15px; }
  .ledger-metrics div { padding: 10px; }
  .shared-metrics strong { font-size: 15px; }
  .shared-metrics span, .shared-note, .shared-plan span { font-size: 12px; }
  .shared-plan strong { font-size: 22px; }
  .shared-plan { align-items: center; }
  .shared-controls { display: grid; grid-template-columns: 1fr; }
  .trade-item { grid-template-columns: 52px 1fr; }
  .trade-value { grid-column: 2; text-align: left; }
  .trade-time, .trade-main strong, .trade-main small, .trade-value, .trade-value small, .empty-copy { font-size: 12px; line-height: 1.5; }
  .review-grid span, .review-grid strong, .health-strip span, .health-strip strong, .review-note { font-size: 12px; line-height: 1.6; }
  .review-grid > div, .health-strip > div { min-width: 0; }
  .health-strip strong { white-space: normal; }
  .health-table th, .health-table td { font-size: 12px; padding: 10px; }
  .health-table-scroll { -webkit-overflow-scrolling: touch; }
  .alert-controls { font-size: 12px; line-height: 1.6; }
  .alert-audio-status { flex-basis: 100%; }
  .connection-banner { flex-direction: column; align-items: stretch; }
  .form-grid, .form-grid.two { grid-template-columns: 1fr 1fr; }
  .form-grid label { min-width: 0; font-size: 12px; line-height: 1.6; }
  .form-grid input, .form-grid select { min-height: 46px; min-width: 0; font-size: 16px; }
  .form-note { font-size: 12px; line-height: 1.7; }
  .form-actions { flex-wrap: wrap; }
  .modal { padding: max(12px,env(safe-area-inset-top)) 10px calc(30px + env(safe-area-inset-bottom)); }
  .mobile-nav { position: fixed; z-index: 20; bottom: 0; left: 0; right: 0; display: flex; justify-content: space-around; gap: 3px; padding: 8px max(8px,env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left)); background: #101e19; border-top: 1px solid var(--line-strong); box-shadow: 0 -5px 20px #0005; }
  .mobile-nav a { display: grid; place-items: center; min-height: 44px; flex: 1; color: var(--accent); text-decoration: none; font-size: 12px; border-radius: 8px; background: #172a22; }
  .toast { left: 14px; right: 14px; max-width: none; bottom: calc(76px + env(safe-area-inset-bottom)); font-size: 13px; }
  .alert-popup { bottom: calc(78px + env(safe-area-inset-bottom)); max-height: 65vh; overflow: auto; }
}
/* Minute continuity and explanatory candidates: shared desktop/mobile content. */
.continuity-note, .signal-explanation { padding: 10px 12px; margin: 12px 0 0; border: 1px solid #345045; border-radius: 10px; color: #b9d1c6; background: #10211b; font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.continuity-note[data-code="GAP"], .continuity-note[data-code="SOURCE_CHANGE"] { border-color: #806e39; color: #edc668; }
.fund-panel > .continuity-note { margin: 0 12px 12px; }
.candidate-history { margin-top: 10px; color: #a8bfb6; font-size: 12px; line-height: 1.7; }
.candidate-history summary { cursor: pointer; color: #dfbd6e; }
.candidate-history p { padding: 8px 0; margin: 0; border-bottom: 1px solid #253d33; }
.candidate-history strong, .candidate-history span { display: block; overflow-wrap: anywhere; }
/* Research stays inside the existing review section on desktop and phones. */
.research-panel { margin-top: 16px; padding: 14px; border: 1px solid var(--border, #2b4136); border-radius: 12px; }
.research-panel > summary { color: #eac15b; cursor: pointer; font-weight: 700; }
.research-panel p { overflow-wrap: anywhere; line-height: 1.6; }
.research-panel .health-table { min-width: 650px; }
.research-panel details { margin-top: 12px; }
/* Technical context is informational, visually separate from the trade verdict. */
.technical-overview { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; margin: 0 12px 12px; padding: 10px 12px; border: 1px solid #355047; border-radius: 10px; background: #10211b; color: var(--muted); font-size: 11px; line-height: 1.65; }
.technical-overview b { display: block; margin-bottom: 4px; color: #9dc7ec; }
.technical-overview p { margin: 0; }
.fund-table { min-width: 720px; }
.fund-table .technical-cell { min-width: 105px; max-width: 155px; white-space: normal; vertical-align: top; }
.technical-cell span, .technical-cell small { display: block; line-height: 1.65; }
.technical-cell small { color: var(--muted); font-size: 9px; }
.indicator-overview-heading, .indicator-overview-foot { grid-column: 1 / -1; }
.indicator-overview-heading { color: #9dc7ec; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px; }
.indicator-overview-heading span { color: var(--accent); font-size: 10px; }
.indicator-reading { min-width: 0; padding: 10px; border-radius: 9px; background: #172922; overflow-wrap: anywhere; }
.indicator-reading strong { display: block; color: #e9dfb8; font-size: 13px; margin: 4px 0; }
.indicator-reading small { display: block; margin-top: 7px; border-top: 1px solid #355047; padding-top: 6px; line-height: 1.7; }
.indicator-values { display: block; font-variant-numeric: tabular-nums; margin-bottom: 6px; font-size: 10px; color: #b4cbc1; }
.technical-cell .indicator-title { color: #dcc887; font-size: 11px; }
.indicator-background { border-top: 1px solid #30453b; margin-top: 6px; padding-top: 5px; }
.technical-summary { display: block; max-width: 160px; white-space: normal; color: #b3c7bf; font-weight: 400; font-size: 9px; line-height: 1.6; margin-top: 5px; }
.fund-extras { margin: 8px 12px 12px; padding: 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); font-size: 11px; line-height: 1.65; }
.fund-extras summary { cursor: pointer; color: var(--accent); }
.fund-extras p { overflow-wrap: anywhere; }
.technical-error { color: #efbf6d; }
.technical-review .health-table small { display: block; }
.technical-review summary { line-height: 1.8; }
.mobile-indicators { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.mobile-indicators > div { min-width: 0; background: #172922; border-radius: 9px; padding: 9px; }
.mobile-indicators b, .mobile-indicators span, .mobile-indicators small { display: block; line-height: 1.65; }
.mobile-indicators b { color: #9dc7ec; font-size: 11px; margin-bottom: 4px; }
#quoteTimeNote { white-space: normal; }
@media (max-width: 760px) {
  .technical-overview { grid-template-columns: 1fr; gap: 6px; font-size: 12px; }
  .fund-mobile-grid { grid-template-columns: 1fr 1fr; }
  .fund-mobile-card .technical-summary { max-width: none; font-size: 12px; }
  .mobile-indicators span, .mobile-indicators small { font-size: 11px; overflow-wrap: anywhere; }
  .fund-extras { font-size: 12px; }
}
