/* External monochrome SVGs keep theme-aware color and independent caching. */
.ui-icon { display: inline-block; width: 16px; height: 16px; flex-shrink: 0; vertical-align: middle; background-color: currentColor; -webkit-mask: var(--ui-icon) center / contain no-repeat; mask: var(--ui-icon) center / contain no-repeat; }
.ui-icon-sun { --ui-icon: url("../icons/ui/sun.svg"); }
.ui-icon-moon { --ui-icon: url("../icons/ui/moon.svg"); }
.ui-icon-user { --ui-icon: url("../icons/ui/user.svg"); }
.ui-icon-arrow-left { --ui-icon: url("../icons/ui/arrow-left.svg"); }
.ui-icon-chevron-down { --ui-icon: url("../icons/ui/chevron-down.svg"); }

/*
 * Light and dark theme tokens.
 *
 * The application historically shipped a single dark palette written directly
 * into the stylesheets. Theme selection therefore works in two layers:
 *
 * 1. Every shared token below is re-declared for the light theme, which the
 *    existing `var(...)` references pick up automatically.
 * 2. A small set of hard-painted rules (bodies, native controls, scrollbars,
 *    status chips) is corrected per theme so text, borders, links, focus
 *    rings, disabled controls and status colours stay readable in both.
 *
 * `html[data-polytalk-theme]` is set by `theme.js` before first paint and
 * always carries the palette actually rendered, so the native `color-scheme`
 * matches what the user sees even while the preference is still `system`
 * (`data-polytalk-theme-mode` keeps that raw preference). The rules below
 * therefore never need to duplicate the media query.
 */

:root {
  --polytalk-surface-ink: #f5f8ff;
  --polytalk-surface-ink-soft: #c6cfdd;
  --polytalk-chrome-bg: rgba(22, 33, 62, 0.76);
  --polytalk-option-bg: #101b3a;
  --polytalk-option-text: #ffffff;
  --polytalk-option-disabled-text: #6f7890;
  --polytalk-scrollbar-track: rgba(13, 24, 51, 0.82);
  --polytalk-focus-ring: rgba(255, 167, 38, 0.92);
  --polytalk-status-success: #4ade80;
  --polytalk-status-warning: #eab308;
  --polytalk-status-error: #ef4444;
  --polytalk-status-info: #7cc4ff;
  /* One design language for both palettes. A surface, its foreground, the
     brand accent and the four status colours are re-declared for the light
     theme below, so a component never has to know which palette it is on.
     The shadow ramp is the same restrained elevation recipe in both themes:
     a thin border plus one soft shadow, never a second spatial treatment for
     dark mode. */
  --pt-shadow-1: 0 1px 2px rgba(8, 14, 34, 0.32);
  --pt-shadow-2: 0 8px 22px rgba(8, 14, 34, 0.38);
  --pt-shadow-3: 0 18px 42px rgba(8, 14, 34, 0.44);
  --pt-elev-1: var(--pt-shadow-1);
  --pt-elev-2: var(--pt-shadow-2);
  --pt-elev-3: var(--pt-shadow-3);
  --pt-scrim: rgba(7, 11, 24, 0.66);
  --pt-icon-stroke: #e8eefc;
  --pt-icon-stroke-soft: #c7d2e8;
  --pt-on-brand: #ffffff;
  --pt-brand-fg: var(--poly-primary);
  --pt-brand-fg-hover: var(--poly-secondary);
  --pt-status-success: var(--polytalk-status-success);
  --pt-status-warning: var(--polytalk-status-warning);
  --pt-status-error: var(--polytalk-status-error);
  --pt-action-danger: #fda4af;
  --pt-status-info: var(--polytalk-status-info);
  /* Brand accents are foreground-safe per palette: the dark theme keeps the
     bright orange, the light theme re-declares `--poly-primary` darker. */
  --polytalk-accent-strong: var(--poly-primary);
  --polytalk-accent-strong-hover: var(--poly-secondary);
}

/* ------------------------------------------------------------------ tokens */

html[data-polytalk-theme-resolved="light"] {
  --pt-control-bg: #f7f8fa;
  --pt-control-hover: #fff0e4;
  --pt-control-border: #d4dce5;
  --pt-control-selected: #fff1e7;
  --pt-control-selected-border: #d8a17a;
  --pt-control-ink: #b83f0c;
  --pt-control-accent: #b83f0c;
  --pt-control-danger-bg: #faf0f1;
  --pt-control-danger-border: #dfc3c8;
  --pt-control-danger-ink: #974653;
  --pt-control-focus: #526f8b;
  --pt-control-toggle: #66859f;
  --bg-dark: #eef1f8;
  --bg-card: #ffffff;
  --bg-card-soft: #f2f5fb;
  --text: #17202f;
  --text-muted: #5b6a80;
  --line: rgba(23, 32, 47, 0.14);
  --shadow: 0 10px 30px rgba(24, 39, 75, 0.14);
  --premium-card-border: rgba(30, 105, 190, 0.28);
  --premium-card-bg-start: rgba(232, 240, 252, 0.95);
  --premium-card-bg-end: rgba(246, 249, 254, 0.95);
  --premium-card-highlight: rgba(30, 136, 229, 0.12);
  --premium-option-border: rgba(23, 32, 47, 0.14);
  --premium-option-bg: rgba(23, 32, 47, 0.04);
  --premium-option-text: #2a3550;
  --conv-source-color: #155fa8;
  --conv-source-bg: rgba(30, 136, 229, 0.12);
  --conv-source-text: #10395f;
  --conv-source-segment-text: #155fa8;
  --conv-source-glow: rgba(30, 136, 229, 0.2);
  --conv-target-color: #c2470f;
  --conv-target-bg: rgba(255, 122, 24, 0.14);
  --conv-target-text: #8c3a10;
  --conv-target-glow: rgba(255, 122, 24, 0.22);
  --polytalk-surface-ink: #17202f;
  --polytalk-surface-ink-soft: #3a4a63;
  /* Surfaces that painted themselves with a bare white/alpha fill. */
  --polytalk-fill-faint: rgba(23, 32, 47, 0.06);
  --polytalk-fill-soft: rgba(23, 32, 47, 0.09);
  --polytalk-surface-panel: #ffffff;
  --polytalk-surface-inset: #f5f8fd;
  --polytalk-chrome-bg: rgba(255, 255, 255, 0.88);
  --polytalk-option-bg: #ffffff;
  --polytalk-option-text: #17202f;
  --polytalk-option-disabled-text: #92a0b5;
  --polytalk-scrollbar-track: rgba(23, 32, 47, 0.1);
  --polytalk-focus-ring: #b34700;
  --polytalk-status-success: #15734a;
  --polytalk-status-warning: #8a6100;
  --polytalk-status-error: #b3261e;
  --polytalk-status-info: #155fa8;
  --polytalk-accent-strong: #c2470f;
  --polytalk-accent-strong-hover: #9a380a;
  /* The light counterparts of the shared tokens above: light surfaces, dark
     foregrounds, and status colours darkened enough to read on a white card
     while keeping the same success/warning/error/info meaning. */
  --pt-surface: #ffffff;
  --pt-surface-soft: #f5f8fd;
  --pt-surface-inset: #eef1f8;
  --pt-text: #17202f;
  --pt-text-muted: #5b6a80;
  --pt-text-soft: #3a4a63;
  --pt-border: rgba(23, 32, 47, 0.14);
  --pt-border-strong: rgba(23, 32, 47, 0.24);
  --pt-brand-fg: #c2470f;
  --pt-brand-fg-hover: #9a380a;
  --pt-brand-tint: rgba(194, 71, 15, 0.1);
  --pt-brand-tint-strong: rgba(194, 71, 15, 0.18);
  --pt-brand-border: rgba(194, 71, 15, 0.38);
  --pt-on-brand: #ffffff;
  --pt-status-success: #15734a;
  --pt-status-warning: #8a6100;
  --pt-status-error: #b3261e;
  --pt-action-danger: var(--pt-status-error);
  --pt-status-info: #155fa8;
  --pt-status-success-tint: rgba(21, 115, 74, 0.12);
  --pt-status-warning-tint: rgba(138, 97, 0, 0.12);
  --pt-status-error-tint: rgba(179, 38, 30, 0.12);
  --pt-status-info-tint: rgba(21, 95, 168, 0.12);
  --pt-success: #22c55e;
  --pt-warning: #d97706;
  --pt-danger: #dc2626;
  --pt-info: #0284c7;
  --pt-icon-stroke: #1f2937;
  --pt-icon-stroke-soft: #334155;
  --pt-scrim: rgba(15, 23, 42, 0.4);
  --pt-shadow-1: 0 1px 2px rgba(15, 23, 42, 0.06);
  --pt-shadow-2: 0 6px 18px rgba(15, 23, 42, 0.1);
  --pt-shadow-3: 0 16px 38px rgba(15, 23, 42, 0.14);
  --pt-elev-1: var(--pt-shadow-1);
  --pt-elev-2: var(--pt-shadow-2);
  --pt-elev-3: var(--pt-shadow-3);
  /* The brand orange is a foreground colour on light surfaces, so the shared
     accent token resolves to the accessible brown-orange instead. */
  --poly-primary: #c2470f;
  --poly-primary-alpha: rgba(194, 71, 15, 0.14);
  --poly-primary-glow: rgba(194, 71, 15, 0.32);
  color-scheme: light;
}

/* The bare `system` attribute only survives during the boot window before
   theme.js resolves the palette, so the dark palette stays the default there. */
html[data-polytalk-theme="system"],
html[data-polytalk-theme-resolved="dark"] {
  color-scheme: dark;
}

/* The dark palette is the shipped default, so it owns no token block of its
   own. These are the raised-control ramps the dark canvas needs and the light
   palette already names equivalents of: the film a control sits on, the
   brighter film it lifts to on hover/focus, and the border both states carry.
   Declaring them here means no component has to restate the same white-alpha
   literal, and a rebrand reaches the dark canvas through the same tokens. */
html[data-polytalk-theme="system"],
html[data-polytalk-theme-resolved="dark"] {
  --pt-hover-surface: rgba(255, 255, 255, 0.06);
  --pt-hover-surface-strong: rgba(255, 255, 255, 0.12);
  --pt-hover-border: rgba(255, 255, 255, 0.24);
}

html[data-polytalk-theme-resolved="light"] body {
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 122, 24, 0.16), transparent 30%),
    radial-gradient(circle at 80% 10%, rgba(30, 136, 229, 0.16), transparent 28%),
    var(--bg-dark);
}

/* ------------------------------------------------------- shared components */

/* Native widgets follow the theme token, never the historical dark default. */
html[data-polytalk-theme-resolved="light"] option {
  background: var(--polytalk-option-bg);
  color: var(--polytalk-option-text);
}

html[data-polytalk-theme-resolved="light"] option:disabled {
  color: var(--polytalk-option-disabled-text);
}

html[data-polytalk-theme-resolved="light"] select {
  scrollbar-color: rgba(255, 122, 24, 0.6) var(--polytalk-scrollbar-track);
}

html[data-polytalk-theme-resolved="light"] select::-webkit-scrollbar-track {
  background: var(--polytalk-scrollbar-track);
}

html[data-polytalk-theme-resolved="light"] select::-webkit-scrollbar-thumb {
  border-color: var(--polytalk-scrollbar-track);
}

html[data-polytalk-theme-resolved="light"] .custom-language-select-list {
  background: #ffffff;
  border-color: rgba(30, 136, 229, 0.32);
  box-shadow: 0 18px 38px rgba(24, 39, 75, 0.18);
  scrollbar-color: rgba(30, 136, 229, 0.6) #ffffff;
}

html[data-polytalk-theme-resolved="light"] .custom-language-select-list::-webkit-scrollbar-track {
  background: #ffffff;
}

html[data-polytalk-theme-resolved="light"] .custom-language-select-option {
  color: #17202f;
}

html[data-polytalk-theme-resolved="light"] .custom-language-select-option:hover,
html[data-polytalk-theme-resolved="light"] .custom-language-select-option:focus-visible {
  background: rgba(30, 136, 229, 0.14);
}

html[data-polytalk-theme-resolved="light"] .custom-language-select-option.is-selected {
  background: rgba(30, 136, 229, 0.22);
}

html[data-polytalk-theme-resolved="light"] .custom-language-select-option:disabled {
  color: var(--polytalk-option-disabled-text);
}

/* Favourite star in the language list. The base ink is a pale translucent
   white for the dark list only, so on the white Light Mode list both states
   needed their own tones: a muted outline star and the warning-amber filled
   star, plus the two hover states the base stylesheet also restates. */
html[data-polytalk-theme-resolved="light"] .language-star {
  color: var(--pt-text-muted);
}

html[data-polytalk-theme-resolved="light"] .language-star[data-is-favorite="true"] {
  color: var(--pt-status-warning);
}

html[data-polytalk-theme-resolved="light"] .language-star[data-is-favorite="false"]:hover {
  color: var(--polytalk-accent-strong);
}

html[data-polytalk-theme-resolved="light"] .language-star[data-is-favorite="true"]:hover {
  color: var(--pt-status-error);
}

html[data-polytalk-theme-resolved="light"] .custom-language-select-button {
  background:
    linear-gradient(135deg, rgba(255, 122, 24, 0.08), rgba(30, 136, 229, 0.1)),
    #ffffff;
  border-color: rgba(23, 32, 47, 0.18);
  color: #17202f;
}

html[data-polytalk-theme-resolved="light"] .custom-language-select-button::after {
  color: #3a4a63;
}

/* Navigation and status chips. */
html[data-polytalk-theme-resolved="light"] .enterprise-nav {
  background: var(--polytalk-chrome-bg);
}

html[data-polytalk-theme-resolved="light"] .nav-button {
  color: #33415a;
}

html[data-polytalk-theme-resolved] .enterprise-nav a,
html[data-polytalk-theme-resolved] .enterprise-nav a.active {
  color: var(--pt-brand-fg);
}

html[data-polytalk-theme-resolved="light"] .enterprise-nav a.is-disabled {
  color: rgba(51, 65, 90, 0.56);
  background: rgba(23, 32, 47, 0.06);
}

html[data-polytalk-theme-resolved="light"] .language-pair-divider {
  color: #5b6a80;
}

/* Focus rings stay visible on both palettes. */
html[data-polytalk-theme-resolved="light"] button:focus-visible,
html[data-polytalk-theme-resolved="light"] select:focus-visible,
html[data-polytalk-theme-resolved="light"] input:focus-visible,
html[data-polytalk-theme-resolved="light"] textarea:focus-visible,
html[data-polytalk-theme-resolved="light"] a:focus-visible {
  outline-color: var(--polytalk-focus-ring);
}

/* Confidence chips keep their meaning, not just their exact hue. */
html[data-polytalk-theme-resolved="light"] .confidence-badge.confidence-high {
  color: var(--polytalk-status-success) !important;
  background: rgba(21, 122, 74, 0.12);
  border-color: rgba(21, 122, 74, 0.35);
}

