/* Steady Capital — partners dashboard
   Palette: ink navy room, paper ink, old gold; bull green vs bear red
   Type: Georgia small-caps masthead, system body, mono numerals */

:root {
  --surface: #0F151D;
  --panel: #171F2A;
  --panel-2: #1D2734;
  --line: #26303D;
  --ink: #E9E4D6;
  --ink-2: #B9BFC7;
  --muted: #8B95A1;
  --gold: #C9A227;
  --gold-soft: #C9A22733;
  --bull: #3FA97C;
  --bear: #D06557;
  --aggr: #D9822B;
  --cons: #6C9BD1;
  --neut: #9AA5B1;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: var(--surface);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- masthead ---------- */
.masthead-mark {
  display: inline-grid; place-items: center;
  width: 52px; height: 52px;
  border: 1px solid var(--gold);
  color: var(--gold);
  font-family: var(--serif); font-size: 30px;
  border-radius: 2px;
}
.masthead-mark.small { width: 30px; height: 30px; font-size: 18px; }

/* ---------- login ---------- */
.login {
  min-height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 28px; padding: 24px;
  background:
    radial-gradient(1200px 600px at 50% -10%, #1A2430 0%, var(--surface) 60%);
}
.login-card { width: min(360px, 100%); text-align: center; }
.masthead h1 {
  font-family: var(--serif);
  font-size: 34px; font-weight: 400;
  letter-spacing: 0.12em;
  font-variant: small-caps;
  margin-top: 14px;
}
.masthead-sub {
  color: var(--muted);
  font-size: 12px; letter-spacing: 0.28em;
  text-transform: uppercase;
  margin-top: 4px;
}
#login-form { margin-top: 36px; text-align: left; }
#login-form label {
  display: block;
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px;
}
#login-form input {
  width: 100%; padding: 12px 14px;
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-radius: 3px;
  font-size: 16px; letter-spacing: 0.08em;
}
#login-form input:focus { border-color: var(--gold); outline: none; }
#login-form button {
  width: 100%; margin-top: 14px; padding: 12px;
  background: var(--gold); color: #14100A;
  border-radius: 3px; font-weight: 600; letter-spacing: 0.04em;
}
#login-form button:hover { filter: brightness(1.08); }
.login-error { color: var(--bear); font-size: 13px; margin-top: 12px; }
.login-foot { color: var(--muted); font-size: 12px; max-width: 420px; text-align: center; }

/* ---------- dashboard chrome ---------- */
.dash { height: 100vh; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 20px;
  padding: 10px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.topbar-brand { display: flex; align-items: center; gap: 10px; }
.topbar-name {
  font-family: var(--serif); font-variant: small-caps;
  letter-spacing: 0.1em; font-size: 18px;
}
.run-tabs { display: flex; gap: 6px; overflow-x: auto; flex: 1; }
.run-tab {
  padding: 6px 12px;
  border: 1px solid var(--line); border-radius: 3px;
  color: var(--ink-2); font-size: 13px; white-space: nowrap;
}
.run-tab .run-date { color: var(--muted); font-size: 11px; margin-left: 6px; }
.run-tab[aria-selected="true"] {
  border-color: var(--gold); color: var(--ink);
  background: var(--gold-soft);
}
.topbar-right { display: flex; align-items: center; gap: 14px; }
.equity-readout { font-family: var(--mono); font-size: 14px; color: var(--ink-2); }
.equity-readout strong { color: var(--ink); font-weight: 600; }
.equity-readout .up { color: var(--bull); }
.equity-readout .down { color: var(--bear); }
.ghost-btn {
  padding: 6px 10px; font-size: 12px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 3px;
}
.ghost-btn:hover { color: var(--ink); }

.dash-body { flex: 1; display: flex; min-height: 0; }

/* ---------- department rail ---------- */
.rail {
  width: 210px; flex-shrink: 0;
  padding: 16px 10px;
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 2px;
  overflow-y: auto;
}
.rail-label {
  font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--muted);
  padding: 10px 10px 6px;
}
.dept {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 3px;
  color: var(--ink-2); font-size: 14px; text-align: left;
}
.dept:hover { background: var(--panel); color: var(--ink); }
.dept[aria-current="true"] { background: var(--panel-2); color: var(--ink); }
.dept-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dept-dot.analysts { background: var(--cons); }
.dept-dot.research { background: var(--bull); box-shadow: 5px 0 0 -1px var(--bear); margin-right: 4px; }
.dept-dot.trading { background: var(--ink-2); }
.dept-dot.risk { background: var(--aggr); }
.dept-dot.decision { background: var(--gold); }
.dept-dot.portfolio { background: var(--gold); border-radius: 1px; }
.rail-foot {
  margin-top: auto; padding: 12px 10px 4px;
  color: var(--muted); font-size: 11px; line-height: 1.6;
}

