/* ==========================================================================
   MimikTrader — dashboard mockups (DARK theme)
   Faithful static reproduction of the real app shell + design system.
   Tokens lifted from app/globals.css :root (DARK theme — the app's real
   shipped default palette, not an invented one).
   Built to Linear-grade fidelity. Mock data only.
   Re-synced 2026-07-03 to the Linear-monochrome dark palette (lch() neutrals
   + white-on-black accent, teal removed on dark). Semantic P&L colors
   (--success/--warning/--danger/--profit/--loss) were left untouched —
   Tom's directive to keep P&L direction legible applies here too.
   ========================================================================== */

:root, :host {
  /* surfaces — RE-SYNCED 2026-08-31 to app/globals.css.
     These were lifted from the app on 2026-07-03 (637f8f8f), when the app's
     dark surfaces were lch(4.52% 0.3 272) and friends. 84161d9d ("lift dark
     theme tiles above page background", 2026-07-30) retuned the app to the
     neutral #121212 family and the mockup was never re-synced, so the landing
     page had been showing a palette the app no longer used. The whole point of
     this sheet is that the marketing mockups are the REAL app palette. */
  --background: #121212;
  --background-elevated: #222222;
  --background-panel: #1a1a1a;
  --background-muted: #1f1f1f;
  --card-bg: #1a1a1a;
  --card-hover: #222222;
  --card-border: rgba(255, 255, 255, 0.08);

  /* borders */
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.14);

  /* text */
  --text-primary: lch(100% 0 272);
  --text-secondary: lch(90.35% 1.15 272);
  --text-tertiary: lch(61.399% 1.15 272);
  --text-quaternary: lch(48% 1.15 272);
  --text-faint: lch(26% 1.15 272);

  /* brand / semantic — dark accent is now Linear-monochrome white-on-black
     (teal removed on dark, D18 Tom's override 2026-07-03). */
  --primary: lch(100% 0 272);
  --primary-bright: lch(100% 0 272);
  --primary-foreground: #121212; /* near-black text on the white primary — matches app/globals.css */
  --primary-hover: lch(90.35% 1.15 272);
  --brand: #ffffff;
  --success: #4a7c78;
  --warning: #8a7a5a;
  --danger: #da3633;
  --profit: #26a69a;
  --loss: #ef5350;

  --green-soft: rgba(0, 175, 121, 0.16);
  --green-line: rgba(0, 175, 121, 0.5);
  --red-soft: rgba(224, 104, 125, 0.16);
  --amber-soft: rgba(138, 122, 90, 0.18);
  --info-soft: rgba(255, 255, 255, 0.12);
  --info: lch(90.35% 1.15 272);

  --font-sans: var(--font-geist-sans, "Geist"), -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;

  --sidebar-w: 244px;
  --header-h: 56px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
:host, body {
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); }
.pos { color: var(--profit); }
.neg { color: var(--loss); }

