/* Premium design system (2026-09-21) -- applied globally via these tokens
   and the bare `section`/nested-card selectors below, so every current and
   future section inherits it automatically instead of being styled
   one-off. See the project's dashboard-deploy memory for the deploy step
   this file still needs after any edit. */
:root {
  --bg: #0a0a0d;
  --surface-1: #121215; /* cards -- top-level section containers */
  --surface-2: #17171b; /* nested items inside a card, and hover */
  --surface-3: #1c1c21; /* deepest nesting / hover-on-nested, if needed */
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.14);
  --elevation: inset 0 1px 0 rgba(255, 255, 255, 0.04); /* top-edge highlight, never a drop shadow */
  --text: #e8e9ec;
  --muted: #9198a6;

  /* Semantic 3-color system (2026-09-21, replaces the earlier violet/pink
     gradient accent -- not layered on top of it). Colors carry meaning,
     not decoration: pick the one matching what the number/state actually
     IS, never for visual variety.
       blue  = default/neutral numeric value (most standard data displays)
       good  = positive/good signal
       warn  = attention/warning signal (also reserved for thin-data --
               one amber, doing double duty on purpose, not a second yellow)
     --good is unified to this single green (#22c55e) everywhere -- it
     previously also existed as a slightly different green (#3ecf8e) used
     only for flash-success/gate-unlocked; those now share this same value
     so "good" is one color across the app, not two. */
  --blue: #3b82f6;
  /* Same blue, one step deeper -- #3b82f6 with white button text only
     contrasts 3.68:1 (fails WCAG AA at button-label text size; it's fine
     at 5+:1 as text ON a dark surface, which is its main use). Buttons
     need their own fill shade, not a second hue. */
  --blue-fill: #2563eb;
  --good: #22c55e;
  --warn: #e0a53e;
  --bad: #e0575b;
  /* 0-100 score bands (title/description/tag scores) -- see app.py's
     SCORE_BANDS for why these are rose/gold/cyan/emerald and not the
     semantic --bad/--warn/--blue/--good above. */
  --score-band-low: #f43f5e;
  --score-band-mid-low: #eab308;
  --score-band-mid-high: #22d3ee;
  --score-band-high: #10b981;

  /* 4px base spacing scale -- use these for all padding/margin, not
     arbitrary values. */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;

  --radius-control: 6px;  /* buttons/inputs/chips */
  --radius-card: 10px;    /* cards/containers (8-12px band) */

  --fw-heading: 590;
  --fw-label: 510; /* top of the 400-510 body/label band -- card titles, th, badges */
}

* { box-sizing: border-box; }

/* Site-wide animated background (templates/_background.html), CSS-only.
   Only transform and opacity are animated, so the browser runs it on the
   compositor: no layout, no paint, no JS per frame. z-index -1 puts it above
   body's background (which propagates to the page root) but below all
   in-flow content; cards/header are opaque, so it shows in the gaps.
   position: fixed also gives the "background stays put while content
   scrolls" parallax for free. */
.app-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background: var(--bg); /* fallback if the image fails to load */
}

.app-bg-image {
  position: absolute;
  inset: -4%; /* bleed so the pan never exposes an edge */
  /* Original vector scene (gen_neon_background.py), sharp at any size. */
  background: url("bg/neon_scene.svg") center / cover no-repeat;
  animation: app-bg-pan 80s ease-in-out infinite alternate;
  will-change: transform;
}

/* Ambient light dots in 3 groups, each twinkling on its own phase. Same
   viewBox as the scene, so they line up; opacity on the div only. */
.app-bg-lights {
  position: absolute;
  inset: 0;
  background: center / cover no-repeat;
  animation: app-bg-twinkle 6s ease-in-out infinite alternate;
  will-change: opacity;
}
.app-bg-lights-1 { background-image: url("bg/neon_lights_1.svg"); animation-duration: 4.5s; }
.app-bg-lights-2 { background-image: url("bg/neon_lights_2.svg"); animation-duration: 6.5s; animation-delay: -2s; }
.app-bg-lights-3 { background-image: url("bg/neon_lights_3.svg"); animation-duration: 9s; animation-delay: -5s; }

/* Readability layer: keeps the neon image to ambient texture behind text. */
.app-bg-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 13, 0.45);
}

.app-bg-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 72% 40%, rgba(217, 70, 239, 0.6), transparent 50%),
    radial-gradient(circle at 22% 78%, rgba(139, 92, 246, 0.5), transparent 45%);
  opacity: 0.15;
  animation: app-bg-glow 5s ease-in-out infinite alternate;
  will-change: opacity;
}

@keyframes app-bg-pan {
  from { transform: scale(1) translate(0, 0); }
  to   { transform: scale(1.08) translate(-1.5%, -1%); }
}

@keyframes app-bg-twinkle {
  from { opacity: 1; }
  to   { opacity: 0.25; }
}

@keyframes app-bg-glow {
  from { opacity: 0.15; }
  to   { opacity: 0.3; }
}

