/* CuGate Channels: the chart-room theme.
   Ported from the locked design mockup
   (design-mockups/dashboard-chart-room-blue.html). The mockup is canonical:
   token roles, spotlight discipline and component recipes carry over 1:1.

   ============================================================
   PALETTE ROLES - cugate.com brand palette
   Source: main.css :root variables
   --color-blue-light:  #00cbd8  (bright cyan-blue)
   --color-blue-medium: #037A9A  (mid teal-blue)
   --color-blue-dark:   #07294C  (deep navy)
   --color-yellow:      #fff95b  (lemon yellow)
   --color-orange:      #ffcd00  (golden/amber) - spotlight
   --color-gray:        #9FC8E4  (powder blue)

   Role map (this file):
   --bg          Page base
   --surface     Cards / rows
   --border      Structural lines
   --primary     #00cbd8 bright cyan (interactive, nav active, revenue bar)
   --spotlight   #ffcd00 gold - #1 rank numeral + total revenue ONLY (precious)
   --text        Primary text
   --muted       #9FC8E4 powder blue - labels / secondary
   --danger      Down-trend red (unchanged - semantic, not brand)

   NO magenta. NO mint/green-teal. Precious = gold, used once per screen.
   ============================================================ */

:root {
  --radius: 10px;
  --transition: 0.22s cubic-bezier(0.25, 1, 0.2, 1);
}

html[data-theme="dark"] {
  --bg:            #041829;
  --bg-deeper:     #020e1a;
  --surface:       rgba(7, 41, 76, 0.55);
  --surface-hover: rgba(0, 203, 216, 0.07);
  --border:        rgba(0, 203, 216, 0.13);
  --border-strong: rgba(0, 203, 216, 0.24);
  --primary:       #00cbd8;
  --primary-dim:   rgba(0, 203, 216, 0.13);
  --spotlight:     #ffcd00;
  --spotlight-dim: rgba(255, 205, 0, 0.12);
  --text:          #d8eef8;
  --text-strong:   #f0f8ff;
  --muted:         #5a8aaa;
  --muted-mid:     #7aafc8;
  --danger:        #e05050;
  --up:            #00cbd8;
  --sidebar-bg:    #020e1a;
  --sidebar-border: rgba(0, 203, 216, 0.10);
  --header-bg:     rgba(2, 14, 26, 0.92);
  --rank-track:    rgba(255, 255, 255, 0.04);
  --shadow:        rgba(0, 0, 0, 0.50);
}

html[data-theme="light"] {
  --bg:            #eef5fb;
  --bg-deeper:     #d8eaf4;
  --surface:       #ffffff;
  --surface-hover: #f4f9fd;
  --border:        rgba(3, 122, 154, 0.14);
  --border-strong: rgba(3, 122, 154, 0.26);
  --primary:       #037A9A;
  --primary-dim:   rgba(3, 122, 154, 0.10);
  --spotlight:     #c89700;
  --spotlight-dim: rgba(200, 151, 0, 0.10);
  --text:          #07294C;
  --text-strong:   #041829;
  --muted:         #5b8aaa;
  --muted-mid:     #3d6f90;
  --danger:        #c03030;
  --up:            #037A9A;
  --sidebar-bg:    #07294C;
  --sidebar-border: rgba(255, 255, 255, 0.10);
  --header-bg:     rgba(238, 245, 251, 0.94);
  --rank-track:    rgba(7, 41, 76, 0.07);
  --shadow:        rgba(7, 41, 76, 0.14);
}

/* ===== RESET + BASE ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

body {
  font-family: 'DM Sans', 'Noto Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
}

* {
  transition-property: background-color, border-color, color, fill, stroke, opacity;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 200ms;
}

/* ===== THIN LABEL OVERRIDE (prevents fuzzy webkit rendering) ===== */
.label-thin {
  -webkit-font-smoothing: subpixel-antialiased;
  -moz-osx-font-smoothing: auto;
}

