/* ── Unchained Music · Partner Analytics ─────────────────────────────
   Studio-console identity. Dark-first, tokenized both ways.
   Accent (magenta) is brand/interactive only — never a data series. */

/* Unchained Music brand tokens (from unchainedmusic.io):
   pink #e8097b · purple #760a8e · sea green #4caa91 · ghost white #f1f1f5
   ink #272727/#080808 · Poppins headings · Figtree body */
:root {
  color-scheme: dark;
  --page: #0a0a0c;
  --panel: #141417;
  --raised: #1c1c21;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.15);
  --ink: #f4f4f6;
  --ink-2: #a2a2ac;
  --ink-3: #6d6d78;
  --accent: #e8097b;        /* unchained pink */
  --accent-ink: #ffffff;
  --accent-soft: rgba(232, 9, 123, 0.14);
  --brand-purple: #760a8e;
  --good: #4caa91;          /* light sea green */
  --warn: #fab219;
  --grid: #232328;
  --s1: #3987e5;  /* series: blue   */
  --s2: #199e70;  /* series: aqua   */
  --s3: #c98500;  /* series: yellow */
  --s4: #9085e9;  /* series: violet */
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}
:root[data-theme="light"] {
  color-scheme: light;
  --page: #f1f1f5;          /* ghost white */
  --panel: #ffffff;
  --raised: #f4f4f7;
  --line: rgba(8, 8, 8, 0.09);
  --line-strong: rgba(8, 8, 8, 0.16);
  --ink: #272727;
  --ink-2: #5a5a64;
  --ink-3: #8e8e98;
  --accent: #cf0a6e;        /* pink, darkened for white ground */
  --accent-ink: #ffffff;
  --accent-soft: rgba(232, 9, 123, 0.09);
  --brand-purple: #760a8e;
  --good: #2e8a72;
  --warn: #8a6100;
  --grid: #e6e6ea;
  --s1: #2a78d6;
  --s2: #1baf7a;
  --s3: #eda100;
  --s4: #4a3aa7;
  --shadow: 0 10px 26px rgba(20, 24, 29, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--page);
  color: var(--ink);
  font: 15px/1.5 "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
}
.eyebrow, h1, h2, h3, .kpi-value, .rail-label, .pill, button, .duo .mini .big {
  font-family: "Poppins", "Figtree", system-ui, sans-serif;
}

/* ── Shell ── */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.rail {
  border-right: 1px solid var(--line);
  padding: 22px 18px;
  display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100vh;
}
.wordmark { display: flex; align-items: center; margin-bottom: 22px; }
.lockup { width: 100%; max-width: 178px; height: auto; display: block; }
:root:not([data-theme="light"]) .lockup { filter: invert(1); }
.rail-label {
  margin-top: 18px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--ink-3);
}
.rail nav { display: flex; flex-direction: column; gap: 2px; }
.rail-link {
  color: var(--ink-2); text-decoration: none; padding: 8px 10px; border-radius: 8px;
  font-size: 14px;
}
.rail-link:hover { background: var(--raised); color: var(--ink); }
.rail-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.rail-link .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--good); margin-right: 8px; }
.rail-empty { color: var(--ink-3); font-size: 13px; padding: 6px 10px; }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.rail-meta { color: var(--ink-3); font-size: 11.5px; line-height: 1.6; }

main { padding: 30px 38px 60px; max-width: 1180px; }

/* ── Common bits ── */
.eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 6px;
}
h1 { font-size: 26px; font-weight: 700; margin: 0 0 4px; text-wrap: balance; }
h2 { font-size: 15px; font-weight: 700; margin: 0; }
.sub { color: var(--ink-2); margin: 0 0 26px; max-width: 62ch; }
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow);
}
.kpi { transition: transform 0.18s ease, border-color 0.18s ease; }
.kpi:hover { transform: translateY(-3px); border-color: var(--line-strong); }
tbody tr { transition: background 0.12s; }
tbody tr:hover td { background: color-mix(in srgb, var(--ink) 3%, transparent); }
.panel-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 16px 20px 0;
}
.panel-head .hint { color: var(--ink-3); font-size: 12px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.05em;
  padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-strong);
  color: var(--ink-2); text-transform: uppercase;
}
.pill.live { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, transparent); }
.pill.brand { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); }
.pill.locked { color: var(--ink-3); }
.pill.sim { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }

/* Production-preview panels */
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; padding: 4px 14px 12px; }
.duo .mini h3 { font-size: 12px; font-weight: 600; color: var(--ink-2); margin: 8px 6px 2px; }
.duo .mini .big { font-size: 20px; font-weight: 700; margin: 0 6px 4px; }
.duo .mini .big small { font-size: 12px; font-weight: 500; color: var(--ink-3); font-family: system-ui; }
.duo svg { display: block; width: 100%; height: 170px; }
.geo-list { padding: 8px 0 14px; }
.geo-row { display: flex; align-items: center; gap: 12px; padding: 6px 20px; font-size: 13.5px; }
.geo-row .city { width: 128px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.geo-row .cc { color: var(--ink-3); font-size: 11px; margin-left: 5px; }
.geo-bar { flex: 1; height: 8px; border-radius: 4px; background: var(--raised); overflow: hidden; }
.geo-bar i { display: block; height: 100%; background: var(--s1); border-radius: 4px; }
.geo-val { width: 58px; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 12.5px; }
.impact-wrap { padding: 6px 14px 12px; }
.impact-wrap svg { display: block; width: 100%; height: 230px; }
.chg { font-size: 11px; font-weight: 700; letter-spacing: 0.05em; padding: 2px 8px; border-radius: 999px; }
.chg.added { color: var(--good); background: color-mix(in srgb, var(--good) 12%, transparent); }
.chg.up { color: var(--good); }
.chg.down { color: #e66767; }

button {
  font-size: 13.5px; font-weight: 600; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--raised); color: var(--ink);
  padding: 8px 14px;
}
button:hover { border-color: var(--ink-3); }
button.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
button.primary:hover { filter: brightness(1.08); }
.ghost-btn { background: transparent; border: 1px solid var(--line-strong); color: var(--ink-2); padding: 7px 12px; }
button:focus-visible, a:focus-visible, .switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Accounts table ── */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 700; padding: 14px 20px 10px; border-bottom: 1px solid var(--line);
}
td { padding: 14px 20px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.acct { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 38px; height: 38px; border-radius: 10px; object-fit: cover;
  background: var(--raised); border: 1px solid var(--line);
  display: grid; place-items: center; font-weight: 700; color: var(--ink-3); font-size: 15px;
}
.acct-name { font-weight: 600; }
.acct-mail { color: var(--ink-3); font-size: 12.5px; }
.map-state { font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.map-state .ok { color: var(--good); font-weight: 700; }

/* Toggle switch */
.switch { position: relative; display: inline-block; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch .track {
  display: block; width: 42px; height: 24px; border-radius: 999px;
  background: var(--raised); border: 1px solid var(--line-strong); transition: background 0.15s;
}
.switch .track::after {
  content: ""; position: absolute; top: 4px; left: 4px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--ink-3); transition: transform 0.15s, background 0.15s;
}
.switch input:checked + .track { background: var(--accent); border-color: transparent; }
.switch input:checked + .track::after { transform: translateX(18px); background: var(--accent-ink); }
.switch input:disabled + .track { opacity: 0.35; }

/* ── Drawer (artist mapping) ── */
.drawer-scrim { position: fixed; inset: 0; background: rgba(5, 7, 10, 0.55); }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 92vw);
  background: var(--panel); border-left: 1px solid var(--line); box-shadow: var(--shadow);
  padding: 26px 26px 30px; overflow-y: auto;
}
.drawer h2 { font-size: 19px; margin-bottom: 4px; }
.drawer .sub { margin-bottom: 18px; font-size: 13.5px; }
.search-row { display: flex; gap: 8px; margin-bottom: 8px; }
.search-row input {
  flex: 1; background: var(--raised); border: 1px solid var(--line-strong); border-radius: 9px;
  color: var(--ink); padding: 9px 12px; font: inherit;
}
.hint-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.hint-chips button { font-size: 12px; padding: 4px 10px; border-radius: 999px; color: var(--ink-2); }
.cand { display: flex; gap: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; align-items: center; }
.cand img { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; }
.cand .meta { flex: 1; min-width: 0; }
.cand .meta .nm { font-weight: 650; }
.cand .meta .dt { color: var(--ink-3); font-size: 12px; }
.stage { font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; background: var(--raised); color: var(--ink-2); }
.stage.superstar { color: var(--accent); background: var(--accent-soft); }
.drawer-note { font-size: 12.5px; color: var(--ink-3); border-top: 1px solid var(--line); padding-top: 14px; margin-top: 16px; line-height: 1.6; }