html[data-polytalk-theme-resolved="light"] .confidence-badge.confidence-medium {
  color: var(--polytalk-status-warning) !important;
  background: rgba(191, 139, 10, 0.14);
  border-color: rgba(191, 139, 10, 0.38);
}

html[data-polytalk-theme-resolved="light"] .confidence-badge.confidence-low {
  color: var(--polytalk-status-error) !important;
  background: rgba(217, 68, 60, 0.12);
  border-color: rgba(217, 68, 60, 0.35);
}

/* Pipeline pills render their own background, so the inactive pill needs a
   light surface to stay legible. */
html[data-polytalk-theme-resolved="light"] .pipeline-stage,
html[data-polytalk-theme-resolved="light"] .pipeline-mode-session-stage {
  --stage-background: #dde4f0;
  --stage-border: #b3c0d4;
  color: #33415a;
}

html[data-polytalk-theme-resolved="light"] .pipeline-stage.passed,
html[data-polytalk-theme-resolved="light"] .pipeline-mode-session-stage.passed {
  color: #1f2b3f;
}

html[data-polytalk-theme-resolved="light"] .release-notice {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(179, 71, 0, 0.35);
  color: #33415a;
}

/* --------------------------------------------------------------- surfaces */

/* Shared surfaces that paint themselves with the raw dark card tokens inherit
   the light palette from here, so no page-specific override is needed. */
html[data-polytalk-theme-resolved="light"] .panel,
html[data-polytalk-theme-resolved="light"] .card,
html[data-polytalk-theme-resolved="light"] .modal,
html[data-polytalk-theme-resolved="light"] .dialog,
html[data-polytalk-theme-resolved="light"] .form-card,
html[data-polytalk-theme-resolved="light"] .settings-card,
html[data-polytalk-theme-resolved="light"] .console-card {
  background: var(--bg-card);
  color: var(--text);
}

/* Status pills keep their hue but lose the dark background they assumed. */
html[data-polytalk-theme-resolved="light"] .status-pill {
  color: #2f3a4f;
}

html[data-polytalk-theme-resolved="light"] .status-pill[data-state="error"] {
  color: #8b1f1f;
  background: rgba(179, 38, 30, 0.12);
  border-color: rgba(179, 38, 30, 0.32);
}

html[data-polytalk-theme-resolved="light"] .status-pill[data-state="pending"] {
  color: #6d4c00;
  background: rgba(191, 139, 10, 0.14);
  border-color: rgba(191, 139, 10, 0.34);
}

html[data-polytalk-theme-resolved="light"] .status-pill[data-state="closed"] {
  color: #44506a;
  background: rgba(68, 80, 106, 0.1);
  border-color: rgba(68, 80, 106, 0.28);
}

/* Console chrome, transcripts and controls. */
html[data-polytalk-theme-resolved="light"] .nav-button,
html[data-polytalk-theme-resolved="light"] .language-select span,
html[data-polytalk-theme-resolved="light"] .settings-field span,
html[data-polytalk-theme-resolved="light"] .custom-instruction-field span,
html[data-polytalk-theme-resolved="light"] .custom-instruction-field textarea,
html[data-polytalk-theme-resolved="light"] .translation-mode-field select,
html[data-polytalk-theme-resolved="light"] .output-text,
html[data-polytalk-theme-resolved="light"] .linked-segment,
html[data-polytalk-theme-resolved="light"] .panel-action-primary,
html[data-polytalk-theme-resolved="light"] .player-speeds button,
html[data-polytalk-theme-resolved="light"] .player-volume-control,
html[data-polytalk-theme-resolved="light"] .player-download,
html[data-polytalk-theme-resolved="light"] .swap-marker,
html[data-polytalk-theme-resolved="light"] .session-timer strong,
html[data-polytalk-theme-resolved="light"] .readiness-line,
html[data-polytalk-theme-resolved="light"] .voice-output strong,
html[data-polytalk-theme-resolved="light"] .runtime-voice-primary,
html[data-polytalk-theme-resolved="light"] .runtime-microphone,
html[data-polytalk-theme-resolved="light"] .polytalk-mode-icon {
  color: var(--text);
}

html[data-polytalk-theme-resolved="light"] .panel-action {
  background: var(--premium-option-bg);
  border-color: var(--line);
  color: var(--text);
}

/* Accent-coloured actions darken instead of losing contrast on white. */
html[data-polytalk-theme-resolved="light"] .btn-tertiary,
html[data-polytalk-theme-resolved="light"] .btn-stop {
  color: var(--polytalk-accent-strong);
}

html[data-polytalk-theme-resolved="light"] .btn-tertiary:hover:not(:disabled),
html[data-polytalk-theme-resolved="light"] .btn-stop:hover:not(:disabled) {
  color: var(--polytalk-accent-strong-hover);
}

/* Tooltips and native option lists render their own surface. */
html[data-polytalk-theme-resolved="light"] .stage-tooltip-text,
html[data-polytalk-theme-resolved="light"] .pipeline-mode-tooltip,
html[data-polytalk-theme-resolved="light"] .translation-mode-field select option {
  background: var(--bg-card);
  color: var(--text);
}

html[data-polytalk-theme-resolved="light"] .pipeline-mode-tooltip::after,
html[data-polytalk-theme-resolved="light"] .stage-tooltip-text::after {
  border-bottom-color: var(--bg-card);
}

/* System notices and the onboarding language picker. */
html[data-polytalk-theme-resolved="light"] .system-notice {
  background: var(--bg-card);
  border-color: var(--line);
  color: var(--text);
}

html[data-polytalk-theme-resolved="light"] .onboarding-language-grid select {
  background-color: var(--bg-card);
  background-image: none;
  color: var(--text);
}

html[data-polytalk-theme-resolved="light"] .onboarding-language-grid select option {
  background: var(--bg-card);
  color: var(--text);
}

/* ------------------------------------------------------------------ pricing */

/* The marketing and account pages paint their own palette with these tokens,
   so the light theme re-declares the same set. `body.pricing-page` also paints
   its own decorative dark gradient, which would otherwise survive the token
   change, so its body is matched explicitly. */
html[data-polytalk-theme-resolved="light"] body,
html[data-polytalk-theme-resolved="light"] body.pricing-page,
html[data-polytalk-theme-resolved="light"] .pricing-shell {
  --pricing-bg: #f4f6fb;
  --pricing-panel: #ffffff;
  --pricing-panel-strong: #eef1f8;
  --pricing-line: rgba(23, 32, 47, 0.14);
  --pricing-text: #17202f;
  --pricing-muted: #5b6a80;
  --pricing-orange: #c2470f;
  --pricing-blue: #155fa8;
}

/* The decorative marketing gradients are tuned for the dark canvas; on light
   surfaces they become the pale brand wash instead of dark blobs. */
html[data-polytalk-theme-resolved="light"] body.pricing-page {
  background:
    radial-gradient(circle at 10% 0, rgba(194, 71, 15, 0.12) 0, transparent 35%),
    radial-gradient(circle at 90% 0, rgba(21, 95, 168, 0.12) 0, transparent 40%),
    var(--pricing-bg);
}

/* ------------------------------------------------------ preference controls */

.theme-mode-field {
  grid-column: 1 / -1;
}

.theme-mode-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 420px;
  gap: 8px;
}

