/* ─────────────────────────────────────────────────────────────────────────────
   Deep-violet neon dashboard.

   The six series hues are a fixed, validated set — worst adjacent CVD ΔE 8.8,
   worst normal-vision ΔE 21.7, all ≥3:1 on the #1E1640 card surface. Each one is
   pinned to a specific channel in app.js and never reassigned by rank, so a hue
   means the same thing in every panel on the page.

   The brighter --glow-* tints are decoration only — outer glows and gradient top
   stops. The validated hex is always what fills the mark.
   ───────────────────────────────────────────────────────────────────────────── */

:root {
  color-scheme: dark;

  --page: #100A24;
  --page-2: #17103a;
  --surface-1: #1E1640;
  --surface-2: #251c4d;
  --surface-3: #2e2360;

  --text-primary: #ffffff;
  --text-secondary: #c3bde0;
  --text-muted: #8a83ad;

  --grid: rgba(255, 255, 255, 0.07);
  --axis: rgba(255, 255, 255, 0.16);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --ghost: rgba(255, 255, 255, 0.05);

  /* Validated categorical slots, in validated order. */
  --s1: #EC4899;  /* magenta */
  --s2: #1BA04B;  /* lime    */
  --s3: #A855F7;  /* violet  */
  --s4: #BC8215;  /* amber   */
  --s5: #1A9AAB;  /* cyan    */
  --s6: #E0553D;  /* coral   */

  /* Decorative brighter stops for gradients and glows. */
  --g1: #ff6cb0;
  --g2: #2fd96c;
  --g3: #c78bff;
  --g4: #f0ae2a;
  --g5: #2fd3e6;
  --g6: #ff7a5e;

  --accent: #A855F7;
  --accent-2: #1A9AAB;

  --up: #2fd96c;
  --down: #ff6b6b;

  --radius: 18px;
  --radius-sm: 11px;
  --sidebar-w: 232px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 620px at 12% -8%, rgba(168, 85, 247, 0.22), transparent 60%),
    radial-gradient(900px 560px at 92% 4%, rgba(26, 154, 171, 0.16), transparent 62%),
    linear-gradient(168deg, var(--page) 0%, var(--page-2) 55%, var(--page) 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
a { color: inherit; }

/* ── Shell ──────────────────────────────────────────────────────────────── */

.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 6px;
  padding: 22px 16px;
  background: linear-gradient(180deg, rgba(30, 22, 64, 0.9), rgba(16, 10, 36, 0.75));
  border-right: 1px solid var(--border);
  backdrop-filter: blur(14px);
}

.logo { display: flex; align-items: center; gap: 11px; padding: 0 8px 22px; }
.logo-mark {
  width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0;
  background: linear-gradient(140deg, var(--g3), var(--s1));
  box-shadow: 0 0 18px rgba(168, 85, 247, 0.55);
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 13px;
}

/* The brand mark is a circular logo on white. Cropping it to a circle drops the
   JPEG's white corners, which would otherwise read as a white tile on violet.
   It is a detailed wordmark rather than an icon, so it needs real size to stay
   legible — 36px renders as an unreadable blob. */
img.logo-mark {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: #fff;
  object-fit: cover;
  padding: 0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18), 0 0 20px rgba(168, 85, 247, 0.4);
}
.logo b { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; display: block; }
.logo span { font-size: 11px; color: var(--text-muted); }

.nav-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-muted); padding: 16px 10px 8px;
}

.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 11px;
  font-size: 13.5px; font-weight: 500; color: var(--text-secondary);
  text-decoration: none; transition: background 0.14s, color 0.14s;
}
.nav a svg { width: 17px; height: 17px; opacity: 0.75; flex-shrink: 0; }
.nav a:hover { background: var(--ghost); color: var(--text-primary); }
.nav a.on {
  color: #fff;
  background: linear-gradient(90deg, rgba(168, 85, 247, 0.32), rgba(168, 85, 247, 0.04));
  box-shadow: inset 2px 0 0 var(--g3);
}
.nav a.on svg { opacity: 1; }