/* ===== LAYOUT SHELL ===== */
.app {
  display: grid;
  grid-template-columns: 60px 1fr;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  grid-row: 1 / -1;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 100;
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-logo svg {
  width: 28px;
  height: 28px;
}

.nav-item {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  cursor: pointer;
  color: var(--muted);
  text-decoration: none;
  position: relative;
  background: none;
  border: 0;
  font: inherit;
}

.nav-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.nav-item.active {
  background: var(--primary-dim);
  color: var(--primary);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.5;
}

.nav-tooltip {
  position: absolute;
  left: calc(100% + 10px);
  background: var(--bg-deeper);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  border: 1px solid var(--border);
  z-index: 110;
}

.nav-item:hover .nav-tooltip,
.nav-item:focus-visible .nav-tooltip {
  opacity: 1;
}

/* Unread count on the Inbox icon (real nav needs it; tokens only) */
.nav-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 7px;
  background: var(--primary);
  color: var(--bg-deeper);
  font-size: 9px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
}

.sidebar-spacer { flex: 1; }

.sidebar-auth { margin: 0; }

/* ===== HEADER ===== */
.header {
  grid-column: 2;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-brand {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-strong);
  text-decoration: none;
}

.header-brand span {
  color: var(--primary);
}

.header-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
}

.header-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.header-label.label-thin {
  -webkit-font-smoothing: subpixel-antialiased;
  -moz-osx-font-smoothing: auto;
}

.header-spacer { flex: 1; }

/* Revenue total in header - gold spotlight, precious moment #1 */
.header-revenue {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.header-revenue-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  -webkit-font-smoothing: subpixel-antialiased;
  -moz-osx-font-smoothing: auto;
}

.header-revenue-value {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 22px;
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--spotlight);
}

.header-revenue-note {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* Theme toggle */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
}

/* Icon visibility is theme-driven so the right icon shows pre-JS. */
html[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
html[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* ===== MAIN CONTENT ===== */
.main {
  grid-column: 2;
  padding: 32px;
  max-width: 1200px;
  width: 100%;
  /* the mockup was designed at ~1440px where the 1200px column fills the
     track; on wider screens it pins left without this */
  margin-inline: auto;
}

/* ===== SECTION EYEBROW ===== */
.section-eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.eyebrow-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  -webkit-font-smoothing: subpixel-antialiased;
  -moz-osx-font-smoothing: auto;
}

.eyebrow-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.eyebrow-date {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--muted);
  -webkit-font-smoothing: subpixel-antialiased;
  -moz-osx-font-smoothing: auto;
}

a.eyebrow-date {
  text-decoration: none;
}

a.eyebrow-date:hover {
  color: var(--primary);
}

/* ===== CHART HEADING ===== */
.chart-heading {
  margin-bottom: 8px;
}

.chart-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900;
  font-size: 48px;
  line-height: 1;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--text-strong);
}

.chart-subtitle {
  font-size: 14px;
  color: var(--muted-mid);
  margin-top: 4px;
  letter-spacing: 0.02em;
}

/* ===== CHART COLUMNS HEADER ===== */
.chart-col-headers {
  display: grid;
  grid-template-columns: 72px 1fr 140px 120px 160px;
  gap: 0;
  padding: 8px 20px 8px 20px;
  margin-bottom: 4px;
}

.col-header {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  -webkit-font-smoothing: subpixel-antialiased;
  -moz-osx-font-smoothing: auto;
}

.col-header.align-right { text-align: right; }
.col-header.align-center { text-align: center; }

/* Revenue-hidden variant (non-staff): the per-channel money column is removed
   from the DOM, so collapse the grid to four tracks and keep it intact. The
   revenue visibility decision is centralised in accounts.access. */
.chart-col-headers.no-revenue { grid-template-columns: 72px 1fr 120px 160px; }

/* ===== CHART ROWS ===== */
.chart-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chart-row {
  display: grid;
  grid-template-columns: 72px 1fr 140px 120px 160px;
  align-items: center;
  gap: 0;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: default;
  position: relative;
  overflow: hidden;
}

.chart-row.no-revenue { grid-template-columns: 72px 1fr 120px 160px; }

.chart-row::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--surface-hover);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.chart-row:hover::before { opacity: 1; }

/* Rank numeral - the HERO of this stance */
.rank-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  position: relative;
  z-index: 1;
}

.rank-num {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900;
  font-size: 52px;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--rank-track);
  /* default: very dim, almost like a watermark */
  position: relative;
}

/* Rank #1 gets gold spotlight - the ONE precious warm moment on this page */
.chart-row.rank-1 .rank-num {
  color: var(--spotlight);
  text-shadow: 0 0 40px rgba(255, 205, 0, 0.30);
  font-size: 60px;
}

