/* RivalWatch · Eduport — design system on Vercel's Geist
   Geist Sans / Geist Mono (self-hosted, SIL OFL), Geist's neutral scale
   (100-300 backgrounds, 400-600 borders, 900 secondary text, 1000 text),
   radius 6px (controls) / 12px (raised surfaces), monochrome primary buttons.
   Eduport orange stays the brand accent (logo, active marks, data). */

@font-face { font-family: 'Geist'; src: url('/fonts/Geist-Variable.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url('/fonts/GeistMono-Variable.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  /* Geist neutrals (light) */
  --ds-background-100: #ffffff;
  --ds-background-200: #fafafa;
  --ds-gray-100: #f2f2f2;
  --ds-gray-200: #ebebeb;
  --ds-gray-300: #e6e6e6;
  --ds-gray-400: #ebebeb;
  --ds-gray-500: #c9c9c9;
  --ds-gray-600: #a8a8a8;
  --ds-gray-700: #8f8f8f;
  --ds-gray-800: #7d7d7d;
  --ds-gray-900: #666666;
  --ds-gray-1000: #171717;
  --ds-gray-alpha-400: rgba(0, 0, 0, 0.08);
  /* Eduport brand + Geist-style accents */
  --brand: #fb6514;
  --brand-600: #ec4a0a;
  --brand-700: #c4320a;
  --brand-50: #fff4ec;
  --brand-100: #ffe6d5;
  --brand-200: #fdd1b2;
  --blue: #006bff;
  --blue-700: #0059d6;
  --blue-50: #f0f6ff;
  --green: #28a948;
  --green-700: #107d32;
  --green-50: #effaf1;
  --red: #e5484d;
  --red-700: #cb2a2f;
  --red-50: #fff0f0;
  --amber: #ffa100;
  --amber-700: #a35200;
  --amber-50: #fff6e5;
  --purple: #8e4ec6;
  --purple-700: #6e2ead;
  --purple-50: #f9f1fe;
  /* the app's names, mapped onto Geist */
  --gray-25: var(--ds-background-200);
  --gray-50: var(--ds-background-200);
  --gray-100: var(--ds-gray-100);
  --gray-200: var(--ds-gray-400);
  --gray-300: var(--ds-gray-500);
  --gray-400: var(--ds-gray-700);
  --gray-500: var(--ds-gray-900);
  --gray-600: #4d4d4d;
  --gray-700: #333333;
  --gray-800: #222222;
  --gray-900: var(--ds-gray-1000);
  --radius: 12px;
  --radius-sm: 6px;
  --shadow-xs: 0 1px 1px rgba(0, 0, 0, 0.02);
  --shadow-sm: 0 2px 2px rgba(0, 0, 0, 0.04), 0 8px 8px -8px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 1px 1px rgba(0, 0, 0, 0.02), 0 4px 8px -4px rgba(0, 0, 0, 0.04), 0 16px 24px -8px rgba(0, 0, 0, 0.06);
  --ring: 0 0 0 1px var(--ds-gray-600), 0 0 0 4px rgba(0, 0, 0, 0.12);
  --sidebar: 240px;
  --font: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--gray-50);
  color: var(--gray-900);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  font-feature-settings: normal;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.25; color: var(--gray-900); }