@media (prefers-reduced-motion: reduce) {
  .app-bg-image, .app-bg-glow, .app-bg-lights { animation: none; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  font-variant-numeric: tabular-nums; /* all numeric values align in fixed-width columns */
}

/* Semantic value-color utilities -- for "key" numeric values/signals only
   (avg views, matched keywords -- not secondary/meta counts like admin's
   sample sizes). Color only, no weight change, so applying one never
   silently changes a value's boldness too. Pick by what the value IS:
     .value-good -- positive signal (strong best-time window, matched keyword)
     .value-warn -- attention/warning (notable outlier, thin data, high-demand-unapplied keyword)
   Regular view counts (Recent Videos, video detail) and Outlier Flags
   multipliers no longer use a fixed class at all -- they're colored by
   the gradient system (app.py's _gradient_color, inline style per value)
   and, once 24h+ old and below average, the flat amber underperformance
   override (also inline, both computed server-side -- see app.py). */
.value-good { color: var(--good); }
.value-warn { color: var(--warn); }

a {
  color: var(--text);
  text-decoration: none;
}

a:hover, a:focus-visible {
  color: var(--blue);
}

header {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

/* Centered brand stack above the status/Log Out row. .app-name and
   .account-context are separate hooks on purpose: the planned account
   switcher replaces .account-context's content (a dropdown) without
   touching the app name or this layout. */
.header-brand { text-align: center; margin-bottom: var(--space-2); }
.app-name { margin: 0; font-size: 24px; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; }
.account-context { margin: 2px 0 0; font-size: 13px; color: var(--muted); }

.header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-size: 12px;
  color: var(--muted);
}

.header-meta .logout {
  margin-left: auto;
  color: var(--muted);
}

.header-meta .back-link { color: var(--muted); }

/* .header-meta .logout/.back-link's static `color` above is more specific
   than the generic `a:hover` rule (two classes vs. one pseudo-class), so it
   would otherwise win even on hover and silently suppress the color change.
   This restates it at matching specificity. */
.header-meta .logout:hover, .header-meta .logout:focus-visible,
.header-meta .back-link:hover, .header-meta .back-link:focus-visible {
  color: var(--blue);
}

/* Header layout + hamburger menu (2026-10-02; replaces the 2026-09-24
   horizontal tab strip). Three columns at every width: menu button | brand
   (logo or text, plus the owner's mode switch) | signed-in user + Log Out.
   The menu is the same dropdown on phone and desktop. */
.header-bar {
  display: grid;
  grid-template-columns: minmax(44px, 1fr) auto minmax(44px, 1fr);
  align-items: center;
  gap: var(--space-3);
}
.header-bar .header-brand { grid-column: 2; margin-bottom: 0; display: flex; flex-direction: column; align-items: center; }
.header-bar .header-meta { grid-column: 3; justify-content: flex-end; align-items: center; text-align: right; }
.header-bar .header-meta .logout { margin-left: 0; }
.header-user { color: var(--text); white-space: nowrap; }

.brand-logo {
  display: block;
  height: 64px;          /* width follows from the intrinsic aspect ratio */
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.nav-menu { grid-column: 1; position: relative; justify-self: start; }
.nav-toggle {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-control);
  cursor: pointer; color: var(--text);
}
.nav-toggle:hover, .nav-toggle:focus-visible, .nav-toggle.open { background: var(--surface-3); border-color: var(--border-hover); }
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after {
  display: block; width: 18px; height: 2px; border-radius: 1px; background: currentColor; position: relative;
}
.nav-toggle-bars::before, .nav-toggle-bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bars::before { top: -6px; }
.nav-toggle-bars::after { top: 6px; }

.nav-panel {
  position: absolute; top: calc(100% + var(--space-2)); left: 0; z-index: 30;
  min-width: 220px; max-width: calc(100vw - 2 * var(--space-4));
  display: flex; flex-direction: column; gap: 2px; padding: var(--space-2);
  background: var(--surface-1); border: 1px solid var(--border-hover); border-radius: var(--radius-card);
  box-shadow: var(--elevation);
}
.nav-panel[hidden] { display: none; }
.nav-panel a {
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-control);
  color: var(--text); font-size: 14px; font-weight: var(--fw-label); text-decoration: none;
}
.nav-panel a:hover, .nav-panel a:focus-visible { background: var(--surface-2); color: var(--text); }
/* Active page -- the same blue selection fill the old tab strip used. */
.nav-panel a.active { background: var(--blue-fill); color: #fff; }

@media (max-width: 480px) {
  .brand-logo { height: 48px; }
  .header-user { display: none; }
}

main {
  padding: var(--space-4) var(--space-4) var(--space-8);
  max-width: 720px;
  margin: 0 auto;
}

/* Narrow viewports: tighter page padding so content feels native, not just
   shrunk. (The old nav-strip rule here went with the hamburger menu.) */
@media (max-width: 480px) {
  main {
    padding: var(--space-3) var(--space-3) var(--space-8);
  }
}

/* Every section is a card -- this is the whole "apply globally, not
   one-off" mechanism: any current or future <section> in any template
   inherits the bordered surface-1 card automatically. */
section {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--elevation);
  padding: var(--space-4);
  margin-bottom: var(--space-6);
}

section h2 {
  font-size: 16px;
  font-weight: var(--fw-heading);
  margin: 0 0 var(--space-1);
}

.hint {
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
  margin: 0 0 var(--space-3);
}

.empty {
  color: var(--muted);
  font-style: italic;
}

/* Thin-data rows (e.g. best-time-to-post on a day with too few real posts
   to trust the pick the same as a day with 5-6) -- a real number, not
   hidden, but must not look as solid as every other row at a glance.
   Amber is the same semantic "warning" color used elsewhere (see --warn
   above), not a separate one-off shade. */
tr.thin-data td {
  opacity: 0.6;
  border-left: 2px solid var(--warn);
}

/* .badge (defined below, used together with this class -- e.g.
   class="badge thin-badge" on the header's STALE indicator and the
   Thin Data table badge) sets its own background at equal specificity and
   comes later in the file, so it was silently winning: every "thin-badge"
   element was rendering with .badge's neutral background instead of this
   amber one -- a real, pre-existing bug (confirmed live 2026-09-21, not
   introduced by the color-system pass), same class of cascade issue as
   .bt-bar-fill and .header-meta .logout/.back-link elsewhere in this file.
   `.badge.thin-badge` (two classes) fixes it the same way: specificity-based,
   not order-dependent. */
.badge.thin-badge {
  background: var(--warn);
  color: #2b1a04;
  font-weight: var(--fw-label);
}

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

table th, table td {
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
}

table th {
  font-weight: var(--fw-label);
  color: var(--text);
}

/* Row hover steps the row background up one level on the surface ladder
   (surface-1, the section card, -> surface-2) instead of adding a shadow
   or border. */
table tr:hover td {
  background: var(--surface-2);
}

.best-time-table td.bt-day {
  font-weight: var(--fw-label);
}

.bt-views {
  min-width: 130px;
}

.bt-views-value {
  font-weight: var(--fw-label);
}

.bt-bar {
  width: 100%;
  max-width: 90px;
  margin-top: var(--space-1);
}

/* Best-time-to-post avg-views bar -- green: every row's window is already
   the algorithm's best pick for that day, i.e. a positive signal.
   `.bt-bar .bar-fill` (descendant, 2 classes) rather than a same-specificity
   `.bt-bar-fill` -- the generic `.bar-fill` rule below would otherwise win
   by source order regardless of which one is defined "later" here (this
   exact bug already happened once before this app got its own .best-time-card
   wrapper that made it a non-issue; that wrapper is gone now that every
   `section` is a card, so the fix has to be specificity-based, not order-based). */
.bt-bar .bar-fill {
  background: var(--good);
}

/* Nested cards -- one step up the surface ladder from the section (card)
   they live inside, so depth reads from surface color, never a shadow.
   Hover steps up one more level. */
.video-card,
.gate-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--elevation);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
}

.video-card:hover,
.gate-card:hover {
  background: var(--surface-3);
  border-color: var(--border-hover);
}

.video-title { font-weight: var(--fw-label); }
.video-meta { color: var(--muted); font-size: 12px; margin-bottom: var(--space-2); }

/* Home page stats feed (subscriber count, total watch hours) -- nested
   cards, same ladder as .video-card/.gate-card. */
.stat-feed {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.stat-tile {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--space-4);
  flex: 1;
  min-width: 140px;
}

.stat-value {
  font-size: 28px;
  font-weight: var(--fw-heading);
  line-height: 1.2;
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  margin-top: var(--space-1);
}

/* Optional Home banner -- a <section> already inherits the card look;
   just centers its own text. */
.banner {
  text-align: center;
}

/* Recent-videos card grid (summary view) -- thumbnail, title, views only.
   Detail (tags/description/retention/etc.) lives one click away at
   /video/<id>, not here. */
.recent-videos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-2);
}

.recent-video-card {
  display: block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--elevation);
  overflow: hidden;
  color: inherit;
}

.recent-video-card:hover {
  background: var(--surface-3);
  border-color: var(--border-hover);
}

.recent-video-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--surface-3);
}

.recent-video-thumb-empty {
  aspect-ratio: 16 / 9;
}

.recent-video-title {
  font-weight: var(--fw-label);
  font-size: 13px;
  padding: var(--space-2) var(--space-3) var(--space-1);
  /* clamp to 2 lines so a long title doesn't blow out card height in the grid */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.recent-video-views {
  font-size: 12px;
  color: var(--muted);
  padding: 0 var(--space-3) var(--space-3);
}

/* Optimize page -- tabs (Live Streams / Long-form / Shorts) + full-history
   video row list (denser than the Home summary grid; a browsable list,
   not a glanceable grid). */
.tab-bar {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-button {
  flex-shrink: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-control);
  font-size: 13px;
  font-weight: var(--fw-label);
  cursor: pointer;
  white-space: nowrap;
}

.tab-button:hover, .tab-button:focus-visible {
  background: var(--surface-3);
  color: var(--text);
}

.tab-button.active {
  background: var(--blue-fill);
  border-color: var(--blue-fill);
  color: #fff;
}

.optimize-video-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.optimize-video-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--space-2);
  color: inherit;
}