/* ---------- App shell ---------- */
.app { background: #0a0a0a; display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: #0a0a0a;
  border-right: 0;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-head {
  height: 44px;
  display: flex; align-items: center; gap: 9px;
  padding: 0 16px;
  border-bottom: 0;
}
.sidebar-wordmark { height: 28px; width: auto; max-width: 100%; }
/* Legacy window chrome dots (replaces the logo) — frames the card as an app window. */
.win-dots { display: flex; align-items: center; gap: 8px; }
.win-dots span { width: 11px; height: 11px; border-radius: 50%; background: #3a4047; display: block; }
.logo-mark {
  width: 24px; height: 24px; border-radius: 7px;
  background: var(--primary-bright);
  display: grid; place-items: center; flex: none;
}
.logo-mark svg { width: 14px; height: 14px; color: var(--primary-foreground); }
.logo-word { font-size: 15px; font-weight: 650; letter-spacing: -0.02em; color: var(--text-primary); }

.nav { flex: 1; overflow-y: auto; padding: 12px; }
.nav-section + .nav-section { margin-top: 22px; }
.nav-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.09em; color: var(--text-quaternary);
  margin: 0 0 9px 10px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  min-height: 32px; padding: 4px 8px; border-radius: 6px;
  font-size: 15px; color: var(--text-tertiary);
  transition: background-color .1s var(--ease), color .1s var(--ease);
  cursor: pointer;
}
.nav-item svg { width: 16px; height: 16px; color: var(--text-quaternary); flex: none; }
.nav-item:hover { background: var(--card-hover); color: var(--text-secondary); }
.nav-item.active { background: var(--background-muted); color: var(--text-primary); font-weight: 550; }
.nav-item.active svg { color: var(--primary-bright); }

/* ---------- Main + header ---------- */
.main { display: flex; flex-direction: column; min-width: 0; margin: 8px 8px 8px 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--background); }
.topbar {
  height: var(--header-h);
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  padding: 0 24px;
  background: var(--background);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.theme-pill {
  display: flex; align-items: center; gap: 2px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--card-bg); padding: 2px;
}
.theme-pill button {
  width: 26px; height: 26px; border-radius: 999px; border: 0; background: transparent;
  display: grid; place-items: center; color: var(--text-quaternary); cursor: pointer;
}
.theme-pill button svg { width: 14px; height: 14px; }
.theme-pill button.active { background: var(--background-muted); color: var(--text-primary); }
.market-pill {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--card-bg); padding: 5px 12px;
  font-size: 11px; font-weight: 500; letter-spacing: 0.02em; color: var(--text-tertiary);
}
.dot { width: 6px; height: 6px; border-radius: 999px; flex: none; }
.dot.green { background: var(--success); }
.dot.amber { background: var(--warning); }
.dot.gray { background: var(--text-quaternary); }
.icon-btn {
  position: relative; width: 32px; height: 32px; border-radius: 8px; border: 0;
  background: transparent; color: var(--text-quaternary);
  display: grid; place-items: center; cursor: pointer;
}
.icon-btn:hover { background: var(--background-muted); color: var(--text-tertiary); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn .badge-dot { position: absolute; top: 5px; right: 6px; width: 7px; height: 7px; border-radius: 999px; background: var(--danger); }
.avatar {
  width: 28px; height: 28px; border-radius: 999px;
  background: var(--background-muted); color: var(--text-tertiary);
  display: grid; place-items: center; font-size: 10px; font-weight: 600;
  border: 1px solid var(--border);
}

/* Fluid full-width content — matches the real app (its dashboard grid has no
   max-width, just side padding). The old 1400px cap left a large empty gutter on
   the right of wide screens, squeezing every card. */
.content { padding: 32px 32px 64px; width: 100%; }

/* ---------- Page heading ---------- */
.page-head { margin-bottom: 32px; }
.page-actions { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-title { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; color: var(--text-primary); }
.page-sub { margin: 6px 0 0; font-size: 12px; color: var(--text-quaternary); }

/* ---------- Buttons / inline actions ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 12px; border-radius: 8px;
  font-size: 12px; font-weight: 500; cursor: pointer;
  color: var(--text-tertiary); background: var(--background-muted);
  border: 1px solid var(--border);
  transition: all .1s var(--ease);
}
.btn:hover { color: var(--text-primary); border-color: var(--border-strong); }
.btn svg { width: 13px; height: 13px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--primary-foreground); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); }
.link-action {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 500; color: var(--text-quaternary); cursor: pointer;
}
.link-action:hover { color: var(--text-secondary); }
.link-action svg { width: 12px; height: 12px; }

/* ---------- Stats strip ---------- */
.stats {
  display: flex; align-items: stretch;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--card-bg); overflow: hidden;
}
.stat { flex: 1; padding: 16px 20px; }
.stat + .stat { border-left: 1px solid var(--border); }
.stat-label { font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-quaternary); }
.stat-value { margin-top: 7px; font-size: 20px; font-weight: 650; letter-spacing: -0.02em; color: var(--text-primary); }
.stat-sub { margin-top: 5px; font-size: 10px; color: var(--text-quaternary); }
.stat-sub .syncing { color: var(--text-tertiary); font-weight: 500; }

