/* The Desk — trading-desk dark theme */
:root {
  --bg: #0a0d14;
  --bg-2: #0e121c;
  --panel: rgba(22, 27, 38, 0.72);
  --panel-solid: #161b26;
  --border: rgba(255, 255, 255, 0.07);
  --border-2: rgba(255, 255, 255, 0.12);
  --text: #eef2f8;
  --text-2: #aeb8c8;
  --text-3: #6b7689;
  --pos: #3ecf8e;
  --neg: #f0616d;
  --gold: #d8b04a;
  --accent: #5b8def;
  --accent-2: #52c8b0;
  --radius: 14px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 80% -10%, rgba(91, 141, 239, 0.12), transparent 60%),
    radial-gradient(900px 600px at -10% 100%, rgba(82, 200, 176, 0.08), transparent 55%),
    var(--bg);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---- layout ---- */
.app { display: grid; grid-template-columns: 244px 1fr; min-height: 100vh; }

.sidebar {
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  display: flex; flex-direction: column; gap: 22px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center; font-size: 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #07101e; font-weight: 800;
}
.brand-text { display: flex; flex-direction: column; }
.brand-text strong { font-size: 16px; letter-spacing: 0.2px; }
.brand-text span { font-size: 11px; color: var(--text-3); letter-spacing: 0.4px; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-link {
  padding: 10px 12px; border-radius: 10px; color: var(--text-2);
  cursor: pointer; font-size: 13.5px; font-weight: 500;
  transition: background 0.15s, color 0.15s; user-select: none;
}
.nav-link:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.nav-link.active { background: rgba(91, 141, 239, 0.16); color: #fff; }
.nav-link.manager-link { margin-top: 6px; color: var(--gold); }
.nav-link.manager-link.active { background: rgba(216, 176, 74, 0.16); }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.4px; }
.field select {
  background: var(--panel-solid); color: var(--text); border: 1px solid var(--border-2);
  border-radius: 9px; padding: 8px 10px; font-family: var(--sans); font-size: 13px;
}
.tiny-note { font-size: 10.5px; color: var(--text-3); line-height: 1.4; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
  backdrop-filter: blur(12px); background: rgba(10, 13, 20, 0.6);
}
.topbar h1 { font-size: 20px; font-weight: 650; letter-spacing: 0.2px; }
.view { padding: 24px 28px 60px; display: flex; flex-direction: column; gap: 18px; }

/* ---- banner ---- */
.banner {
  margin: 16px 28px -4px; padding: 11px 16px; border-radius: 12px;
  background: rgba(216, 176, 74, 0.1); border: 1px solid rgba(216, 176, 74, 0.28);
  color: #f0e4c4; font-size: 13px;
}
.banner .link { background: none; border: none; color: var(--gold); cursor: pointer; font: inherit; text-decoration: underline; }

/* ---- buttons ---- */
.btn {
  border: 1px solid var(--border-2); background: var(--panel-solid); color: var(--text);
  padding: 9px 15px; border-radius: 10px; cursor: pointer; font: 500 13px var(--sans);
  transition: transform 0.08s, background 0.15s, border-color 0.15s;
}
.btn:hover { background: #1d2433; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: linear-gradient(135deg, var(--accent), #4a7bdc); border-color: transparent; color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.tiny { padding: 4px 9px; font-size: 11px; border-radius: 8px; }
.btn.danger { color: var(--neg); border-color: rgba(240, 97, 109, 0.4); }

/* ---- stat cards ---- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat-grid.compact { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.stat {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; backdrop-filter: blur(8px);
}
.stat-label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font: 600 22px var(--mono); margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-value.big { font-size: 30px; }
.stat-sub { font-size: 12px; color: var(--text-2); margin-top: 4px; }

/* ---- panels ---- */
.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  backdrop-filter: blur(8px); overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 18px; border-bottom: 1px solid var(--border);
}
.panel-head h2 { font-size: 14px; font-weight: 600; letter-spacing: 0.3px; }
.panel-actions { display: flex; align-items: center; gap: 10px; }
.panel-body { padding: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.subhead { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-3); margin: 16px 0 8px; }
.source-tag { font: 500 11px var(--mono); color: var(--text-3); padding: 3px 8px; border: 1px solid var(--border-2); border-radius: 7px; }

/* ---- donuts / charts ---- */
.donut-row { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut { width: 200px; height: 200px; }
.dual-donut { display: flex; gap: 24px; justify-content: center; flex-wrap: wrap; }
.donut-cell { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.donut-cell .donut { width: 170px; height: 170px; }
.donut-cap { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.4px; }
canvas.line, canvas.drift { width: 100%; display: block; }
canvas.tall { height: 280px; }

.legend { list-style: none; display: flex; flex-direction: column; gap: 7px; flex: 1; min-width: 150px; }
.legend li { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.legend .dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend-label { color: var(--text-2); }
.legend-val { margin-left: auto; font-family: var(--mono); color: var(--text); }

/* ---- tables ---- */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; color: var(--text-3); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.data-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); }
.data-table tr:last-child td { border-bottom: none; }
.data-table .r { text-align: right; }
.data-table.tight td, .data-table.tight th { padding: 6px 8px; }
.data-table .muted { color: var(--text-3); }
.bar-cell { width: 90px; }
.minibar { display: inline-block; height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

/* ---- movers ---- */
.movers { list-style: none; display: flex; flex-direction: column; }
.movers li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 9px 4px; border-bottom: 1px solid var(--border); }
.movers li:last-child { border-bottom: none; }
.mover-sym { font: 600 13px var(--mono); }
.mover-name { color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mover-pl { font-family: var(--mono); font-weight: 600; }

/* ---- semantics ---- */
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.flat { color: var(--text-2); }
.muted { color: var(--text-3); }

/* ---- pills / badges ---- */
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; border: 1px solid var(--border-2); }
.pill.ok { color: var(--pos); border-color: rgba(62, 207, 142, 0.4); background: rgba(62, 207, 142, 0.08); }
.pill.warn { color: var(--neg); border-color: rgba(240, 97, 109, 0.4); background: rgba(240, 97, 109, 0.08); }
.pill.info { color: var(--accent); border-color: rgba(91, 141, 239, 0.4); background: rgba(91, 141, 239, 0.08); }
.pill.muted { color: var(--text-3); }
.action-badge { display: inline-block; padding: 2px 8px; border-radius: 7px; font: 700 10.5px var(--mono); letter-spacing: 0.5px; }
.action-badge.buy { color: var(--pos); background: rgba(62, 207, 142, 0.14); }
.action-badge.sell { color: var(--neg); background: rgba(240, 97, 109, 0.14); }
.action-badge.hold { color: var(--text-2); background: rgba(255, 255, 255, 0.06); }
.conviction { color: var(--gold); font-size: 11px; letter-spacing: 1px; }

/* ---- manager ---- */
.mgr-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.mgr-read { font-size: 14.5px; line-height: 1.55; color: var(--text); }
.mgr-memo { margin-top: 10px; color: var(--text-2); font-size: 13.5px; }
.mgr-memo p { margin: 4px 0; }
.rec-list { display: flex; flex-direction: column; gap: 10px; }
.rec { border: 1px solid var(--border); border-radius: 11px; padding: 12px 14px; background: rgba(255, 255, 255, 0.02); }
.rec-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rec-head .btn.tiny { margin-left: auto; }
.rec-why { color: var(--text-2); font-size: 13px; margin-top: 7px; }
.mgr-summary { display: flex; flex-direction: column; gap: 10px; }
.mgr-rec { display: flex; align-items: center; gap: 9px; font-size: 13px; flex-wrap: wrap; }
.mgr-rec-why { color: var(--text-3); }
.best-worst { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; font-size: 13px; }
.best-worst div { display: flex; gap: 8px; align-items: center; }
.thinking { display: flex; align-items: center; gap: 12px; color: var(--text-2); padding: 20px 0; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border-2); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- calendar ---- */
.cal { list-style: none; display: flex; flex-direction: column; }
.cal li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--border); align-items: center; }
.cal li:last-child { border-bottom: none; }
.cal-date { color: var(--text-3); font-size: 12px; }
.cal-amt { font-family: var(--mono); }

/* ---- misc ---- */
.empty { text-align: center; color: var(--text-3); padding: 26px 16px; font-size: 13.5px; line-height: 1.5; }
.empty-cta { margin-top: 14px; }
.disclaimer { font-size: 11.5px; color: var(--text-3); margin-top: 12px; line-height: 1.5; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--panel-solid); border: 1px solid var(--border-2); color: var(--text);
  padding: 11px 18px; border-radius: 11px; font-size: 13px; opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- responsive ---- */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto; flex-direction: row; flex-wrap: wrap;
    align-items: center; gap: 12px;
  }
  .nav { flex-direction: row; flex-wrap: wrap; flex: 1; }
  .sidebar-foot { flex-direction: row; align-items: center; margin: 0; width: 100%; }
  .sidebar-foot .field { flex: 1; }
  .tiny-note { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
  .view, .topbar { padding-left: 16px; padding-right: 16px; }
  .banner { margin: 12px 16px -4px; }
}
