/* ==========================================================================
   Vantage — Revenue operations dashboard template
   Design tokens, shell, and component layer.
   Tailwind handles layout utilities; everything with an identity lives here.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-sans: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;

  --sidebar-w: 268px;
  --topbar-h: 68px;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 22px;

  /* Light mode ---------------------------------------------------------- */
  --bg: #f2f3fa;
  --sidebar-bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f8fd;
  --surface-3: #eceef8;
  --border: #e3e5f1;
  --border-strong: #cfd3e6;
  --text: #14162e;
  --text-2: #545977;
  --text-3: #8b90ac;

  --brand: #6d3ae0;
  --brand-hover: #5c2ecb;
  --brand-ink: #ffffff;
  --brand-2: #0e8fbe;
  --brand-soft: rgba(109, 58, 224, 0.09);
  --brand-line: rgba(109, 58, 224, 0.22);
  --ring: rgba(109, 58, 224, 0.4);

  --good: #157a4a;
  --good-soft: rgba(21, 122, 74, 0.1);
  --warn: #97620a;
  --warn-soft: rgba(151, 98, 10, 0.11);
  --bad: #bb1e46;
  --bad-soft: rgba(187, 30, 70, 0.1);
  --info: #1d5fb5;
  --info-soft: rgba(29, 95, 181, 0.1);

  /* Categorical chart series — validated for light surface #ffffff
     (all-pairs CVD ΔE 9.9 · normal-vision ΔE 15.6 · contrast ≥ 3:1) */
  --c1: #6d3ae0;
  --c2: #1d7fb5;
  --c3: #a27409;
  --c4: #1e9e74;
  --c5: #b3195c;
  --grid-line: rgba(20, 22, 46, 0.08);
  --axis-ink: #8b90ac;

  --shadow-sm: 0 1px 2px rgba(19, 22, 47, 0.05);
  --shadow-card: 0 1px 2px rgba(19, 22, 47, 0.04), 0 14px 34px -22px rgba(19, 22, 47, 0.35);
  --shadow-pop: 0 24px 60px -20px rgba(19, 22, 47, 0.28), 0 2px 8px rgba(19, 22, 47, 0.06);
  --aurora-1: rgba(109, 58, 224, 0.16);
  --aurora-2: rgba(14, 143, 190, 0.14);
  --scrim: rgba(16, 18, 40, 0.42);
}

.dark {
  --bg: #08091a;
  --sidebar-bg: #0c0e21;
  --surface: #12142a;
  --surface-2: #171a33;
  --surface-3: #1e2242;
  --border: #262a4a;
  --border-strong: #363b62;
  --text: #edeef8;
  --text-2: #a2a7c8;
  --text-3: #737996;

  --brand: #7c5cff;
  --brand-hover: #8f74ff;
  --brand-ink: #ffffff;
  --brand-2: #3ecfe8;
  --brand-soft: rgba(124, 92, 255, 0.16);
  --brand-line: rgba(124, 92, 255, 0.34);
  --ring: rgba(124, 92, 255, 0.55);

  --good: #3ecf8e;
  --good-soft: rgba(62, 207, 142, 0.14);
  --warn: #e8a33d;
  --warn-soft: rgba(232, 163, 61, 0.14);
  --bad: #ff6b8b;
  --bad-soft: rgba(255, 107, 139, 0.14);
  --info: #63b3ff;
  --info-soft: rgba(99, 179, 255, 0.14);

  /* Categorical chart series — validated for dark surface #12142a
     (all-pairs CVD ΔE 9.8 · normal-vision ΔE 18.2 · contrast ≥ 3:1) */
  --c1: #9e71fd;
  --c2: #0d76ad;
  --c3: #c8800d;
  --c4: #29a987;
  --c5: #c0326a;
  --grid-line: rgba(255, 255, 255, 0.07);
  --axis-ink: #737996;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 1px 1px rgba(0, 0, 0, 0.4), 0 18px 40px -26px rgba(0, 0, 0, 0.9);
  --shadow-pop: 0 28px 70px -24px rgba(0, 0, 0, 0.85), 0 2px 10px rgba(0, 0, 0, 0.5);
  --aurora-1: rgba(124, 92, 255, 0.3);
  --aurora-2: rgba(62, 207, 232, 0.18);
  --scrim: rgba(4, 5, 16, 0.66);
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */
* { border-color: var(--border); }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* `body` prefix keeps these ahead of Tailwind's preflight, which is injected
   after this stylesheet by the Play CDN. */
body h1, body h2, body h3, body h4, body h5 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}
body h1 { font-size: 24px; }
body h2 { font-size: 19px; }
body h3 { font-size: 16px; }
body h4 { font-size: 14.5px; }
body strong { font-weight: 700; }