/* ---------- Cards ---------- */
.card { border: 1px solid var(--border); border-radius: 10px; background: var(--card-bg); }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; }
.card-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.card-eyebrow { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-quaternary); }
.card-sub { font-size: 10px; color: var(--text-faint); margin-top: 2px; }
.card-body { padding: 6px 22px 18px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; align-items: center; gap: 2px; border-bottom: 1px solid var(--border); margin: 4px 0 22px; }
.tabs button {
  position: relative; padding: 8px 13px; font-size: 12px; font-weight: 500;
  color: var(--text-quaternary); background: transparent; border: 0; cursor: pointer;
  margin-bottom: -1px;
}
.tabs button:hover { color: var(--text-tertiary); }
.tabs button.active { color: var(--text-primary); }
.tabs button.active::after {
  content: ''; position: absolute; left: 9px; right: 9px; bottom: 0; height: 1.5px; background: var(--primary-bright);
}

/* ---------- Badges / chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: 999px; padding: 2px 9px;
  font-size: 10px; font-weight: 600; letter-spacing: 0.02em;
  border: 1px solid var(--card-border); background: var(--card-bg); color: var(--text-secondary);
}
.badge.success { color: var(--success); background: var(--green-soft); border-color: transparent; }
.badge.warning { color: var(--warning); background: var(--amber-soft); border-color: transparent; }
.badge.danger { color: var(--danger); background: var(--red-soft); border-color: transparent; }
.badge.info { color: var(--info); background: var(--info-soft); border-color: transparent; }
.role {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 5px;
  font-size: 9px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
}
.role.leader { background: rgba(255, 255, 255, 0.14); color: var(--primary-bright); }
.role.follower { background: var(--background-muted); color: var(--text-quaternary); }

/* status pill (connection) */
.status { display: inline-flex; align-items: center; gap: 5px; font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.status .dot { width: 5px; height: 5px; }
.status.ok { color: var(--success); }
.status.reauth { color: var(--warning); }
.status.error { color: var(--danger); }
.status.offline { color: var(--text-quaternary); }

/* toggle */
.toggle { width: 32px; height: 18px; border-radius: 999px; background: var(--border-strong); position: relative; cursor: pointer; border: 0; padding: 0; transition: background .12s var(--ease); }
.toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 999px; background: #c9d1d9; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .14s var(--ease); }
.toggle.on { background: var(--primary); }
.toggle.on::after { transform: translateX(14px); background: #8b949e; }
.toggle.sm { width: 28px; height: 16px; }
.toggle.sm::after { width: 12px; height: 12px; }
.toggle.sm.on::after { transform: translateX(12px); }

/* ---------- Tables ---------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl thead th {
  text-align: left; padding: 10px 14px; font-size: 9px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-quaternary);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tbl tbody td { padding: 12px 14px; font-size: 12px; color: var(--text-secondary); border-bottom: 1px solid var(--border); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--card-hover); }
.tbl .right { text-align: right; }
.tbl .center { text-align: center; }
.acct { font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--text-primary); display: inline-flex; align-items: center; gap: 6px; }
.acct svg { width: 11px; height: 11px; color: var(--brand); }
.muted { color: var(--text-quaternary); }
.pos-cell { font-family: var(--font-mono); font-size: 11px; }
.pos-cell .qty { color: var(--text-quaternary); margin-left: 4px; }

.grid-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 28px; }
.grid-cc { display: grid; grid-template-columns: 1fr 300px; gap: 28px; }

/* ---------- footer note ---------- */
.mock-note {
  position: fixed; bottom: 14px; right: 16px; z-index: 50;
  font-size: 10px; color: var(--text-quaternary);
  background: lch(7.22% 0.75 272 / 0.85); border: 1px solid var(--border);
  padding: 4px 9px; border-radius: 999px; backdrop-filter: blur(6px);
}


/* The embedded app is dark even when the marketing page uses light mode.
   Keep native scrolling discoverable without a white Windows scrollbar. */
:host, :root { color-scheme: dark; }
:host, * { scrollbar-width: thin; scrollbar-color: #3d3d3d #121212; }
:host::-webkit-scrollbar, *::-webkit-scrollbar { width: 6px; height: 6px; }
:host::-webkit-scrollbar-track, *::-webkit-scrollbar-track { background: #121212; }
:host::-webkit-scrollbar-thumb, *::-webkit-scrollbar-thumb { background: #3d3d3d; border-radius: 6px; }
:host::-webkit-scrollbar-thumb:hover, *::-webkit-scrollbar-thumb:hover { background: #565656; }
:host::-webkit-scrollbar-button, *::-webkit-scrollbar-button { display: none; }