.optimize-video-row:hover {
  background: var(--surface-3);
  border-color: var(--border-hover);
}

.optimize-video-thumb {
  width: 96px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius-control);
  flex-shrink: 0;
  background: var(--surface-3);
}

.optimize-video-info {
  min-width: 0;
}

.optimize-video-title {
  font-weight: var(--fw-label);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.optimize-video-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: var(--space-1);
}

.video-detail-thumb {
  display: block;
  width: 100%;
  max-width: 480px;
  border-radius: var(--radius-card);
  margin-bottom: var(--space-3);
}

.video-description {
  white-space: pre-wrap;
}

/* Tag editor chips (video detail, "Edit Title, Description & Tags" --
   current tags as removable chips, suggested additions as one-click-add
   chips; retired the old apply-missing-keywords checkbox grid this
   replaces, 2026-09-24). Same pill shape that grid used, repurposed. */
.tag-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: var(--space-2) 0 var(--space-3);
}

.tag-chip {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--surface-2);
  /* Explicit, not inherited -- .tag-chip-suggestion is a <button>, and
     browser UA stylesheets give buttons their own default text color
     (confirmed live: rendered as black-on-near-black, nearly invisible,
     since nothing here had overridden it -- getComputedStyle, not source
     reading, is what caught it). <span> chips would have inherited
     var(--text) fine on their own; buttons need it stated explicitly. */
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px; /* chip, not a control/card -- stays fully rounded */
  padding: var(--space-2) var(--space-3);
  font-size: 13px;
}

.tag-chip-text {
  white-space: nowrap;
}

.tag-chip-score {
  /* Base color is a fallback only -- every real render sets an inline
     style="color: ..." per-chip (gradient-colored score, 2026-09-24
     follow-up brief, replaces the old amber-border "lowest scoring"
     flag this used to pair with). */
  color: var(--muted);
  font-size: 11px;
}

.tag-chip-remove {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}

.tag-chip-remove:hover, .tag-chip-remove:focus-visible {
  color: var(--bad);
}

/* Suggested-addition chips are buttons -- the whole chip is clickable to
   add, same blue "selection" hover the retired checkbox grid used for its
   checked state. */
.tag-chip-suggestion {
  cursor: pointer;
  font: inherit;
}

.tag-chip-suggestion:hover, .tag-chip-suggestion:focus-visible {
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(59, 130, 246, 0.5);
}

.tag-chip-add {
  color: var(--good);
  font-weight: var(--fw-label);
}

.tag-chip-suggestion-added {
  opacity: 0.4;
  cursor: default;
}

.tag-chip-suggestion-added:hover {
  background: var(--surface-2);
  border-color: var(--border);
}

/* Custom tag box (tag editor): type a tag, see its live 0-100 score
   (same band colors as the chips), then Add it as a normal chip. */
.custom-tag-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin: var(--space-2) 0 var(--space-3);
}

.custom-tag-row input {
  flex: 1 1 14rem;
  min-width: 0;
  margin: 0;
}

.custom-tag-score {
  color: var(--muted);
  font-size: 13px;
  min-width: 4.5rem;
}

.custom-tag-row .apply-button {
  margin: 0;
}

/* Suggested Title & Description (video detail) */
section h3 {
  font-size: 14px;
  font-weight: var(--fw-label);
  margin: var(--space-4) 0 var(--space-2);
}

.suggestion-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.suggestion-list li {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--space-3);
}

.suggestion-list li:hover {
  background: var(--surface-3);
  border-color: var(--border-hover);
}

.suggestion-text {
  flex: 1;
}

.use-suggestion-button {
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-control);
  padding: var(--space-1) var(--space-3);
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
}

.use-suggestion-button:hover, .use-suggestion-button:focus-visible {
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(59, 130, 246, 0.5);
}

/* Edit Title, Description & Tags (video detail) */
.edit-metadata-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin: var(--space-3) 0;
}

.field-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  font-weight: var(--fw-label);
  color: var(--muted);
  margin-top: var(--space-3);
}

.edit-metadata-form input[type="text"],
.edit-metadata-form textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: var(--space-2) var(--space-3);
  width: 100%;
  resize: vertical;
}

.edit-metadata-form input[type="text"]:focus,
.edit-metadata-form textarea:focus {
  outline: none;
  border-color: var(--border-hover);
}

/* Floating Save & Push (2026-09-24) -- replaces the old bottom-of-form
   button; fixed to the top-right just under the sticky header (top is set
   by video_detail.html's JS from the header's real height), so it stays
   reachable while scrolling the long tag list. */
.floating-save {
  position: fixed;
  right: var(--space-4);
  top: 96px;
  z-index: 11;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-2);
  max-width: min(320px, calc(100vw - 2 * var(--space-4)));
}

.floating-save .apply-button {
  border: 1px solid var(--border-hover);
}

.apply-button:disabled {
  opacity: 0.6;
  cursor: default;
  filter: none;
}

.floating-save-status {
  margin: 0;
  font-size: 13px;
  border-radius: var(--radius-card);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-hover);
}

.floating-save-status:empty { display: none; }

.floating-save-status.flash-pending { background: var(--surface-3); color: var(--text); }

.apply-button {
  background: var(--blue-fill);
  color: #fff;
  font-weight: var(--fw-label);
  border: none;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-control);
  font-size: 14px;
  cursor: pointer;
}

.apply-button:hover, .apply-button:focus-visible {
  filter: brightness(1.08);
}

.flash {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-card);
  font-size: 13px;
  margin: 0 0 var(--space-3);
}

.flash-success { background: var(--good); color: #06231a; }
.flash-warning { background: var(--warn); color: #2b1a04; }
.flash-error { background: var(--bad); color: #2b0607; }
.flash-pending { background: var(--surface-3); color: var(--text); }

/* Comments tab (templates/comments.html). Reply drafts reuse
   .suggestion-list / .use-suggestion-button from the video page. */
.comment-list { display: flex; flex-direction: column; gap: var(--space-3); margin-top: var(--space-3); }

.comment-card {
  display: flex;
  gap: var(--space-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--space-3);
}

.comment-card-replied { opacity: 0.6; }

.comment-video { width: 120px; flex-shrink: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.comment-video-thumb { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius-control); background: var(--surface-3); display: block; }
.comment-video-title { font-size: 12px; color: var(--muted); line-height: 1.3; }
.comment-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-2); align-items: flex-start; }
.comment-meta { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: baseline; font-size: 13px; }
.comment-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-status { margin: 0; font-size: 13px; }
.comment-status:empty { display: none; }
.comment-status.flash { margin: 0; align-self: stretch; }
.reply-options { align-self: stretch; }
.reply-tone { flex-shrink: 0; min-width: 72px; font-size: 13px; color: var(--muted); }
.reply-editor { align-self: stretch; display: flex; flex-direction: column; gap: var(--space-2); align-items: flex-start; }
/* display: flex above would otherwise beat the [hidden] attribute. */
.reply-options[hidden], .reply-editor[hidden] { display: none; }

.reply-text {
  width: 100%;
  background: var(--surface-1);
  color: var(--text);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-control);
  padding: var(--space-2) var(--space-3);
  font: inherit;
  resize: vertical;
}