/* ── Dashboard ── */
.hero {
  display: flex; align-items: center; gap: 20px; margin-bottom: 20px;
  padding: 24px 26px; border-radius: 22px; border: 1px solid var(--line);
  background:
    radial-gradient(120% 180% at 0% 0%, hsl(var(--hero-h, 330) 55% 42% / 0.22), transparent 55%),
    radial-gradient(90% 140% at 100% 100%, hsl(calc(var(--hero-h, 330) + 60) 60% 45% / 0.10), transparent 60%),
    var(--panel);
  box-shadow: var(--shadow);
}
:root[data-theme="light"] .hero {
  background:
    radial-gradient(120% 180% at 0% 0%, hsl(var(--hero-h, 330) 60% 55% / 0.16), transparent 55%),
    radial-gradient(90% 140% at 100% 100%, hsl(calc(var(--hero-h, 330) + 60) 60% 55% / 0.08), transparent 60%),
    var(--panel);
}
.hero img { width: 78px; height: 78px; border-radius: 20px; object-fit: cover; border: 1px solid var(--line-strong); }
.hero .who { flex: 1; }
.hero .who .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.hero h1 { font-size: 29px; }
.hero .glow { color: var(--accent); }
.freshness { color: var(--ink-3); font-size: 12.5px; text-align: right; line-height: 1.6; }

