/* ==========================================================================
   Attention Grabba — styles
   Shell: open plane. One face (DM Sans), one accent (blue) spent on data.
   Every colour is a token; dark mode remaps the tokens, never the components.
   ========================================================================== */

:root {
  color-scheme: light;

  /* surfaces — a blue-grey studio ground, white panels */
  --ground: #f7f8fb;
  --surface: #ffffff;
  --raised: #f1f3f7;
  --active: #e8ebf1;

  /* lines, in three steps */
  --border: #e4e7ee;
  --rule: #eef0f4;
  --control: #cfd4de;

  /* text, every tier at 4.5:1 or better on --ground and --surface */
  --text: #16181f;
  --muted: #555a66;
  --faint: #676c78;

  /* actions */
  --primary: #16181f;
  --primary-hover: #2c303b;
  --on-primary: #ffffff;

  /* the one hue — on data, focus, and selection */
  --accent: #254ff5;
  --accent-ink: #1d40d6;
  --accent-soft: #e9eeff;
  --accent-track: #e7eaf2;
  --focus: #254ff5;

  /* status */
  --positive: #247b50;
  --notice-bg: #eef2ff;
  --notice-ink: #34407a;
  --notice-border: #dbe3ff;

  /* identity tints for people and releases (pale, never data) */
  --tint-1: #f2e7d8; --tint-1-ink: #6c5236;
  --tint-2: #e5e8f8; --tint-2-ink: #3d447a;
  --tint-3: #dff0e8; --tint-3-ink: #2c5b45;
  --tint-4: #f6e2e6; --tint-4-ink: #7a3443;

  --grid: #e3e6ed;
  --scrim: rgb(14 17 30 / 0.45);
  --float-shadow: 0 16px 48px rgb(14 17 30 / 0.16);

  /* shape and rhythm (4px base) */
  --radius-card: 8px;
  --radius-control: 6px;
  --radius-chip: 4px;
  --gap: 16px;
  --card-pad: 20px;
  --control-h: 36px;
  --sidebar-w: 240px;

  /* type — four sizes do the work */
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
  --font-art: "Barlow Condensed", Impact, sans-serif;
  --fs-title: 24px;
  --fs-section: 16px;
  --fs-body: 14px;
  --fs-small: 12px;
  --fs-kpi: 26px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #0e0e10;
  --surface: #161618;
  --raised: #1e1e21;
  --active: #26262a;
  --border: #2a2a2e;
  --rule: #222226;
  --control: #3f3f45;
  --text: #f4f4f5;
  --muted: #b4b4ba;
  --faint: #96969c;
  --primary: #f4f4f5;
  --primary-hover: #d9d9dd;
  --on-primary: #111113;
  --accent: #6f8cff;
  --accent-ink: #93a8ff;
  --accent-soft: #1d2340;
  --accent-track: #26262b;
  --focus: #93a8ff;
  --positive: #3fc07a;
  --notice-bg: #171b2c;
  --notice-ink: #b9c4f2;
  --notice-border: #262d4a;
  --tint-1: #33291d; --tint-1-ink: #e8cfae;
  --tint-2: #23263b; --tint-2-ink: #c3c8f2;
  --tint-3: #1b2e25; --tint-3-ink: #a8dcc2;
  --tint-4: #35212a; --tint-4-ink: #f0bccb;
  --grid: #2a2a2e;
  --scrim: rgb(0 0 0 / 0.6);
  --float-shadow: 0 16px 48px rgb(0 0 0 / 0.5);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ground: #0e0e10;
    --surface: #161618;
    --raised: #1e1e21;
    --active: #26262a;
    --border: #2a2a2e;
    --rule: #222226;
    --control: #3f3f45;
    --text: #f4f4f5;
    --muted: #b4b4ba;
    --faint: #96969c;
    --primary: #f4f4f5;
    --primary-hover: #d9d9dd;
    --on-primary: #111113;
    --accent: #6f8cff;
    --accent-ink: #93a8ff;
    --accent-soft: #1d2340;
    --accent-track: #26262b;
    --focus: #93a8ff;
    --positive: #3fc07a;
    --notice-bg: #171b2c;
    --notice-ink: #b9c4f2;
    --notice-border: #262d4a;
    --tint-1: #33291d; --tint-1-ink: #e8cfae;
    --tint-2: #23263b; --tint-2-ink: #c3c8f2;
    --tint-3: #1b2e25; --tint-3-ink: #a8dcc2;
    --tint-4: #35212a; --tint-4-ink: #f0bccb;
    --grid: #2a2a2e;
    --scrim: rgb(0 0 0 / 0.6);
    --float-shadow: 0 16px 48px rgb(0 0 0 / 0.5);
  }
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font: 400 var(--fs-body)/20px var(--font);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button, a { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

svg { width: 16px; height: 16px; display: block; stroke-width: 1.6; }
i { display: inline-flex; font-style: normal; flex-shrink: 0; }

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

.sr-only, .skip {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip:focus {
  clip: auto; width: auto; height: auto; top: 8px; left: 8px; z-index: 200;
  padding: 12px 16px; background: var(--surface); border-radius: var(--radius-control);
}
[hidden] { display: none !important; }

/* ---------- controls ---------- */

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--control-h); padding: 0 14px;
  border: 1px solid var(--control); border-radius: var(--radius-control);
  background: var(--surface); color: var(--text);
  font-size: var(--fs-body); font-weight: 500; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
.button:hover { background: var(--raised); border-color: var(--faint); }
.button:active { transform: translateY(1px); }
.button-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.button-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.button-small { height: 30px; font-size: var(--fs-small); }
.full { width: 100%; }

.icon-button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border: 0; border-radius: var(--radius-control);
  background: transparent; color: var(--muted);
  transition: background-color .15s, color .15s;
}
.icon-button:hover { background: var(--raised); color: var(--text); }