.reply-text:focus { outline: none; border-color: var(--blue); }

@media (max-width: 480px) {
  .comment-card { flex-direction: column; }
  .comment-video { width: 100%; flex-direction: row; align-items: center; }
  .comment-video-thumb { width: 96px; }
}

/* View Curves chart (2026-09-21, gradient coloring + a styling pass added
   same day) -- see dashboard/static/view_curves.js, which builds the
   actual SVG. This is layout/color only. Video-line segments are colored
   by the gradient color system (amber<->green vs. that checkpoint's
   baseline, HSL-interpolated as of the styling pass for saturation -- see
   that file's own header comment for the formula/reasoning). The
   baseline/reference line is bright var(--text) at a heavier stroke
   (styling pass) -- deliberately NOT neutral gray anymore, and NOT blue
   (already means "default value" elsewhere), so it reads unambiguously as
   the reference line at a glance. */
.view-curves-chart {
  position: relative;
}

.view-curves-svg {
  width: 100%;
  height: auto;
  display: block;
}

.vc-gridline {
  stroke: var(--border);
  stroke-width: 1;
}

.vc-axis-label,
.vc-y-axis-label {
  fill: var(--muted);
  font-size: 10px;
}

/* Baseline styling pass (2026-09-21): bright white/silver + a heavier
   stroke, replacing the previous neutral gray -- confirmed with Chris so
   it reads unambiguously as "the reference line," distinct from both blue
   (already means "default value" elsewhere) and the video-line gradient
   range. Segment/dashing LOGIC is unchanged, only color/weight. */
.vc-baseline-segment {
  stroke: var(--text);
  stroke-width: 3;
  stroke-linecap: round;
}

.vc-baseline-segment.vc-low-confidence,
.vc-video-line.vc-low-confidence {
  stroke-dasharray: 5 4;
}

.vc-video-line {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Always-visible checkpoint labels on the most-recently-published video's
   line only (see view_curves.js) -- a text-color halo (paint-order) keeps
   the number legible wherever it happens to cross a gridline or another
   line, without needing a background chip. */
.vc-point-label {
  fill: var(--text);
  font-size: 10px;
  font-weight: var(--fw-label);
  paint-order: stroke fill;
  stroke: var(--surface-1);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.vc-end-dot-ring {
  fill: var(--surface-1);
}

.vc-hit-column {
  fill: transparent;
  cursor: crosshair;
}

.vc-crosshair {
  stroke: var(--border-hover);
  stroke-width: 1;
  pointer-events: none;
}

.vc-tooltip {
  position: absolute;
  top: var(--space-1);
  background: var(--surface-3);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-control);
  box-shadow: var(--elevation);
  padding: var(--space-2) var(--space-3);
  font-size: 12px;
  pointer-events: none;
  white-space: nowrap;
  z-index: 5;
}

.vc-tooltip-title {
  font-weight: var(--fw-label);
  margin-bottom: var(--space-1);
}

.vc-tooltip-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--muted);
}

.vc-tooltip-swatch {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

.vc-tooltip-swatch-baseline {
  background: var(--text);
}

.view-curves-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.vc-legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.vc-legend-swatch {
  width: 24px;
  height: 4px;
  border-radius: 999px;
  flex-shrink: 0;
}

.vc-legend-swatch-baseline {
  background: var(--text);
}

.vc-legend-label {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.gate-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2);
}

.gate-card.unlocked { border-color: var(--good); }

.gate-title {
  font-weight: var(--fw-label);
  margin-bottom: var(--space-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.badge {
  font-size: 10px;
  font-weight: var(--fw-label);
  padding: 2px var(--space-2);
  border-radius: 999px; /* chip, stays fully rounded */
  background: var(--border);
  color: var(--muted);
}

.gate-card.unlocked .badge {
  background: var(--good);
  color: #06231a;
}

.gate-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-top: var(--space-2);
}

.bar {
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-top: var(--space-1);
}

.bar-fill {
  height: 100%;
  background: var(--blue);
}

.gate-card.unlocked .bar-fill { background: var(--good); }

/* Login page */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--elevation);
  padding: var(--space-6);
  width: 90%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* Same .app-name/.account-context hooks as base.html's header brand stack.
   Here "Vantik" is bigger (the card's anchor) and "Welcome" keeps the old
   "Channel Dashboard" title's size/weight/color instead of the header's muted subtitle style. */
.login-brand { text-align: center; margin-bottom: var(--space-1); }
.login-card .app-name { font-size: 28px; }
.login-card .account-context { margin: var(--space-1) 0 0; font-size: 18px; font-weight: var(--fw-heading); color: var(--text); }

.login-card input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-control);
  font-size: 15px;
}

.login-card input:focus {
  outline: none;
  border-color: var(--border-hover);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.35);
}

.login-card button {
  background: var(--blue-fill);
  color: #fff;
  font-weight: var(--fw-label);
  border: none;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-control);
  font-size: 15px;
  cursor: pointer;
}

.login-card button:hover, .login-card button:focus-visible {
  filter: brightness(1.08);
}

.login-card .error { color: var(--bad); font-size: 13px; margin: 0; }
.login-card { max-width: 360px; }
/* Login (2026-10-02): Famous Exteriors leads; Vantik is credited as the
   platform above the card, deliberately quiet (small, muted, light weight). */
.login-page { flex-direction: column; gap: var(--space-3); }
.powered-by { margin: 0; font-size: 12px; font-weight: 400; letter-spacing: 0.04em; color: var(--muted); opacity: 0.85; }
.login-logo { display: block; height: 104px; width: auto; max-width: 100%; margin: 0 auto var(--space-2); object-fit: contain; }
.login-welcome { margin: 0; font-size: 18px; font-weight: var(--fw-heading); line-height: 1.3; text-wrap: balance; }
.login-card .login-brand .account-context { font-size: 13px; font-weight: 400; color: var(--muted); margin-top: 2px; }
@media (max-width: 480px) { .login-logo { height: 88px; } }
.login-label { font-size: 13px; font-weight: var(--fw-label); color: var(--muted); margin-bottom: calc(-1 * var(--space-2)); }
.login-notice { font-size: 13px; color: var(--warn); margin: 0; }

/* Analytics expansion (2026-09-27): Shorts engagement / Live panels.
   Deliberately neutral (blue = the app's neutral default, no score-band colors). */
.engage-bar {
  height: 14px;
  border-radius: 7px;
  background: var(--surface-3);
  overflow: hidden;
  margin: var(--space-3) 0 var(--space-2);
}
.engage-bar-stayed { height: 100%; background: var(--blue); }
.engage-bar-legend { display: flex; flex-wrap: wrap; gap: var(--space-4); font-size: 13px; color: var(--muted); }
.engage-bar-legend strong { color: var(--text); }
.engage-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--surface-3); margin-right: 6px; vertical-align: -1px; }
.engage-swatch-stayed { background: var(--blue); }
.stat-feed-compact { margin-top: var(--space-3); }
.stat-feed-compact .stat-value { font-size: 20px; }

