/* Phosphor console. Keep semantic profit/loss colors independent of amber UI. */
html.dark, :root {
  --color-bg: #0d100b;
  --color-bg-alt: #151a12;
  --color-bg-secondary: #20271c;
  --color-card: #10150d;
  --color-border: #49432f;
  --color-border-strong: #706043;
  --color-text-primary: #eebe70;
  --color-text-secondary: #cdb88f;
  --color-text-muted: #ad9c7e;
  --color-accent: #eebe70;
  --color-accent-hover: #ffda98;
  --color-accent-light: #30291b;
  --color-profit: #8ce3a0;
  --color-loss: #ff9690;
  --color-warning: #ecc365;
  --color-link: #eebe70;
}
body.app-shell { font-family: 'IBM Plex Mono', monospace; background: var(--color-bg); color: var(--color-text-primary); }
.app-shell h1, .app-shell h2, .app-shell h3, .app-shell th,
.app-shell .bank-footer-wordmark,
.app-shell .bank-footer blockquote, .app-shell .bank-footer cite,
.app-shell .private-bank-wordmark { font-family: 'IBM Plex Mono', monospace; }
.app-shell h1 { letter-spacing: -.06em; font-weight: 500; text-transform: uppercase; font-size: 1.7rem; }
.app-shell h2 { font-size: .95rem; letter-spacing: .02em; }
.app-shell .bank-sidebar { background: #13180f; border-color: var(--color-border); width: 228px; }
.app-shell .bank-wordmark { color: var(--color-accent); font: 500 22px/1.15 'IBM Plex Mono',monospace; letter-spacing: -1.7px; padding-bottom: 28px; white-space: nowrap; }
.app-shell .terminal-product-intro .bank-wordmark:hover,
.app-shell .bank-mobile-bar .private-bank-wordmark:hover {
  color: var(--color-accent);
  background: transparent;
  text-decoration: none;
}
.terminal-cursor { display: inline-block; animation: terminal-cursor-blink 1.2s steps(1,end) infinite; }
@keyframes terminal-cursor-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
.app-shell .bank-nav-link { font: 13px/1.5 'IBM Plex Mono',monospace; border: 0; padding: 11px 13px; border-radius: 0; gap: 9px; color: var(--color-text-secondary); }
.app-shell .bank-nav-link svg { display: inline-block; width: 16px; height: 16px; flex-shrink: 0; }
.app-shell .bank-nav-link svg.private-nav-icon { display: inline-block; width: 12px; height: 12px; flex-shrink: 0; color: var(--color-text-muted); }
.app-shell .trading-activity-dot { width: 6px; height: 6px; flex: 0 0 6px; margin-left: 1px; border-radius: 50%; background: currentColor; animation: trading-activity-blink 1.8s steps(1,end) infinite; }
@keyframes trading-activity-blink { 0%, 62% { opacity: .9; } 63%, 100% { opacity: .2; } }
.app-shell .bank-nav-link[aria-current=page] { background: var(--color-accent); color: #0d100b !important; box-shadow: none; }
.app-shell .bank-nav-link[aria-current=page] svg { color: inherit; }
.app-shell .asset-exchange { display: inline; margin-left: .4rem; color: var(--color-text-muted); font-size: 11px; font-weight: 400; white-space: nowrap; }
.app-shell .bank-account .bank-freshness { float: none; margin: 0; }
.app-shell .bank-account { min-width: 0; }
.app-shell .bank-account .bank-system-link { display: inline; padding-bottom: 0; text-align: right; font-size: inherit; line-height: inherit; }
.app-shell .terminal-buying-power { margin-left: auto; flex-shrink: 0; align-self: flex-start; }
.app-shell .sleeve-position-row > td { padding-left: 2rem; }
.app-shell tr:has(+ .sleeve-position-row) > td { border-bottom: 0; }
.app-shell tr:has(+ .sleeve-position-row) { border-bottom: 0; }
.app-shell tbody > .sleeve-position-row { border-top-width: 0 !important; }
.position-open-dot { color: var(--color-profit); font-size: 10px; vertical-align: middle; }
/* Shared asset label and position event tags (positions tables and the monitor). */
.app-shell .asset-label { white-space: nowrap; }
.app-shell .asset-label a { color: var(--color-text-primary); }
.app-shell .asset-label a:hover { color: var(--color-accent); text-decoration: underline; }
.app-shell .position-event { display: inline-block; padding: 0 5px; border: 1px solid var(--color-border-strong); font-size: 10px; line-height: 16px; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.app-shell .position-event-opened, .app-shell .position-event-open { border-color: var(--color-profit); color: var(--color-profit); }
.app-shell .position-event-closed { color: var(--color-text-muted); }
.app-shell .position-event-pending { border-style: dashed; color: var(--color-warning); }
.sleeve-order { margin-left: auto; }
.sleeve-list-wrap { overflow-x: auto; }
.sleeve-list-table { min-width: 980px; }
.sleeve-mobile-label { display: none; }
.sleeve-coverage { min-width: 0; }
.sleeve-return-evidence { min-width: 0; }
.sleeve-about summary { color: var(--color-text-secondary); }
.sleeve-about[open] summary { margin-bottom: .5rem; }
.terminal-log-preview { max-height: 360px; overflow-y: auto; }
.sleeve-filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 2rem; }
@media (min-width: 1024px) { .sleeve-filter-row { flex-wrap: nowrap; overflow-x: auto; } .sleeve-filter-row > * { flex-shrink: 0; } }
.app-shell .sleeve-position-row details { border-left: 1px solid var(--color-border-strong); padding-left: 1rem; }
.terminal-power-track { height: 8px; margin: 6px 0; border: 1px solid var(--color-border-strong); background: var(--color-bg); overflow: hidden; }
.terminal-power-track > span { display: block; height: 100%; background: repeating-linear-gradient(90deg, var(--color-accent) 0 5px, transparent 5px 7px); transition: width .3s ease; }
@media (prefers-reduced-motion: reduce) { .terminal-power-track > span { transition: none; } }
.app-shell .terminal-footer-login, .terminal-footer-account { font-size: 11px; color: var(--color-text-muted); margin-top: 16px; }
.app-shell .terminal-mobile-login { display: none; }
@media (max-width: 767px) {
  .app-shell .terminal-mobile-login { display: block; margin-top: auto; padding: 20px 16px; font-size: 12px; }
  .app-shell .terminal-footer-login { display: none; }
}
.terminal-footer-account summary { cursor: pointer; }
.terminal-footer-account .bank-account-actions { max-width: 220px; }
.app-shell .bank-main { background: var(--color-bg); }
.app-shell .bank-content { background: radial-gradient(ellipse at top left, #edaa3810, transparent 70%), var(--color-bg); padding: 26px; }
.app-shell .bank-mobile-bar, .app-shell .bank-footer { background: #13180f; border-color: var(--color-border); }
.app-shell .bank-mobile-bar .private-bank-wordmark { font-size: 18px; letter-spacing: -.8px; text-transform: uppercase; }
.app-shell .bank-tabs { border-color: var(--color-border); gap: 8px 18px; }
.app-shell .bank-tabs a { font-size: 12px; color: var(--color-text-secondary); }
.app-shell .bank-tabs a[aria-current=page] { color: var(--color-accent); border-color: var(--color-accent); }
.app-shell .bank-tabs .bank-tabs-monitor { margin-left: auto; align-self: center; padding: 6px 12px; border: 1px solid var(--color-border); }
.app-shell .bank-avatar { border-radius: 0; font-family: inherit; color: var(--color-accent); }
.app-shell .bank-account summary, .app-shell .bank-login { color: var(--color-text-secondary); }
.app-shell .bank-freshness { font: 11px/1.8 'IBM Plex Mono',monospace; color: var(--color-text-muted); }
.app-shell .bank-performance-grid { border-radius: 0; border-color: var(--color-border); }
.app-shell .bank-performance-grid h2, .app-shell .bank-performance-compact h2 { color: var(--color-accent); font-family: inherit; font-size: 12px; }
.app-shell .bank-performance-compact .bank-chart-panel, .app-shell .bank-table td, .app-shell .bank-table th { border-color: var(--color-border); }
.app-shell .bank-table th, .app-shell .bank-fine, .app-shell .bank-empty { color: var(--color-text-muted); }
/* Headline figure boxes, shared by the monitor and the homepage fund strip. */
.stat-tiles { display: grid; gap: 8px; }
.stat-tiles > div { min-width: 0; padding: 8px 6px; border: 1px solid var(--color-border); text-align: center; }
.stat-tiles span { display: block; color: var(--color-text-muted); font-size: 10px; text-transform: uppercase; }
.stat-tiles strong { display: block; overflow-wrap: anywhere; font: 500 20px/1.5 'IBM Plex Mono', monospace; font-variant-numeric: tabular-nums; }
.stat-tiles small { display: block; font-size: 14px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-tiles .bank-date { font-size: 16px; }
.app-shell .bank-metric-strip small { color: var(--color-text-muted); }
.app-shell .holding-weight-side, .app-shell .holding-weights .holding-weight-more { color: var(--color-text-muted); }
.app-shell .holding-weight-track { background: var(--color-border); }
.app-shell .bank-metric-strip [data-rag=green] strong { color: var(--color-profit); }
.app-shell .bank-metric-strip [data-rag=amber] strong { color: var(--color-warning); }
.app-shell .bank-metric-strip [data-rag=red] strong { color: var(--color-loss); }
.app-shell table { font-variant-numeric: tabular-nums; }
.app-shell .rounded-lg, .app-shell .rounded-xl, .app-shell .rounded-md { border-radius: 2px; }
.app-shell .bank-footer-wordmark { letter-spacing: -1px; color: var(--color-accent); }
.app-shell .bank-footer blockquote { font-size: 13px; line-height: 1.9; color: var(--color-text-secondary); }
.app-shell .bank-footer p, .app-shell .bank-about, .app-shell .bank-about p { color: var(--color-text-secondary); }
.app-shell .bank-footer-rule { font-size: 11px; }
.app-shell .bank-footer { grid-template-columns: 180px minmax(0,1fr); }
.app-shell .bank-profit { color: var(--color-profit) !important; }
.app-shell .bank-loss { color: var(--color-loss) !important; }
.app-shell .bank-content .text-emerald-600, .app-shell .bank-content .text-emerald-400 { color: var(--color-profit) !important; }
.app-shell .bank-content .text-red-600, .app-shell .bank-content .text-red-400 { color: var(--color-loss) !important; }
.app-shell .terminal-neutral { color: var(--color-text-muted) !important; }
.terminal-command-buffer { clear: both; margin: 26px 0 6px; padding: 16px; border: 1px solid var(--color-border-strong); background: #080d06; font: 12px/1.7 'IBM Plex Mono',monospace; }
.terminal-buffer-heading { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-bottom: 13px; text-transform: uppercase; }
.terminal-buffer-heading h2 { margin: 0; color: var(--color-accent); font: inherit; }
.terminal-buffer-heading > span, .terminal-buffer-note { font-size: 11px; color: var(--color-text-muted); }
.terminal-log-line { display: grid; grid-template-columns: 175px minmax(0,1fr); gap: 12px; padding: 5px 0; }
.terminal-log-line time { color: var(--color-text-muted); font-size: 11px; }
.terminal-log-line time .terminal-log-milliseconds { font-size: 0.7em; color: var(--color-text-muted); }
.terminal-log-line > span { overflow-wrap: anywhere; }
.terminal-buffer-note { margin-top: 12px; border-top: 1px dashed var(--color-border); padding-top: 10px; }
.terminal-email-signup { clear: both; margin: 26px 0 0; padding: 18px; border: 1px solid var(--color-border-strong); background: linear-gradient(120deg,#151a12,#0d100b); display: grid; grid-template-columns: minmax(0,1fr) minmax(280px,.65fr); gap: 14px 28px; align-items: end; }
.terminal-email-signup h2 { margin: 3px 0 8px; color: var(--color-accent); font-size: 16px; text-transform: uppercase; }
.terminal-email-signup p { margin: 0; color: var(--color-text-secondary); font-size: 12px; line-height: 1.7; }
.terminal-email-kicker { color: var(--color-text-muted) !important; font-size: 10px !important; text-transform: uppercase; letter-spacing: .12em; }
.terminal-email-form { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; position: relative; }
.terminal-email-form input[type=email] { min-width: 0; border: 1px solid var(--color-border-strong); background: #080d06; color: var(--color-text-primary); padding: 11px 12px; font: 12px 'IBM Plex Mono',monospace; }
.terminal-email-form input[type=submit], .terminal-danger-button { border: 1px solid var(--color-accent); background: var(--color-accent); color: #0d100b; padding: 11px 15px; font: 600 12px 'IBM Plex Mono',monospace; cursor: pointer; }
.terminal-email-form input[type=submit]:hover { background: var(--color-accent-hover); }
.terminal-email-fine { grid-column: 1/-1; font-size: 10px !important; color: var(--color-text-muted) !important; }
.terminal-email-error { grid-column: 1/-1; color: var(--color-loss) !important; }
.email-signup-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.terminal-subscription-prompt { position: fixed; right: 22px; bottom: 22px; z-index: 60; width: min(430px,calc(100vw - 32px)); box-shadow: 0 16px 50px rgba(0,0,0,.55); }
.terminal-subscription-prompt[hidden] { display: none; }
.terminal-subscription-prompt .terminal-email-signup { margin: 0; padding: 20px; grid-template-columns: 1fr; gap: 13px; background: #10150e; }
.terminal-subscription-prompt .terminal-email-signup h2 { padding-right: 28px; }
.terminal-subscription-prompt .terminal-email-form { grid-template-columns: minmax(0,1fr) auto; }
.terminal-subscription-prompt-close { position: absolute; z-index: 1; top: 8px; right: 10px; width: 34px; height: 34px; border: 0; background: transparent; color: var(--color-text-muted); font: 24px/1 'IBM Plex Mono',monospace; }
.terminal-subscription-prompt-close:hover, .terminal-subscription-prompt-close:focus-visible { color: var(--color-text-primary); outline: 1px solid var(--color-border-strong); }
.terminal-message-panel { max-width: 680px; padding: 24px; border: 1px solid var(--color-border-strong); background: var(--color-card); }
.terminal-message-panel h2 { margin: 6px 0 12px; color: var(--color-accent); font-size: 18px; }
.terminal-danger-button { background: transparent; color: var(--color-loss); border-color: var(--color-loss); margin-top: 14px; }
.terminal-csv-import { margin: 18px 0 24px; padding: 16px; border: 1px solid var(--color-border-strong); background: var(--color-card); display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 16px 24px; align-items: end; }
.terminal-csv-import h2 { margin: 0 0 7px; color: var(--color-accent); text-transform: uppercase; }
.terminal-csv-import p { margin: 0; color: var(--color-text-muted); font-size: 11px; line-height: 1.7; }
.terminal-csv-import-form { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.terminal-csv-import-form label { width: 100%; color: var(--color-text-secondary); font-size: 11px; }
.terminal-csv-import-form input[type=file] { max-width: 280px; color: var(--color-text-secondary); font: 11px 'IBM Plex Mono',monospace; }
.terminal-csv-import-form input[type=submit] { border: 1px solid var(--color-accent); background: var(--color-accent); color: #0d100b; padding: 9px 13px; font: 600 11px 'IBM Plex Mono',monospace; cursor: pointer; }
@media(max-width: 700px) { .terminal-email-signup { grid-template-columns: 1fr; } .terminal-email-form { grid-template-columns: 1fr; } }
@media(max-width: 700px) { .terminal-subscription-prompt { right: 12px; bottom: 12px; width: calc(100vw - 24px); } .terminal-subscription-prompt .terminal-email-form { grid-template-columns: 1fr; } }
@media(max-width: 700px) { .terminal-csv-import { grid-template-columns: 1fr; } }
@media(max-width: 767px) {
  .app-shell .bank-footer { grid-template-columns: 1fr; }
}
/* Identity and reporting, public activity, then the existing email opt-in. */
.terminal-product-intro { max-width: 1500px; margin: 0 auto; padding: 22px 26px; display: grid; grid-template-columns: minmax(0,1fr) minmax(0,2fr) minmax(0,1fr); align-items: start; gap: 24px; background: #13180f; border: 8px solid #252d23; border-bottom: 0; border-radius: 12px 12px 0 0; }
.terminal-product-identity { display: grid; gap: 12px; min-width: 0; }
@media(min-width: 1101px) { .terminal-product-intro--without-signup { grid-template-columns: minmax(0,1fr) minmax(0,3fr); } }
.app-shell .terminal-product-intro .bank-wordmark { padding: 0; font-size: 30px; letter-spacing: -1.5px; }
.terminal-product-purpose { min-width: 0; }
.terminal-product-intro h2, .terminal-product-intro p { padding: 0; }
.terminal-product-purpose p { margin: 0; color: var(--color-text-secondary); font-size: 12px; line-height: 1.8; }
.app-shell .terminal-product-intro .bank-freshness { display: grid; gap: 6px; float: none; margin: 0; text-align: left; }
.terminal-product-intro .bank-system-link { display: inline; font: inherit; color: inherit; }
.terminal-product-intro [data-inception-performance] { overflow-wrap: anywhere; }
.terminal-product-intro [data-inception-spy] { display: inline-block; white-space: nowrap; }
.terminal-product-intro .terminal-command-buffer { min-width: 0; margin: 0; padding: 14px; }
.terminal-product-intro .terminal-log-preview { height: 190px; max-height: 190px; }
.terminal-product-intro .terminal-log-line { grid-template-columns: 116px minmax(0,1fr); gap: 10px; }
.terminal-product-intro .terminal-email-signup { margin: 0; padding: 0 0 0 20px; border: 0; border-left: 1px solid var(--color-border); background: none; grid-template-columns: minmax(0,1fr); gap: 9px; min-width: 0; }
.terminal-product-intro .terminal-email-signup h2 { margin: 0 0 5px; font-size: 12px; line-height: 1.4; }
.terminal-product-intro .terminal-email-signup p { font-size: 11px; line-height: 1.6; }
.terminal-product-intro .terminal-email-form { grid-template-columns: minmax(0,1fr) auto; }
.terminal-product-intro .terminal-email-form input { padding: 9px; }
@media(min-width: 768px) and (max-width: 1100px) {
  .terminal-product-intro { grid-template-columns: minmax(0,1fr) minmax(0,2fr); gap: 18px; }
  .terminal-product-intro .terminal-email-signup { grid-column: 1/-1; border: 0; border-top: 1px solid var(--color-border); padding: 14px 0 0; grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
}
@media(max-width: 767px) {
  .terminal-product-intro { padding: 20px 16px; grid-template-columns: minmax(0,1fr); gap: 16px; border: 0; border-bottom: 1px solid var(--color-border); border-radius: 0; }
  .terminal-product-identity > .bank-wordmark { padding-right: 60px; }
  .terminal-product-intro .terminal-command-buffer { display: none; }
  .terminal-product-intro .terminal-email-signup { border: 0; border-top: 1px solid var(--color-border); padding: 14px 0 0; }
  .app-shell .bank-mobile-bar { inset: 20px 16px auto auto; width: auto; height: auto; padding: 0; border: 0; background: transparent; }
  .app-shell .bank-mobile-bar .private-bank-wordmark { display: none; }
  .app-shell .bank-mobile-bar button { width: 44px; background: #13180f; border: 1px solid var(--color-border); }
  .app-shell .bank-main { padding-top: 0; }
}
/* Desktop terminal: the existing navigation becomes a function-key strip.
   The mobile drawer and authentication controls retain their normal behavior. */
@media(min-width: 768px) {
  body.app-shell { padding: 18px; }
  .app-shell .bank-sidebar { position: relative; inset: auto; width: 100%; max-width: 1500px; margin: 0 auto; display: grid; grid-template-columns: 1fr; padding: 0 26px; overflow: visible; border: 8px solid #252d23; border-block: 0; border-radius: 0; }
  .app-shell .bank-sidebar > nav { grid-row: 2; grid-column: 1/-1; display: flex; flex-wrap: wrap; gap: 6px; border-block: 1px solid var(--color-border-strong); padding: 7px 0; }
  .app-shell .bank-nav-link { margin: 0; padding: 8px 11px; }
  .app-shell .bank-main { max-width: 1500px; margin: 0 auto; border: 8px solid #252d23; border-top: 0; border-radius: 0 0 12px 12px; overflow: clip; }
  .app-shell .bank-content { min-height: 0; }
}
@media(max-width: 767px) {
  .app-shell .bank-content { padding: 20px 12px; }
  .app-shell h1 { font-size: 1.35rem; }
  .terminal-log-line { grid-template-columns: 1fr; gap: 0; padding: 8px 0; }
  .sleeve-filter-row > * { min-width: 0; max-width: 100%; }
  .sleeve-order { margin-left: 0; flex-wrap: wrap; }
  .sleeve-list-wrap { overflow-x: visible; }
  .sleeve-list-table { min-width: 0; display: block; }
  .sleeve-list-table > colgroup, .sleeve-list-table > thead { display: none; }
  .sleeve-list-table > tbody, .sleeve-list-table > tbody > tr, .sleeve-list-table > tbody > tr > td { display: block; width: 100%; min-width: 0; }
  .sleeve-list-table > tbody > tr > td { overflow-wrap: anywhere; }
  .sleeve-list-table > tbody > tr[data-testid='standard-sleeve-row'] { border-top: 1px solid var(--color-border); }
  .sleeve-list-table > tbody > tr[data-testid='standard-sleeve-row']:first-child { border-top: 0; }
  .sleeve-list-table .sleeve-identity { padding-bottom: .5rem; }
  .sleeve-list-table .sleeve-holdings, .sleeve-list-table .sleeve-return-evidence { padding-top: .5rem; padding-bottom: .5rem; }
  .sleeve-list-table .sleeve-mobile-label { display: block; margin-bottom: .25rem; color: var(--color-text-muted); font-size: .65rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
  .sleeve-list-table .sleeve-return-evidence { padding-bottom: 1rem; }
  .app-shell .sleeve-list-table .sleeve-position-row > td { padding: .25rem 1rem .75rem; }
  .sleeve-list-table .sleeve-position-row details { min-width: 0; }
  .sleeve-list-table .sleeve-position-row summary { white-space: normal; overflow-wrap: anywhere; }
  .sleeve-list-table .sleeve-position-row .bank-table { display: block; width: 100%; min-width: 0; }
  .sleeve-list-table .sleeve-position-row .bank-table thead { display: none; }
  .sleeve-list-table .sleeve-position-row .bank-table tbody, .sleeve-list-table .sleeve-position-row .bank-table tr, .sleeve-list-table .sleeve-position-row .bank-table td { display: block; width: 100%; min-width: 0; }
  .sleeve-list-table .sleeve-position-row .bank-table tr { padding: .5rem 0; border-top: 1px solid var(--color-border); }
  .sleeve-list-table .sleeve-position-row .bank-table td { display: block; padding: .2rem 0; text-align: right; overflow-wrap: anywhere; white-space: normal; }
  .sleeve-list-table .sleeve-position-row .bank-table td::before { content: attr(data-label); float: left; width: 38%; color: var(--color-text-muted); text-align: left; }
  .sleeve-list-table .sleeve-position-row .bank-table td::after { content: ''; display: block; clear: both; }
}
@media(prefers-reduced-motion: reduce) { .terminal-cursor, .app-shell .trading-activity-dot { animation: none; } }
@media print { .terminal-cursor { animation: none; } .terminal-command-buffer { display: none; } }
.market-summary-link { color: var(--color-accent, #eebe70); text-decoration: underline; text-underline-offset: 3px; }
.market-summary-link:hover { text-decoration-thickness: 2px; }
.app-shell .bank-table .data-group-badge { font-size: 10px; line-height: 1.3; padding: 3px 7px; font-weight: 400; }
.app-shell .data-sources-table { table-layout: auto; }
.app-shell .data-sources-table th[scope="row"] { width: 38%; min-width: 22rem; white-space: normal; vertical-align: top; }
.app-shell .data-sources-table [data-testid="source-description"] { display: block; width: 100%; max-width: none; font-size: 14px; line-height: 1.6; white-space: normal; text-transform: none; letter-spacing: normal; }
.app-shell .data-sources-table [data-testid="source-categories"] { min-width: 10rem; width: 18%; font-size: 12px; line-height: 1.45; }
.app-shell .data-sources-table tr > :nth-child(3) { min-width: 5.5rem; width: 8%; }
.app-shell .data-sources-table td { vertical-align: top; }
.app-shell .data-access-status { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.app-shell .data-access-status[data-rag="green"] { color: #91b96f; }
.app-shell .data-access-status[data-rag="amber"] { color: #e5ba69; }
.app-shell .data-access-status[data-rag="red"] { color: #ef8b82; }
.data-access-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
@media(max-width: 767px) { .app-shell .data-sources-table th[scope="row"] { min-width: 16rem; } }
.app-shell .bank-table .data-supplier { margin-top: 4px; font-size: 11px; font-weight: 400; text-transform: none; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* Position lists: keep historical context quiet and make return magnitude comparable. */
.app-shell .position-list-table .position-row-closed td { color: var(--color-text-muted); }
/* Why a position was opened: shown over the row on hover or focus, so it takes no table space. */
.position-list-table td[data-label="Asset"] { position: relative; }
.position-list-table .position-rationale { display: none; position: absolute; z-index: 30; left: 0; top: 100%; width: max-content; max-width: min(32rem, 80vw); padding: 6px 8px; border: 1px solid var(--color-border-strong); background: var(--color-card); color: var(--color-text-secondary); font-size: 12px; line-height: 1.45; white-space: normal; box-shadow: 0 4px 12px rgb(0 0 0 / .35); }
.position-list-table tr:hover .position-rationale, .position-list-table tr:focus-within .position-rationale { display: block; }
.app-shell .position-list-table td.position-running-superseded, .app-shell .position-list-table .position-row-closed td.position-running-superseded { color: var(--color-text-muted) !important; }
.app-shell .position-list-table .position-row-closed td a { color: var(--color-text-muted); }
.app-shell .position-list-table .position-row-closed td .position-return-value.bank-profit,
.app-shell .position-list-table .position-row-closed td.bank-profit { color: var(--color-profit) !important; }
.app-shell .position-list-table .position-row-closed td .position-return-value.bank-loss,
.app-shell .position-list-table .position-row-closed td.bank-loss { color: var(--color-loss) !important; }
.app-shell .position-list-table .position-return-value { font-weight: 600; }
.app-shell .position-list-table .position-return-track { width: 100%; height: 3px; margin-top: 5px; background: var(--color-border); }
.app-shell .position-list-table .position-return-bar { display: block; height: 100%; min-width: 2px; }
.app-shell .position-list-table .position-return-profit { background: var(--color-profit); }
.app-shell .position-list-table .position-return-loss { background: var(--color-loss); }
/* Source identity is separate from the green/amber/red availability indicator. */
.data-source-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: .4rem;
  color: #dfc899;
  background: #292820;
  border: 1px solid #61563f;
  vertical-align: middle;
}
.data-source-icon svg { width: 1.55rem; height: 1.55rem; overflow: visible; }
.data-source-icon-detail { animation: source-icon-breathe 3s ease-in-out infinite; }
.data-source-icon--power, .data-source-icon--grain { color: #b9d49a; }
.data-source-icon--medicine, .data-source-icon--hospital { color: #e7aba8; }
.data-source-icon--weather, .data-source-icon--water, .data-source-icon--satellite { color: #a4cee0; }
@keyframes source-icon-breathe {
  0%, 100% { opacity: .55; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-.5px); }
}
@media (prefers-reduced-motion: reduce) {
  .data-source-icon-detail { animation: none; }
}
.data-sources-table th[scope="row"] > .data-source-icon { float: left; margin: .15rem .6rem .15rem 0; }
.sleeve-search input[type="search"], .data-source-search input[type="search"] { width: 100%; max-width: 36rem; padding: .7rem .85rem; border: 1px solid #777568; border-radius: .4rem; color: inherit; background: transparent; }
.sleeve-search input[type="search"]:focus, .data-source-search input[type="search"]:focus { outline: 2px solid #c3ae82; outline-offset: 2px; }
.sleeve-list-table tr[hidden] { display: none; }
.data-sources-table tr[hidden] { display: none; }

/* Monitor: one stage on one permanently open screen. */
body.app-shell.monitor-shell { padding: 0; }
.app-shell.monitor-shell .bank-main { max-width: none; margin: 0; padding-top: 0; border: 0; border-radius: 0; }
.monitor-shell main, .monitor-shell #page-content, .monitor-shell #page-content > div:has(> .bank-content), .monitor-shell .bank-content { display: flex; flex-direction: column; min-height: 0; }
.monitor-shell main { height: 100dvh; }
.monitor-shell #page-content, .monitor-shell #page-content > div:has(> .bank-content), .monitor-shell .bank-content { flex: 1 1 auto; }
.monitor-shell .bank-content { padding: 12px; }
.monitor { flex: 1 1 auto; min-height: 0; display: grid; gap: 12px; grid-template-columns: minmax(0,1.2fr) minmax(0,1fr); grid-template-rows: auto minmax(0,1.1fr) minmax(0,1fr); grid-template-areas: "bar bar" "performance buffer" "trades buffer"; }
.monitor-bar { grid-area: bar; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; padding: 4px 4px 10px; border-bottom: 1px solid var(--color-border); }
.monitor-wordmark { color: var(--color-accent); font-size: 18px; font-weight: 500; letter-spacing: -1px; white-space: nowrap; }
.monitor-stages { display: flex; gap: 6px; }
.monitor-panel-heading { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 6px 16px; }
.monitor-periods, .monitor-activity-views { display: flex; gap: 6px; margin-bottom: 10px; }
.monitor-periods a[aria-current=true], .monitor-activity-views a[aria-current=true] { background: var(--color-accent); border-color: var(--color-accent); color: #0d100b; }
.monitor-stages a, .monitor-periods a, .monitor-activity-views a, .monitor-exit { padding: 3px 10px; border: 1px solid var(--color-border-strong); color: var(--color-text-secondary); font-size: 12px; text-transform: uppercase; }
.monitor-stages a[aria-current=page] { background: var(--color-accent); border-color: var(--color-accent); color: #0d100b; }
.monitor-bar #header-freshness { margin-left: auto; }
.monitor-bar .bank-freshness { display: flex; flex-wrap: wrap; align-items: center; gap: 0 18px; float: none; margin: 0; font-size: 12px; text-align: left; }
.monitor-bar .bank-system-link { display: inline; padding: 0; font: inherit; color: inherit; }
.monitor-clock { color: var(--color-text-secondary); font-size: 14px; font-variant-numeric: tabular-nums; }
.monitor-panel { min-height: 0; display: flex; flex-direction: column; padding: 14px; border: 1px solid var(--color-border-strong); background: var(--color-card); }
.monitor .monitor-panel h2, .monitor .terminal-buffer-heading h2 { margin: 0 0 10px; padding: 0; color: var(--color-accent); font-size: 12px; line-height: 1.5; text-transform: uppercase; }
.monitor .terminal-buffer-heading h2 { margin: 0; }
.monitor [hidden] { display: none !important; }
.monitor-performance { grid-area: performance; overflow: hidden; }
/* Keep ApexCharts inline dimensions out of the flex layout. */
.monitor-performance #monitor-chart-frame { position: relative; flex: 1 1 0; min-height: 0; overflow: hidden; }
.monitor-performance #monitor-chart { position: absolute; inset: 0; }
.monitor-panel-heading, .monitor-stats { flex-shrink: 0; }
.monitor .bank-empty { flex: 1 1 auto; min-height: 0; }
.monitor-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 10px; }
.monitor-trades { grid-area: trades; }
.monitor-trades-scroll { flex: 1 1 auto; min-height: 0; overflow-x: hidden; overflow-y: auto; }
.monitor-trade-table { width: 100%; table-layout: auto; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.monitor-trade-table th { position: sticky; top: 0; padding: 4px 6px; background: var(--color-card); color: var(--color-text-muted); font-size: 10px; font-weight: 400; text-align: left; text-transform: uppercase; }
.monitor-trade-table td { padding: 5px 6px; border-top: 1px solid var(--color-border); white-space: nowrap; }
.monitor-pnl-note { display: block; color: var(--color-text-muted); font-size: 10px; }
/* Sleeve and asset give way first so the table never scrolls sideways. */
.monitor-trade-table .monitor-trade-sleeve { max-width: 0; width: 45%; overflow: hidden; text-overflow: ellipsis; }
.monitor-trade-table .monitor-trade-asset { max-width: 20ch; overflow: hidden; text-overflow: ellipsis; }
.monitor-trade-table .position-row-closed td { color: var(--color-text-muted); }
.monitor .terminal-command-buffer { grid-area: buffer; min-height: 0; margin: 0; display: flex; flex-direction: column; font-size: 14px; }
.monitor .terminal-log-line { grid-template-columns: 150px minmax(0,1fr); padding: 3px 0; }
.monitor .terminal-log-preview { flex: 1 1 auto; min-height: 0; max-height: none; }
@media (max-width: 1100px) {
  .monitor-shell main { height: auto; min-height: 100dvh; }
  .monitor { grid-template-columns: minmax(0,1fr); grid-template-rows: auto; grid-template-areas: "bar" "performance" "trades" "buffer"; }
  .monitor-performance #monitor-chart-frame { height: 280px; flex: none; }
  .monitor-trades-scroll, .monitor .terminal-log-preview { max-height: 420px; }
}

.monitor[data-monitor-stage="staging"] .monitor-stats,
.monitor[data-monitor-stage="sandbox"] .monitor-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 1600px) {
  .monitor[data-monitor-stage="live"] .monitor-stats { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

.terminal-monitor-link { padding: 6px 12px; border: 1px solid var(--color-border); color: var(--color-text-muted); font-size: 12px; }
.terminal-monitor-link:hover, .terminal-monitor-link:focus-visible { color: var(--color-text); border-color: currentColor; }

/* Public promotion diagram uses the shared terminal palette and real text. */
.about-promotion-flow { margin: 2rem 0; padding: 1rem; border: 1px solid var(--color-border); background: var(--color-card); font-size: 12px; line-height: 1.6; }
.about-promotion-flow figcaption { margin-bottom: 1rem; color: var(--color-text-primary); }
.about-promotion-stages { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.25rem; list-style: none; padding: 0; }
.about-promotion-stages li { position: relative; min-width: 0; border-top: 1px solid var(--color-border-strong); padding-top: .5rem; }
.about-promotion-stages li + li::before { content: "→"; position: absolute; left: -1rem; top: .5rem; color: var(--color-text-muted); }
.about-promotion-flow a { color: var(--color-link); text-decoration: underline; text-underline-offset: 3px; }
.about-promotion-stages span { display: block; margin-top: .25rem; color: var(--color-text-muted); font-size: 11px; }
.about-promotion-stages .about-stage-count { display: block; margin-top: .25rem; color: var(--color-text-primary); font-weight: 600; }
.about-promotion-stages .about-stage-power { display: block; color: var(--color-text-secondary); font-style: normal; font-size: 11px; }
.about-step-plain h3 .about-stage-count { margin-left: .5rem; color: var(--color-text-muted); font-size: .75em; font-weight: 400; }
.about-promotion-outcomes .about-stage-count { color: var(--color-text-muted); }
.about-promotion-outcomes { margin-top: 1rem; color: var(--color-text-secondary); }
.about-promotion-flow p { margin-top: .75rem; font-size: 11px; }
@media (max-width: 639px) {
  .about-promotion-stages { grid-template-columns: 1fr; gap: 1.5rem; }
  .about-promotion-stages li + li::before { content: "↓"; left: 0; top: -1.4rem; }
}
/* First-visit orientation on the signed-out homepage. */
.terminal-welcome { margin: 0 0 28px; padding: 22px 24px; border: 1px solid var(--color-border-strong); background: linear-gradient(135deg, #1a1f14, #0d100b 70%); color: var(--color-text-secondary); font-size: 13px; line-height: 1.5; }
.terminal-welcome-kicker { margin: 0 0 6px; color: var(--color-text-muted); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.terminal-welcome h2 { margin: 0; color: var(--color-text-primary); font: 500 20px/1.3 'IBM Plex Mono', monospace; letter-spacing: -.4px; }
.terminal-welcome-actions { display: inline-flex; align-items: center; gap: 16px; }
.terminal-welcome-actions button { flex: none; padding: 6px 12px; border: 1px solid var(--color-border-strong); background: transparent; color: var(--color-text-secondary); font: 500 12px 'IBM Plex Mono', monospace; cursor: pointer; }
.terminal-welcome-actions button:hover, .terminal-welcome-actions button:focus-visible { border-color: var(--color-accent); color: var(--color-accent); }
.terminal-welcome-score { margin: 20px 0 22px; }
.terminal-welcome-score dl { display: flex; flex-wrap: wrap; gap: 8px 56px; margin: 0; }
.terminal-welcome-score dt { color: var(--color-text-muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.terminal-welcome-score dd { margin: 2px 0 0; font: 600 56px/1 'IBM Plex Mono', monospace; letter-spacing: -2px; }
.terminal-welcome-score dl > div:nth-child(2) dd { opacity: .75; }
.terminal-welcome-lead { margin: 12px 0 0; font-size: 15px; font-weight: 600; }
.terminal-welcome-fine { margin: 6px 0 0; color: var(--color-text-muted); font-size: 11px; }
.terminal-welcome-ladder { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; padding: 0; border: 1px solid var(--color-border); list-style: none; }
.terminal-welcome-ladder li { position: relative; display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 12px 14px; }
.terminal-welcome-ladder li + li { border-left: 1px solid var(--color-border); }
.terminal-welcome-ladder li + li::before { content: "▶"; position: absolute; left: -6px; top: 15px; color: var(--color-border-strong); background: var(--color-bg); font-size: 9px; line-height: 1; }
.terminal-welcome-ladder li[aria-current=step] { background: var(--color-accent-light); box-shadow: inset 0 0 0 1px var(--color-accent); }
.terminal-welcome-stage { color: var(--color-accent); font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.terminal-welcome-ladder strong { color: var(--color-text-primary); font-size: 26px; font-weight: 600; line-height: 1; }
.terminal-welcome-bar { display: block; height: 6px; background: var(--color-bg-secondary); }
.terminal-welcome-bar > span { display: block; height: 100%; background: repeating-linear-gradient(90deg, var(--color-accent) 0 5px, transparent 5px 7px); }
.terminal-welcome-description { color: var(--color-text-muted); font-size: 11px; }
.terminal-welcome-here { color: var(--color-accent); }
.terminal-welcome-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; margin-top: 12px; color: var(--color-text-muted); font-size: 12px; }
.terminal-welcome-foot a { color: var(--color-link); text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 767px) {
  .terminal-welcome { padding: 16px; }
  .terminal-welcome h2 { font-size: 16px; }
  .terminal-welcome-score dl { gap: 8px 28px; }
  .terminal-welcome-score dd { font-size: 38px; letter-spacing: -1px; }
  .terminal-welcome-ladder { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .terminal-welcome-ladder li:nth-child(3) { border-left: 0; }
  .terminal-welcome-ladder li:nth-child(3)::before { content: none; }
  .terminal-welcome-ladder li:nth-child(n+3) { border-top: 1px solid var(--color-border); }
  .terminal-welcome-actions { width: 100%; justify-content: space-between; }
}

/* Asset pages */
.app-shell .asset-name { font-size: 1.75rem; line-height: 1.15; letter-spacing: -.04em; font-weight: 500; }
.app-shell .asset-description { max-width: 72ch; line-height: 1.6; }
.app-shell .asset-chip { display: inline-flex; align-items: center; padding: 2px 8px; border: 1px solid var(--color-border); border-radius: 999px; color: var(--color-text-secondary); text-transform: none; letter-spacing: 0; font-size: 11px; }
.app-shell .asset-chip-strong { color: var(--color-bg); background: var(--color-accent); border-color: var(--color-accent); font-weight: 600; }
.app-shell .asset-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.app-shell .asset-fact { padding: 14px 24px; border-right: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border); margin: 0 -1px -1px 0; }
.app-shell .asset-fact dt, .app-shell .asset-tile dt { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--color-text-muted); }
.app-shell .asset-fact dd { margin-top: 4px; font-size: 14px; color: var(--color-text-primary); }
.app-shell .asset-headline { font-size: 1.6rem; letter-spacing: -.03em; }
.app-shell .asset-tile { padding: 10px 12px; background: var(--color-bg-alt); border: 1px solid var(--color-border); border-radius: 6px; }
.app-shell .asset-tile dd { margin-top: 2px; font-size: 15px; font-weight: 600; }
.app-shell .asset-legend { display: inline-block; width: 14px; height: 0; border-top: 1px solid; margin-right: 6px; vertical-align: middle; }
.app-shell .asset-legend-dot { width: 8px; height: 8px; border: 0; border-radius: 50%; }
.app-shell .asset-moves { display: grid; gap: 6px; font-size: 12px; }
.app-shell .asset-moves li { display: grid; grid-template-columns: 7.5rem 1fr 4rem; align-items: center; gap: 10px; }
.app-shell .asset-move-date { color: var(--color-text-muted); }
.app-shell .asset-move-track { position: relative; height: 8px; background: var(--color-bg-alt); border-radius: 4px; }
.app-shell .asset-move-track::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; border-left: 1px solid var(--color-border-strong); }
.app-shell .asset-move-bar { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.app-shell .asset-move-bar.is-up { left: 50%; background: var(--color-profit); }
.app-shell .asset-move-bar.is-down { right: 50%; background: var(--color-loss); }
.app-shell .asset-move-value { text-align: right; }
.app-shell #asset-price-chart .apexcharts-tooltip { background: var(--color-bg-alt) !important; border: 1px solid var(--color-border) !important; }
