/* Wavelength Analytics — dark, premium data-product surface.
   Signature: growth-green accent + waveform motif on deep ink. */

:root {
  --ink:        #0a0d13;
  --panel:      #10151f;
  --panel-2:    #141b28;
  --panel-hi:   #18202f;
  --line:       rgba(255,255,255,.07);
  --line-2:     rgba(255,255,255,.11);
  --text:       #e9edf5;
  --muted:      #8b94a7;
  --muted-2:    #626c80;

  --green:      #35e0a1;
  --green-dim:  #1f8f68;
  --blue:       #5b9dff;
  --amber:      #ffb454;
  --pink:       #ff6b9d;
  --cyan:       #34d6d6;
  --violet:     #a68bfa;
  --red:        #ff5f66;

  --grad-green: linear-gradient(135deg, #35e0a1, #16b98a);

  /* chart theming (read by cshell-charts.js) */
  --chart-text: #7f8a9d;
  --chart-grid: rgba(255,255,255,.06);
  --chart-tooltip-bg: #0c1119;
  --chart-tooltip-text: #eef2f8;
  --chart-c1: #35e0a1;
  --chart-c2: #5b9dff;
  --chart-c3: #ffb454;
  --chart-c4: #ff6b9d;
  --chart-c5: #34d6d6;
  --chart-c6: #a68bfa;

  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 20px;
  --sb: 248px;
  --font-ui: 'Inter', system-ui, sans-serif;
  --font-display: 'Schibsted Grotesk', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-ui);
  background: var(--ink);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before {
  /* faint radial glow behind the whole app */
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(900px 500px at 78% -8%, rgba(53,224,161,.10), transparent 60%),
    radial-gradient(700px 500px at 8% 108%, rgba(91,157,255,.07), transparent 55%);
}
.num { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; }
::selection { background: rgba(53,224,161,.28); }

/* ---------------- layout ---------------- */
.app { position: relative; z-index: 1; display: grid; grid-template-columns: var(--sb) 1fr; min-height: 100vh; }

/* ---------------- sidebar ---------------- */
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  padding: 22px 16px 18px;
  background: linear-gradient(180deg, #0c1017, #0a0d13);
  border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 0; margin-bottom: 26px; }
.brand-mark {
  width: 38px; height: 38px; display: grid; place-items: center; color: #05130d;
  background: var(--grad-green); border-radius: 11px;
  box-shadow: 0 6px 18px -6px rgba(53,224,161,.6);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 16.5px; letter-spacing: -.01em; }
.brand-sub { font-size: 11px; color: var(--muted-2); letter-spacing: .12em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--r-md);
  color: var(--muted); text-decoration: none; font-weight: 500; font-size: 14px;
  transition: background .15s, color .15s;
}
.nav-item .ico { width: 19px; height: 19px; fill: currentColor; opacity: .85; flex: none; }
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(53,224,161,.14), rgba(53,224,161,.04));
  color: #d7fff0;
  box-shadow: inset 2px 0 0 var(--green);
}
.nav-item.active .ico { opacity: 1; color: var(--green); }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.show-card {
  display: flex; align-items: center; gap: 11px; padding: 11px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md);
}
.show-avatar {
  width: 36px; height: 36px; border-radius: 9px; flex: none;
  display: grid; place-items: center; font-family: var(--font-display);
  font-weight: 700; font-size: 13px; color: #05130d; background: var(--grad-green);
}
.show-meta, .user-meta { display: flex; flex-direction: column; min-width: 0; }
.show-name { font-weight: 600; font-size: 13.5px; }
.show-tag, .user-tag { font-size: 11px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-row { display: flex; align-items: center; gap: 11px; padding: 4px 6px; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 12px; font-weight: 600; color: #cfe;
  background: linear-gradient(135deg, #26304a, #1a2233); border: 1px solid var(--line-2);
}
.user-name { font-weight: 550; font-size: 13px; }

/* ---------------- topbar ---------------- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 28px; flex-wrap: wrap;
  background: rgba(10,13,19,.78); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-lead { display: flex; align-items: center; gap: 12px; min-width: 0; }
.menu-btn { display: none; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 8px; }
.menu-btn:hover { color: var(--text); background: var(--panel); }
.page-heading h1 { font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.page-sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; }

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.range { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.range button {
  font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: .02em;
  color: var(--muted); background: none; border: 0; cursor: pointer;
  padding: 6px 12px; border-radius: 7px; transition: background .15s, color .15s;
}
.range button:hover { color: var(--text); }
.range button.active { background: var(--panel-hi); color: var(--green); box-shadow: 0 1px 0 rgba(0,0,0,.4); }

.show-switch { position: relative; }
.show-switch-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  padding: 7px 11px; border-radius: 10px; cursor: pointer; font-size: 13px; font-weight: 500;
  transition: border-color .15s, background .15s;
}
.show-switch-btn:hover { border-color: var(--line-2); background: var(--panel-2); }
.show-switch-btn .chev { color: var(--muted); }
.dot-live { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(53,224,161,.18); }
.show-menu {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 210px; z-index: 40;
  list-style: none; padding: 6px; background: var(--panel-2);
  border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 20px 50px -12px rgba(0,0,0,.7);
}
.show-menu li { padding: 9px 10px; border-radius: 8px; cursor: pointer; display: flex; flex-direction: column; }
.show-menu li:hover { background: var(--panel-hi); }
.show-menu li .sm-name { font-weight: 550; font-size: 13.5px; }
.show-menu li .sm-tag { font-size: 11px; color: var(--muted-2); }

.export-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--grad-green); color: #05130d; border: 0; cursor: pointer;
  font-weight: 600; font-size: 13px; padding: 8px 14px; border-radius: 10px;
  box-shadow: 0 6px 18px -8px rgba(53,224,161,.7); transition: transform .12s, filter .15s;
}
.export-btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.export-btn:active { transform: translateY(0); }

/* ---------------- content ---------------- */
.content { padding: 24px 28px 40px; display: flex; flex-direction: column; gap: 20px; }
.view { display: flex; flex-direction: column; gap: 20px; animation: rise .4s cubic-bezier(.2,.7,.3,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* grids */
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(4, 1fr); }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.split-2-1 { grid-template-columns: 2fr 1fr; }
.split-1-2 { grid-template-columns: 1fr 2fr; }

/* panels */
.panel {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 18px 20px; position: relative;
}
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-title { font-family: var(--font-display); font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.panel-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }
.eyebrow { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted-2); }
.panel-metric { font-family: var(--font-display); font-size: 20px; font-weight: 700; }

/* KPI cards */
.kpi {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 8px;
  position: relative; overflow: hidden;
}
.kpi::after {
  content: ''; position: absolute; right: -30px; top: -30px; width: 120px; height: 120px;
  background: radial-gradient(circle, var(--kpi-glow, rgba(53,224,161,.14)), transparent 70%);
  pointer-events: none;
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.kpi-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--panel-hi); border: 1px solid var(--line); }
.kpi-ico svg { width: 16px; height: 16px; }
.kpi-value { font-family: var(--font-display); font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.kpi-foot { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-family: var(--font-mono); font-weight: 500; font-size: 12px; padding: 2px 7px; border-radius: 20px; }
.delta.up { color: var(--green); background: rgba(53,224,161,.12); }
.delta.down { color: var(--red); background: rgba(255,95,102,.12); }
.delta svg { width: 12px; height: 12px; }
.kpi-note { color: var(--muted-2); font-size: 11.5px; }

/* chart container */
.chart { width: 100%; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; }

/* mini legend / stat rows */
.rowlist { display: flex; flex-direction: column; }
.rowlist-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.rowlist-item:last-child { border-bottom: 0; }
.rank { font-family: var(--font-mono); font-size: 12px; color: var(--muted-2); width: 18px; flex: none; }
.bar-track { flex: 1; height: 7px; background: rgba(255,255,255,.05); border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; background: var(--grad-green); }
.rl-name { font-weight: 500; font-size: 13px; min-width: 0; }
.rl-val { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); flex: none; }
.flag { width: 22px; height: 15px; border-radius: 3px; flex: none; box-shadow: 0 0 0 1px rgba(255,255,255,.08); object-fit: cover; }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; font-weight: 500; color: var(--muted-2); font-size: 11px;
  letter-spacing: .08em; text-transform: uppercase; padding: 8px 12px; white-space: nowrap;
  border-bottom: 1px solid var(--line); cursor: pointer; user-select: none;
}
table.data th.sortable:hover { color: var(--text); }
table.data th .arr { opacity: 0; margin-left: 4px; }
table.data th.sorted .arr { opacity: 1; color: var(--green); }
table.data th.num, table.data td.num { text-align: right; }
table.data td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: rgba(255,255,255,.025); }
.ep-cell { display: flex; align-items: center; gap: 12px; }
.ep-thumb {
  width: 40px; height: 40px; border-radius: 9px; flex: none; display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 11px; font-weight: 600; color: #05130d;
}
.ep-title { font-weight: 550; font-size: 13.5px; }
.ep-guest { font-size: 11.5px; color: var(--muted); }
.pill { font-size: 11px; font-weight: 500; padding: 3px 9px; border-radius: 20px; display: inline-block; text-transform: capitalize; }
.tag-growth { background: rgba(53,224,161,.12); color: var(--green); }
.tag-engineering { background: rgba(91,157,255,.12); color: var(--blue); }
.tag-design { background: rgba(255,107,157,.12); color: var(--pink); }
.tag-culture { background: rgba(255,180,84,.14); color: var(--amber); }
.tag-business { background: rgba(166,139,250,.14); color: var(--violet); }
.tag-writing, .tag-productivity, .tag-ai { background: rgba(52,214,214,.12); color: var(--cyan); }
.trend-up { color: var(--green); font-family: var(--font-mono); font-size: 12.5px; }
.trend-down { color: var(--red); font-family: var(--font-mono); font-size: 12.5px; }
.compl-cell { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.compl-track { width: 46px; height: 6px; border-radius: 4px; background: rgba(255,255,255,.06); overflow: hidden; }
.compl-fill { height: 100%; background: var(--grad-green); border-radius: 4px; }

/* donut layout with legend */
.donut-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.legend-list { display: flex; flex-direction: column; gap: 9px; width: 100%; }
.legend-row { display: flex; align-items: center; gap: 9px; font-size: 12.5px; }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.legend-name { flex: 1; color: var(--text); }
.legend-val { font-family: var(--font-mono); color: var(--muted); }

/* heatmap */
.heatmap { display: grid; grid-template-columns: 40px repeat(7, 1fr); gap: 4px; }
.hm-corner { }
.hm-col-h { font-family: var(--font-mono); font-size: 10px; color: var(--muted-2); text-align: center; padding-bottom: 2px; }
.hm-row-h { font-family: var(--font-mono); font-size: 10px; color: var(--muted-2); display: flex; align-items: center; }
.hm-cell { aspect-ratio: 1; border-radius: 5px; min-height: 22px; transition: transform .12s; }
.hm-cell:hover { transform: scale(1.08); outline: 1px solid var(--line-2); }

/* small stat trio inside panels */
.mini-stats { display: flex; gap: 20px; flex-wrap: wrap; }
.mini-stat .ms-val { font-family: var(--font-display); font-size: 19px; font-weight: 700; }
.mini-stat .ms-lab { font-size: 11.5px; color: var(--muted); }

/* section title outside panels */
.section-title { font-family: var(--font-display); font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: -.005em; margin-top: 4px; }

/* age bars */
.age-list { display: flex; flex-direction: column; gap: 12px; }
.age-row { display: grid; grid-template-columns: 52px 1fr 40px; align-items: center; gap: 10px; }
.age-band { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.age-pct { font-family: var(--font-mono); font-size: 12px; text-align: right; }

/* toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(24px);
  background: var(--panel-hi); border: 1px solid var(--line-2); color: var(--text);
  padding: 11px 18px; border-radius: 12px; font-size: 13px; font-weight: 500;
  box-shadow: 0 16px 40px -12px rgba(0,0,0,.7); opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s; z-index: 100; display: flex; align-items: center; gap: 9px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast .dot-live { flex: none; }

/* scrollbars */
.table-wrap::-webkit-scrollbar { height: 8px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; }

/* ---------------- responsive ---------------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .cols-3 { grid-template-columns: 1fr 1fr; }
  .split-2-1, .split-1-2, .cols-2 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  :root { --sb: 0px; }
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 60; width: 264px; left: 0; top: 0;
    transform: translateX(-100%); transition: transform .28s cubic-bezier(.2,.7,.3,1);
    box-shadow: 24px 0 60px -20px rgba(0,0,0,.7);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-btn { display: grid; place-items: center; }
  .scrim {
    position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 50; opacity: 0;
    pointer-events: none; transition: opacity .25s;
  }
  .scrim.show { opacity: 1; pointer-events: auto; }
}
@media (max-width: 640px) {
  .topbar { padding: 12px 16px; gap: 10px; }
  .content { padding: 18px 16px 36px; }
  .cols-3 { grid-template-columns: 1fr; }
  .page-heading h1 { font-size: 19px; }
  .page-sub { display: none; }
  .export-btn span, .export-btn { font-size: 12px; }
  .topbar-actions { gap: 8px; width: 100%; justify-content: space-between; }
  .kpi-value { font-size: 26px; }
}
@media (max-width: 460px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .show-switch { display: none; }
}

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