:root {
  color-scheme: light;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-subtle: #f1f5f9;
  --surface-muted: #f8fafc;
  --surface-hover: #f1f5f9;
  --header-bg: rgba(255, 255, 255, 0.88);
  --line: #e2e8f0;
  --line-subtle: #eef2f6;
  --line-strong: #cbd5e1;
  --text: #0f172a;
  --text-secondary: #334155;
  --muted: #64748b;
  --placeholder: #94a3b8;
  --brand: #2563eb;
  --brand-hover: #1d4ed8;
  --brand-soft: #eff6ff;
  --brand-border: #bfdbfe;
  --success: #059669;
  --success-soft: #ecfdf5;
  --success-border: #a7f3d0;
  --success-text: #065f46;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --danger-border: #fecaca;
  --danger-text: #991b1b;
  --live: #e11d48;
  --live-soft: #fff1f2;

  /* Programme card shades - Light */
  --prog-bg: #f8fafc;
  --prog-bg-hover: #ffffff;
  --prog-border: #e2e8f0;
  --prog-border-hover: #94a3b8;
  --prog-accent: #64748b;

  --prog-live-bg: #eff6ff;
  --prog-live-bg-hover: #e0f2fe;
  --prog-live-border: #bfdbfe;
  --prog-live-accent: #2563eb;

  --prog-movie-bg: #faf5ff;
  --prog-movie-bg-hover: #f3e8ff;
  --prog-movie-border: #e9d5ff;
  --prog-movie-accent: #9333ea;

  --prog-news-bg: #f0f9ff;
  --prog-news-bg-hover: #e0f2fe;
  --prog-news-border: #bae6fd;
  --prog-news-accent: #0284c7;

  --prog-sports-bg: #fff7ed;
  --prog-sports-bg-hover: #ffedd5;
  --prog-sports-border: #fed7aa;
  --prog-sports-accent: #ea580c;

  --prog-sub-bg: #ecfdf5;
  --prog-sub-bg-hover: #d1fae5;
  --prog-sub-border: #a7f3d0;
  --prog-sub-accent: #059669;

  /* 18+ Adult Channel List Highlight - Light */
  --adult-bg: #fff1f2;
  --adult-bg-hover: #ffe4e6;
  --adult-border: #fecdd3;
  --adult-accent: #e11d48;
  --adult-badge-bg: #ffe4e6;
  --adult-badge-text: #be123c;

  /* Timeline Country Group Header - Light */
  --group-header-bg: linear-gradient(90deg, #e0e7ff 0%, #eef2ff 55%, #f8fafc 100%);
  --group-header-border: #c7d2fe;
  --group-header-text: #1e3a8a;
  --group-header-accent: #4f46e5;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 20px 40px rgba(15, 23, 42, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b1120;
    --surface: #111827;
    --surface-subtle: #1e293b;
    --surface-muted: #0f172a;
    --surface-hover: #1e293b;
    --header-bg: rgba(17, 24, 39, 0.88);
    --line: #1e293b;
    --line-subtle: #172033;
    --line-strong: #334155;
    --text: #f1f5f9;
    --text-secondary: #cbd5e1;
    --muted: #94a3b8;
    --placeholder: #64748b;
    --brand: #3b82f6;
    --brand-hover: #2563eb;
    --brand-soft: rgba(59, 130, 246, 0.15);
    --brand-border: rgba(96, 165, 250, 0.35);
    --success: #10b981;
    --success-soft: rgba(16, 185, 129, 0.15);
    --success-border: rgba(52, 211, 153, 0.32);
    --success-text: #a7f3d0;
    --danger: #f87171;
    --danger-soft: rgba(239, 68, 68, 0.15);
    --danger-border: rgba(248, 113, 113, 0.32);
    --danger-text: #fecaca;
    --live: #fb7185;
    --live-soft: rgba(244, 63, 94, 0.16);

    /* Programme card shades - Dark */
    --prog-bg: #172033;
    --prog-bg-hover: #1e293b;
    --prog-border: #26354d;
    --prog-border-hover: #475569;
    --prog-accent: #64748b;

    --prog-live-bg: rgba(37, 99, 235, 0.2);
    --prog-live-bg-hover: rgba(37, 99, 235, 0.28);
    --prog-live-border: rgba(96, 165, 250, 0.36);
    --prog-live-accent: #60a5fa;

    --prog-movie-bg: rgba(147, 51, 234, 0.18);
    --prog-movie-bg-hover: rgba(147, 51, 234, 0.26);
    --prog-movie-border: rgba(192, 132, 252, 0.32);
    --prog-movie-accent: #c084fc;

    --prog-news-bg: rgba(2, 132, 199, 0.18);
    --prog-news-bg-hover: rgba(2, 132, 199, 0.26);
    --prog-news-border: rgba(56, 189, 248, 0.32);
    --prog-news-accent: #38bdf8;

    --prog-sports-bg: rgba(234, 88, 12, 0.18);
    --prog-sports-bg-hover: rgba(234, 88, 12, 0.26);
    --prog-sports-border: rgba(251, 146, 60, 0.32);
    --prog-sports-accent: #fb923c;

    --prog-sub-bg: rgba(5, 150, 105, 0.2);
    --prog-sub-bg-hover: rgba(5, 150, 105, 0.28);
    --prog-sub-border: rgba(52, 211, 153, 0.35);
    --prog-sub-accent: #34d399;

    /* 18+ Adult Channel List Highlight - Dark */
    --adult-bg: rgba(225, 29, 72, 0.12);
    --adult-bg-hover: rgba(225, 29, 72, 0.2);
    --adult-border: rgba(251, 113, 133, 0.28);
    --adult-accent: #fb7185;
    --adult-badge-bg: rgba(225, 29, 72, 0.25);
    --adult-badge-text: #fda4af;

    /* Timeline Country Group Header - Dark */
    --group-header-bg: linear-gradient(90deg, rgba(79, 70, 229, 0.28) 0%, rgba(30, 41, 59, 0.9) 60%, rgba(15, 23, 42, 0.95) 100%);
    --group-header-border: rgba(129, 140, 248, 0.3);
    --group-header-text: #e0e7ff;
    --group-header-accent: #818cf8;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 20px 44px rgba(0, 0, 0, 0.6);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1120;
  --surface: #111827;
  --surface-subtle: #1e293b;
  --surface-muted: #0f172a;
  --surface-hover: #1e293b;
  --header-bg: rgba(17, 24, 39, 0.88);
  --line: #1e293b;
  --line-subtle: #172033;
  --line-strong: #334155;
  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --muted: #94a3b8;
  --placeholder: #64748b;
  --brand: #3b82f6;
  --brand-hover: #2563eb;
  --brand-soft: rgba(59, 130, 246, 0.15);
  --brand-border: rgba(96, 165, 250, 0.35);
  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.15);
  --success-border: rgba(52, 211, 153, 0.32);
  --success-text: #a7f3d0;
  --danger: #f87171;
  --danger-soft: rgba(239, 68, 68, 0.15);
  --danger-border: rgba(248, 113, 113, 0.32);
  --danger-text: #fecaca;
  --live: #fb7185;
  --live-soft: rgba(244, 63, 94, 0.16);

  /* Programme card shades - Dark */
  --prog-bg: #172033;
  --prog-bg-hover: #1e293b;
  --prog-border: #26354d;
  --prog-border-hover: #475569;
  --prog-accent: #64748b;

  --prog-live-bg: rgba(37, 99, 235, 0.2);
  --prog-live-bg-hover: rgba(37, 99, 235, 0.28);
  --prog-live-border: rgba(96, 165, 250, 0.36);
  --prog-live-accent: #60a5fa;

  --prog-movie-bg: rgba(147, 51, 234, 0.18);
  --prog-movie-bg-hover: rgba(147, 51, 234, 0.26);
  --prog-movie-border: rgba(192, 132, 252, 0.32);
  --prog-movie-accent: #c084fc;

  --prog-news-bg: rgba(2, 132, 199, 0.18);
  --prog-news-bg-hover: rgba(2, 132, 199, 0.26);
  --prog-news-border: rgba(56, 189, 248, 0.32);
  --prog-news-accent: #38bdf8;

  --prog-sports-bg: rgba(234, 88, 12, 0.18);
  --prog-sports-bg-hover: rgba(234, 88, 12, 0.26);
  --prog-sports-border: rgba(251, 146, 60, 0.32);
  --prog-sports-accent: #fb923c;

  --prog-sub-bg: rgba(5, 150, 105, 0.2);
  --prog-sub-bg-hover: rgba(5, 150, 105, 0.28);
  --prog-sub-border: rgba(52, 211, 153, 0.35);
  --prog-sub-accent: #34d399;

  /* 18+ Adult Channel List Highlight - Dark */
  --adult-bg: rgba(225, 29, 72, 0.12);
  --adult-bg-hover: rgba(225, 29, 72, 0.2);
  --adult-border: rgba(251, 113, 133, 0.28);
  --adult-accent: #fb7185;
  --adult-badge-bg: rgba(225, 29, 72, 0.25);
  --adult-badge-text: #fda4af;

  /* Timeline Country Group Header - Dark */
  --group-header-bg: linear-gradient(90deg, rgba(79, 70, 229, 0.28) 0%, rgba(30, 41, 59, 0.9) 60%, rgba(15, 23, 42, 0.95) 100%);
  --group-header-border: rgba(129, 140, 248, 0.3);
  --group-header-text: #e0e7ff;
  --group-header-accent: #818cf8;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 20px 44px rgba(0, 0, 0, 0.6);
}

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

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Header & Navigation */
header#appChrome {
  position: sticky;
  top: 0;
  z-index: 20;
  width: min(1680px, calc(100% - 36px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 18px;
  background: var(--header-bg);
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  box-shadow: var(--shadow-xs);
  backdrop-filter: blur(12px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--brand);
  color: #ffffff;
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: -0.03em;
}

header strong {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

header .brand-tagline {
  font-size: 12px;
  color: var(--muted);
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.main-nav button {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 7px;
  box-shadow: none;
}

.main-nav button:hover {
  color: var(--text);
  background: var(--surface-hover);
  border-color: transparent;
}

.main-nav button.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  border-color: var(--line);
  box-shadow: var(--shadow-xs);
}

/* Top Bar Right Cluster: Theme Switcher + Stylized User Email Chip */
.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-Segment {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.05);
}

.theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 999px;
  box-shadow: none;
  line-height: 1;
  cursor: pointer;
  transition: color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease, transform 0.1s ease;
}

