/* Current routes share app-shell.css and component styles. Legacy routes and dialogs retain these rules. */
@scope (:root) to (.app:is(.compare-active, .search-active, .settings-active), #appStartup, .experience-signin, .tc-auth-dialog, .launch-center, .experience-reference-dialog, .experience-dialog, #mobileSyncWorkspace, #easySyncDialog, #syncInsightsDialog, #syncMicroDialog) {
/*
 * ThrowCentral premium interface
 * One semantic component system; themes only provide design tokens.
 */

:scope,
:scope[data-colorway="carbon-slate"] {
  color-scheme: dark;
  --background: #0b0f14;
  --surface: #11161f;
  --surface-elevated: #171d27;
  --surface-hover: #1c2330;
  --border: rgb(255 255 255 / 0.07);
  --border-strong: rgb(255 255 255 / 0.13);
  --text-primary: #ffffff;
  --text-secondary: #ffffff;
  --text-muted: #ffffff;
  --accent: #6c5cff;
  --accent-hover: #7b6dff;
  --accent-soft: rgb(108 92 255 / 0.16);
  --accent-contrast: #ffffff;
  --focus-ring: rgb(108 92 255 / 0.42);
  --danger: #ed5c6f;
  --success: #31c47c;
  --timeline: #252d39;
  --slider-track: #303947;
  --radius: 9px;
  --control-height: 36px;
  --shadow: 0 16px 40px rgb(0 0 0 / 0.22);
}

:scope[data-colorway="midnight-indigo"] {
  color-scheme: dark;
  --background: #070b18;
  --surface: #0d1424;
  --surface-elevated: #121d30;
  --surface-hover: #17263c;
  --border: rgb(122 180 205 / 0.11);
  --border-strong: rgb(122 210 224 / 0.2);
  --text-primary: #ffffff;
  --text-secondary: #ffffff;
  --text-muted: #ffffff;
  --accent: #20c7d9;
  --accent-hover: #39d6e5;
  --accent-soft: rgb(32 199 217 / 0.15);
  --accent-contrast: #031318;
  --focus-ring: rgb(32 199 217 / 0.4);
  --danger: #f06578;
  --success: #39cc8a;
  --timeline: #213047;
  --slider-track: #2a3d54;
}

:scope[data-colorway="deep-emerald"] {
  color-scheme: dark;
  --background: #07120e;
  --surface: #0d1a15;
  --surface-elevated: #12231c;
  --surface-hover: #183026;
  --border: rgb(113 202 157 / 0.1);
  --border-strong: rgb(113 202 157 / 0.2);
  --text-primary: #ffffff;
  --text-secondary: #ffffff;
  --text-muted: #ffffff;
  --accent: #2ecb79;
  --accent-hover: #43d88b;
  --accent-soft: rgb(46 203 121 / 0.15);
  --accent-contrast: #04130b;
  --focus-ring: rgb(46 203 121 / 0.38);
  --danger: #eb6472;
  --success: #2ecb79;
  --timeline: #21332b;
  --slider-track: #2b4036;
}

:scope[data-colorway="crimson-dark"] {
  color-scheme: dark;
  --background: #160a10;
  --surface: #201019;
  --surface-elevated: #2a1520;
  --surface-hover: #361a28;
  --border: rgb(238 123 150 / 0.1);
  --border-strong: rgb(238 123 150 / 0.2);
  --text-primary: #ffffff;
  --text-secondary: #ffffff;
  --text-muted: #ffffff;
  --accent: #ef3f65;
  --accent-hover: #f25878;
  --accent-soft: rgb(239 63 101 / 0.16);
  --accent-contrast: #ffffff;
  --focus-ring: rgb(239 63 101 / 0.4);
  --danger: #ff6078;
  --success: #37c986;
  --timeline: #3a202a;
  --slider-track: #492a36;
}

:scope[data-colorway="amber-gold"] {
  color-scheme: dark;
  --background: #17120a;
  --surface: #211a10;
  --surface-elevated: #2b2316;
  --surface-hover: #382d1b;
  --border: rgb(240 190 103 / 0.11);
  --border-strong: rgb(240 190 103 / 0.22);
  --text-primary: #ffffff;
  --text-secondary: #ffffff;
  --text-muted: #ffffff;
  --accent: #f2a93b;
  --accent-hover: #f7b957;
  --accent-soft: rgb(242 169 59 / 0.16);
  --accent-contrast: #211403;
  --focus-ring: rgb(242 169 59 / 0.4);
  --danger: #ee6671;
  --success: #37c781;
  --timeline: #3a3020;
  --slider-track: #4a3d27;
}

:scope[data-colorway="clean-light"] {
  color-scheme: light;
  --background: #f5f6f8;
  --surface: #ffffff;
  --surface-elevated: #f9fafb;
  --surface-hover: #eef1f5;
  --border: rgb(23 31 44 / 0.09);
  --border-strong: rgb(23 31 44 / 0.16);
  --text-primary: #0b0f14;
  --text-secondary: #0b0f14;
  --text-muted: #0b0f14;
  --accent: #356df3;
  --accent-hover: #285edc;
  --accent-soft: rgb(53 109 243 / 0.12);
  --accent-contrast: #ffffff;
  --focus-ring: rgb(53 109 243 / 0.3);
  --danger: #d8495d;
  --success: #18895b;
  --timeline: #dce1e8;
  --slider-track: #ccd3dc;
  --shadow: 0 16px 40px rgb(26 36 50 / 0.09);
}

/* Legacy-token bridge. Existing components remain functional while consuming
   the same semantic palette as the redesigned Compare workspace. */
:scope {
  --page-start: var(--background) !important;
  --page-end: var(--background) !important;
  --surface-soft: var(--surface-elevated) !important;
  --panel: var(--surface) !important;
  --panel-solid: var(--surface) !important;
  --button-bg: var(--surface-elevated) !important;
  --button-hover: var(--surface-hover) !important;
  --button-text: var(--text-primary) !important;
  --text: var(--text-primary) !important;
  --muted: var(--text-muted) !important;
  --accent-text: var(--accent-contrast) !important;
  --border-soft: var(--border) !important;
  --video-bg: var(--background) !important;
  --hairline: var(--border) !important;
  --dashboard-line: var(--border) !important;
  --dashboard-rail-line: var(--border) !important;
  --dashboard-surface: var(--surface) !important;
  --dashboard-ink: var(--text-primary) !important;
}

html,
body {
  min-height: 100%;
  background: var(--background) !important;
  color: var(--text-primary) !important;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
}

body {
  transition: background-color 180ms ease, color 180ms ease;
}

button,
input,
select,
textarea,
summary {
  font: inherit;
}

/* Studio overlays style their own controls. */
button:not(:where(html[data-tc-redesign="trackside-1"] :is(dialog, [popover], .studio-notice) *)),
select:not(:where(html[data-tc-redesign="trackside-1"] :is(dialog, [popover], .studio-notice) *)),
input:not([type="range"]):not([type="color"]):not(:where(html[data-tc-redesign="trackside-1"] :is(dialog, [popover], .studio-notice) *)),
textarea:not(:where(html[data-tc-redesign="trackside-1"] :is(dialog, [popover], .studio-notice) *)) {
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  background: var(--surface-elevated) !important;
  color: var(--text-primary) !important;
  box-shadow: none !important;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease !important;
}

button:not(:where(html[data-tc-redesign="trackside-1"] :is(dialog, [popover], .studio-notice) *)):hover,
select:not(:where(html[data-tc-redesign="trackside-1"] :is(dialog, [popover], .studio-notice) *)):hover {
  border-color: var(--border-strong) !important;
  background: var(--surface-hover) !important;
}

button:active {
  transform: translateY(1px);
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--focus-ring) !important;
  outline-offset: 2px;
}

button:disabled,
select:disabled,
input:disabled {
  opacity: 0.68;
  cursor: not-allowed;
}

input[type="range"] {
  accent-color: var(--accent);
}

input[type="range"]::-webkit-slider-runnable-track {
  background: var(--slider-track);
}

::placeholder {
  color: var(--text-muted) !important;
}

.danger-button {
  color: var(--danger) !important;
}

.primary-action,
button.active,
.layout-toggle button.active,
.mark-tool-button.active,
.color-swatch.active {
  border-color: transparent !important;
  background: var(--accent) !important;
  color: var(--accent-contrast) !important;
}

.app {
  width: min(1600px, calc(100vw - 32px)) !important;
  margin: 0 auto !important;
  padding: 0 0 24px !important;
  transform-origin: top center;
}

.topbar,
:scope[data-visual-mode="enhanced"] .topbar {
  position: sticky !important;
  top: 0;
  z-index: 100;
  display: grid !important;
  grid-template-columns: 220px minmax(420px, 1fr) minmax(220px, 320px) !important;
  grid-template-areas: "brand nav search" !important;
  align-items: center !important;
  gap: 22px !important;
  height: 64px !important;
  min-height: 64px !important;
  max-height: 64px !important;
  margin: 0 !important;
  padding: 0 14px !important;
  border: 0 !important;
  border-bottom: 1px solid var(--border) !important;
  border-radius: 0 !important;
  background: color-mix(in srgb, var(--background) 92%, transparent) !important;
  box-shadow: none !important;
}

.brand-strip { grid-area: brand !important; }
.primary-nav { grid-area: nav !important; }
.search-row { grid-area: search !important; }

.brand-mark,
.user-avatar,
.settings-button {
  background: var(--accent) !important;
  color: var(--accent-contrast) !important;
}

.brand-mark {
  border-radius: 7px !important;
}

.brand-copy strong {
  color: var(--text-primary) !important;
  font-size: 18px !important;
  font-weight: 600 !important;
  letter-spacing: -0.02em;
}

.brand-copy span {
  color: var(--text-muted) !important;
  font-size: 10px !important;
  font-weight: 500 !important;
  letter-spacing: 0.1em;
}

.primary-nav,
:scope[data-visual-mode="enhanced"] .primary-nav {
  display: flex !important;
  justify-content: center !important;
  gap: 8px !important;
  width: auto !important;
}

.primary-nav-button {
  position: relative;
  width: auto !important;
  min-height: 64px !important;
  padding: 0 12px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--text-secondary) !important;
  font-size: 13px !important;
  font-weight: 450 !important;
}

.primary-nav-button:hover {
  color: var(--text-primary) !important;
  background: transparent !important;
}

.primary-nav-button.active {
  background: transparent !important;
  color: var(--text-primary) !important;
}

.primary-nav-button.active::after {
  display: block !important;
  position: absolute;
  right: 10px;
  bottom: 0;
  left: 10px;
  height: 2px;
  border-radius: 0;
  background: var(--accent);
  content: "";
}

.primary-nav-link {
  display: none !important;
}

.search-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 34px 34px !important;
  gap: 8px !important;
  width: 100% !important;
}

.search-filter {
  display: none !important;
}

.project-search,
.project-search input {
  min-height: 34px !important;
  border: 0 !important;
  background: transparent !important;
}

.project-search {
  border: 1px solid var(--border) !important;
  background: var(--surface) !important;
}

.settings-button,
.user-avatar {
  width: 34px !important;
  min-width: 34px !important;
  height: 34px !important;
  min-height: 34px !important;
}

.user-avatar {
  display: grid;
  place-items: center;
  border-radius: 50% !important;
  font-size: 12px;
}

.search-page {
  scroll-margin-top: 64px;
}

.compare-heading {
  display: none !important;
}

.compare-shell {
  display: grid !important;
  grid-template-columns: minmax(280px, 0.8fr) minmax(280px, 0.8fr) minmax(360px, 1.4fr) !important;
  gap: 10px !important;
  padding: 0 !important;
}

.compare-shell > .compare-select-row,
.compare-video-panel {
  min-height: 52px;
  padding: 8px 10px !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  background: var(--surface) !important;
}

.compare-shell > .compare-select-row {
  grid-column: 1 / 2;
}

.compare-video-panel {
  grid-column: 2 / -1;
}

.compare-video-panel > strong,
.compare-stats-grid {
  display: none !important;
}

.compare-select-row {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 8px !important;
}

.compare-select-row label {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px !important;
  color: var(--text-muted) !important;
  font-size: 11px !important;
  font-weight: 500 !important;
}

.compare-select-row select {
  min-width: 0;
  min-height: 34px !important;
  padding: 0 28px 0 10px !important;
  font-size: 12px !important;
}

.compare-workspace-panel {
  display: grid !important;
  gap: 14px !important;
}