/* Ranks #2-3 get primary cyan, pulled back */
.chart-row.rank-2 .rank-num,
.chart-row.rank-3 .rank-num {
  color: var(--primary);
  opacity: 0.60;
}

/* Ranks #4-5 stay dim */
.chart-row.rank-4 .rank-num,
.chart-row.rank-5 .rank-num {
  color: var(--text);
  opacity: 0.18;
}

/* Channel info */
.channel-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 16px;
  position: relative;
  z-index: 1;
}

.channel-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--text-strong);
  line-height: 1.1;
}

.channel-last-video {
  font-size: 12px;
  color: var(--muted-mid);
  font-style: italic;
  line-height: 1.3;
  letter-spacing: 0.01em;
}

.channel-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.channel-subs {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.04em;
  -webkit-font-smoothing: subpixel-antialiased;
  -moz-osx-font-smoothing: auto;
}

/* Revenue column */
.channel-revenue {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  position: relative;
  z-index: 1;
}

.revenue-amount {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 26px;
  letter-spacing: -0.01em;
  line-height: 1;
  color: var(--text-strong);
}

.revenue-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  -webkit-font-smoothing: subpixel-antialiased;
  -moz-osx-font-smoothing: auto;
}

/* #1 row revenue gets spotlight gold - precious moment #2 (tightly related) */
.chart-row.rank-1 .revenue-amount {
  color: var(--spotlight);
}

/* Movement column */
.channel-movement {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  position: relative;
  z-index: 1;
}

.movement-arrow {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.movement-up { color: var(--up); }
.movement-down { color: var(--danger); }

.movement-value {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.movement-up .movement-value { color: var(--up); }
.movement-down .movement-value { color: var(--danger); }
.movement-flat .movement-value { color: var(--muted); }

.movement-sub {
  font-size: 10px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.06em;
  -webkit-font-smoothing: subpixel-antialiased;
  -moz-osx-font-smoothing: auto;
  margin-left: 2px;
}

/* Views column */
.channel-views {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  position: relative;
  z-index: 1;
}

.views-value {
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.views-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  -webkit-font-smoothing: subpixel-antialiased;
  -moz-osx-font-smoothing: auto;
}

/* ===== REVENUE BAR MINI VIZ ===== */
/* Inline bar in the revenue col - width proportional to share of total */
.revenue-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 4px;
  width: 80px;
  overflow: hidden;
}

.revenue-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.25, 1, 0.2, 1);
}

/* #1 bar gets gold to match its rank and revenue */
.chart-row.rank-1 .revenue-bar-fill {
  background: var(--spotlight);
}

/* ===== ATTENTION FLAG: subscriber decline ===== */
.flag-critical {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(224, 80, 80, 0.12);
  border: 1px solid rgba(224, 80, 80, 0.28);
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--danger);
  -webkit-font-smoothing: subpixel-antialiased;
  -moz-osx-font-smoothing: auto;
}

/* ===== REVENUE SPARKLINE: on-board monthly trend ===== */
/* Small inline trend line under the channel meta. Server-rendered SVG; no
   client JS. Default stroke is primary cyan; a channel down from its peak gets
   the danger red plus the "vs peak" caption, matching the sub-decline flag. */
.channel-trend {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.sparkline {
  width: 96px;
  height: 24px;
  display: block;
  color: var(--primary);
  opacity: 0.75;
  flex-shrink: 0;
}

.sparkline-down {
  color: var(--danger);
  opacity: 0.9;
}

.trend-peak {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--danger);
  -webkit-font-smoothing: subpixel-antialiased;
  -moz-osx-font-smoothing: auto;
}

/* ===== NEXT RELEASES SECTION ===== */
.releases-section {
  margin-top: 40px;
}

.releases-strip {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.release-row {
  display: grid;
  grid-template-columns: 88px 1fr 200px 130px;
  align-items: center;
  gap: 0;
  padding: 14px 20px;
  background: var(--surface);
}

.release-row:hover { background: var(--surface-hover); }

.release-date {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-mid);
}

.release-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-strong);
  line-height: 1.3;
}

.release-artist {
  font-size: 12px;
  color: var(--muted-mid);
  margin-top: 1px;
}

.release-channel {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--muted);
  -webkit-font-smoothing: subpixel-antialiased;
  -moz-osx-font-smoothing: auto;
}