.theme-icon {
  width: 14px;
  height: 14px;
  flex: none;
}

.theme-btn:hover {
  color: var(--text);
  background: transparent;
}

.theme-btn:active {
  transform: scale(0.95);
}

.theme-btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.theme-btn.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

.theme-btn.active .theme-icon {
  color: var(--brand);
}

#account {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12.5px;
  cursor: pointer;
  box-shadow: none;
  transition: border-color 0.15s, background-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.user-chip:hover {
  background: var(--surface);
  border-color: var(--brand-border);
  box-shadow: var(--shadow-xs);
}

.user-chip.active {
  background: var(--brand-soft);
  border-color: var(--brand-border);
  color: var(--brand);
}

.user-name {
  font-weight: 600;
  font-size: 12.5px;
  color: inherit;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-chip-chevron {
  width: 14px;
  height: 14px;
  flex: none;
  color: var(--muted);
  transition: transform 0.18s ease, color 0.15s ease;
}

.user-chip.active .user-chip-chevron {
  transform: rotate(180deg);
  color: var(--brand);
}

.signout-btn {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  box-shadow: none;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background-color 0.15s;
}

.signout-btn:hover {
  color: var(--danger);
  border-color: var(--danger-border);
  background: var(--danger-soft);
}

.signout-btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* Search Shell */
.search-shell {
  width: min(1680px, calc(100% - 36px));
  margin: 12px auto 0;
  padding: 0;
}

.search-shell .global-search {
  width: 100%;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}

.search-shell .global-search:focus-within {
  background: var(--surface);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.global-search .search-icon {
  font-size: 15px;
  color: var(--muted);
  user-select: none;
}

.global-search input {
  border: 0;
  padding: 4px 2px;
  background: transparent;
  font-size: 13.5px;
  color: var(--text);
  box-shadow: none;
}

.global-search input:focus {
  outline: 0;
  box-shadow: none;
}

.global-search .search-shortcut {
  font-size: 11px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.global-search button {
  padding: 4px 10px;
  font-size: 12px;
}

/* Buttons & Inputs */
button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 7px 13px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow-xs);
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

button:hover,
.btn:hover {
  background: var(--surface-subtle);
  border-color: var(--muted);
}

button:active,
.btn:active {
  transform: translateY(0.5px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button.primary,
.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

button.primary:hover,
.btn-primary:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
}

button.subtle {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  box-shadow: none;
}

button.subtle:hover {
  background: var(--surface-subtle);
  color: var(--text);
}

button.danger-outline {
  color: var(--danger);
  border-color: var(--danger-border);
  background: var(--surface);
}

button.danger-outline:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  background-color: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  line-height: 1.35;
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  resize: vertical;
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%2364748b' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 12px 12px;
  cursor: pointer;
}

input::placeholder {
  color: var(--placeholder);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

input[readonly] {
  background: var(--surface-subtle);
  color: var(--muted);
  cursor: default;
}

/* Layout & Typography */
main {
  width: min(1680px, calc(100% - 36px));
  margin: 0 auto;
  padding: 16px 0 48px;
}

.muted,
p {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
}

h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--text);
}

h2 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 20px 0 6px;
  color: var(--text);
}