.chip {
  height: 28px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-chip);
  background: var(--surface); color: var(--muted); font-size: var(--fs-small);
  transition: border-color .15s, color .15s;
}
.chip:hover { border-color: var(--control); color: var(--text); }

/* ---------- shell: sidebar on the ground ---------- */

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 20;
  width: var(--sidebar-w);
  display: flex; flex-direction: column;
  padding: 28px 16px 20px;
  background: var(--ground);
  border-right: 1px solid var(--border);
}

.brand {
  white-space: nowrap;
  display: flex; align-items: center; gap: 10px; padding: 0 8px;
  font-size: var(--fs-section); font-weight: 700; letter-spacing: -0.01em;
}
.brand-mark { width: 26px; height: 26px; flex-shrink: 0; }
.brand-mark circle { fill: var(--accent); stroke: none; }
.brand-mark path { stroke: #fff; stroke-width: 2.6; stroke-linecap: round; fill: none; }

.workspace {
  display: flex; align-items: center; gap: 10px;
  margin: 28px 0 0; padding: 8px;
  border-radius: var(--radius-card);
}
.workspace strong { display: block; font-weight: 600; }
.workspace small { display: block; color: var(--muted); font-size: var(--fs-small); line-height: 16px; }

.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 32px; height: 32px; border-radius: var(--radius-control);
  font-size: var(--fs-small); font-weight: 600;
}
.avatar-ws { background: var(--accent); color: #fff; }
.avatar.t1 { background: var(--tint-1); color: var(--tint-1-ink); }
.avatar.t2 { background: var(--tint-2); color: var(--tint-2-ink); }
.avatar.t3 { background: var(--tint-3); color: var(--tint-3-ink); }
.avatar.t4 { background: var(--tint-4); color: var(--tint-4-ink); }

.nav-label { margin: 32px 12px 8px; color: var(--muted); font-size: var(--fs-small); }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  height: 34px; padding: 0 12px; margin-bottom: 2px;
  border-radius: var(--radius-control);
  color: var(--muted); font-weight: 500;
  transition: background-color .15s, color .15s;
}
.nav-item:hover { background: var(--raised); color: var(--text); }
.nav-item.active { background: var(--active); color: var(--text); font-weight: 600; }
.nav-count {
  margin-left: auto; min-width: 20px; text-align: center;
  color: var(--muted); font-size: var(--fs-small); font-variant-numeric: tabular-nums;
}