/* ---------- feed ---------- */
.feed { flex: 1; overflow-y: auto; padding: 26px 30px 60px; }
.feed-day {
  font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted); text-align: center;
  margin: 6px 0 22px;
  display: flex; align-items: center; gap: 14px;
}
.feed-day::before, .feed-day::after {
  content: ''; flex: 1; height: 1px; background: var(--line);
}
.empty-floor {
  margin: 18vh auto 0; max-width: 380px; text-align: center; color: var(--muted);
}
.empty-floor .masthead-mark { margin-bottom: 18px; opacity: 0.5; }

/* messages */
.msg { display: flex; gap: 12px; max-width: 780px; margin: 0 auto 18px; }
.avatar {
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 3px;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
  background: var(--panel-2); color: var(--ink-2);
  border-top: 2px solid var(--muted);
}
.msg-body { min-width: 0; flex: 1; }
.msg-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.msg-name { font-weight: 600; font-size: 14px; }
.msg-role { color: var(--muted); font-size: 12px; }
.msg-text {
  margin-top: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0 6px 6px 6px;
  padding: 12px 15px;
  font-size: 14px;
  color: var(--ink-2);
  overflow-wrap: break-word;
}
.msg-text > * + * { margin-top: 10px; }
.msg-text strong { color: var(--ink); }
.msg-text h1, .msg-text h2, .msg-text h3, .msg-text h4 {
  color: var(--ink); font-size: 14px; letter-spacing: 0.02em;
}
.msg-text ul, .msg-text ol { padding-left: 20px; }
.msg-text li { margin-top: 4px; }
.msg-text .tbl-wrap { overflow-x: auto; }
.msg-text table { border-collapse: collapse; font-size: 13px; min-width: 60%; }
.msg-text th, .msg-text td { border: 1px solid var(--line); padding: 5px 9px; text-align: left; }
.msg-text th { color: var(--ink); background: var(--panel-2); }

/* long reports collapse */
.msg-text.collapsed { max-height: 300px; overflow: hidden; position: relative; }
.msg-text.collapsed::after {
  content: ''; position: absolute; inset: auto 0 0 0; height: 90px;
  background: linear-gradient(transparent, var(--panel));
}
.read-more {
  margin-top: 6px; font-size: 12px; color: var(--gold);
  letter-spacing: 0.06em;
}
.read-more:hover { text-decoration: underline; }

/* debate sides — the firm's signature: bull and bear argue across the aisle */
.msg.side-bull .avatar { border-top-color: var(--bull); color: var(--bull); }
.msg.side-bull .msg-text { border-left: 2px solid var(--bull); }
.msg.side-bear { flex-direction: row-reverse; }
.msg.side-bear .avatar { border-top-color: var(--bear); color: var(--bear); }
.msg.side-bear .msg-head { justify-content: flex-end; }
.msg.side-bear .msg-text { border-right: 2px solid var(--bear); border-radius: 6px 0 6px 6px; }
.msg.role-aggr .avatar { border-top-color: var(--aggr); color: var(--aggr); }
.msg.role-aggr .msg-text { border-left: 2px solid var(--aggr); }
.msg.role-cons .avatar { border-top-color: var(--cons); color: var(--cons); }
.msg.role-cons .msg-text { border-left: 2px solid var(--cons); }
.msg.role-neut .avatar { border-top-color: var(--neut); color: var(--neut); }
.msg.role-neut .msg-text { border-left: 2px solid var(--neut); }

/* verdict / decision cards */
.verdict { max-width: 780px; margin: 26px auto; }
.verdict-card {
  border: 1px solid var(--gold);
  border-radius: 4px;
  background: linear-gradient(var(--gold-soft), transparent 120px), var(--panel);
  padding: 16px 18px;
}
.verdict-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 10px;
}
.rating-badge {
  font-family: var(--mono); font-weight: 700; font-size: 13px;
  padding: 3px 10px; border-radius: 3px; letter-spacing: 0.08em;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--ink);
}
.rating-badge.buy, .rating-badge.overweight { border-color: var(--bull); color: var(--bull); }
.rating-badge.sell, .rating-badge.underweight { border-color: var(--bear); color: var(--bear); }

/* ---------- portfolio ---------- */
.folio { max-width: 860px; margin: 0 auto; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: 4px;
  padding: 14px 16px;
}
.stat .stat-label {
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted);
}
.stat .stat-value {
  font-family: var(--mono); font-size: 24px; margin-top: 6px; color: var(--ink);
}
.stat .stat-value.up { color: var(--bull); }
.stat .stat-value.down { color: var(--bear); }