::selection { background: var(--brand); color: #fff; }

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

a { color: inherit; text-decoration: none; }

/* Scrollbars ------------------------------------------------------------- */
.scroll-thin { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.scroll-thin::-webkit-scrollbar { width: 8px; height: 8px; }
.scroll-thin::-webkit-scrollbar-track { background: transparent; }
.scroll-thin::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
.scroll-thin::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }

/* --------------------------------------------------------------------------
   3. Type helpers
   -------------------------------------------------------------------------- */
.font-display { font-family: var(--font-display); }
.font-mono { font-family: var(--font-mono); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
}

.metric {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1;
}

.tnum { font-variant-numeric: tabular-nums; }

.muted { color: var(--text-2); }
.faint { color: var(--text-3); }

/* --------------------------------------------------------------------------
   4. App shell
   -------------------------------------------------------------------------- */
.app {
  min-height: 100vh;
  display: flex;
  position: relative;
  isolation: isolate;
}

/* One aurora bloom anchored top-left — the only decorative layer in the shell.
   (An overlaid grid was tried here and cut: two soft effects in the same
   corner read as noise.) */
.app::after {
  content: "";
  position: fixed;
  top: -18%;
  left: 6%;
  width: 62vw;
  height: 52vh;
  z-index: -1;
  background:
    radial-gradient(ellipse at 25% 35%, var(--aurora-1), transparent 62%),
    radial-gradient(ellipse at 72% 20%, var(--aurora-2), transparent 60%);
  filter: blur(46px);
  opacity: 0.9;
  pointer-events: none;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 60;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(16px) saturate(140%);
}

.page {
  flex: 1;
  width: 100%;
  max-width: 1560px;
  margin: 0 auto;
  padding: 26px 18px 8px;
}

@media (min-width: 768px) {
  .topbar { padding: 0 28px; }
  .page { padding: 32px 28px 10px; }
}

@media (max-width: 1023px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-pop); }
  .sidebar.is-open { transform: translateX(0); }
  .app-main { margin-left: 0; }
}

.sidebar-scrim {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: var(--scrim);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s;
}
.sidebar-scrim.is-open { opacity: 1; visibility: visible; }

/* --------------------------------------------------------------------------
   5. The rail — signature state marker
   Appears on the active nav item, the lead metric card, and section headers.
   Its brightness encodes state: hidden (idle) → 45% (hover) → full (active).
   -------------------------------------------------------------------------- */
.rail { position: relative; }
.rail::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) scaleY(0.35);
  width: 3px;
  height: 62%;
  border-radius: 0 99px 99px 0;
  background: linear-gradient(180deg, var(--brand), var(--brand-2));
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.rail:hover::before { opacity: 0.45; transform: translateY(-50%) scaleY(0.8); }
.rail.is-active::before { opacity: 1; transform: translateY(-50%) scaleY(1); }

/* The rail as a card marker — reserved for the one lead metric per page. */
.card-lead::after {
  content: "";
  position: absolute;
  left: 0;
  top: 20px;
  bottom: 20px;
  width: 3px;
  border-radius: 0 99px 99px 0;
  background: linear-gradient(180deg, var(--brand), var(--brand-2));
}