.sidebar-bottom { margin-top: auto; display: grid; gap: 2px; }
.side-link {
  display: flex; align-items: center; gap: 10px;
  height: 34px; padding: 0 12px; border: 0; border-radius: var(--radius-control);
  background: none; color: var(--muted); text-align: left;
  transition: background-color .15s, color .15s;
}
.side-link:hover { background: var(--raised); color: var(--text); }

.mobile-bar, .tabbar { display: none; }

/* ---------- canvas ---------- */

main {
  margin-left: var(--sidebar-w);
  padding: 32px 40px 0;
  max-width: calc(1320px + var(--sidebar-w));
}

.title-row {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  margin-bottom: 20px;
}
h1 { font-size: var(--fs-title); line-height: 32px; font-weight: 650; letter-spacing: -0.02em; }
.lede { margin-top: 4px; color: var(--muted); font-size: var(--fs-section); line-height: 24px; }
.lede strong { color: var(--text); font-weight: 600; }

/* search + suggestions */
.scope-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }

#search-form {
  display: flex; align-items: center; gap: 8px; flex: 1 1 420px; max-width: 640px;
  height: 44px; padding: 0 4px 0 12px;
  background: var(--surface); border: 1px solid var(--control); border-radius: var(--radius-card);
  color: var(--faint);
  transition: border-color .15s;
}
#search-form:focus-within { border-color: var(--focus); outline: 2px solid var(--accent-soft); }
#search {
  flex: 1; min-width: 0; height: 100%;
  border: 0; outline: none; background: transparent; color: var(--text);
  font-size: var(--fs-body);
}
#search::placeholder { color: var(--faint); }
#search-form .button { height: 34px; }

.try-search { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: var(--fs-small); }
.try-search > span { margin-right: 2px; }

/* ---------- panels ---------- */

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

.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 18px var(--card-pad) 14px;
}
.panel-head h2, .rail-block h2, .insight h2 {
  font-size: var(--fs-section); line-height: 24px; font-weight: 600; letter-spacing: -0.01em;
}
.panel-head p { margin-top: 2px; color: var(--muted); font-size: var(--fs-small); line-height: 16px; }
.count { color: var(--muted); font-size: var(--fs-small); font-variant-numeric: tabular-nums; white-space: nowrap; padding-top: 4px; }

/* overview: main column + 340px rail */
.overview {
  display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px;
  align-items: start;
}
.overview-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); min-width: 0; }
.overview-rail { display: grid; gap: 24px; position: sticky; top: 32px; }
.rail-block h2 { margin-bottom: 8px; }
.rail-panel { padding: 8px var(--card-pad) var(--card-pad); }