h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--text);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin: 12px 0;
  box-shadow: var(--shadow-xs);
}

/* Auth Card */
.auth-landing {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 460px);
  align-items: center;
  gap: clamp(28px, 5vw, 80px);
  max-width: 1440px;
  margin: 5vh auto;
  padding: 24px;
}
.landing-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 36px; font-size: 22px; letter-spacing: -0.03em; }
.landing-brand .brand-mark { width: 38px; height: 38px; font-size: 15px; border-radius: 11px; }
.landing-hero > .eyebrow { margin-bottom: 12px; }
.landing-hero > h1 { font-size: clamp(34px, 3.7vw, 54px); line-height: 1.12; letter-spacing: -0.045em; }
.landing-hero > h1 span { color: var(--brand); }
.landing-intro { font-size: 16px; line-height: 1.7; max-width: 580px; margin: 20px 0 28px; }
.landing-guide { padding: 18px; border: 1px solid var(--brand-border); border-radius: 18px; background: linear-gradient(125deg, var(--brand-soft), var(--surface)); box-shadow: var(--shadow-md); }
.landing-guide-head, .landing-guide-row { display: grid; grid-template-columns: 110px minmax(0, 1.2fr) minmax(0, 1fr); gap: 8px; align-items: center; font-size: 12px; }
.landing-guide-head { color: var(--muted); padding: 0 0 12px; }
.landing-guide-row { margin-top: 8px; }
.landing-guide-row > strong { font-size: 12px; }
.landing-show { padding: 13px 10px; border: 1px solid var(--line); border-left: 3px solid var(--brand); border-radius: 7px; background: var(--surface); color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.landing-show.movie { border-left-color: var(--prog-movie-accent); background: var(--prog-movie-bg); }
.landing-show.science { border-left-color: var(--success); }
.landing-features { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 22px; margin-top: 30px; }
.landing-features > div { position: relative; padding-left: 32px; }
.landing-features > div > span { position: absolute; left: 0; top: 0; color: var(--brand); font-size: 21px; }
.landing-features h3 { font-size: 13px; margin: 0 0 5px; }
.landing-features p { margin: 0; font-size: 12.5px; line-height: 1.5; }
.auth-entry { padding: 30px; margin: 0; box-shadow: var(--shadow-lg); border-top: 3px solid var(--brand); }
.auth-entry > h2 { font-size: 25px; line-height: 1.25; letter-spacing: -0.03em; margin: 14px 0 8px; }
.auth-entry > p { margin: 0 0 18px; line-height: 1.6; }
.auth-entry .auth-panel { display: grid; gap: 14px; }
.auth-entry .auth-panel > p { margin: 0; }
.auth-entry .auth-panel > button.primary { padding: 10px 14px; }
.auth-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.narrow {
  max-width: 420px;
  margin: 7vh auto;
  padding: 28px;
  box-shadow: var(--shadow-md);
}

.narrow h1 {
  font-size: 24px;
  margin-bottom: 4px;
}

.narrow > p {
  margin: 0 0 16px;
  font-size: 13.5px;
}

.auth-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 18px 0;
  padding: 0 0 10px;
  border-radius: 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
}
.registration-setting-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 20px; background: var(--surface-muted); border: 1px solid var(--line); border-radius: var(--radius); }
.registration-setting-copy { display: grid; gap: 5px; cursor: pointer; }
.registration-setting-copy strong { font-size: 14px; color: var(--text); }
.registration-setting-copy span { font-size: 13px; color: var(--muted); }
.registration-setting-control { display: flex; align-items: center; gap: 12px; flex-shrink: 0; font-size: 12px; }
.registration-setting-row.is-open { border-color: var(--brand); background: var(--brand-soft); box-shadow: var(--shadow-xs); }
.registration-setting-row .source-toggle { flex-shrink: 0; }
.registration-setting-row .status-badge { font-size: 11px; white-space: nowrap; }
.source-toggle input:focus-visible + .source-toggle-slider { outline: 3px solid var(--brand-border); outline-offset: 3px; }

.auth-tab { color: var(--muted); font-weight: 500; }

.auth-tab:hover {
  background: var(--surface-muted);
  border-color: transparent;
  color: var(--text);
}

.auth-tab.active {
  background: var(--brand-soft);
  border-color: transparent;
  color: var(--brand);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--brand);
}

.auth-tabs button.auth-tab { font-size: 13px; padding: 7px 12px; }

.auth-inline-link { margin: 0; text-align: center; }
.text-link {
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  color: var(--brand);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.text-link:hover { background: none; border-color: transparent; box-shadow: none; text-decoration: underline; }

.narrow form,
.dialog-form {
  display: grid;
  gap: 14px;
}

.auth-panel label,
.profile-form label,
.dialog-form label {
  display: grid;
  gap: 5px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.auth-demo-hint {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

.auth-demo-hint code {
  color: var(--text);
  font-weight: 600;
}

/* Toolbars */
.toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.guide-toolbar {
  position: sticky;
  top: 74px;
  z-index: 15;
  padding: 12px 18px;
  margin-bottom: 16px;
  background: var(--header-bg);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.guide-header-meta {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

#rangeLabel {
  margin: 0;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
}

.guide-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-pills {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.filter-pill {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: 7px;
  box-shadow: none;
}

.filter-pill:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.filter-pill.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

.guide-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-group {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.btn-group button {
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  padding: 7px 12px;
}

.btn-group button:last-child {
  border-right: 0;
}

.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--live);
}

/* Global Search Results */
.global-results {
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.global-results header {
  position: static;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--line);
}

.global-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1px;
  background: var(--line);
}

.global-result {
  border: 0;
  border-radius: 0;
  background: var(--surface);
  text-align: left;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  box-shadow: none;
}

.global-result:hover {
  background: var(--brand-soft);
}

.global-result h3 {
  margin: 0;
  font-size: 14px;
  color: var(--text);
}

.global-result .result-meta {
  font-size: 12px;
  font-weight: 500;
  color: var(--brand);
  margin: 0;
}

.global-result p {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.4;
}

/* Timeline Grid */
.timeline {
  overflow: clip;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.timeline-grid {
  position: relative;
  width: 100%;
}

.time-head,
.channel-row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  width: 100%;
}

.timeline-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--group-header-bg);
  border-top: 1px solid var(--group-header-border);
  border-bottom: 1px solid var(--group-header-border);
  border-left: 3.5px solid var(--group-header-accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--group-header-text);
}

.timeline-group-header .group-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.country-flag {
  display: inline-block;
  width: 18px;
  height: 13px;
  border-radius: 2.5px;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.16);
  flex-shrink: 0;
  vertical-align: middle;
}
.adult-category-flag { box-shadow: 0 0 0 1px rgba(127, 29, 29, 0.28); }