/* Status badge. The mockup defines submitted / not-submitted / at-risk
   recipes; the models expose Bootstrap-style contextual names, so each
   contextual name aliases onto the matching mockup recipe. */
.status-badge,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  -webkit-font-smoothing: subpixel-antialiased;
  -moz-osx-font-smoothing: auto;
}

.status-badge.submitted,
.badge.text-bg-success,
.status-badge.text-bg-success,
.badge.text-bg-info,
.status-badge.text-bg-info,
.badge.text-bg-primary,
.status-badge.text-bg-primary {
  background: rgba(0, 203, 216, 0.11);
  border: 1px solid rgba(0, 203, 216, 0.24);
  color: var(--primary);
}

html[data-theme="light"] .status-badge.submitted,
html[data-theme="light"] .badge.text-bg-success,
html[data-theme="light"] .status-badge.text-bg-success,
html[data-theme="light"] .badge.text-bg-info,
html[data-theme="light"] .status-badge.text-bg-info,
html[data-theme="light"] .badge.text-bg-primary,
html[data-theme="light"] .status-badge.text-bg-primary {
  background: rgba(3, 122, 154, 0.08);
  border-color: rgba(3, 122, 154, 0.22);
  color: var(--primary);
}

.status-badge.not-submitted,
.badge.text-bg-warning,
.status-badge.text-bg-warning {
  background: rgba(255, 205, 0, 0.10);
  border: 1px solid rgba(255, 205, 0, 0.22);
  color: var(--spotlight);
}

html[data-theme="light"] .status-badge.not-submitted,
html[data-theme="light"] .badge.text-bg-warning,
html[data-theme="light"] .status-badge.text-bg-warning {
  background: rgba(200, 151, 0, 0.08);
  border-color: rgba(200, 151, 0, 0.20);
  color: var(--spotlight);
}

.status-badge.at-risk,
.badge.text-bg-danger,
.status-badge.text-bg-danger {
  background: rgba(224, 80, 80, 0.10);
  border: 1px solid rgba(224, 80, 80, 0.22);
  color: var(--danger);
}

.badge.text-bg-secondary,
.status-badge.text-bg-secondary,
.badge.text-bg-light,
.badge.text-bg-dark {
  background: var(--rank-track);
  border: 1px solid var(--border-strong);
  color: var(--muted-mid);
}

.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ===== TOTAL REVENUE STAT STRIP ===== */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.stat-card:hover { background: var(--surface-hover); }

.stat-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  -webkit-font-smoothing: subpixel-antialiased;
  -moz-osx-font-smoothing: auto;
}

.stat-value {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 30px;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--text-strong);
}

/* Total Revenue card: gold spotlight */
.stat-value.accent { color: var(--spotlight); }

.stat-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
  letter-spacing: 0.02em;
}

.stat-sub .up { color: var(--up); font-weight: 600; }
.stat-sub .down { color: var(--danger); font-weight: 600; }

/* ===== NEEDS YOUR ATTENTION (per-viewer, private) =====
   The page's action queue: dense itemised rows, each one a release link
   ([date chip][title][need tag]), tighter than the board's chart rows.
   Quiet on purpose: surface/border tokens, primary for the live dates,
   danger only for overdue. The gold --spotlight stays reserved for the
   one revenue moment per screen. */
.attention-strip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px 12px;
  margin-bottom: 16px;
}

.attention-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.attention-queue {
  display: flex;
  flex-direction: column;
}

/* One queue row, wholly clickable. Hover reuses the surface-hover wash. */
.attention-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px;
  margin: 0 -8px;
  border-radius: 6px;
  border-top: 1px solid var(--border);
  text-decoration: none;
}

.attention-item:first-child {
  border-top: none;
}

.attention-item:hover {
  background: var(--surface-hover);
}

/* Date chip: the mono-style label treatment, tabular so dates align. */
.attention-due {
  flex: 0 0 104px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--primary);
}

.attention-due.overdue {
  color: var(--danger);
}

.attention-due.undated {
  color: var(--muted);
}

.attention-item-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attention-item:hover .attention-item-title {
  color: var(--text-strong);
}

/* Need tag: the quiet badge recipe (rank-track + strong border, muted). */
.attention-need {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  background: var(--rank-track);
  border: 1px solid var(--border-strong);
  color: var(--muted-mid);
  -webkit-font-smoothing: subpixel-antialiased;
  -moz-osx-font-smoothing: auto;
}

