/* ------------------------------------------------------------------
   AI portfolio manager - console
   Editorial serif over terminal mono. Ink ground, gold signal.
   ------------------------------------------------------------------ */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@400;500;600&display=swap');

:root {
  --bg:        #0c0e0d;
  --panel:     #131716;
  --panel-2:   #181d1b;
  --line:      #242c29;
  --line-soft: #1b211f;
  --ink:       #e9e6df;
  --ink-dim:   #a8b0ac;
  --muted:     #6f7a75;
  --gold:      #d6a340;
  --gold-dim:  #6d5322;
  --pos:       #4fc9a3;
  --neg:       #e2695c;
  --warn:      #d9a441;
  --paper:     #171412;

  --serif: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  --sans:  'IBM Plex Sans', ui-sans-serif, system-ui, sans-serif;
  --mono:  'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --sidebar: 268px;
  --radius: 3px;
}

* { box-sizing: border-box; }

/* `display` on a class beats the hidden attribute, so state it explicitly. */
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* faint grain so the ground is not a flat fill */
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  opacity: .025;
  background-image: radial-gradient(circle at 1px 1px, #fff 1px, transparent 0);
  background-size: 3px 3px;
}

a { color: var(--gold); text-decoration: none; }
button { font-family: inherit; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.pos  { color: var(--pos); }
.neg  { color: var(--neg); }
.dim  { color: var(--muted); }

/* ---------------- shell ---------------- */

#app { display: flex; min-height: 100vh; position: relative; z-index: 1; }

aside {
  width: var(--sidebar); flex: 0 0 var(--sidebar);
  border-right: 1px solid var(--line);
  background: var(--panel);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}

.brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--line);
}
.brand .mark {
  font-family: var(--mono); font-size: 20px; font-weight: 600;
  color: var(--gold); letter-spacing: -.02em;
}
.brand .mark span { animation: blink 1.2s steps(2) infinite; }
@keyframes blink { 0%, 50% { opacity: 1 } 50.01%, 100% { opacity: 0 } }
.brand .title {
  font-family: var(--serif); font-size: 19px; line-height: 1.15;
  margin-top: 6px; color: var(--ink);
}
.brand .sub {
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); margin-top: 6px;
}

.rail { padding: 16px 0; overflow-y: auto; flex: 1; }
.rail-label {
  font-family: var(--mono); font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted);
  padding: 0 20px 8px;
}

.class-btn {
  display: block; width: 100%; text-align: left;
  background: none; border: 0; border-left: 2px solid transparent;
  padding: 9px 20px; cursor: pointer; color: var(--ink-dim);
  transition: background .12s, color .12s, border-color .12s;
}
.class-btn:hover { background: var(--panel-2); color: var(--ink); }
.class-btn.active {
  border-left-color: var(--gold); background: var(--panel-2); color: var(--ink);
}
.class-btn .row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.class-btn .name { font-size: 13.5px; font-weight: 500; }
.class-btn .count {
  font-family: var(--mono); font-size: 11px; color: var(--muted);
}
.class-btn.active .count { color: var(--gold); }
.class-btn .bar {
  height: 2px; margin-top: 7px; background: var(--line); border-radius: 2px; overflow: hidden;
}
.class-btn .bar i {
  display: block; height: 100%; background: var(--gold-dim);
  transition: width .4s cubic-bezier(.2,.8,.2,1);
}
.class-btn.active .bar i { background: var(--gold); }
.class-btn .proxy {
  font-family: var(--mono); font-size: 10px; color: var(--muted); margin-top: 4px;
}

.rail-sep { height: 1px; background: var(--line); margin: 16px 20px; }

.nav-btn {
  display: flex; width: 100%; justify-content: space-between; align-items: center;
  background: none; border: 0; border-left: 2px solid transparent;
  padding: 8px 20px; cursor: pointer; color: var(--ink-dim); font-size: 13px;
  transition: background .12s, color .12s;
}
.nav-btn:hover { background: var(--panel-2); color: var(--ink); }
.nav-btn.active { border-left-color: var(--gold); color: var(--ink); background: var(--panel-2); }
.pill {
  font-family: var(--mono); font-size: 10px; padding: 1px 6px; border-radius: 9px;
  background: var(--gold); color: #1a1206; font-weight: 600;
}
.pill.zero { background: var(--line); color: var(--muted); }

.rail-foot {
  border-top: 1px solid var(--line); padding: 12px 20px 16px;
  font-family: var(--mono); font-size: 10.5px; color: var(--muted); line-height: 1.6;
}
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px; }
.dot.ok   { background: var(--pos); box-shadow: 0 0 6px var(--pos); }
.dot.bad  { background: var(--neg); }
.dot.warn { background: var(--warn); }

/* ---------------- main ---------------- */

main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

header.top {
  border-bottom: 1px solid var(--line);
  padding: 13px 28px; display: flex; align-items: flex-end;
  gap: 36px; flex-wrap: wrap; background: var(--panel);
}
.kpi .k {
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 4px;
}
.kpi .v {
  font-family: var(--mono); font-size: 22px; font-weight: 500;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.kpi .v.small { font-size: 16px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }

.live {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
  display: flex; align-items: center;
}
.live .dot.ok { animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .25 } }