.country-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.timeline-group-header .group-right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.timeline-group-header span.group-count {
  font-weight: 600;
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--group-header-text);
  opacity: 0.8;
}

.group-hide-btn {
  padding: 2px 8px;
  height: 22px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 5px;
  border: 1px solid var(--group-header-border);
  background: var(--surface);
  color: var(--group-header-text);
  box-shadow: none;
  text-transform: none;
  letter-spacing: 0;
}

.group-hide-btn:hover {
  background: var(--danger-soft);
  border-color: var(--danger-border);
  color: var(--danger);
}

/* Interest (child) header inside a country (parent) header. */
.timeline-subgroup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 16px 5px 34px;
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--group-header-border);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.timeline-subgroup-header .group-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.timeline-subgroup-header .group-right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.timeline-subgroup-header span.group-count {
  font-weight: 600;
  font-size: 10.5px;
  text-transform: none;
  letter-spacing: 0;
  opacity: 0.75;
}

.time-head {
  position: sticky;
  top: 0;
  z-index: 6;
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--line);
}

.time-head .channel-name {
  background: var(--surface-subtle);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 16px;
}

.time-ruler {
  position: relative;
  height: 42px;
  background: var(--surface-subtle);
  overflow: hidden;
}

.time-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  padding: 9px 0 0 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  border-left: 1px solid var(--line-strong);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.time-tick.half-tick {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  border-left: 1px solid var(--line);
}

.time-tick.minor-tick {
  top: auto;
  bottom: 0;
  height: 8px;
  padding: 0;
  border-left: 1px solid var(--line-strong);
  opacity: 0.7;
  pointer-events: none;
}

.time-tick.end-tick {
  right: 6px;
  left: auto !important;
  border-left: 0;
  padding-left: 0;
}

.channel-row {
  min-height: 74px;
  border-bottom: 1px solid var(--line-subtle);
  transition: background-color 0.1s;
}

.channel-row:last-child {
  border-bottom: 0;
}

.channel-row:hover .track,
.channel-row:hover .channel-name {
  background-color: var(--surface-muted);
}

.channel-name {
  position: sticky;
  left: 0;
  z-index: 4;
  padding: 12px 16px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
}

.channel-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.channel-logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--surface-subtle);
}

.guide-channel-logo {
  position: relative;
  display: inline-flex;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
}
.guide-channel-logo .channel-logo {
  position: absolute;
  inset: 0;
  width: 32px;
  height: 32px;
  z-index: 1;
  background: var(--surface);
}
.channel-logo-placeholder {
  display: inline-flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.guide-channel-logo:has(img:not([hidden])) .channel-logo-placeholder { visibility: hidden; }

.channel-name small {
  font-weight: 400;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track {
  position: relative;
  min-height: 74px;
  overflow: hidden;
  background-color: var(--surface);
  background-image: repeating-linear-gradient(
    90deg,
    transparent 0,
    transparent calc(100% / 6 - 1px),
    var(--line-subtle) calc(100% / 6 - 1px),
    var(--line-subtle) calc(100% / 6)
  );
}

/* Programme Blocks (Theme-Adaptive Shades) */
.programme {
  position: absolute;
  top: 7px;
  height: 60px;
  overflow: hidden;
  text-align: left;
  padding: 7px 10px;
  border: 1px solid var(--prog-border);
  border-left: 3px solid var(--prog-accent);
  border-radius: 7px;
  background: var(--prog-bg);
  color: var(--text);
  box-shadow: var(--shadow-xs);
  font-size: 12.5px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 2px;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease, background-color 0.12s ease;
}

.programme.clipped-left {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.programme.clipped-right {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: 0;
}

.programme:hover {
  z-index: 3;
  transform: translateY(-1px);
  background: var(--prog-bg-hover);
  border-color: var(--prog-border-hover);
  box-shadow: var(--shadow-sm);
}

.programme strong {
  display: block;
  width: 100%;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.programme-time {
  display: block;
  width: 100%;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.programme.live {
  background: var(--prog-live-bg);
  border-color: var(--prog-live-border);
  border-left-color: var(--prog-live-accent);
}

.programme.live:hover {
  background: var(--prog-live-bg-hover);
}

.programme.movie {
  background: var(--prog-movie-bg);
  border-color: var(--prog-movie-border);
  border-left-color: var(--prog-movie-accent);
}

.programme.movie:hover {
  background: var(--prog-movie-bg-hover);
}

.programme.news {
  background: var(--prog-news-bg);
  border-color: var(--prog-news-border);
  border-left-color: var(--prog-news-accent);
}

.programme.news:hover {
  background: var(--prog-news-bg-hover);
}

.programme.sports {
  background: var(--prog-sports-bg);
  border-color: var(--prog-sports-border);
  border-left-color: var(--prog-sports-accent);
}

.programme.sports:hover {
  background: var(--prog-sports-bg-hover);
}

.programme.subscribed {
  background: var(--prog-sub-bg);
  border-color: var(--prog-sub-border);
  border-left-color: var(--prog-sub-accent);
}

.programme.subscribed:hover {
  background: var(--prog-sub-bg-hover);
}

.programme-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2.5px;
  background: var(--brand);
  opacity: 0.85;
}

.live-pill {
  display: inline-block;
  padding: 0 5px;
  margin-right: 4px;
  border-radius: 4px;
  background: var(--brand);
  color: #ffffff;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  vertical-align: 1px;
}

.timeline-now {
  position: absolute;
  z-index: 5;
  top: 42px;
  bottom: 0;
  width: 1.5px;
  background: var(--live);
  pointer-events: none;
}

.now-label {
  position: absolute;
  z-index: 7;
  top: 12px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--live);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  transform: translateX(-50%);
  box-shadow: var(--shadow-xs);
}

/* Sources & Channels View */
.channels-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(300px, 0.95fr);
  gap: 24px;
  align-items: start;
  margin-top: 8px;
}

.channels-main-col {
  min-width: 0;
}

.channels-sidebar {
  position: sticky;
  top: 74px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sources-card {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sources-sidebar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sources-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.source {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: opacity 0.15s, background-color 0.15s;
}

.source.is-disabled {
  opacity: 0.6;
}

.source-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
  cursor: pointer;
}

.source-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.source-toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--line-strong);
  border-radius: 999px;
  transition: background-color 0.18s;
}

.source-toggle-slider::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  top: 3px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 0.18s;
}