.rail-static::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  border-radius: 99px;
  background: linear-gradient(180deg, var(--brand), var(--brand-2));
}
.rail-static { position: relative; padding-left: 16px; }

/* --------------------------------------------------------------------------
   6. Navigation
   -------------------------------------------------------------------------- */
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, var(--brand), var(--brand-2));
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.04em;
  box-shadow: 0 6px 18px -8px var(--brand);
}

.nav-group-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 0 14px;
  margin: 20px 0 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 12px 9px 14px;
  margin-bottom: 1px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.18s ease, color 0.18s ease;
}
.nav-item svg { width: 17px; height: 17px; flex: none; stroke-width: 1.7; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.is-active { background: var(--brand-soft); color: var(--text); font-weight: 600; }
.nav-item.is-active svg { color: var(--brand); }
/* A group whose child page is open: the rail marks the branch, but no
   highlight — the highlight belongs to the page you are actually on. */
.nav-item.is-parent { color: var(--text); font-weight: 600; }
.nav-item.is-parent::before { opacity: 1; transform: translateY(-50%) scaleY(1); }

.nav-toggle-icon { transition: transform 0.25s ease; margin-left: auto; width: 14px; height: 14px; color: var(--text-3); }
.nav-item[aria-expanded="true"] .nav-toggle-icon { transform: rotate(180deg); }

.nav-sub {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-sub > div { overflow: hidden; }
.nav-sub.is-open { grid-template-rows: 1fr; }

.nav-sub-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px 7px 30px;
  margin-left: 13px;
  border-left: 1px solid var(--border);
  color: var(--text-3);
  font-size: 13px;
  transition: color 0.16s ease, border-color 0.16s ease;
}
.nav-sub-item:hover { color: var(--text); border-color: var(--border-strong); }
.nav-sub-item.is-active { color: var(--text); font-weight: 600; border-color: var(--brand); }

.nav-badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--surface-3);
  color: var(--text-2);
}
.nav-badge.is-new { background: var(--brand-soft); color: var(--brand); }

/* --------------------------------------------------------------------------
   7. Surfaces
   -------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  position: relative;
}
.card-pad { padding: 20px; }
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-family: var(--font-display); font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }

.panel {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.divider { height: 1px; background: var(--border); border: 0; }

/* --------------------------------------------------------------------------
   8. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 15px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; stroke-width: 1.9; flex: none; }

.btn-primary {
  background: linear-gradient(140deg, var(--brand), color-mix(in srgb, var(--brand) 62%, var(--brand-2)));
  color: var(--brand-ink);
  box-shadow: 0 8px 20px -12px var(--brand);
}
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 12px 26px -12px var(--brand); }

.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--text-3); }

.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-danger { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.btn-danger:hover { background: color-mix(in srgb, var(--bad) 18%, transparent); }

.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 14.5px; border-radius: 12px; }
.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn-block { width: 100%; }

/* --------------------------------------------------------------------------
   9. Forms
   -------------------------------------------------------------------------- */
.field-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}

.input,
.select,
.textarea {
  width: 100%;
  height: 40px;
  padding: 0 13px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13.5px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}
.textarea { height: auto; padding: 11px 13px; line-height: 1.6; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b90ac' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 15px;
}
.input-group { position: relative; }
.input-group .input { padding-left: 38px; }
.input-group > svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-3);
  pointer-events: none;
}