.sidebar-foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--border); }
.sidebar-foot .who { font-size: 12px; color: var(--text-secondary); word-break: break-all; }
.sidebar-foot .sub { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

.content { min-width: 0; display: flex; flex-direction: column; }

/* ── Topbar ─────────────────────────────────────────────────────────────── */

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 16px 26px;
  background: rgba(16, 10, 36, 0.72);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.search-wrap { position: relative; flex: 1; max-width: 420px; }
.search-wrap svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--text-muted); pointer-events: none;
}
.search {
  width: 100%; font: inherit; font-size: 13px; color: var(--text-primary);
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 999px; padding: 10px 16px 10px 38px;
}
.search::placeholder { color: var(--text-muted); }
.search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.18); }

.topbar-spacer { flex: 1; }

.segmented {
  display: inline-flex; background: var(--surface-1);
  border: 1px solid var(--border); border-radius: 999px; padding: 3px; gap: 2px;
}
.segmented button {
  appearance: none; border: 0; background: transparent; font: inherit;
  font-size: 12.5px; font-weight: 500; color: var(--text-secondary);
  padding: 7px 15px; border-radius: 999px; cursor: pointer; transition: all 0.14s;
}
.segmented button:hover { color: #fff; background: var(--ghost); }
.segmented button[aria-pressed="true"] {
  color: #fff;
  background: linear-gradient(135deg, var(--g3), var(--s1));
  box-shadow: 0 0 16px rgba(168, 85, 247, 0.45);
}

.icon-btn, .btn {
  appearance: none; font: inherit; font-size: 12.5px; font-weight: 500;
  color: var(--text-secondary); background: var(--surface-1);
  border: 1px solid var(--border); border-radius: 999px;
  cursor: pointer; transition: all 0.14s; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}
.btn { padding: 9px 16px; }
.icon-btn { width: 38px; height: 38px; flex-shrink: 0; }
.icon-btn svg, .btn svg { width: 15px; height: 15px; }
.icon-btn:hover, .btn:hover { color: #fff; border-color: var(--border-strong); background: var(--surface-2); }

.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(140deg, var(--g5), var(--s3));
  display: grid; place-items: center; font-size: 13px; font-weight: 700; color: #fff;
  box-shadow: 0 0 14px rgba(26, 154, 171, 0.4);
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ── Main ───────────────────────────────────────────────────────────────── */

main { padding: 22px 26px 70px; display: grid; gap: 20px; }
main.is-loading { opacity: 0.5; transition: opacity 0.15s; pointer-events: none; }

.crumbs { font-size: 12px; color: var(--text-muted); letter-spacing: 0.03em; }
.crumbs b { color: var(--text-primary); font-weight: 600; }

.card {
  position: relative;
  background: linear-gradient(158deg, rgba(46, 35, 96, 0.62), rgba(30, 22, 64, 0.86));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  min-width: 0;
  box-shadow: 0 10px 34px rgba(8, 4, 22, 0.42);
}
/* A single hairline highlight along the top edge — the "glass" cue. */
.card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 1px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
}

/* wrap + nowrap title: in a narrow card the badge drops to its own line rather
   than colliding with a wrapped heading. */
.card-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; flex-wrap: wrap; }
.card-head h2 { font-size: 13.5px; white-space: nowrap; }
.card-head .hint {
  margin-left: auto; font-size: 10px; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--text-muted); background: var(--ghost);
  padding: 3px 9px; border-radius: 999px; white-space: nowrap; flex-shrink: 0;
}
.card-sub { margin: 0 0 16px; font-size: 12px; color: var(--text-muted); }