/* KPIs: one container split by dividers */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); }
.kpi { padding: 16px var(--card-pad) 18px; min-width: 0; }
.kpi + .kpi { border-left: 1px solid var(--border); }
.kpi-label { color: var(--muted); font-size: var(--fs-body); }
.kpi-value {
  margin: 6px 0 4px; font-size: var(--fs-kpi); line-height: 32px; font-weight: 500;
  letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kpi-caption { color: var(--muted); font-size: var(--fs-small); line-height: 16px; }

/* ---------- the radar: mentions on platform lanes over 72 hours ---------- */

.radar { padding: 4px var(--card-pad) 16px; }
.lane {
  display: grid; grid-template-columns: 120px minmax(0, 1fr); align-items: center;
  height: 44px;
}
.lane-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--fs-small); }
.lane-label svg { width: 14px; height: 14px; }
.lane-track { position: relative; height: 100%; border-bottom: 1px dashed var(--grid); }
.lane:last-of-type .lane-track { border-bottom-style: solid; }
.lane-track::before { /* faint day lines */
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(to right, var(--grid) 1px, transparent 1px); /* taste-skill-ignore: chart gridlines */
  background-size: calc(100% / 3) 100%;
  opacity: .6;
}
.dot {
  position: absolute; top: 50%;
  width: var(--d); height: var(--d); margin: calc(var(--d) / -2) 0 0 calc(var(--d) / -2);
  padding: 0; border: 2px solid var(--surface); border-radius: 50%;
  background: var(--accent); opacity: .9;
  transition: transform .15s, opacity .15s;
}
.dot:hover, .dot:focus-visible { transform: scale(1.18); opacity: 1; z-index: 2; }
.dot.is-dim { background: var(--control); }
.dot.is-saved { outline: 2px solid var(--accent); outline-offset: 1px; }
.dot-tip {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  width: max-content; max-width: 220px; padding: 6px 10px;
  background: var(--primary); color: var(--on-primary); border-radius: var(--radius-control);
  font-size: var(--fs-small); line-height: 16px; text-align: left; white-space: normal;
  pointer-events: none; display: none;
}
.dot:hover .dot-tip, .dot:focus-visible .dot-tip { display: block; }
.dot.tip-start .dot-tip { left: 0; transform: none; }
.dot.tip-end .dot-tip { left: auto; right: 0; transform: none; }
.radar-axis {
  display: grid; grid-template-columns: 120px minmax(0, 1fr);
  margin-top: 8px; color: var(--muted); font-size: var(--fs-small);
}
.radar-axis > div { display: flex; justify-content: space-between; }

/* ---------- feed ---------- */

.filter-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px var(--card-pad);
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
}
.platform-filters { display: flex; flex-wrap: wrap; gap: 4px; }
.filter {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 10px;
  border: 0; border-radius: var(--radius-control);
  background: transparent; color: var(--muted); font-size: var(--fs-small); font-weight: 500;
  transition: background-color .15s, color .15s;
}
.filter svg { width: 14px; height: 14px; }
.filter:hover { background: var(--raised); color: var(--text); }
.filter[aria-pressed="true"] { background: var(--active); color: var(--text); }
.filter .num { color: var(--muted); }

.sort-label select {
  height: 30px; padding: 0 8px;
  border: 1px solid var(--border); border-radius: var(--radius-control);
  background-color: var(--surface); color: var(--text); font-size: var(--fs-small);
}

.mention {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) 32px; gap: 14px; align-items: start;
  padding: 16px var(--card-pad);
  border-bottom: 1px solid var(--rule);
}
.mention:last-child { border-bottom: 0; }