.compare-annotation-heading {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 550;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Settings and all other pages consume the same theme system. */
.search-page,
.settings-page,
.library-panel,
.coach-panel,
.app-dialog form:not(:where(html[data-tc-redesign="trackside-1"] .tc-surface-dialog:not(#loginDialog, #athleteDialog) > form)),
.throw-search-dialog form:not(:where(html[data-tc-redesign="trackside-1"] .tc-surface-dialog:not(#loginDialog, #athleteDialog) > form)),
.sync-viewer-shell,
.tool-panel {
  border-color: var(--border) !important;
  background: var(--surface) !important;
  color: var(--text-primary) !important;
  box-shadow: var(--shadow) !important;
}

.settings-grid label,
.tool-select,
.notes-box,
.distance-stack label {
  color: var(--text-secondary) !important;
}

.tool-panel,
.app-dialog form {
  border-radius: var(--radius) !important;
}

.settings-grid input[type="color"] {
  background: var(--surface-elevated) !important;
}

svg {
  stroke: currentColor;
}

@media (max-width: 1240px) {

.topbar,
:scope[data-visual-mode="enhanced"] .topbar {
    grid-template-columns: 200px minmax(360px, 1fr) minmax(190px, 250px) !important;
    gap: 10px !important;
  }
}

@media (max-width: 980px) {
  .app {
    width: min(100%, calc(100vw - 16px)) !important;
  }

.topbar,
:scope[data-visual-mode="enhanced"] .topbar {
    grid-template-columns: 1fr auto !important;
    grid-template-areas: "brand search" "nav nav" !important;
    min-height: auto;
    padding: 8px !important;
  }

  .primary-nav-button {
    min-height: 42px !important;
  }

  .compare-shell {
    grid-template-columns: 1fr !important;
  }

  .compare-shell > .compare-select-row,
  .compare-video-panel {
    grid-column: 1 !important;
  }
}

/* Reference analysis spacing pass. */
:scope[data-visual-mode="enhanced"][data-colorway] .workspace-layout {
  grid-template-columns: 300px minmax(0, 1fr) !important;
  grid-template-areas: "sidebar videos" !important;
  align-items: start !important;
  gap: 30px !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding-bottom: 24px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .analysis-column {
  grid-area: sidebar !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 14px !important;
  width: 100% !important;
  min-width: 0 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .video-column {
  grid-area: videos !important;
  display: grid !important;
  gap: 16px !important;
  min-width: 0 !important;
  width: 100% !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .video-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 20px !important;
  width: 100% !important;
  min-width: 0 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .video-grid .video-panel {
  width: 100% !important;
  min-width: 0 !important;
  padding: 24px !important;
  border-radius: 10px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .video-grid .file-picker {
  gap: 10px !important;
  margin-bottom: 18px !important;
  width: 100% !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .video-grid .file-picker > * {
  min-width: 0 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .video-grid .frame-shape-controls {
  min-height: 48px !important;
  padding: 4px !important;
  border-radius: 8px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .video-grid .frame-shape-controls button,
:scope[data-visual-mode="enhanced"][data-colorway] .video-grid .pick-button,
:scope[data-visual-mode="enhanced"][data-colorway] .video-grid .saved-video-select,
:scope[data-visual-mode="enhanced"][data-colorway] .video-grid .slot-crop-toggle {
  min-height: 48px !important;
  height: 48px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .video-grid .video-stage {
  min-height: 430px !important;
  aspect-ratio: 1.08 / 1 !important;
  width: 100% !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .analysis-column > :is(.sync-disclosure-button, #advancedSyncDetails, .distance-panel) {
  width: 100% !important;
  min-width: 0 !important;
  border-radius: 10px !important;
}

@media (max-width: 980px) {
  :scope[data-visual-mode="enhanced"][data-colorway] .workspace-layout {
    grid-template-columns: 1fr !important;
    grid-template-areas: "videos" "sidebar" !important;
    gap: 20px !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] .video-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 720px) {
  :scope[data-visual-mode="enhanced"][data-colorway] .video-grid .video-panel {
    padding: 14px !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] .video-grid .video-stage {
    min-height: 260px !important;
  }
}

/* Dashboard control rail: every primary action earns a full-height, clearly
   scannable lane instead of sitting as a small control inside an oversized bar. */
:scope[data-visual-mode="enhanced"][data-colorway] .topbar {
  min-height: 164px !important;
  grid-template-areas: "brand nav search" "actions actions actions" !important;
  row-gap: 16px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .topbar > .actions {
  min-height: 70px !important;
  align-items: stretch !important;
  padding-top: 14px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .topbar > .actions > .main-controls {
  grid-template-columns: minmax(250px, 1.35fr) minmax(220px, 1.1fr) minmax(210px, 1fr) !important;
  min-height: 56px !important;
  align-items: stretch !important;
  gap: 14px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .topbar > .actions > .main-controls > :is(.project-menu, .layout-toggle, .sync-viewer-launch) {
  min-height: 56px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .topbar > .actions .project-menu > summary,
:scope[data-visual-mode="enhanced"][data-colorway] .topbar > .actions .layout-toggle > button,
:scope[data-visual-mode="enhanced"][data-colorway] .topbar > .actions .sync-viewer-launch {
  min-height: 56px !important;
  height: 100% !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .topbar > .actions .layout-toggle {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  overflow: hidden !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .topbar > .actions .sync-viewer-launch-status:empty {
  display: none !important;
}

/* Both comparison slots are the same object in the grid: same column width,
   same row height, and the same video-stage geometry. */
:scope[data-visual-mode="enhanced"][data-colorway] .video-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  grid-auto-rows: minmax(0, 1fr) !important;
  align-items: stretch !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .video-grid .video-panel {
  height: 100% !important;
  min-height: 0 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .video-grid .video-stage {
  aspect-ratio: 16 / 10 !important;
  min-height: clamp(360px, 38vw, 560px) !important;
}

@media (max-width: 980px) {
  :scope[data-visual-mode="enhanced"][data-colorway] .topbar > .actions > .main-controls {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

/* Let Search own the remaining header width after the logo and nav. */
:scope[data-visual-mode="enhanced"][data-colorway] .topbar {
  grid-template-columns: 250px max-content minmax(360px, 1fr) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .topbar > .primary-nav {
  width: max-content !important;
  max-width: 100% !important;
  justify-content: flex-start !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .topbar > .search-row {
  justify-self: stretch !important;
  width: 100% !important;
}

@media (max-width: 1280px) {
  :scope[data-visual-mode="enhanced"][data-colorway] .topbar {
    grid-template-columns: 220px max-content minmax(300px, 1fr) !important;
  }
}

@media (max-width: 980px) {
  :scope[data-visual-mode="enhanced"][data-colorway] .topbar {
    grid-template-columns: 1fr auto !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] .topbar > .primary-nav {
    width: 100% !important;
  }
}

@media (max-width: 720px) {
  .primary-nav {
    overflow-x: auto;
    justify-content: flex-start !important;
  }

  .compare-select-row {
    grid-template-columns: 1fr !important;
  }
}

/* Final header cleanup: remove Find a Throw from the primary nav and give
   Search the open space on the right without crowding the other widgets. */
:scope[data-visual-mode="enhanced"][data-colorway] .primary-nav .find-throw-nav-button {
  display: none !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .topbar {
  grid-template-columns: 250px minmax(0, 1fr) 440px !important;
  column-gap: 28px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .primary-nav {
  justify-content: center !important;
  gap: 24px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .primary-nav-button {
  padding-right: 18px !important;
  padding-left: 18px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .search-row {
  grid-template-columns: minmax(0, 1fr) 40px 40px !important;
  gap: 14px !important;
  width: 100% !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .project-search {
  min-height: 42px !important;
  width: 100% !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .project-search input {
  width: 100% !important;
  min-height: 40px !important;
  padding-right: 14px !important;
  padding-left: 14px !important;
}

@media (max-width: 1280px) {
  :scope[data-visual-mode="enhanced"][data-colorway] .topbar {
    grid-template-columns: 220px minmax(0, 1fr) 360px !important;
    column-gap: 20px !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] .primary-nav {
    gap: 16px !important;
  }
}

@media (max-width: 980px) {
  :scope[data-visual-mode="enhanced"][data-colorway] .topbar {
    grid-template-columns: 1fr auto !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] .search-row {
    grid-template-columns: minmax(220px, 1fr) 40px 40px !important;
  }
}

/* Header overflow guard: keep the brand and navigation in separate, readable lanes. */
:scope[data-visual-mode="enhanced"][data-colorway] .topbar > .brand-strip,
:scope[data-visual-mode="enhanced"][data-colorway] .brand-strip {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  min-width: 0 !important;
  width: 100% !important;
  overflow: hidden !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .brand-copy {
  min-width: 0 !important;
  overflow: hidden !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .brand-mark {
  flex: 0 0 auto !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .brand-copy :is(strong, span) {
  display: block !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .topbar > .primary-nav,
:scope[data-visual-mode="enhanced"][data-colorway] .primary-nav {
  min-width: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow: hidden !important;
  justify-content: stretch !important;
  gap: 4px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .primary-nav-button {
  flex: 1 1 0 !important;
  min-width: 0 !important;
  max-width: none !important;
  padding-right: 8px !important;
  padding-left: 8px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .primary-nav-button.active {
  background: transparent !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .topbar > .search-row,
:scope[data-visual-mode="enhanced"][data-colorway] .search-row,
:scope[data-visual-mode="enhanced"][data-colorway] .project-search,
:scope[data-visual-mode="enhanced"][data-colorway] .project-search input {
  min-width: 0 !important;
  max-width: 100% !important;
}

/* Give the primary header a deliberate, readable rhythm. */
:scope[data-visual-mode="enhanced"][data-colorway] .topbar {
  grid-template-columns: 250px minmax(0, 1fr) 300px !important;
  gap: 28px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .primary-nav {
  justify-content: space-between !important;
  gap: 16px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .primary-nav-button {
  flex: 0 1 auto !important;
  padding-right: 14px !important;
  padding-left: 14px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .search-row {
  gap: 12px !important;
}

/* The mark controls are already available in the Analysis Tools panel;
   remove the duplicate floating strip from the middle of the workspace. */
:scope[data-visual-mode="enhanced"][data-colorway] .floating-mark-toolbar {
  display: none !important;
}

/* Keep any open popover anchored and compact instead of creating a full-width
   white bar across the video workspace. */
:scope[data-visual-mode="enhanced"][data-colorway] .app :is(.tool-panel, .wide-tool-panel, .project-tool-panel, .search-suggestions) {
  width: min(420px, calc(100vw - 32px)) !important;
  max-width: calc(100vw - 32px) !important;
  min-width: 0 !important;
  overflow: auto !important;
  background: var(--surface-elevated) !important;
  color: var(--text-primary) !important;
}

/* Keep Load Project inside its video card. A legacy rule made saved-video
   selects span from column 2 through the end of the picker, creating the
   detached white bar across the workspace. */
:scope[data-visual-mode="enhanced"][data-colorway] .app .file-picker .saved-video-select {
  grid-column: auto !important;
  grid-row: auto !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
}

@media (max-width: 1280px) {
  :scope[data-visual-mode="enhanced"][data-colorway] .topbar {
    grid-template-columns: 220px minmax(0, 1fr) 240px !important;
    gap: 20px !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] .primary-nav {
    justify-content: flex-start !important;
    gap: 12px !important;
    overflow-x: auto !important;
    scrollbar-width: thin;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] .primary-nav-button {
    flex: 0 0 auto !important;
  }
}

/* Top-bar widget layout: navigation on top, controls in one intentional row. */
:scope[data-visual-mode="enhanced"][data-colorway] .topbar {
  grid-template-columns: 250px minmax(0, 1fr) 300px !important;
  grid-template-areas: "brand nav search" "actions actions actions" !important;
  height: auto !important;
  min-height: 124px !important;
  max-height: none !important;
  row-gap: 14px !important;
  padding-top: 10px !important;
  padding-bottom: 12px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .topbar > .actions {
  grid-area: actions !important;
  display: flex !important;
  align-items: center !important;
  gap: 16px !important;
  width: 100% !important;
  min-width: 0 !important;
  padding-top: 10px !important;
  border-top: 1px solid var(--border) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .topbar > .actions > .main-controls {
  display: grid !important;
  grid-template-columns: minmax(190px, 1.2fr) minmax(150px, 0.9fr) minmax(170px, 1fr) !important;
  align-items: center !important;
  gap: 12px !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .topbar > .actions > .main-controls > * {
  width: 100% !important;
  min-width: 0 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .topbar .analysis-tools-menu {
  position: relative !important;
  display: block !important;
  flex: 0 0 164px !important;
  width: 164px !important;
  min-width: 0 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .topbar .analysis-tools-menu > summary {
  display: grid !important;
  place-items: center !important;
  width: 100% !important;
  min-height: 38px !important;
  padding: 0 14px !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  background: var(--surface-elevated) !important;
  color: var(--text-primary) !important;
  cursor: pointer !important;
  white-space: nowrap !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .topbar .analysis-tools-menu > .analysis-tools-panel {
  position: absolute !important;
  top: calc(100% + 10px) !important;
  right: 0 !important;
  z-index: 120 !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 12px !important;
  width: min(420px, calc(100vw - 32px)) !important;
  height: auto !important;
  min-width: 0 !important;
  padding: 14px !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  background: var(--surface-elevated) !important;
  box-shadow: var(--shadow) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .topbar .analysis-tools-menu > .analysis-tools-panel > * {
  min-width: 0 !important;
}

@media (max-width: 980px) {
  :scope[data-visual-mode="enhanced"][data-colorway] .topbar {
    grid-template-columns: 1fr auto !important;
    grid-template-areas: "brand search" "nav nav" "actions actions" !important;
    min-height: 0 !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] .topbar > .actions > .main-controls {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 720px) {
  :scope[data-visual-mode="enhanced"][data-colorway] .topbar > .actions {
    align-items: stretch !important;
    flex-wrap: wrap !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] .topbar > .actions > .main-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100% !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] .topbar .analysis-tools-menu {
    flex-basis: 100% !important;
    width: 100% !important;
  }
}

/* The legacy enhanced layer used important custom properties. Keep theme
   ownership at the token level so presets always win without per-theme
   component duplication. */
:scope[data-colorway="carbon-slate"] {
  --background: #0b0f14 !important;
  --surface: #11161f !important;
  --surface-elevated: #171d27 !important;
  --surface-hover: #1c2330 !important;
  --border: rgb(255 255 255 / 0.07) !important;
  --border-strong: rgb(255 255 255 / 0.13) !important;
  --text-primary: #ffffff !important;
  --text-secondary: #ffffff !important;
  --text-muted: #ffffff !important;
  --accent: #6c5cff !important;
  --accent-hover: #7b6dff !important;
  --accent-soft: rgb(108 92 255 / 0.16) !important;
  --accent-contrast: #ffffff !important;
  --focus-ring: rgb(108 92 255 / 0.42) !important;
  --timeline: #252d39 !important;
  --slider-track: #303947 !important;
}

:scope[data-colorway="midnight-indigo"] {
  --background: #070b18 !important;
  --surface: #0d1424 !important;
  --surface-elevated: #121d30 !important;
  --surface-hover: #17263c !important;
  --border: rgb(122 180 205 / 0.11) !important;
  --border-strong: rgb(122 210 224 / 0.2) !important;
  --text-primary: #ffffff !important;
  --text-secondary: #ffffff !important;
  --text-muted: #ffffff !important;
  --accent: #20c7d9 !important;
  --accent-hover: #39d6e5 !important;
  --accent-soft: rgb(32 199 217 / 0.15) !important;
  --accent-contrast: #031318 !important;
  --focus-ring: rgb(32 199 217 / 0.4) !important;
  --timeline: #213047 !important;
  --slider-track: #2a3d54 !important;
}

:scope[data-colorway="deep-emerald"] {
  --background: #07120e !important;
  --surface: #0d1a15 !important;
  --surface-elevated: #12231c !important;
  --surface-hover: #183026 !important;
  --border: rgb(113 202 157 / 0.1) !important;
  --border-strong: rgb(113 202 157 / 0.2) !important;
  --text-primary: #ffffff !important;
  --text-secondary: #ffffff !important;
  --text-muted: #ffffff !important;
  --accent: #2ecb79 !important;
  --accent-hover: #43d88b !important;
  --accent-soft: rgb(46 203 121 / 0.15) !important;
  --accent-contrast: #04130b !important;
  --focus-ring: rgb(46 203 121 / 0.38) !important;
  --timeline: #21332b !important;
  --slider-track: #2b4036 !important;
}

:scope[data-colorway="crimson-dark"] {
  --background: #160a10 !important;
  --surface: #201019 !important;
  --surface-elevated: #2a1520 !important;
  --surface-hover: #361a28 !important;
  --border: rgb(238 123 150 / 0.1) !important;
  --border-strong: rgb(238 123 150 / 0.2) !important;
  --text-primary: #ffffff !important;
  --text-secondary: #ffffff !important;
  --text-muted: #ffffff !important;
  --accent: #ef3f65 !important;
  --accent-hover: #f25878 !important;
  --accent-soft: rgb(239 63 101 / 0.16) !important;
  --accent-contrast: #ffffff !important;
  --focus-ring: rgb(239 63 101 / 0.4) !important;
  --timeline: #3a202a !important;
  --slider-track: #492a36 !important;
}

:scope[data-colorway="amber-gold"] {
  --background: #17120a !important;
  --surface: #211a10 !important;
  --surface-elevated: #2b2316 !important;
  --surface-hover: #382d1b !important;
  --border: rgb(240 190 103 / 0.11) !important;
  --border-strong: rgb(240 190 103 / 0.22) !important;
  --text-primary: #ffffff !important;
  --text-secondary: #ffffff !important;
  --text-muted: #ffffff !important;
  --accent: #f2a93b !important;
  --accent-hover: #f7b957 !important;
  --accent-soft: rgb(242 169 59 / 0.16) !important;
  --accent-contrast: #211403 !important;
  --focus-ring: rgb(242 169 59 / 0.4) !important;
  --timeline: #3a3020 !important;
  --slider-track: #4a3d27 !important;
}

:scope[data-colorway="clean-light"] {
  --background: #f5f6f8 !important;
  --surface: #ffffff !important;
  --surface-elevated: #f9fafb !important;
  --surface-hover: #eef1f5 !important;
  --border: rgb(23 31 44 / 0.09) !important;
  --border-strong: rgb(23 31 44 / 0.16) !important;
  --text-primary: #0b0f14 !important;
  --text-secondary: #0b0f14 !important;
  --text-muted: #0b0f14 !important;
  --accent: #356df3 !important;
  --accent-hover: #285edc !important;
  --accent-soft: rgb(53 109 243 / 0.12) !important;
  --accent-contrast: #ffffff !important;
  --focus-ring: rgb(53 109 243 / 0.3) !important;
  --timeline: #dce1e8 !important;
  --slider-track: #ccd3dc !important;
}

:scope[data-visual-mode="enhanced"] body {
  background: var(--background) !important;
  color: var(--text-primary) !important;
}

:scope[data-visual-mode="enhanced"] .brand-mark {
  border-color: transparent !important;
  background: var(--accent) !important;
  background-image: none !important;
  color: var(--accent-contrast) !important;
  box-shadow: none !important;
}

:scope[data-visual-mode="enhanced"] .search-row:focus-within,
:scope[data-visual-mode="enhanced"] .search-field:focus-within {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--focus-ring) !important;
}

/* Application-wide color normalization. The original interface still exposes
   several legacy palette variables and hard-coded surface treatments outside
   Compare; route them all through the active semantic theme. */
:scope {
  --accent-2: var(--accent-hover) !important;
  --accent-gradient: var(--accent) !important;
  --accent-shadow: var(--focus-ring) !important;
  --control-shadow: var(--shadow) !important;
  --shadow-card: var(--shadow) !important;
  --shadow-lift: var(--shadow) !important;
  --shadow-soft: var(--shadow) !important;
  --dashboard-canvas: var(--background) !important;
  --dashboard-shell: var(--background) !important;
  --dashboard-surface: var(--surface) !important;
  --dashboard-rail: var(--surface) !important;
  --dashboard-rail-section: var(--surface-elevated) !important;
  --dashboard-muted: var(--text-muted) !important;
  --dashboard-rail-muted: var(--text-muted) !important;
  --field-green: var(--success) !important;
  --field-green-soft: color-mix(in srgb, var(--success) 16%, transparent) !important;
  --progress: var(--accent) !important;
  --pin-windup: var(--accent) !important;
  --pin-release: var(--danger) !important;
  --pin-landing: var(--success) !important;
  --sunrise-gradient: var(--accent) !important;
  --sunrise-soft-gradient: var(--accent-soft) !important;
  --sunrise-shadow: 0 0 0 3px var(--focus-ring) !important;
  --tc-coral: var(--accent) !important;
  --tc-cyan: var(--accent) !important;
  --tc-ink: var(--text-primary) !important;
  --tc-mono: var(--text-secondary) !important;
  --tc-yellow: var(--accent) !important;
  --warm-amber: var(--accent) !important;
  --warm-clay: var(--accent) !important;
  --warm-clay-soft: var(--accent-soft) !important;
  --warm-clay-strong: var(--accent-hover) !important;
  --video-poster: var(--surface-elevated) !important;
}

:scope[data-colorway] .app,
:scope[data-colorway] .app .search-page,
:scope[data-colorway] .app .settings-page,
:scope[data-colorway] .app .athlete-profile-view,
:scope[data-colorway] .app .general-coach-view,
:scope[data-colorway] .app .coach-memory-view,
:scope[data-colorway] .app .compare-view {
  background-color: var(--background) !important;
  color: var(--text-primary) !important;
}

:scope[data-colorway] .app :is(
  [class*="panel"],
  [class*="card"],
  [class*="dialog"],
  [class*="popover"],
  [class*="workspace"],
  [class*="library-section"],
  [class*="search-result"],
  [class*="search-suggestions"],
  .tips,
  details,
  .tool-panel,
  .project-library
) {
  border-color: var(--border) !important;
  background-color: var(--surface) !important;
  background-image: none !important;
  color: var(--text-primary) !important;
  box-shadow: var(--shadow) !important;
}

:scope[data-colorway] .app :is(
  .distance-stat-card,
  .advanced-sync-row,
  .advanced-sync-header,
  .advanced-sync-count-controls,
  .phase-detection-chip,
  .video-sync-pills span,
  .distance-stack,
  .unit-input,
  .biomech-status-panel,
  .skeleton-controls,
  .tool-panel,
  .dialog-heading,
  .search-suggestions,
  .empty-state
) {
  border-color: var(--border) !important;
  background-color: var(--surface-elevated) !important;
  background-image: none !important;
  color: var(--text-primary) !important;
  box-shadow: none !important;
}

:scope[data-colorway] .app :is(
  h1, h2, h3, h4, h5, h6,
  strong,
  .dialog-heading,
  .coach-card-heading,
  .project-popover-heading
) {
  color: var(--text-primary) !important;
}

:scope[data-colorway] .app :is(
  p,
  label,
  small,
  .dialog-copy,
  .drop-status,
  .video-hud,
  .video-hud-kicker,
  .video-sync-pills,
  .project-popover-heading span,
  .phase-detection-chip span
) {
  color: var(--text-secondary) !important;
}

:scope[data-colorway] .app :is(
  .empty-state,
  .video-stage,
  .video-hud,
  .video-sync-pills,
  .skeleton-canvas + canvas
) {
  border-color: var(--border) !important;
}

:scope[data-colorway] .app .empty-state::before,
:scope[data-colorway] .app .empty-state::after,
:scope[data-colorway] .app .empty-state strong::before {
  background: var(--accent) !important;
  background-image: none !important;
  color: var(--accent-contrast) !important;
  border-color: transparent !important;
}

:scope[data-colorway] .app :is(
  .auto-sync-panel,
  .phase-detection-summary,
  .advanced-sync-time.synced,
  .video-sync-pills span,
  .drop-status:not(:empty)
) {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border)) !important;
  background-color: var(--accent-soft) !important;
  background-image: none !important;
  color: var(--text-primary) !important;
}

:scope[data-colorway] .app :is(
  .primary-action,
  .layout-toggle button.active,
  .frame-shape-controls button.active,
  .mark-tool-button.active,
  .color-swatch.active,
  .primary-nav-button.active,
  .speed-preset.active,
  .sync-disclosure-button::before
) {
  border-color: transparent !important;
  background-color: var(--accent) !important;
  background-image: none !important;
  color: var(--accent-contrast) !important;
  box-shadow: none !important;
}

:scope[data-colorway] .app :is(
  .danger-button,
  .sync-trash,
  .delete-athlete-button,
  .delete-project-button
) {
  border-color: color-mix(in srgb, var(--danger) 48%, var(--border)) !important;
  background-color: color-mix(in srgb, var(--danger) 12%, var(--surface)) !important;
  color: var(--danger) !important;
}

:scope[data-colorway] .app :is(
  .status-success,
  .success,
  .synced,
  .mmpose-status.ready
) {
  border-color: color-mix(in srgb, var(--success) 48%, var(--border)) !important;
  background-color: color-mix(in srgb, var(--success) 14%, var(--surface)) !important;
  color: var(--success) !important;
}

:scope[data-colorway] .app :is(button, select, input, textarea, summary):focus,
:scope[data-colorway] .app :is(button, select, input, textarea, summary):focus-visible {
  outline: none !important;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--focus-ring) !important;
}

:scope[data-colorway] .app svg {
  color: inherit;
}

:scope[data-colorway] .app svg :is(path, circle, line, polyline, rect) {
  stroke: currentColor;
}

:scope[data-colorway] .app .file-picker,
:scope[data-colorway] .app .control-strip,
:scope[data-colorway] .app .video-stage {
  border-color: var(--border) !important;
  background: var(--surface-elevated) !important;
  background-image: none !important;
  box-shadow: inset 0 0 0 1px var(--border) !important;
}

:scope[data-colorway] .app .video-stage.has-video {
  background: var(--video-bg) !important;
}

:scope[data-colorway] .app .video-stage::after {
  background: none !important;
  animation: none !important;
}

:scope[data-colorway] .app :is(.file-picker > span, .empty-state span, .video-hud-kicker) {
  color: var(--text-muted) !important;
}

:scope[data-colorway] .app :is(.file-picker > span, .video-hud-kicker, .primary-nav-button.active)::after {
  background: var(--accent) !important;
  background-image: none !important;
}

:scope[data-colorway] dialog::backdrop {
  background: color-mix(in srgb, var(--background) 82%, transparent) !important;
}

:scope[data-colorway] .app :is(
  .settings-grid > label,
  .settings-account-actions,
  .settings-link-button,
  .general-coach-shell,
  .coach-memory-file,
  .athlete-profile-content,
  .athlete-profile-card,
  .library-grid,
  .compare-shell,
  .compare-select-row,
  .search-categories
) {
  border-color: var(--border) !important;
  background: var(--surface) !important;
  background-image: none !important;
  color: var(--text-primary) !important;
  box-shadow: var(--shadow) !important;
}

:scope[data-colorway] .app .settings-grid :is(input, select),
:scope[data-colorway] .app .settings-grid input[readonly],
:scope[data-colorway] .app .settings-link-button {
  border-color: var(--border) !important;
  background: var(--surface-elevated) !important;
  color: var(--text-primary) !important;
  box-shadow: none !important;
}

:scope[data-colorway] .app .settings-grid > label {
  color: var(--text-muted) !important;
}

:scope[data-colorway] .app .settings-page-heading,
:scope[data-colorway] .app .general-coach-heading,
:scope[data-colorway] .app .athlete-profile-heading {
  border-color: var(--border) !important;
  background: transparent !important;
  color: var(--text-primary) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .app :is(
  .library-item,
  .athlete-video-list,
  .athlete-project-row,
  .compare-card,
  .general-coach-card,
  .compare-athlete-card,
  .compare-fact,
  .profile-fact,
  .profile-pr-row,
  .athlete-event-filters
) {
  border-color: var(--border) !important;
  background: var(--surface) !important;
  background-image: none !important;
  color: var(--text-primary) !important;
  box-shadow: none !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .app :is(
  .library-item,
  .project-thumbnail,
  .athlete-video-list,
  .athlete-project-row,
  .compare-card,
  .general-coach-card,
  .compare-athlete-card
) :is(strong, small, span, p) {
  color: var(--text-secondary) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .app :is(
  .library-item,
  .project-thumbnail,
  .athlete-video-list,
  .athlete-project-row,
  .compare-card,
  .general-coach-card,
  .compare-athlete-card
) strong {
  color: var(--text-primary) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .app .athlete-event-filters button {
  background: transparent !important;
  color: var(--text-secondary) !important;
  box-shadow: none !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .app .athlete-event-filters button.active {
  background: var(--accent) !important;
  color: var(--accent-contrast) !important;
}

/* Symmetry pass: keep the comparison workspace balanced at every desktop width. */
:scope[data-visual-mode="enhanced"][data-colorway] .topbar {
  grid-template-columns: 220px minmax(0, 1fr) 220px !important;
}

@media (max-width: 980px) {
  :scope[data-visual-mode="enhanced"][data-colorway] .topbar {
    grid-template-columns: 1fr auto !important;
  }
}

/* Refined home workspace
   A compact coaching workstation: media first, tools contextual, analysis in a
   collapsible inspector. This final layer intentionally supersedes the legacy
   home-dashboard spacing while leaving Compare and the other routes intact. */
:scope[data-visual-mode="enhanced"][data-colorway] {
  --analysis-marker: #e4a83b;
  --media-stage: #0b1018;
  --media-stage-raised: #111925;
  --top-space-1: 4px;
  --top-space-2: 8px;
  --top-space-3: 12px;
  --top-space-4: 16px;
  --top-space-6: 24px;
  --top-control-height: 38px;
  --top-card-radius: 11px;
  --top-control-radius: 8px;
  --top-surface: #171c24;
  --top-surface-muted: #202631;
  --top-surface-hover: #28303d;
  --top-border: rgb(255 255 255 / 0.12);
  --top-border-strong: rgb(255 255 255 / 0.2);
  --top-ink: #f5f7fb;
  --top-muted: #ffffff;
  --top-accent: #3f73f2;
  --top-accent-contrast: #ffffff;
  --top-accent-hover: #5485f6;
  --top-accent-soft: rgb(63 115 242 / 0.16);
  --top-focus: rgb(63 115 242 / 0.35);
}

:scope[data-visual-mode="enhanced"][data-colorway="clean-light"] {
  --top-surface: #ffffff;
  --top-surface-muted: #f4f6f9;
  --top-surface-hover: #e9edf3;
  --top-border: #dce1e8;
  --top-border-strong: #c8d0da;
  --top-ink: #18202b;
  --top-muted: #0b0f14;
  --top-accent: #356df3;
  --top-accent-contrast: #ffffff;
  --top-accent-hover: #285edc;
  --top-accent-soft: rgb(53 109 243 / 0.12);
  --top-focus: rgb(53 109 243 / 0.3);
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) > .topbar {
  position: sticky !important;
  top: 0 !important;
  z-index: 100 !important;
  display: grid !important;
  grid-template-columns: 208px minmax(0, 1fr) 308px !important;
  grid-template-areas: "brand nav search" "actions actions actions" !important;
  grid-template-rows: 58px 54px !important;
  gap: 0 var(--top-space-6) !important;
  width: 100% !important;
  height: 112px !important;
  min-height: 112px !important;
  max-height: 112px !important;
  margin: 0 !important;
  padding: 0 20px !important;
  border: 0 !important;
  border-bottom: 1px solid var(--top-border) !important;
  border-radius: 0 !important;
  background: color-mix(in srgb, var(--top-surface) 96%, transparent) !important;
  box-shadow: none !important;
  backdrop-filter: blur(18px) saturate(130%);
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) > .topbar > .actions {
  grid-area: actions !important;
  display: flex !important;
  align-items: center !important;
  align-self: stretch !important;
  gap: var(--top-space-3) !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 54px !important;
  min-height: 54px !important;
  max-height: 54px !important;
  margin: 0 !important;
  padding: 8px 0 !important;
  border-top: 1px solid var(--top-border) !important;
  background: var(--top-surface) !important;
  transform: none !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) > .topbar > .actions > .main-controls {
  display: flex !important;
  align-items: center !important;
  gap: var(--top-space-3) !important;
  flex: 1 1 auto !important;
  width: auto !important;
  min-width: 0 !important;
  height: var(--top-control-height) !important;
  margin: 0 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .main-controls > .project-menu {
  position: relative !important;
  flex: 1 1 272px !important;
  width: auto !important;
  min-width: 180px !important;
  max-width: 320px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .main-controls > .layout-toggle {
  flex: 0 0 196px !important;
  width: 196px !important;
  min-width: 196px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .main-controls > .sync-viewer-launch {
  flex: 0 0 164px !important;
  width: 164px !important;
  min-width: 164px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .main-controls > :is(.project-menu, .layout-toggle, .sync-viewer-launch),
:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .main-controls > .project-menu > summary {
  height: var(--top-control-height) !important;
  min-height: var(--top-control-height) !important;
  border-radius: var(--top-control-radius) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .topbar .analysis-tools-menu {
  align-self: center !important;
  flex: 0 0 148px !important;
  width: 148px !important;
  height: var(--top-control-height) !important;
  margin: 0 0 0 auto !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .topbar .analysis-tools-menu > summary {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: var(--top-control-height) !important;
  min-height: var(--top-control-height) !important;
  padding: 0 28px 0 12px !important;
  border: 1px solid var(--top-border) !important;
  border-radius: var(--top-control-radius) !important;
  background: var(--top-surface-muted) !important;
  color: var(--top-ink) !important;
  font-size: 12px !important;
  font-weight: 500 !important;
}

/* Row 1: one compact global header baseline. */
:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) > .topbar > .brand-strip {
  align-self: center !important;
  gap: var(--top-space-2) !important;
  width: 100% !important;
  height: var(--top-control-height) !important;
  overflow: visible !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .brand-mark {
  width: 34px !important;
  min-width: 34px !important;
  height: 34px !important;
  min-height: 34px !important;
  border-radius: var(--top-control-radius) !important;
  background: var(--top-accent) !important;
  color: var(--top-accent-contrast) !important;
  font-size: 11px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .brand-copy strong {
  color: var(--top-ink) !important;
  font-size: 17px !important;
  font-weight: 650 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) > .topbar > .primary-nav {
  align-self: center !important;
  justify-content: flex-start !important;
  gap: var(--top-space-1) !important;
  width: max-content !important;
  height: var(--top-control-height) !important;
  overflow: visible !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .primary-nav-button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 7px !important;
  flex: 0 0 auto !important;
  width: auto !important;
  min-width: 82px !important;
  height: var(--top-control-height) !important;
  min-height: var(--top-control-height) !important;
  padding: 0 12px !important;
  border: 0 !important;
  border-radius: var(--top-control-radius) !important;
  background: transparent !important;
  color: var(--top-muted) !important;
  font-size: 12px !important;
  font-weight: 500 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .primary-nav-button:hover {
  background: var(--top-surface-hover) !important;
  color: var(--top-ink) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .primary-nav-button.active {
  background: var(--top-accent-soft) !important;
  color: var(--top-ink) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .primary-nav-button.active::after {
  right: 12px !important;
  bottom: -10px !important;
  left: 12px !important;
  height: 2px !important;
  border-radius: 999px !important;
  background: var(--top-accent) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .primary-nav :is(.find-throw-nav-button, .primary-nav-link) {
  display: none !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) > .topbar > .search-row {
  align-self: center !important;
  grid-template-columns: minmax(0, 1fr) 36px 36px !important;
  gap: var(--top-space-2) !important;
  width: 100% !important;
  height: var(--top-control-height) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .project-search,
:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .project-search input {
  width: 100% !important;
  min-width: 0 !important;
  height: var(--top-control-height) !important;
  min-height: var(--top-control-height) !important;
  border-radius: var(--top-control-radius) !important;
  border-color: var(--top-border) !important;
  background: var(--top-surface-muted) !important;
  color: var(--top-ink) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .project-search input {
  padding: 0 12px 0 34px !important;
  font-size: 12px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) :is(.settings-button, .user-avatar) {
  align-self: center !important;
  width: 36px !important;
  min-width: 36px !important;
  height: 36px !important;
  min-height: 36px !important;
  margin: 0 !important;
  border-color: transparent !important;
  background: var(--top-accent) !important;
  color: var(--top-accent-contrast) !important;
}

/* Row 2: one coherent project/action bar. */
:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .project-menu > summary {
  display: grid !important;
  grid-template-columns: 26px minmax(0, 1fr) 14px !important;
  align-items: center !important;
  gap: var(--top-space-2) !important;
  width: 100% !important;
  padding: 0 10px !important;
  border: 1px solid var(--top-border) !important;
  background: var(--top-surface-muted) !important;
  color: var(--top-ink) !important;
  box-shadow: none !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .project-menu > .project-tool-panel {
  position: absolute !important;
  top: calc(100% + var(--top-space-2)) !important;
  right: auto !important;
  left: 0 !important;
  width: min(360px, calc(100vw - 40px)) !important;
  max-width: calc(100vw - 40px) !important;
  margin: 0 !important;
  transform: none !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .sync-viewer-launch-status:not(.visible) {
  display: none !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .main-controls > .project-menu {
  align-self: center !important;
  height: var(--top-control-height) !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .project-menu-avatar {
  display: grid !important;
  place-items: center !important;
  width: 26px !important;
  min-width: 26px !important;
  height: 26px !important;
  min-height: 26px !important;
  border-radius: 7px !important;
  background: var(--top-accent) !important;
  color: var(--top-accent-contrast) !important;
  font-size: 9px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .project-menu-copy {
  display: grid !important;
  gap: 1px !important;
  min-width: 0 !important;
  overflow: hidden !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .project-menu-label {
  color: var(--top-muted) !important;
  font-size: 8px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .project-menu-copy strong {
  display: block !important;
  min-width: 0 !important;
  overflow: hidden !important;
  color: var(--top-ink) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  line-height: 1.15 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .layout-toggle {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 2px !important;
  padding: 2px !important;
  overflow: hidden !important;
  border: 1px solid var(--top-border) !important;
  border-radius: var(--top-control-radius) !important;
  background: var(--top-surface-muted) !important;
  box-shadow: none !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .layout-toggle button {
  height: 32px !important;
  min-height: 32px !important;
  padding: 0 10px !important;
  border: 0 !important;
  border-radius: 6px !important;
  background: transparent !important;
  color: var(--top-muted) !important;
  font-size: 11px !important;
  font-weight: 500 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .layout-toggle button.active {
  background: var(--top-accent) !important;
  color: var(--top-accent-contrast) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .sync-viewer-launch {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: var(--top-space-2) !important;
  padding: 0 14px !important;
  border: 1px solid var(--top-border) !important;
  background: var(--top-surface-muted) !important;
  color: var(--top-ink) !important;
  font-size: 11px !important;
  font-weight: 550 !important;
  box-shadow: none !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .sync-viewer-launch::before {
  content: none !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .sync-viewer-launch svg {
  width: 16px !important;
  height: 16px !important;
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 1.8 !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) :is(button, select, summary) {
  font-weight: 500;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .topbar :is(.tool-panel, .wide-tool-panel, .analysis-tools-panel) {
  color: var(--text-primary) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .topbar :is(.tool-panel, .wide-tool-panel, .analysis-tools-panel) :is(strong, span, label, .mmpose-status) {
  color: var(--text-primary) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .topbar .project-name {
  color: #0b0f14 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 300px !important;
  grid-template-areas: "videos inspector" !important;
  align-items: start !important;
  gap: 16px !important;
  width: 100% !important;
  min-height: calc(100vh - 112px) !important;
  margin: 0 !important;
  padding: 16px 0 24px !important;
  background: var(--background) !important;
  transition: grid-template-columns 180ms ease !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout.analysis-rail-collapsed {
  grid-template-columns: minmax(0, 1fr) 48px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout > .video-column {
  grid-area: videos !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  grid-template-areas: "stage stage" "timeline speed" !important;
  gap: 12px !important;
  min-width: 0 !important;
  width: 100% !important;
  padding: 0 !important;
  background: transparent !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout > .video-column > .video-grid {
  grid-area: stage !important;
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 12px !important;
  min-width: 0 !important;
  width: 100% !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .video-panel {
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr) !important;
  min-width: 0 !important;
  padding: var(--top-space-3) !important;
  overflow: hidden !important;
  border: 1px solid var(--top-border) !important;
  border-radius: var(--top-card-radius) !important;
  background: var(--top-surface) !important;
  box-shadow: 0 4px 14px rgb(10 18 30 / 0.04) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .file-picker {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  grid-template-rows: auto repeat(3, var(--top-control-height)) !important;
  align-items: stretch !important;
  gap: var(--top-space-2) !important;
  width: 100% !important;
  margin: 0 0 var(--top-space-3) !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .file-picker > * {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  min-height: var(--top-control-height) !important;
  height: var(--top-control-height) !important;
  margin: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .file-picker > .video-setup-heading {
  grid-column: 1 / -1 !important;
  grid-row: 1 !important;
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) !important;
  align-items: baseline !important;
  gap: var(--top-space-3) !important;
  min-height: 34px !important;
  height: auto !important;
  padding: 0 var(--top-space-1) !important;
  overflow: visible !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .video-setup-heading strong {
  color: var(--top-ink) !important;
  font-size: 14px !important;
  font-weight: 650 !important;
  letter-spacing: -0.01em !important;
  text-transform: none !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .video-setup-heading span {
  min-width: 0 !important;
  max-width: 100% !important;
  overflow: hidden !important;
  color: var(--top-muted) !important;
  font-size: 11px !important;
  font-weight: 450 !important;
  justify-self: end !important;
  text-align: right !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .file-picker > .pick-button {
  grid-column: 1 / -1 !important;
  grid-row: 2 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .file-picker > .saved-video-select:first-of-type {
  grid-column: 1 !important;
  grid-row: 3 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .file-picker > .saved-video-select:last-of-type {
  grid-column: 2 !important;
  grid-row: 3 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .file-picker > .slot-crop-toggle {
  grid-column: 1 !important;
  grid-row: 4 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .file-picker > .frame-shape-controls {
  grid-column: 2 !important;
  grid-row: 4 !important;
  min-height: var(--top-control-height) !important;
  height: var(--top-control-height) !important;
  padding: 2px !important;
  border-color: var(--top-border-strong) !important;
  background: var(--top-surface-muted) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .file-picker :is(button, select) {
  min-width: 0 !important;
  min-height: var(--top-control-height) !important;
  height: var(--top-control-height) !important;
  padding: 0 10px !important;
  overflow: hidden !important;
  border-radius: var(--top-control-radius) !important;
  border-color: var(--top-border-strong) !important;
  background: var(--top-surface-muted) !important;
  color: var(--top-ink) !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .file-picker :is(button, select):hover {
  border-color: color-mix(in srgb, var(--top-accent) 48%, var(--top-border)) !important;
  background: var(--top-surface-hover) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .file-picker .frame-shape-controls button {
  min-height: 32px !important;
  height: 32px !important;
  padding: 0 6px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .file-picker .frame-shape-controls button.active {
  border-color: transparent !important;
  background: var(--top-accent) !important;
  color: var(--top-accent-contrast) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .video-stage {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: hidden !important;
  border: 1px solid rgb(255 255 255 / 0.08) !important;
  border-radius: 8px !important;
  background: var(--media-stage) !important;
  aspect-ratio: 16 / 10 !important;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.025) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .video-stage > .empty-state {
  display: grid !important;
  place-content: center !important;
  justify-items: center !important;
  gap: 9px !important;
  width: 100% !important;
  height: 100% !important;
  padding: 24px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background:
    radial-gradient(circle at center, rgb(53 109 243 / 0.12), transparent 44%),
    linear-gradient(rgb(255 255 255 / 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 0.025) 1px, transparent 1px),
    var(--media-stage) !important;
  background-size: auto, 32px 32px, 32px 32px, auto !important;
  color: #eef4ff !important;
  cursor: pointer !important;
  box-shadow: none !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .video-stage > .empty-state:hover {
  background:
    radial-gradient(circle at center, rgb(53 109 243 / 0.2), transparent 48%),
    linear-gradient(rgb(255 255 255 / 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 0.03) 1px, transparent 1px),
    var(--media-stage-raised) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .video-stage > .empty-state::before {
  display: grid !important;
  place-items: center !important;
  width: 48px !important;
  height: 48px !important;
  margin: 0 0 3px !important;
  border: 1px solid rgb(255 255 255 / 0.12) !important;
  border-radius: 50% !important;
  background: var(--top-accent) !important;
  color: var(--top-accent-contrast) !important;
  content: "+" !important;
  font-size: 26px !important;
  font-weight: 350 !important;
  line-height: 1 !important;
  box-shadow: 0 10px 28px rgb(0 0 0 / 0.28) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) :is(.topbar, .file-picker) :is(button, select, input, summary):focus-visible {
  outline: none !important;
  border-color: var(--top-accent) !important;
  box-shadow: 0 0 0 3px var(--top-focus) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .video-stage > .empty-state strong {
  color: #f7f9fc !important;
  font-size: 14px !important;
  font-weight: 600 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .video-stage > .empty-state span {
  color: #8f9bac !important;
  font-size: 11px !important;
  font-weight: 450 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout > .video-column > .control-strip {
  grid-area: timeline !important;
  display: grid !important;
  grid-template-columns: 64px minmax(0, 1fr) 64px !important;
  gap: 12px !important;
  align-items: center !important;
  min-width: 0 !important;
  min-height: 48px !important;
  height: 48px !important;
  margin: 0 !important;
  padding: 0 14px !important;
  border: 1px solid var(--border) !important;
  border-radius: 9px !important;
  background: var(--surface) !important;
  color: var(--text-primary) !important;
  box-shadow: none !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout > .video-column > .control-strip :is(span, label, select) {
  color: var(--text-primary) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout > .video-column > .control-strip select {
  background: var(--surface-elevated) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout > .video-column > .control-strip :is(#frameBack, #frameForward) {
  color: #0b0f14 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout > .video-column > .reference-speed-controls {
  grid-area: speed !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  min-width: 254px !important;
  min-height: 48px !important;
  height: 48px !important;
  margin: 0 !important;
  padding: 6px 8px !important;
  border: 1px solid var(--border) !important;
  border-radius: 9px !important;
  background: var(--surface) !important;
  color: var(--text-primary) !important;
  box-shadow: none !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout > .video-column > .reference-speed-controls :is(span, button) {
  color: var(--text-primary) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout > .video-column > .reference-speed-controls button {
  min-width: 52px !important;
  min-height: 32px !important;
  height: 32px !important;
  padding: 0 8px !important;
  border-radius: 7px !important;
  font-size: 11px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout > .analysis-column {
  grid-area: inspector !important;
  position: sticky !important;
  top: 128px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  width: 100% !important;
  min-width: 0 !important;
  max-height: calc(100vh - 144px) !important;
  padding: 0 !important;
  overflow-y: auto !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--text-primary) !important;
  scrollbar-width: thin;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .analysis-rail-toggle {
  order: -10 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
  flex: 0 0 auto !important;
  width: 100% !important;
  min-height: 42px !important;
  height: 42px !important;
  padding: 0 10px 0 12px !important;
  border: 1px solid var(--border) !important;
  border-radius: 9px !important;
  background: var(--surface) !important;
  color: var(--text-primary) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  box-shadow: none !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .analysis-rail-toggle::before {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--analysis-marker);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--analysis-marker) 14%, transparent);
  content: "";
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .analysis-rail-toggle-label {
  flex: 1 1 auto;
  text-align: left;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .analysis-rail-toggle svg {
  width: 16px !important;
  height: 16px !important;
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 1.8 !important;
  transition: transform 180ms ease;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout.analysis-rail-collapsed .analysis-column > :not(.analysis-rail-toggle) {
  display: none !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout.analysis-rail-collapsed .analysis-rail-toggle {
  justify-content: center !important;
  height: 48px !important;
  padding: 0 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout.analysis-rail-collapsed .analysis-rail-toggle::before,
:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout.analysis-rail-collapsed .analysis-rail-toggle-label {
  display: none !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout.analysis-rail-collapsed .analysis-rail-toggle svg {
  transform: rotate(180deg);
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout > .analysis-column > .sync-disclosure-button {
  display: none !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout > .analysis-column > :is(#advancedSyncDetails, .distance-panel, .notes-panel) {
  flex: 0 0 auto !important;
  width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 1px solid var(--border) !important;
  border-radius: 9px !important;
  background: var(--surface) !important;
  box-shadow: none !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout > .analysis-column > :is(#advancedSyncDetails, .distance-panel, .notes-panel) > summary {
  min-height: 44px !important;
  padding: 0 12px !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--text-primary) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout > .analysis-column > :is(#advancedSyncDetails, .distance-panel, .notes-panel) > summary strong::before {
  color: #0b0f14 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout > .analysis-column > :is(#advancedSyncDetails, .distance-panel, .notes-panel) > summary strong::after {
  color: var(--text-primary) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout > .analysis-column :is(.sync-strip-body, .distance-panel-body, .notes-panel-body) {
  max-height: none !important;
  padding: 10px !important;
  overflow: visible !important;
  border-top: 1px solid var(--border) !important;
  background: transparent !important;
  box-shadow: none !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout > .analysis-column :is(.advanced-sync-row, .sync-checkpoint-intro, .distance-stat-card, .distance-center, .distance-stack) {
  border-color: var(--border) !important;
  border-radius: 7px !important;
  background: var(--surface-elevated) !important;
  color: var(--text-primary) !important;
  box-shadow: none !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout > .analysis-column :is(
  #releaseStatus,
  .advanced-sync-count-label,
  .advanced-sync-header span,
  .advanced-sync-number,
  .distance-stat-card > strong,
  .distance-panel label,
  .distance-settings label,
  .mmpose-status
) {
  color: var(--text-primary) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout > .analysis-column :is(
  .advanced-sync-count-label,
  .advanced-sync-header span,
  .advanced-sync-number
) {
  background: transparent !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout > .analysis-column #releaseStatus {
  background: var(--surface-hover) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout > .analysis-column :is(.distance-panel label, .distance-settings label) {
  border-color: var(--border) !important;
  background: transparent !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout > .analysis-column :is(
  .advanced-sync-step,
  .advanced-sync-count-value,
  .advanced-sync-row button,
  .distance-panel select,
  .distance-panel input:not([type="range"]),
  .distance-panel button
) {
  border-color: var(--border-strong) !important;
  background: var(--surface-hover) !important;
  color: var(--text-primary) !important;
}

@media (max-width: 1180px) {
  :scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) > .topbar {
    grid-template-columns: 190px minmax(0, 1fr) 264px !important;
    gap: 0 12px !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .primary-nav-button {
    padding-right: 9px !important;
    padding-left: 9px !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout {
    grid-template-columns: minmax(0, 1fr) 278px !important;
  }
}

@media (max-width: 900px) {
  :scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) > .topbar {
    grid-template-columns: 1fr auto !important;
    grid-template-areas: "brand search" "nav nav" "actions actions" !important;
    grid-template-rows: 56px 44px auto !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) > .topbar > .actions {
    height: auto !important;
    min-height: 52px !important;
    max-height: none !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) > .topbar > .actions > .main-controls {
    flex-wrap: wrap !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout,
  :scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout.analysis-rail-collapsed {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-areas: "videos" "inspector" !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout > .analysis-column {
    position: static !important;
    max-height: none !important;
  }
}

@media (max-width: 720px) {
  :scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout > .video-column {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-areas: "stage" "timeline" "speed" !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout > .video-column > .video-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .file-picker {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: auto repeat(5, var(--top-control-height)) !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .file-picker > * {
    grid-column: 1 !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .file-picker > .video-setup-heading { grid-row: 1 !important; }
  :scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .file-picker > .pick-button { grid-row: 2 !important; }
  :scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .file-picker > .saved-video-select:first-of-type { grid-row: 3 !important; }
  :scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .file-picker > .saved-video-select:last-of-type { grid-row: 4 !important; }
  :scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .file-picker > .slot-crop-toggle { grid-row: 5 !important; }
  :scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .file-picker > .frame-shape-controls { grid-row: 6 !important; }
}

/* The inspector may be taller than the media. Keep video cards content-sized
   instead of inheriting the legacy equal-height dashboard stretch. */
:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout > .video-column > .video-grid {
  align-items: start !important;
  align-content: start !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .video-panel {
  grid-template-rows: auto auto !important;
  align-self: start !important;
  height: auto !important;
  min-height: 0 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .video-grid.single-video > .video-panel:nth-child(2) {
  display: none !important;
}

/* Emerald coherence and route-level layout stabilization. The workspace used a
   second, hard-coded blue palette, which made its controls disagree with the
   selected application colorway. Keep the compact workspace structure, but
   derive every surface, control, and text treatment from the active palette. */
:scope[data-visual-mode="enhanced"][data-colorway] {
  --top-surface: var(--surface);
  --top-surface-muted: var(--surface-elevated);
  --top-surface-hover: var(--surface-hover);
  --top-border: var(--border);
  --top-border-strong: var(--border-strong);
  --top-ink: var(--text-primary);
  --top-muted: var(--text-secondary);
  --top-accent: var(--accent);
  --top-accent-contrast: var(--accent-contrast);
  --top-accent-hover: var(--accent-hover);
  --top-accent-soft: var(--accent-soft);
  --top-focus: var(--focus-ring);
  --media-stage: color-mix(in srgb, var(--background) 72%, #000);
  --media-stage-raised: color-mix(in srgb, var(--surface) 86%, #000);
}

:scope[data-colorway="deep-emerald"] {
  --text-primary: #f4fbf6 !important;
  --text-secondary: #d2e6d9 !important;
  --text-muted: #a9c6b4 !important;
}

/* The workspace controls do not belong on Library or Settings. Removing this
   unused row gives those routes a clean, focused header and prevents the
   oversized export icon visible in the previous settings layout. */
:scope[data-visual-mode="enhanced"][data-colorway] .app:is(.search-active, .settings-active) > .topbar > .actions {
  display: none !important;
}

/* A stable three-zone header reserves enough room for a real search field
   instead of letting it collapse between navigation and account controls. */
:scope[data-visual-mode="enhanced"][data-colorway] .app:is(.search-active, .settings-active) > .topbar {
  grid-template-columns: 220px minmax(0, 1fr) minmax(340px, 420px) !important;
  grid-template-areas: "brand nav search" !important;
  column-gap: 24px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .app:is(.search-active, .settings-active) > .topbar > .search-row {
  grid-template-columns: minmax(0, 1fr) 38px 38px !important;
  gap: 10px !important;
  min-width: 0 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .app:is(.search-active, .settings-active) .project-search,
:scope[data-visual-mode="enhanced"][data-colorway] .app:is(.search-active, .settings-active) .project-search input {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 40px !important;
  border-color: var(--border-strong) !important;
  background: var(--surface-elevated) !important;
  color: var(--text-primary) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .app:is(.search-active, .settings-active) .project-search input::placeholder {
  color: var(--text-muted) !important;
  opacity: 1 !important;
}

/* Settings are a compact form, not a stretched dashboard. */
:scope[data-visual-mode="enhanced"][data-colorway] .settings-page {
  max-width: 1120px !important;
  min-height: 0 !important;
  margin: 20px auto !important;
  padding: 24px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .settings-page > .settings-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 12px !important;
  max-width: 100% !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .settings-page > .settings-grid > :is(label, .settings-account-actions, .settings-link-button) {
  min-height: 92px !important;
  padding: 14px !important;
  border-color: var(--border) !important;
  background: var(--surface) !important;
  color: var(--text-primary) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .settings-page > .settings-grid :is(input, select) {
  min-height: 38px !important;
  border-color: var(--border-strong) !important;
  background: var(--surface-elevated) !important;
  color: var(--text-primary) !important;
}

@media (max-width: 980px) {
  :scope[data-visual-mode="enhanced"][data-colorway] .app:is(.search-active, .settings-active) > .topbar {
    grid-template-columns: minmax(0, 1fr) auto !important;
    grid-template-areas: "brand search" "nav nav" !important;
    row-gap: 4px !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] .app:is(.search-active, .settings-active) > .topbar > .search-row {
    grid-template-columns: minmax(220px, 1fr) 38px 38px !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] .settings-page > .settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 640px) {
  :scope[data-visual-mode="enhanced"][data-colorway] .settings-page {
    margin: 12px 0 !important;
    padding: 16px !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] .settings-page > .settings-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Dialogs are mounted outside `.app`, so they need the same token treatment
   explicitly rather than inheriting the legacy light form controls. */
:scope[data-colorway] .app-dialog form:not(:where(html[data-tc-redesign="trackside-1"] .tc-surface-dialog:not(#loginDialog, #athleteDialog) > form)) {
  border-color: var(--border) !important;
  background: var(--surface) !important;
  color: var(--text-primary) !important;
}

:scope[data-colorway] .app-dialog :is(label, strong, p, span) {
  color: var(--text-secondary) !important;
}

:scope[data-colorway] .app-dialog .settings-grid > label {
  border-color: var(--border) !important;
  background: var(--surface) !important;
}

:scope[data-colorway] .app-dialog :is(input, select, textarea) {
  border-color: var(--border-strong) !important;
  background: var(--surface-elevated) !important;
  color: var(--text-primary) !important;
  caret-color: var(--accent) !important;
}

:scope[data-colorway] .app-dialog :is(input, select, textarea)::placeholder {
  color: var(--text-muted) !important;
  opacity: 1 !important;
}

/* Social-app navigation rail: a short, calm top row with evenly spaced
   destinations. Workspace controls remain in their own row below, so global
   navigation never competes with project actions. */
:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) > .topbar {
  grid-template-columns: 200px minmax(360px, 1fr) 320px !important;
  column-gap: 20px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) > .topbar > .brand-strip {
  gap: 10px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .brand-copy span {
  display: none !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) > .topbar > .primary-nav {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(68px, 78px)) !important;
  justify-content: center !important;
  gap: 4px !important;
  width: max-content !important;
  height: 46px !important;
  padding: 4px !important;
  border: 1px solid var(--top-border) !important;
  border-radius: 14px !important;
  background: color-mix(in srgb, var(--top-surface-muted) 86%, transparent) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .primary-nav-button {
  display: grid !important;
  grid-template-rows: 15px 12px !important;
  place-items: center !important;
  gap: 2px !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 36px !important;
  min-height: 36px !important;
  padding: 3px 6px !important;
  border-radius: 10px !important;
  color: var(--top-muted) !important;
  font-size: 10px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .primary-nav-button::before {
  font-size: 16px !important;
  line-height: 1 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .primary-nav-button.active {
  background: var(--top-accent-soft) !important;
  color: var(--top-ink) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .primary-nav-button.active::after {
  display: none !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) > .topbar > .search-row {
  grid-template-columns: minmax(0, 1fr) 38px 38px !important;
  gap: 8px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .project-search {
  border-color: var(--top-border) !important;
  background: color-mix(in srgb, var(--top-surface-muted) 90%, transparent) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .project-search input {
  padding-left: 32px !important;
  color: var(--top-ink) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .project-search input::placeholder {
  color: var(--top-muted) !important;
  opacity: 1 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .settings-button {
  border: 1px solid var(--top-border) !important;
  border-radius: 11px !important;
  background: var(--top-surface-muted) !important;
  color: var(--top-muted) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) .settings-button:hover {
  background: var(--top-surface-hover) !important;
  color: var(--top-ink) !important;
}

@media (max-width: 1120px) {
  :scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) > .topbar {
    grid-template-columns: 180px minmax(300px, 1fr) 264px !important;
    column-gap: 12px !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) > .topbar > .primary-nav {
    grid-template-columns: repeat(4, 64px) !important;
  }
}

@media (max-width: 760px) {
  :scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) > .topbar > .primary-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    width: 100% !important;
  }
}

/* This intentionally matches the legacy workspace selector's specificity so a
   coach session cannot inherit the two-row analysis header. */
:scope[data-visual-mode="enhanced"][data-colorway] body > .app.general-coach-active:not(.search-active):not(.settings-active) > .topbar {
  position: relative !important;
  top: auto !important;
  height: 84px !important;
  min-height: 84px !important;
  max-height: 84px !important;
  grid-template-rows: minmax(0, 1fr) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app.general-coach-active > .topbar > .actions.compact-actions {
  display: none !important;
}

@media (max-width: 760px) {
  :scope[data-visual-mode="enhanced"][data-colorway] body > .app.general-coach-active:not(.search-active):not(.settings-active) > .topbar {
    height: 108px !important;
    min-height: 108px !important;
    max-height: 108px !important;
    grid-template-rows: 52px 40px !important;
  }
}

/* A side-by-side analysis pair is useful on desktop but becomes too narrow to
   operate on a phone. Keep each full-size card usable rather than shrinking
   their controls into two miniature columns. */
@media (max-width: 680px) {
  :scope[data-visual-mode="enhanced"][data-colorway] .app:not(.search-active):not(.settings-active):not(.compare-active) .video-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] .app:not(.search-active):not(.settings-active):not(.compare-active) .video-stage {
    width: 100% !important;
    min-height: 300px !important;
  }
}

/* Workspace header: the previous fluid middle track left the navigation
   visually attached to the brand. Equal flexible side tracks keep navigation
   optically centered while the right control group stays anchored to the page. */
:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active):not(.compare-active):not(.general-coach-active):not(.coach-memory-active) > .topbar {
  grid-template-columns: minmax(220px, 1fr) minmax(380px, 420px) minmax(320px, 1fr) !important;
  column-gap: var(--space-4, 16px) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .app:not(.search-active):not(.settings-active):not(.compare-active):not(.general-coach-active):not(.coach-memory-active) > .topbar > .primary-nav {
  width: 100% !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  justify-self: center !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .app:not(.search-active):not(.settings-active):not(.compare-active):not(.general-coach-active):not(.coach-memory-active) > .topbar > :is(.brand-strip, .primary-nav, .search-row) {
  align-self: center !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .app:not(.search-active):not(.settings-active):not(.compare-active):not(.general-coach-active):not(.coach-memory-active) > .topbar > .search-row {
  justify-self: end !important;
}

@media (min-width: 981px) and (max-width: 1180px) {
  :scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active):not(.compare-active):not(.general-coach-active):not(.coach-memory-active) > .topbar {
    grid-template-columns: minmax(180px, 1fr) minmax(340px, 360px) minmax(0, 1fr) !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] .app:not(.search-active):not(.settings-active):not(.compare-active):not(.general-coach-active):not(.coach-memory-active) > .topbar > .search-row {
    width: min(100%, 300px) !important;
    grid-template-columns: minmax(0, 1fr) 36px 36px !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] .app:not(.search-active):not(.settings-active):not(.compare-active):not(.general-coach-active):not(.coach-memory-active) > .topbar > .search-row input {
    min-width: 0 !important;
  }
}

/* Shared application header. Global navigation is deliberately independent of
   the current workspace so Home, Library, Settings, and focused views always
   present the same wayfinding surface. Project-specific controls stay in the
   command strip immediately below it. */
:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar {
  display: grid !important;
  grid-template-columns: minmax(242px, 0.74fr) minmax(240px, 0.6fr) minmax(480px, 1.66fr) !important;
  grid-template-areas: "brand nav search" !important;
  align-items: center !important;
  gap: clamp(22px, 2.4vw, 46px) !important;
  min-height: 96px !important;
  height: 96px !important;
  margin: 0 !important;
  padding: 14px 18px !important;
  border: 0 !important;
  border-bottom: 1px solid rgba(211, 241, 223, 0.08) !important;
  border-radius: 0 !important;
  background: linear-gradient(105deg, #06100c 0%, #0a1712 100%) !important;
  box-shadow: none !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar > .brand-strip {
  display: flex !important;
  align-items: center !important;
  gap: 18px !important;
  min-width: 0 !important;
  height: 68px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar .brand-mark {
  width: 60px !important;
  min-width: 60px !important;
  height: 60px !important;
  min-height: 60px !important;
  border: 1px solid rgba(123, 255, 166, 0.2) !important;
  border-radius: 13px !important;
  background: linear-gradient(145deg, #20cc68, #13a94e) !important;
  color: #04130a !important;
  font-size: 17px !important;
  font-weight: 850 !important;
  box-shadow: 0 10px 26px rgba(22, 195, 87, 0.18) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar .brand-copy strong {
  display: block !important;
  color: #f5fff8 !important;
  font-size: 24px !important;
  font-weight: 760 !important;
  letter-spacing: -0.045em !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar .brand-copy span {
  display: none !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar > .primary-nav {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 18px !important;
  width: auto !important;
  height: 64px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar .primary-nav-button {
  position: relative !important;
  min-width: 102px !important;
  min-height: 62px !important;
  padding: 0 20px !important;
  border: 0 !important;
  border-radius: 10px !important;
  background: transparent !important;
  color: rgba(239, 249, 243, 0.65) !important;
  font-size: 17px !important;
  font-weight: 720 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar .primary-nav-button:hover {
  background: rgba(116, 237, 153, 0.07) !important;
  color: #f5fff8 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar .primary-nav-button.active {
  background: linear-gradient(180deg, rgba(36, 183, 83, 0.16), rgba(36, 183, 83, 0.07)) !important;
  color: #f5fff8 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar .primary-nav-button.active::after {
  content: "" !important;
  position: absolute !important;
  right: 35% !important;
  bottom: 3px !important;
  left: 35% !important;
  height: 3px !important;
  border-radius: 99px !important;
  background: #2cdb73 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar > .search-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 64px 60px !important;
  align-items: center !important;
  gap: 16px !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 64px !important;
  margin: 0 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar .project-search {
  min-width: 0 !important;
  height: 64px !important;
  border: 1px solid rgba(220, 247, 229, 0.2) !important;
  border-radius: 12px !important;
  background: rgba(24, 42, 34, 0.62) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar .project-search > input#projectSearch {
  height: 62px !important;
  padding: 0 18px 0 62px !important;
  color: #f5fff8 !important;
  font-size: 17px !important;
  font-weight: 540 !important;
  text-align: left !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar .project-search > input#projectSearch::placeholder {
  color: rgba(231, 244, 236, 0.5) !important;
  text-align: left !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar .project-search-icon {
  right: auto !important;
  left: 19px !important;
  width: 25px !important;
  height: 25px !important;
  color: rgba(239, 250, 244, 0.75) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar .settings-button {
  width: 64px !important;
  min-width: 64px !important;
  height: 64px !important;
  min-height: 64px !important;
  padding: 0 !important;
  border: 1px solid rgba(220, 247, 229, 0.18) !important;
  border-radius: 50% !important;
  background: rgba(7, 18, 13, 0.38) !important;
  color: #f2fff6 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar .settings-button:hover {
  border-color: rgba(103, 237, 150, 0.72) !important;
  background: rgba(37, 88, 57, 0.45) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar .settings-button svg {
  width: 30px !important;
  height: 30px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar .user-avatar {
  width: 60px !important;
  min-width: 60px !important;
  height: 60px !important;
  min-height: 60px !important;
  border: 1px solid rgba(123, 255, 166, 0.16) !important;
  border-radius: 50% !important;
  background: linear-gradient(145deg, #25d76e, #12ac50) !important;
  color: #04130a !important;
  font-size: 17px !important;
  font-weight: 850 !important;
  box-shadow: 0 10px 26px rgba(22, 195, 87, 0.15) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-command-bar {
  display: block !important;
  min-height: 58px !important;
  padding: 10px 24px !important;
  border-bottom: 1px solid rgba(211, 241, 223, 0.08) !important;
  background: #0a1510 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-command-bar > .actions.compact-actions {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 38px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:is(.search-active, .settings-active) > .workspace-command-bar {
  display: none !important;
}

@media (max-width: 980px) {
  :scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar {
    grid-template-columns: minmax(0, 1fr) auto auto !important;
    grid-template-areas: "brand search search" "nav nav nav" !important;
    height: auto !important;
    min-height: 0 !important;
    gap: 10px !important;
    padding: 10px 14px !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar > .brand-strip,
  :scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar > .search-row {
    height: 48px !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar .brand-mark,
  :scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar .user-avatar,
  :scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar .settings-button {
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar .brand-copy strong {
    font-size: 18px !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar .project-search {
    height: 44px !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar .project-search > input#projectSearch {
    height: 42px !important;
    padding-left: 46px !important;
    font-size: 14px !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar .project-search-icon {
    left: 13px !important;
    width: 20px !important;
    height: 20px !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar .primary-nav-button {
    min-height: 42px !important;
    font-size: 14px !important;
  }
}

/* The athlete-link prompt is a focused part of saving a throw. It lives
   outside the app shell, so give it the same dark field surface and bright
   athlete names instead of inheriting the retired light/pink dialog theme. */
:scope[data-visual-mode="enhanced"][data-colorway] #projectAthleteDialog {
  border-color: rgba(42, 191, 102, 0.46) !important;
  background: #0d1e16 !important;
  color: #ffffff !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] #projectAthleteDialog form {
  border: 1px solid rgba(42, 191, 102, 0.28) !important;
  background: linear-gradient(180deg, #183525 0%, #0d1e16 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.48) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] #projectAthleteDialog :is(
  .dialog-heading strong,
  .dialog-copy,
  .project-athlete-fieldset legend,
  .project-athlete-option,
  .project-athlete-option span,
  .project-athlete-options small
) {
  color: #ffffff !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] #projectAthleteDialog .project-athlete-fieldset {
  border-color: rgba(94, 225, 139, 0.26) !important;
  background: #10271b !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] #projectAthleteDialog .project-athlete-option {
  border-color: rgba(94, 225, 139, 0.22) !important;
  background: #183626 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] #projectAthleteDialog .project-athlete-option:hover {
  border-color: rgba(111, 239, 155, 0.72) !important;
  background: #204a31 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] #projectAthleteDialog .project-athlete-option:has(input:checked) {
  border-color: #38c970 !important;
  background: #1f5033 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] #projectAthleteDialog .project-athlete-option input {
  accent-color: #38c970 !important;
}

/* The Library shares the dark workspace canvas. Its route title used to keep
   a light-theme slate foreground, which made it recede into that canvas. */
:scope[data-visual-mode="enhanced"][data-colorway] .app.search-active .search-page-heading {
  color: #cfe4d7 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .app.search-active .search-page-heading > strong {
  color: #f5fff8 !important;
}

/* Keep the two Library result-group labels crisp against their dark cards. */
:scope[data-visual-mode="enhanced"][data-colorway] .app.search-active #searchSavedSection > strong,
:scope[data-visual-mode="enhanced"][data-colorway] .app.search-active #searchAthleteSection > strong {
  color: #ffffff !important;
}

/* Final workspace proportions. These selectors intentionally mirror the
   route-level layout rules above, so the wide project controls are not
   collapsed again by the compact-header styles. */
:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) > .topbar {
  grid-template-rows: 70px 82px !important;
  height: 152px !important;
  min-height: 152px !important;
  max-height: 152px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) > .topbar > .actions {
  height: 82px !important;
  min-height: 82px !important;
  max-height: 82px !important;
  padding: 12px 0 !important;
  align-items: stretch !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) > .topbar > .actions > .main-controls {
  display: grid !important;
  grid-template-columns: minmax(260px, 1.35fr) minmax(230px, 1.15fr) minmax(210px, 1fr) !important;
  align-items: stretch !important;
  gap: 14px !important;
  width: 100% !important;
  height: 58px !important;
  min-height: 58px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) > .topbar .main-controls > :is(.project-menu, .layout-toggle, .sync-viewer-launch) {
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  height: 58px !important;
  min-height: 58px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) > .topbar .main-controls > .project-menu,
:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) > .topbar .main-controls > .layout-toggle,
:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) > .topbar .main-controls > .sync-viewer-launch {
  flex: none !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) > .topbar .main-controls .project-menu > summary,
:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) > .topbar .main-controls .layout-toggle > button,
:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) > .topbar .main-controls .sync-viewer-launch {
  height: 58px !important;
  min-height: 58px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) > .topbar .main-controls > .layout-toggle {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout > .video-column > .video-grid {
  align-items: stretch !important;
  grid-auto-rows: minmax(0, 1fr) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .video-panel {
  align-self: stretch !important;
  height: 100% !important;
  min-height: 0 !important;
  grid-template-rows: auto minmax(0, 1fr) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .video-stage {
  min-height: clamp(360px, 38vw, 560px) !important;
}

@media (max-width: 980px) {
  :scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) > .topbar {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) > .topbar > .actions > .main-controls {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

/* A restored media source must always take ownership of its stage. The
   workspace empty-state styling above is deliberately strong, so explicitly
   remove that overlay once either local or external video has loaded. */
:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .video-stage.has-video > .empty-state {
  display: none !important;
}

/* Empty media states use the selected application accent, including Video 2.
   The earlier cyan treatment made an empty slot read like a second theme. */
:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .video-stage:not(.has-video) > .empty-state {
  background:
    radial-gradient(circle at center, color-mix(in srgb, var(--accent) 18%, transparent), transparent 48%),
    linear-gradient(color-mix(in srgb, var(--accent) 8%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 8%, transparent) 1px, transparent 1px),
    var(--media-stage) !important;
  background-size: auto, 32px 32px, 32px 32px, auto !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .video-stage:not(.has-video) > .empty-state:hover {
  background:
    radial-gradient(circle at center, color-mix(in srgb, var(--accent) 28%, transparent), transparent 52%),
    linear-gradient(color-mix(in srgb, var(--accent) 11%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 11%, transparent) 1px, transparent 1px),
    var(--media-stage-raised) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-layout .video-stage:not(.has-video) > .empty-state::before {
  border-color: color-mix(in srgb, var(--accent) 58%, transparent) !important;
  background: color-mix(in srgb, var(--accent) 16%, transparent) !important;
  color: var(--accent) !important;
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 5%, transparent) !important;
}

/* Library, settings, and Compare are content routes rather than the persistent
   workspace toolbar. Keep their header in normal document flow; legacy sticky
   rules were reserving a short row while painting a much taller header over
   the route content. */
:scope[data-visual-mode="enhanced"][data-colorway] .app:is(.search-active, .settings-active) > .topbar {
  position: relative !important;
  top: auto !important;
  z-index: 1 !important;
  display: grid !important;
  grid-template-columns: 220px minmax(0, 1fr) minmax(300px, 420px) !important;
  grid-template-areas: "brand nav search" !important;
  grid-template-rows: minmax(0, 1fr) !important;
  box-sizing: border-box !important;
  width: 100% !important;
  height: 84px !important;
  min-height: 84px !important;
  max-height: 84px !important;
  margin: 0 !important;
  padding: 10px 18px !important;
  overflow: visible !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .app:is(.search-active, .settings-active) > .search-page,
:scope[data-visual-mode="enhanced"][data-colorway] .app:is(.search-active, .settings-active) > .settings-page {
  margin-top: 0 !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .app.settings-active > .workspace-layout {
  display: none !important;
}

@media (max-width: 980px) {
  :scope[data-visual-mode="enhanced"][data-colorway] .app:is(.search-active, .settings-active) > .topbar {
    grid-template-columns: minmax(0, 1fr) auto !important;
    grid-template-areas: "brand search" "nav nav" !important;
    grid-template-rows: 52px 40px !important;
    height: 108px !important;
    min-height: 108px !important;
    max-height: 108px !important;
    padding: 8px 12px !important;
  }
}

/* Coach is mounted in the workspace so it can retain the active project. Hide
   only the workspace siblings and give the coaching conversation its own calm,
   full-width surface. */
:scope[data-visual-mode="enhanced"][data-colorway] .app.general-coach-active > .topbar {
  position: relative !important;
  top: auto !important;
  display: grid !important;
  grid-template-columns: 220px minmax(0, 1fr) minmax(300px, 420px) !important;
  grid-template-areas: "brand nav search" !important;
  grid-template-rows: minmax(0, 1fr) !important;
  box-sizing: border-box !important;
  height: 84px !important;
  min-height: 84px !important;
  max-height: 84px !important;
  margin: 0 !important;
  padding: 10px 18px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app.general-coach-active > .topbar > .actions.compact-actions,
:scope[data-visual-mode="enhanced"][data-colorway] .app.general-coach-active > .workspace-layout > :is(.video-column, .analysis-column) {
  display: none !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .app.general-coach-active > .workspace-layout > .coach-panel {
  display: none !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .app.general-coach-active > .workspace-layout {
  display: block !important;
  min-height: 0 !important;
  padding: 20px 0 32px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .app.general-coach-active .general-coach-view {
  width: min(100%, 1080px) !important;
  min-height: 0 !important;
  margin: 0 auto !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .app.general-coach-active .general-coach-shell {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 180px !important;
  grid-template-rows: minmax(280px, auto) auto !important;
  gap: 14px !important;
  min-height: 0 !important;
  padding: 14px !important;
  border-color: var(--border) !important;
  border-radius: var(--radius) !important;
  background: var(--surface) !important;
  box-shadow: var(--shadow) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .app.general-coach-active .general-coach-log {
  grid-column: 1 !important;
  grid-row: 1 !important;
  min-height: 280px !important;
  max-height: min(54vh, 560px) !important;
  overflow: auto !important;
  border-color: var(--border) !important;
  background: var(--surface-elevated) !important;
  color: var(--text-primary) !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .app.general-coach-active .general-coach-actions {
  grid-column: 2 !important;
  grid-row: 1 !important;
  grid-template-columns: minmax(0, 1fr) !important;
  align-self: start !important;
  gap: 8px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .app.general-coach-active .general-coach-actions > button {
  min-height: 44px !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .app.general-coach-active .general-coach-compose {
  grid-column: 1 / -1 !important;
  grid-row: 2 !important;
}

/* Header athlete search is one field: the wrapper owns the surface and the
   input remains transparent inside it. This avoids the duplicate-outline
   effect created when both elements are rendered as separate controls. */
:scope[data-visual-mode="enhanced"][data-colorway] .topbar .project-search {
  position: relative !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  align-items: center !important;
  justify-content: normal !important;
  gap: 0 !important;
  min-width: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .topbar .project-search::before {
  display: none !important;
  content: none !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .topbar .project-search > input#projectSearch {
  box-sizing: border-box !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 100% !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 42px !important;
  border: 0 !important;
  border-radius: inherit !important;
  outline: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--top-ink) !important;
  font: inherit !important;
  text-align: center !important;
  -webkit-appearance: none;
  appearance: none;
}

:scope[data-visual-mode="enhanced"][data-colorway] .topbar .project-search > input#projectSearch::placeholder {
  color: var(--top-muted) !important;
  opacity: 1 !important;
  text-align: center !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .topbar .project-search-icon {
  position: absolute;
  z-index: 2;
  right: 14px;
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
  color: var(--top-muted);
  pointer-events: none;
}

:scope[data-visual-mode="enhanced"][data-colorway] .topbar .project-search-icon svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2;
}

@media (max-width: 760px) {
  :scope[data-visual-mode="enhanced"][data-colorway] .app.general-coach-active > .topbar {
    grid-template-columns: minmax(0, 1fr) auto !important;
    grid-template-areas: "brand search" "nav nav" !important;
    grid-template-rows: 52px 40px !important;
    height: 108px !important;
    min-height: 108px !important;
    max-height: 108px !important;
    padding: 8px 12px !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] .app.general-coach-active .general-coach-shell {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: auto auto auto !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] .app.general-coach-active .general-coach-log,
  :scope[data-visual-mode="enhanced"][data-colorway] .app.general-coach-active .general-coach-actions,
  :scope[data-visual-mode="enhanced"][data-colorway] .app.general-coach-active .general-coach-compose {
    grid-column: 1 !important;
    grid-row: auto !important;
  }
}

/* A rounded, confident type layer makes ThrowCentral feel as approachable as
   a social feed while keeping the dense analysis UI easy to scan. */
/* Preserve the original cascade exactly in Classic. Pro uses its own type
   tokens; it must not compete with this historical important-declaration layer. */
@scope (:root) {
:scope[data-visual-mode="enhanced"][data-colorway],
:scope[data-visual-mode="enhanced"][data-colorway] body,
:scope[data-visual-mode="enhanced"][data-colorway] button,
:scope[data-visual-mode="enhanced"][data-colorway] input,
:scope[data-visual-mode="enhanced"][data-colorway] select,
:scope[data-visual-mode="enhanced"][data-colorway] textarea,
:scope[data-visual-mode="enhanced"][data-colorway] summary {
  font-family: ui-rounded, "SF Pro Rounded", "Avenir Next Rounded", "Avenir Next", system-ui, sans-serif !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body {
  font-size: 15px !important;
  letter-spacing: 0.01em !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] :is(
  button,
  input,
  select,
  textarea,
  summary,
  label,
  p,
  a,
  li,
  td,
  th,
  output,
  .brand-copy span,
  .empty-state,
  .search-suggestions,
  .project-library
) {
  font-weight: 700 !important;
}

/* Important declarations in this layer take precedence over the legacy
   unlayered component rules, keeping every piece of app copy consistently
   friendly and emphatic. */
@layer friendly-type {
  :scope[data-visual-mode="enhanced"][data-colorway] body,
  :scope[data-visual-mode="enhanced"][data-colorway] body * {
    font-family: ui-rounded, "SF Pro Rounded", "Avenir Next Rounded", "Avenir Next", system-ui, sans-serif !important;
    font-weight: 700 !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] .topbar .primary-nav-button {
    font-size: 11px !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] .topbar #projectSearch {
    font-size: 13px !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] .workspace-layout :is(button, input, select, textarea, summary, label, output) {
    font-size: 13px !important;
  }
}

}

/* Library is a focused home for saved projects and athletes, not another
   analysis workspace. Two balanced result columns make that purpose clear. */
:scope[data-visual-mode="enhanced"][data-colorway] .app.search-active:not(.compare-active):not(.general-coach-active):not(.coach-memory-active) > .workspace-layout,
:scope[data-visual-mode="enhanced"][data-colorway] .app.search-active > .search-page > :is(.compare-view, .general-coach-view, .coach-memory-view) {
  display: none !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .app.search-active .search-results-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  align-items: start !important;
}

/* Dark colorways always carry light text on their dark application surfaces. */
:scope:is(
  [data-colorway="carbon-slate"],
  [data-colorway="midnight-indigo"],
  [data-colorway="deep-emerald"],
  [data-colorway="crimson-dark"],
  [data-colorway="amber-gold"]
) .app :is(
  .topbar,
  .search-page,
  .workspace-layout,
  .video-panel,
  .analysis-column,
  .tool-panel,
  .library-section,
  .project-library,
  .library-item,
  .settings-page,
  .app-dialog form,
  .sync-viewer-shell,
  .control-strip,
  .file-picker,
  .video-stage,
  .distance-panel,
  .notes-panel,
  details
) :is(h1, h2, h3, h4, h5, h6, strong, span, p, small, label, legend, a, button, input, select, textarea, summary, output, td, th) {
  color: #ffffff !important;
}

/* The primary header now intentionally contains only the two durable places
   people return to most: the workspace and the project library. */
:scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) > .topbar > .primary-nav {
  grid-template-columns: repeat(2, minmax(96px, 1fr)) !important;
  width: 224px !important;
  justify-self: center !important;
}

/* Project previews are media, not a decorative background. Keeping them as
   images makes saved thumbnails resilient to all visual themes. */
:scope[data-visual-mode="enhanced"][data-colorway] .project-thumbnail :is(.project-thumbnail-media, .project-thumbnail-pane) {
  position: absolute !important;
  z-index: 0 !important;
  display: block !important;
  max-width: none !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: none !important;
  object-fit: cover !important;
  object-position: center !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .project-thumbnail > .project-thumbnail-media {
  inset: 0 !important;
  width: 100% !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .project-thumbnail > .project-thumbnail-pane {
  inset: 0 auto 0 0 !important;
  width: 50% !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] .project-thumbnail > .project-thumbnail-pane[data-slot="2"] {
  right: 0 !important;
  left: auto !important;
  border-left: 1px solid rgba(255, 255, 255, 0.38) !important;
}

/* The old dashboard shell used a light border around the entire app. It reads
   as white gutters on a dark workspace, especially in Chrome fullscreen. */
:scope[data-visual-mode="enhanced"][data-colorway] body > .app {
  border: 0 !important;
  border-radius: 0 !important;
}

/* Library uses the search route internally. Its legacy page shell was still
   light, rounded, and inset, which exposed a white gutter at either side of
   the otherwise dark library. Keep that route on the same full-bleed canvas
   as the analysis workspace. */
:scope[data-visual-mode="enhanced"][data-colorway] body > .app.search-active {
  background: #08110f !important;
}

:scope[data-visual-mode="enhanced"][data-colorway] body > .app.search-active > .search-page {
  min-height: calc(100dvh - 1px) !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  padding: 18px 24px 32px !important;
  background: #08110f !important;
  box-shadow: none !important;
}

/* Saved throws are video frames, not banner ads. A capped 16:9 preview keeps
   the useful vertical part of each throw in view and stops wide library cards
   from turning every thumbnail into a thin strip. */
:scope[data-visual-mode="enhanced"][data-colorway] .app.search-active :is(
  .library-item > .project-thumbnail,
  .athlete-video-list > .project-thumbnail,
  .profile-project-thumbnail
) {
  inline-size: min(100%, 720px) !important;
  min-height: 0 !important;
  aspect-ratio: 16 / 9 !important;
  justify-self: start !important;
  align-self: start !important;
}

/* On wide screens the two durable destinations should use the navigation lane
   instead of clustering in its center. This makes the logo, destinations,
   search, settings, and profile read as a calm, evenly distributed sequence. */
@media (min-width: 981px) {
  :scope[data-visual-mode="enhanced"][data-colorway] body > .app:not(.search-active):not(.settings-active) > .topbar > .primary-nav,
  :scope[data-visual-mode="enhanced"][data-colorway] body > .app.search-active > .topbar > .primary-nav {
    display: flex !important;
    grid-template-columns: none !important;
    width: min(90%, 400px) !important;
    justify-self: center !important;
    justify-content: space-between !important;
    gap: 0 !important;
  }

  :scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar > .primary-nav > .primary-nav-button {
    flex: 0 0 auto !important;
    width: auto !important;
  }
}

/* Final header enforcement: old workspace variants use higher-specificity
   selectors, so keep the reference header identical when those states are
   active as well. */
@media (min-width: 981px) {

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar,
:scope[data-visual-mode="enhanced"][data-colorway] body > .app.search-active > .topbar,
:scope[data-visual-mode="enhanced"][data-colorway] body > .app.settings-active > .topbar {
    display: grid !important;
    grid-template-columns: 250px 400px minmax(0, 1fr) !important;
    grid-template-rows: 96px !important;
    grid-template-areas: "brand nav search" !important;
    align-items: center !important;
    gap: clamp(22px, 2.4vw, 46px) !important;
    height: 96px !important;
    min-height: 96px !important;
    max-height: 96px !important;
    margin: 0 !important;
    padding: 14px 18px !important;
    border: 0 !important;
    border-bottom: 1px solid rgba(211, 241, 223, 0.08) !important;
    border-radius: 0 !important;
    background: linear-gradient(105deg, #06100c 0%, #0a1712 100%) !important;
    box-shadow: none !important;
  }

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar > .primary-nav,
:scope[data-visual-mode="enhanced"][data-colorway] body > .app.search-active > .topbar > .primary-nav,
:scope[data-visual-mode="enhanced"][data-colorway] body > .app.settings-active > .topbar > .primary-nav {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 18px !important;
    width: auto !important;
    height: 64px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
  }

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar > .search-row,
:scope[data-visual-mode="enhanced"][data-colorway] body > .app.search-active > .topbar > .search-row,
:scope[data-visual-mode="enhanced"][data-colorway] body > .app.settings-active > .topbar > .search-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 64px 60px !important;
    align-items: center !important;
    gap: 16px !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 64px !important;
    margin: 0 !important;
  }

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar .brand-mark {
    width: 60px !important;
    min-width: 60px !important;
    height: 60px !important;
    min-height: 60px !important;
    border: 1px solid rgba(123, 255, 166, 0.2) !important;
    border-radius: 13px !important;
    background: linear-gradient(145deg, #20cc68, #13a94e) !important;
    color: #04130a !important;
    font-size: 17px !important;
    box-shadow: 0 10px 26px rgba(22, 195, 87, 0.18) !important;
  }

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar .brand-copy strong {
    color: #f5fff8 !important;
    font-size: 24px !important;
    font-weight: 760 !important;
    letter-spacing: -0.045em !important;
  }

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar .primary-nav-button,
:scope[data-visual-mode="enhanced"][data-colorway] body > .app.search-active > .topbar .primary-nav-button,
:scope[data-visual-mode="enhanced"][data-colorway] body > .app.settings-active > .topbar .primary-nav-button {
    width: 112px !important;
    min-width: 102px !important;
    min-height: 62px !important;
    padding: 0 20px !important;
    border: 0 !important;
    border-radius: 10px !important;
    background: transparent !important;
    color: rgba(239, 249, 243, 0.65) !important;
    font-size: 17px !important;
    font-weight: 720 !important;
  }

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar .primary-nav-button.active,
:scope[data-visual-mode="enhanced"][data-colorway] body > .app.search-active > .topbar .primary-nav-button.active,
:scope[data-visual-mode="enhanced"][data-colorway] body > .app.settings-active > .topbar .primary-nav-button.active {
    background: linear-gradient(180deg, rgba(36, 183, 83, 0.16), rgba(36, 183, 83, 0.07)) !important;
    color: #f5fff8 !important;
  }

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar .primary-nav-button.active::after,
:scope[data-visual-mode="enhanced"][data-colorway] body > .app.search-active > .topbar .primary-nav-button.active::after,
:scope[data-visual-mode="enhanced"][data-colorway] body > .app.settings-active > .topbar .primary-nav-button.active::after {
    right: 35% !important;
    bottom: 3px !important;
    left: 35% !important;
    height: 3px !important;
    border-radius: 99px !important;
    background: #2cdb73 !important;
  }

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar .project-search,
:scope[data-visual-mode="enhanced"][data-colorway] body > .app.search-active > .topbar .project-search,
:scope[data-visual-mode="enhanced"][data-colorway] body > .app.settings-active > .topbar .project-search {
    height: 64px !important;
    border: 1px solid rgba(220, 247, 229, 0.2) !important;
    border-radius: 12px !important;
    background: rgba(24, 42, 34, 0.62) !important;
  }

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar .project-search > input#projectSearch,
:scope[data-visual-mode="enhanced"][data-colorway] body > .app.search-active > .topbar .project-search > input#projectSearch,
:scope[data-visual-mode="enhanced"][data-colorway] body > .app.settings-active > .topbar .project-search > input#projectSearch {
    height: 62px !important;
    padding: 0 18px 0 62px !important;
    color: #f5fff8 !important;
    font-size: 17px !important;
    text-align: left !important;
  }

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar .project-search > input#projectSearch::placeholder,
:scope[data-visual-mode="enhanced"][data-colorway] body > .app.search-active > .topbar .project-search > input#projectSearch::placeholder,
:scope[data-visual-mode="enhanced"][data-colorway] body > .app.settings-active > .topbar .project-search > input#projectSearch::placeholder {
    color: rgba(231, 244, 236, 0.5) !important;
    text-align: left !important;
  }

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar .project-search-icon,
:scope[data-visual-mode="enhanced"][data-colorway] body > .app.search-active > .topbar .project-search-icon,
:scope[data-visual-mode="enhanced"][data-colorway] body > .app.settings-active > .topbar .project-search-icon {
    right: auto !important;
    left: 19px !important;
    width: 25px !important;
    height: 25px !important;
    color: rgba(239, 250, 244, 0.75) !important;
  }

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar .settings-button {
    width: 64px !important;
    min-width: 64px !important;
    height: 64px !important;
    min-height: 64px !important;
    padding: 0 !important;
    border: 1px solid rgba(220, 247, 229, 0.18) !important;
    border-radius: 50% !important;
    background: rgba(7, 18, 13, 0.38) !important;
    color: #f2fff6 !important;
  }

:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .topbar .user-avatar {
    width: 60px !important;
    min-width: 60px !important;
    height: 60px !important;
    min-height: 60px !important;
    border-radius: 50% !important;
    background: linear-gradient(145deg, #25d76e, #12ac50) !important;
    color: #04130a !important;
    font-size: 17px !important;
    font-weight: 850 !important;
  }
}

/* The project bar is a continuous part of the dark workspace, never a light
   spacer between the header and the footage. */
:scope[data-visual-mode="enhanced"][data-colorway] body > .app > .workspace-command-bar {
  background: #0a1510 !important;
  border-bottom-color: rgba(211, 241, 223, 0.08) !important;
}

/* The project controls used to live inside a light card.  They now sit below
   the dark header, so neutralize that legacy surface on both wrapper layers. */
:scope[data-visual-mode="enhanced"] body > .app > .workspace-command-bar,
:scope[data-visual-mode="enhanced"] body > .app > .workspace-command-bar > .actions.compact-actions {
  background-color: #0a1510 !important;
  background-image: none !important;
  box-shadow: none !important;
}

:scope[data-visual-mode="enhanced"] body > .app > .workspace-command-bar > .actions.compact-actions {
  border: 0 !important;
}

}