.folio h2 {
  font-family: var(--serif); font-variant: small-caps; font-weight: 400;
  letter-spacing: 0.08em; font-size: 19px;
  margin: 30px 0 12px;
}
.chart-panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 4px;
  padding: 16px;
}
.chart-wrap { position: relative; }
.chart-tip {
  position: absolute; pointer-events: none;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 3px;
  padding: 5px 9px; font-family: var(--mono); font-size: 12px;
  transform: translate(-50%, -130%); white-space: nowrap;
  display: none;
}
.folio table {
  width: 100%; border-collapse: collapse; font-size: 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 4px;
}
.folio th, .folio td { padding: 9px 13px; border-bottom: 1px solid var(--line); text-align: left; }
.folio th {
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.folio td.num { font-family: var(--mono); }
.folio tr:last-child td { border-bottom: none; }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .rail { position: fixed; inset: auto 0 0 0; z-index: 5;
    width: 100%; flex-direction: row; flex-wrap: nowrap; overflow-x: auto;
    border-top: 1px solid var(--line); border-right: none;
    background: var(--panel); padding: 8px; }
  .rail-label, .rail-foot { display: none; }
  .dept { flex-shrink: 0; }
  .feed { padding: 18px 14px 120px; }
  .topbar { flex-wrap: wrap; }
  .equity-readout { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .msg { animation: rise 0.25s ease both; }
  @keyframes rise { from { opacity: 0; transform: translateY(6px); } }
}

/* ---------- performance review + execution quality ---------- */
.up { color: var(--bull); }
.down { color: var(--bear); }
.dept-dot.review { background: #5B8DB8; }
.review-grade { font-family: ui-monospace, Menlo, monospace; font-size: 13px; margin: 2px 0 8px; color: var(--ink-2); }
.review-pending { color: var(--ink-2); font-style: italic; }
.order-status { font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.chart-legend { font-size: 12px; font-weight: 400; color: var(--ink-2); margin-left: 12px; }
.chart-legend .lg { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin: 0 5px 0 12px; }
.chart-legend .lg-firm { background: #C9A227; }
.chart-legend .lg-bench { background: #5B8DB8; }

/* ---------- partner desk chat ---------- */
.dept-dot.chat { background: var(--ink-2); border-radius: 50% 50% 50% 2px; }
.deskchat { display: flex; flex-direction: column; min-height: calc(100vh - 140px); }
.chat-log { flex: 1; }
.chat-user .avatar { background: var(--gold); color: #171F2A; }
.chat-wait { color: var(--ink-2); font-style: italic; font-size: 13px; padding: 8px 0 8px 52px; }
.chat-form { display: flex; gap: 8px; position: sticky; bottom: 0; padding: 12px 0 4px;
  background: linear-gradient(transparent, var(--bg, #0F151D) 30%); }
.chat-form input { flex: 1; background: #171F2A; border: 1px solid #26303D; border-radius: 8px;
  color: inherit; padding: 10px 14px; font: inherit; }
.chat-form input:focus { outline: none; border-color: var(--gold); }
.chat-form button { background: var(--gold); color: #171F2A; border: none; border-radius: 8px;
  padding: 10px 20px; font: inherit; font-weight: 600; cursor: pointer; }
.chat-form button:disabled { opacity: .5; cursor: default; }

/* ---------- read-aloud button ---------- */
.say { margin-left: auto; background: none; border: 1px solid transparent; border-radius: 6px;
  color: var(--ink-2); cursor: pointer; padding: 3px 6px; line-height: 0; flex-shrink: 0; }
.say:hover { color: var(--gold); border-color: #26303D; }
.say.speaking { color: var(--gold); animation: say-pulse 1.2s ease-in-out infinite; }
@keyframes say-pulse { 50% { opacity: .45; } }
.msg-head, .verdict-head { display: flex; align-items: center; gap: 8px; }

/* ---------- voice picker ---------- */
.voice-label { display: block; font-size: 11px; color: var(--ink-2); margin-bottom: 10px; }
.voice-label select { display: block; width: 100%; margin-top: 4px; background: #171F2A;
  border: 1px solid #26303D; border-radius: 6px; color: inherit; padding: 5px 6px; font-size: 12px; }

/* ---------- playback bar ---------- */
#say-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; z-index: 50;
  display: flex; align-items: center; gap: 6px; padding: 8px 12px;
  background: #171F2A; border: 1px solid #26303D; border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,.45); }
#say-bar button { background: none; border: none; color: var(--ink, #E8ECF1); cursor: pointer;
  padding: 6px; border-radius: 8px; line-height: 0; }
#say-bar button:hover { color: var(--gold); background: #1F2937; }
#say-progress { font: 12px ui-monospace, Menlo, monospace; color: var(--ink-2); min-width: 52px; text-align: center; }
#say-bar input[type=range] { width: 90px; accent-color: var(--gold); }
@media (max-width: 720px) { #say-bar { bottom: 64px; } }

/* ---------- firm switcher ---------- */
.firm-pick { background: #171F2A; border: 1px solid #26303D; border-radius: 8px; color: inherit;
  font-family: Georgia, serif; font-size: 15px; padding: 6px 8px; cursor: pointer; max-width: 240px; }
.firm-pick:hover, .firm-pick:focus { border-color: var(--gold); outline: none; }

/* ---------- session (date) picker in feed header ---------- */
.session-pick { margin-left: 10px; background: #171F2A; border: 1px solid #26303D;
  border-radius: 6px; color: inherit; font-size: 12px; padding: 3px 6px; cursor: pointer; }
.session-pick:focus { outline: none; border-color: var(--gold); }

/* ---------- standings scoreboard ---------- */
.standings-btn { margin-left: 10px; background: #171F2A; border: 1px solid #26303D; border-radius: 8px;
  color: inherit; font-size: 13px; padding: 6px 12px; cursor: pointer; white-space: nowrap; }
.standings-btn:hover { border-color: var(--gold); }
.standings-btn.active { background: var(--gold); color: #171F2A; border-color: var(--gold); font-weight: 600; }
.muted { color: var(--ink-2); font-size: 12px; }
td .muted { font-size: 11px; }

/* ---- live toasts (real-time alerts + news wire) ---- */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 999;
  display: flex; flex-direction: column-reverse; gap: 8px; max-width: min(420px, calc(100vw - 32px));
  pointer-events: none; }          /* container never blocks the UI under it */
.toast { pointer-events: auto; }   /* only the toasts themselves are clickable */
.toast { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px;
  padding: 10px 12px; border-radius: 8px; font-size: 13px; line-height: 1.35;
  background: #171F2A; border: 1px solid #2A3646; color: var(--ink-1, #E8EDF4);
  box-shadow: 0 6px 24px rgba(0,0,0,.45); animation: toast-in .25s ease; }
.toast strong { font-size: 12px; letter-spacing: .02em; color: var(--gold, #C9A227); }
.toast span { grid-column: 1; }
.toast .toast-x { grid-column: 2; grid-row: 1 / span 2; align-self: start;
  background: none; border: none; color: inherit; opacity: .55; font-size: 15px;
  cursor: pointer; padding: 0 2px; }
.toast .toast-x:hover { opacity: 1; }
.toast.alert { border-color: #B33A3A; background: #241419; }
.toast.alert strong { color: #E06666; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; }
  to { transform: none; opacity: 1; } }
.dept-dot.night { background: #7A6BD6; border-radius: 50% 2px 50% 50%; }
.dept-dot.news { background: #4FA3A3; border-radius: 2px; }
.toast.clickable { cursor: pointer; }
.toast.clickable:hover { border-color: var(--gold); }
.toast-open { grid-column: 1; font-size: 11px; color: var(--gold); opacity: .85; margin-top: 2px; }
.newslist { display: flex; flex-direction: column; gap: 2px; }
.newsrow { display: block; text-decoration: none; color: inherit;
  padding: 10px 12px; border-bottom: 1px solid #222C3A; }
a.newsrow:hover { background: #171F2A; }
a.newsrow:hover .newshead { color: var(--gold); }
.newsmeta { font-size: 11px; color: var(--ink-2); letter-spacing: .02em; }
.newshead { font-size: 14px; line-height: 1.4; margin: 2px 0; }
.newstags { font-size: 11px; color: var(--ink-2); }
/* On narrow screens the rail becomes a fixed bottom bar — lift toasts above it
   (and cap the stack) so live alerts can never cover the navigation. */
@media (max-width: 760px) {
  .toasts { bottom: 76px; max-height: 60vh; overflow: hidden; }
}
.dept-dot.riskrecap { background: #C97F27; border-radius: 2px 50% 50% 50%; }
.thesis-row td { padding: 6px 10px 10px; font-size: 12px; color: var(--ink-2);
  line-height: 1.5; border-top: none; }
.thesis-label { color: var(--gold); font-weight: 600; }
.toast-age { grid-column: 1; font-size: 11px; color: var(--ink-2); opacity: .8; margin-top: 2px; }
.deskday { margin-bottom: 26px; }
.deskday h2 { font-size: 14px; letter-spacing: .06em; color: var(--gold); margin: 18px 0 10px; }
.deskday table { width: 100%; }
.deskday tr.ev-pass td { color: var(--ink-2); }
.deskday tr.ev-exit td { background: #131A24; }
.lb-row { cursor: pointer; }
.lb-row:hover { background: #171F2A; }
.lb-row:hover td:nth-child(2) { color: var(--gold); }
