/* ============================================================
   Stock Analyst Console — styles
   Design tokens lifted verbatim from the wireframe handoff.
   ============================================================ */

:root {
  --f-display: 'Caveat', cursive;
  --f-body: 'Kalam', system-ui, sans-serif;
  --f-mono: 'JetBrains Mono', monospace;
  --bg: #0d0f13; --sidebar: #111419; --panel: #1a1d24; --inset: #0f1217;
  --inset2: #13161b; --mock: #161a20; --bd1: #20242c; --bd2: #262b34;
  --bd3: #2b3039; --dash: #313742; --line: #3a4150; --segbd: #3a4d5e;
  --segbg: #26323e; --ctabd: #2f5e7a; --ctabg: #13202b; --predbd: #2f4a5e;
  --predbg: #101820; --gblue: #192230; --gblue2: #161922; --ggreen: #16201a;
  --ggreen2: #17231b; --gamber: #231c14; --tbright: #e6ebf2; --tbody: #cdd4df;
  --tmut: #9aa6b8; --tmut2: #8b94a4; --tdim: #7e8796; --tfaint: #5b6472;
  --tfaint2: #7c8696; --oncta: #cfe0f2; --green: #73c088; --red: #e0746e;
  --amber: #e0a85f; --blue: #62a9e0; --cyan: #5fbecb; --amberdk: #b5823f;
  --amberlt: #e0c089;
}
.themeroot[data-font="blueprint"] { --f-display: 'Caveat', cursive; --f-body: 'Kalam', system-ui, sans-serif; --f-mono: 'JetBrains Mono', monospace; }
.themeroot[data-font="modern"] { --f-display: 'Space Grotesk', sans-serif; --f-body: 'Plus Jakarta Sans', sans-serif; --f-mono: 'JetBrains Mono', monospace; }
.themeroot[data-font="editorial"] { --f-display: 'Newsreader', serif; --f-body: 'Spline Sans', sans-serif; --f-mono: 'JetBrains Mono', monospace; }
.themeroot[data-font="mono"] { --f-display: 'Space Mono', monospace; --f-body: 'IBM Plex Mono', monospace; --f-mono: 'IBM Plex Mono', monospace; }
.themeroot[data-theme="light"] {
  --bg: #f3f5f8; --sidebar: #ffffff; --panel: #ffffff; --inset: #f1f3f6;
  --inset2: #eef0f4; --mock: #e7eaef; --bd1: #e4e7ec; --bd2: #dadee5;
  --bd3: #cdd3db; --dash: #c3c9d3; --line: #aeb6c2; --segbd: #a9bdcf;
  --segbg: #dde8f2; --ctabd: #9cc2dd; --ctabg: #e7f1f9; --predbd: #9cc2dd;
  --predbg: #e9f1f9; --gblue: #e9f0f8; --gblue2: #f1f4f9; --ggreen: #e6f4ea;
  --ggreen2: #e3f3e8; --gamber: #faf0df; --tbright: #10141b; --tbody: #2c333e;
  --tmut: #59647a; --tmut2: #5e6877; --tdim: #6b7585; --tfaint: #8a93a1;
  --tfaint2: #7b8593; --oncta: #1c4f73; --green: #2f9e54; --red: #d2453d;
  --amber: #b9791b; --blue: #2f7fc4; --cyan: #0f8a9c; --amberdk: #9c6518;
  --amberlt: #9a6a17;
}

.themeroot, .themeroot * { transition: background-color .22s ease, border-color .22s ease, color .22s ease; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); font-family: var(--f-body); color: var(--tbody); -webkit-font-smoothing: antialiased; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--bd3); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes dashmove { to { background-position: 200px 0; } }

a { color: inherit; text-decoration: none; }
button { font: inherit; }
.boot { padding: 60px; font-family: var(--f-mono); color: var(--tdim); }
.hidden { display: none !important; }

/* ---------- App shell ---------- */
.shell { display: flex; min-height: 100vh; background: var(--bg); color: var(--tbody); font-family: var(--f-body); }
.sidebar {
  width: 266px; flex: none; background: var(--sidebar); border-right: 1px solid var(--bd1);
  position: sticky; top: 0; height: 100vh; overflow: hidden; padding: 18px 13px 14px;
  display: flex; flex-direction: column;
}
.brand { padding: 6px 8px 14px; flex: none; }
.brand-name { font-family: var(--f-display); font-size: 27px; color: var(--tbright); line-height: 1; }
.brand-sub { font-family: var(--f-display); font-size: 19px; color: var(--cyan); }