h1 { font-size: 24px; letter-spacing: -0.04em; line-height: 32px; }
h2 { font-size: 20px; letter-spacing: -0.03em; }
h3 { font-size: 16px; letter-spacing: -0.02em; }
code, pre { font-family: var(--mono); }
p { margin: 0; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
::selection { background: var(--brand-100); }
.num { font-variant-numeric: tabular-nums; }

/* utilities */
.muted { color: var(--gray-500); }
.soft { color: var(--gray-600); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.strong { font-weight: 600; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap, 16px); }
.grow { flex: 1 1 auto; min-width: 0; }
.spacer { flex: 1; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.link { color: var(--gray-900); font-weight: 500; text-decoration: underline; text-decoration-color: var(--ds-gray-600); text-underline-offset: 3px; }
.link:hover { text-decoration-color: currentColor; }
svg.i { width: 18px; height: 18px; flex: none; }
svg.i-sm { width: 16px; height: 16px; }

/* ------------------------------------------------------------------ layout */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px;
  background: var(--ds-background-100); border-right: 1px solid var(--gray-200); padding: 20px 12px;
}
.brand { display: flex; align-items: center; padding: 0 8px 22px; }
/* RivalWatch lockup: mark + name + "by eduport" */
.lockup { display: inline-flex; align-items: center; gap: 10px; }
.lockup .mark { flex: none; display: block; }
.lockup-text { display: grid; gap: 1px; line-height: 1.1; }
.lockup-name { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; color: var(--gray-900); }
.lockup-by { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 500; color: var(--gray-500); }
.lockup-by img { height: 13px; width: auto; display: block; }
.lockup.sm .lockup-name { font-size: 15px; }
.lockup.sm .lockup-by img { height: 11px; }
.auth-brand { display: grid; justify-items: center; gap: 6px; }
.auth-brand .mark { margin-bottom: 6px; }
.auth-brand h1 { font-size: 24px; letter-spacing: -0.02em; }
.auth-brand .lockup-by { font-size: 12px; }
.auth-brand .lockup-by img { height: 15px; }
.nav { display: grid; gap: 2px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: var(--radius-sm);
  font-weight: 500; font-size: 14px; color: var(--ds-gray-900);
}
.nav a svg { color: var(--ds-gray-900); }
.nav a:hover { background: var(--ds-gray-100); color: var(--ds-gray-1000); }
.nav a.active { background: var(--ds-gray-100); color: var(--ds-gray-1000); }
.nav a.active svg { color: var(--brand); }
.nav .label { font-size: 12px; font-weight: 500; color: var(--ds-gray-700); padding: 18px 10px 6px; }
.sidebar .me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 14px 8px 0; border-top: 1px solid var(--gray-200); }
.sidebar .me .who { min-width: 0; flex: 1; }
.sidebar .me .who b { display: block; font-size: 14px; font-weight: 600; }
.sidebar .me .who span { display: block; font-size: 12px; color: var(--gray-500); }
.main { min-width: 0; }
.page { max-width: 1240px; margin: 0 auto; padding: 32px 32px 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head .sub { color: var(--gray-500); margin-top: 2px; font-size: 14px; }
.topbar, .bottom-nav { display: none; }

/* ------------------------------------------------------------------ surfaces */
.card { background: var(--ds-background-100); border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow-xs); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--gray-200); }
.card-head h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.card-body { padding: 20px; }
a.card:hover, .card.hover:hover { border-color: var(--gray-300); box-shadow: var(--shadow-sm); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.grid-halves { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }

/* ------------------------------------------------------------------ buttons */
/* Geist buttons: secondary (default), primary = high-contrast gray-1000, tertiary = ghost. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--ds-gray-alpha-400); background: var(--ds-background-100); color: var(--ds-gray-1000);
  font-weight: 500; font-size: 14px; cursor: pointer; white-space: nowrap; box-shadow: 0 0 0 1px transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.btn:hover { background: var(--ds-gray-100); border-color: var(--ds-gray-500); }
.btn:disabled { opacity: 1; cursor: not-allowed; background: var(--ds-gray-100); color: var(--ds-gray-700); border-color: var(--ds-gray-400); }
.btn-primary { background: var(--ds-gray-1000); border-color: var(--ds-gray-1000); color: #fff; }
.btn-primary:hover { background: #383838; border-color: #383838; color: #fff; }
.btn-blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-blue:hover { background: var(--blue-700); border-color: var(--blue-700); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ds-gray-900); }
.btn-ghost:hover { background: var(--ds-gray-100); border-color: transparent; color: var(--ds-gray-1000); }
.btn-danger { color: var(--red-700); }
.btn-danger:hover { background: var(--red-50); border-color: #f5b5b7; color: var(--red-700); }
.btn-danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger-solid:hover { background: var(--red-700); color: #fff; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 14px; }
.btn-lg { height: 48px; padding: 0 14px; font-size: 16px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }

/* ------------------------------------------------------------------ forms */
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--ds-gray-alpha-400); border-radius: var(--radius-sm);
  background: var(--ds-background-100); font-size: 14px; color: var(--ds-gray-1000); box-shadow: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--ds-gray-500); }
