/* ==========================================================================
   PricerHub — foundation
   Direction: Bloomberg Terminal (data density, comparative tape) meets Stripe
   Dashboard (clarity, whitespace). Sidebar is always the dark "terminal"; the
   content area is Stripe-clean in light mode and goes full-terminal in dark mode.
   ========================================================================== */

@font-face {
  font-family: "InterVar";
  src: url("../fonts/inter-variable-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-sans: "InterVar", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;

  /* Content — light (Stripe) */
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --surface-3: #e9eef5;
  --border: #e4e9f0;
  --border-strong: #d3dae4;
  --text: #0f172a;
  --text-dim: #5b6675;
  --text-mute: #93a0b2;

  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eef3ff;
  --accent-border: #c9d9fb;

  --best: #10b981;
  --best-soft: #ecfdf5;
  --best-text: #047857;
  --best-border: #a7f3d0;

  --st-received: #10b981;
  --st-pending: #f59e0b;
  --st-timeout: #94a3b8;
  --st-error: #ef4444;

  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warn-soft: #fffbeb;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 30px -12px rgba(15, 23, 42, 0.25);

  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 14px;

  /* Sidebar — always the terminal (identical in both themes) */
  --sb-bg: #0b1120;
  --sb-surface: #131c30;
  --sb-border: #1e293b;
  --sb-text: #cbd5e1;
  --sb-text-dim: #64748b;
  --sb-active-bg: rgba(37, 99, 235, 0.16);
  --sb-active-text: #ffffff;
  --sb-accent: #3b82f6;

  --sidebar-w: 244px;
  --topbar-h: 60px;
}

[data-theme="dark"] {
  --bg: #0a0e16;
  --surface: #111827;
  --surface-2: #172033;
  --surface-3: #1e293b;
  --border: #222d40;
  --border-strong: #2c3a52;
  --text: #e6eaf2;
  --text-dim: #93a0b5;
  --text-mute: #5f6b7e;

  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-soft: rgba(59, 130, 246, 0.13);
  --accent-border: rgba(59, 130, 246, 0.32);

  --best: #10b981;
  --best-soft: rgba(16, 185, 129, 0.13);
  --best-text: #34d399;
  --best-border: rgba(16, 185, 129, 0.35);

  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.1);
  --warn-soft: rgba(245, 158, 11, 0.1);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px -12px rgba(0, 0, 0, 0.6);
}

/* --- reset ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv05" 1, "ss01" 1;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; }
.tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 20px; }
::-webkit-scrollbar-track { background: transparent; }

/* --- app shell ------------------------------------------------------------ */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sb-bg);
  border-right: 1px solid var(--sb-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.sb-brand {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid var(--sb-border);
  flex-shrink: 0;
}
.sb-logo {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), #22d3ee);
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 15px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 4px 12px rgba(37,99,235,0.4);
}
.sb-wordmark { color: #fff; font-weight: 700; font-size: 16px; letter-spacing: -0.02em; }
.sb-wordmark span { color: var(--sb-accent); }

.sb-scroll { flex: 1; overflow-y: auto; padding: 14px 12px; }
.sb-section-label {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--sb-text-dim);
  padding: 0 10px; margin: 6px 0 8px;
}
.sb-nav { display: flex; flex-direction: column; gap: 2px; }
.sb-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: 8px;
  color: var(--sb-text); font-weight: 500; font-size: 13.5px;
  transition: background 0.12s, color 0.12s;
}
.sb-link:hover { background: var(--sb-surface); color: #fff; }
.sb-link.active { background: var(--sb-active-bg); color: var(--sb-active-text); font-weight: 600; }
.sb-link.active .sb-icon { color: var(--sb-accent); }
.sb-icon { width: 18px; height: 18px; flex-shrink: 0; color: var(--sb-text-dim); }
.sb-link:hover .sb-icon { color: var(--sb-text); }
.sb-badge {
  margin-left: auto; font-size: 10px; font-weight: 700;
  background: var(--sb-surface); color: var(--sb-text);
  padding: 1px 7px; border-radius: 20px; font-variant-numeric: tabular-nums;
}

.sb-cta {
  margin: 6px 4px 2px; display: flex; align-items: center; justify-content: center;
  gap: 8px; padding: 10px; border-radius: 9px; font-weight: 600; font-size: 13.5px;
  color: #fff; background: linear-gradient(180deg, var(--accent), var(--accent-hover));
  box-shadow: 0 4px 14px -3px rgba(37,99,235,0.5);
  transition: transform 0.1s, box-shadow 0.12s;
}
.sb-cta:hover { transform: translateY(-1px); box-shadow: 0 6px 18px -3px rgba(37,99,235,0.6); }

.sb-footer { border-top: 1px solid var(--sb-border); padding: 12px; flex-shrink: 0; }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 4px 6px; }
.sb-avatar {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 700; font-size: 12px;
  color: #fff; background: var(--sb-surface); border: 1px solid var(--sb-border);
}
.sb-user-meta { min-width: 0; flex: 1; }
.sb-user-name { color: #f1f5f9; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-role { color: var(--sb-text-dim); font-size: 11px; text-transform: capitalize; }
.sb-actions { display: flex; gap: 6px; margin-top: 10px; }
.sb-action {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px; border-radius: 7px; font-size: 12px; font-weight: 500;
  color: var(--sb-text); background: var(--sb-surface); border: 1px solid var(--sb-border);
  transition: background 0.12s, color 0.12s;
}
.sb-action:hover { background: #1c2740; color: #fff; }
.sb-action svg { width: 15px; height: 15px; }

/* --- main column ---------------------------------------------------------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); flex-shrink: 0;
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px;
}
.topbar-title { font-size: 16px; font-weight: 650; letter-spacing: -0.02em; }
.topbar-sub { color: var(--text-mute); font-size: 12.5px; }
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.hamburger { display: none; background: none; border: none; color: var(--text); padding: 6px; }
.hamburger svg { width: 22px; height: 22px; }

.content { padding: 24px; max-width: 1320px; width: 100%; margin: 0 auto; }
.content-narrow { max-width: 760px; }

.page-head { margin-bottom: 20px; }
.page-head h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.025em; }
.page-head p { color: var(--text-dim); margin-top: 4px; font-size: 13.5px; }

/* --- utilities ------------------------------------------------------------ */
.row { display: flex; }
.col { display: flex; flex-direction: column; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.text-dim { color: var(--text-dim); }
.text-mute { color: var(--text-mute); }
.text-best { color: var(--best-text); }
.text-danger { color: var(--danger); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.fs-12 { font-size: 12px; } .fs-13 { font-size: 13px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--text-mute);
}

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* --- overlay for mobile sidebar ------------------------------------------- */
.sb-overlay { display: none; }

@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0; transform: translateX(-100%);
    transition: transform 0.22s ease; box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sb-overlay.open {
    display: block; position: fixed; inset: 0; z-index: 39;
    background: rgba(2, 6, 23, 0.5); backdrop-filter: blur(1px);
  }
  .hamburger { display: inline-flex; }
  .content { padding: 16px; }
}

@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .topbar { padding: 0 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