.btn {
  background: transparent; border: 1px solid var(--line); color: var(--ink-dim);
  padding: 7px 13px; border-radius: var(--radius); cursor: pointer;
  font-family: var(--mono); font-size: 11px; letter-spacing: .06em;
  text-transform: uppercase; transition: all .14s;
}
.btn:hover { border-color: var(--gold); color: var(--gold); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.gold { border-color: var(--gold); color: var(--gold); }
.btn.gold:hover { background: var(--gold); color: #171104; }
.btn.danger:hover { border-color: var(--neg); color: var(--neg); background: none; }

/* quote tape */
.tape {
  display: flex; gap: 0; border-bottom: 1px solid var(--line);
  background: var(--bg); overflow-x: auto; scrollbar-width: none;
}
.tape::-webkit-scrollbar { display: none; }
.tape .t {
  padding: 8px 16px; border-right: 1px solid var(--line-soft);
  font-family: var(--mono); font-size: 11.5px; white-space: nowrap;
  display: flex; gap: 8px; align-items: baseline; flex: 0 0 auto;
}
.tape .t .s { color: var(--ink-dim); }
.tape .t .p { font-variant-numeric: tabular-nums; }
.tape .t.up   { animation: flashUp .7s ease-out; }
.tape .t.down { animation: flashDown .7s ease-out; }
@keyframes flashUp   { from { background: rgba(79,201,163,.22) } to { background: transparent } }
@keyframes flashDown { from { background: rgba(226,105,92,.22) } to { background: transparent } }

.content { padding: 18px 28px 40px; flex: 1; }

/* ---------------- panels ---------------- */

.panel {
  border: 1px solid var(--line); background: var(--panel);
  border-radius: var(--radius); margin-bottom: 16px;
}
.panel > h2 {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted); font-weight: 500;
  margin: 0; padding: 11px 18px; border-bottom: 1px solid var(--line-soft);
  display: flex; justify-content: space-between; align-items: center;
}
.panel .body { padding: 14px 18px; }
.panel .body.flush { padding: 0; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); font-weight: 500;
  text-align: left; padding: 8px 18px; border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
td {
  padding: 9px 18px; border-bottom: 1px solid var(--line-soft);
  font-variant-numeric: tabular-nums;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--panel-2); }
th.r, td.r { text-align: right; }
td.sym { font-family: var(--mono); font-weight: 500; }

.tag {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .08em;
  text-transform: uppercase; padding: 2px 6px; border-radius: 2px;
  border: 1px solid var(--line); color: var(--muted);
}
.tag.open, .tag.increase { border-color: var(--pos); color: var(--pos); }
.tag.reduce, .tag.exit   { border-color: var(--neg); color: var(--neg); }
.tag.keep    { border-color: var(--line); color: var(--muted); }
.tag.blocked { border-color: var(--warn); color: var(--warn); }

/* proposals */
.prop {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel-2); padding: 16px 18px; margin-bottom: 12px;
}
.prop.blocked { border-left: 2px solid var(--warn); }
.prop.pending { border-left: 2px solid var(--gold); }
.prop.executed { border-left: 2px solid var(--pos); opacity: .72; }
.prop.rejected { border-left: 2px solid var(--neg); opacity: .55; }
.prop .head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.prop .head .sym { font-family: var(--mono); font-size: 16px; font-weight: 600; }
.prop .move {
  font-family: var(--mono); font-size: 12.5px; color: var(--ink-dim);
  margin-left: auto; font-variant-numeric: tabular-nums;
}
.prop .lines { margin-top: 12px; display: grid; gap: 8px; }
.prop .lines p { margin: 0; font-size: 13px; line-height: 1.55; color: var(--ink-dim); }
.prop .lines p b {
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); font-weight: 500;
  display: block; margin-bottom: 2px;
}
.prop .actions { margin-top: 14px; display: flex; gap: 8px; align-items: center; }
.prop .note {
  font-family: var(--mono); font-size: 11px; color: var(--warn); margin-top: 10px;
}

/* memo */
.memo { font-size: 14.5px; line-height: 1.68; color: var(--ink-dim); background: var(--paper); }
.memo .body { padding: 32px 38px; max-width: 860px; }
.memo h1 {
  font-family: var(--serif); font-size: 34px; font-weight: 400;
  color: var(--ink); margin: 0 0 4px; letter-spacing: -.01em;
}
.memo h2 {
  font-family: var(--serif); font-size: 23px; font-weight: 400; color: var(--ink);
  margin: 34px 0 12px; padding-top: 14px; border-top: 1px solid var(--line);
}
.memo h3 {
  font-family: var(--mono); font-size: 12px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--gold); margin: 22px 0 8px; font-weight: 500;
}
.memo p { margin: 0 0 12px; }
.memo ul { margin: 0 0 14px; padding-left: 18px; }
.memo li { margin-bottom: 5px; }
.memo table { margin: 12px 0 20px; font-size: 12.5px; }
.memo th, .memo td { padding: 7px 12px; }
.memo th:first-child, .memo td:first-child { padding-left: 0; }
.memo code {
  font-family: var(--mono); font-size: .9em; background: var(--panel-2);
  padding: 1px 5px; border-radius: 2px; color: var(--gold);
}
.memo strong { color: var(--ink); font-weight: 600; }