.theme-mode-group .theme-mode-option {
  position: relative;
  display: inline-flex;
  justify-content: center;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  align-items: center;
  gap: 6px;
  padding: 8px 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--premium-option-bg);
  color: var(--premium-option-text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.theme-mode-option input {
  /* Keep native radio keyboard behavior without crowding the segment label. */
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  padding: 0;
  margin: 0;
  accent-color: var(--poly-primary);
  cursor: pointer;
}

.theme-mode-option span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.theme-mode-option:has(input:checked) {
  border-color: var(--poly-primary);
  background: var(--poly-primary-alpha);
  color: var(--text);
}

.theme-mode-option:focus-within {
  outline: 2px solid var(--polytalk-focus-ring);
  outline-offset: 2px;
}

.theme-mode-option input:disabled + span {
  color: var(--text-muted);
}

.theme-mode-note {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

@media (prefers-reduced-motion: no-preference) {
  html[data-polytalk-theme-resolved] .theme-mode-option {
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
  }
}

/* ==================================================== light component palette

   The stylesheets historically written for the single dark palette hard-paint
   their surfaces and their foregrounds (`rgba(13, 24, 51, ...)`, `#dfe7f5`,
   `rgba(255, 255, 255, 0.035)`...). Re-declaring the tokens above cannot reach
   those rules, so every reported component is corrected here, in the one
   stylesheet that loads last in the console cascade. Nothing below changes the
   dark palette; it only makes the same component legible on a light canvas.

   ---------------------------------------------------------------- shared fills */

/* Faint insets that were a white film over the dark canvas become a dark film
   over the light canvas; the ones that keep a surface of their own get a real
   panel colour. */
html[data-polytalk-theme-resolved="light"] .analytics-row,
html[data-polytalk-theme-resolved="light"] .detail-meta-item,
html[data-polytalk-theme-resolved="light"] .enterprise-strip article,
html[data-polytalk-theme-resolved="light"] .event-list-panel,
html[data-polytalk-theme-resolved="light"] .history-filter-shell,
html[data-polytalk-theme-resolved="light"] .history-row,
html[data-polytalk-theme-resolved="light"] .onboarding-option,
html[data-polytalk-theme-resolved="light"] .preview-helper,
html[data-polytalk-theme-resolved="light"] .privacy-action-list > div {
  border-color: var(--line);
  background: var(--polytalk-fill-faint);
  color: var(--text);
}

/* Panels that own a background of their own, so their nested headings and
   values cannot inherit a legible colour by accident. */
html[data-polytalk-theme-resolved="light"] .analytics-card,
html[data-polytalk-theme-resolved="light"] .analytics-heading strong,
html[data-polytalk-theme-resolved="light"] .detail-grid article,
html[data-polytalk-theme-resolved="light"] .event-list-panel,
html[data-polytalk-theme-resolved="light"] .history-detail-panel,
html[data-polytalk-theme-resolved="light"] .history-list-panel,
html[data-polytalk-theme-resolved="light"] .settings-card-heading h2,
html[data-polytalk-theme-resolved="light"] .site-notice {
  background: var(--polytalk-surface-panel);
  border-color: var(--line);
  color: var(--text);
}

/* ------------------------------------------------------- shared text tones

   A pale ink only worked on the dark canvas. Each tone gets its darker
   equivalent, so a heading, label, value or helper line that disappeared in
   Light mode is legible again without touching the dark palette. */
html[data-polytalk-theme-resolved="light"] .ai-instruction-card .custom-instruction-field > span,
html[data-polytalk-theme-resolved="light"] .analytics-row span,
html[data-polytalk-theme-resolved="light"] .detail-meta dd,
html[data-polytalk-theme-resolved="light"] .detail-panel-heading .icon-action,
html[data-polytalk-theme-resolved="light"] .detail-text,
html[data-polytalk-theme-resolved="light"] .event-list,
html[data-polytalk-theme-resolved="light"] .history-row,
html[data-polytalk-theme-resolved="light"] .history-row em,
html[data-polytalk-theme-resolved="light"] .history-toolbar span,
html[data-polytalk-theme-resolved="light"] .language-select span,
html[data-polytalk-theme-resolved="light"] .premium-preview-copy,
html[data-polytalk-theme-resolved="light"] .preview-helper,
html[data-polytalk-theme-resolved="light"] .site-notice-copy p,
html[data-polytalk-theme-resolved="light"] .voice-kicker {
  color: var(--text);
}

/* Warm accent inks (statuses, player controls, AI notes) keep their role and
   darken enough to survive on a white card. */
html[data-polytalk-theme-resolved="light"] .ai-notes-section h4,
html[data-polytalk-theme-resolved="light"] .analytics-row strong,
html[data-polytalk-theme-resolved="light"] .event-list strong,
html[data-polytalk-theme-resolved="light"] .history-filter-toggle,
html[data-polytalk-theme-resolved="light"] .history-status-tabs button.active,
html[data-polytalk-theme-resolved="light"] .history-status-tabs button:hover,
html[data-polytalk-theme-resolved="light"] .panel-action-primary,
html[data-polytalk-theme-resolved="light"] .player-download,
html[data-polytalk-theme-resolved="light"] .player-volume-control,
html[data-polytalk-theme-resolved="light"] .player-speeds button.active,
html[data-polytalk-theme-resolved="light"] .swap-marker {
  color: var(--polytalk-accent-strong);
}

/* --------------------------------------------------------------- live console */

html[data-polytalk-theme-resolved="light"] .custom-instruction-field textarea,
html[data-polytalk-theme-resolved="light"] .translation-mode-field select {
  background: var(--polytalk-surface-inset);
  border-color: var(--line);
  color: var(--text);
}

html[data-polytalk-theme-resolved="light"] .translation-mode-field select option {
  background: var(--polytalk-option-bg);
  color: var(--polytalk-option-text);
}

html[data-polytalk-theme-resolved="light"] .readiness-steps li {
  background: var(--polytalk-fill-faint);
  color: var(--text);
}

/* The audio player keeps its brand glow but loses the dark canvas fill, so its
   status line, timestamps, speed chips and volume control stay readable. */
html[data-polytalk-theme-resolved="light"] .voice-output {
  background:
    radial-gradient(circle at 0% 50%, rgba(255, 122, 24, 0.14), transparent 32%),
    linear-gradient(135deg, rgba(255, 122, 24, 0.1), rgba(30, 136, 229, 0.1)),
    var(--polytalk-surface-panel);
  border-color: rgba(194, 71, 15, 0.38);
}

html[data-polytalk-theme-resolved="light"] .player-download,
html[data-polytalk-theme-resolved="light"] .player-speeds button {
  background: var(--polytalk-fill-soft);
  border-color: var(--line);
  color: var(--text-muted);
}

html[data-polytalk-theme-resolved="light"] .player-speeds button.active {
  background: rgba(194, 71, 15, 0.14);
  border-color: rgba(194, 71, 15, 0.42);
}

/* Transcript, translation and control chrome. */
html[data-polytalk-theme-resolved="light"] .controls .btn-swap,
html[data-polytalk-theme-resolved="light"] .recording-controls .btn-conversation,
html[data-polytalk-theme-resolved="light"] .session-timer span {
  color: var(--text-muted);
}

html[data-polytalk-theme-resolved="light"] .btn-tertiary {
  background: var(--polytalk-fill-soft);
  border-color: var(--line);
}

html[data-polytalk-theme-resolved="light"] .panel-action:disabled,
html[data-polytalk-theme-resolved="light"] .btn:disabled {
  color: var(--polytalk-option-disabled-text);
}

html[data-polytalk-theme-resolved="light"] .panel-action[data-tooltip-flash="true"] {
  color: var(--polytalk-accent-strong);
}

html[data-polytalk-theme-resolved="light"] .panel-action[data-tooltip-flash="true"]::after {
  background: var(--polytalk-surface-panel);
  border-color: rgba(194, 71, 15, 0.5);
  color: var(--text);
}

html[data-polytalk-theme-resolved="light"] .readiness-line,
html[data-polytalk-theme-resolved="light"] .runtime-voice-primary,
html[data-polytalk-theme-resolved="light"] .runtime-microphone {
  color: var(--text);
}

html[data-polytalk-theme-resolved="light"] .runtime-voice-primary {
  background: transparent;
  border-color: var(--line);
}

/* Keep the live animation on the page surface, with saturated bars that read
   on white. The existing amplitude, timing and reduced-motion rules still own
   the animation in both palettes. */
html[data-polytalk-theme-resolved="light"] .polytalk-runtime-voice {
  --runtime-source: #1876b8;
  --runtime-source-deep: #155fa8;
  --runtime-target: #c55a12;
  --runtime-target-deep: #a13c0f;
}

html[data-polytalk-theme-resolved="light"] .runtime-control-label {
  color: var(--pt-text-soft);
}

html[data-polytalk-theme-resolved="light"] .polytalk-runtime-voice[data-state="ready"] .runtime-waveform > span,
html[data-polytalk-theme-resolved="light"] .polytalk-runtime-voice[data-state="paused"] .runtime-waveform > span,
html[data-polytalk-theme-resolved="light"] .polytalk-runtime-voice[data-state="listening"] .runtime-waveform-target > span,
html[data-polytalk-theme-resolved="light"] .polytalk-runtime-voice[data-state="streaming"] .runtime-waveform-target > span,
html[data-polytalk-theme-resolved="light"] .polytalk-runtime-voice[data-state="speaking"] .runtime-waveform-source > span {
  opacity: 0.65;
}

html[data-polytalk-theme-resolved] .runtime-session-actions .btn-tertiary {
  --runtime-action-color: var(--pt-status-info);
}

html[data-polytalk-theme-resolved] .runtime-session-actions .btn-stop {
  --runtime-action-color: var(--pt-action-danger);
}

html[data-polytalk-theme-resolved] .runtime-session-actions .runtime-mini-action {
  background: color-mix(in srgb, var(--runtime-action-color) 12%, var(--bg-card));
  border-color: color-mix(in srgb, var(--runtime-action-color) 55%, var(--bg-card));
  color: var(--runtime-action-color);
  box-shadow: var(--pt-shadow-1);
}

html[data-polytalk-theme-resolved] .runtime-session-actions .runtime-mini-action:hover:not(:disabled) {
  background: color-mix(in srgb, var(--runtime-action-color) 22%, var(--bg-card));
  border-color: var(--runtime-action-color);
  color: var(--runtime-action-color);
  box-shadow: var(--pt-shadow-2);
}

html[data-polytalk-theme-resolved] .runtime-session-actions .runtime-mini-action:focus-visible {
  outline: 2px solid var(--polytalk-focus-ring);
  outline-offset: 2px;
}

html[data-polytalk-theme-resolved] .tab-share-message {
  color: var(--polytalk-surface-ink-soft);
}

html[data-polytalk-theme-resolved="light"] .session-timer strong {
  color: var(--text);
}

html[data-polytalk-theme-resolved="light"] .enterprise-strip strong,
html[data-polytalk-theme-resolved="light"] .enterprise-strip span {
  color: var(--text);
}

/* ----------------------------------------------------------- settings & dialogs */

html[data-polytalk-theme-resolved="light"] .privacy-danger-zone {
  background: rgba(255, 245, 245, 0.95) !important;
}

html[data-polytalk-theme-resolved="light"] .privacy-danger-zone strong,
html[data-polytalk-theme-resolved="light"] .privacy-danger-zone small,
html[data-polytalk-theme-resolved="light"] .privacy-danger-zone .settings-field span {
  color: var(--text);
}

/* The destructive red keeps its meaning; it only darkens enough to read. */
html[data-polytalk-theme-resolved="light"] .privacy-danger-label {
  color: #b3261e;
}

html[data-polytalk-theme-resolved="light"] .privacy-policy-links a {
  color: var(--polytalk-status-info);
}

html[data-polytalk-theme-resolved="light"] .premium-preview-fields input:disabled,
html[data-polytalk-theme-resolved="light"] .premium-preview-fields select:disabled,
html[data-polytalk-theme-resolved="light"] .endpoint-preview-fields input:disabled,
html[data-polytalk-theme-resolved="light"] .endpoint-preview-fields select:disabled,
html[data-polytalk-theme-resolved="light"] .settings-field input,
html[data-polytalk-theme-resolved="light"] .settings-field input:disabled,
html[data-polytalk-theme-resolved="light"] .settings-field textarea {
  background: var(--polytalk-surface-inset);
  border-color: var(--line);
  color: var(--text);
  opacity: 1;
}

/* Placeholders and helper copy must not disappear into the light field. */
html[data-polytalk-theme-resolved="light"] .history-toolbar input::placeholder,
html[data-polytalk-theme-resolved="light"] .settings-field input::placeholder,
html[data-polytalk-theme-resolved="light"] .settings-field textarea::placeholder {
  color: var(--polytalk-option-disabled-text);
}

html[data-polytalk-theme-resolved="light"] .glossary-entry {
  background: var(--polytalk-fill-soft);
  border-color: var(--line);
}

html[data-polytalk-theme-resolved="light"] .glossary-entry-word {
  color: var(--text);
}

html[data-polytalk-theme-resolved="light"] .glossary-helper,
html[data-polytalk-theme-resolved="light"] .glossary-counter {
  color: var(--text-muted);
}

html[data-polytalk-theme-resolved="light"] .glossary-empty {
  color: var(--polytalk-option-disabled-text);
}

/* The base card carries the dark canvas shadow (huge, near-black) plus a brand
   border and inset ring, all of which read as a stray slab and a coloured edge
   behind a white card on the light scrim. Use the shared elevation ramp and the
   palette's own boundary instead. */
html[data-polytalk-theme-resolved="light"] .confirm-modal,
html[data-polytalk-theme-resolved="light"] .feedback-modal {
  background: linear-gradient(145deg, #ffffff, #eef2fa);
  border-color: var(--pt-border-strong);
  box-shadow: var(--pt-shadow-3);
  color: var(--text);
}

html[data-polytalk-theme-resolved="light"] .confirm-modal-cancel,
html[data-polytalk-theme-resolved="light"] .feedback-modal-skip {
  background: var(--polytalk-fill-soft);
  color: var(--text);
}

/* background-color only: the quick-settings selects draw their own chevron
   via background-image, and the background shorthand would erase it. */
html[data-polytalk-theme-resolved="light"] .feedback-comment-field textarea,
html[data-polytalk-theme-resolved="light"] .quick-settings-field select {
  background-color: var(--polytalk-surface-inset);
  border-color: var(--line);
  color: var(--text);
}

html[data-polytalk-theme-resolved="light"] .quick-settings-note,
html[data-polytalk-theme-resolved="light"] .quick-settings-warning {
  color: var(--text-muted);
}

html[data-polytalk-theme-resolved="light"] .system-notice--compound {
  background: var(--polytalk-surface-panel);
  color: var(--text);
}

/* ------------------------------------------------------------- usage & subscription */

/* Summary cards (usage stats, subscription details) and their filter chips. */
html[data-polytalk-theme-resolved="light"] .metric-card,
html[data-polytalk-theme-resolved="light"] .metric-card-primary,
html[data-polytalk-theme-resolved="light"] .subscription-action-card,
html[data-polytalk-theme-resolved="light"] .subscription-state article {
  background: var(--polytalk-surface-panel);
  border-color: var(--line);
}

html[data-polytalk-theme-resolved="light"] .metric-card-primary,
html[data-polytalk-theme-resolved="light"] .subscription-action-card {
  border-color: rgba(194, 71, 15, 0.38);
}

html[data-polytalk-theme-resolved="light"] .metric-card strong,
html[data-polytalk-theme-resolved="light"] .subscription-state strong,
html[data-polytalk-theme-resolved="light"] .detail-meta dd,
html[data-polytalk-theme-resolved="light"] .detail-grid h3,
html[data-polytalk-theme-resolved="light"] .ai-notes-panel h3,
html[data-polytalk-theme-resolved="light"] .event-list-panel h3 {
  color: var(--text);
}

html[data-polytalk-theme-resolved="light"] .metric-card-warning strong {
  color: var(--polytalk-status-error);
}

html[data-polytalk-theme-resolved="light"] .history-filter-presets button,
html[data-polytalk-theme-resolved="light"] .history-status-tabs button {
  background: var(--polytalk-fill-soft);
  border-color: var(--line);
  color: var(--text-muted);
}

html[data-polytalk-theme-resolved="light"] .history-filter-presets button.active,
html[data-polytalk-theme-resolved="light"] .history-filter-presets button:hover,
html[data-polytalk-theme-resolved="light"] .history-filter-presets button:focus-visible,
html[data-polytalk-theme-resolved="light"] .history-status-tabs button.active,
html[data-polytalk-theme-resolved="light"] .history-status-tabs button:hover,
html[data-polytalk-theme-resolved="light"] .history-status-tabs button:focus-visible {
  background: rgba(194, 71, 15, 0.12);
  border-color: rgba(194, 71, 15, 0.42);
  color: var(--polytalk-accent-strong);
}

html[data-polytalk-theme-resolved="light"] .history-filter-toggle {
  background: rgba(194, 71, 15, 0.12);
  border-color: rgba(194, 71, 15, 0.42);
}

/* background-color only: .history-range-select draws its chevron with
   background-image, and the background shorthand would erase it. */
html[data-polytalk-theme-resolved="light"] .history-toolbar input,
html[data-polytalk-theme-resolved="light"] .history-toolbar .history-range-select,
html[data-polytalk-theme-resolved="light"] .history-title-editor input {
  background-color: var(--polytalk-surface-inset);
  border-color: var(--line);
  color: var(--text);
}

html[data-polytalk-theme-resolved="light"] .history-toolbar .history-range-select option {
  background: var(--polytalk-option-bg);
  color: var(--polytalk-option-text);
}

html[data-polytalk-theme-resolved="light"] .history-title-editor input:disabled {
  color: var(--polytalk-option-disabled-text);
  opacity: 1;
}

html[data-polytalk-theme-resolved="light"] .panel-action-danger {
  border-color: rgba(179, 38, 30, 0.5);
  color: var(--polytalk-status-error);
}

html[data-polytalk-theme-resolved="light"] .module-status {
  background: rgba(21, 95, 168, 0.1);
  border-color: rgba(21, 95, 168, 0.34);
  color: var(--polytalk-status-info);
}

html[data-polytalk-theme-resolved="light"] .module-status[data-state="error"] {
  background: rgba(179, 38, 30, 0.1);
  border-color: rgba(179, 38, 30, 0.34);
  color: var(--polytalk-status-error);
}

html[data-polytalk-theme-resolved="light"] .history-row.active,
html[data-polytalk-theme-resolved="light"] .history-row:hover {
  background: rgba(194, 71, 15, 0.1);
  box-shadow: none;
}

html[data-polytalk-theme-resolved="light"] .history-row em[data-status="completed"] {
  color: var(--polytalk-status-info);
}

html[data-polytalk-theme-resolved="light"] .history-row em[data-status="failed"] {
  color: var(--polytalk-status-error);
}

html[data-polytalk-theme-resolved="light"] .history-row em[data-status="disconnected"] {
  color: var(--polytalk-status-warning);
}

html[data-polytalk-theme-resolved="light"] .ai-notes-output,
html[data-polytalk-theme-resolved="light"] .ai-notes-actions,
html[data-polytalk-theme-resolved="light"] .ai-notes-loading-text {
  color: var(--text);
}

html[data-polytalk-theme-resolved="light"] .ai-notes-actions th,
html[data-polytalk-theme-resolved="light"] .ai-notes-actions td {
  border-top-color: var(--line);
}

/* --------------------------------------------------------- sign-in & registration

   The auth stylesheet ships with the same dark-only palette and is shared by
   the sign-in page and the settings language picker, so it follows the theme
   too. The Google Play badge is deliberately absent: its original black
   artwork is the explicit exception and is never recoloured. */
html[data-polytalk-theme-resolved="light"] .account-strip button,
html[data-polytalk-theme-resolved="light"] .auth-field input,
html[data-polytalk-theme-resolved="light"] .auth-locale-switcher select,
html[data-polytalk-theme-resolved="light"] .auth-secondary,
html[data-polytalk-theme-resolved="light"] .social-auth-button {
  background: var(--polytalk-surface-inset);
  border-color: var(--line);
  color: var(--text);
}

html[data-polytalk-theme-resolved="light"] .account-strip button {
  color: var(--text);
}

html[data-polytalk-theme-resolved="light"] .auth-aside article {
  background: var(--polytalk-fill-faint);
  color: var(--text);
}

html[data-polytalk-theme-resolved="light"] .ui-locale-switcher .custom-language-select-list {
  background: var(--polytalk-surface-panel);
}

/* -------------------------------------------------------------- scrollbars */

html[data-polytalk-theme-resolved="light"] .detail-text,
html[data-polytalk-theme-resolved="light"] .history-list {
  scrollbar-color: rgba(194, 71, 15, 0.5) var(--polytalk-fill-soft);
}

html[data-polytalk-theme-resolved="light"] .detail-text::-webkit-scrollbar-track,
html[data-polytalk-theme-resolved="light"] .history-list::-webkit-scrollbar-track {
  background: var(--polytalk-fill-soft);
}


/* --------------------------------------------------------- marketing & checkout

   Those pages load only `base.css` and `pricing.css`, and `pricing.css` paints
   its own form fields, checkout rows and support threads with a dark literal
   instead of the tokens the theme already re-declares. */
html[data-polytalk-theme-resolved="light"] .checkout-summary > div,
html[data-polytalk-theme-resolved="light"] .checkout-payment-methods label,
html[data-polytalk-theme-resolved="light"] .checkout-provider-notice,
html[data-polytalk-theme-resolved="light"] .commercial-form-card input,
html[data-polytalk-theme-resolved="light"] .commercial-form-card select,
html[data-polytalk-theme-resolved="light"] .commercial-form-card textarea,
html[data-polytalk-theme-resolved="light"] .go-live-date,
html[data-polytalk-theme-resolved="light"] .invoice-row,
html[data-polytalk-theme-resolved="light"] .pricing-controls select,
html[data-polytalk-theme-resolved="light"] .profile-form input,
html[data-polytalk-theme-resolved="light"] .profile-form select,
html[data-polytalk-theme-resolved="light"] .recurring-consent,
html[data-polytalk-theme-resolved="light"] .segmented,
html[data-polytalk-theme-resolved="light"] .support-dialog textarea,
html[data-polytalk-theme-resolved="light"] .support-ticket {
  background: var(--polytalk-surface-inset);
  border-color: var(--pricing-line);
  color: var(--pricing-text);
}

html[data-polytalk-theme-resolved="light"] .support-thread-entry--original,
html[data-polytalk-theme-resolved="light"] .support-thread-entry--customer,
html[data-polytalk-theme-resolved="light"] .support-thread-entry--support {
  background: var(--polytalk-surface-inset);
  border-color: var(--pricing-line);
}

/* --------------------------------------------------------- purchase history

   The purchase-history wrapper and its rows also hard-painted a white film on
   top of a dark panel. */
html[data-polytalk-theme-resolved="light"] .purchase-history-table-wrapper,
html[data-polytalk-theme-resolved="light"] .purchase-history-table tbody tr {
  background: var(--polytalk-fill-faint);
  border-color: var(--line);
}

html[data-polytalk-theme-resolved="light"] .purchase-history-table tbody td {
  border-bottom-color: var(--line);
  color: var(--text);
}

/* The signed-in status chip is rendered with a pale ink and a translucent
   dark fill; the surface rules above already left the ink on the wrong side. */
html[data-polytalk-theme-resolved="light"] .status-pill,
html[data-polytalk-theme-resolved="light"] .status-pill[data-state="closed"] {
  background: var(--polytalk-fill-soft);
  color: var(--text);
}

/* Muted helper copy that was a white film over the dark canvas. */
html[data-polytalk-theme-resolved="light"] .feedback-invite-star,
html[data-polytalk-theme-resolved="light"] .feedback-star,
html[data-polytalk-theme-resolved="light"] .feedback-toast-dismiss,
html[data-polytalk-theme-resolved="light"] .last-purchase-date,
html[data-polytalk-theme-resolved="light"] .purchase-total-count,
html[data-polytalk-theme-resolved="light"] .social-auth-divider {
  color: var(--text-muted);
}

/* The owner pointed out Refresh and Clear in the same row: they are
   `.btn-tertiary`, whose brand-gold ink belonged to a dark fill. */
html[data-polytalk-theme-resolved="light"] .history-filter-actions .btn-tertiary {
  background: var(--polytalk-fill-soft);
  border-color: var(--line);
  color: var(--text);
}

html[data-polytalk-theme-resolved="light"] .history-filter-actions .btn-tertiary:hover:not(:disabled),
html[data-polytalk-theme-resolved="light"] .history-filter-actions .btn-tertiary:focus-visible {
  background: rgba(194, 71, 15, 0.12);
  border-color: rgba(194, 71, 15, 0.42);
  color: var(--polytalk-accent-strong);
}

/* ---------------------------------- app title and heading inks per palette

   The heading/eyebrow pairs on every card (`section-kicker` + `h1`/`h2`) were a
   pale ink tuned to the dark canvas, and the usage/subscription cards painted
   their own dark gradient on top of a surface the token layer already made
   light. Light mode therefore owns both the card surface and the heading ink. */
html[data-polytalk-theme-resolved="light"] .metric-card,
html[data-polytalk-theme-resolved="light"] .subscription-state article,
html[data-polytalk-theme-resolved="light"] .subscription-action-card {
  background: var(--polytalk-surface-panel);
  border-color: var(--line);
  box-shadow: none;
}

html[data-polytalk-theme-resolved="light"] .metric-card-primary,
html[data-polytalk-theme-resolved="light"] .subscription-action-card {
  border-color: rgba(194, 71, 15, 0.38);
}

html[data-polytalk-theme-resolved="light"] .section-kicker,
html[data-polytalk-theme-resolved="light"] .module-heading h1,
html[data-polytalk-theme-resolved="light"] .subscription-title-row h1,
html[data-polytalk-theme-resolved="light"] .analytics-heading strong,
html[data-polytalk-theme-resolved="light"] .app-title,
html[data-polytalk-theme-resolved="light"] .app-subtitle {
  color: var(--text);
}

html[data-polytalk-theme-resolved="light"] .subscription-state span {
  color: var(--polytalk-accent-strong);
}

html[data-polytalk-theme-resolved="light"] .metric-card small,
html[data-polytalk-theme-resolved="light"] .history-toolbar label > span {
  color: var(--text-muted);
}

html[data-polytalk-theme-resolved="light"] .retention-policy-status,
html[data-polytalk-theme-resolved="light"] .retention-policy-status[data-tone="active"],
html[data-polytalk-theme-resolved="light"] .retention-policy-status[data-tone="warning"] {
  background: var(--polytalk-fill-faint);
  border-color: var(--line);
  color: var(--text);
}

html[data-polytalk-theme-resolved="light"] .privacy-delete-controls .panel-action {
  background: var(--polytalk-fill-soft);
}

html[data-polytalk-theme-resolved="light"] .privacy-action-list strong,
html[data-polytalk-theme-resolved="light"] .privacy-center-card > p {
  color: var(--text);
}

html[data-polytalk-theme-resolved="light"] .premium-toggle-track {
  border-color: rgba(23, 32, 47, 0.22);
  background: var(--polytalk-fill-soft);
  box-shadow: none;
}

html[data-polytalk-theme-resolved="light"] .premium-toggle-track::after {
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(24, 39, 75, 0.28);
}

html[data-polytalk-theme-resolved="light"] .premium-toggle-input:checked + .premium-toggle-track::after {
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(24, 39, 75, 0.24);
}

html[data-polytalk-theme-resolved="light"] .toggle-field,
html[data-polytalk-theme-resolved="light"] .range-field {
  color: var(--text);
}

html[data-polytalk-theme-resolved="light"] .settings-note {
  color: var(--text-muted);
}

/* ------------------------------------------------ header chrome in light mode

   The sign-in strip, the `?` help menu and the announcement line are the three
   places the owner still saw a pale ink on a pale surface, because all three
   carried a white/ivory ink that only worked against the old dark canvas. */
html[data-polytalk-theme-resolved="light"] .account-identity strong {
  color: var(--text);
}

html[data-polytalk-theme-resolved="light"] .help-menu-panel {
  background: var(--polytalk-surface-panel);
  border-color: var(--line);
  box-shadow: 0 18px 42px rgba(24, 39, 75, 0.18);
}

html[data-polytalk-theme-resolved="light"] .help-menu-panel button,
html[data-polytalk-theme-resolved="light"] .help-menu-panel a,
html[data-polytalk-theme-resolved="light"] .help-menu-panel span {
  color: var(--text);
}

html[data-polytalk-theme-resolved="light"] .help-menu-panel button:disabled,
html[data-polytalk-theme-resolved="light"] .help-menu-panel button[aria-disabled="true"] {
  color: var(--polytalk-option-disabled-text);
}

html[data-polytalk-theme-resolved="light"] .settings-toggle {
  color: var(--polytalk-accent-strong);
}

/* The gear sits in the header strip next to the brand-orange controls, so it
   inherits the accent from `.settings-toggle` instead of the dark surface ink
   used by the help icon. */
html[data-polytalk-theme-resolved="light"] .settings-icon {
  color: var(--polytalk-accent-strong);
}

html[data-polytalk-theme-resolved="light"] .help-icon {
  color: var(--polytalk-surface-ink);
}

html[data-polytalk-theme-resolved="light"] .release-notice strong {
  color: #15734a;
}

html[data-polytalk-theme-resolved="light"] .release-notice span {
  color: var(--text);
}

html[data-polytalk-theme-resolved="light"] .quick-settings-modal {
  background: var(--polytalk-surface-panel);
  border-color: var(--line);
}

html[data-polytalk-theme-resolved="light"] .quick-settings-header h2 {
  color: var(--text);
}

html[data-polytalk-theme-resolved="light"] .quick-settings-close {
  color: var(--text-muted);
}

html[data-polytalk-theme-resolved="light"] .quick-settings-body {
  color: var(--text);
}

html[data-polytalk-theme-resolved="light"] .quick-settings-field label {
  color: var(--text);
}

html[data-polytalk-theme-resolved="light"] .quick-settings-footer {
  border-top-color: var(--line);
}

/* ---------------------------------------------- typed text translation panels

   The typed translation card and its two panels paint themselves with a dark
   film and a near-white ink, so the whole block disappears on a light card. */
html[data-polytalk-theme-resolved="light"] .typed-translation,
html[data-polytalk-theme-resolved="light"] .typed-input-panel,
html[data-polytalk-theme-resolved="light"] .typed-result-panel {
  background: var(--polytalk-surface-inset);
  border-color: var(--line);
  box-shadow: none;
  color: var(--text);
}

html[data-polytalk-theme-resolved="light"] .typed-panel-header strong,
html[data-polytalk-theme-resolved="light"] .typed-result,
html[data-polytalk-theme-resolved="light"] #typed-source-text,
html[data-polytalk-theme-resolved="light"] .typed-translation-heading h2,
html[data-polytalk-theme-resolved="light"] .typed-translation-footer {
  color: var(--text);
}

html[data-polytalk-theme-resolved="light"] .typed-eyebrow {
  color: var(--polytalk-accent-strong);
}

/* --------------------------------------------------- subscription status chip

   The contract-state chip is painted per state with white ink on a saturated
   brand fill. That combination stays in the light theme only because the fill
   is not a page surface, so the ink is called out explicitly instead of being
   left to cascade from the light text token. */
html[data-polytalk-theme-resolved="light"] .subscription-panel[data-state]::after {
  color: #ffffff;
}


/* ==================================================== visibility and control pass

   Sections below were added for the light/dark visibility review. They name the
   winning rule on the reported components instead of relying on the shared
   tokens, and keep the equivalent dark rules legible.


 */
/* =================================               visibility pass, part one
                                                                   :controls */

/* Form controls own their surface in both themes: a light field with a dark
   ink in Light mode, and the same field kept honest in Dark mode. The border,
   the caret and the placeholder all resolve against the actual surface, so a
   typed or selected value is always readable. */
html[data-polytalk-theme-resolved="light"] input[type="text"],
html[data-polytalk-theme-resolved="light"] input[type="email"],
html[data-polytalk-theme-resolved="light"] input[type="password"],
html[data-polytalk-theme-resolved="light"] input[type="number"],
html[data-polytalk-theme-resolved="light"] input[type="url"],
html[data-polytalk-theme-resolved="light"] input[type="search"],
html[data-polytalk-theme-resolved="light"] textarea,
html[data-polytalk-theme-resolved="light"] select {
  background-color: var(--pt-surface);
  border-color: var(--pt-border-strong);
  caret-color: var(--pt-brand-fg);
  color: var(--pt-text);
}


html[data-polytalk-theme-resolved="light"] input::placeholder,
html[data-polytalk-theme-resolved="light"] textarea::placeholder {
  color: var(--pt-text-muted);
  opacity: 1;
}

/* The segmented control, quick-settings and help rows are the surfaces the
   owner pointed at: they carried a dark field with a pale ink, so neither the
   selected value nor the surrounding label survived the change of palette. */
html[data-polytalk-theme-resolved="light"] .settings-field input,
html[data-polytalk-theme-resolved="light"] .settings-field textarea,
html[data-polytalk-theme-resolved="light"] .settings-field select,
html[data-polytalk-theme-resolved="light"] .quick-settings-field input,
html[data-polytalk-theme-resolved="light"] .quick-settings-field select,
html[data-polytalk-theme-resolved="light"] .history-search-field input,
html[data-polytalk-theme-resolved="light"] .range-field input {
  background-color: var(--pt-surface);
  border-color: var(--pt-border-strong);
  color: var(--pt-text);
}


/* ------------------------------------------- visibility pass: surfaces, part 1

   Each block below is a surface that painted itself with the dark canvas it
   was written for. The winning declaration is named explicitly (audit, not
   guesswork: the shadowed values are what the component actually rendered),
   so the light palette reaches the nested control instead of only the page. */

/* The audio player kept the dark canvas fill under a pale ink. */
html[data-polytalk-theme-resolved="light"] .voice-output {
  background:
    radial-gradient(circle at 0% 50%, rgba(194, 71, 15, 0.12), transparent 32%),
    linear-gradient(135deg, rgba(194, 71, 15, 0.08), rgba(21, 95, 168, 0.08)),
    var(--pt-surface);
  border-color: var(--pt-brand-border);
  box-shadow: var(--pt-shadow-2), inset 3px 0 0 var(--pt-brand-fg);
}

/* Player sub-controls: chips and the volume block rode on the dark fill. */
html[data-polytalk-theme-resolved="light"] .player-download,
html[data-polytalk-theme-resolved="light"] .player-speeds button {
  background: var(--pt-surface-inset);
  border-color: var(--pt-border-strong);
  color: var(--pt-text);
}

html[data-polytalk-theme-resolved="light"] .player-speeds button.active {
  background: var(--pt-brand-tint);
  border-color: var(--pt-brand-border);
  color: var(--pt-brand-fg);
}

html[data-polytalk-theme-resolved="light"] .player-download,
html[data-polytalk-theme-resolved="light"] .player-volume-control {
  color: var(--pt-brand-fg);
}


/* Status pills, the readiness rail and the transcript panels next. */
html[data-polytalk-theme-resolved="light"] .status-pill {
  background:
    linear-gradient(135deg, rgba(21, 95, 168, 0.14), rgba(194, 71, 15, 0.12)),
    var(--pt-surface);
  color: var(--pt-text);
}

html[data-polytalk-theme-resolved="light"] .readiness-steps li {
  background: var(--pt-surface-inset);
  color: var(--pt-text);
}

html[data-polytalk-theme-resolved="light"] .readiness-steps li[data-state="active"] {
  background: var(--pt-brand-tint);
  color: var(--pt-brand-fg);
}

/* The transcript and its scrollback painted a dark film under pale text. */
html[data-polytalk-theme-resolved="light"] .output-text,
html[data-polytalk-theme-resolved="light"] .translation-panel .output-text {
  background: var(--pt-surface-inset);
  color: var(--pt-text);
  border: 1px solid var(--pt-border);
  scrollbar-color: rgba(30, 136, 229, 0.6) var(--pt-surface-inset);
}

html[data-polytalk-theme-resolved="light"] .translation-panel .output-text {
  scrollbar-color: rgba(194, 71, 15, 0.6) var(--pt-surface-inset);
}

html[data-polytalk-theme-resolved="light"] .output-text::-webkit-scrollbar-thumb {
  background: rgba(30, 136, 229, 0.6);
}

html[data-polytalk-theme-resolved="light"] .translation-panel .output-text::-webkit-scrollbar-thumb {
  background: rgba(194, 71, 15, 0.6);
}

html[data-polytalk-theme-resolved="light"] .output-text::-webkit-scrollbar-track {
  background: var(--pt-surface-inset);
}

html[data-polytalk-theme-resolved="light"] .linked-segment {
  background: var(--pt-surface-soft);
  color: var(--pt-text);
}

/* An unavailable segment stays visually unavailable: the dashed border and
   the muted ink are kept, only the dark fill is replaced. */
html[data-polytalk-theme-resolved="light"] .linked-segment.is-unavailable {
  background: var(--pt-surface-inset);
  color: var(--pt-text-muted);
}

html[data-polytalk-theme-resolved="light"] .runtime-mic-policy {
  background: var(--pt-surface);
  border-color: var(--pt-border-strong);
  color: var(--pt-text);
}


/* ------------------------------------------- visibility pass: surfaces, part 2

   Settings, notices, dialogs and the account strip, all of which assumed the
   dark canvas for both their fill and their ink. */

html[data-polytalk-theme-resolved="light"] .analytics-card,
html[data-polytalk-theme-resolved="light"] .settings-card {
  background: var(--pt-surface);
  border-color: var(--pt-border);
  box-shadow: var(--pt-shadow-1);
}

html[data-polytalk-theme-resolved="light"] .site-notice {
  background: var(--pt-surface);
  border-color: var(--pt-border-strong);
  box-shadow: var(--pt-shadow-2);
  color: var(--pt-text);
}

html[data-polytalk-theme-resolved="light"] .system-notice,
html[data-polytalk-theme-resolved="light"] .system-notice--compound {
  background: var(--pt-surface);
  border-color: var(--pt-border-strong);
  color: var(--pt-text);
}

/* The account strip kept a dark field plus a white ink for the signed-in
   name; both are named here so the name reads on the light card. */
html[data-polytalk-theme-resolved="light"] .account-strip a,
html[data-polytalk-theme-resolved="light"] .account-strip button,
html[data-polytalk-theme-resolved="light"] .account-strip .ui-locale-switcher select {
  background: var(--pt-surface-inset);
  border-color: var(--pt-border-strong);
  color: var(--pt-text);
}

html[data-polytalk-theme-resolved="light"] .account-identity strong {
  color: var(--pt-text);
}

/* Keys, codes and the danger zone are code-styled surfaces: they keep a
   distinct inset look instead of the page background. */
html[data-polytalk-theme-resolved="light"] .api-key-code,
html[data-polytalk-theme-resolved="light"] #api-key-masked {
  background: var(--pt-surface-inset);
  border-color: var(--pt-border-strong);
  color: var(--pt-text);
}

/* Overlays stay a scrim in both themes; the dialog itself must not be a dark
   card floating on a light page, and its headings keep the card ink. */

html[data-polytalk-theme-resolved="light"] .confirm-modal-overlay,
html[data-polytalk-theme-resolved="light"] .quick-settings-overlay,
html[data-polytalk-theme-resolved="light"] .tab-share-modal-overlay,
html[data-polytalk-theme-resolved="light"] .feedback-modal-overlay {
  background: var(--pt-scrim);
}

/* The confirm dialog element is a transparent overlay container (see
   modals.css) whose card is the inner .confirm-modal, already themed above.
   Painting the container itself left a white panel around the card. */
html[data-polytalk-theme-resolved="light"] .tab-share-modal,
html[data-polytalk-theme-resolved="light"] .feedback-modal {
  background: var(--pt-surface);
  border: 1px solid var(--pt-border-strong);
  box-shadow: var(--pt-shadow-3);
  color: var(--pt-text);
}

html[data-polytalk-theme-resolved="light"] .confirm-modal-header h2,
html[data-polytalk-theme-resolved="light"] .confirm-modal-message,
html[data-polytalk-theme-resolved="light"] .tab-share-header h2,
html[data-polytalk-theme-resolved="light"] .tab-share-info,
html[data-polytalk-theme-resolved="light"] .feedback-modal-header h2,
html[data-polytalk-theme-resolved="light"] .feedback-modal-desc,
html[data-polytalk-theme-resolved="light"] .feedback-comment-field span {
  color: var(--pt-text);
}

/* The muted-helper rule paints every `.feedback-star` with the same grey,
   which out-specifies `.is-selected` and left the chosen rating identical to
   the empty slots, while the rating caption stayed a pale slate film meant for
   the dark dialog. The selected star takes a strong amber and the caption the
   card ink, so the rating state reads on a light dialog. */
html[data-polytalk-theme-resolved="light"] .feedback-star.is-selected,
html[data-polytalk-theme-resolved="light"] .feedback-star.is-selected:hover {
  color: #b45309;
  border-color: rgba(180, 83, 9, 0.65);
}

html[data-polytalk-theme-resolved="light"] .feedback-star-label {
  color: var(--text);
}

html[data-polytalk-theme-resolved="light"] .confirm-modal-danger {
  background: var(--pt-status-error-tint);
  border-color: var(--pt-status-error);
  color: var(--pt-status-error);
}

html[data-polytalk-theme-resolved="light"] .feedback-toast {
  background: var(--pt-surface);
  border-color: var(--pt-border-strong);
  box-shadow: var(--pt-shadow-2);
  color: var(--pt-text);
}

/* Settings, usage and subscription surfaces that kept the dark card fill. */
html[data-polytalk-theme-resolved="light"] .analytics-card,
html[data-polytalk-theme-resolved="light"] .metric-card,
html[data-polytalk-theme-resolved="light"] .checkout-summary > div,
html[data-polytalk-theme-resolved="light"] .purchase-history-table tbody::-webkit-scrollbar-track,
html[data-polytalk-theme-resolved="light"] .ai-notes-loading-overlay {
  background: var(--pt-surface);
  border-color: var(--pt-border);
  color: var(--pt-text);
}

html[data-polytalk-theme-resolved="light"] .privacy-danger-zone {
  background: var(--pt-status-error-tint);
  border-color: var(--pt-status-error);
}

/* A trial orbit is a brand badge, not a page surface: it keeps its saturated
   fill, so only the surrounding ring and label needed the light palette. */
html[data-polytalk-theme-resolved="light"] .trial-orbit {
  background: radial-gradient(circle, var(--pt-brand-tint-strong), var(--pt-surface));
}

html[data-polytalk-theme-resolved="light"] .onboarding-card {
  background: var(--pt-surface);
  border-color: var(--pt-border-strong);
  box-shadow: var(--pt-shadow-2);
  color: var(--pt-text);
}

html[data-polytalk-theme-resolved="light"] .btn,
html[data-polytalk-theme-resolved="light"] .panel-action,
html[data-polytalk-theme-resolved="light"] .theme-mode-option,
html[data-polytalk-theme-resolved="light"] .help-menu-panel button,
html[data-polytalk-theme-resolved="light"] .history-status-tabs button {
  box-shadow: var(--pt-shadow-1);
}

html[data-polytalk-theme-resolved="light"] .btn:hover:not(:disabled),
html[data-polytalk-theme-resolved="light"] .panel-action:hover:not(:disabled),
html[data-polytalk-theme-resolved="light"] .theme-mode-option:hover {
  box-shadow: var(--pt-shadow-2);
}

html[data-polytalk-theme-resolved="light"] .modal,
html[data-polytalk-theme-resolved="light"] .quick-settings-modal,
html[data-polytalk-theme-resolved="light"] .help-menu-panel {
  box-shadow: var(--pt-shadow-3);
}

/* ------------------------------------------------ dark parity for the controls

   Dark mode is allowed to keep its dark surfaces; it is not allowed to keep
   illegible foregrounds. These are the same control rules above with the dark
   palette resolved, so hover, focus and the selected state stay distinguishable
   on the dark canvas instead of collapsing to the previous near-invisible film. */
html[data-polytalk-theme-resolved="dark"] .btn:hover:not(:disabled),
html[data-polytalk-theme-resolved="dark"] .panel-action:hover:not(:disabled),
html[data-polytalk-theme-resolved="dark"] .theme-mode-option:hover {
  box-shadow: var(--pt-shadow-2);
}

html[data-polytalk-theme-resolved="dark"] .theme-mode-option:has(input:checked) {
  border-color: var(--polytalk-accent-strong);
  color: var(--polytalk-surface-ink);
}


html[data-polytalk-theme-resolved="dark"] .btn,
html[data-polytalk-theme-resolved="dark"] .panel-action,
html[data-polytalk-theme-resolved="dark"] .quick-settings-close,
html[data-polytalk-theme-resolved="dark"] .help-menu-panel button {
  box-shadow: var(--pt-shadow-1);
}

html[data-polytalk-theme-resolved="dark"] .modal,
html[data-polytalk-theme-resolved="dark"] .quick-settings-modal,
html[data-polytalk-theme-resolved="dark"] .help-menu-panel {
  box-shadow: var(--pt-shadow-3);
}

html[data-polytalk-theme-resolved="dark"] .confirm-modal-overlay,
html[data-polytalk-theme-resolved="dark"] .tab-share-modal-overlay,
html[data-polytalk-theme-resolved="dark"] .feedback-modal-overlay,
html[data-polytalk-theme-resolved="dark"] .quick-settings-overlay {
  background: var(--pt-scrim);
}
/* =========================================== remaining reported surfaces */

/* ---------------------------------------------------- remaining reported surfaces */

/* Hero and mode icons carry a pale ink that only worked on the dark canvas, so
   the live-page icons vanished on a white card. The icon ink is now called from
   the palette: the dark theme keeps the original artwork, the light theme gets a
   stroke that reads. */
html[data-polytalk-theme-resolved="light"] .polytalk-mode-icon,
html[data-polytalk-theme-resolved="light"] .polytalk-runtime-voice,
html[data-polytalk-theme-resolved="light"] .runtime-microphone-svg,
html[data-polytalk-theme-resolved="light"] .runtime-mode-artwork,
html[data-polytalk-theme-resolved="light"] .pipeline-mode-icon {
  color: var(--pt-icon-stroke);
  filter: drop-shadow(0 1px 1px rgba(15, 23, 42, 0.12));
}

/* The translucent halo is a dark-theme affordance; on a light card it only
   smudges the icon sitting behind it. */
html[data-polytalk-theme-resolved="light"] .runtime-microphone-halo {
  background: var(--pt-brand-tint);
  border-color: var(--pt-brand-border);
  opacity: 0.55;
}

/* The signed-in account name, the header tagline and the help control all
   inherited the pale header ink. The quick-settings gear keeps its accent
   colour (see the rule in the light-theme section above). */
html[data-polytalk-theme-resolved="light"] .account-identity strong,
html[data-polytalk-theme-resolved="light"] .enterprise-strip strong,
html[data-polytalk-theme-resolved="light"] .help-icon,
html[data-polytalk-theme-resolved="light"] .quick-settings-close {
  color: var(--pt-text);
}

html[data-polytalk-theme-resolved="light"] .help-menu-panel,
html[data-polytalk-theme-resolved="light"] .quick-settings-modal {
  background: var(--pt-surface);
  border-color: var(--pt-border-strong);
  color: var(--pt-text);
}

/* The tour chrome is rendered by the vendor library outside our own markup, so
   its overlay and buttons need the same explicit palette. */
html[data-polytalk-theme-resolved="light"] .polytalk-onboarding-locale-overlay {
  background: var(--pt-scrim);
}

html[data-polytalk-theme-resolved="light"] .poly-tour-popover,
html[data-polytalk-theme-resolved="light"] .poly-tour-popover .driver-popover-title,
html[data-polytalk-theme-resolved="light"] .poly-tour-popover .driver-popover-description {
  background: var(--pt-surface);
  border-color: var(--pt-border-strong);
  color: var(--pt-text);
}

html[data-polytalk-theme-resolved="light"] .poly-tour-popover .driver-popover-prev-btn,
html[data-polytalk-theme-resolved="light"] .poly-tour-popover .driver-popover-close-btn {
  border-color: var(--pt-brand-border);
  color: var(--pt-brand-fg);
}

html[data-polytalk-theme-resolved="light"] .poly-tour-popover .driver-popover-prev-btn:hover,
html[data-polytalk-theme-resolved="light"] .poly-tour-popover .driver-popover-close-btn:hover {
  border-color: var(--pt-brand-fg);
  color: var(--pt-brand-fg-hover);
}

/* Match the vendor selector specificity so primary actions keep contrasting
   ink at rest, on hover, and on the final tour step. */
html[data-polytalk-theme-resolved="light"] .poly-tour-popover .polytalk-tour-primary-button {
  background: var(--pt-brand-fg);
  border-color: var(--pt-brand-fg);
  color: var(--pt-on-brand);
}

html[data-polytalk-theme-resolved="light"] .poly-tour-popover .polytalk-tour-primary-button:hover,
html[data-polytalk-theme-resolved="light"] .poly-tour-popover .polytalk-tour-primary-button:focus-visible {
  background: var(--pt-brand-fg-hover);
  border-color: var(--pt-brand-fg-hover);
  color: var(--pt-on-brand);
}

/* -------------------------------------------------- remaining pale inks per page

   Long tail from the audit: labels, helper copy and status lines that carried a
   white/ivory ink. They are grouped by what they describe, never by page, so a
   later shared component inherits the same readable default. */
html[data-polytalk-theme-resolved="light"] .auth-primary,
html[data-polytalk-theme-resolved="light"] .auth-aside strong,
html[data-polytalk-theme-resolved="light"] .auth-field span,
html[data-polytalk-theme-resolved="light"] .auth-email-summary,
html[data-polytalk-theme-resolved="light"] .auth-trust-heading h2,
html[data-polytalk-theme-resolved="light"] .onboarding-progress-copy,
html[data-polytalk-theme-resolved="light"] .microphone-guidance,
html[data-polytalk-theme-resolved="light"] .preview-badge,
html[data-polytalk-theme-resolved="light"] .ai-instruction-card .custom-instruction-field > span,
html[data-polytalk-theme-resolved="light"] .retention-policy-status,
html[data-polytalk-theme-resolved="light"] .toggle-field,
html[data-polytalk-theme-resolved="light"] .settings-field span,
html[data-polytalk-theme-resolved="light"] .custom-instruction-field span,
html[data-polytalk-theme-resolved="light"] .feedback-invite-sparkle {
  color: var(--pt-text);
}

html[data-polytalk-theme-resolved="light"] .ai-notes-section h4,
html[data-polytalk-theme-resolved="light"] .readiness-steps li[data-state="active"] {
  color: var(--pt-brand-fg);
}

/* Semantic states keep their meaning: each gets the palette status ink instead
   of a pale or a dark-only variant. */
html[data-polytalk-theme-resolved="light"] .auth-error,
html[data-polytalk-theme-resolved="light"] .pricing-status.error,
html[data-polytalk-theme-resolved="light"] .renewal-cancelled-banner {
  color: var(--pt-status-error);
}

html[data-polytalk-theme-resolved="light"] .pricing-status.error {
  background: var(--pt-status-error-tint);
  border-color: var(--pt-status-error);
}

html[data-polytalk-theme-resolved="light"] .retention-policy-status[data-tone="warning"],
html[data-polytalk-theme-resolved="light"] .preview-badge-premium {
  color: var(--pt-status-warning);
}

html[data-polytalk-theme-resolved="light"] .retention-policy-status[data-tone="active"] {
  color: var(--pt-status-success);
}

/* Pipeline tooltips render their own bubble; they were a dark chip with pale
   text on every page. */
html[data-polytalk-theme-resolved="light"] .pipeline-stage .stage-tooltip-text,
html[data-polytalk-theme-resolved="light"] .pipeline-mode-tooltip,
html[data-polytalk-theme-resolved="light"] .pipeline-mode-field .pipeline-mode-tooltip {
  background: var(--pt-surface);
  border: 1px solid var(--pt-border-strong);
  box-shadow: var(--pt-shadow-2);
  color: var(--pt-text);
}

/* --------------------------------------------------------- shared component pass

   Cards, panels, menus, tables, chips and toasts are shared by every page, so
   they are corrected once here. The audit named the rules that still won with a
   hard dark fill; the dark equivalents are re-declared in the dark section at
   the end of this file so nothing regresses while Light mode is repaired. */
html[data-polytalk-theme-resolved="light"] .console-card,
html[data-polytalk-theme-resolved="light"] .card,
html[data-polytalk-theme-resolved="light"] .panel,
html[data-polytalk-theme-resolved="light"] .form-card,
html[data-polytalk-theme-resolved="light"] .settings-card,
html[data-polytalk-theme-resolved="light"] .modal,
html[data-polytalk-theme-resolved="light"] .dialog {
  background: var(--pt-surface);
  border-color: var(--pt-border);
  box-shadow: var(--pt-shadow-2);
  color: var(--pt-text);
}

/* The subscription panel's contract-state border (green/orange/red top bar)
   is a status affordance. The generic light card border above wins on
   specificity, so the state colours are re-declared here to keep it visible
   in Light mode exactly as in the dark palette. */
html[data-polytalk-theme-resolved="light"] .subscription-panel[data-state="active"] {
  border-top-color: #43a047;
}

html[data-polytalk-theme-resolved="light"] .subscription-panel[data-state="no_active_plan"] {
  border-top-color: #ef6c00;
}

html[data-polytalk-theme-resolved="light"] .subscription-panel[data-state="expired"] {
  border-top-color: #e53935;
}

html[data-polytalk-theme-resolved="light"] .subscription-panel[data-state="blocked"] {
  border-top-color: #d32f2f;
}

/* Tables in usage and purchase history inherit the page ink but kept a dark
   header rule and a dark row separator. The invoice list is a gap grid, not a
   table: painting it with its own surface put a white slab behind the rows and
   made every row show a shade difference between lists of invoices, so it now
   inherits the card surface and only the rows keep an inset fill. */
html[data-polytalk-theme-resolved="light"] table,
html[data-polytalk-theme-resolved="light"] table th,
html[data-polytalk-theme-resolved="light"] table td,
html[data-polytalk-theme-resolved="light"] .purchase-history-table {
  background: var(--pt-surface);
  border-color: var(--pt-border);
  color: var(--pt-text);
}

html[data-polytalk-theme-resolved="light"] table th {
  color: var(--pt-text-muted);
}

/* ---------------------------------------- surfaces that stay saturated on purpose

   A white ink is only wrong when the surface under it turns light. Brand
   buttons and the account chips sit on a saturated fill in both palettes, so
   the pairing is intentional and stays explicit rather than inheriting the
   light page ink. */
html[data-polytalk-theme-resolved="light"] .primary-cta,
html[data-polytalk-theme-resolved="light"] .secondary-cta,
html[data-polytalk-theme-resolved="light"] .trial-cta,
html[data-polytalk-theme-resolved="light"] .segmented button[aria-pressed="true"],
html[data-polytalk-theme-resolved="light"] .pricing-cta,
html[data-polytalk-theme-resolved="light"] .btn-primary-accent,
html[data-polytalk-theme-resolved="light"] .site-notice-action,
html[data-polytalk-theme-resolved="light"] .subscription-button,
html[data-polytalk-theme-resolved="light"] .subscription-plans-link,
html[data-polytalk-theme-resolved="light"] .confirm-modal-primary,
html[data-polytalk-theme-resolved="light"] .feedback-modal-primary,
html[data-polytalk-theme-resolved="light"] .onboarding-primary,
html[data-polytalk-theme-resolved="light"] .polytalk-tour-primary-button {
  color: var(--pt-on-brand);
}

/* Hover and selected states on those same controls keep the same ink; only the
   fill is allowed to move, so a pressed segment never turns pale on pale. */
html[data-polytalk-theme-resolved="light"] .feedback-star:hover,
html[data-polytalk-theme-resolved="light"] .feedback-star:focus-visible,
html[data-polytalk-theme-resolved="light"] .feedback-toast-dismiss:hover,
html[data-polytalk-theme-resolved="light"] .feedback-modal-skip:hover:not(:disabled),
html[data-polytalk-theme-resolved="light"] .system-notice-dismiss:hover,
html[data-polytalk-theme-resolved="light"] .glossary-delete-btn:hover:not(:disabled),
html[data-polytalk-theme-resolved="light"] .site-notice-action-secondary,
html[data-polytalk-theme-resolved="light"] .pricing-header .quick-support-link,
html[data-polytalk-theme-resolved="light"] .onboarding-language-grid select option:checked {
  color: var(--pt-text);
}

/* The account strip carries the locale picker; its custom control painted the
   dark field and the option list under the light card. */
html[data-polytalk-theme-resolved="light"] .account-strip a,
html[data-polytalk-theme-resolved="light"] .ui-locale-switcher .custom-language-select-button,
html[data-polytalk-theme-resolved="light"] .ui-locale-switcher .custom-language-select-list {
  background: var(--pt-surface);
  border-color: var(--pt-border-strong);
  color: var(--pt-text);
}

/* The locale list rows are <button> elements inside the account strip, so the
   strip's toolbar-button border (account-auth.css, this file and
   workspace-layout.css) painted a box around every language row, not just the
   selected one. The source/target language picker keeps its rows borderless, so
   reset the option buttons here and match that treatment in both palettes. */
html[data-polytalk-theme-resolved] .account-strip .ui-locale-switcher .custom-language-select-option {
  border: 0;
}

/* ================================================================ final pass

   Owner comments 110246, 110272 and 110308 asked for one clean, minimal design
   language in both palettes: light surfaces in Light mode, coherent dark
   surfaces with readable foregrounds in Dark mode, and restrained depth from a
   border plus one shadow rather than a second spatial treatment. Everything
   below is therefore stated once per shared component, keyed on the resolved
   palette, instead of being repeated per page.

   The audit behind it named the rules that actually won on the reported
   components (a hardcoded hex or an alpha slate in `console-ui.css`,
   `usage-subscription.css`, `modals.css` and `base.css`), so each block below
   overrides that winning declaration rather than trusting a shared token.
   The Google Play badge keeps its original black artwork; it is an image asset
   and no rule here touches it.
 */

/* --------------------------------------------------- the native <audio> player

   The live panel and the translation players are unstyled native controls, so
   the browser chrome followed the document `color-scheme` and painted a dark
   transport even on a light card. Forcing the light control set is the only
   rule that reaches the play button, the scrubber and the volume row; the
   element keeps its dimensions so nothing below it moves. */
html[data-polytalk-theme-resolved="light"] audio,
html[data-polytalk-theme-resolved="light"] video {
  color-scheme: light;
  background: var(--pt-surface-inset);
  border: 1px solid var(--pt-border);
  border-radius: 10px;
  color: var(--pt-text);
}

html[data-polytalk-theme-resolved="dark"] audio,
html[data-polytalk-theme-resolved="dark"] video {
  color-scheme: dark;
  background: var(--bg-card-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
}

/* --------------------------------------------------------------- tables

   A sticky header row and a sticky `thead` paint their own surface; a rule on
   the generic element leaves the column titles floating over the rows that
   scroll under them. Both are named so the usage, invoice and purchase-history
   tables keep a readable header in each palette. */
html[data-polytalk-theme-resolved="light"] .purchase-history-table thead,
html[data-polytalk-theme-resolved="light"] .purchase-history-table thead th,
html[data-polytalk-theme-resolved="light"] .purchase-history-table thead tr,
html[data-polytalk-theme-resolved="light"] table thead,
html[data-polytalk-theme-resolved="light"] table thead th,
html[data-polytalk-theme-resolved="light"] table thead tr {
  background: var(--pt-surface-soft);
  color: var(--pt-text-muted);
  border-color: var(--pt-border);
}

html[data-polytalk-theme-resolved="dark"] .purchase-history-table thead,
html[data-polytalk-theme-resolved="dark"] .purchase-history-table thead th,
html[data-polytalk-theme-resolved="dark"] table thead,
html[data-polytalk-theme-resolved="dark"] table thead th {
  background: var(--bg-card);
  color: var(--text-muted);
  border-color: var(--line);
}

/* Rows separate with a white hairline that disappears on a light card; the
   dark palette keeps the stronger separator it was designed for. */
html[data-polytalk-theme-resolved="light"] .purchase-history-table tbody td,
html[data-polytalk-theme-resolved="light"] .invoice-row,
html[data-polytalk-theme-resolved="light"] .analytics-row {
  border-color: var(--pt-border);
  color: var(--pt-text);
}

html[data-polytalk-theme-resolved="dark"] .purchase-history-table tbody td,
html[data-polytalk-theme-resolved="dark"] .invoice-row {
  border-color: rgba(255, 255, 255, 0.1);
}

html[data-polytalk-theme-resolved="light"] .history-detail-panel .detail-meta dt,
html[data-polytalk-theme-resolved="light"] .detail-grid h3,
html[data-polytalk-theme-resolved="light"] .analytics-heading span {
  color: var(--pt-text-muted);
}

html[data-polytalk-theme-resolved="light"] .history-detail-panel .detail-meta dd,
html[data-polytalk-theme-resolved="light"] .analytics-heading strong {
  color: var(--pt-text);
}

/* ------------------------------------------------------------------ focus

   One focus recipe for both palettes and every focusable element, custom
   controls included. The ring resolves through the palette's own accent token,
   so a keyboard user sees the same indicator wherever a control lives and
   neither theme paints it with the pale ink the dark canvas used to borrow. */
html[data-polytalk-theme-resolved="light"] :focus-visible,
html[data-polytalk-theme-resolved="dark"] :focus-visible {
  outline-color: var(--polytalk-focus-ring);
}

/* ---------------------------------------------------------------- elevation

   Hover and selection add the same single step of elevation in both themes.
   This is the restrained depth the owner asked for: the shadow ramp is shared,
   so a control that lifts in Light mode lifts identically in Dark mode, and no
   component grows a second visual language per palette. */
html[data-polytalk-theme-resolved="dark"] .onboarding-card,
html[data-polytalk-theme-resolved="dark"] .analytics-card,
html[data-polytalk-theme-resolved="dark"] .subscription-action-card,
html[data-polytalk-theme-resolved="dark"] .site-notice,
html[data-polytalk-theme-resolved="dark"] .confirm-modal,
html[data-polytalk-theme-resolved="dark"] .feedback-modal,
html[data-polytalk-theme-resolved="dark"] .feedback-toast {
  box-shadow: var(--pt-shadow-2);
}

html[data-polytalk-theme-resolved="dark"] .confirm-modal-overlay,
html[data-polytalk-theme-resolved="dark"] .tab-share-modal-overlay,
html[data-polytalk-theme-resolved="dark"] .feedback-modal-overlay {
  background: var(--pt-scrim);
}


/* =========================================================== remaining palette

   Everything below is keyed on the resolved palette rather than on a page, so
   the components that still carried a hardcoded artwork colour get the same
   treatment as the shared surfaces: a light fill and a dark ink in Light mode,
   and a deliberately readable dark ink in Dark mode. The tour popover is the
   one vendor-rendered component (driver.js paints it outside our markup), and
   it is corrected the same way in both palettes below. Status meanings survive
   through the palette status tokens; the Google Play badge and every other
   branded image asset are untouched. */

/* ------------------------------------------------- sign-in and status strips

   The auth screens carried white/ivory inks designed for the dark canvas, so a
   success panel, the pending-deletion notice and the account links went pale on
   a light card. Each keeps its own status tint so success stays green and
   warning stays amber, just legibly. */
html[data-polytalk-theme-resolved="light"] .auth-success {
  background: var(--pt-status-success-tint);
  border-color: var(--pt-status-success);
  color: var(--pt-status-success);
}

html[data-polytalk-theme-resolved="light"] .deletion-pending-status {
  background: var(--pt-status-warning-tint);
  border-color: var(--pt-status-warning);
  color: var(--pt-status-warning);
}

html[data-polytalk-theme-resolved="light"] .deletion-pending-status strong {
  color: var(--pt-status-warning);
}

/* The eye toggle sits inside the password field, so it needs the field ink. */
html[data-polytalk-theme-resolved="light"] .password-visibility-toggle {
  background: transparent;
  color: var(--pt-text-muted);
}

html[data-polytalk-theme-resolved="light"] .password-visibility-toggle:hover {
  background: var(--polytalk-fill-soft);
  color: var(--pt-text);
}

html[data-polytalk-theme-resolved="dark"] .password-visibility-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

html[data-polytalk-theme-resolved="light"] .auth-links .auth-create-account {
  border-color: var(--pt-brand-border);
  color: var(--pt-brand-fg);
}

/* ---------------------------------------------------- console action buttons

   Live/Share/Text/Conversation are brand-gradient fills, so the white ink on
   them is intentional; naming it keeps the label legible on the light page
   without touching the brand artwork. */
html[data-polytalk-theme-resolved="light"] .btn-live,
html[data-polytalk-theme-resolved="light"] .btn-share,
html[data-polytalk-theme-resolved="light"] .btn-text,
html[data-polytalk-theme-resolved="light"] .btn-swap,
html[data-polytalk-theme-resolved="light"] .btn-conversation {
  color: var(--pt-on-brand);
}

/* ---------------------------------------------------------- typed transcript

   The typed pane's helper line and its action buttons reported through pale
   status inks, which is exactly the "text disappears" complaint. Status keeps
   its meaning through the palette tokens instead of a pale tint.

   The status line is bare helper text with no padding or radius of its own, so
   a tinted background painted only here highlighted the sentence in blue or
   green the way a marker pen would, and made the line look like a chip that
   does not exist in the dark palette. Status stays ink-only in both palettes. */
html[data-polytalk-theme-resolved="light"] #typed-status,
html[data-polytalk-theme-resolved="light"] .typed-keyboard-help,
html[data-polytalk-theme-resolved="light"] #typed-character-count {
  color: var(--pt-text-muted);
}

html[data-polytalk-theme-resolved="light"] #typed-status[data-state="error"] {
  color: var(--pt-status-error);
}

html[data-polytalk-theme-resolved="light"] #typed-status[data-state="success"] {
  color: var(--pt-status-success);
}