.textarea { height: auto; min-height: 132px; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.input::placeholder, .textarea::placeholder { color: var(--gray-400); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--ds-gray-600); box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.08); }
.select {
  appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%23667085' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 8 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
}
.select-sm { height: 32px; font-size: 14px; width: auto; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 500; color: var(--ds-gray-900); }
.error-text { color: var(--red-700); font-size: 13px; font-weight: 500; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; color: var(--gray-700); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--ds-gray-1000); }

.switch { position: relative; display: inline-flex; width: 36px; height: 20px; flex: none; cursor: pointer; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.switch .track { position: absolute; inset: 0; border-radius: 999px; background: var(--gray-200); transition: background 0.15s; }
.switch .track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform 0.15s; }
.switch input:checked + .track { background: var(--ds-gray-1000); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }

/* segmented chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn {
  height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--ds-gray-alpha-400); background: var(--ds-background-100);
  font-weight: 500; font-size: 14px; color: var(--ds-gray-900); cursor: pointer; white-space: nowrap;
}
.chip-btn:hover { background: var(--ds-gray-100); color: var(--ds-gray-1000); }
.chip-btn.active { background: var(--ds-gray-1000); border-color: var(--ds-gray-1000); color: #fff; }
.chip-btn .count { margin-left: 6px; opacity: 0.7; font-weight: 500; }

/* tabs */
/* Baseline drawn as an inset shadow (not a border) so the active tab's 2px line covers it even though the bar scrolls sideways. */
.tabs { display: flex; gap: 4px; box-shadow: inset 0 -1px 0 var(--gray-200); margin-bottom: 24px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; white-space: nowrap; height: 40px; padding: 0 2px; margin-right: 20px; border: 0; background: none; font-weight: 500; font-size: 14px; color: var(--ds-gray-900); cursor: pointer; border-bottom: 2px solid transparent; transition: color 0.15s; }
.tabs button:hover { color: var(--ds-gray-1000); }
.tabs button.active { color: var(--ds-gray-1000); border-bottom-color: var(--ds-gray-1000); }

/* ------------------------------------------------------------------ badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--ds-gray-100); color: var(--ds-gray-1000);
}
.badge.dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.orange { background: var(--brand-50); color: var(--brand-700); }
.badge.blue { background: var(--blue-50); color: var(--blue-700); }
.badge.green { background: var(--green-50); color: var(--green-700); }
.badge.red { background: var(--red-50); color: var(--red-700); }
.badge.amber { background: var(--amber-50); color: var(--amber-700); }
.badge.purple { background: var(--purple-50); color: var(--purple-700); }
.badge.solid { background: var(--ds-gray-1000); color: #fff; }

/* ------------------------------------------------------------------ media */
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--gray-100); flex: none; border: 1px solid rgba(16, 24, 40, 0.08); }
.avatar.sm { width: 28px; height: 28px; }
.avatar.xs { width: 22px; height: 22px; }
.avatar.lg { width: 48px; height: 48px; }
.avatar.xl { width: 72px; height: 72px; }
.avatar.initials { display: inline-grid; place-items: center; font-weight: 600; color: var(--brand-700); background: var(--brand-50); font-size: 13px; }
.thumb { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius-sm); overflow: hidden; background: var(--gray-100); flex: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .dur { position: absolute; right: 6px; bottom: 6px; padding: 1px 6px; border-radius: 4px; background: rgba(16, 24, 40, 0.82); color: #fff; font-size: 11px; font-weight: 600; }
.thumb.removed img { filter: grayscale(1); opacity: 0.6; }
.thumb-gone { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; color: var(--gray-500); }
.thumb.w-sm { width: 120px; }
.thumb.w-md { width: 168px; }
.thumb.w-lg { width: 100%; }

/* ------------------------------------------------------------------ dashboard */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { padding: 20px; }
.kpi .k { display: flex; align-items: center; justify-content: space-between; color: var(--ds-gray-900); font-weight: 500; font-size: 14px; }
.kpi .k .ico { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; }
.kpi .v { font-size: 32px; font-weight: 600; letter-spacing: -0.04em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.ico.orange { background: var(--brand-50); color: var(--brand); }
.ico.blue { background: var(--blue-50); color: var(--blue); }
.ico.green { background: var(--green-50); color: var(--green); }
.ico.purple { background: var(--purple-50); color: var(--purple); }

.top-videos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding: 20px; }
.vcard { display: grid; gap: 10px; align-content: start; }
.vcard .t { font-weight: 600; font-size: 14px; line-height: 1.35; color: var(--gray-900); }
.vcard:hover .t { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--ds-gray-600); }
.vcard .meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--gray-500); }
.thumb .outlier { position: absolute; left: 6px; top: 6px; }