.grid-5 { display: grid; grid-template-columns: 1.25fr repeat(4, 1fr); gap: 20px; }
.grid-2-wide { display: grid; grid-template-columns: 1.35fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

@media (max-width: 1400px) { .grid-5 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 1150px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto; }
  .sidebar .nav-label, .sidebar-foot { display: none; }
  .nav { display: flex; gap: 4px; }
  .grid-2-wide, .grid-3 { grid-template-columns: 1fr; }
  .grid-5 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .grid-5 { grid-template-columns: 1fr; }
  main, .topbar { padding-left: 14px; padding-right: 14px; }
  .search-wrap { max-width: none; }
}

/* ── Figures ────────────────────────────────────────────────────────────── */

.hero-card { display: flex; flex-direction: column; justify-content: center; }
.hero-card .label { font-size: 12px; color: var(--text-secondary); }
.hero-card .value {
  font-size: 56px; font-weight: 700; line-height: 1.02; letter-spacing: -0.035em;
  margin: 8px 0 4px;
  background: linear-gradient(120deg, #fff 20%, var(--g3) 75%, var(--g5));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-card .caption { font-size: 11.5px; color: var(--text-muted); }

.delta {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 12px;
  font-size: 11.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  background: var(--ghost); width: fit-content;
}
.delta.up { color: var(--up); background: rgba(47, 217, 108, 0.13); }
.delta.down { color: var(--down); background: rgba(255, 107, 107, 0.13); }
.delta.flat { color: var(--text-muted); }

/* Radial gauge tile */
.gauge-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; }
.gauge-card .g-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.gauge-card .g-caption { font-size: 11px; color: var(--text-muted); line-height: 1.45; }
.gauge { position: relative; width: 132px; height: 132px; }
.gauge .g-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1px;
}
.gauge .g-value { font-size: 27px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.gauge .g-pct { font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ── Charts ─────────────────────────────────────────────────────────────── */

.chart-wrap { position: relative; }
.chart { width: 100%; display: block; overflow: visible; }

.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 14px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--text-secondary); }
.legend i { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }

.tooltip {
  position: absolute; z-index: 40; pointer-events: none;
  background: rgba(20, 13, 46, 0.97);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  padding: 9px 12px; font-size: 12px; color: #fff; white-space: nowrap;
  opacity: 0; transform: translate(-50%, -100%); transition: opacity 0.1s;
}
.tooltip.on { opacity: 1; }
.tooltip .t-label { color: var(--text-muted); display: block; margin-bottom: 2px; font-size: 11px; }
.tooltip .t-value { font-weight: 600; }

/* Heat grid */
.heat { display: grid; gap: 3px; }
.heat-row { display: grid; grid-template-columns: 42px 1fr; gap: 8px; align-items: center; }
.heat-row .h-label { font-size: 10.5px; color: var(--text-muted); text-align: right; font-variant-numeric: tabular-nums; }
.heat-cells { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; }
/* Height is set per-render from the row count — a 24h window has two rows and
   would otherwise leave the card mostly empty. */
.heat-cells i { display: block; border-radius: 3px; background: var(--ghost); }
.heat-axis { display: grid; grid-template-columns: 42px 1fr; gap: 8px; margin-top: 8px; }
.heat-axis .ticks { display: grid; grid-template-columns: repeat(24, 1fr); font-size: 9.5px; color: var(--text-muted); }
.heat-axis .ticks span { text-align: center; }
.heat-scale { display: flex; align-items: center; gap: 7px; margin-top: 14px; font-size: 11px; color: var(--text-muted); }
.heat-scale i { width: 15px; height: 9px; border-radius: 2px; display: block; }

/* ── Ranked list ────────────────────────────────────────────────────────── */