.source-toggle input:checked + .source-toggle-slider {
  background: var(--brand);
}

.source-toggle input:checked + .source-toggle-slider::before {
  transform: translateX(16px);
}

.source-info {
  min-width: 0;
  flex: 1;
}

.source-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.source-info strong {
  font-size: 13.5px;
  color: var(--text);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-subtle);
  color: var(--muted);
}

.status-badge.ok {
  background: var(--success-soft);
  color: var(--success);
}

.status-badge.err {
  background: var(--danger-soft);
  color: var(--danger);
}

.source-url {
  display: block;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.source-meta {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}

.source-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.lineup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 0;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}

.lineup-header h2 {
  margin: 0;
}

.lineup-header p {
  margin: 2px 0 0;
  font-size: 13px;
}

.lineup-actions {
  display: flex;
  align-items: stretch;
  flex: 1 1 100%;
  width: 100%;
  min-width: 0;
  gap: 8px;
  flex-wrap: wrap;
}

.lineup-actions select {
  flex: 1 1 140px;
  width: 0;
  min-width: 0;
}

.lineup-actions input {
  flex: 2 1 180px;
  width: 0;
  min-width: 0;
}

.lineup-actions button { flex: 1 1 100px; min-height: 34px; }

.lineup-tools-bar {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}

.lineup-tool-group {
  display: flex;
  align-items: stretch;
  flex: 1 1 180px;
  min-width: 0;
  gap: 8px;
}
.lineup-tool-group > button { flex: 1; min-height: 34px; }
.ai-adult-tools { flex-wrap: wrap; }
.ai-adult-tools .ai-adult-switch { display: inline-flex; align-items: center; gap: 9px; max-width: 360px; color: var(--text-secondary); font-size: 12px; font-weight: 500; white-space: normal; cursor: pointer; }
.ai-adult-tools .ai-adult-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ai-adult-tools .ai-adult-switch .source-toggle-slider { position: relative; inset: auto; display: inline-block; flex: 0 0 36px; width: 36px; height: 20px; }
.ai-adult-tools .ai-adult-switch .source-toggle-slider::before { transform: none; }
.ai-adult-tools .ai-adult-switch input:checked + .source-toggle-slider { background: var(--brand); }
.ai-adult-tools .ai-adult-switch input:checked + .source-toggle-slider::before { transform: translateX(16px); }
.ai-adult-tools .ai-adult-switch input:disabled + .source-toggle-slider { opacity: .45; }
.ai-adult-tools .ai-adult-switch input:focus-visible + .source-toggle-slider { outline: 3px solid var(--brand-border); outline-offset: 3px; }

.regex-strip-group {
  display: flex;
  align-items: stretch;
  flex: 3 1 400px;
  min-width: 0;
  gap: 8px;
  flex-wrap: wrap;
}

#stripTagsInput {
  flex: 2 1 180px;
  width: 0;
  min-width: 0;
  max-width: 100%;
  height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}

/* Keep the strip/reset buttons consistent with the toolbar controls. */
button.strip-tool {
  flex: 1 1 100px;
  padding: 7px 14px;
  height: 34px;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .lineup-header .lineup-actions input, .lineup-header .lineup-actions select { flex: 1 1 100%; min-width: 0; }
  .regex-strip-group { flex-basis: 100%; }
  #stripTagsInput { flex-basis: 100%; }
}

label.visibility-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 34px;
  white-space: nowrap;
  font-size: 12.5px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  padding: 0 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-muted);
}

label.visibility-toggle input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

label.visibility-toggle .source-toggle-slider {
  position: relative;
  inset: auto;
  display: inline-block;
  flex: 0 0 36px;
  width: 36px;
  height: 20px;
}

label.visibility-toggle .source-toggle-slider::before { transform: none; }
label.visibility-toggle input:checked + .source-toggle-slider { background: var(--brand); }
label.visibility-toggle input:checked + .source-toggle-slider::before { transform: translateX(16px); }
label.visibility-toggle input:focus-visible + .source-toggle-slider { outline: 3px solid var(--brand-border); outline-offset: 3px; }

label.visibility-toggle.adult-toggle {
  border-color: var(--adult-border);
  background: var(--adult-bg);
  color: var(--adult-badge-text);
  font-weight: 500;
}

.channel-categories-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.category-help { margin: 0; font-size: 12px; line-height: 1.6; }
.category-country-group {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.category-children { padding: 4px 0; }

/* Country (parent) grouping with its interest (child) rows underneath. */
.category-parent {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 12px;
  border-radius: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
  transition: opacity 0.15s, border-color 0.15s, background-color 0.15s;
}

.category-parent.is-category-hidden {
  opacity: 0.62;
}

.category-parent.is-filtered {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.category-parent.is-adult-category {
  border-color: var(--adult-border);
  background: var(--adult-bg);
}

.category-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-muted);
  transition: opacity 0.15s, border-color 0.15s, background-color 0.15s;
}

.category-row.is-category-hidden {
  opacity: 0.62;
}

.category-row.category-sub-row {
  margin: 0;
  padding: 10px 12px 10px 26px;
  background: var(--surface);
  border: 0;
  border-radius: 0;
  border-left: 3px solid transparent;
}
.category-sub-row + .category-sub-row { border-top: 1px solid var(--line-subtle); }
.category-row.category-sub-row:hover { background: var(--surface-muted); }
.category-sub-row .category-row-text strong { font-weight: 500; font-size: 12.5px; }
.category-country-group .category-row-text { gap: 4px; }
.category-country-group .category-row-text strong { overflow-wrap: anywhere; line-height: 1.35; }
.category-visible-count { color: var(--text-secondary); font-weight: 600; }
.category-country-group .category-filter-btn { min-width: 56px; min-height: 30px; flex-shrink: 0; }
.category-country-group .is-filtered { box-shadow: inset 3px 0 var(--brand); background: var(--brand-soft); }
.category-row.category-sub-row.is-filtered { background: var(--brand-soft); border-left-color: var(--brand); box-shadow: none; }
.category-checkbox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 24px;
  min-height: 30px;
  cursor: pointer;
}
.category-checkbox input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--brand);
  cursor: pointer;
}
.category-checkbox input:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
.category-checkbox:has(input:disabled), .category-checkbox input:disabled { cursor: not-allowed; }
.category-row.category-sub-row.is-country-disabled {
  opacity: 0.5;
  background: var(--surface-muted);
}
.category-country-group:focus-within { border-color: var(--brand-border); }