.list { display: grid; grid-template-columns: minmax(0, 1fr); }
.list-item { display: flex; gap: 12px; align-items: flex-start; padding: 14px 20px; border-bottom: 1px solid var(--gray-100); }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: var(--ds-background-200); }
.list-item .text { min-width: 0; flex: 1; }
.list-item .text b { font-weight: 600; }
.list-item time { font-size: 12px; color: var(--gray-400); white-space: nowrap; }

/* ------------------------------------------------------------------ feed */
.filterbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 20px; }
.filterbar .selects { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.events { display: grid; gap: 12px; }
.event { padding: 16px 20px; display: grid; gap: 14px; }
.event-head { display: flex; align-items: center; gap: 12px; }
.event-head > a { flex: none; }
.event-head .who { font-weight: 500; color: var(--gray-700); line-height: 1.35; }
.event-head .who a { font-weight: 600; color: var(--gray-900); }
.event-head .who a:hover { color: var(--brand-700); }
.event-head time { font-size: 12px; color: var(--gray-400); display: block; }
.event-body { display: flex; gap: 16px; align-items: flex-start; }
.event-title { font-weight: 600; font-size: 15px; line-height: 1.35; color: var(--gray-900); }
a.event-title:hover { color: var(--brand-700); }
.stats { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; color: var(--gray-500); font-size: 13px; }
.stats span { display: inline-flex; align-items: center; gap: 5px; }
.stats svg { width: 15px; height: 15px; }
.diff { display: grid; gap: 6px; }
.diff-row { display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: baseline; }
.diff-row .lbl { font-size: 11px; font-weight: 600; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.04em; }
.diff-row.was .val { color: var(--gray-500); text-decoration: line-through; text-decoration-color: var(--gray-300); }
.diff-row.now .val { font-weight: 600; color: var(--gray-900); }
.swap { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.swap .arrow { color: var(--gray-400); }
figure.variant { margin: 0; display: grid; gap: 6px; }
figure.variant figcaption { font-size: 12px; color: var(--gray-500); }
figure.variant.win .thumb { box-shadow: 0 0 0 2px var(--green); }
.variants-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.variants-list li { display: flex; gap: 10px; align-items: baseline; font-weight: 500; }
.variants-list li .tag { flex: none; width: 22px; height: 22px; border-radius: 6px; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--gray-100); color: var(--gray-600); }
.variants-list li.win .tag { background: var(--green-50); color: var(--green-700); }
.big-num { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.load-more { display: flex; justify-content: center; padding: 8px 0; }

/* ------------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th {
  text-align: left; font-size: 12px; font-weight: 500; color: var(--ds-gray-900); background: var(--ds-background-200);
  padding: 10px 16px; border-bottom: 1px solid var(--gray-200); white-space: nowrap;
}
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--gray-700); }
.table th .arrow { margin-left: 4px; color: var(--ds-gray-1000); }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--gray-200); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--ds-background-200); }
.table tr.own td { background: #fffbf7; }
.table tr.own:hover td { background: var(--brand-50); }
.table td.r, .table th.r { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.paused td { opacity: 0.6; }
.table .channel-cell { display: flex; align-items: center; gap: 12px; min-width: 200px; }
.table .channel-cell .name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.table .channel-cell b { font-weight: 600; }
.table .channel-cell .sub { display: block; font-size: 12px; color: var(--gray-500); }
.top-video { display: grid; gap: 4px; width: 96px; }
.top-video .thumb { width: 96px; }
.bar { height: 6px; border-radius: 99px; background: var(--gray-100); overflow: hidden; width: 90px; margin-left: auto; margin-top: 6px; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.delta-up { color: var(--green-700); }
.delta-down { color: var(--red-700); }

/* ------------------------------------------------------------------ channel & video pages */
.hero { display: flex; gap: 20px; align-items: center; padding: 24px; flex-wrap: wrap; }
.hero h1 { font-size: 22px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin: 20px 0; }
.tile { padding: 18px 20px; }
.tile .k { font-size: 13px; font-weight: 500; color: var(--ds-gray-900); }
.tile .v { font-size: 24px; font-weight: 600; margin-top: 6px; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.tile .s { font-size: 12px; color: var(--ds-gray-900); margin-top: 2px; }
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 16px; }
.video-tile { padding: 10px; display: grid; gap: 10px; align-content: start; }
.video-tile .t { font-weight: 600; font-size: 14px; line-height: 1.35; }
.video-hero { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 24px; padding: 24px; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.timeline li { position: relative; padding-left: 22px; }
.timeline li::before { content: ''; position: absolute; left: 3px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--gray-300); }
.timeline li.current::before { background: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); }
.timeline .t { font-weight: 600; }
.timeline .m { font-size: 12px; color: var(--gray-500); margin-top: 2px; }
.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--gray-500); font-weight: 600; margin-bottom: 16px; }
.back:hover { color: var(--gray-800); }

