.route-loading #main-content > *:not(header),
.route-loading #main-content header > *:first-child { visibility: hidden; }

.studio-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  padding: 12px 2px;
  scrollbar-width: thin;
}
.studio-nav a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding: 0 12px;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
}
.studio-nav a.active { background: #1c2917; color: var(--lime); }
.studio-nav a[data-unavailable="true"] { border: 1px dashed #303831; color: #a3ada6; }
.studio-nav a small { font-size: 9px; color: #d8b77a; text-transform: uppercase; letter-spacing: .08em; }
.nav-divider { flex: 0 0 auto; color: #79847d; font-size: 9px; letter-spacing: .12em; text-transform: uppercase; padding-left: 8px; }
.control-help { display: block; margin-top: 7px; color: var(--muted); font-size: 11px; line-height: 1.4; text-transform: none; letter-spacing: 0; }

.tool-view:has(.history-workspace),
.tool-view:has(.settings-workspace),
.history-workspace,
.settings-workspace { width: 100%; min-width: 0; }
.settings-panel { min-width: 0; overflow-wrap: anywhere; }
.tool-content.settings-workspace { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.settings-workspace .settings-panel { padding: 24px; }
.settings-workspace .settings-form { grid-template-columns: repeat(2, minmax(0, 1fr)); min-width: 0; align-items: end; }
.settings-workspace .settings-form label > span { font-size: 11px; letter-spacing: .07em; color: #b3c1b5; overflow-wrap: normal; }
.settings-workspace .settings-form :is(input,select) { min-width: 0; }
.settings-workspace .settings-form button { justify-self: start; }
.settings-form > * { min-width: 0; }
.pronunciation-form { grid-template-columns: minmax(0,1.2fr) minmax(0,1.2fr) minmax(0,1fr) minmax(0,1fr) auto; }
.developer-key-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.developer-scopes label { min-height: 44px; display: flex; align-items: center; gap: 8px; }
.privacy-panel .button { min-height: 44px; display: inline-flex; align-items: center; }
.gated-settings { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.usage-summary { grid-column: 1 / -1; color: var(--muted); line-height: 1.55; margin: 0 0 6px; }
.speech-draft { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin: -8px 0 20px; font-size: 11px; color: #b3c1b5; }
.speech-draft button { min-height: 44px; border: 1px solid var(--line); border-radius: 9px; padding: 8px 12px; background: transparent; color: #c0cdc2; cursor: pointer; }
#retry-languages:not([hidden]) { margin-top: 16px; }
.account-status { padding: 12px 16px; border: 1px solid #8a5353; border-radius: 10px; color: #ffc2b7; }
.hero { padding: 14px 0; align-items: center; }
.hero h1 { font-size: 38px; line-height: 1.15; margin: 8px 0 0; }
.hero .eyebrow { margin: 0; }
.hero .lede { font-size: 14px; max-width: 360px; }
.workspace > .card { min-width: 0; }
.composer { padding: 22px; }
.composer .card-title { flex-wrap: wrap; gap: 10px; }
.composer .count { flex-wrap: wrap; gap: 8px; }
.clone-panel label, .clone-panel input { min-width: 0; max-width: 100%; }
.composer textarea { height: 120px; font-size: 21px; }
.composer .count { padding-bottom: 6px; }
.composer .speech-draft { margin: 0 0 8px; }
.composer .controls { gap: 14px; margin-top: 12px; padding-top: 12px; }
.composer .speech-basics { grid-template-columns: repeat(3,minmax(0,1fr)); }
.speech-direction { margin-top: 12px; border: 1px solid #3c4d3d; border-radius: 10px; padding: 0 12px; }
.speech-direction summary { min-height: 44px; padding: 12px 0; color: #c5d2c5; cursor: pointer; font-size: 12px; }
.speech-direction .controls { margin-bottom: 16px; }
.generate-row { position: static; gap: 12px; padding: 8px 0; margin-top: 10px; background: #0c100d; }
.generate-row button { flex-shrink: 0; padding: 16px 20px; }
.library { min-height: 0; }
.clone-mode .composer > :not(.clone-panel):not(.card-title) { display: none; }
.clone-mode .library { display: none; }
.clone-mode .workspace { grid-template-columns: minmax(0,720px); }
.clone-mode .clone-panel { display: grid; margin-top: 0; }
/* Keep permission and privacy links visible when keyboard focus scrolls the form. */
.clone-mode #save-voice { position: static; background: #14200f; }
.voice-empty { padding: 24px; border: 1px solid #3c4d3d; border-radius: 14px; }
.voice-empty p { color: #c0cdc2; line-height: 1.6; }
.voice-empty a { display: inline-flex; align-items: center; margin: 8px 10px 0 0; text-decoration: none; height: auto; min-height: 48px; }
.history-filters { grid-template-columns: repeat(3,minmax(0,1fr)); align-items: end; }
.history-filters label { min-width: 0; }
.history-filters input,.history-filters select { min-width: 0; width: 100%; }
.history-count { text-align: left; color: #bfcebe; }
.history-player { border: 1px solid #667f3f; border-radius: 14px; padding: 20px; margin-bottom: 18px; }
.history-player[hidden] { display: none; }
.history-player h2 { font-size: 20px; overflow-wrap: anywhere; }
.history-player audio,.scene-actions audio { width: 100%; }
.history-feedback { font-size: 12px; line-height: 1.6; color: #d3c9b7; }
.history-feedback:empty { display: none; }
.tool-content .usage-breakdown { grid-column: 1/-1; overflow-x: auto; }
.usage-breakdown table { width: 100%; border-collapse: collapse; }
.usage-breakdown th,.usage-breakdown td { padding: 12px; border-bottom: 1px solid #3c4d3d; text-align: left; }
.studio-update { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; border: 1px solid #627d35; background: #142010; border-radius: 12px; padding: 14px; margin: 10px 0; }
.studio-update[hidden] { display: none; }
.studio-update p { flex: 1 1 300px; margin: 0; color: #d4e0cb; font-size: 13px; line-height: 1.6; }
.settings-workspace .check-field input { width: auto; height: auto; flex-shrink: 0; }
.tool-view:has(.history-workspace),.tool-view:has(.settings-workspace),.tool-view:has(.project-workspace) { padding-top: 28px; }
.workflow-editor > .workflow-actions:last-child { position: static; background: #0c1710; padding: 10px 0; }
@media(max-width:900px) {
  .hero { padding: 18px 0; }.hero h1 { font-size: 30px; }.hero .lede { margin-top: 10px; max-width: none; }
  .composer .speech-basics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .history-filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media(max-width:600px) {
  .composer .speech-basics,.history-filters { grid-template-columns: minmax(0,1fr); }
  .generate-row { position: sticky; z-index: 2; flex-wrap: wrap; bottom: 0; }.generate-row button { width: 100%; }
  .voice-empty a { width: 100%; }.studio-update button { flex: 1 1 auto; }
}

.studio-footer { margin-left: 112px; padding: 20px 42px 34px; display: flex; gap: 22px; border-top: 1px solid var(--line); }
.studio-footer a { color: var(--muted); min-height: 44px; display: inline-flex; align-items: center; }

@media (max-width: 900px) {
  main > header > div:first-child { min-width: 0; }
  main > header .account { flex: 0 0 auto; gap: 0; margin-left: 10px; }
  .account #signout:not([hidden]) { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 12px; border: 1px solid #3c4d3d; border-radius: 10px; font-size: 12px; }
  main > header #crumb-detail { overflow-wrap: anywhere; }
  main > header :is(.crumb,.slash) { margin-right: 8px; }
  .studio-footer { margin-left: 0; padding: 18px; flex-wrap: wrap; }
  .studio-nav { margin-inline: -18px; padding-inline: 18px; }
  .nav-divider { display: none; }
  .settings-form,
  .pronunciation-form,
  .developer-key-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .settings-workspace .settings-form { grid-template-columns: minmax(0, 1fr); }
  .settings-workspace .settings-panel { padding: 18px; }
  .settings-form,
  .pronunciation-form,
  .developer-key-form,
  .gated-settings { grid-template-columns: minmax(0, 1fr); }
  .history-actions > *, .generate-row button { min-height: 44px; }
}

/* One canonical set of route links: disclosure on mobile, original strip on
   desktop. Without enhancement the original scrolling navigation stays usable. */
.studio-tools { min-width: 0; }
.studio-tools-toggle { display: none; }
.studio-tools-toggle[hidden] { display: none; }

@media (max-width: 900px) {
  .studio-tools[data-enhanced="true"] { margin: 12px 0 4px; }
  .studio-tools[data-enhanced="true"] .studio-tools-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 60px;
    padding: 10px 14px;
    border: 1px solid #3c4d3d;
    border-radius: 12px;
    background: #101910;
    color: var(--text);
    text-align: left;
    font: inherit;
    cursor: pointer;
  }
  .studio-tools-heading { display: grid; gap: 4px; flex: 1; min-width: 0; }
  .studio-tools-heading small { color: #aebbac; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
  .studio-tools-heading strong { font-size: 15px; overflow-wrap: anywhere; }
  #studio-tools-action { color: var(--lime); font-size: 12px; white-space: nowrap; }
  .studio-tools-chevron { color: var(--lime); font-size: 20px; }
  .studio-tools-toggle[aria-expanded="true"] .studio-tools-chevron { transform: rotate(180deg); }
  .studio-tools[data-enhanced="true"] .studio-nav { display: none; }
  .studio-tools[data-enhanced="true"].is-open .studio-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 8px;
    width: 100%;
    max-height: min(60vh, 480px);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    margin: 8px 0 0;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #0c140d;
  }
  .studio-tools[data-enhanced="true"] .studio-nav a {
    min-width: 0;
    min-height: 48px;
    flex-wrap: wrap;
    align-content: center;
    gap: 4px 6px;
    padding: 10px 12px;
    white-space: normal;
    overflow-wrap: anywhere;
    color: #b9c5b9;
    font-size: 12px;
  }
  .studio-tools[data-enhanced="true"] .studio-nav a[aria-current="page"] { border-color: #647d39; color: var(--lime); background: #1c2917; }
}

/* Customer Studio scrollbars: visible affordances, without the OS-white track.
   Standard properties cover Firefox; WebKit rules provide rounded Chromium
   thumbs. No scrolling, focus, touch, or reduced-motion behavior is replaced. */
html:root,
html:root * {
  scrollbar-width: thin;
  scrollbar-color: #657953 #101910;
}

@supports selector(::-webkit-scrollbar) {
  /* Non-auto standard properties override Chromium's pseudo-element styling. */
  html:root,
  html:root * {
    scrollbar-width: auto;
    scrollbar-color: auto;
  }
  html:root::-webkit-scrollbar,
  html:root *::-webkit-scrollbar {
    display: block;
    width: 10px;
    height: 8px;
  }
  html:root::-webkit-scrollbar-track,
  html:root *::-webkit-scrollbar-track {
    background: #101910;
    border-radius: 999px;
  }
  html:root::-webkit-scrollbar-thumb,
  html:root *::-webkit-scrollbar-thumb {
    background: #657953;
    border: 2px solid #101910;
    border-radius: 999px;
  }
  html:root::-webkit-scrollbar-thumb:hover,
  html:root *::-webkit-scrollbar-thumb:hover {
    background: #8baa70;
  }
  html:root::-webkit-scrollbar-thumb:active,
  html:root *::-webkit-scrollbar-thumb:active {
    background: var(--lime);
  }
  html:root::-webkit-scrollbar-button,
  html:root *::-webkit-scrollbar-button {
    display: none;
    width: 0;
    height: 0;
  }
  html:root::-webkit-scrollbar-corner,
  html:root *::-webkit-scrollbar-corner {
    background: #101910;
  }
}

/* Let the browser retain native system-colored controls in high contrast. */
.settings-section-nav { display:flex; flex-wrap:wrap; gap:8px; grid-column:1/-1; }
.settings-section-nav a { display:inline-flex; align-items:center; min-height:44px; padding:8px 12px; border:1px solid #405448; border-radius:10px; color:#d7e6ce; font-size:12px; }
.settings-group { min-width:0; grid-column:1/-1; border:1px solid #405448; border-radius:14px; background:#0c1710; scroll-margin-top:20px; }
.settings-group > summary { padding:18px; color:#eaf2e6; cursor:pointer; font-weight:650; }
.settings-group > .settings-panel { border:0; margin:0; border-radius:0 0 14px 14px; }
.settings-draft-status { grid-column:1/-1; color:#cfddc7; font-size:13px; }
.settings-draft-status:empty { display:none; }
.settings-group .settings-list .empty { min-height:0; padding:12px 0; }
.settings-section-nav a:focus-visible,.settings-group > summary:focus-visible { outline:2px solid var(--lime); outline-offset:3px; }
.settings-workspace .settings-form { align-items:start; }
.language-field-group { min-width:0; display:grid; gap:10px; align-self:start; }
.language-field-group > label { display:grid; gap:6px; margin:0!important; }
.language-field-group > label > span { margin-bottom:0; }
.language-search-label { margin:0!important; }
.language-search-label > span { font-size:11px; color:#c5d5bf; }
.language-search-label input { width:100%; box-sizing:border-box; min-height:44px; padding:10px; color:#edf7eb; background:#122017; border:1px solid #4d6151; border-radius:9px; font:inherit; }
.language-search-label input:focus-visible { outline:2px solid var(--lime); outline-offset:3px; }
.language-search-status { display:block; color:#c3d0be; font-size:11px; line-height:1.5; }
.workflow-draft-recovery { padding:12px; border:1px solid #647d39; border-radius:10px; }
.workflow-panel .workflow-draft-status { font-size:12px; color:#cfddc7; }
@media(max-width:900px) {
  .voice-workflow-workspace .workflow-turn-list,.voice-workflow-workspace .workflow-cues { max-height:none; overflow:visible; }
  .workflow-editor { padding-bottom:20px; }
  .workflow-turn,.workflow-cue,.language-field-group { scroll-margin-block:90px 160px; }
  .workflow-editor>.workflow-actions:last-child { position:static; }
  .settings-section-nav { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
  .settings-section-nav a { overflow-wrap:anywhere; }
}
@media (forced-colors: active) {
  html:root,
  html:root * {
    scrollbar-width: auto;
    scrollbar-color: auto;
  }
  html:root::-webkit-scrollbar,
  html:root *::-webkit-scrollbar,
  html:root::-webkit-scrollbar-track,
  html:root *::-webkit-scrollbar-track,
  html:root::-webkit-scrollbar-thumb,
  html:root *::-webkit-scrollbar-thumb,
  html:root::-webkit-scrollbar-button,
  html:root *::-webkit-scrollbar-button,
  html:root::-webkit-scrollbar-corner,
  html:root *::-webkit-scrollbar-corner {
    all: revert;
  }
}