/* Gradient identity avatars */
.avatar.grad { color: #fff; border: 0; font-weight: 700; }

/* Activity feed */
.feed { padding: 6px 0 12px; }
.feed-item { display: flex; align-items: center; gap: 14px; padding: 9px 20px; font-size: 14px; }
.feed-item + .feed-item { border-top: 1px solid var(--line); }
.feed-ico {
  width: 36px; height: 36px; border-radius: 12px; flex: none;
  display: grid; place-items: center; font-size: 16px;
}
.feed-text { flex: 1; line-height: 1.45; }
.feed-text b { font-weight: 650; }
.feed-when { color: var(--ink-3); font-size: 11.5px; white-space: nowrap; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }
.kpi { padding: 16px 18px 12px; }
.kpi .lbl { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); font-weight: 600; }
.kpi .lbl .sw { width: 9px; height: 9px; border-radius: 3px; }
.kpi-value { font-size: 31px; font-weight: 700; margin: 6px 0 2px; letter-spacing: -0.01em; }
.kpi .delta { font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.kpi .delta.up { color: var(--good); }
.kpi .delta.down { color: #e66767; }
.kpi svg { display: block; width: 100%; height: 34px; margin-top: 8px; }

.grid-main { display: grid; grid-template-columns: 1fr; gap: 14px; }
.chart-panel { padding: 0 0 8px; }
.chart-tools { display: flex; gap: 6px; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--line-strong); background: transparent; color: var(--ink-2);
  border-radius: 999px; padding: 4px 11px;
}
.chip .sw { width: 9px; height: 9px; border-radius: 3px; }
.chip.on { color: var(--ink); background: var(--raised); }
.chip.range.on { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); }
.chart-wrap { position: relative; padding: 6px 10px 2px; }
.chart-wrap svg { display: block; width: 100%; height: 300px; }
.tooltip {
  position: absolute; pointer-events: none; background: var(--raised);
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 9px 12px;
  font-size: 12.5px; box-shadow: var(--shadow); min-width: 172px; z-index: 5; display: none;
}
.tooltip .tt-date { color: var(--ink-3); font-size: 11.5px; margin-bottom: 5px; }
.tooltip .tt-row { display: flex; justify-content: space-between; gap: 14px; font-variant-numeric: tabular-nums; }
.tooltip .tt-row b { font-weight: 650; }
.tt-name { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.tt-name .sw { width: 8px; height: 8px; border-radius: 2px; }

.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.locked-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.locked { padding: 20px; color: var(--ink-3); font-size: 13.5px; line-height: 1.65; }
.locked h2 { color: var(--ink-2); display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.locked .lock { font-size: 14px; }
.foot-note { color: var(--ink-3); font-size: 12.5px; margin-top: 26px; max-width: 78ch; line-height: 1.7; }
.foot-note b { color: var(--ink-2); }

.empty, .loading { padding: 46px 20px; text-align: center; color: var(--ink-3); }
.spin {
  width: 22px; height: 22px; margin: 0 auto 12px; border-radius: 50%;
  border: 2px solid var(--line-strong); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }

/* ── 2026 pass: bento hierarchy, narrative insight, skeletons, motion ── */

/* Bento: one hero tile per KPI row, double width, dominant number */
.kpi.hero-tile { grid-column: span 2; padding: 20px 22px 14px; }
.kpi.hero-tile .kpi-value { font-size: 44px; letter-spacing: -0.02em; }
.kpi.hero-tile svg { height: 48px; }

/* Narrative insight — the analyst's one-liner, before any chart */
.insight {
  display: flex; gap: 12px; align-items: baseline;
  background: var(--accent-soft); border-left: 3px solid var(--accent);
  border-radius: 12px; padding: 13px 18px; margin-bottom: 16px;
  font-size: 14.5px; line-height: 1.55;
}
.insight b { font-weight: 650; }
.insight-mark { color: var(--accent); font-size: 15px; flex: none; }

/* Skeleton loading — shape of the page, not a spinner */
.sk {
  border-radius: 18px; background: var(--panel); position: relative; overflow: hidden;
  border: 1px solid var(--line);
}
.sk::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, color-mix(in srgb, var(--ink) 4%, transparent) 50%, transparent 70%);
  animation: shimmer 1.3s infinite;
}
.sk-hero { height: 126px; margin-bottom: 20px; border-radius: 22px; }
.sk-kpi { height: 150px; }
.sk-chart { height: 300px; margin-top: 14px; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* Staggered entrance — content settles in, top to bottom */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.panel, .hero, .insight { animation: rise 0.4s cubic-bezier(0.2, 0.7, 0.3, 1) backwards; }
.kpis .kpi:nth-child(2) { animation-delay: 0.05s; }
.kpis .kpi:nth-child(3) { animation-delay: 0.1s; }
.kpis .kpi:nth-child(4) { animation-delay: 0.15s; }
.insight { animation-delay: 0.03s; }

/* Track links + external playlist links */
.track-link { color: inherit; text-decoration: none; }
.track-link:hover { color: var(--accent); }

/* Placement impact stats row */
.impact-stats { display: flex; align-items: center; gap: 22px; padding: 16px 20px 6px; flex-wrap: wrap; }
.impact-stats > div { display: flex; flex-direction: column; gap: 2px; }
.is-label { font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.is-val { font-family: "Poppins", sans-serif; font-size: 24px; font-weight: 700; }
.is-val small { font-size: 12px; font-weight: 500; color: var(--ink-3); }
.is-arrow { color: var(--ink-3); font-size: 18px; }
.impact-events { margin-top: 6px; border-top: 1px solid var(--line); }
.method-note { color: var(--ink-3); font-size: 11.5px; line-height: 1.55; padding: 10px 20px 14px; margin: 0; }

/* Command palette (Ctrl/Cmd+K) */
.palette {
  position: fixed; top: 14vh; left: 50%; transform: translateX(-50%);
  width: min(520px, 92vw); background: var(--panel); border: 1px solid var(--line-strong);
  border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; z-index: 40;
  animation: rise 0.18s ease backwards;
}
.palette input {
  width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent;
  color: var(--ink); font: 16px "Figtree", system-ui, sans-serif; padding: 15px 18px; outline: none;
}
#pal-list { max-height: 320px; overflow-y: auto; padding: 6px; }
.pal-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px;
  border-radius: 10px; cursor: pointer; font-size: 14px;
}
.pal-item.sel, .pal-item:hover { background: var(--accent-soft); }
.pal-label { font-weight: 600; }
.pal-hint { margin-left: auto; color: var(--ink-3); font-size: 12px; }
.pal-foot { padding: 8px 16px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 11.5px; }

@media (prefers-reduced-motion: reduce) {
  .spin, .sk::after { animation: none; }
  .panel, .hero, .insight, .palette { animation: none; }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi.hero-tile { grid-column: span 2; }
  .cols-2, .locked-row { grid-template-columns: 1fr; }
  main { padding: 20px; }
}