html[data-polytalk-theme-resolved="light"] #typed-status[data-state="processing"] {
  color: var(--pt-status-info);
}

html[data-polytalk-theme-resolved="light"] .typed-result-actions button {
  background: var(--pt-surface);
  border-color: var(--pt-border-strong);
  color: var(--pt-text);
}

html[data-polytalk-theme-resolved="light"] .typed-result-actions button.is-success {
  background: var(--pt-status-success-tint);
  border-color: var(--pt-status-success);
  color: var(--pt-status-success);
}

html[data-polytalk-theme-resolved="light"] .typed-result-actions button.is-error {
  background: var(--pt-status-error-tint);
  border-color: var(--pt-status-error);
  color: var(--pt-status-error);
}

/* ------------------------------------------------------ plans and billing pages

   Pricing shipped its own dark palette tokens, so its prose, hour counts,
   footer credit and support controls need explicit light counterparts. */
html[data-polytalk-theme-resolved="light"] .pricing-controls select,
html[data-polytalk-theme-resolved="light"] .segmented {
  background: var(--pt-surface);
  border-color: var(--pt-border);
  color: var(--pt-text);
}

html[data-polytalk-theme-resolved="light"] .segmented button {
  color: var(--pt-text-muted);
}

html[data-polytalk-theme-resolved="light"] .plan-hours,
html[data-polytalk-theme-resolved="light"] .price-card ul {
  border-color: var(--pt-border);
  color: var(--pt-text);
}