.table-scroll { overflow-x: auto; max-height: 420px; overflow-y: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { padding: var(--space-2); border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.data-table th { color: var(--muted); font-weight: var(--fw-label); position: sticky; top: 0; background: var(--surface-1); }
.data-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.data-table td a { color: var(--text); }
.data-table td a:hover { color: var(--blue); }
.sortable-table th[data-sort] { cursor: pointer; user-select: none; }
.sortable-table th[data-dir="asc"]::after { content: " \25B2"; font-size: 9px; }
.sortable-table th[data-dir="desc"]::after { content: " \25BC"; font-size: 9px; }
.thumb-cell { width: 72px; }
.table-thumb { width: 64px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius-control); display: block; background: var(--surface-3); }

.live-summary { margin-bottom: var(--space-6); }
.live-summary h4 { margin: var(--space-4) 0 var(--space-2); font-size: 14px; font-weight: var(--fw-label); }
.seg-row { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.seg { display: inline-flex; border: 1px solid var(--border-hover); border-radius: var(--radius-control); overflow: hidden; margin-bottom: var(--space-2); }
.seg-btn { background: var(--surface-2); color: var(--muted); border: 0; padding: var(--space-1) var(--space-3); font-size: 13px; cursor: pointer; }
.seg-btn + .seg-btn { border-left: 1px solid var(--border-hover); }
.seg-btn.active { background: rgba(59, 130, 246, 0.2); color: var(--text); }
.share-bars { display: flex; flex-direction: column; gap: var(--space-2); }
.share-row { display: grid; grid-template-columns: minmax(120px, 190px) 1fr 90px; gap: var(--space-2); align-items: center; font-size: 13px; }
.share-track { height: 10px; background: var(--surface-3); border-radius: 5px; overflow: hidden; }
.share-fill { display: block; height: 100%; background: var(--blue); }
.share-value { text-align: right; font-variant-numeric: tabular-nums; }
.data-table[hidden], .live-summary [hidden] { display: none; }

.concurrency-chart { width: 100%; height: auto; display: block; margin: var(--space-2) 0; }
.cc-axis { stroke: var(--border-hover); }
.cc-grid { stroke: var(--border); stroke-dasharray: 3 4; }
.cc-label { fill: var(--muted); font-size: 11px; }
.cc-peak { fill: none; stroke: var(--blue); stroke-width: 1.8; stroke-linejoin: round; }
.cc-avg { fill: none; stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 4 3; }
.cc-swatch-avg { background: var(--muted); }

.heatmap { border-collapse: separate; border-spacing: 2px; font-size: 10px; }
.heatmap th { color: var(--muted); font-weight: var(--fw-label); padding: 2px 4px; }
.heatmap td { width: 22px; height: 20px; text-align: center; color: var(--text); border-radius: 3px; }
.button-row { display: flex; gap: var(--space-2); margin-top: var(--space-3); flex-wrap: wrap; }
#audience-upload-form { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin: var(--space-3) 0; }

/* Business mode (2026-09-28) */
.mode-switch { display: inline-flex; margin-top: var(--space-2); border: 1px solid var(--border-hover); border-radius: 999px; overflow: hidden; font-size: 12px; }
.mode-switch a { padding: 2px 12px; color: var(--muted); }
.mode-switch a.active { background: rgba(59, 130, 246, 0.2); color: var(--text); }
.invoice-status { font-size: 12px; text-transform: capitalize; padding: 1px 8px; border-radius: 999px; background: var(--surface-3); color: var(--muted); }
.invoice-status-overdue { color: var(--warn); }
.invoice-status-paid { color: var(--text); }
.stack-form { display: flex; flex-direction: column; gap: var(--space-2); max-width: 420px; }
.stack-form input { width: 100%; background: var(--surface-1); color: var(--text); border: 1px solid var(--border-hover); border-radius: var(--radius-control); padding: var(--space-2); font: inherit; }

.business-brief-text { font-size: 17px; line-height: 1.5; margin: 0 0 var(--space-2); }

/* Business mode: Jobs + Calendar (2026-09-30) */
.section-head-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.section-head-row h2 { margin: 0; }
.nowrap { white-space: nowrap; }
.job-desc-cell { max-width: 22rem; white-space: pre-line; }

.job-form { max-width: 40rem; }
.job-form input[type="text"], .job-form input[type="tel"], .job-form input[type="date"], .job-form input[type="password"], .job-form input[type="email"],
.job-form select, .job-form textarea {
  display: block; width: 100%;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-control);
  color: var(--text); font: inherit; font-size: 14px; padding: var(--space-2) var(--space-3);
  color-scheme: dark;
}
.job-form textarea { resize: vertical; }
.job-form input:focus, .job-form select:focus, .job-form textarea:focus { outline: none; border-color: var(--border-hover); }
.job-form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: var(--space-3); }
.job-form-actions { display: flex; gap: var(--space-2); align-items: center; margin-top: var(--space-4); flex-wrap: wrap; }

.job-status { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--surface-3); white-space: nowrap; }
.job-status-scheduled { color: var(--blue); }
.job-status-in_progress { color: var(--warn); }
.job-status-done { color: var(--good); }
/* Canceled: kept on the calendar and list as a record, muted and struck
   through so it reads as "not happening", not as done. */
.job-status-canceled { color: var(--muted); }
.job-source-tag { font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 0 6px; white-space: nowrap; }
.calendar-job.job-status-canceled { text-decoration: line-through; opacity: 0.75; }

.job-delete summary { cursor: pointer; color: var(--bad); font-size: 14px; }
.danger-button {
  background: var(--bad); color: #fff; border: none; border-radius: var(--radius-control);
  padding: var(--space-2) var(--space-4); font: inherit; font-weight: var(--fw-label); cursor: pointer;
}

.calendar-nav { display: flex; gap: var(--space-2); }
.calendar { display: grid; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; margin-top: var(--space-3); }
.calendar-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; }
.calendar-weekdays div { background: var(--surface-2); color: var(--muted); font-size: 12px; text-align: center; padding: var(--space-1) 0; }
.calendar-day { background: var(--surface-1); min-height: 6rem; padding: var(--space-1); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.calendar-day-outside { background: var(--surface-2); }
.calendar-day-outside .calendar-day-link { color: var(--muted); opacity: 0.6; }
.calendar-day-link { color: var(--text); font-size: 13px; text-decoration: none; padding: 2px 4px; border-radius: var(--radius-control); align-self: flex-start; }
.calendar-day-link:hover, .calendar-day-link:focus-visible { background: var(--surface-3); }
.calendar-day-today .calendar-day-link { background: var(--blue-fill); color: #fff; }
.calendar-day-selected { box-shadow: inset 0 0 0 2px var(--blue); }
.calendar-job {
  display: block; font-size: 11px; line-height: 1.4; padding: 1px 4px; border-radius: 4px;
  background: var(--surface-3); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.calendar-job:hover, .calendar-job:focus-visible { background: var(--surface-2); }
.calendar-more { font-size: 11px; color: var(--muted); text-decoration: none; padding: 0 4px; }
.calendar-legend { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-2); }
.calendar-day-list { list-style: none; padding: 0; margin: var(--space-3) 0 0; display: grid; gap: var(--space-2); }
.calendar-day-list li { background: var(--surface-2); border-radius: var(--radius-control); padding: var(--space-2) var(--space-3); }
.calendar-day-list .job-status { margin-left: var(--space-2); }

@media (max-width: 600px) {
  .calendar-day { min-height: 3.75rem; padding: 2px; }
  .calendar-job { font-size: 10px; padding: 0 2px; }
}

/* Title Generator (2026-10-01) */
.title-idea-row { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }
.title-idea-row input {
  flex: 1 1 16rem; min-width: 0;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-control);
  color: var(--text); font: inherit; font-size: 14px; padding: var(--space-2) var(--space-3);
}
.title-idea-row input:focus { outline: none; border-color: var(--border-hover); }
.title-idea-row .apply-button { margin: 0; }

/* Team page + read-only job view (2026-10-02) */
.team-manage summary { cursor: pointer; color: var(--blue); font-size: 13px; }
.team-inline { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin-top: var(--space-2); }
.team-inline select, .team-inline input {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-control);
  color: var(--text); font: inherit; font-size: 13px; padding: var(--space-1) var(--space-2); min-width: 0;
}
.job-readonly { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-2) var(--space-4); margin: var(--space-3) 0 0; }
.job-readonly dt { color: var(--muted); font-size: 13px; }
.job-readonly dd { margin: 0; }

