/* Ghost professional workspace — clear, neutral, and task-first. */

:root {
  color-scheme: light;
  --background: #f8fafd;
  --foreground: #1f1f1f;
  --card: #ffffff;
  --card-foreground: #1f1f1f;
  --popover: #ffffff;
  --popover-foreground: #1f1f1f;
  --primary: #0b57d0;
  --primary-foreground: #ffffff;
  --secondary: #f1f3f4;
  --secondary-foreground: #3c4043;
  --muted-surface: #f1f3f4;
  --muted-foreground: #5f6368;
  --accent: #e8f0fe;
  --accent-foreground: #174ea6;
  --destructive: #b3261e;
  --border-token: #dadce0;
  --input-token: #c4c7c5;
  --ring-token: #0b57d0;
  --signal: #0b57d0;
  --signal-soft: #e8f0fe;
  --canvas: var(--background);
  --surface: var(--card);
  --surface-soft: #f8fafd;
  --sidebar: var(--card);
  --sidebar-soft: #f1f3f4;
  --ink: var(--foreground);
  --muted: var(--muted-foreground);
  --faint: #80868b;
  --line: var(--border-token);
  --line-strong: #c4c7c5;
  --blue: var(--primary);
  --blue-dark: #0842a0;
  --blue-soft: var(--accent);
  --cyan: var(--primary);
  --amber: #b06000;
  --amber-soft: #fef7e0;
  --green: #137333;
  --red: var(--destructive);
  --red-soft: #fce8e6;
  --display: "Noto Sans", "Segoe UI", sans-serif;
  --body: "Noto Sans", "Segoe UI", sans-serif;
  --mono: "Noto Sans", "Segoe UI", sans-serif;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow-sm: 0 1px 2px rgba(60, 64, 67, .08), 0 1px 3px 1px rgba(60, 64, 67, .05);
  --shadow-lg: 0 8px 28px rgba(60, 64, 67, .18);
}