/* The saving line is a pale green tuned for the dark card; on a light card it
   was almost unreadable, so it takes the light success green instead. */
html[data-polytalk-theme-resolved="light"] .plan-saving {
  color: var(--pt-status-success);
}

html[data-polytalk-theme-resolved="light"] .pricing-footer-credit,
html[data-polytalk-theme-resolved="light"] .auth-builder-footer .auth-footer-credit {
  color: var(--pt-brand-fg);
  text-shadow: none;
}

html[data-polytalk-theme-resolved="light"] .pricing-footer-credit:hover,
html[data-polytalk-theme-resolved="light"] .pricing-footer-credit:focus-visible,
html[data-polytalk-theme-resolved="light"] .auth-builder-footer .auth-footer-credit:hover,
html[data-polytalk-theme-resolved="light"] .auth-builder-footer .auth-footer-credit:focus-visible {
  color: var(--pt-brand-fg-hover);
  text-shadow: none;
}

/* Closing a support ticket is destructive, so the red stays red -- it just no
   longer assumes the dark panel it was drawn for. */
html[data-polytalk-theme-resolved="light"] .support-close-ticket {
  background: var(--pt-surface);
  border-color: var(--pt-status-error);
  color: var(--pt-status-error);
}

html[data-polytalk-theme-resolved="light"] .support-close-ticket:hover,
html[data-polytalk-theme-resolved="light"] .support-close-ticket:focus-visible {
  background: var(--pt-status-error-tint);
  border-color: var(--pt-status-error);
  color: var(--pt-status-error);
}