/* nav scrolls; the profile foot below stays pinned (claude.ai-style) */
.nav-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; margin: 0 -4px; padding: 0 4px; }

.eyebrow { font-family: var(--f-body); font-size: 10px; letter-spacing: .12em; color: var(--tdim); text-transform: uppercase; }
.seg-row { display: flex; gap: 6px; }
.seg {
  flex: 1; font-family: var(--f-body); font-size: 13px; cursor: pointer; color: var(--tmut2);
  background: transparent; border: 1px solid var(--bd3); padding: 7px 0; border-radius: 8px;
}
.seg.active { color: var(--oncta); background: var(--segbg); border-color: var(--segbd); }
.font-list { display: flex; flex-direction: column; gap: 5px; }
.font-opt {
  display: flex; align-items: center; justify-content: space-between; cursor: pointer;
  color: var(--tmut2); background: transparent; border: 1px solid var(--bd3); padding: 6px 11px; border-radius: 8px;
}
.font-opt.active { color: var(--oncta); background: var(--segbg); border-color: var(--segbd); }

.nav-head { font-family: var(--f-body); font-size: 11px; letter-spacing: .12em; color: var(--tfaint); text-transform: uppercase; padding: 10px 9px 5px; }
.nav-item {
  display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 8px; cursor: pointer;
  border: 1px solid transparent; background: transparent; color: var(--tmut); font-family: var(--f-body); font-size: 14px; margin-bottom: 3px; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--inset); }
.nav-item.active { background: rgba(98,169,224,.14); color: var(--oncta); border-color: rgba(98,169,224,.45); }
.nav-num { font-family: var(--f-mono); font-size: 10px; opacity: .6; }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }

/* logged-in account row, pinned to the foot of the sidebar. Flat like the nav
   items (transparent, inset on hover) so it reads as part of the same surface. */