/* Toggle ------------------------------------------------------------------ */
.switch { position: relative; display: inline-flex; flex: none; width: 40px; height: 22px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 99px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  transition: background 0.2s ease, border-color 0.2s ease;
  pointer-events: none;
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 99px;
  background: var(--text-3);
  transition: transform 0.22s cubic-bezier(0.34, 1.35, 0.64, 1), background 0.2s ease;
}
.switch input:checked + .switch-track { background: var(--brand); border-color: var(--brand); }
.switch input:checked + .switch-track::after { transform: translateX(18px); background: #fff; }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px var(--ring); }

/* Checkbox ---------------------------------------------------------------- */
.checkbox {
  appearance: none;
  width: 17px;
  height: 17px;
  flex: none;
  border-radius: 5px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.checkbox:checked {
  background: var(--brand) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 11px no-repeat;
  border-color: var(--brand);
}

/* --------------------------------------------------------------------------
   10. Badges, pills, avatars
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--text-2);
  white-space: nowrap;
}
.badge svg { width: 12px; height: 12px; stroke-width: 2.2; }
.badge-good { background: var(--good-soft); color: var(--good); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-brand { background: var(--brand-soft); color: var(--brand); }
.badge-outline { background: transparent; border: 1px solid var(--border-strong); color: var(--text-2); }

.dot { width: 6px; height: 6px; border-radius: 99px; flex: none; background: currentColor; }

.delta { display: inline-flex; align-items: center; gap: 3px; font-family: var(--font-mono); font-size: 11.5px; font-weight: 500; }
.delta-up { color: var(--good); }
.delta-down { color: var(--bad); }
.delta svg { width: 12px; height: 12px; stroke-width: 2.4; }

.avatar {
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 99px;
  background: var(--surface-3);
  color: var(--text-2);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: -0.01em;
  overflow: hidden;
  user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 26px; height: 26px; font-size: 10.5px; }
.avatar-md { width: 34px; height: 34px; }
.avatar-lg { width: 44px; height: 44px; font-size: 15px; }
.avatar-xl { width: 76px; height: 76px; font-size: 24px; }

.avatar-stack { display: flex; }
.avatar-stack > * { margin-left: -8px; box-shadow: 0 0 0 2px var(--surface); }
.avatar-stack > *:first-child { margin-left: 0; }

/* --------------------------------------------------------------------------
   11. Tables
   -------------------------------------------------------------------------- */
.table-wrap { width: 100%; overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--surface-2);
}
table.data td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  vertical-align: middle;
}
table.data td.lead { color: var(--text); font-weight: 600; }
table.data tbody tr { transition: background 0.14s ease; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono); font-size: 12.5px; }

/* --------------------------------------------------------------------------
   12. Popovers & dropdowns
   -------------------------------------------------------------------------- */
.pop {
  position: absolute;
  z-index: 80;
  min-width: 216px;
  padding: 6px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-pop);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top right;
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s;
}
.pop.is-open { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }
.pop-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 9px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  text-align: left;
  transition: background 0.14s ease, color 0.14s ease;
}
.pop-item:hover { background: var(--surface-2); color: var(--text); }
.pop-item svg { width: 15px; height: 15px; stroke-width: 1.8; flex: none; }
.pop-sep { height: 1px; background: var(--border); margin: 5px 8px; }
.pop-label { padding: 8px 10px 4px; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-3); }

/* Segmented control ------------------------------------------------------- */
.segment {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.segment button {
  padding: 5px 11px;
  border-radius: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-3);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}
.segment button:hover { color: var(--text); }
.segment button.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* Tabs -------------------------------------------------------------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab {
  position: relative;
  padding: 11px 14px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-3);
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.16s ease;
}
.tab::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  opacity: 0;
  transition: opacity 0.18s ease;
}
.tab:hover { color: var(--text-2); }
.tab.is-active { color: var(--text); font-weight: 600; }
.tab.is-active::after { opacity: 1; }

/* Disclosure (FAQ, filter groups) ----------------------------------------- */
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary svg { transform: rotate(180deg); }
details > summary svg { transition: transform 0.22s ease; }

/* --------------------------------------------------------------------------
   13. Charts
   -------------------------------------------------------------------------- */