html[data-polytalk-theme-resolved="dark"] .support-close-ticket:hover,
html[data-polytalk-theme-resolved="dark"] .support-close-ticket:focus-visible {
  background: #4b1f2c;
  border-color: #e16a78;
  color: #ffc0c8;
}

/* --------------------------------------------------------- settings notices

   The API-key warning, the coming-soon badge and the glossary/onboarding errors
   are status copy on a light card: keep the meaning, fix the contrast. */
html[data-polytalk-theme-resolved="light"] .api-key-warning {
  color: var(--pt-status-warning);
}

html[data-polytalk-theme-resolved="light"] .preview-badge-coming-soon {
  background: var(--pt-brand-tint-strong);
  border-color: var(--pt-brand-border);
  box-shadow: none;
  color: var(--pt-brand-fg);
}

html[data-polytalk-theme-resolved="light"] .glossary-error,
html[data-polytalk-theme-resolved="light"] .onboarding-error {
  background: var(--pt-status-error-tint);
  border-color: var(--pt-status-error);
  color: var(--pt-status-error);
}

/* ---------------------------------------------------------------- setup steps

   The onboarding wizard renders on both a dark card and a light one, so its
   secondary/back actions and trust copy need an explicit ink per palette. */
html[data-polytalk-theme-resolved="light"] .onboarding-secondary,
html[data-polytalk-theme-resolved="light"] .onboarding-back {
  background: var(--pt-surface);
  border-color: var(--pt-border-strong);
  color: var(--pt-text);
}