/* ------------------------------------------------------------------ charts */
.chart { position: relative; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .axis text { font-size: 12px; fill: var(--ds-gray-900); font-family: var(--font); }
.chart .grid { stroke: var(--gray-200); }
.chart .marker { stroke: var(--gray-400); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-tip {
  position: absolute; z-index: 5; pointer-events: none; transform: translate(-50%, calc(-100% - 12px));
  background: var(--ds-gray-1000); color: #fff; border-radius: 6px; padding: 8px 10px; font-size: 12px; line-height: 1.5; white-space: nowrap; box-shadow: var(--shadow-lg);
}
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--gray-500); margin-top: 10px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }

/* ------------------------------------------------------------------ states */
.empty { padding: 56px 24px; text-align: center; display: grid; justify-items: center; gap: 8px; }
.empty .ico { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: var(--ds-background-100); color: var(--ds-gray-1000); margin-bottom: 8px; border: 1px solid var(--ds-gray-alpha-400); box-shadow: var(--shadow-sm); }
.empty h3 { font-size: 16px; }
.empty p { color: var(--gray-500); max-width: 360px; }
.empty .btn { margin-top: 12px; }
.skeleton { border-radius: var(--radius-sm); background: linear-gradient(270deg, var(--ds-gray-100), var(--ds-background-200), var(--ds-background-200), var(--ds-gray-100)); background-size: 400% 100%; animation: shimmer 8s ease-in-out infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.spin { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* toast & modal */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: grid; gap: 8px; }
.toast { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 8px; background: var(--ds-gray-1000); color: #fff; font-weight: 500; box-shadow: var(--shadow-lg); max-width: 380px; animation: pop 0.18s ease-out; }
.toast.error { background: var(--red-700); }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }
.modal-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(0, 0, 0, 0.4); display: grid; place-items: center; padding: 16px; }
.modal { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--ds-background-100); border-radius: 12px; border: 1px solid var(--ds-gray-alpha-400); box-shadow: var(--shadow-lg); animation: pop 0.15s ease-out; }
.modal .m-head { padding: 22px 24px 0; }
.modal .m-head p { color: var(--gray-500); margin-top: 4px; }
.modal .m-body { padding: 20px 24px; display: grid; gap: 16px; }
.modal .m-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px; border-top: 1px solid var(--ds-gray-alpha-400); background: var(--ds-background-200); border-radius: 0 0 12px 12px; }
.results { display: grid; gap: 6px; max-height: 220px; overflow: auto; }
.results div { display: flex; gap: 8px; align-items: center; font-size: 13px; }

/* sign in */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: var(--ds-background-200); }
.auth-card { width: min(400px, 100%); padding: 36px 32px; display: grid; gap: 20px; text-align: center; box-shadow: var(--shadow-sm); }
.auth-card .logo { height: 34px; margin: 0 auto; }
.auth-card form { display: grid; gap: 14px; text-align: left; }