/* Summary rows (team schedule / inbox): count lines, arrow affordance. */
.attention-go {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--muted);
}

.attention-item:hover .attention-go {
  color: var(--primary);
}

/* Notice rows: staff-only board facts. A leading dot stands in for the date
   chip the summary rows carry, keeping the compact two-part grammar; tone is
   colour only, from the existing semantic tokens (no gold). */
.attention-notice .attention-item-title::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 8px;
  border-radius: 50%;
  vertical-align: middle;
  background: currentColor;
}

.attention-notice-danger .attention-item-title {
  color: var(--danger);
}

.attention-notice-muted .attention-item-title {
  color: var(--muted);
}

.attention-more {
  display: inline-block;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-decoration: none;
}

.attention-more:hover {
  color: var(--primary);
}

/* ===== DATA NOTE (sample-data / fixture tag) ===== */
.data-note {
  font-size: 12px;
  color: var(--muted-mid);
  letter-spacing: 0.04em;
  font-style: italic;
  margin-bottom: 32px;
  padding: 8px 12px;
  background: var(--rank-track);
  border-radius: 6px;
  display: inline-block;
}

.data-note code {
  font-style: normal;
  color: var(--primary);
  font-size: 11px;
}

/* ============================================================
   INNER PAGES - the rest of the hub on the same surface tokens.
   These re-express the existing page components (panels, data
   tables, metric cards, forms, inbox) in chart-room roles so
   every module renders cleanly inside the new shell. Full
   per-page redesigns come in later waves.
   ============================================================ */

/* --- Page head --- */
.page-head {
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  padding-bottom: 14px;
}

.page-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900;
  font-size: 34px;
  line-height: 1;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: var(--text-strong);
}

.page-sub {
  font-size: 14px;
  color: var(--muted-mid);
  margin-top: 6px;
  letter-spacing: 0.02em;
}

/* The open-work counts line needs air before the table panel below it. */
.open-work-summary { margin: 12px 0 16px; }

/* --- Panels --- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px 20px;
  margin-bottom: 24px;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin-bottom: 12px;
  gap: 12px;
}

.panel-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-strong);
  margin: 0;
}

.panel-note {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.panel-link, .panel-link:hover {
  color: var(--primary);
  font-size: 13px;
  text-decoration: none;
}

.panel-link:hover { text-decoration: underline; }

/* --- Metric cards (rights overview etc.) --- */
.metric-row {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  min-width: 220px;
}

.metric-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.metric-value {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 30px;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--text-strong);
}

.metric-foot {
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
  letter-spacing: 0.02em;
}

/* --- Data tables --- */
.table-responsive { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
}

.table.align-middle td,
.table.align-middle th { vertical-align: middle; }

.data-table { margin: 0; }

.data-table thead th {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-strong);
}

.data-table td,
.data-table tbody th {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  text-align: left;
}

.data-table tbody tr:last-child td,
.data-table tbody tr:last-child th { border-bottom: 0; }

.data-table tbody tr:hover { background: var(--surface-hover); }

.data-table tbody th {
  font-weight: 600;
  color: var(--text-strong);
}

.data-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data-table thead th.num { text-align: right; }

.data-table .nowrap { white-space: nowrap; }

.muted { color: var(--muted-mid); }
.trend-up { color: var(--up); }
.trend-down { color: var(--danger); }

.cat-ref {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--primary);
}

.server-link { text-decoration: none; color: var(--primary); }
.video-flag { color: var(--muted-mid); font-size: 12px; }

/* --- Finding panel (Rights) --- */
.finding {
  background: var(--primary-dim);
  border-color: var(--border-strong);
}
.finding-body { font-size: 14px; line-height: 1.5; }
.finding-body ol { margin: 8px 0; padding-left: 20px; }
.finding-body li { margin-bottom: 8px; }
.finding-foot {
  margin: 8px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  color: var(--muted-mid);
  font-size: 13px;
}

/* --- Deliverables --- */
.deliverable-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.deliverable-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
}

.deliverable-card.is-missing { opacity: 0.55; }

.deliverable-kind {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
}

.deliverable-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--text-strong);
  margin: 6px 0 6px;
  line-height: 1.15;
}

.deliverable-date { color: var(--muted); font-size: 12px; }

.deliverable-open {
  margin-top: auto;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
  padding-top: 12px;
}