.profile { flex: none; position: relative; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--bd1); }
.profile-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; cursor: pointer;
  background: transparent; border: 1px solid transparent; border-radius: 9px; padding: 7px 9px; text-align: left;
}
.profile-btn:hover { background: var(--inset); }
.profile.open .profile-btn { background: var(--inset); border-color: var(--bd2); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: var(--segbg); border: 1px solid var(--segbd);
  font-family: var(--f-body); font-size: 13px; font-weight: 600; color: var(--oncta);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.profile-name { font-family: var(--f-body); font-size: 13px; color: var(--tbody); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-login { font-family: var(--f-mono); font-size: 11px; color: var(--tfaint); }
.profile-caret { color: var(--tfaint); font-size: 10px; flex: none; transition: transform .15s; }
.profile.open .profile-caret { transform: rotate(180deg); }
.profile-menu {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 6px);
  background: var(--panel); border: 1px solid var(--bd3); border-radius: 10px; padding: 5px;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
.profile-menu[hidden] { display: none; }
.profile-item {
  display: flex; align-items: center; gap: 8px; width: 100%; cursor: pointer;
  background: transparent; border: none; border-radius: 7px; padding: 9px 10px;
  font-family: var(--f-body); font-size: 13px; color: var(--tbody); text-align: left;
}
.profile-item:hover { background: var(--inset); color: var(--red); }

.main { flex: 1; min-width: 0; background: var(--bg); padding: 26px 34px 90px; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; border-bottom: 1px dashed var(--bd2); padding-bottom: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.pagehead h1 { font-family: var(--f-display); font-size: 38px; color: var(--tbright); line-height: 1; margin: 0; font-weight: 600; }
.pagehead .note { font-family: var(--f-body); font-size: 15px; color: var(--tmut2); margin-top: 4px; max-width: 680px; }
.route-chip { font-family: var(--f-mono); font-size: 12px; color: var(--cyan); background: rgba(95,190,203,.08); border: 1px solid rgba(95,190,203,.28); padding: 5px 11px; border-radius: 7px; white-space: nowrap; }

/* ---------- Generic components ---------- */
.card { background: var(--panel); border: 1px solid var(--bd3); border-radius: 14px; padding: 18px; }
.card.tight { padding: 16px; }
.card-title { font-family: var(--f-display); font-size: 22px; color: var(--tbright); margin-bottom: 12px; }
.card-eyebrow { font-family: var(--f-body); font-size: 12px; letter-spacing: .08em; color: var(--tdim); text-transform: uppercase; margin-bottom: 10px; }
.mono { font-family: var(--f-mono); }
.display { font-family: var(--f-display); }
.muted { color: var(--tmut2); }
.dim { color: var(--tdim); }
.faint { color: var(--tfaint); }
.cyan { color: var(--cyan); }
.green { color: var(--green); }
.red { color: var(--red); }
.amber { color: var(--amber); }
.blue { color: var(--blue); }
.bright { color: var(--tbright); }
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.wrap { flex-wrap: wrap; }
.gap6 { gap: 6px; } .gap8 { gap: 8px; } .gap10 { gap: 10px; } .gap12 { gap: 12px; } .gap14 { gap: 14px; } .gap16 { gap: 16px; } .gap18 { gap: 18px; }
.between { justify-content: space-between; }
.center { justify-content: center; }
.mla { margin-left: auto; }
.grow { flex: 1; }
.note-line { font-family: var(--f-body); font-size: 13px; color: var(--cyan); }
.help { font-family: var(--f-body); font-size: 13px; color: var(--tmut2); }

.badge { display: inline-flex; align-items: center; gap: 6px; font-family: var(--f-mono); font-size: 12px; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.pill { font-family: var(--f-mono); font-size: 12px; padding: 4px 10px; border-radius: 7px; white-space: nowrap; }
.bar { height: 9px; background: var(--bd2); border-radius: 5px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--blue); }
.bar.low > i { background: repeating-linear-gradient(45deg, var(--amber), var(--amber) 5px, var(--amberdk) 5px, var(--amberdk) 10px); }

.btn { font-family: var(--f-body); font-size: 14px; cursor: pointer; border-radius: 8px; padding: 8px 14px; border: 1px solid var(--line); background: var(--inset); color: var(--oncta); }
.btn.cta { background: var(--ctabg); border-color: var(--ctabd); }
.btn.ghost { background: transparent; border: 1px dashed var(--bd3); color: var(--tmut2); }
.btn.disabled { opacity: .55; cursor: not-allowed; border-style: dashed; color: var(--tmut2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.metric { flex: 1; background: var(--inset); border: 1px solid var(--bd2); border-radius: 9px; padding: 12px; }
.metric .big { font-family: var(--f-mono); font-size: 26px; color: var(--tbright); }
.metric .lbl { font-family: var(--f-body); font-size: 13px; color: var(--tmut2); }

.grid { display: grid; gap: 16px; }
.funnel { display: flex; align-items: center; gap: 10px; }
.funnel .step { flex: 1; background: var(--inset); border: 1px solid var(--bd2); border-radius: 8px; padding: 10px 13px; }
.funnel .step .n { font-family: var(--f-mono); font-size: 22px; color: var(--tbody); }
.funnel .step .l { font-family: var(--f-body); font-size: 12px; color: var(--tmut2); }
.funnel .arr { font-family: var(--f-mono); color: var(--cyan); }

.dial { border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none; transform: rotate(45deg); border: 8px solid var(--blue); border-right-color: var(--bd2); }
.dial > div { transform: rotate(-45deg); text-align: center; }

.list-row { display: flex; align-items: center; gap: 13px; padding: 9px 0; border-top: 1px solid var(--bd1); }
.kv { font-family: var(--f-mono); font-size: 13px; }
.kv .k { color: var(--tdim); font-family: var(--f-body); }

/* tables */
.tbl { width: 100%; }
.tbl .thead, .tbl .trow { display: grid; align-items: center; }
.tbl .thead { background: var(--inset2); border-bottom: 1px solid var(--bd2); padding: 11px 16px; font-family: var(--f-body); font-size: 11px; letter-spacing: .06em; color: var(--tdim); text-transform: uppercase; }
.tbl .trow { padding: 12px 16px; border-bottom: 1px solid var(--bd1); font-family: var(--f-mono); font-size: 12.5px; color: var(--tbody); }
.tbl .trow.click { cursor: pointer; }
.tbl .trow.click:hover { background: var(--inset); }
.tbl-wrap { overflow: auto; }

.skel { height: 10px; border-radius: 5px; background: var(--bd1); }
.skel.anim { background: linear-gradient(90deg, var(--bd1), var(--bd3), var(--bd1)); background-size: 200px 100%; animation: dashmove 1.2s linear infinite; }

/* modal (prompt editor) */
.modal-back { position: fixed; inset: 0; z-index: 80; background: rgba(5,7,10,.62); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal { background: var(--panel); border: 1px solid var(--bd3); border-radius: 14px; padding: 22px 24px; width: 780px; max-width: 100%; max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 24px 70px rgba(0,0,0,.5); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 4px; }
.modal-ta { flex: 1; min-height: 320px; resize: vertical; font-family: var(--f-mono); font-size: 13px; line-height: 1.55; color: var(--tbody); background: var(--inset); border: 1px solid var(--bd2); border-radius: 9px; padding: 14px; width: 100%; }
.modal-ta:focus { outline: none; border-color: var(--blue); }

.toast { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: flex; flex-direction: column; gap: 8px; }
.toast > div { font-family: var(--f-mono); font-size: 12px; padding: 10px 14px; border-radius: 9px; max-width: 360px; }
.toast .ok { color: var(--green); background: var(--ggreen); border: 1px solid rgba(115,192,136,.5); }
.toast .err { color: var(--red); background: rgba(224,116,110,.1); border: 1px solid rgba(224,116,110,.5); }

/* login */
.login-wrap { display: flex; justify-content: center; padding: 60px 20px; }
.login-card { width: 430px; max-width: 100%; }
.spin { width: 14px; height: 14px; border: 2px solid var(--blue); border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; }

.toggle { width: 46px; height: 25px; border-radius: 13px; background: var(--bd3); position: relative; cursor: pointer; flex: none; }
.toggle.on { background: var(--ctabd); }
.toggle > i { position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: var(--tmut2); transition: left .15s ease; }
.toggle.on > i { left: 24px; background: var(--oncta); }

.input { font-family: var(--f-mono); font-size: 15px; color: var(--oncta); background: var(--inset); border: 1px solid var(--ctabd); border-radius: 7px; padding: 7px 14px; text-align: right; width: 96px; }
.input:focus { outline: none; border-color: var(--blue); }
.tag { font-family: var(--f-mono); font-size: 13px; color: var(--tbody); background: var(--inset); border: 1px solid var(--bd3); border-radius: 7px; padding: 7px 12px; display: inline-flex; align-items: center; gap: 8px; }
.sec-input { font-family: var(--f-mono); font-size: 13px; color: var(--tbody); background: transparent; border: none; outline: none; width: 130px; padding: 0; }
.sec-input::placeholder { color: var(--tfaint); }

/* mobile chrome — hidden on desktop, surfaced by the media query below */
.topbar { display: none; }
.scrim { display: none; }

/* ---------- Mobile (≤860px): sidebar becomes an off-canvas drawer ---------- */
@media (max-width: 860px) {
  .topbar {
    display: flex; align-items: center; gap: 12px;
    position: sticky; top: 0; z-index: 40;
    margin: -20px -16px 18px; padding: 11px 16px;
    background: var(--sidebar); border-bottom: 1px solid var(--bd1);
  }
  .hamburger {
    display: flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; flex: none; cursor: pointer;
    background: var(--inset); border: 1px solid var(--bd3); border-radius: 9px;
    color: var(--tbody); font-size: 18px; line-height: 1;
  }
  .topbar-brand { font-family: var(--f-display); font-size: 22px; color: var(--tbright); line-height: 1; }

  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; z-index: 60;
    transform: translateX(-100%); transition: transform .24s ease;
    box-shadow: 0 0 40px rgba(0, 0, 0, .5);
  }
  .shell.nav-open .sidebar { transform: translateX(0); }

  .scrim {
    display: block; position: fixed; inset: 0; z-index: 55;
    background: rgba(0, 0, 0, .55); opacity: 0; pointer-events: none; transition: opacity .2s ease;
  }
  .shell.nav-open .scrim { opacity: 1; pointer-events: auto; }

  .main { padding: 20px 16px 60px; overflow-x: hidden; }
  .main .grid { grid-template-columns: 1fr !important; }
  .pagehead h1 { font-size: 30px; }
  .funnel { flex-wrap: wrap; }
}