html { background: var(--background); color: var(--foreground); }
body {
  background: var(--background);
  color: var(--foreground);
  font: 14px/1.5 var(--body);
  letter-spacing: 0;
}
h1, h2, h3, h4 { color: var(--foreground); font-family: var(--display); letter-spacing: -.02em; }
button, input, select, textarea { font-family: var(--body); }
mark { border-radius: 2px; background: #fdd663; color: #1f1f1f; padding: 0 2px; }
.signal-overline, .section-number, .page-trail, .nav-foot { display: none !important; }

input, select, textarea {
  min-height: 44px;
  border: 1px solid var(--input-token);
  border-radius: 8px;
  background: #fff;
  color: var(--foreground);
  padding: 10px 12px;
  box-shadow: none;
}
input:hover, select:hover, textarea:hover { border-color: #80868b; }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}
button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
input::placeholder { color: #80868b; }

.primary-button, .secondary-button, .bar-button {
  min-height: 42px;
  border-radius: 20px;
  padding: 0 20px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  box-shadow: none;
}
.primary-button { background: var(--primary); color: #fff; }
.primary-button:hover { background: #0842a0; box-shadow: 0 1px 2px rgba(60, 64, 67, .2); transform: none; }
.secondary-button { border: 1px solid var(--line-strong); background: #fff; color: var(--primary); }
.secondary-button:hover { border-color: var(--primary); background: #f8fafd; }
.text-button { min-height: 40px; color: var(--primary); font-size: 13px; font-weight: 600; }
.text-button:hover { background: var(--accent); color: var(--primary); }

/* Authentication */
.auth-screen {
  min-height: 100dvh;
  overflow-y: auto;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: var(--background);
}
.auth-shell {
  width: 100%;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.auth-panel {
  width: min(440px, 100%);
  margin: auto;
  padding: 40px;
  border: 1px solid var(--border-token);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.auth-brand {
  margin-bottom: 32px;
  color: var(--primary);
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -.04em;
}
.auth-panel h1 { margin: 0 0 24px; font-size: 28px; font-weight: 500; line-height: 1.25; }
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 0 0 28px;
  padding: 0;
  border-bottom: 1px solid var(--border-token);
  border-radius: 0;
  background: transparent;
}
.auth-tabs button {
  min-height: 44px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 14px;
  font-weight: 600;
}
.auth-tabs button:hover { background: #f8fafd; color: var(--foreground); }
.auth-tabs button.active {
  border-bottom-color: var(--primary);
  background: transparent;
  color: var(--primary);
  box-shadow: none;
}
.auth-form { display: grid; gap: 20px; margin: 0; }
.auth-form label, .stack-form label, .watchlist-form label {
  display: grid;
  gap: 7px;
  color: #3c4043;
  font-size: 13px;
  font-weight: 500;
}
.auth-form .primary-button { width: 100%; margin-top: 4px; border-radius: 8px; }
.form-error { min-height: 20px; margin: 16px 0 0; color: var(--red); font-size: 13px; font-weight: 500; }

/* Application shell */
.site-header {
  height: 64px;
  grid-template-columns: 248px minmax(220px, 1fr) auto;
  border-bottom: 1px solid var(--border-token);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(12px);
}
.brand-word {
  height: 64px;
  padding: 0 24px;
  border-right: 1px solid var(--border-token);
  background: #fff;
}
.brand-word > .brand-wordmark { color: #3c4043; font-size: 23px; font-weight: 700; letter-spacing: -.04em; }
.brand-dot { display: none; }
.header-context { padding: 0 24px; }
.header-context > span { display: none; }
.header-context h1 { margin: 0; font-size: 20px; font-weight: 500; }
.header-status { height: 64px; padding: 0 16px; }
.account-trigger {
  min-height: 48px;
  max-width: 280px;
  border: 0;
  border-radius: 24px;
  background: transparent;
  padding: 6px 10px 6px 6px;
}
.account-trigger:hover, .account-trigger[aria-expanded="true"] { background: var(--muted-surface); }
.account-trigger strong { color: var(--foreground); font-size: 13px; font-weight: 600; }
.account-trigger small { color: var(--muted-foreground); font-size: 11px; }
.account-trigger > svg { color: var(--muted-foreground); }
.user-badge { border-radius: 50%; background: var(--primary); color: #fff; }
.account-popover {
  border: 1px solid var(--border-token);
  border-radius: 12px;
  background: #fff;
  color: var(--foreground);
  box-shadow: var(--shadow-lg);
}
.account-popover-rule { background: var(--border-token); }
.account-popover > a, .account-popover > button { color: var(--foreground); }
.account-popover > a:hover, .account-popover > button:hover { background: var(--muted-surface); }

.app-frame { min-height: calc(100dvh - 64px); grid-template-columns: 248px minmax(0, 1fr); }
.workspace-nav {
  top: 64px;
  height: calc(100dvh - 64px);
  padding: 20px 12px;
  border-right: 1px solid var(--border-token);
  background: #fff;
  color: var(--foreground);
}
.nav-label {
  padding: 0 12px 8px;
  color: var(--muted-foreground);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
}
.nav-label-spaced { margin-top: 20px; }
.workspace-nav nav { gap: 4px; }
.sidebar-link {
  min-height: 52px;
  grid-template-columns: 28px minmax(0, 1fr);
  border: 0;
  border-radius: 26px;
  color: #3c4043;
  padding: 8px 14px;
  transition: background-color .15s ease, color .15s ease;
}
.sidebar-link:hover { border: 0; background: var(--muted-surface); color: var(--foreground); transform: none; }
.sidebar-link.active { border: 0; background: var(--accent); color: #174ea6; }
.sidebar-link .nav-icon { color: #5f6368; }
.sidebar-link.active .nav-icon { color: var(--primary); }
.sidebar-link strong { color: inherit; font-size: 13px; font-weight: 600; }
.sidebar-link small { margin-top: 1px; color: var(--muted-foreground); font-size: 11px; }

.content-area { width: 100%; max-width: 1600px; padding: 24px; }
.view-bar {
  min-height: 64px;
  padding: 0 24px;
  border: 1px solid var(--border-token);
  border-radius: 12px 12px 0 0;
  background: #fff;
}
.view-bar > div:first-child { gap: 0; }
.view-bar strong { color: var(--foreground); font-size: 16px; font-weight: 600; }
.catalog-readout { color: var(--muted-foreground); font: 12px/1.4 var(--body); letter-spacing: 0; }

/* Search and filter workspace */
.search-layout {
  min-height: 680px;
  grid-template-columns: 320px minmax(0, 1fr);
  border: 1px solid var(--border-token);
  border-top: 0;
  border-radius: 0 0 12px 12px;
  background: #fff;
  box-shadow: none;
}
.filter-rail { min-height: 680px; border-right: 1px solid var(--border-token); background: #f8fafd; }
.query-block { padding: 20px; border-bottom: 1px solid var(--border-token); background: #fff; }
.query-block > label, .field-label { margin-bottom: 8px; color: #3c4043; font-size: 13px; font-weight: 600; }
.query-block > small { margin-top: 8px; color: var(--muted-foreground); font-size: 12px; line-height: 1.5; }
.query-row { grid-template-columns: minmax(0, 1fr) 46px; }
.query-row input { border-radius: 8px 0 0 8px; }
.search-submit {
  min-height: 44px;
  border: 1px solid var(--primary);
  border-radius: 0 8px 8px 0;
  background: var(--primary);
  color: #fff;
  font-size: 20px;
}
.search-submit:hover { background: #0842a0; }
.form-actions { gap: 8px; padding: 14px 20px; border-bottom: 1px solid var(--border-token); background: #fff; }
.primary-button.compact { min-height: 40px; border-radius: 20px; padding: 0 18px; font-size: 13px; }
.filter-group { border-bottom: 1px solid var(--border-token); background: transparent; }
.filter-group > summary { min-height: 52px; padding: 0 20px; color: var(--foreground); font-size: 13px; font-weight: 600; }
.filter-group > summary:hover { background: var(--muted-surface); }
.filter-group > summary b { color: var(--muted-foreground); font-size: 11px; font-weight: 500; }
.filter-content { padding: 4px 20px 20px; }
.filter-content label { color: #3c4043; font-size: 12px; font-weight: 500; }
.filter-note { color: var(--muted-foreground); font-size: 11px; }
.segmented { gap: 8px; }
.segmented label span { min-height: 38px; border: 1px solid var(--line-strong); border-radius: 19px; background: #fff; color: #3c4043; font-size: 12px; }
.segmented input:checked + span { border-color: var(--primary); background: var(--accent); color: #174ea6; box-shadow: none; }
.recent-block { border-top: 0; background: #f8fafd; }
.rail-heading { color: var(--muted-foreground); font-size: 12px; font-weight: 600; }
.rail-heading button { color: var(--primary); }

.results-pane { padding: 24px; background: #fff; }
.result-toolbar { gap: 20px; padding: 0 0 16px; border-bottom: 1px solid var(--border-token); }
.result-toolbar h2 { margin: 0; font-size: 22px; font-weight: 500; line-height: 1.3; }
.result-controls { gap: 8px; }
.result-controls label { color: var(--muted-foreground); font-size: 11px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.result-controls select { min-height: 40px; border-radius: 8px; font-size: 12px; }
.result-count { border: 0; border-radius: 16px; background: var(--muted-surface); color: #3c4043; font: 600 11px var(--body); letter-spacing: .02em; }
.active-filter-strip { min-height: 46px; border-bottom: 1px solid var(--border-token); color: var(--muted-foreground); font-size: 12px; }
.filter-chip { border: 1px solid var(--line-strong); border-radius: 16px; background: #fff; color: #3c4043; }

.result-insights { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 16px 0; }
.insight-card { min-height: 78px; display: flex; flex-direction: column; justify-content: center; padding: 14px 16px; border: 1px solid var(--border-token); border-radius: 10px; background: #fff; box-shadow: none; }
.insight-card.accent { border-color: var(--border-token); background: var(--amber-soft); }
.insight-card span { display: block; color: var(--muted-foreground); font-size: 11px; }
.insight-card strong { display: block; margin-top: 5px; color: var(--foreground); font-size: 18px; font-weight: 600; }
.insight-card.accent strong { color: #7c4a03; }

.results-list { gap: 12px; }
.result-card {
  grid-template-columns: minmax(0, 1fr) 128px;
  gap: 20px;
  padding: 20px;
  border: 1px solid var(--border-token);
  border-radius: 12px;
  background: #fff;
  box-shadow: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.result-card:hover { border-color: #aeb4b7; box-shadow: 0 1px 3px rgba(60, 64, 67, .12); transform: none; }
.result-card.has-thumbnail { grid-template-columns: 160px minmax(0, 1fr) 128px; }
.result-visual { min-width: 0; }
.result-thumb { min-height: 96px; border: 1px solid var(--border-token); border-radius: 8px; background: #f1f3f4; }
.thumb-kind { border-radius: 3px; background: rgba(32, 33, 36, .78); color: #fff; font: 600 10px var(--body); letter-spacing: .02em; }
.result-body { min-width: 0; }
.result-meta { color: var(--muted-foreground); font: 12px/1.4 var(--body); letter-spacing: 0; text-transform: none; }
.source-name { color: #174ea6; font-weight: 600; }
.result-card h3 { margin: 6px 0 6px; overflow: visible; color: var(--foreground); font-size: 17px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; text-overflow: clip; white-space: normal; }
.result-excerpt { color: #3c4043; font-size: 13px; line-height: 1.55; }
.result-metrics { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin-top: 12px; }
.result-metric { min-width: 0; display: inline-flex; align-items: baseline; gap: 4px; padding: 0 14px 0 0; border-left: 0; border-right: 1px solid var(--border-token); background: transparent; }
.result-metric:last-child { border-right: 0; }
.result-metric small { color: var(--muted-foreground); font: 11px var(--body); letter-spacing: 0; text-transform: none; }
.result-metric strong { color: var(--foreground); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.audience-metric { border-left: 0; }
.audience-metric strong { color: #7c4a03; }
.result-facts { color: var(--muted-foreground); font-size: 11px; }
.result-facts span::before { background: #80868b; }
.result-tags { gap: 6px; }
.result-tag { border: 0; border-radius: 12px; background: var(--muted-surface); color: #3c4043; font: 11px var(--body); letter-spacing: 0; }
.result-actions { gap: 8px; }
.result-actions button, .external-action {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 19px;
  background: #fff;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
}
.result-actions button:hover, .external-action:hover { border-color: var(--primary); background: #f8fafd; color: var(--primary); }
.result-actions .media-button { border-color: var(--primary); background: var(--primary); color: #fff; }
.result-actions .media-button:hover { background: #0842a0; color: #fff; }
.transcript-panel { grid-column: 1 / -1; border: 1px solid var(--border-token); border-radius: 8px; background: #f8fafd; }
.transcript-panel > summary { min-height: 42px; color: #3c4043; font-size: 12px; font-weight: 500; }
.match-jump { border-color: var(--border-token); background: #fff; color: #3c4043; }
.match-jump:hover { border-color: var(--primary); background: var(--accent); }

.pager { border-color: var(--border-token); }
.pager button { min-height: 40px; border: 1px solid var(--line-strong); border-radius: 20px; background: #fff; color: var(--primary); }
.pager span { color: var(--muted-foreground); font: 12px var(--body); }
.syntax-help { border: 1px solid var(--border-token); border-radius: 10px; background: #fff; }
.syntax-help > summary { min-height: 48px; color: #3c4043; font-size: 13px; font-weight: 500; }

/* Secondary views */
.workspace-panel, .admin-layout, .settings-layout {
  border: 1px solid var(--border-token);
  border-top: 0;
  border-radius: 0 0 12px 12px;
  background: #fff;
  box-shadow: none;
}
.watchlist-layout { display: block; padding: clamp(22px, 3vw, 32px); }
.watchlist-directory { min-width: 0; }
.toolbar-description { margin: 5px 0 0; color: var(--muted-foreground); font-size: 13px; }
.watchlist-form { width: min(820px, calc(100% - 32px)); margin: 16px auto 0; }
.panel-intro, .settings-intro { border-left: 0; padding-left: 0; }
.panel-intro h2, .settings-intro h2 { margin: 0 0 8px; color: var(--foreground); font-size: 22px; font-weight: 500; }
.panel-intro p, .settings-intro p { color: var(--muted-foreground); font-size: 13px; }
.watch-item, .member-item { border: 1px solid var(--border-token); border-radius: 10px; background: #fff; box-shadow: none; }
.watchlist-form, .stack-form, .settings-card, .taxonomy-panel { border-color: var(--border-token); border-radius: 12px; background: #fff; box-shadow: none; }
.settings-card-head h3 { font-size: 20px; font-weight: 500; }
.timezone-preview { border: 0; border-radius: 10px; background: var(--muted-surface); }
.timezone-preview strong { font-size: clamp(18px, 2vw, 24px); font-weight: 500; }
.settings-state, .member-status { color: var(--primary); font: 600 11px var(--body); letter-spacing: .02em; }
.taxonomy-panel {
  margin-top: 16px;
  overflow: hidden;
  transition: opacity .15s ease;
}
.taxonomy-panel.is-saving { opacity: .6; pointer-events: none; }
.taxonomy-head {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr);
  gap: 32px;
  align-items: end;
  padding: 24px;
  border-bottom: 1px solid var(--border-token);
}
.taxonomy-head h2 { margin: 0 0 6px; font-size: 22px; font-weight: 500; }
.taxonomy-head p { max-width: 680px; margin: 0; color: var(--muted-foreground); font-size: 13px; line-height: 1.55; }
.taxonomy-search { display: grid; gap: 7px; color: #3c4043; font-size: 13px; font-weight: 500; }
.taxonomy-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 16px; background: #f8fafd; }
.taxonomy-group { overflow: hidden; border: 1px solid var(--border-token); border-radius: 10px; background: #fff; }
.taxonomy-group > summary {
  min-height: 64px;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  list-style: none;
  background: #fff;
  cursor: pointer;
}
.taxonomy-group > summary::-webkit-details-marker { display: none; }
.taxonomy-group > summary::before { content: "›"; color: var(--muted-foreground); font-size: 22px; line-height: 1; transform: rotate(90deg); transition: transform .15s ease; }
.taxonomy-group:not([open]) > summary::before { transform: none; }
.taxonomy-group > summary:hover { background: #f8fafd; }
.taxonomy-group > summary > span:first-of-type { min-width: 0; display: grid; gap: 2px; }
.taxonomy-group > summary b { color: var(--foreground); font-size: 14px; font-weight: 600; }
.taxonomy-group > summary small { color: var(--muted-foreground); font-size: 11px; }
.taxonomy-bulk { display: flex; align-items: center; gap: 6px; }
.taxonomy-bulk button { min-height: 34px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; color: var(--primary); padding: 0 10px; font-size: 12px; font-weight: 600; }
.taxonomy-bulk button:hover { border-color: var(--primary); background: var(--accent); }
.taxonomy-bulk button:last-child { color: var(--destructive); }
.taxonomy-bulk button:last-child:hover { border-color: #d93025; background: var(--red-soft); }
.taxonomy-list { max-height: 360px; overflow-y: auto; display: grid; align-content: start; border-top: 1px solid var(--border-token); }
.taxonomy-item {
  min-width: 0;
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  align-items: center;
  gap: 16px;
  padding: 10px 14px;
  border-bottom: 1px solid #eef0f1;
  cursor: pointer;
  content-visibility: auto;
  contain-intrinsic-size: 58px;
  transition: background-color .15s ease, opacity .15s ease;
}
.taxonomy-item:last-child { border-bottom: 0; }
.taxonomy-item:hover { background: #f8fafd; }
.taxonomy-item > span { min-width: 0; display: grid; gap: 2px; }
.taxonomy-item strong, .taxonomy-item small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.taxonomy-item strong { color: var(--foreground); font-size: 13px; font-weight: 500; }
.taxonomy-item small { color: var(--muted-foreground); font-size: 11px; }
.taxonomy-item input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.taxonomy-item i { width: 38px; height: 22px; position: relative; border: 1px solid #80868b; border-radius: 999px; background: #fff; transition: border-color .15s ease, background-color .15s ease; }
.taxonomy-item i::after { content: ""; width: 16px; height: 16px; position: absolute; left: 2px; top: 2px; border-radius: 50%; background: #80868b; transition: transform .15s ease, background-color .15s ease; }
.taxonomy-item input:checked + i { border-color: var(--primary); background: var(--primary); }
.taxonomy-item input:checked + i::after { background: #fff; transform: translateX(16px); }
.taxonomy-item:has(input:not(:checked)) > span { opacity: .6; }
.taxonomy-item:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: -3px; }

/* Timeline */
.timeline-guide { color: var(--muted-foreground); font: 600 11px var(--body); letter-spacing: .02em; }
.timeline-item { border-color: var(--border-token); border-radius: 10px; background: #fff; box-shadow: none; }
.timeline-time { color: var(--primary); }
.timeline-title { color: var(--foreground); font-weight: 600; }
.timeline-station { color: var(--muted-foreground); }

/* Media dialog */
.media-dialog {
  border: 1px solid var(--border-token);
  border-radius: 14px;
  background: #fff;
  color: var(--foreground);
  box-shadow: var(--shadow-lg);
}
.media-dialog::backdrop { background: rgba(32, 33, 36, .56); backdrop-filter: none; }
.media-dialog.transcript-only { width: min(760px, calc(100vw - 40px)); height: min(720px, calc(100dvh - 40px)); }
.media-dialog.transcript-only .media-workbench { grid-template-columns: 1fr; }
.media-dialog.transcript-only .player-column { display: none; }
.media-dialog.transcript-only .transcript-desk { height: 100%; min-height: 0; }
.media-dialog-head { border-color: var(--border-token); background: #fff; }
.media-dialog-head h2 { color: var(--foreground); font-size: 20px; font-weight: 600; }
.media-dialog-head p { color: var(--muted-foreground); }
.media-close { border-radius: 50%; background: var(--muted-surface); color: #3c4043; }
.media-close:hover { background: #e0e0e0; color: var(--foreground); }
.player-column { background: #202124; }
.media-stage { background: #202124; }
.media-loading { color: #e8eaed; font: 500 12px var(--body); letter-spacing: 0; text-transform: none; }
.media-note { display: none; }
.clip-desk, .media-note { border-color: #3c4043; background: #292a2d; }
.clip-desk input { border-color: #5f6368; background: #202124; color: #fff; }
.clip-desk button { border-color: #80868b; border-radius: 18px; background: transparent; color: #e8eaed; font-size: 12px; font-weight: 600; }
.clip-desk .clip-play { border-color: #8ab4f8; background: #8ab4f8; color: #202124; }
.transcript-desk { background: #fff; }
.transcript-desk > input { font-size: 12px; }
.transcript-head h3 { color: var(--foreground); font-weight: 600; }
.transcript-line { border-color: var(--border-token); border-radius: 8px; background: #fff; color: #3c4043; font-size: 12px; }
.transcript-line:hover, .transcript-line.active { border-color: var(--primary); background: var(--accent); }
.transcript-time { color: var(--primary); }
.toast { border-radius: 8px; background: #3c4043; color: #fff; box-shadow: var(--shadow-lg); }
.toast.error { background: #b3261e; }

@media (max-width: 1180px) {
  .site-header { grid-template-columns: 220px minmax(180px, 1fr) auto; }
  .app-frame { grid-template-columns: 220px minmax(0, 1fr); }
  .search-layout { grid-template-columns: 300px minmax(0, 1fr); }
  .result-card.has-thumbnail { grid-template-columns: 140px minmax(0, 1fr) 116px; }
}

@media (max-width: 920px) {
  .site-header { grid-template-columns: 48px minmax(0, 1fr) auto; padding: 0 10px; }
  .mobile-nav-toggle { display: grid; place-items: center; border-color: var(--border-token); background: #fff; color: #3c4043; }
  .brand-word { display: none; }
  .header-context { padding: 0 12px; }
  .app-frame { display: block; }
  .workspace-nav {
    top: 64px;
    width: min(320px, 86vw);
    height: calc(100dvh - 64px);
    padding: 16px 12px max(20px, env(safe-area-inset-bottom));
    box-shadow: var(--shadow-lg);
  }
  .sidebar-mobile-head { display: flex; }
  .sidebar-mobile-head .brand-wordmark { color: #3c4043; font-size: 22px; }
  .nav-overlay { inset: 64px 0 0; background: rgba(32, 33, 36, .42); backdrop-filter: none; }
  .content-area { padding: 20px; }
  .search-layout, .datetime-layout { grid-template-columns: 1fr; }
  .filter-rail { min-height: 0; border-right: 0; border-bottom: 1px solid var(--border-token); }
  .search-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .query-block, .form-actions, .recent-block { grid-column: 1 / -1; }
  .results-pane { padding: 20px; }
  .watchlist-layout, .admin-layout, .settings-layout { grid-template-columns: 1fr; }
  .taxonomy-grid { grid-template-columns: 1fr; }
  .result-card.has-thumbnail { grid-template-columns: 140px minmax(0, 1fr); }
  .result-card.has-thumbnail .result-actions { grid-column: 1 / -1; }
  .result-actions { flex-direction: row; flex-wrap: wrap; }
  .result-actions > * { width: auto; padding-inline: 16px; }
}

@media (max-width: 680px) {
  .site-header { height: 60px; grid-template-columns: 46px minmax(0, 1fr) 46px; padding: 0 8px; }
  .header-context { padding: 0 10px; }
  .header-context h1 { overflow: hidden; font-size: 18px; text-overflow: ellipsis; white-space: nowrap; }
  .header-status { height: 60px; padding: 0; }
  .account-trigger { min-width: 42px; min-height: 42px; padding: 3px; }
  .account-trigger > span:last-of-type, .account-trigger > svg { display: none; }
  .workspace-nav { top: 60px; height: calc(100dvh - 60px); }
  .nav-overlay { inset: 60px 0 0; }
  .content-area { padding: 12px; }
  .view-bar { min-height: 56px; padding: 0 16px; border-radius: 10px 10px 0 0; }
  .view-bar strong { font-size: 15px; }
  .catalog-readout { display: none; }
  .search-layout { border-radius: 0 0 10px 10px; }
  .mobile-filter-head { display: flex; min-height: 52px; padding: 0 16px; border-bottom: 1px solid var(--border-token); background: #fff; }
  .mobile-filter-head span { font-size: 13px; font-weight: 600; }
  .mobile-filter-head button { min-height: 40px; color: var(--primary); font-size: 13px; font-weight: 600; }
  .filter-rail:not(.filters-open) .filter-group,
  .filter-rail:not(.filters-open) .recent-block,
  .filter-rail:not(.filters-open) .selected-station { display: none; }
  .search-form { grid-template-columns: 1fr; }
  .query-block, .form-actions { grid-column: auto; }
  .query-block { padding: 16px; }
  .form-actions { padding: 12px 16px; }
  .filter-group > summary { padding: 0 16px; }
  .filter-content { padding: 4px 16px 18px; }
  .results-pane { padding: 16px; }
  .result-toolbar { align-items: flex-start; flex-direction: column; gap: 14px; }
  .result-toolbar h2 { font-size: 20px; }
  .result-controls { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .result-controls .result-count { grid-column: 1 / -1; justify-self: start; }
  .result-insights { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
  .result-insights::-webkit-scrollbar { display: none; }
  .insight-card { min-width: 142px; min-height: 72px; }
  .result-card, .result-card.has-thumbnail { grid-template-columns: 1fr; gap: 14px; padding: 16px; }
  .result-visual { width: min(220px, 100%); }
  .result-actions { grid-column: 1; }
  .result-actions > * { flex: 1 1 120px; }
  .result-metrics { flex-wrap: wrap; }
  .result-metric { padding-right: 0; border-right: 0; }
  .transcript-panel { grid-column: 1; }
  .watchlist-layout, .admin-layout, .settings-layout { padding: 20px 16px; }
  .settings-card, .stack-form, .watchlist-form { padding: 20px 16px; }
  .watchlist-form { width: 100%; margin-top: 12px; }
  .taxonomy-head { grid-template-columns: 1fr; gap: 18px; padding: 20px 16px; }
  .taxonomy-grid { padding: 10px; }
  .taxonomy-group > summary { grid-template-columns: 16px minmax(0, 1fr); }
  .taxonomy-bulk { grid-column: 2; width: 100%; }
  .taxonomy-bulk button { min-height: 40px; flex: 1; }
  .taxonomy-list { max-height: none; overflow-y: visible; }
  .media-dialog {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    inset: 0;
    border: 0;
    border-radius: 0;
  }
  .media-dialog.transcript-only { width: 100vw; height: 100dvh; max-height: 100dvh; }
  .media-dialog-head { min-height: 72px; padding: max(10px, env(safe-area-inset-top)) 12px 10px; }
  .media-workbench { display: block; height: calc(100dvh - 72px); overflow-y: auto; overscroll-behavior: contain; }
  .player-column { overflow: visible; }
  .media-stage { min-height: 230px; }
  .clip-desk { min-height: 0; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; padding: 16px; }
  .clip-desk > div, .clip-desk .clip-play { grid-column: 1 / -1; }
  .clip-desk input, .clip-desk button { width: 100%; min-height: 44px; }
  .transcript-desk { min-height: 420px; overflow: visible; padding: 16px; }
  .media-dialog.transcript-only .transcript-desk { min-height: calc(100dvh - 72px); }
}

@media (max-width: 480px) {
  .auth-screen { background: #fff; }
  .auth-shell {
    min-height: 100dvh;
    align-items: flex-start;
    justify-content: flex-start;
    padding: max(24px, env(safe-area-inset-top)) 20px max(32px, env(safe-area-inset-bottom));
  }
  .auth-panel {
    width: 100%;
    min-height: 0;
    display: block;
    justify-content: initial;
    margin: 0;
    padding: 8px 0 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .auth-brand { margin-bottom: 32px; }
  .auth-panel h1 { margin-bottom: 24px; font-size: 26px; }
  .auth-tabs { margin-bottom: 24px; }
  .auth-form { gap: 18px; }
  .auth-form input { min-height: 48px; }
  .auth-form .primary-button { min-height: 48px; }
  .form-grid { grid-template-columns: 1fr; }
  .settings-actions { align-items: stretch; flex-direction: column; }
  .settings-actions > * { width: 100%; }
  .watch-item, .member-item { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
