/* SOLUS — refined minimal trading terminal */

:root {
  /* base palette */
  --bg: #060910;
  --surface: #0c1220;
  --surface-2: #0f1628;
  --surface-3: #131c33;
  --border: #1e2d47;
  --border-soft: #182238;
  --border-strong: #2a3d5c;

  --text: #e6ecf6;
  --text-2: #93a2bd;
  --text-3: #5d6c87;
  --text-4: #3e4a63;

  /* accents — single hue family controlled by tweak */
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.12);
  --accent-line: rgba(59, 130, 246, 0.32);

  /* state */
  --gold: #fbbf24;
  --gold-soft: rgba(251, 191, 36, 0.12);
  --green: #10b981;
  --green-soft: rgba(16, 185, 129, 0.12);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.12);
  --purple: #8b5cf6;
  --purple-soft: rgba(139, 92, 246, 0.12);

  /* density */
  --row-h: 40px;
  --pad-card: 20px;
  --pad-section: 28px;
  --gap: 16px;

  /* type */
  --font-sans: "Geist", "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "Geist Mono", "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

[data-density="spacious"] {
  --row-h: 48px;
  --pad-card: 24px;
  --pad-section: 36px;
  --gap: 20px;
}
[data-density="dense"] {
  --row-h: 32px;
  --pad-card: 14px;
  --pad-section: 20px;
  --gap: 12px;
}

[data-accent="teal"] {
  --accent: #14b8a6;
  --accent-soft: rgba(20, 184, 166, 0.12);
  --accent-line: rgba(20, 184, 166, 0.32);
}
[data-accent="violet"] {
  --accent: #8b5cf6;
  --accent-soft: rgba(139, 92, 246, 0.12);
  --accent-line: rgba(139, 92, 246, 0.32);
}

[data-surface="glassy"] {
  --surface: rgba(20, 30, 55, 0.55);
  --surface-2: rgba(28, 40, 70, 0.55);
  --surface-3: rgba(36, 50, 85, 0.55);
}
[data-surface="bordered"] {
  --surface: #060910;
  --surface-2: #060910;
  --surface-3: #0a1020;
}

/* ━━━ Light theme ━━━ */
[data-theme="light"] {
  --bg: #f7f6f2;          /* warm paper */
  --surface: #ffffff;
  --surface-2: #f1efe9;
  --surface-3: #e7e4dc;
  --border: #d8d3c7;
  --border-soft: #e7e3d8;
  --border-strong: #c4beb0;

  --text: #16181d;
  --text-2: #555a66;
  --text-3: #8a8e98;
  --text-4: #b6b8be;

  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.10);
  --accent-line: rgba(37, 99, 235, 0.28);

  --gold: #b88600;
  --gold-soft: rgba(184, 134, 0, 0.10);
  --green: #047857;
  --green-soft: rgba(4, 120, 87, 0.10);
  --red: #c0271e;
  --red-soft: rgba(192, 39, 30, 0.10);
  --purple: #6d28d9;
  --purple-soft: rgba(109, 40, 217, 0.10);
}
[data-theme="light"][data-accent="teal"] {
  --accent: #0d8a7e;
  --accent-soft: rgba(13, 138, 126, 0.10);
  --accent-line: rgba(13, 138, 126, 0.28);
}
[data-theme="light"][data-accent="violet"] {
  --accent: #6d28d9;
  --accent-soft: rgba(109, 40, 217, 0.10);
  --accent-line: rgba(109, 40, 217, 0.28);
}
[data-theme="light"][data-surface="bordered"] {
  --surface: #f7f6f2;
  --surface-2: #f7f6f2;
  --surface-3: #efece4;
}
[data-theme="light"][data-surface="glassy"] {
  --surface: rgba(255, 255, 255, 0.65);
  --surface-2: rgba(255, 255, 255, 0.55);
  --surface-3: rgba(247, 246, 242, 0.55);
}
[data-theme="light"] [data-surface="glassy"] .card,
[data-theme="light"] [data-surface="glassy"] .card-flush {
  border-color: rgba(0,0,0,0.08);
}

/* Agent chip contrast — chips render as <span style={{ background: ${color}1a; color }}>.
   On light bg those tints work, but light hues (gold, cyan) need a darker text override. */