/* chart */
.spark { width: 100%; height: 132px; display: block; }

/* One data point is not a line. Collapse the panel to its header row rather
   than leaving a tall empty box above everything that matters. */
.curve-panel.collapsed .body { display: none; }
.curve-panel.collapsed > h2 { border-bottom: 0; }
.curve-panel > h2 .dim { font-family: var(--mono); text-transform: none; letter-spacing: 0; }
.legend {
  display: flex; gap: 18px; font-family: var(--mono); font-size: 10.5px;
  color: var(--muted); margin-top: 10px;
}
.legend i { display: inline-block; width: 14px; height: 2px; margin-right: 6px; vertical-align: middle; }

.empty {
  padding: 44px 18px; text-align: center; color: var(--muted);
  font-family: var(--mono); font-size: 12px; line-height: 1.8;
}

/* login */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.login {
  width: 100%; max-width: 340px; border: 1px solid var(--line);
  background: var(--panel); padding: 30px; border-radius: var(--radius);
}
.login .mark { font-family: var(--mono); font-size: 22px; color: var(--gold); font-weight: 600; }
.login h1 { font-family: var(--serif); font-size: 24px; font-weight: 400; margin: 10px 0 22px; }
.login input {
  width: 100%; background: var(--bg); border: 1px solid var(--line);
  color: var(--ink); padding: 11px 12px; border-radius: var(--radius);
  font-family: var(--mono); font-size: 13px; margin-bottom: 12px;
}
.login input:focus { outline: none; border-color: var(--gold); }
.login .err { color: var(--neg); font-family: var(--mono); font-size: 11.5px; min-height: 16px; }

.autopilot {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  padding: 6px 12px; border-radius: var(--radius); cursor: pointer;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em;
  display: flex; align-items: center; gap: 2px; transition: all .16s;
}
.autopilot:hover { border-color: var(--ink-dim); color: var(--ink-dim); }
.autopilot.armed {
  border-color: var(--pos); color: var(--pos);
  box-shadow: 0 0 0 1px rgba(79,201,163,.18) inset;
}
.autopilot.armed .dot { background: var(--pos); box-shadow: 0 0 6px var(--pos);
  animation: pulse 2s ease-in-out infinite; }

.banner {
  border: 1px solid var(--line); border-left: 2px solid var(--gold);
  background: var(--panel-2); padding: 11px 16px; border-radius: var(--radius);
  font-family: var(--mono); font-size: 11.5px; color: var(--ink-dim);
  margin-bottom: 16px; line-height: 1.6;
}
.banner.warn { border-left-color: var(--warn); }

.prop .headline {
  font-size: 13px; color: var(--ink); margin-top: 10px;
  padding-left: 10px; border-left: 2px solid var(--line);
}
.prop .headline a { color: var(--ink); }
.prop .headline a:hover { color: var(--gold); }
.prop .headline .meta {
  display: block; font-family: var(--mono); font-size: 10px;
  color: var(--muted); margin-top: 4px; text-transform: uppercase;
  letter-spacing: .08em;
}

.stat-row { display: flex; gap: 26px; flex-wrap: wrap; }
.stat-row .s .k {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 3px;
}
.stat-row .s .v {
  font-family: var(--mono); font-size: 15px; font-variant-numeric: tabular-nums;
}

.toast {
  position: fixed; bottom: 22px; right: 22px; z-index: 50;
  background: var(--panel); border: 1px solid var(--line);
  border-left: 2px solid var(--gold); padding: 13px 17px; border-radius: var(--radius);
  font-family: var(--mono); font-size: 12px; max-width: 420px;
  animation: slideIn .22s cubic-bezier(.2,.8,.2,1);
}
.toast.bad { border-left-color: var(--neg); }
.toast.good { border-left-color: var(--pos); }
@keyframes slideIn { from { transform: translateY(10px); opacity: 0 } to { transform: none; opacity: 1 } }

.disclaimer {
  font-family: var(--mono); font-size: 10.5px; color: var(--muted);
  text-align: center; padding: 8px 28px 0; line-height: 1.7;
}

@media (max-width: 900px) {
  #app { flex-direction: column; }
  aside { width: 100%; flex: none; height: auto; position: static; }
  .rail { display: flex; overflow-x: auto; padding: 10px 0; }
  .rail-label, .rail-sep, .rail-foot { display: none; }
  .class-btn { width: auto; flex: 0 0 auto; border-left: 0; border-bottom: 2px solid transparent; }
  .class-btn.active { border-left: 0; border-bottom-color: var(--gold); }
  .class-btn .bar { display: none; }
  header.top { padding: 14px 18px; gap: 22px; }
  .content { padding: 18px; }
  .memo .body { padding: 22px 20px; }
}