.category-row.is-filtered {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.category-row.is-adult-category {
  border-color: var(--adult-border);
  background: var(--adult-bg);
}

.category-row-main {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.category-row-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.category-row-text strong {
  font-size: 13px;
  color: var(--text);
}

.category-row-text small {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.category-filter-btn {
  padding: 4px 9px;
  font-size: 11.5px;
  border-radius: var(--radius-sm);
  box-shadow: none;
}

.category-filter-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

.channel-list {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.channel-row-editor {
  display: grid;
  grid-template-columns: 28px 38px minmax(280px, 320px) 160px auto auto;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line-subtle);
  border-left: 3px solid transparent;
  background: var(--surface);
  transition: background-color 0.1s;
}

.channel-row-editor:last-child {
  border-bottom: 0;
}

.channel-row-editor:hover {
  background: var(--surface-muted);
}

.channel-row-editor.adult-channel {
  background: var(--adult-bg);
  border-left-color: var(--adult-accent);
  border-bottom-color: var(--adult-border);
}

.channel-row-editor.adult-channel:hover {
  background: var(--adult-bg-hover);
}

.channel-row-editor.is-hidden {
  background: var(--surface-muted);
  opacity: 0.62;
}

.channel-row-editor.is-source-off {
  opacity: 0.55;
}

.channel-row-editor.adult-channel.is-hidden {
  background: var(--adult-bg);
  opacity: 0.55;
}

.channel-row-editor.dragging {
  opacity: 0.45;
  background: var(--brand-soft);
}

.drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  color: var(--muted);
  cursor: grab;
  font-size: 16px;
  line-height: 1;
  user-select: none;
}

.drag-handle:active {
  cursor: grabbing;
}

.channel-number {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 34px;
  padding-right: 4px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.channel-editor-main {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.channel-editor-main input {
  width: 220px;
  min-width: 220px;
  max-width: 220px;
  flex: 0 0 220px;
}

.channel-row-editor input.channel-category-input {
  width: 160px;
  min-width: 160px;
  max-width: 160px;
}

.channel-meta-row {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.country-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  padding: 0 7px;
  border-radius: 5px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.adult-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  padding: 0 7px;
  border-radius: 5px;
  background: var(--adult-badge-bg);
  border: 1px solid var(--adult-border);
  color: var(--adult-badge-text);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.adult-channel-flag-badge { gap: 5px; }

.channel-row-editor input[type="text"],
.channel-row-editor input:not([type]) {
  height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

.channel-tools {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.channel-tools button {
  height: 34px;
  width: 32px;
  padding: 0;
  font-size: 13px;
}

.channel-source {
  color: var(--muted);
  font-size: 11.5px;
}

/* Favorites View & Vertical Timeline */
.favorites-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(300px, 0.95fr);
  gap: 24px;
  align-items: start;
  margin-top: 8px;
}

.fav-timeline-col {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.fav-day-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fav-day-header {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px;
  background: var(--group-header-bg);
  border: 1px solid var(--group-header-border);
  border-left: 3.5px solid var(--group-header-accent);
  border-radius: var(--radius);
  color: var(--group-header-text);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.fav-day-header span.day-count {
  font-size: 11.5px;
  font-weight: 600;
  opacity: 0.8;
}

.fav-timeline-list {
  display: flex;
  flex-direction: column;
}

.fav-timeline-item {
  display: grid;
  grid-template-columns: 68px 28px minmax(0, 1fr);
  align-items: stretch;
}

.fav-time-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 14px 6px 14px 0;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.fav-time-start {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.fav-time-end {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}

.fav-rail-col {
  position: relative;
  display: flex;
  justify-content: center;
}

.fav-rail-col::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: var(--line-strong);
}

.fav-timeline-item:first-child .fav-rail-col::before {
  top: 20px;
}

.fav-timeline-item:last-child .fav-rail-col::before {
  bottom: calc(100% - 24px);
}

.fav-timeline-item:only-child .fav-rail-col::before {
  display: none;
}

.fav-dot {
  position: relative;
  z-index: 2;
  margin-top: 17px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--surface);
  border: 2.5px solid var(--brand);
  box-shadow: 0 0 0 3px var(--bg);
}

.fav-timeline-item.is-live .fav-dot {
  background: var(--live);
  border-color: var(--live);
}

.favorite-program {
  width: 100%;
  margin: 0 0 12px;
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 6px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.fav-timeline-item.is-live .favorite-program {
  border-color: var(--brand-border);
  background: var(--prog-live-bg);
}

.favorite-program:hover {
  background: var(--surface);
  border-color: var(--brand);
  box-shadow: var(--shadow-sm);
}

.fav-card-top {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.favorite-program h3 {
  margin: 0;
  font-size: 15px;
  color: var(--text);
}

.fav-badges {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.fav-channel-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
}

.fav-cat-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 11px;
  font-weight: 600;
}

.favorite-program .fav-desc {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.45;
}

.fav-sidebar {
  position: sticky;
  top: 74px;
}

.fav-followed-card {
  margin: 0;
}

.fav-followed-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.fav-followed-head h2 {
  margin: 0;
}

.subscription-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.subscription-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.subscription-list small {
  display: inline-block;
  padding: 2px 7px;
  margin-right: 6px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}

/* Profile & Settings View */
.updates-shell {
  width: 100%;
  min-width: 0;
}
.updates-feed { display: grid; gap: 18px; }
.update-post {
  display: grid;
  grid-template-columns: 125px minmax(0, 1fr);
  gap: 20px;
  margin: 0;
  padding: 20px;
}
.update-post-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; color: var(--muted); font-size: 12.5px; }
.update-release { background: var(--brand-soft); color: var(--brand); border: 1px solid var(--brand-border); padding: 3px 9px; border-radius: 999px; overflow-wrap: anywhere; }
.update-post-content { min-width: 0; }
.update-post-content > h2 { margin: 0 0 6px; overflow-wrap: anywhere; }
.update-byline { font-size: 12px; margin: 0 0 12px; color: var(--muted); }
.update-post-body { line-height: 1.5; font-size: 14px; overflow-wrap: anywhere; }
.update-post-body p, .update-post-body li { color: var(--text-secondary); }
.update-post-body p { margin: 0 0 12px; }
.update-post-body h3, .update-post-body h4 { margin: 16px 0 6px; }
.update-post-body h4 { font-size: 14px; font-weight: 600; }
.update-post-body ul, .update-post-body ol { padding-left: 22px; }
.update-post-body > :last-child { margin-bottom: 0; }
.update-post-actions { display: flex; gap: 8px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.update-post-actions { flex-wrap: wrap; }
.update-read-btn { margin-right: auto; }
.update-read-btn:disabled { color: var(--success); opacity: 1; border-color: var(--success-border); background: var(--success-soft); }
.nav-unread { font-weight: 700; }
.updates-pagination { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 16px 0; }
.updates-newsletter {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px;
  margin: 0 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.newsletter-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background: var(--brand-soft);
  color: var(--brand);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-sm);
  font-size: 20px;
}
.newsletter-copy { flex: 1; min-width: 0; }
.newsletter-copy h2 { margin: 0 0 6px; }
.newsletter-copy p { margin: 0; color: var(--muted); font-size: 13px; }
.newsletter-action { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.newsletter-action button { white-space: nowrap; }
.updates-newsletter.is-subscribed { border-color: var(--success-border); }
.updates-newsletter.is-subscribed .newsletter-icon { color: var(--success); border-color: var(--success-border); }
#updatePostDialog { width: min(740px, calc(100% - 32px)); }
#updatePostDialog > h2 { margin: 0 0 18px; }

.profile-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
  margin-top: 14px;
}

/* Tabbed profile: one row of blocks per tab, spanning the content width. */
#settings .profile-cards > * { grid-column: 1 / -1; }
#settings [data-section-panel] { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
#settings [data-section-panel] > .card { margin: 0; }

.profile-cards > .card {
  margin: 0;
}

.profile-form {
  display: grid;
  gap: 14px;
}

.profile-form h2,
.calendar-card h2 {
  margin: 0 0 4px;
}

.tz-row {
  display: flex;
  gap: 8px;
}

.tz-row select {
  flex: 1;
}

.tz-row button {
  flex-shrink: 0;
}

.profile-form .check,
.dialog-form .check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
}

.profile-form .check input,
.dialog-form .check input {
  width: auto;
  margin: 0;
}

.calendar-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.copy {
  display: flex;
  gap: 8px;
}

.copy button {
  flex: none;
}

.calendar-steps {
  margin: 4px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

/* Dialogs & Modals */
dialog {
  width: min(520px, calc(100% - 32px));
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-lg);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
}

.close {
  float: right;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 999px;
  border-color: transparent;
  background: var(--surface-subtle);
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  box-shadow: none;
}

.close:hover {
  background: var(--line);
  color: var(--text);
}

.program-modal {
  padding: 2px 0;
}

.program-modal h2 {
  margin: 4px 0 4px;
  font-size: 22px;
  line-height: 1.25;
}

.program-subtitle {
  margin: 0 0 12px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}

.program-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 12px 0 16px;
}

.program-meta span {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
}

.program-modal .program-description {
  margin: 0;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

.program-description p {
  margin: 0 0 10px;
  color: var(--text-secondary);
}

.program-description p:last-child {
  margin-bottom: 0;
}

.program-description ul,
.program-description ol {
  margin: 8px 0 0;
  padding-left: 20px;
}

.program-description li {
  margin-bottom: 6px;
}

.program-description li:last-child {
  margin-bottom: 0;
}

.program-description strong {
  color: var(--text);
}

.program-cast {
  margin-top: 14px;
  font-size: 13px;
}

.program-cast strong {
  color: var(--text);
}

.program-cast p {
  margin: 4px 0 0;
}

.program-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.form-error {
  min-height: 1.4em;
  color: var(--danger);
  font-size: 12.5px;
}

/* Flash Notifications */
.flash {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--success-soft);
  border: 1px solid var(--success-border);
  color: var(--success-text);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
}

.flash.error {
  background: var(--danger-soft);
  border-color: var(--danger-border);
  color: var(--danger-text);
}

.flash-action {
  margin-left: auto;
  margin-right: 10px;
  padding: 2px 8px;
  font-weight: 700;
  color: inherit;
  text-decoration: underline;
}

.empty-state {
  text-align: center;
  padding: 36px 20px;
  color: var(--muted);
}

.empty-state h3 {
  margin-bottom: 4px;
}

.empty-state p {
  margin: 0;
  font-size: 13px;
}

/* TOTP & Admin Panel */
.totp-qr-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.totp-qr-box {
  display: inline-flex;
  padding: 6px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.totp-qr-box svg {
  display: block;
  width: 148px;
  height: 148px;
}

.totp-secret-info {
  flex: 1;
  min-width: 200px;
  display: grid;
  gap: 8px;
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.admin-stat-card {
  margin: 0;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-stat-card strong {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text);
}

.admin-layout {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Tab strips: icon + label, active tab highlighted with a brand pill (see Settings tabs). */
.tab-nav button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;
  text-align: left;
}
.tab-nav button:hover { background: var(--surface-muted); border-color: transparent; color: var(--text); }
.tab-nav button.active {
  background: var(--brand-soft);
  border-color: transparent;
  color: var(--brand);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--brand);
}
.tab-nav button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.tab-icon { width: 17px; height: 17px; flex-shrink: 0; }

.admin-section-nav,
.ai-function-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 0 0 10px;
  margin-bottom: 18px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
}
.ai-function-tabs { margin-bottom: 16px; }

#admin [role="tabpanel"][hidden] { display: none !important; }
#admin .admin-layout > .profile-cards { display: contents; }

#admin [tabindex="-1"] { scroll-margin-top: 24px; }
#admin [tabindex="-1"]:focus-visible { outline: 2px solid var(--brand); outline-offset: 5px; }
#settings [role="tabpanel"]:focus-visible { outline: 2px solid var(--brand); outline-offset: 5px; }
#admin .fav-followed-head { align-items: flex-start; gap: 16px; flex-wrap: wrap; }
#admin .fav-followed-head > div:first-child { flex: 1 1 260px; }
#admin .fav-followed-head h2 { margin: 0; font-size: 16px; }
#admin .guide-actions { flex-wrap: wrap; gap: 8px; }
#adminUserSearch { width: 200px; max-width: 100%; }
#admin .profile-cards { align-items: start; }
#admin .admin-table-wrap { border: 1px solid var(--line); border-radius: var(--radius); }
#admin .admin-table th { background: var(--surface-muted); }
#admin .admin-table tbody tr:hover { background: var(--surface-muted); }

.admin-backups-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.admin-backups-block h3 { margin: 0; font-size: 15px; }
.admin-backups-block .muted { font-size: 12.5px; line-height: 1.5; }
.s3-backups-empty { margin: 0; font-size: 13px; line-height: 1.6; }
.s3-backup-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.s3-backup-actions .btn { padding: 4px 10px; font-size: 12px; height: 30px; }
.s3-backup-actions button { padding: 4px 10px; font-size: 12px; height: 30px; }
#admin .admin-row-actions > span { display: inline-flex; }
#admin .admin-user-action { min-width: 104px; }

@media (max-width: 640px) {
  .admin-section-nav { gap: 4px; padding: 0 0 8px; }
  .admin-section-nav button { flex: 1 1 auto; }
  .auth-tabs button.auth-tab { flex: 1 1 auto; }
  #admin .fav-followed-head > .guide-actions { width: 100%; }
  #adminUserSearch { flex: 1; min-width: 140px; width: auto; }
  #admin .audit-filters label { min-width: 0; flex: 1 1 100%; }
  #admin .audit-pagination { align-items: flex-start; }
}

.admin-section {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-table-wrap {
  overflow-x: auto;
  margin-top: 4px;
}

.audit-filters,
.audit-pagination {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}
.audit-filters label {
  display: grid;
  gap: 5px;
  font-size: 13px;
  min-width: 120px;
}
.audit-filters label:first-child { flex: 1; min-width: 220px; }
.audit-pagination { align-items: center; justify-content: space-between; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th,
.admin-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line-subtle);
  vertical-align: middle;
}

.admin-table th {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: var(--surface-subtle);
}

.admin-table tr:last-child td {
  border-bottom: 0;
}

.admin-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.admin-row-actions button {
  padding: 4px 9px;
  font-size: 12px;
  height: 32px;
  white-space: nowrap;
}
.admin-row-actions .admin-user-action { flex: 0 0 104px; }

.db-grid-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.db-grid-span {
  grid-column: 1 / -1;
}

.admin-db-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
}

.admin-kv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-kv-row span:first-child {
  color: var(--muted);
}

.admin-result-box {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--text-secondary);
}

@media (max-width: 820px) {
  .auth-landing { grid-template-columns: 1fr; gap: 32px; margin: 12px auto; padding: 4px; }
  .auth-entry { grid-row: 1; padding: 24px; }
  .landing-brand { margin-bottom: 24px; }
  .landing-guide-head, .landing-guide-row { grid-template-columns: 85px minmax(0,1fr) minmax(0,1fr); font-size: 11px; gap: 6px; }
  .landing-guide-row > strong { font-size: 11px; }
  .registration-setting-row { align-items: flex-start; padding: 15px; gap: 12px; }
  .registration-setting-control { flex-direction: column-reverse; gap: 8px; }
  .updates-newsletter { flex-wrap: wrap; gap: 14px; padding: 20px; }
  .newsletter-action { width: 100%; align-items: flex-start; }
  .update-post { grid-template-columns: 1fr; padding: 20px; gap: 14px; }
  .update-post-meta { flex-direction: row; flex-wrap: wrap; align-items: center; }
  header#appChrome,
  .search-shell,
  main {
    width: calc(100% - 24px);
  }

  header#appChrome {
    padding: 10px 14px;
    flex-wrap: wrap;
    gap: 10px;
  }

  header .brand-tagline {
    display: none;
  }

  .main-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
  }

  .main-nav button {
    flex: 1;
  }

  .search-shell {
    padding: 0;
  }

  main {
    padding: 14px 0 36px;
  }

  .profile-cards,
  .favorites-layout,
  .channels-layout {
    grid-template-columns: 1fr;
  }

  #settings [data-section-panel] {
    grid-template-columns: minmax(0, 1fr);
  }

  .fav-sidebar,
  .channels-sidebar {
    position: static;
  }

  .time-head,
  .channel-row {
    grid-template-columns: 140px minmax(0, 1fr);
    min-width: 0;
  }

  .lineup-header {
    align-items: stretch;
    flex-direction: column;
  }

  .lineup-actions input,
  .lineup-actions select {
    flex: 1;
    min-width: 130px;
  }

  .channel-row-editor {
    grid-template-columns: 24px 28px minmax(0, 1fr) 140px auto;
  }

  .channel-editor-main input {
    width: 170px;
    min-width: 170px;
    max-width: 170px;
    flex-basis: 170px;
  }

  .channel-row-editor input.channel-category-input {
    width: 140px;
    min-width: 140px;
    max-width: 140px;
  }

  .channel-row-editor .channel-tools {
    grid-column: 3 / 6;
  }
}