.deliverable-open:hover { text-decoration: underline; }

.deliverable-missing {
  margin-top: auto;
  color: var(--danger);
  font-size: 12px;
  padding-top: 12px;
}

/* --- Action bar + row edit --- */
.action-bar { margin-bottom: 16px; display: flex; justify-content: flex-end; }
.row-edit { color: var(--primary); text-decoration: none; font-size: 12px; }
.row-edit:hover { text-decoration: underline; }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
}

.btn-dark {
  background: var(--primary-dim);
  border-color: var(--border-strong);
  color: var(--primary);
}

.btn-dark:hover {
  background: var(--primary);
  color: var(--bg-deeper);
}

.btn-outline-dark {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--muted-mid);
}

.btn-outline-dark:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-sm { padding: 5px 10px; font-size: 11px; }

.btn-link {
  background: none;
  border: 0;
  color: var(--muted-mid);
  text-transform: none;
  letter-spacing: 0.02em;
}

.btn-link:hover { color: var(--primary); }

/* --- Forms --- */
.form-panel { max-width: 640px; }
.login-panel { max-width: 420px; }

.mb-3 { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.form-control,
.form-select {
  display: block;
  width: 100%;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg-deeper);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 9px 12px;
}

html[data-theme="light"] .form-control,
html[data-theme="light"] .form-select {
  background: var(--surface);
}

.form-control:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}

.form-select option { background: var(--bg-deeper); }

html[data-theme="light"] .form-select option { background: var(--surface); }

.form-text { font-size: 12px; color: var(--muted); margin-top: 4px; }

.form-actions { display: flex; gap: 8px; align-items: center; margin-top: 8px; }

.field-error { color: var(--danger); font-size: 12px; margin-top: 4px; }

/* --- File upload drop zone (static/js/upload.js) --- */
/* The real <input type="file"> is visually hidden but kept in the DOM and
   focusable (clip technique, not display:none), so the form submits through it
   and works with JS off. The labelled .upload-zone is the click target and the
   drop target; .is-dragover lifts it to --primary while a file is hovering. */
.upload-zone {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-deeper);
  transition: border-color var(--transition), background-color var(--transition);
}

html[data-theme="light"] .upload-zone { background: var(--surface); }

.upload-zone-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.upload-zone-target {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  cursor: pointer;
}

.upload-zone-hint { font-size: 13px; color: var(--muted); }

.upload-zone-filename {
  font-size: 13px;
  color: var(--muted-mid);
  margin-left: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.upload-zone-filename.has-file { color: var(--text); font-weight: 600; }

/* Keyboard focus on the hidden input rings the visible trigger. */
.upload-zone-input:focus-visible + .upload-zone-hint ~ .upload-zone-trigger,
.upload-zone-input:focus + .upload-zone-hint ~ .upload-zone-trigger {
  box-shadow: 0 0 0 3px var(--primary-dim);
}

.upload-zone.is-dragover {
  border-color: var(--primary);
  border-style: solid;
  background: var(--primary-dim);
}

/* --- Choices.js select skin (vendor: static/vendor/choices/) --- */
/* Token-only re-skin of the vendored widget, driven through its --choices-*
   hooks plus a few cascade overrides (chart-room.css loads after the vendor
   sheet). The closed field mirrors .form-select exactly, including its 8px
   radius alongside the other inputs; the floating dropdown uses var(--radius)
   and paints --surface over a --bg-deeper base so the translucent dark-theme
   surface never lets page content bleed through. No spotlight gold here:
   selects are interactive chrome, so they stay on --primary roles. */
.choices {
  --choices-guttering: 0;
  --choices-font-size-lg: 14px;
  --choices-font-size-md: 14px;
  --choices-font-size-sm: 12px;
  --choices-bg-color: var(--bg-deeper);
  --choices-bg-color-dropdown: var(--bg-deeper);
  --choices-bg-color-disabled: var(--rank-track);
  --choices-disabled-color: var(--muted);
  --choices-item-disabled-color: var(--muted);
  --choices-keyline-color: var(--border-strong);
  --choices-border-radius: 8px; /* matches .form-control / .form-select */
  --choices-text-color: var(--muted-mid); /* the dropdown arrow */
  --choices-primary-color: var(--primary-dim);
  --choices-item-color: var(--text);
  --choices-highlighted-color: var(--surface-hover);
  --choices-input-height: 38px;
  --choices-inner-padding: 5px 12px;
  --choices-inner-one-padding: 5px;
  --choices-list-single-padding: 4px 16px 4px 0;
  --choices-dropdown-item-padding: 9px 12px;
  --choices-z-index: 20;
  color: var(--text);
}

html[data-theme="light"] .choices {
  --choices-bg-color: var(--surface);
  --choices-bg-color-dropdown: var(--surface);
}

.choices.is-focused .choices__inner,
.choices.is-open .choices__inner {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}

.choices__list--dropdown,
.choices__list[aria-expanded] {
  /* --surface composed over --bg-deeper: opaque in both themes. */
  background: linear-gradient(var(--surface), var(--surface)) var(--bg-deeper);
  border-color: var(--border-strong);
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
  box-shadow: 0 12px 28px var(--shadow);
}

.choices[data-type*=select-one] .choices__input {
  background-color: transparent; /* sit on the dropdown's own paint */
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.choices__list--dropdown .choices__item--selectable.is-selected,
.choices__list[aria-expanded] .choices__item--selectable.is-selected {
  background-color: var(--primary-dim);
  color: var(--text-strong);
}

.choices__list--dropdown .choices__item--selectable.is-highlighted,
.choices__list[aria-expanded] .choices__item--selectable.is-highlighted {
  background-color: var(--surface-hover);
  color: var(--text-strong);
}

/* --- Inbox --- */
.btn-link-plain { background: none; border: 0; padding: 0; cursor: pointer; }

.inbox-list { list-style: none; margin: 0; padding: 0; }
.inbox-list li { border-bottom: 1px solid var(--border); }
.inbox-list li:last-child { border-bottom: 0; }

.inbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: none;
  border: 0;
  text-align: left;
  padding: 10px 0;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--text);
}