[data-theme="light"] .agent-chip[data-agent="chief"]   { color: #8a6300 !important; background: rgba(184, 134, 0, 0.12) !important; }
[data-theme="light"] .agent-chip[data-agent="pattern"] { color: #0c7a8c !important; background: rgba(12, 122, 140, 0.12) !important; }
[data-theme="light"] .agent-chip[data-agent="data"]    { color: #1d4ed8 !important; background: rgba(29, 78, 216, 0.10) !important; }
[data-theme="light"] .agent-chip[data-agent="trade"]   { color: #047857 !important; background: rgba(4, 120, 87, 0.10) !important; }
[data-theme="light"] .agent-chip[data-agent="risk"]    { color: #b91c1c !important; background: rgba(185, 28, 28, 0.10) !important; }
[data-theme="light"] .agent-chip[data-agent="exec"]    { color: #6d28d9 !important; background: rgba(109, 40, 217, 0.10) !important; }

/* Score badge (gold) needs darker ink on light */
[data-theme="light"] .score-tier-A { color: #8a6300 !important; }

/* Mode badge tinting on light */
[data-theme="light"] .mode-pill-auto { color: #8a6300 !important; background: rgba(184, 134, 0, 0.12) !important; }

/* Sidebar / topbar feel a touch softer in light */
[data-theme="light"] .sidebar { background: var(--surface-2); }
[data-theme="light"] .topbar { background: var(--surface-2); }

/* Toggle thumb — light mode uses surface; dark uses pure white */
[data-theme="light"] .toggle-thumb { background: #fff !important; box-shadow: 0 1px 2px rgba(0,0,0,0.15); }

/* In light mode, the "bordered" surface variant should still distinguish cards */
[data-theme="light"][data-surface="bordered"] .card,
[data-theme="light"][data-surface="bordered"] .card-flush {
  border-color: var(--border);
}

/* Subtle paper grain — only visible at small opacity */
[data-theme="light"] body {
  background:
    radial-gradient(ellipse at top, rgba(0,0,0,0.025), transparent 60%),
    var(--bg);
}

* { box-sizing: border-box; }

.solus {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-feature-settings: "ss01", "cv11";
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: var(--font-mono); font-feature-settings: "tnum"; letter-spacing: 0; }
.tnum { font-variant-numeric: tabular-nums; }

/* ━━━ Type scale ━━━ */
.t-eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 500;
}
.t-label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.t-value { font-family: var(--font-mono); font-size: 22px; font-weight: 500; letter-spacing: -0.01em; }
.t-value-lg { font-family: var(--font-mono); font-size: 32px; font-weight: 500; letter-spacing: -0.02em; }
.t-h { font-size: 15px; font-weight: 500; letter-spacing: -0.01em; }
.t-h-lg { font-size: 19px; font-weight: 500; letter-spacing: -0.015em; }
.t-body { font-size: 13px; color: var(--text-2); line-height: 1.5; }
.t-tiny { font-size: 11px; color: var(--text-3); }

/* ━━━ Surfaces ━━━ */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: var(--pad-card);
}
.card-flush {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  overflow: hidden;
}
[data-surface="glassy"] .card,
[data-surface="glassy"] .card-flush {
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border-color: rgba(255,255,255,0.06);
}
[data-surface="bordered"] .card,
[data-surface="bordered"] .card-flush {
  border-color: var(--border);
}

.divider { height: 1px; background: var(--border-soft); }
.divider-v { width: 1px; background: var(--border-soft); align-self: stretch; }

/* ━━━ Buttons ━━━ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 12px;
  font: 500 12.5px/1 var(--font-sans);
  letter-spacing: -0.005em;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-3); border-color: var(--border-strong); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { height: 26px; padding: 0 9px; font-size: 11.5px; border-radius: 6px; }
.btn-icon { width: 32px; padding: 0; justify-content: center; }

/* ━━━ Badges ━━━ */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px;
  font: 500 10.5px/1 var(--font-mono);
  letter-spacing: 0.06em; text-transform: uppercase;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
}
.badge-dot::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: currentColor;
}
.badge-green { background: var(--green-soft); color: var(--green); border-color: transparent; }
.badge-red { background: var(--red-soft); color: var(--red); border-color: transparent; }
.badge-gold { background: var(--gold-soft); color: var(--gold); border-color: transparent; }
.badge-purple { background: var(--purple-soft); color: var(--purple); border-color: transparent; }
.badge-accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* ━━━ Tables ━━━ */
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl thead th {
  text-align: left; font: 500 10.5px/1 var(--font-mono);
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3);
  padding: 12px 16px; border-bottom: 1px solid var(--border-soft);
  background: transparent;
}
.tbl tbody td {
  padding: 0 16px; height: var(--row-h);
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
  color: var(--text);
}
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl-num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.tbl-right { text-align: right; }

/* ━━━ Progress ━━━ */
.bar { height: 4px; background: var(--surface-3); border-radius: 99px; overflow: hidden; position: relative; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.bar-green > i { background: var(--green); }
.bar-gold > i { background: var(--gold); }
.bar-red > i { background: var(--red); }

/* ━━━ Status dot ━━━ */
.sd { display: inline-block; width: 7px; height: 7px; border-radius: 50%; position: relative; }
.sd::after {
  content: ""; position: absolute; inset: -3px;
  border-radius: 50%; border: 1px solid currentColor; opacity: 0.18;
}
.sd-green { background: var(--green); color: var(--green); }
.sd-amber { background: var(--gold); color: var(--gold); }
.sd-red { background: var(--red); color: var(--red); }
.sd-grey { background: var(--text-4); color: var(--text-4); }

/* ━━━ Brand mark ━━━ */
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font: 500 14px/1 var(--font-sans);
  letter-spacing: 0.08em;
}
.brand-glyph {
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
}
.brand-glyph svg { width: 100%; height: 100%; }

/* ━━━ Sidebar ━━━ */
.sidebar {
  width: 220px;
  background: var(--bg);
  border-right: 1px solid var(--border-soft);
  display: flex; flex-direction: column;
  padding: 22px 14px;
  flex-shrink: 0;
}
.sidebar-item {
  display: flex; align-items: center; gap: 11px;
  height: 34px; padding: 0 10px;
  border-radius: 7px;
  color: var(--text-2); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: background .15s, color .15s;
}
.sidebar-item:hover { background: var(--surface-2); color: var(--text); }
.sidebar-item.active { background: var(--surface-2); color: var(--text); }
.sidebar-item.active::before {
  content: ""; width: 2px; height: 14px; background: var(--accent);
  border-radius: 99px; margin-left: -10px; margin-right: 8px;
}
.sidebar-item .ic { width: 16px; height: 16px; opacity: .8; }

/* ━━━ Topbar ━━━ */
.topbar {
  height: 56px; padding: 0 28px;
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; gap: 18px;
  background: var(--bg);
}

/* ━━━ Mobile ━━━ */
.mobile-shell {
  width: 375px; height: 812px;
  background: var(--bg);
  display: flex; flex-direction: column;
  overflow: hidden;
  position: relative;
}
.mobile-status {
  height: 44px; padding: 0 24px 0 32px;
  display: flex; align-items: center; justify-content: space-between;
  font: 600 14px var(--font-sans);
}
.mobile-tabbar {
  height: 70px;
  border-top: 1px solid var(--border-soft);
  background: var(--bg);
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding-bottom: 14px;
}
.mobile-tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; color: var(--text-3); font-size: 9.5px; letter-spacing: 0.06em;
  text-transform: uppercase; font-family: var(--font-mono);
}
.mobile-tab.active { color: var(--text); }
.mobile-tab.active .ic { color: var(--accent); }

/* ━━━ Misc ━━━ */
.kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  font: 500 10px var(--font-mono);
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: 4px; color: var(--text-2);
}

.scrollY { overflow-y: auto; }
.scrollY::-webkit-scrollbar { width: 8px; height: 8px; }
.scrollY::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
.scrollY::-webkit-scrollbar-track { background: transparent; }

.up { color: var(--green); }
.dn { color: var(--red); }

/* simple sparkline path stroke */
.spark { stroke-width: 1.25; fill: none; }