html[data-polytalk-theme-resolved="dark"] .onboarding-secondary,
html[data-polytalk-theme-resolved="dark"] .onboarding-back {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.24);
  color: #eef4ff;
}

html[data-polytalk-theme-resolved="light"] .onboarding-trust-list {
  color: var(--pt-text);
}

html[data-polytalk-theme-resolved="light"] .onboarding-legal a {
  color: var(--pt-brand-fg);
}

/* --------------------------------------------------------- notices and spinners

   The system-notice rows and the notes spinner were drawn against the dark
   canvas. The rows keep their danger/warning meaning through the palette status
   tokens; the spinner borrows the palette border token so it is never invisible
   on the surface it spins on. */
html[data-polytalk-theme-resolved="light"] .system-notice-row-title,
html[data-polytalk-theme-resolved="light"] .system-notice-header strong {
  color: var(--pt-text);
}

html[data-polytalk-theme-resolved="light"] .system-notice-row--danger .system-notice-row-title {
  color: var(--pt-status-error);
}

html[data-polytalk-theme-resolved="light"] .system-notice-row--warning .system-notice-row-title {
  color: var(--pt-status-warning);
}

html[data-polytalk-theme-resolved="light"] .tab-share-warning {
  color: var(--pt-status-warning);
}

html[data-polytalk-theme-resolved="light"] .ai-notes-fullscreen-spinner,
html[data-polytalk-theme-resolved="light"] .payment-spinner {
  border-color: var(--pt-border-strong);
  border-top-color: var(--pt-brand-fg);
}

/* ------------------------------------------------------- tour popover per palette

   The popover is driver.js chrome painted as a white card with slate ink, so
   Light mode only has to name the ink the vendor stylesheet left dark. Dark
   mode re-inks the whole card, and the palette border ramp, one step of the
   shared shadow and the palette focus ring are what make it read as the same
   component in both themes rather than two different ones. */
html[data-polytalk-theme-resolved="light"] .poly-tour-popover .driver-popover-title,
html[data-polytalk-theme-resolved="light"] .polytalk-tour-title {
  color: var(--pt-text);
}

html[data-polytalk-theme-resolved="light"] .poly-tour-popover .driver-popover-description,
html[data-polytalk-theme-resolved="light"] .polytalk-tour-body,
html[data-polytalk-theme-resolved="light"] .polytalk-tour-welcome-intro,
html[data-polytalk-theme-resolved="light"] .polytalk-tour-welcome-closing,
html[data-polytalk-theme-resolved="light"] .polytalk-tour-welcome-note,
html[data-polytalk-theme-resolved="light"] .polytalk-tour-dont-show-wrapper {
  color: var(--pt-text-soft);
}

html[data-polytalk-theme-resolved="light"] .polytalk-tour-feature-icon {
  background: var(--pt-brand-tint);
  color: var(--pt-brand-fg);
}

html[data-polytalk-theme-resolved="dark"] .driver-popover.poly-tour-popover,
html[data-polytalk-theme-resolved="dark"] .driver-popover.polytalk-tour {
  background: var(--bg-card);
  border-color: var(--line);
  color: var(--text);
  box-shadow: var(--pt-shadow-3);
}

html[data-polytalk-theme-resolved="dark"] .driver-popover.poly-tour-popover:focus-visible,
html[data-polytalk-theme-resolved="dark"] .driver-popover.polytalk-tour:focus-visible {
  outline-color: var(--polytalk-focus-ring);
}

/* The arrow is coloured per side by the vendor stylesheet, so each side needs
   the palette border rather than the light card it was drawn for. */
html[data-polytalk-theme-resolved="dark"] .polytalk-tour .driver-popover-arrow {
  border-color: var(--bg-card);
}

/* Titles, body copy and the "don't show again" line were slate-on-white. */
html[data-polytalk-theme-resolved="dark"] .polytalk-tour-title,
html[data-polytalk-theme-resolved="dark"] .polytalk-tour-feature-copy strong,
html[data-polytalk-theme-resolved="dark"] .poly-tour-popover .driver-popover-title {
  color: var(--text);
}

html[data-polytalk-theme-resolved="dark"] .polytalk-tour-body,
html[data-polytalk-theme-resolved="dark"] .poly-tour-popover .driver-popover-description,
html[data-polytalk-theme-resolved="dark"] .polytalk-tour-welcome-intro,
html[data-polytalk-theme-resolved="dark"] .polytalk-tour-welcome-closing,
html[data-polytalk-theme-resolved="dark"] .polytalk-tour-welcome-note,
html[data-polytalk-theme-resolved="dark"] .polytalk-tour-feature-copy small,
html[data-polytalk-theme-resolved="dark"] .polytalk-tour-progress,
html[data-polytalk-theme-resolved="dark"] .polytalk-tour-dont-show-wrapper,
html[data-polytalk-theme-resolved="dark"] .polytalk-tour-dont-show-label {
  color: var(--text-muted);
}

/* The secondary/close buttons and the feature icons inherit the light card
   too; they take the same restrained surface-plus-border treatment as every
   other dark control. */
html[data-polytalk-theme-resolved="dark"] .polytalk-tour-secondary-button,
html[data-polytalk-theme-resolved="dark"] .polytalk-tour-close {
  background: var(--pt-hover-surface);
  border-color: var(--pt-hover-border);
  color: var(--text);
}

html[data-polytalk-theme-resolved="dark"] .polytalk-tour-secondary-button:hover,
html[data-polytalk-theme-resolved="dark"] .polytalk-tour-secondary-button:focus-visible,
html[data-polytalk-theme-resolved="dark"] .polytalk-tour-close:hover,
html[data-polytalk-theme-resolved="dark"] .polytalk-tour-close:focus-visible {
  background: var(--pt-hover-surface-strong);
  color: var(--text);
}

html[data-polytalk-theme-resolved="dark"] .polytalk-tour-feature-icon {
  background: rgba(255, 122, 24, 0.16);
  color: var(--poly-primary);
}

/* The locale picker and the tour's own skip button are the last light-card
   chrome; the skip button is a secondary action, so it matches its siblings. */
html[data-polytalk-theme-resolved="dark"] .polytalk-onboarding-locale-dialog,
html[data-polytalk-theme-resolved="dark"] .polytalk-onboarding-locale-list,
html[data-polytalk-theme-resolved="dark"] .polytalk-onboarding-locale-trigger {
  background: var(--bg-card);
  border-color: var(--line);
  color: var(--text);
}

html[data-polytalk-theme-resolved="dark"] .poly-tour-popover .polytalk-tour-skip-btn {
  background: var(--pt-hover-surface);
  border-color: var(--pt-hover-border);
  color: var(--text);
}

/* The final-action links on the plans page are recoloured for the light card;
   their focus ring has to come from the palette, never the light ring. */
html[data-polytalk-theme-resolved="light"] .support-close-ticket:focus-visible {
  outline-color: var(--polytalk-focus-ring);
}

/* Enabled actions use brand ink; primary actions add a quiet warm tint. */
html[data-polytalk-theme-resolved="dark"] {
  --pt-control-bg: #202c43;
  --pt-control-hover: #30394c;
  --pt-control-border: #3a475d;
  --pt-control-selected: #343338;
  --pt-control-selected-border: #62554d;
  --pt-control-ink: #d5deec;
  --pt-control-accent: #e6aa78;
  --pt-control-danger-bg: #392d3d;
  --pt-control-danger-border: #765363;
  --pt-control-danger-ink: #edb9c0;
  --pt-control-focus: #a4c6e3;
  --pt-control-toggle: #3e627f;
}
html[data-polytalk-theme-resolved] :is(.btn:not(.btn-live, .btn-share, .btn-text, .btn-conversation, .btn-swap), .pricing-cta, .primary-cta, .secondary-cta, .support-close-ticket, .panel-action, .player-toggle, .player-download, .typed-result-actions button, .account-strip button, .auth-primary, .auth-secondary, .social-auth-button, .confirm-modal-button, .feedback-modal-button, .subscription-button, .theme-mode-option, .segmented button, .player-speeds button, .history-filter-presets button, .history-status-tabs button, .polytalk-tour-primary-button, .polytalk-tour-secondary-button) {
  background: var(--pt-control-bg);
  color: var(--pt-control-ink);
  border: 1px solid var(--pt-control-border);
  box-shadow: none;
  text-shadow: none;
  transform: none;
  filter: none;
  font-weight: 600;
}
html[data-polytalk-theme-resolved] :is(.pricing-cta, .primary-cta, .trial-cta, .btn-primary-accent, .auth-primary, .confirm-modal-primary, .feedback-modal-primary, .subscription-button, .polytalk-tour-primary-button, .theme-mode-option:has(input:checked), .segmented button[aria-pressed="true"], .player-speeds button.active, .history-filter-presets button.active, .history-status-tabs button.active) {
  background: var(--pt-control-selected);
  border-color: var(--pt-control-selected-border);
  color: var(--pt-control-accent);
}
html[data-polytalk-theme-resolved] :is(.btn-stop, .confirm-modal-danger, .panel-action-danger) {
  background: var(--pt-control-danger-bg);
  border-color: var(--pt-control-danger-border);
  color: var(--pt-control-danger-ink);
}

/* Light mode: the billing-period segmented toggle keeps unselected options
   transparent, matching the original pricing design where only the pressed
   option carries a background. The generic control background above would
   otherwise paint an unwanted light box around them. */
html[data-polytalk-theme-resolved="light"] :is(.segmented button):not([aria-pressed="true"]) {
  background: transparent;
  border-color: transparent;
}
html[data-polytalk-theme-resolved] :is(.btn:not(.btn-live, .btn-share, .btn-text, .btn-conversation, .btn-swap), .pricing-cta, .primary-cta, .secondary-cta, .support-close-ticket, .panel-action, .player-toggle, .player-download, .typed-result-actions button, .account-strip button, .auth-primary, .auth-secondary, .social-auth-button, .confirm-modal-button, .feedback-modal-button, .subscription-button, .theme-mode-option, .segmented button, .player-speeds button, .history-filter-presets button, .history-status-tabs button):hover:not(:disabled) {
  background: var(--pt-control-hover);
  transform: none;
  box-shadow: none;
  filter: none;
}
/* Back-to-workspace / back-to-sessions are ghost controls on an open canvas:
   the shared pill fill and border read as a stray white shape there, so only
   the arrow and the label carry the control (QA #22). Placed after the
   generic hover rule so the hover paint is stripped as well. */
html[data-polytalk-theme-resolved] .panel-action.usage-back,
html[data-polytalk-theme-resolved] .panel-action.usage-back:hover:not(:disabled) {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
html[data-polytalk-theme-resolved] :is(button, a.btn, .auth-primary):focus-visible {
  outline: 2px solid var(--pt-control-focus);
  outline-offset: 3px;
}
html[data-polytalk-theme-resolved] :is(.btn, .auth-primary, .confirm-modal-button, .feedback-modal-button):disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
html[data-polytalk-theme-resolved] .console-workspace #pipeline-stage-bar .pipeline-stage.active {
  background: var(--pt-control-selected);
  border-color: var(--pt-control-selected-border);
  color: var(--pt-control-accent);
}