.cover {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; overflow: hidden; border-radius: var(--radius-chip);
  color: #fff;
}
.cover b {
  position: relative; z-index: 1;
  font: 700 15px/0.95 var(--font-art); text-align: center; letter-spacing: 0; transform: rotate(-6deg);
}
/* cover art: flat shapes, one per release */
.cover-a { background: #1d1238; }
.cover-a::after { content: ""; position: absolute; width: 44px; height: 44px; right: -14px; bottom: -14px; border-radius: 50%; background: #e2562e; }
.cover-b { background: #56695b; }
.cover-b::after { content: ""; position: absolute; width: 18px; height: 18px; left: 19px; top: 6px; border-radius: 50%; background: #c1949c; }
.cover-c { background: #1b4a3d; }
.cover-c::after { content: ""; position: absolute; width: 70px; height: 30px; left: -10px; bottom: -12px; border-radius: 50%; background: #79c08e; }
.cover-d { background: #e3913f; }
.cover-d::after { content: ""; position: absolute; inset: 30px 0 0; background: #4a223c; }
.cover-e { background: #2d3270; }
.cover-e::after { content: ""; position: absolute; width: 40px; height: 40px; left: -12px; top: -12px; border-radius: 50%; background: #b9a3db; }

.mention-meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px;
  margin-bottom: 4px; color: var(--muted); font-size: var(--fs-small); line-height: 16px;
}
.platform-tag { display: inline-flex; align-items: center; gap: 5px; }
.platform-tag svg { width: 13px; height: 13px; }
.mention-source { color: var(--text); font-weight: 500; }
.mention-title {
  display: block; padding: 0; margin: 0 0 4px; border: 0; background: none;
  text-align: left; font-size: var(--fs-section); line-height: 22px; font-weight: 600; letter-spacing: -0.01em;
}
.mention-title:hover { color: var(--accent-ink); }
.mention-excerpt {
  color: var(--muted); font-size: var(--fs-body); line-height: 20px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.mention-stats {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 14px;
  margin-top: 8px; color: var(--muted); font-size: var(--fs-small); font-variant-numeric: tabular-nums;
}
.mention-stats > span { display: inline-flex; align-items: center; gap: 4px; }
.mention-stats svg { width: 13px; height: 13px; }
.kind {
  height: 20px; padding: 0 7px; border-radius: var(--radius-chip);
  background: var(--raised); color: var(--muted); line-height: 20px;
}
.kind.is-song { background: var(--accent-soft); color: var(--accent-ink); }

.save-button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border: 0; border-radius: var(--radius-control);
  background: transparent; color: var(--faint);
  transition: background-color .15s, color .15s;
}
.save-button:hover { background: var(--raised); color: var(--text); }
.save-button[aria-pressed="true"] { color: var(--accent); }
.save-button[aria-pressed="true"] svg { fill: currentColor; }

.load-more {
  display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%;
  height: 44px; border: 0; border-top: 1px solid var(--rule);
  border-radius: 0 0 var(--radius-card) var(--radius-card);
  background: var(--surface); color: var(--muted); font-weight: 500;
  transition: background-color .15s, color .15s;
}
.load-more:hover { background: var(--raised); color: var(--text); }
.load-more svg { width: 14px; height: 14px; }

/* ---------- rail lists ---------- */

.row {
  display: flex; align-items: center; gap: 10px;
  min-height: 52px; border-bottom: 1px solid var(--rule);
}
.row:last-of-type { border-bottom: 0; margin-bottom: 12px; }
.row-text { min-width: 0; flex: 1; }
.row-name { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { color: var(--muted); font-size: var(--fs-small); line-height: 16px; }

.bar-row { padding: 10px 0; }
.bar-row + .bar-row { border-top: 1px solid var(--rule); }
.bar-head { display: flex; align-items: center; gap: 8px; }
.bar-head svg { width: 14px; height: 14px; color: var(--muted); }
.bar-head .bar-value { margin-left: auto; color: var(--muted); font-size: var(--fs-small); font-variant-numeric: tabular-nums; }
.bar-head .bar-value strong { color: var(--text); font-weight: 600; font-size: var(--fs-body); margin-right: 6px; }
.bar-track { height: 6px; margin-top: 8px; border-radius: 3px; background: var(--accent-track); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 3px; background: var(--accent); }

/* ---------- other screens ---------- */

.narrow { max-width: 880px; }

.notice {
  display: flex; align-items: center; gap: 10px; margin-bottom: 20px; padding: 12px 16px;
  background: var(--notice-bg); color: var(--notice-ink);
  border: 1px solid var(--notice-border); border-radius: var(--radius-card);
}

.watchlist-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.watch-tile { padding: var(--card-pad); display: flex; flex-direction: column; gap: 4px; }
.watch-tile .avatar { width: 40px; height: 40px; margin-bottom: 12px; font-size: var(--fs-body); }
.watch-tile h2 { font-size: var(--fs-section); line-height: 24px; overflow-wrap: anywhere; }
.watch-tile p { color: var(--muted); }
.watch-tile-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 16px; }
.watch-tile-actions .button:first-child { flex: 1; }

#insight-kpis { margin-bottom: var(--gap); }
.insights-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.insight { padding: 18px var(--card-pad) 10px; }
.insight h2 { margin-bottom: 4px; }

.empty-state { padding: 48px 24px; text-align: center; }
.empty-state h3 { font-size: var(--fs-section); line-height: 24px; }
.empty-state p { max-width: 380px; margin: 6px auto 16px; color: var(--muted); }

.page-footer {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-top: 48px; padding: 20px 0 28px;
  border-top: 1px solid var(--border);
  color: var(--muted); font-size: var(--fs-small);
}
.page-footer > span:first-child { color: var(--text); font-weight: 600; }

/* ---------- dialogs & toast (these float, so they get a shadow) ---------- */

dialog {
  width: 460px; max-width: calc(100% - 32px); padding: 24px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text);
  box-shadow: var(--float-shadow);
  overscroll-behavior: contain;
}
dialog::backdrop { background: var(--scrim); }
.dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 12px; }
.dialog-heading h2 { font-size: 20px; line-height: 28px; font-weight: 650; letter-spacing: -0.015em; }
dialog p { color: var(--muted); line-height: 22px; margin-bottom: 12px; }
dialog label { display: block; margin: 16px 0 6px; font-weight: 500; }
dialog input, dialog select {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid var(--control); border-radius: var(--radius-control);
  background-color: var(--surface); color: var(--text);
}
dialog input::placeholder { color: var(--faint); }
.dialog-note { margin: 16px 0 20px; font-size: var(--fs-small); line-height: 18px; }
dialog .full { margin-top: 8px; }
.detail-meta { display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; margin-bottom: 12px; color: var(--muted); font-size: var(--fs-small); }
.detail-cover { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.detail-cover .cover { width: 72px; height: 72px; }
.detail-cover .cover b { font-size: 19px; }
.detail-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 4px 0 16px; border: 1px solid var(--border); border-radius: var(--radius-card); }
.detail-stats > div { padding: 10px 12px; }
.detail-stats > div + div { border-left: 1px solid var(--border); }
.detail-stats span { display: block; color: var(--muted); font-size: var(--fs-small); }
.detail-stats strong { font-size: var(--fs-section); font-weight: 600; font-variant-numeric: tabular-nums; }

.toast {
  position: fixed; bottom: 24px; left: calc(50% + var(--sidebar-w) / 2); z-index: 100;
  display: flex; align-items: center; gap: 16px;
  max-width: calc(100vw - 32px); padding: 10px 12px 10px 16px;
  background: var(--primary); color: var(--on-primary); border-radius: var(--radius-card);
  box-shadow: var(--float-shadow);
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toast-action {
  height: 28px; padding: 0 10px; border: 0; border-radius: var(--radius-chip);
  background: transparent; color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px;
}
#toast-action:hover { background: rgb(255 255 255 / 0.12); }

/* ---------- responsive ---------- */

@media (max-width: 1200px) {
  .overview { grid-template-columns: minmax(0, 1fr); }
  .overview-rail { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
  .rail-block { display: flex; flex-direction: column; }
  .rail-block .rail-panel { flex: 1; }
  .watchlist-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 960px) {
  :root { --sidebar-w: 216px; }
  main { padding: 28px 24px 0; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi:nth-child(3) { border-left: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--border); }
}

@media (max-width: 760px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  main { margin-left: 0; padding: 72px 16px 96px; }

  .mobile-bar {
    position: fixed; inset: 0 0 auto; z-index: 30; height: 52px;
    display: flex; align-items: center; gap: 12px; padding: 0 8px 0 16px;
    background: var(--ground); border-bottom: 1px solid var(--border);
  }
  .mobile-bar .brand { padding: 0; }
  .mobile-bar strong { flex: 1; font-size: var(--fs-section); }

  .tabbar {
    position: fixed; inset: auto 0 0; z-index: 30;
    display: grid; grid-template-columns: repeat(4, 1fr);
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface); border-top: 1px solid var(--border);
  }
  .tab {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 10px 4px; color: var(--muted); font-size: var(--fs-small); font-weight: 500;
  }
  .tab svg { width: 20px; height: 20px; }
  .tab.active { color: var(--text); }
  .tab.active svg { color: var(--accent); }

  .title-row { align-items: flex-start; }
  .title-row .button:not(.button-primary) { padding: 0 10px; }
  .overview-rail { grid-template-columns: minmax(0, 1fr); }
  .lane { grid-template-columns: 34px minmax(0, 1fr); }
  .lane-label span { display: none; }
  .radar-axis { grid-template-columns: 34px minmax(0, 1fr); }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .platform-filters { flex-wrap: nowrap; overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
  .filter { flex-shrink: 0; }
  .mention { grid-template-columns: 48px minmax(0, 1fr) 32px; gap: 12px; padding: 14px 16px; }
  .cover { width: 48px; height: 48px; }
  .watchlist-grid, .insights-grid { grid-template-columns: minmax(0, 1fr); }
  .toast { bottom: 84px; }
  .page-footer { margin-top: 32px; }
}

@media (max-width: 480px) {
  .scope-row { gap: 10px; }
  #search-form { flex-basis: 100%; }
  .title-row .button span.label { display: none; }
}

@media (pointer: fine) { html { overscroll-behavior-y: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ==========================================================================
   Live search additions
   ========================================================================== */

.start { padding: 28px var(--card-pad); }
.start h2 { font-size: var(--fs-section); line-height: 24px; font-weight: 600; }
.start p { margin-top: 6px; max-width: 620px; color: var(--muted); }

.subject { padding: var(--card-pad); }
.subject-main { display: flex; align-items: center; gap: 16px; }
.subject-art { width: 72px; height: 72px; border-radius: var(--radius-card); object-fit: cover; flex-shrink: 0; font-size: var(--fs-section); }
.subject-text { min-width: 0; flex: 1; }
.subject-type { color: var(--muted); font-size: var(--fs-small); }
.subject-text h2 { font-size: 20px; line-height: 28px; font-weight: 650; letter-spacing: -0.015em; overflow-wrap: anywhere; }
.subject-text p { color: var(--muted); }
.subject-actions { display: flex; align-items: center; gap: 4px; }
.subject-actions .button[aria-pressed="true"] { color: var(--accent-ink); }
.subject-alts {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--rule);
  color: var(--muted); font-size: var(--fs-small);
}
.subject-alts > span { margin-right: 4px; }
.subject-alts .chip { height: auto; min-height: 28px; padding: 4px 10px; text-align: left; color: var(--text); }
.chip-sub { margin-left: 6px; color: var(--muted); }

.kpi-value.is-loading { color: var(--faint); }
.radar-empty { padding: 48px 0; text-align: center; color: var(--muted); }
.rail-empty { padding: 12px 0; }

img.cover { object-fit: cover; background: var(--raised); }
.avatar.cover { width: 56px; height: 56px; border-radius: var(--radius-chip); font-size: var(--fs-body); }
a.mention-title { display: block; }
a.mention-title:hover { text-decoration: underline; text-underline-offset: 3px; }
.bar-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.watch-art { object-fit: cover; margin-bottom: 12px; }
.insight-wide { grid-column: 1 / -1; }
.detail-title { font-size: 20px; line-height: 28px; margin-bottom: 8px; }
.detail-actions { display: flex; gap: 8px; margin-top: 8px; }
.detail-actions .button-primary { flex: 1; }

#overview[aria-busy="true"] .feed-panel, #overview[aria-busy="true"] .rail-panel { opacity: .6; }

@media (max-width: 760px) {
  .subject-main { flex-wrap: wrap; }
  .subject-art { width: 56px; height: 56px; }
  .subject-actions { width: 100%; }
  .subject-actions .button { flex: 1; }
  .avatar.cover { width: 48px; height: 48px; }
}
