/* ==========================================================================
   MimikTrader — dashboard mockups (WHITE theme)
   Faithful static reproduction of the real app shell + design system.
   Tokens lifted from app/globals.css (.white [data-app-shell="dashboard"]).
   Built to Linear-grade fidelity. Mock data only.
   ========================================================================== */

:root, :host {
  /* surfaces */
  --background: #f5f6f8;
  --background-elevated: #ffffff;
  --background-panel: #ffffff;
  --background-muted: #eceff3;
  --card-bg: #ffffff;
  --card-hover: #f2f4f7;
  --card-border: rgba(15, 18, 24, 0.08);

  /* borders */
  --border: #e3e7ec;
  --border-strong: #d0d6de;

  /* text */
  --text-primary: #15181c;
  --text-secondary: #353b43;
  --text-tertiary: #5b6470;
  --text-quaternary: #828b97;
  --text-faint: #9aa3ae;

  /* brand / semantic */
  --primary: #2d3238;
  --primary-bright: #15181c;
  --primary-hover: #3a4047;
  --brand: #2d3238;
  --success: #1a7f4b;
  --warning: #b7791f;
  --danger: #c0392b;
  --profit: #1a7f4b;
  --loss: #c0392b;

  --green-soft: rgba(26, 127, 75, 0.12);
  --green-line: rgba(26, 127, 75, 0.40);
  --red-soft: rgba(192, 57, 43, 0.12);
  --amber-soft: rgba(183, 121, 31, 0.13);
  --info-soft: rgba(3, 105, 161, 0.12);
  --info: #0369a1;

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

  --sidebar-w: 240px;
  --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 { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-head {
  height: var(--header-h);
  display: flex; align-items: center; gap: 9px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
}
/* macOS-style 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: #c4cad2; 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: #fff; }
.logo-word { font-size: 15px; font-weight: 650; letter-spacing: -0.02em; color: var(--text-primary); }

.nav { flex: 1; overflow-y: auto; padding: 20px 12px; }
.nav-section + .nav-section { margin-top: 22px; }
.nav-label {
  font-size: 10px; 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;
  padding: 7px 10px; border-radius: 7px;
  font-size: 13px; color: var(--text-tertiary);
  transition: background-color .1s var(--ease), color .1s var(--ease);
  cursor: pointer;
}
.nav-item svg { width: 15px; height: 15px; 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; }
.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: rgba(255, 255, 255, 0.88);
  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: 22px; font-weight: 650; letter-spacing: -0.02em; 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: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.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(45, 50, 56, 0.10); 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: #fff; 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); }
.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: rgba(255,255,255,.85); border: 1px solid var(--border);
  padding: 4px 9px; border-radius: 999px; backdrop-filter: blur(6px);
}