/* Time clock + timesheets (2026-10-03) */
.clock-section { padding-top: var(--space-3); padding-bottom: var(--space-3); }
.clock-widget { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.clock-widget form { margin: 0; }
.clock-status { display: flex; align-items: center; gap: var(--space-3); font-size: 15px; }
.clock-elapsed { font-size: 13px; color: var(--muted); }
.clock-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.2); flex-shrink: 0; }
.clock-button {
  min-width: 9rem; min-height: 48px; padding: var(--space-3) var(--space-6);
  border: none; border-radius: var(--radius-control); font: inherit; font-size: 16px; font-weight: var(--fw-label);
  color: #fff; cursor: pointer;
}
.clock-button-in { background: var(--good); color: #06240f; }
.clock-button-out { background: var(--bad); }
.clock-button:disabled { opacity: 0.6; cursor: default; }
.time-status-review { color: var(--warn); }
.timesheet-review { border-color: rgba(224, 165, 62, 0.45); }
.time-entry-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-control); padding: var(--space-2) var(--space-3); margin-top: var(--space-2); }
.time-entry-card summary { cursor: pointer; font-size: 14px; }
.time-entry-voided summary { opacity: 0.6; }
.time-entry-form { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: flex-end; margin-top: var(--space-2); }
.time-entry-form label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.time-entry-form .time-note { flex: 1 1 12rem; }
.time-entry-form input, .time-entry-form select {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-control);
  color: var(--text); font: inherit; font-size: 14px; padding: var(--space-1) var(--space-2); color-scheme: dark; min-width: 0;
}
.time-entry-form .apply-button, .time-entry-form .use-suggestion-button { margin: 0; }
.time-history { list-style: none; margin: var(--space-2) 0 0; padding: 0; font-size: 12px; color: var(--muted); }
.timesheet-table td, .timesheet-table th { white-space: nowrap; }
.push-state { font-size: 14px; margin: var(--space-2) 0; }
.owner-clockout { text-align: center; }
.owner-out-button { width: 100%; max-width: 360px; min-height: 64px; font-size: 18px; margin: var(--space-3) 0; }