.ranked { display: grid; gap: 12px; }
.ranked-row { display: grid; grid-template-columns: auto 1fr auto; gap: 9px; align-items: center; }
.ranked-row .rr-dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.ranked-row .rr-name { font-size: 12.5px; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranked-row .rr-name.muted { color: var(--text-muted); font-style: italic; }
.ranked-row .rr-val { font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ranked-row .rr-pct { font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; margin-left: 6px; }
.ranked-row .rr-bar {
  grid-column: 1 / -1; height: 7px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.06); overflow: hidden;
}
.ranked-row .rr-bar > i { display: block; height: 100%; border-radius: 999px; }

.empty { color: var(--text-muted); font-size: 12.5px; padding: 22px 0; text-align: center; }

/* ── Activity feed ──────────────────────────────────────────────────────── */

.feed { display: grid; gap: 2px; max-height: 340px; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.feed-item { display: grid; grid-template-columns: auto 1fr auto; gap: 11px; align-items: start; padding: 10px 6px; border-radius: 10px; }
.feed-item:hover { background: var(--ghost); }
.feed-item .f-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
/* min-width:0 so the two lines actually stack and truncate inside the grid
   column instead of running together and overflowing the card. */
.feed-item .f-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.feed-item .f-name { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-item .f-meta { display: block; font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-item .f-time { font-size: 10.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── Mini meters row ────────────────────────────────────────────────────── */

.meters { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.meter-item { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 1; min-width: 82px; }
.meter-item .m-name { font-size: 10.5px; color: var(--text-secondary); text-align: center; line-height: 1.35; max-width: 96px; }
.meter-item .m-sub { font-size: 10px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ── Lead table ─────────────────────────────────────────────────────────── */

.table-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.meta { font-size: 11.5px; color: var(--text-muted); }
.meta strong { color: var(--text-secondary); font-weight: 600; }

.table-scroll { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead th {
  text-align: left; font-weight: 600; font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.09em; color: var(--text-muted);
  padding: 0 14px 11px 0; white-space: nowrap;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: #1a1338;
  cursor: pointer; user-select: none;
}
thead th:hover { color: var(--text-secondary); }
thead th .sort { opacity: 0.6; margin-left: 3px; }
tbody td { padding: 11px 14px 11px 0; border-bottom: 1px solid var(--border); vertical-align: top; color: var(--text-secondary); }
tbody tr:hover td { background: var(--ghost); }
tbody td.strong { color: var(--text-primary); font-weight: 500; }
tbody td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 500; padding: 3px 10px; border-radius: 999px;
  background: var(--ghost); color: var(--text-primary); white-space: nowrap;
}
.chip i { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

.cell-stack { display: flex; flex-direction: column; gap: 2px; }
.cell-stack small { color: var(--text-muted); font-size: 11px; }
.truncate { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }

.banner {
  padding: 13px 17px; border-radius: var(--radius-sm);
  background: rgba(255, 107, 107, 0.12);
  border: 1px solid rgba(255, 107, 107, 0.32);
  color: #fff; font-size: 12.5px;
}

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.24); }

/* ── Login ──────────────────────────────────────────────────────────────── */

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  background: linear-gradient(158deg, rgba(46, 35, 96, 0.68), rgba(30, 22, 64, 0.9));
  border: 1px solid var(--border); border-radius: 22px;
  box-shadow: 0 24px 60px rgba(6, 3, 18, 0.6);
  padding: 44px; max-width: 400px; width: 100%; text-align: center;
}
.login-card .logo-mark { width: 104px; height: 104px; border-radius: 50%; font-size: 16px; margin: 0 auto 24px; display: block; }
.login-card h1 { font-size: 21px; margin-bottom: 9px; }
.login-card p { color: var(--text-secondary); font-size: 13px; margin: 0 0 28px; }
.google-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 11px;
  width: 100%; padding: 12px 18px; font: inherit; font-size: 14px; font-weight: 600;
  color: #fff; background: linear-gradient(135deg, var(--g3), var(--s1));
  border: 0; border-radius: 12px; text-decoration: none; cursor: pointer;
  box-shadow: 0 8px 26px rgba(168, 85, 247, 0.4); transition: transform 0.14s, box-shadow 0.14s;
}
.google-btn:hover { transform: translateY(-1px); box-shadow: 0 12px 32px rgba(168, 85, 247, 0.55); }
.login-note { margin-top: 24px; font-size: 11.5px; color: var(--text-muted); }