.inbox-item:hover { color: var(--text-strong); }

.inbox-list li.unread .inbox-item { font-weight: 600; color: var(--text-strong); }

.inbox-item .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  flex: none;
}

.inbox-msg { flex: 1; }

.inbox-time {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

/* --- Placeholder note (fixture-data tag) --- */
.placeholder-note {
  font-size: 12px;
  color: var(--muted-mid);
  letter-spacing: 0.04em;
  font-style: italic;
  margin-bottom: 24px;
  padding: 8px 12px;
  background: var(--rank-track);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: inline-block;
}

.placeholder-note code {
  font-style: normal;
  color: var(--primary);
  font-size: 11px;
}

/* --- Footer --- */
.app-footer {
  grid-column: 2;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 16px 32px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .app { grid-template-columns: 52px 1fr; }
  .main { padding: 20px; }
  .chart-row { grid-template-columns: 56px 1fr 110px; }
  .chart-col-headers { grid-template-columns: 56px 1fr 110px; }
  .channel-movement,
  .channel-views,
  .col-header:nth-child(4),
  .col-header:nth-child(5) { display: none; }
  /* Revenue-hidden variant: revenue is already out of the DOM. Keep movement
     visible in its place (headers shift to rank/channel/movement/views) and
     only drop the views column at this width. */
  .chart-row.no-revenue { grid-template-columns: 56px 1fr 110px; }
  .chart-col-headers.no-revenue { grid-template-columns: 56px 1fr 110px; }
  .chart-row.no-revenue .channel-movement { display: flex; }
  .chart-col-headers.no-revenue .col-header:nth-child(3) { display: block; }
  .chart-row.no-revenue .channel-views,
  .chart-col-headers.no-revenue .col-header:nth-child(4) { display: none; }
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
  .release-row { grid-template-columns: 72px 1fr 120px; }
  .release-channel { display: none; }
}

@media (max-width: 600px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .header { grid-column: 1; }
  .main { grid-column: 1; }
  .app-footer { grid-column: 1; }
  .chart-title { font-size: 34px; }
  .stat-strip { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .chart-row { padding: 14px 12px; }
  .release-row { grid-template-columns: 72px 1fr 110px; padding: 12px; }
  .header { padding: 0 16px; }
  /* Attention queue: let the row wrap (date chip + title stay together,
     the need tag flows onto the next line when it does not fit). */
  .attention-item { flex-wrap: wrap; row-gap: 3px; }
  .attention-due { flex-basis: auto; }
  .attention-item-title { flex: 1 1 60%; white-space: normal; }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