/* Calendar toolbar: Month | List switch + Add Job (2026-10-04) */
.calendar-toolbar { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-3); }
.calendar-toolbar .apply-button { margin: 0; }
.view-switch { display: inline-flex; border: 1px solid var(--border-hover); border-radius: 999px; overflow: hidden; font-size: 13px; }
.view-switch a { padding: var(--space-1) var(--space-4); color: var(--muted); text-decoration: none; }
.view-switch a.active { background: var(--blue-fill); color: #fff; }
.team-profile { margin-top: var(--space-2); }
.profile-form { max-width: none; }
.profile-form textarea { resize: vertical; }

/* Time off (2026-10-04) */
.timeoff-kind { margin-bottom: var(--space-2); }
.timeoff-kind label { padding: var(--space-1) var(--space-4); color: var(--muted); cursor: pointer; display: inline-flex; gap: var(--space-1); align-items: center; }
.timeoff-kind label:has(input:checked) { background: var(--blue-fill); color: #fff; }
.timeoff-kind input { accent-color: #fff; }
.timeoff-card { display: grid; gap: var(--space-1); }
.timeoff-head { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; font-size: 14px; }
.timeoff-pending { color: var(--warn); }
.timeoff-approved { color: var(--good); }
.timeoff-denied { color: var(--bad); }
.timeoff-reply { font-size: 13px; border-left: 2px solid var(--border-hover); padding-left: var(--space-2); }
.job-form input[type="time"] { display: block; width: 100%; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-control); color: var(--text); font: inherit; font-size: 14px; padding: var(--space-2) var(--space-3); color-scheme: dark; }

/* Technician Work hub (2026-10-04) */
.work-days { display: grid; gap: 2px; margin-top: var(--space-3); }
.work-day { background: var(--surface-2); border-radius: var(--radius-control); }
.work-day summary, .work-day-empty { display: flex; justify-content: space-between; padding: var(--space-2) var(--space-3); font-size: 14px; }
.work-day summary { cursor: pointer; }
.work-day-empty { color: var(--muted); }
.work-day-entries { margin: 0; padding: 0 var(--space-3) var(--space-2) var(--space-5); font-size: 13px; }
.work-request summary { display: inline-block; list-style: none; margin-bottom: var(--space-3); }
.work-request summary::-webkit-details-marker { display: none; }
.work-request[open] summary { opacity: 0.6; }
.work-older { margin-top: var(--space-3); }
.work-older summary { cursor: pointer; color: var(--blue); font-size: 14px; }
.timeoff-card { padding-top: var(--space-2); padding-bottom: var(--space-2); }

/* Approved requests on the Calendar (2026-10-04). Outlined chips in their
   own hues -- purple / pink / teal -- so they never read as a job (jobs are
   filled chips in blue / amber / green / gray). */
:root { --req-day-off: #c084fc; --req-leave-early: #f472b6; --req-late-arrival: #2dd4bf; }
.calendar-req {
  display: block; font-size: 11px; line-height: 1.4; padding: 0 4px; border-radius: 4px;
  border: 1px solid currentColor; background: transparent; text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.req-day_off { color: var(--req-day-off); }
.req-leave_early { color: var(--req-leave-early); }
.req-late_arrival { color: var(--req-late-arrival); }
.legend-req { display: inline-block; }
.legend-title { color: var(--muted); margin-right: var(--space-1); }
.day-req { border-left: 3px solid currentColor; }
.day-req strong, .day-req .hint { color: var(--text); }
.req-initials { display: none; }
/* Phones: a day cell is ~42px wide, so a request chip shows the person's
   initials (colour = type, per the legend); full text is in the day panel. */
@media (max-width: 600px) {
  .calendar-req { font-size: 10px; padding: 0 2px; text-align: center; font-weight: var(--fw-label); }
  .calendar-req .req-full { display: none; }
  .calendar-req .req-initials { display: inline; }
  .legend-req .req-full, .legend-req { display: inline-block; }
}
.timeoff-cancelled { color: var(--muted); }
.timeoff-cancel summary { cursor: pointer; color: var(--bad); font-size: 13px; width: fit-content; }
.timeoff-history-summary { cursor: pointer; font-weight: var(--fw-label); }
.row-link { cursor: pointer; }
.row-link:hover { background: var(--surface-3); }

/* Job completion + photos (2026-10-04) */
.job-complete summary { list-style: none; display: inline-flex; align-items: center; justify-content: center; }
.job-complete summary::-webkit-details-marker { display: none; }
.job-complete[open] summary { opacity: 0.55; margin-bottom: var(--space-2); }
.photo-form { margin-bottom: var(--space-4); }
.photo-form input[type="file"] { display: block; width: 100%; color: var(--text); font: inherit; font-size: 14px; padding: var(--space-2) 0; }
.photo-progress { font-size: 14px; margin: var(--space-2) 0 0; min-height: 1.2em; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--space-3); }
.photo-card { margin: 0; background: var(--surface-2); border-radius: var(--radius-control); overflow: hidden; }
.photo-card img { display: block; width: 100%; height: 140px; object-fit: cover; background: var(--surface-3); }
.photo-card figcaption { padding: var(--space-2); font-size: 13px; display: grid; gap: 2px; }
.photo-note { white-space: pre-line; }
.photo-owner summary { cursor: pointer; color: var(--muted); font-size: 12px; }

/* Work page polish (2026-10-04): hours periods, today's job cards, week list */
.hours-period { margin: var(--space-2) 0; flex-wrap: wrap; }
.today-job { background: var(--surface-2); border-radius: var(--radius-control); padding: var(--space-3); margin-top: var(--space-2); }
.today-job .job-readonly { margin: 0; }
.today-job-open { margin-top: var(--space-2); font-size: 13px; color: var(--blue); text-align: right; }
.week-list { display: grid; gap: 2px; border-radius: var(--radius-card); overflow: hidden; margin-top: var(--space-2); }
.week-day { display: grid; grid-template-columns: 3.2rem 1fr; gap: var(--space-2); background: var(--surface-2); padding: var(--space-2); align-items: start; }
.week-day-today { box-shadow: inset 3px 0 0 var(--blue-fill); }
.week-day-label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; align-items: center; }
.week-day-label span { font-size: 18px; color: var(--text); font-weight: var(--fw-label); }
.week-day-items { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.week-job, .week-req { font-size: 13px !important; padding: 3px 6px !important; }

/* Business Home: Needs Attention (2026-10-05) */
.attention h3 { margin-top: var(--space-3); }
.attention-list { list-style: none; padding: 0; margin: var(--space-2) 0 0; display: grid; gap: var(--space-2); }
.attention-list li { background: var(--surface-2); border-radius: var(--radius-control); padding: var(--space-2) var(--space-3); font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.attention-go { margin-left: auto; font-size: 13px; white-space: nowrap; }
.attention-seen { margin: 0 0 0 auto; }
.attention-owed { color: var(--warn); }

/* Financial page (2026-10-05) */
.fin-headline { text-align: center; margin-bottom: var(--space-3); }
.fin-profit { font-size: 36px; font-weight: 700; letter-spacing: -0.01em; }
.fin-good { color: var(--good); }
.fin-bad { color: var(--bad); }
.fin-delta { font-size: 12px; margin-left: var(--space-1); }
.fin-table .fin-total td { font-weight: var(--fw-label); border-top: 1px solid var(--border-hover); }
.fin-small-link { cursor: pointer; color: var(--blue); font-size: 13px; }
.fin-cats { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.fin-expense { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.fin-expense-main { display: flex; gap: var(--space-3); align-items: center; }
.fin-expense-actions { display: flex; gap: var(--space-2); align-items: center; }
.fin-receipt { width: 56px; height: 56px; object-fit: cover; border-radius: var(--radius-control); display: block; }
.fin-attach { cursor: pointer; }
.job-form select { display: block; width: 100%; }
.fin-export { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin-top: var(--space-3); }
.fin-export .apply-button { margin: 0; }
.fin-approx { font-size: 13px; }

/* Print / Save as PDF (Financial page, 2026-10-05): just the report. */
@media print {
  :root { --bg: #fff; --text: #111; --muted: #555; --surface-1: #fff; --surface-2: #f4f4f4; --surface-3: #eee; --border: #ccc; --border-hover: #999; }
  body { background: #fff !important; color: #111; }
  .app-bg, header, .nav-menu, .floating-save, .no-print, form, details, .flash-success, script { display: none !important; }
  section { box-shadow: none !important; border: 1px solid #ccc !important; break-inside: avoid; page-break-inside: avoid; }
  main { max-width: none; padding: 0; }
  a { color: #111 !important; text-decoration: none; }
  .fin-good { color: #0a7a2f !important; } .fin-bad { color: #b3261e !important; }
  .flash-warning { background: #fff4d6 !important; color: #111 !important; }
}
.clock-in-form { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; width: 100%; }
.clock-job-label { font-size: 12px; color: var(--muted); width: 100%; margin-bottom: -4px; }
.clock-job { flex: 1 1 14rem; min-width: 0; min-height: 48px; background: var(--surface-2); border: 1px solid var(--border-hover);
  border-radius: var(--radius-control); color: var(--text); font: inherit; font-size: 15px; padding: var(--space-2) var(--space-3); }
/* Owner close-out (2026-10-05): distinct from plain Done -- filled chip. */
.job-status-closed_out { color: #fff; background: var(--good); font-weight: 600; }
/* Full Complete chip = the legend: white on solid green (2026-10-09; was green
   text on the green background inherited from .job-status-closed_out). */
.calendar-job.job-status-closed_out { color: #fff; background: var(--good); font-weight: 600; }
.calendar-job.job-status-closed_out:hover, .calendar-job.job-status-closed_out:focus-visible { background: var(--good); filter: brightness(1.12); }
.closeout-box { margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--border); }
.closeout-done { margin-top: var(--space-2); }
/* Payroll (2026-10-05) */
.payroll-payday { font-size: 16px; margin: var(--space-2) 0; }
.payroll-flag { margin-top: 4px; font-size: 13px; font-weight: 600; color: #2b1a04; background: var(--warn, #e0a53e); border-radius: 6px; padding: 2px 8px; display: inline-block; }
.payroll-flag-inline { color: var(--warn, #e0a53e); font-weight: 600; }
.payroll-table tr.payroll-flagged td:first-child { box-shadow: inset 3px 0 0 var(--warn, #e0a53e); }
.payroll-pay-form { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.payroll-pay-form input[type=date] { min-height: 36px; }
.payroll-flag a { color: #2b1a04 !important; text-decoration: underline; font-weight: 700; }
/* Technician pay stubs + print-only bits (2026-10-05) */
.print-only { display: none !important; }
.paystub { border: 1px solid var(--border); border-radius: var(--radius-control, 10px); padding: var(--space-3); margin-bottom: var(--space-3); }
.paystub-head { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; justify-content: space-between; margin-bottom: var(--space-2); }
.paystub-grid { display: grid; grid-template-columns: max-content 1fr; gap: 4px var(--space-4); margin: 0 0 var(--space-3); }
.paystub-grid dt { color: var(--muted); }
.paystub-grid dd { margin: 0; text-align: right; }
@media print {
  .print-only { display: revert !important; }
  .print-brand { font-weight: 700; font-size: 18px; margin: 0 0 8px; }

  .paystub { border: 1px solid #999 !important; break-inside: avoid; }
  .paystub-grid dd { text-align: left; }
  .payroll-flag { background: #fff4d6 !important; }
}
@media print { .calendar-nav, .view-switch, .use-suggestion-button, .apply-button { display: none !important; } }
/* Letterhead on printed documents (2026-10-05). The logo is white artwork,
   so it prints on a small dark brand panel (print-color-adjust keeps it). */
.letterhead { align-items: center; gap: 16px; border-bottom: 2px solid #1f2937; padding-bottom: 10px; margin-bottom: 14px; }
.letterhead-logo { background: #0b0f1a; border-radius: 8px; padding: 8px 12px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.letterhead-logo img { height: 64px; width: auto; display: block; }
.letterhead-info { font-size: 12px; line-height: 1.45; color: #333; }
.letterhead-name { font-size: 18px; font-weight: 700; color: #111; }
.letterhead-doc { margin-left: auto; font-size: 16px; font-weight: 700; color: #111; text-transform: uppercase; letter-spacing: 0.04em; }
.paystub-ytd { margin-bottom: var(--space-3); }
@media print {
  .letterhead.print-only { display: flex !important; }
  .job-status-closed_out { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

}
/* Single pay stub printing (shared by Paystubs + owner Payroll, 2026-10-05):
   only the letterhead and the chosen card. */
.stub-area { display: none; }
@media print {
  body.print-one .print-hide { display: none !important; }
  body.print-one .print-scope > *:not(.letterhead):not(.print-target) { display: none !important; }
  body.print-one .stub-area.print-scope { display: block !important; }
}
.payroll-stub-btn { margin-left: 6px; padding: 2px 10px; font-size: 12px; }
/* Pay stub sections (2026-10-05): Employee Information + Pay Details table. */
.paystub-table { width: 100%; border-collapse: collapse; margin: 0 0 var(--space-3); }
.paystub-table th { text-align: left; font-weight: 400; color: var(--muted); padding: 4px 12px 4px 0; width: 9rem; vertical-align: top; }
.paystub-table td { text-align: right; padding: 4px 0; }
.paystub-gross td { font-weight: 700; }
.paystub-sub { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 6px; }
.paystub-sub-row { justify-content: space-between; align-items: center; }
@media print {
  tr.print-only { display: table-row !important; }
  .paystub-sub-row.print-only { display: flex !important; }
  .paystub-block { border: 1px solid #bbb; border-radius: 6px; padding: 10px 14px; margin-bottom: 12px; break-inside: avoid; }
  .paystub-sub { color: #111; border-bottom: 1px solid #ddd; padding-bottom: 4px; margin-bottom: 6px; flex: 1; }
  .paystub-sub-row .paystub-sub { border-bottom: none; margin-bottom: 0; }
  .paystub-sub-row { border-bottom: 1px solid #ddd; padding-bottom: 4px; margin-bottom: 6px; }
  .paystub-table th { color: #444; width: 9.5rem; }
  .paystub-table td { text-align: left; color: #111; }
  .paystub-table tr + tr th, .paystub-table tr + tr td { border-top: 1px solid #eee; }
  .paystub-gross th, .paystub-gross td { font-weight: 700; color: #111; }
  .paystub.print-target { border: none !important; padding: 0; }
}
/* Estimates (2026-10-05) */
.est-status-draft { color: var(--muted); }
.est-status-sent { color: var(--blue); }
.est-status-accepted { color: #fff; background: var(--good); font-weight: 600; }
.est-status-declined { color: #ff8a80; }
.est-actions, .est-send { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin-top: var(--space-3); }
.est-send .time-entry-form { margin: 0; }
.est-link-text { width: 100%; word-break: break-all; font-size: 12px; }
.est-job { margin-top: var(--space-3); }
.est-form h3 { margin: var(--space-4) 0 var(--space-2); font-size: 14px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.est-item { display: grid; grid-template-columns: 13.5rem 1fr 7rem 2.5rem; gap: var(--space-2); margin-bottom: var(--space-2); align-items: center; }
.est-item select, .est-item input { min-height: 44px; }
@media (max-width: 560px) { .est-item { grid-template-columns: 1fr 6.5rem 2.5rem; } .est-item select { grid-column: 1 / -1; } }
.est-del { padding: 0; min-height: 44px; font-size: 20px; }
.est-total-live { font-size: 18px; margin: var(--space-3) 0; }
.est-paper-owner { background: #fff; color: #111; border-radius: 10px; padding: 20px; }
.est-paper-owner .letterhead { display: flex; flex-wrap: wrap; }
@media print {
  .est-preview { border: none !important; padding: 0 !important; background: none !important; }
  .est-paper-owner { padding: 0; }
}
/* Structured address fields (2026-10-06) */
.addr-fields { margin: 0; }
.addr-row { display: grid; grid-template-columns: 1fr 5.5rem 7.5rem; gap: var(--space-2); }
@media (max-width: 420px) { .addr-row { grid-template-columns: 1fr 1fr; } .addr-city { grid-column: 1 / -1; } }
.addr-review { font-size: 13px; color: #2b1a04; background: var(--warn, #e0a53e); border-radius: 6px; padding: 6px 10px; margin: var(--space-2) 0; }
/* Customers (2026-10-06) */
.cust-search { margin: var(--space-3) 0; }
.cust-q { flex: 1 1 16rem; }
.cust-q input { width: 100%; }
.inv-status-paid { color: var(--good); }
.inv-status-overdue { color: #ff8a80; }
.inv-status-pending { color: var(--blue); }
/* Customer picker type-ahead (2026-10-06) */
.cp-wrap { position: relative; }
.cp-list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px 0; list-style: none;
  background: var(--surface-2); border: 1px solid var(--border-hover); border-radius: var(--radius-control, 10px); box-shadow: 0 8px 24px rgba(0,0,0,0.45); max-height: 320px; overflow-y: auto; }
.cp-list li[data-i] { padding: 8px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.cp-list li[data-i] span { font-size: 12px; color: var(--muted); }
.cp-list li[data-i]:hover, .cp-list li.active { background: var(--surface-3); }
.cp-list .cp-hint { padding: 6px 12px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--border); }
.cp-picked { margin: 4px 0 0; color: var(--good) !important; }
/* Calendar list view, 6 columns (2026-10-06): keep columns readable on a
   phone -- the table scrolls sideways inside .table-scroll instead of
   squeezing. */
.jobs-table th, .jobs-table td { padding-left: 6px; padding-right: 6px; }
.jobs-table .job-desc-cell { min-width: 7rem; }
.jobs-table .jobs-addr { min-width: 8rem; }
@media (max-width: 700px) { .jobs-table { min-width: 680px; } }

/* Multi-day jobs (2026-10-08) */
.md-toggle { display: flex; align-items: center; gap: var(--space-2); margin-top: var(--space-2); font-size: 14px; }
.md-toggle input { width: auto; margin: 0; }
.job-day-fields { margin-top: var(--space-3); }
.job-day-row { display: grid; grid-template-columns: 7.5rem 1fr; gap: var(--space-2); align-items: center; margin-top: var(--space-2); }
.job-day-row span { font-size: 14px; color: var(--muted); }
.job-day-notes { margin: var(--space-1) 0 0; padding-left: 1.1rem; }
.job-day-line { font-size: 14px; margin-top: 2px; }
.calendar-job .cj-note { display: block; overflow: hidden; text-overflow: ellipsis; opacity: 0.8; }
.week-job .cj-note { display: inline; white-space: normal; }
.week-job .cj-note::before { content: " · "; }
.job-form [hidden] { display: none !important; }

/* Vantik invoices (2026-10-09) */
.inv-state-draft { color: var(--muted); }
.inv-state-awaiting_deposit, .inv-state-awaiting_payment { color: var(--blue); }
.inv-state-deposit_paid { color: var(--warn); }
.inv-state-paid { color: #fff; background: var(--good); font-weight: 600; }
.inv-links { margin-top: var(--space-2); }
.inv-state-refunded { color: #ff8a80; }
.inv-state-partially_refunded { color: var(--warn); }
.invoice-status-partially_refunded { color: var(--warn); }
.inv-refund-amt { width: 7rem; display: inline-block; margin-left: var(--space-1); }
.inv-link-job select { max-width: 100%; }
.fin-refunds { margin-top: var(--space-3); }