code, pre { font-family: var(--mono); font-size: 13px; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .top-videos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30; background: #fff; border-bottom: 1px solid var(--gray-200); padding: 12px 16px; }
  .page { padding: 20px 16px 96px; }
  .bottom-nav { display: flex; position: fixed; inset: auto 0 0 0; z-index: 30; background: #fff; border-top: 1px solid var(--gray-200); padding-bottom: env(safe-area-inset-bottom); }
  .bottom-nav a { flex: 1; display: grid; justify-items: center; gap: 2px; padding: 8px 0; font-size: 11px; font-weight: 500; color: var(--ds-gray-900); }
  .bottom-nav a.active { color: var(--ds-gray-1000); }
  .bottom-nav a.active svg { color: var(--brand); }
  .grid-halves, .video-hero { grid-template-columns: 1fr; }
  .top-videos { grid-template-columns: 1fr; }
  .event-body { flex-direction: column; }
  .event-body .thumb { width: 100%; }
  .filterbar .selects { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ------------------------------------------------------------------ insights */
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 14px; }
.section-title h3 { font-size: 16px; }
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 200px) minmax(0, 1fr) 64px; gap: 12px; align-items: center; font-size: 13px; }
.bar-row .lbl { color: var(--gray-700); font-weight: 500; }
.bar-row .lbl small { display: block; color: var(--gray-400); font-weight: 400; font-size: 11px; }
.bar-track { position: relative; height: 10px; border-radius: 99px; background: var(--gray-100); }
.bar-fill { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: var(--brand); }
.bar-fill.muted { background: var(--gray-300); }
.bar-base { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--gray-500); border-radius: 2px; }
.bar-row .val { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.term { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; background: var(--gray-100); color: var(--gray-700); font-size: 13px; font-weight: 500; }
.term b { color: var(--gray-400); font-weight: 500; }
.quote { display: grid; gap: 4px; padding: 12px 20px; border-bottom: 1px solid var(--gray-100); }
.quote:last-child { border-bottom: 0; }
.quote p { color: var(--gray-800); }
.quote .src { font-size: 12px; color: var(--gray-400); display: grid; gap: 2px; min-width: 0; }
.quote .src .truncate { display: block; max-width: 100%; }
.quote .src a:hover { color: var(--brand-700); }
.sentiment { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: var(--gray-100); }
.sentiment i { display: block; height: 100%; }
.sentiment .pos { background: var(--green); }
.sentiment .neu { background: var(--gray-300); }
.sentiment .neg { background: var(--red); }
.palette { display: flex; gap: 3px; }
.palette i { width: 18px; height: 18px; border-radius: 4px; border: 1px solid rgba(16, 24, 40, 0.08); }
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.trend-up { color: var(--green-700); font-weight: 600; }
.trend-down { color: var(--gray-400); }
.notice { display: flex; gap: 12px; align-items: center; padding: 14px 18px; border-radius: var(--radius); background: var(--brand-50); border: 1px solid var(--brand-200); color: var(--brand-700); font-weight: 500; margin-bottom: 20px; }
.notice .btn { margin-left: auto; }
@media (max-width: 860px) {
  .bar-row { grid-template-columns: 110px minmax(0, 1fr) 52px; }
}

/* --- Insights v2: compact, data-first ------------------------------------------------- */
.thumb.w-xs { width: 64px; border-radius: 6px; }
.table.compact td { padding: 8px 16px; }
.table.compact th { padding-top: 10px; padding-bottom: 10px; }
.table .example { display: flex; align-items: center; gap: 10px; max-width: 360px; min-width: 0; color: var(--gray-600); font-size: 13px; }
.table .example:hover { color: var(--brand-700); }
.seg { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--gray-100); gap: 2px; }
.seg button { border: 0; background: none; padding: 4px 10px; border-radius: 6px; font-size: 13px; font-weight: 600; color: var(--gray-600); cursor: pointer; }
.seg button.active { background: #fff; color: var(--gray-900); box-shadow: var(--shadow-xs); }
.show-more { padding: 8px 12px 12px; text-align: center; border-top: 1px solid var(--gray-100); }
details > summary { cursor: pointer; color: var(--gray-700); padding: 4px 0; list-style: none; }
details > summary::before { content: '▸ '; color: var(--gray-400); }
details[open] > summary::before { content: '▾ '; }
details[open] > summary { margin-bottom: 8px; }
@media (max-width: 720px) {
  .table .hide-sm { display: none; }
  .table .example span { display: none; }
  .table.compact td, .table.compact th { padding-left: 10px; padding-right: 10px; }
}

/* Audience tab */
details.pad { padding: 10px 20px 14px; border-top: 1px solid var(--ds-gray-alpha-400); }
details.pad[open] > summary { margin-bottom: 4px; }
details.pad .quote { padding-left: 0; padding-right: 0; }
.sentiment { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--ds-gray-100); }
.sentiment .pos { background: var(--green); }
.sentiment .neu { background: var(--ds-gray-500); }
.sentiment .neg { background: var(--red); }
.notice { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid var(--ds-gray-alpha-400); background: var(--ds-background-200); color: var(--ds-gray-900); font-size: 14px; }
/* Long titles inside comment rows must truncate, never widen the card. */
.quote, .quote .src { grid-template-columns: minmax(0, 1fr); min-width: 0; }
@media (max-width: 860px) { .grid-halves, .video-hero { grid-template-columns: minmax(0, 1fr); } }