/* Shared navigation and page chrome. */
body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
main { flex: 1; min-width: 0; }
.site-footer {
  width: min(1680px, calc(100% - 36px));
  margin: auto auto 0;
  padding: 16px 0 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
}
.site-footer small { font-size: 11px; }
.skip-link {
  position: fixed; top: 8px; left: 16px; z-index: 100;
  padding: 10px 16px; border-radius: var(--radius);
  background: var(--surface); color: var(--brand);
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }
.main-nav { min-width: 0; }
.main-nav button { min-height: 40px; white-space: nowrap; flex-shrink: 0; }
.main-nav button.active { color: var(--brand); background: var(--brand-soft); border-color: var(--brand-border); }
.main-nav button:focus-visible, .user-chip:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px;
}
.tab-nav { scroll-padding-inline: 6px; }
.tab-nav button { min-height: 42px; white-space: nowrap; }
@media (max-width: 1200px) {
  header#appChrome { flex-wrap: wrap; gap: 10px; }
  .main-nav { order: 3; width: 100%; overflow-x: auto; }
  .main-nav button { flex: 1 0 auto; }
}
@media (max-width: 640px) {
  .header-right { gap: 6px; min-width: 0; flex-wrap: wrap; justify-content: flex-end; }
  .brand-lockup { flex: 1; }
  .tab-nav { flex-wrap: nowrap; overflow-x: auto; padding: 4px 4px 10px; }
  .tab-nav button, .auth-tabs button.auth-tab, .admin-section-nav button { flex: 0 0 auto; }
  .site-footer { width: calc(100% - 24px); }
}