/* Settings and Quick Settings use the same readable pipeline choices. */
html[data-polytalk-theme-resolved] .pipeline-mode-session-bar {
  padding: 4px;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  filter: none;
}
html[data-polytalk-theme-resolved] .pipeline-mode-session-bar .pipeline-mode-session-stage {
  flex: 1;
  min-width: 0;
  height: auto;
  min-height: 76px;
  margin: 0;
  padding: 8px 6px;
  flex-direction: column;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  filter: none;
  box-shadow: none;
}
html[data-polytalk-theme-resolved] .pipeline-mode-session-stage::before { content: none; }
html[data-polytalk-theme-resolved] .pipeline-mode-session-stage .pipeline-stage-icon { width: 22px; height: 22px; filter: none; transform: none; }
.pipeline-choice-label { font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
html[data-polytalk-theme-resolved] .pipeline-mode-session-bar .pipeline-mode-session-stage.active {
  background: var(--pt-control-selected);
  color: var(--pt-control-accent);
  border-color: var(--pt-control-selected-border);
}
html[data-polytalk-theme-resolved] .pipeline-mode-session-bar .pipeline-mode-session-stage:hover { background: var(--bg-card-soft); }

/* Auth pages share the application's stored/system theme. */
html[data-polytalk-theme-resolved="light"] :is(.auth-panel, .auth-aside) { background: var(--bg-card); }
html[data-polytalk-theme-resolved="light"] .auth-error { background: var(--pt-status-error-tint); color: var(--pt-status-error); border-color: var(--pt-status-error); }
/* The pricing card paints its own brand gradient, so the light palette has to
   restate its ink and surface rather than rely on the token cascade. */
html[data-polytalk-theme-resolved="light"] .auth-body .auth-pricing-link {
  background: var(--pt-brand-tint);
  border-color: var(--pt-brand-border);
  /* Flat palette *surface* only: the dark palette's glow is replaced by a
     brand ring, and the brand tint carries the accent instead. */
  box-shadow: inset 0 0 0 1px var(--pt-brand-border);
  color: var(--pt-brand-fg);
  /* Restate the dark palette's list: transition is a shorthand, so a
     background-only override would snap the hover lift. */
  transition:
    background 0.2s,
    box-shadow 0.2s,
    transform 0.2s;
}
/* account-auth.css suppresses the card's transition under
   prefers-reduced-motion, but its (0, 2, 0) selector cannot outrank this
   (0, 3, 1) one, so the light palette has to opt out of its own motion rather
   than rely on that rule. */
@media (prefers-reduced-motion: reduce) {
  html[data-polytalk-theme-resolved="light"] .auth-body .auth-pricing-link {
    transition: none;
  }
}
html[data-polytalk-theme-resolved="light"] .auth-body .auth-pricing-link:hover {
  background: var(--pt-brand-tint-strong);
}
html[data-polytalk-theme-resolved="light"] .auth-body .auth-aside .auth-pricing-label {
  /* Beat the shared light-palette ink for .auth-aside strong, otherwise the
     call to action reads as one more caption. */
  color: var(--pt-brand-fg);
}
/* Scoped to .auth-aside like the label above, to match the dark palette's
   .auth-aside selectors rather than the token cascade. */
html[data-polytalk-theme-resolved="light"] .auth-body .auth-aside .auth-pricing-icon,
html[data-polytalk-theme-resolved="light"] .auth-body .auth-aside .auth-pricing-arrow {
  color: var(--pt-brand-fg);
}
.auth-theme-toggle {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: var(--bg-card-soft);
  cursor: pointer;
}
.auth-theme-toggle .ui-icon { display: none; width: 20px; height: 20px; }
html[data-polytalk-theme-resolved="light"] .theme-icon-light,
html[data-polytalk-theme-resolved="dark"] .theme-icon-dark { display: block; }
.auth-theme-toggle:focus-visible { outline: 2px solid var(--polytalk-focus-ring); outline-offset: 3px; }

html[data-polytalk-theme-resolved] .runtime-session-actions .btn-tertiary {
  background: var(--pt-control-bg); color: var(--pt-control-ink); border-color: var(--pt-control-border);
}
html[data-polytalk-theme-resolved] .runtime-session-actions .btn-stop {
  background: var(--pt-control-danger-bg); color: var(--pt-control-danger-ink); border-color: var(--pt-control-danger-border);
}
html[data-polytalk-theme-resolved] .runtime-session-actions .runtime-mini-action:hover:not(:disabled) {
  background: var(--pt-control-hover); box-shadow: none; filter: none;
}
html[data-polytalk-theme-resolved] .premium-toggle-input:checked + .premium-toggle-track {
  background: var(--pt-control-toggle); border-color: var(--pt-control-selected-border); box-shadow: none;
}
html[data-polytalk-theme-resolved] .premium-toggle-track::after { box-shadow: none; }
html[data-polytalk-theme-resolved] :is(.settings-field, .quick-settings-field) :is(select, .custom-language-select-button) {
  border-color: var(--pt-control-border); box-shadow: none;
}
html[data-polytalk-theme-resolved] .auth-primary span { color: inherit; }
html[data-polytalk-theme-resolved="light"] .auth-body :is(.auth-links a, .auth-footer-links a, .auth-footer-credit) { color: #155fa8; }

/* Subscription links are button actions too, including their hover/press states. */
html[data-polytalk-theme-resolved] .subscription-panel :is(.subscription-button, .subscription-plans-link) {
  background: var(--pt-control-bg); color: var(--pt-control-ink);
  border: 1px solid var(--pt-control-border); box-shadow: none; filter: none;
  font-weight: 600; transform: none;
}
html[data-polytalk-theme-resolved] .subscription-panel :is(.subscription-button, .subscription-plans-link):hover:not(:disabled) {
  background: var(--pt-control-hover); transform: none; filter: none; box-shadow: none;
}
html[data-polytalk-theme-resolved] .subscription-panel :is(.subscription-button, .subscription-plans-link):active:not(:disabled) {
  background: var(--pt-control-selected); transform: none; filter: none;
}
html[data-polytalk-theme-resolved] .subscription-panel :is(.subscription-button, .subscription-plans-link):focus-visible {
  outline: 2px solid var(--pt-control-focus); outline-offset: 3px;
}

.auth-brand { padding-right: 0; }
.auth-display-controls { display: flex; align-items: center; justify-content: flex-end; gap: 8px; width: 100%; margin-bottom: 8px; }
.auth-display-controls .auth-locale-switcher { position: static; min-width: 0; max-width: calc(100% - 48px); }
.auth-display-controls .auth-theme-toggle { width: 44px; height: 44px; }
html[data-polytalk-theme-resolved] .runtime-session-actions .runtime-mini-action:hover:not(:disabled) {
  color: var(--pt-control-ink); border-color: var(--pt-control-selected-border);
}
html[data-polytalk-theme-resolved] .runtime-session-actions .btn-stop:hover:not(:disabled) {
  color: var(--pt-control-danger-ink); border-color: var(--pt-control-danger-border); background: var(--pt-control-danger-bg);
}

/* Commercial and support actions use the same restrained control palette. */
html[data-polytalk-theme-resolved] :is(.pricing-cta, .primary-cta, .secondary-cta, .trial-cta) {
  color: var(--pt-control-accent) !important;
  text-shadow: none; box-shadow: none; filter: none; transform: none;
}
html[data-polytalk-theme-resolved="dark"] .secondary-cta {
  color: var(--pt-control-ink) !important;
}
html[data-polytalk-theme-resolved] .support-close-ticket {
  background: var(--pt-control-danger-bg); border-color: var(--pt-control-danger-border); color: var(--pt-control-danger-ink);
}
html[data-polytalk-theme-resolved] .support-close-ticket:hover {
  background: var(--pt-control-danger-bg); border-color: var(--pt-control-danger-ink); outline: none;
}
html[data-polytalk-theme-resolved] .support-close-ticket:focus-visible { outline: 2px solid var(--pt-control-focus); outline-offset: 3px; }
html[data-polytalk-theme-resolved] .support-dialog input[type="file"]::file-selector-button {
  background: var(--pt-control-bg); color: var(--pt-control-ink); border-color: var(--pt-control-border);
}
.pricing-header nav { flex-wrap: wrap; justify-content: flex-end; }
.pricing-header .auth-theme-toggle { min-width: 44px; height: 44px; }

/* Header links and disclosure controls share the enabled button palette. */
html[data-polytalk-theme-resolved] :is(.account-strip, .pricing-header) .quick-support-link,
html[data-polytalk-theme-resolved] .hero-header .help-menu > summary {
  color: var(--pt-control-ink);
  background: var(--bg-card);
  border: 1px solid var(--line);
  box-shadow: none;
  transform: none;
}
html[data-polytalk-theme-resolved] .hero-header .help-icon {
  color: inherit;
}
html[data-polytalk-theme-resolved] :is(.account-strip, .pricing-header) .quick-support-link:hover,
html[data-polytalk-theme-resolved] .hero-header .help-menu > summary:hover,
html[data-polytalk-theme-resolved] .hero-header .help-menu[open] > summary {
  background: var(--pt-control-hover);
}
html[data-polytalk-theme-resolved] :is(.account-strip, .pricing-header) .quick-support-link:focus-visible,
html[data-polytalk-theme-resolved] .hero-header .help-menu > summary:focus-visible {
  outline: 2px solid var(--pt-control-focus);
  outline-offset: 3px;
}

/* Utility icons sit quietly in the dark header until hovered or opened. */
html[data-polytalk-theme-resolved="dark"] :is(.hero-header, .pricing-header) :is(.quick-support-link, .auth-theme-toggle, .help-menu > summary) {
  color: var(--pt-control-ink);
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
html[data-polytalk-theme-resolved="dark"] :is(.hero-header, .pricing-header) :is(.quick-support-link, .auth-theme-toggle, .help-menu > summary):hover,
html[data-polytalk-theme-resolved="dark"] :is(.hero-header, .pricing-header) .help-menu[open] > summary {
  color: var(--pt-control-accent);
  background: var(--pt-control-bg);
  border-color: var(--line);
}

/* Limit disabled styling to shared controls; other components own their states. */
html[data-polytalk-theme-resolved] :is(.btn:not(.btn-live, .btn-share, .btn-text, .btn-conversation, .btn-swap), .pricing-cta, .primary-cta, .secondary-cta, .trial-cta, .support-close-ticket, .panel-action, .player-toggle, .player-download, .auth-primary, .auth-secondary, .social-auth-button, .confirm-modal-button, .feedback-modal-button, .subscription-button, .theme-mode-option, .polytalk-tour-primary-button, .polytalk-tour-secondary-button):is(:disabled, [aria-disabled="true"], :has(input:disabled)) {
  --pt-control-ink: var(--text-muted);
  --pt-control-accent: var(--text-muted);
  color: var(--text-muted);
  opacity: 0.6;
  cursor: not-allowed;
}

/* Primary actions carry the brand fill; secondary controls keep the quiet ramp. */
html[data-polytalk-theme-resolved] {
  --pt-action-bg: #b94712;
  --pt-action-hover: #9e390b;
  --pt-action-border: #bd622f;
}
html[data-polytalk-theme-resolved] :is(.pricing-cta, .primary-cta, .trial-cta, .auth-primary, .confirm-modal-primary, .feedback-modal-primary, .btn-primary-accent:not(.panel-action-danger), .polytalk-tour-primary-button, [id="subscription-plan-action"], [id="start-trial-btn"]) {
  --pt-control-accent: #fff;
  --pt-control-ink: #fff;
  --pt-control-bg: var(--pt-action-bg);
  --pt-control-selected: var(--pt-action-bg);
  --pt-control-hover: var(--pt-action-hover);
  --pt-control-border: var(--pt-action-border);
  --pt-control-selected-border: var(--pt-action-border);
  color: var(--pt-control-ink);
  background: var(--pt-control-bg);
  border-color: var(--pt-control-border);
  text-shadow: none;
  box-shadow: none;
}
html[data-polytalk-theme-resolved] :is(.pricing-cta, .primary-cta, .trial-cta, .auth-primary, .confirm-modal-primary, .feedback-modal-primary, .btn-primary-accent:not(.panel-action-danger), .polytalk-tour-primary-button, [id="subscription-plan-action"], [id="start-trial-btn"]):hover:not(:disabled):not([aria-disabled="true"]) {
  background: var(--pt-control-hover);
}
/* A disabled brand fill faded with opacity also fades its white ink into the
   page, which left labels like "Translate" unreadable while the action was
   inactive. Disabled primary buttons drop to the quiet control palette with
   full-strength ink so the label stays legible in both palettes. */
html[data-polytalk-theme-resolved] :is(.auth-primary, .confirm-modal-primary, .feedback-modal-primary, .btn-primary-accent:not(.panel-action-danger), .polytalk-tour-primary-button):is(:disabled, [aria-disabled="true"], :has(input:disabled)) {
  --pt-control-ink: var(--text-muted);
  --pt-control-accent: var(--text-muted);
  --pt-control-bg: var(--bg-card-soft);
  --pt-control-border: var(--line);
  color: var(--text-muted);
  background: var(--bg-card-soft);
  border-color: var(--line);
  opacity: 1;
  cursor: not-allowed;
}
html[data-polytalk-theme-resolved] .auth-actions a.auth-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  color: var(--pt-control-ink);
  background: var(--pt-control-bg);
  border-color: var(--pt-control-border);
}
html[data-polytalk-theme-resolved] .auth-actions a.auth-secondary:hover {
  background: var(--pt-control-hover);
}
/* Destructive actions remain distinct from primary actions, including hover. */
html[data-polytalk-theme-resolved] body :is(.confirm-modal-button.confirm-modal-danger, .panel-action.panel-action-danger, .btn.panel-action-danger, .support-close-ticket),
html[data-polytalk-theme-resolved] body :is(.confirm-modal-button.confirm-modal-danger, .panel-action.panel-action-danger, .btn.panel-action-danger, .support-close-ticket):hover:not(:disabled) {
  color: var(--pt-control-danger-ink);
  background: var(--pt-control-danger-bg);
  border-color: var(--pt-control-danger-border);
}
html[data-polytalk-theme-resolved="light"] .social-auth-icon[src$="/github.svg"] { filter: brightness(0); }
html[data-polytalk-theme-resolved="light"] .preview-badge-premium {
  color: #fff;
  background: #175b91;
  border-color: #175b91;
  box-shadow: none;
}
html[data-polytalk-theme-resolved="light"] .last-purchase-status-pill.status-processed {
  color: var(--pt-status-success); background: var(--pt-status-success-tint); border-color: currentColor;
}
html[data-polytalk-theme-resolved="light"] .last-purchase-status-pill.status-pending {
  color: var(--pt-status-warning); background: var(--pt-status-warning-tint); border-color: currentColor;
}
html[data-polytalk-theme-resolved="light"] .last-purchase-status-pill.status-not-initiated {
  color: var(--pt-text-muted); background: var(--pt-surface-soft); border-color: var(--pt-border-strong);
}
html[data-polytalk-theme-resolved="light"] .purchase-history-table tbody {
  scrollbar-color: #8494aa var(--polytalk-scrollbar-track);
  scrollbar-gutter: stable;
}
html[data-polytalk-theme-resolved="light"] .purchase-history-table tbody::-webkit-scrollbar-thumb { background: #8494aa; }
html[data-polytalk-theme-resolved="light"] .purchase-history-table tbody::-webkit-scrollbar-thumb:hover { background: #5b6a80; }
html[data-polytalk-theme-resolved="light"] .translation-start-marker { color: #175b91; }