/* Geist: neutral icon tiles (colour is kept for data, not chrome) */
.kpi .k .ico, .ico.orange, .ico.blue, .ico.green, .ico.purple { background: var(--ds-background-200); color: var(--ds-gray-1000); border: 1px solid var(--ds-gray-alpha-400); }

/* usage close to a limit */
.tile.warn { border-color: #ffcc66; background: var(--amber-50); }
.tile.warn .s { color: var(--amber-700); }

/* Market briefing */
.briefing-summary { padding: 20px; background: linear-gradient(150deg, var(--brand-50), var(--ds-background-100) 46%); }
.briefing-heading { display: flex; justify-content: space-between; align-items: start; gap: 12px 24px; margin-bottom: 20px; }
.briefing-heading h2 { font-size: 26px; }
.briefing-dates { display: grid; gap: 2px; text-align: right; }
.briefing-dates b { color: var(--gray-700); margin-right: 3px; }
.briefing-metrics, .briefing-signals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.briefing-metrics { gap: 12px; grid-template-columns: minmax(0, 1.2fr) repeat(2, minmax(0, 1fr)); }
.briefing-stat { display: grid; align-content: start; gap: 5px; min-height: 122px; padding: 14px; border-radius: 8px; border: 1px solid var(--gray-200); background: var(--ds-background-100); }
.briefing-stat h3 { font-size: 13px; font-weight: 500; color: var(--gray-700); }
.briefing-number { font-size: 26px; font-weight: 600; line-height: 1.2; letter-spacing: -.04em; }
.briefing-lane { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 6px; font-size: 12px; color: var(--gray-600); }
.briefing-track { height: 7px; border-radius: 8px; background: var(--gray-100); }
.briefing-track span { display: block; height: 100%; border-radius: inherit; }
.briefing-track .recent { background: var(--brand-600); }
.briefing-track .previous { background: var(--gray-400); }
.briefing-signal { display: grid; grid-template-rows: auto auto auto 1fr auto; gap: 6px; min-width: 0; padding: 16px 20px; }
.briefing-signal + .briefing-signal { border-left: 1px solid var(--gray-200); }
.briefing-signal-label { display: flex; align-items: center; gap: 6px; color: var(--gray-600); }
.briefing-signal-label svg { color: var(--brand-700); }
.briefing-signal h4 { font-size: 16px; overflow-wrap: anywhere; }
.briefing-evidence { display: flex; align-items: center; gap: 8px; min-width: 0; margin: 4px 0; font-size: 12px; color: var(--gray-600); }
.briefing-evidence .thumb { flex: none; }
.briefing-evidence:hover { color: var(--brand-700); }
.briefing-signal .link { justify-self: start; }
.briefing-table-head { flex-wrap: wrap; }
.briefing-table { min-width: 550px; }
.briefing-table .channel-cell { min-width: 142px; }
.briefing-table .channel-cell b { overflow-wrap: anywhere; }
.briefing-table td.r { white-space: nowrap; }
.briefing details p + p { margin-top: 5px; }
@media (max-width: 640px) {
  .briefing-heading { flex-direction: column; }
  .briefing-dates { text-align: left; }
  .briefing-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .briefing-stat:first-child { grid-column: 1 / -1; }
  .briefing-signals { grid-template-columns: minmax(0, 1fr); }
  .briefing-signal + .briefing-signal { border-left: 0; border-top: 1px solid var(--gray-200); }
}
