/* 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-summary strong, .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 #sidebar .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; }
.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-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-summary { border-radius: 0; }
.app-shell .bank-summary strong { font-size: 24px; }
.app-shell .bank-summary .bank-date { font-size: 18px; }
.app-shell .bank-summary span { font-size: 11px; 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-performance-compact .bank-summary > div, .app-shell .bank-risk-card, .app-shell .bank-risk-card dl > div + div, .app-shell .bank-table td, .app-shell .bank-table th { border-color: var(--color-border); }
.app-shell .bank-risk-card h3, .app-shell .bank-risk-card dt { color: var(--color-text-muted); }
.app-shell .bank-risk-card dd { color: var(--color-text-secondary); font-family: inherit; }
.app-shell .bank-risk-card[data-rag=green] dl > div:first-child dd { color: var(--color-profit); }
.app-shell .bank-risk-card[data-rag=amber] dl > div:first-child dd { color: var(--color-warning); }
.app-shell .bank-risk-card[data-rag=red] dl > div:first-child dd { color: var(--color-loss); }
.app-shell .bank-table th, .app-shell .bank-fine, .app-shell .bank-empty { color: var(--color-text-muted); }
.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) minmax(290px,360px); }
.app-shell .bank-footer-signup { align-self: start; }
.app-shell .bank-footer .terminal-email-signup { margin: 0; padding: 16px; grid-template-columns: 1fr; gap: 12px; }
.app-shell .bank-footer .terminal-email-signup h2 { font-size: 14px; line-height: 1.4; }
.app-shell .bank-footer .terminal-email-form { grid-template-columns: 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: 1100px) {
  .app-shell .bank-footer { grid-template-columns: 180px minmax(0,1fr); }
  .app-shell .bank-footer-signup { grid-column: 2; }
}
@media(max-width: 767px) {
  .app-shell .bank-footer { grid-template-columns: 1fr; }
  .app-shell .bank-footer-signup { grid-column: 1; }
}
/* 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 auto; padding: 28px 26px 0; overflow: visible; border: 8px solid #252d23; border-bottom: 0; border-radius: 12px 12px 0 0; }
  .app-shell .bank-wordmark { padding: 0 0 25px; font-size: 38px; letter-spacing: -2px; }
  .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-account { grid-row: 1; grid-column: 2; padding: 0 0 20px 20px; margin: 0; align-self: center; max-width: none; }
  .app-shell .bank-account .bank-freshness > div:first-child { white-space: nowrap; }
  .app-shell .bank-account [data-inception-performance] { white-space: nowrap; }
  .app-shell .bank-account summary { border: 0; padding: 0; }
  .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; }
  .app-shell .bank-summary strong { font-size: 19px; }
  .app-shell .bank-summary .bank-date { font-size: 16px; }
  .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; }
  .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 tr > :nth-child(2) { 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; }
.app-shell .bank-freshness [data-latest-public-action] { display: block; white-space: nowrap; color: inherit; }
.app-shell .bank-freshness [data-latest-public-action] time,
.app-shell .bank-freshness [data-latest-public-action] small { display: inline; }
.app-shell .bank-freshness [data-latest-public-action] small { font-size: .7em; }
@media (max-width: 1023px) {
  .app-shell .bank-freshness [data-latest-public-action] { display: 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); }
.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); }