.chart { width: 100%; display: block; overflow: visible; }
.chart text { font-family: var(--font-mono); font-size: 10px; fill: var(--axis-ink); letter-spacing: 0.04em; }
.chart .grid line { stroke: var(--grid-line); stroke-width: 1; }
.chart .axis-line { stroke: var(--border); stroke-width: 1; }
.chart .mark { transition: opacity 0.16s ease; }
.chart .crosshair { stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 3 3; }

.chart-tip {
  position: absolute;
  z-index: 40;
  pointer-events: none;
  min-width: 130px;
  padding: 9px 11px;
  border-radius: 11px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-pop);
  font-size: 12px;
  opacity: 0;
  transform: translate(-50%, -100%) translateY(-10px);
  transition: opacity 0.12s ease;
}
.chart-tip.is-on { opacity: 1; }
.chart-tip .tip-head { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); margin-bottom: 6px; }
.chart-tip .tip-row { display: flex; align-items: center; gap: 7px; padding: 2px 0; color: var(--text-2); }
.chart-tip .tip-row b { margin-left: auto; font-family: var(--font-mono); font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; }
.chart-tip .tip-key { width: 8px; height: 8px; border-radius: 2px; flex: none; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.legend-key { width: 9px; height: 9px; border-radius: 3px; flex: none; }

.spark { display: block; overflow: visible; }

/* Progress bars ----------------------------------------------------------- */
.bar-track { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); }

/* --------------------------------------------------------------------------
   14. Kanban
   -------------------------------------------------------------------------- */
.kanban { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 8px; }
.kanban-col { flex: none; width: 300px; display: flex; flex-direction: column; gap: 10px; }
.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 13px;
  box-shadow: var(--shadow-sm);
  cursor: grab;
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}
.kanban-card:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow-card); }

/* --------------------------------------------------------------------------
   15. Auth layout
   -------------------------------------------------------------------------- */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  background: var(--bg);
}
@media (min-width: 1024px) { .auth { grid-template-columns: 1fr 1.05fr; } }

.auth-aside {
  display: none;
  position: relative;
  overflow: hidden;
  padding: 44px;
  background: linear-gradient(155deg, #14103a 0%, #0b0c22 55%, #08091a 100%);
  color: #edeef8;
}
@media (min-width: 1024px) { .auth-aside { display: flex; flex-direction: column; } }
.auth-aside::before {
  content: "";
  position: absolute;
  top: -20%;
  left: -10%;
  width: 90%;
  height: 70%;
  background: radial-gradient(ellipse at center, rgba(124, 92, 255, 0.55), transparent 65%),
              radial-gradient(ellipse at 80% 60%, rgba(62, 207, 232, 0.3), transparent 62%);
  filter: blur(52px);
}
.auth-aside::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 70% at 30% 30%, #000, transparent 75%);
}
.auth-aside > * { position: relative; z-index: 1; }

.auth-body { display: flex; flex-direction: column; padding: 26px 20px; }
@media (min-width: 640px) { .auth-body { padding: 34px 40px; } }

/* --------------------------------------------------------------------------
   16. Footer
   -------------------------------------------------------------------------- */
.site-footer {
  margin-top: 34px;
  border-top: 1px solid var(--border);
  padding: 22px 0 30px;
  font-size: 12.5px;
  color: var(--text-3);
}
.footer-credit { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.footer-credit .sep { color: var(--border-strong); }
.footer-studio {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.05em;
  color: var(--text-2);
}
.footer-studio a { color: var(--brand); font-weight: 500; }
.footer-studio a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* --------------------------------------------------------------------------
   17. Motion
   -------------------------------------------------------------------------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.rise { animation: rise 0.5s cubic-bezier(0.22, 0.9, 0.3, 1) both; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.82); }
}
.live-dot { animation: pulse-dot 2.4s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* Print ------------------------------------------------------------------- */
@media print {
  .sidebar, .topbar, .site-footer { display: none !important; }
  .app-main { margin-left: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}
