/* Academic Precision, adapted from the user-supplied Stitch Home light/dark exports.
   Loaded after ui-refresh.css. Application state, metrics and input engines are unchanged. */
:root {
  --ui-canvas:#faf8ff; --ui-soft:#f3f3fe; --ui-ink:#191b23; --ui-muted:#434655;
  --ui-divider:#e2e8f0; --ui-next:#f3f3fe; --ui-control:#737686; --ui-sidebar:224px;
  --bg:#faf8ff; --surface:#ffffff; --surface-2:#f3f3fe; --surface-hover:#ededf9;
  --text:#191b23; --text-2:#434655; --text-3:#434655; --separator:#e2e8f0; --separator-strong:#737686;
  --accent:#2563eb; --accent-hover:#004ac6; --on-accent:#ffffff; --accent-soft:#eff6ff; --focus:#004ac6;
  --stitch-link:#004ac6; --stitch-badge:#eff6ff; --stitch-badge-ink:#1d4ed8; --stitch-chip:#ededf9;
  --stitch-card-border:transparent; --stitch-shadow:0 1px 3px rgba(15,23,42,.04),0 1px 2px rgba(15,23,42,.02);
  --stitch-note:#64748b; --stitch-card:#ffffff; --stitch-inner:#f3f3fe;
  --stitch-nav-bg:rgba(250,248,255,.97); --stitch-writing:#943700;
  --danger:#ba1a1a; --danger-soft:#ffdad6; --success:#157547; --success-soft:#edf8f2;
  --font-ui:Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
}
:root[data-theme="dark"] {
  color-scheme:dark;
  --ui-canvas:#0f131d; --ui-soft:#171b26; --ui-ink:#dfe2f1; --ui-muted:#bdc8d1;
  --ui-divider:#343b48; --ui-next:#171b26; --ui-control:#87929a;
  --bg:#0f131d; --surface:#1c1f2a; --surface-2:#171b26; --surface-hover:#262a35;
  --text:#dfe2f1; --text-2:#bdc8d1; --text-3:#bdc8d1; --separator:#343b48; --separator-strong:#87929a;
  --accent:#8ed5ff; --accent-hover:#b3e5ff; --on-accent:#00354a; --accent-soft:#122c43; --focus:#8ed5ff;
  --stitch-link:#8ed5ff; --stitch-badge:#122c43; --stitch-badge-ink:#8ed5ff; --stitch-chip:#202632;
  --stitch-card-border:rgba(148,163,184,.16); --stitch-shadow:0 1px 3px rgba(0,0,0,.15);
  --stitch-note:#a9b5c8; --stitch-card:#1c1f2a; --stitch-inner:#171b26;
  --stitch-nav-bg:rgba(15,19,29,.97); --stitch-writing:#afcfff;
  --danger:#ffb4ab; --danger-soft:#3b1c23; --success:#6bd69d; --success-soft:#172b21;
}
@media(prefers-color-scheme:dark) {
  :root[data-theme="system"] {
    color-scheme:dark;
    --ui-canvas:#0f131d; --ui-soft:#171b26; --ui-ink:#dfe2f1; --ui-muted:#bdc8d1;
    --ui-divider:#343b48; --ui-next:#171b26; --ui-control:#87929a;
    --bg:#0f131d; --surface:#1c1f2a; --surface-2:#171b26; --surface-hover:#262a35;
    --text:#dfe2f1; --text-2:#bdc8d1; --text-3:#bdc8d1; --separator:#343b48; --separator-strong:#87929a;
    --accent:#8ed5ff; --accent-hover:#b3e5ff; --on-accent:#00354a; --accent-soft:#122c43; --focus:#8ed5ff;
    --stitch-link:#8ed5ff; --stitch-badge:#122c43; --stitch-badge-ink:#8ed5ff; --stitch-chip:#202632;
    --stitch-card-border:rgba(148,163,184,.16); --stitch-shadow:0 1px 3px rgba(0,0,0,.15);
    --stitch-note:#a9b5c8; --stitch-card:#1c1f2a; --stitch-inner:#171b26;
    --stitch-nav-bg:rgba(15,19,29,.97); --stitch-writing:#afcfff;
    --danger:#ffb4ab; --danger-soft:#3b1c23; --success:#6bd69d; --success-soft:#172b21;
  }
}
.stitch-ui { --content:1120px; font-size:16px; line-height:1.6; background:var(--ui-canvas); color:var(--ui-ink); }
.stitch-ui h1,.stitch-ui h2,.stitch-ui h3,.stitch-ui h4 {letter-spacing:-.02em;}
.stitch-ui .btn {border-radius:8px;min-height:44px;line-height:1.45;font-weight:600;gap:9px;}
.stitch-ui .btn:not(.btn-danger):not(.danger):not([data-ui-primary]) {border-color:var(--stitch-card-border)!important;}
.stitch-ui .btn[data-ui-primary="true"] {box-shadow:0 1px 2px rgba(0,0,0,.05)!important;}
.stitch-ui .btn:focus-visible {outline:3px solid var(--focus);outline-offset:3px;}
.stitch-ui :is(.quiet-link,.home-footer a) {color:var(--stitch-link);text-decoration:none;}
.stitch-ui .quiet-link:hover,.stitch-ui .home-footer a:hover {text-decoration:underline;text-underline-offset:3px;}
.stitch-ui :is(.panel,.account-card,.account-panel,.learn-hero,.learn-lesson-card,.learn-summary) {border-radius:12px;}
.stitch-ui :is(.panel,.learn-hero,.learn-lesson-card,.account-card,.account-panel) {background:var(--stitch-card);box-shadow:var(--stitch-shadow);border:1px solid var(--stitch-card-border);}
.stitch-ui .section .panel,.stitch-ui .analysis-two .panel {border:0;box-shadow:none;background:transparent;}
.stitch-ui .learn-summary,.stitch-ui .metric-grid,.stitch-ui .fc-trend-figure {background:var(--stitch-inner);}
.stitch-ui .choice-card,.stitch-ui .writing-profile-explainer {border-radius:8px;}
.stitch-ui .page-stack {gap:28px;}
.stitch-ui :is(.page-intro,.flow-hero,.ch-intro,.learn-hero) :is(h1,h2) {font-size:2rem;line-height:1.25;}
.stitch-ui .section-header h3 {font-size:1.25rem;}
.stitch-ui :is(.metric-value,.home-stat-grid dd,.flow-number) {font-variant-numeric:tabular-nums;}
/* Shared header: named controls retained, compact visible values and separate account action. */
.stitch-ui .sidebar {background:var(--stitch-card);border-right:1px solid var(--stitch-card-border);padding:24px 16px;}
.stitch-ui .nav-item {border-radius:8px;min-height:44px;}
.stitch-ui .nav-item.is-active {color:var(--stitch-link);background:var(--stitch-badge);}
.stitch-ui .stitch-header {display:grid;grid-template-columns:minmax(88px,1fr) auto auto;grid-template-areas:"title settings account";align-items:center;gap:12px;padding:20px 32px;}
.stitch-header-title {grid-area:title;min-width:0;}
.stitch-ui .stitch-header-title>h1 {font-size:22px;}
.stitch-ui .stitch-header-title>.eyebrow {font-size:11px;}
.stitch-mobile-brand {display:none;}
.stitch-ui .topbar-actions {grid-area:settings;display:flex;flex-wrap:wrap;gap:8px;min-width:0;}
.stitch-ui .header-selector {flex:0 1 auto;min-width:0;}
.stitch-ui .header-selector-button {background:var(--stitch-chip);border:0;border-radius:9999px;min-height:44px;padding:9px 12px;gap:7px;}
.stitch-ui .header-selector-copy {min-width:0;}
.stitch-ui .header-selector-copy strong {font-size:12px;font-weight:550;}
.stitch-ui .header-selector-copy small {position:absolute;clip:rect(0,0,0,0);clip-path:inset(50%);width:1px;height:1px;overflow:hidden;white-space:nowrap;}
.stitch-ui .header-selector-button>svg:first-child {display:block;width:16px;height:16px;flex-shrink:0;}
.stitch-ui [data-header-selector="targetBand"] .header-selector-button {background:var(--stitch-badge);color:var(--stitch-badge-ink);}
.stitch-ui #header-band-value::before {content:"Band ";}
.stitch-ui .header-selector-menu {z-index:95;background:var(--stitch-card);border-color:var(--ui-divider);border-radius:12px;min-width:170px;max-width:calc(100vw - 32px);}
.stitch-ui .selector-chevron {width:14px;height:14px;}
.stitch-ui .header-option {min-height:44px;}
.stitch-ui .stitch-header>.account-chip {grid-area:account;max-width:170px;min-width:44px;min-height:44px;display:flex;align-items:center;gap:7px;white-space:nowrap;padding:4px 5px 4px 12px;border-radius:9999px;border:0;background:var(--stitch-chip);font-size:12px;margin:0;text-decoration:none;}
.stitch-account-label {min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.stitch-account-avatar {width:32px;height:32px;border-radius:50%;display:grid;place-items:center;flex:0 0 32px;color:var(--on-accent);background:var(--accent);}
.stitch-account-avatar svg {width:18px;height:18px;}
.stitch-ui .stitch-release {background:var(--stitch-badge);color:var(--stitch-badge-ink);font-size:10px;line-height:1.3;padding:4px 7px;border-radius:99px;white-space:nowrap;}
.stitch-ui .stitch-mark {display:inline-flex;align-items:center;flex:0 0 23px;}
.stitch-ui .stitch-mark img {width:23px;height:22px;object-fit:contain;}
.stitch-ui .stitch-brand-link {display:flex;align-items:center;gap:5px;color:var(--text);font-size:15px;font-weight:650;text-decoration:none;}
.stitch-ui .stitch-more-trigger {display:none;}
.stitch-ui .stitch-more-panel {display:grid;gap:5px;}
.stitch-more-panel[hidden] {display:none!important;}
/* Home: source order retained across sizes: first step, metrics, alternatives, activity, routine. */
.stitch-ui .home-dashboard {gap:20px;}
.stitch-ui .dashboard-welcome .eyebrow {display:flex;align-items:center;gap:7px;color:var(--stitch-link);font-size:11px;letter-spacing:.06em;margin:0 0 6px;}
.stitch-ui .dashboard-welcome .eyebrow svg {width:16px;height:16px;flex:none;}
.stitch-ui .dashboard-welcome h2 {font-size:2.25rem;line-height:1.22;font-weight:700;margin:0 0 8px;letter-spacing:-.03em;}
.stitch-ui .dashboard-welcome p:not(.eyebrow) {font-size:14px;line-height:1.65;max-width:66ch;}
.stitch-ui .dashboard-target strong {color:var(--stitch-link);font-weight:600;}
.stitch-ui .home-dashboard-grid {grid-template-columns:minmax(0,1.65fr) minmax(280px,1fr);gap:24px;grid-template-areas:"next progress" "options activity" "tools activity" "guide guide";}
.stitch-ui .home-next,.stitch-ui .home-progress {padding:24px;border-radius:12px;background:var(--stitch-card);border:1px solid var(--stitch-card-border);box-shadow:var(--stitch-shadow);}
.stitch-ui .home-next-label {font-size:11px;text-transform:uppercase;letter-spacing:.04em;color:var(--stitch-link);gap:8px;margin:0 0 12px;}
.stitch-ui .home-next h3 {font-size:22px;margin-bottom:10px;}
.stitch-ui .home-next>p {font-size:14px;line-height:1.6;}
.stitch-ui .home-next-actions {display:grid;gap:8px;margin-top:16px;}
.stitch-ui .home-next-actions .btn {display:flex;justify-content:flex-start;width:100%;padding:12px 16px;}
.stitch-ui .home-next-actions .btn>span {flex:1;text-align:left;}
.stitch-ui .home-next-actions .quiet-link {justify-self:center;font-size:12px;}
.stitch-ui .stitch-icon-tile {display:grid;place-items:center;background:var(--stitch-chip);color:var(--stitch-link);width:32px;height:32px;border-radius:8px;flex:0 0 32px;}
.stitch-ui .stitch-icon-tile svg {width:18px;height:18px;}
.stitch-ui .stitch-writing-icon {color:var(--stitch-writing);}
.stitch-ui :is(.home-progress,.home-options,.home-activity) .section-header {margin:0 0 16px;gap:8px;flex-wrap:wrap;}
.stitch-ui :is(.home-progress,.home-options,.home-activity,.home-toolbox) h3 {font-size:18px;line-height:1.4;}
.stitch-ui #home-progress-title {display:flex;align-items:center;gap:8px;}
.stitch-ui #home-progress-title svg {color:var(--stitch-link);width:18px;flex:none;}
.stitch-ui #home-analysis {font-size:12px;min-height:44px;}
.stitch-ui .home-stat-grid {grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;}
.stitch-ui .home-stat-grid>div {display:flex;flex-direction:column;min-width:0;padding:16px;background:var(--stitch-inner);border-radius:8px;}
.stitch-ui .home-stat-grid dt {font-size:11px;line-height:1.5;text-transform:uppercase;letter-spacing:.02em;}
.stitch-ui .home-stat-grid dd {font-size:32px;line-height:36px;font-weight:700;margin:8px 0;letter-spacing:-.025em;}
.stitch-ui .home-stat-grid dd span {font-size:14px;}
.stitch-ui .home-stat-grid small {margin-top:auto;font-size:11px;color:var(--stitch-note);line-height:1.5;}
.stitch-ui .home-stats-note {display:flex;align-items:flex-start;gap:6px;font-size:12px;line-height:1.5;margin:16px 0 0;color:var(--stitch-note);}
.stitch-ui .home-stats-note svg {width:15px;height:18px;flex:none;}
.stitch-ui .home-option-list {gap:12px;}
.stitch-ui .home-option {display:grid;grid-template-columns:1fr;gap:12px;padding:24px;border:1px solid var(--stitch-card-border);border-radius:12px;background:var(--stitch-card);box-shadow:var(--stitch-shadow);}
.stitch-ui .home-option:first-child {padding-top:24px;border-top:1px solid var(--stitch-card-border);}
.stitch-option-header {display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap;}
.stitch-ui .home-option-tier {display:inline-flex;align-items:center;gap:5px;padding:3px 9px;border-radius:99px;font-size:10px;line-height:1.4;font-weight:650;letter-spacing:.03em;text-transform:uppercase;color:var(--stitch-badge-ink);background:var(--stitch-badge);}
.stitch-ui .home-option-tier::before {content:"";width:5px;height:5px;flex:none;border-radius:50%;background:currentColor;}
.stitch-ui .home-option-tier[data-tier="stretch"] {background:var(--stitch-chip);color:var(--text);}
.stitch-ui .stitch-duration {display:inline-flex;align-items:center;gap:4px;font-size:11px;white-space:nowrap;color:var(--text-2);margin-left:auto;text-transform:none;letter-spacing:0;}
.stitch-ui .stitch-duration svg {width:14px;height:14px;}
.stitch-ui .home-option h4 {font-size:16px;line-height:1.5;margin:0 0 6px;font-weight:650;}
.stitch-ui .home-option p {font-size:14px;line-height:1.6;}
.stitch-ui .home-option .recommendation-reason {margin-top:10px;}
.stitch-ui .recommendation-reason summary {min-height:32px;padding-block:5px;font-size:12px;}
.stitch-ui .home-option .btn {display:flex;justify-content:flex-start;width:100%;max-width:none;padding:10px 14px;justify-self:stretch;}
.stitch-ui .home-option .btn>span {flex:1;text-align:left;}
.stitch-ui .home-option .btn>svg:first-child {color:var(--stitch-link);}
.stitch-ui .home-option .btn[data-ui-primary]>svg {color:inherit;}
.stitch-ui .home-activity {padding:0;}
.stitch-ui .home-activity-list {padding:8px 20px;background:var(--stitch-card);border:1px solid var(--stitch-card-border);border-radius:12px;box-shadow:var(--stitch-shadow);}
.stitch-ui .home-activity-list li:first-child {padding-top:16px;}
.stitch-ui .home-empty {display:flex;flex-direction:column;align-items:center;text-align:center;gap:8px;background:var(--stitch-card);border:1px solid var(--stitch-card-border);border-radius:12px;box-shadow:var(--stitch-shadow);padding:28px 24px;font-size:14px;}
.stitch-ui .home-empty p {margin:2px 0;max-width:29ch;}
.stitch-ui .home-empty>span:last-child {font-size:13px;color:var(--stitch-note);}
.stitch-empty-icon {display:grid;place-items:center;width:48px;height:48px;border-radius:50%;background:var(--stitch-chip);color:var(--text-2);margin-bottom:4px;}
.stitch-ui .home-toolbox {padding:0;background:transparent;}
.stitch-ui .home-tool-links {margin-top:12px;padding:4px 16px;background:var(--stitch-card);border:1px solid var(--stitch-card-border);border-radius:12px;box-shadow:var(--stitch-shadow);}
.stitch-ui .home-tool-links button {padding:14px 4px;gap:12px;min-height:76px;}
.stitch-ui .home-tool-links button>span.stitch-icon-tile {flex:0 0 32px;}
.stitch-ui .home-tool-links button>svg:last-child {transform:none;width:16px;height:16px;flex:none;}
.stitch-ui .home-tool-links small {font-size:12px;}
.stitch-ui .home-footer {display:flex;flex-direction:column;justify-content:center;align-items:center;gap:8px;margin:4px 0 0;padding:20px 0 4px;text-align:center;}
.stitch-ui .home-footer>span {display:flex;align-items:center;justify-content:center;gap:6px;margin:0;font-size:12px;}
.stitch-ui .home-footer>span svg {color:var(--success);width:16px;height:16px;}
.stitch-ui .home-footer>div {display:flex;justify-content:center;align-items:center;gap:16px;flex-wrap:wrap;font-size:12px;}
/* First-step interaction uses the existing onboarding state and guards, never the demo's timeout. */
.stitch-guide-shell {position:relative;}
.stitch-ui .home-first-guide {padding:20px;}
.stitch-ui .stitch-guide-shell .fc-onboarding>summary {list-style:none;padding:0 42px 0 0;min-height:44px;cursor:pointer;}
.stitch-ui .stitch-guide-shell .fc-onboarding>summary::-webkit-details-marker {display:none;}
.stitch-guide-heading {display:flex;gap:8px;align-items:center;}
.stitch-ui .stitch-guide-heading>span:last-child {display:block;min-width:0;}
.stitch-ui .stitch-guide-heading strong {display:block;color:var(--stitch-link);font-size:11px;line-height:1.4;text-transform:uppercase;letter-spacing:.03em;}
.stitch-ui .stitch-guide-heading small {display:block;font-size:12px;line-height:1.45;margin-top:3px;color:var(--stitch-note);}
.stitch-ui .stitch-guide-close {position:absolute;top:-6px;right:-8px;width:44px;height:44px;border:0;background:transparent;color:var(--text-2);display:grid;place-items:center;cursor:pointer;border-radius:8px;}
.stitch-guide-close[hidden] {display:none!important;}
.stitch-ui .stitch-guide-close:hover {background:var(--surface-hover);}
.stitch-ui .stitch-guide-shell .fc-onboarding-body {padding:12px 0 0;}
.stitch-ui .stitch-guide-step {background:var(--stitch-inner);border-radius:8px;padding:20px;}
.stitch-ui .stitch-guide-step>.eyebrow {font-size:11px;color:var(--stitch-link);margin:0 0 8px;}
.stitch-ui .stitch-guide-step>h3 {font-size:18px;line-height:1.45;margin:0 0 8px;}
.stitch-ui .stitch-guide-step p {font-size:14px;line-height:1.6;}
.stitch-ui .stitch-guide-step .field {gap:6px;}
.stitch-ui .stitch-guide-step .field>label {font-size:13px;}
.stitch-ui .stitch-guide-step select {background:var(--stitch-card);border-radius:8px;min-height:44px;}
.stitch-ui .stitch-guide-step .fc-actions {margin-top:16px;}
.stitch-ui .stitch-guide-step .btn-primary {width:100%;}
.stitch-ui .stitch-guide-shell .fc-onboarding-body>.fc-note {font-size:12px;color:var(--stitch-note);line-height:1.5;margin:14px 0 0;}
.stitch-ui .stitch-guide-shell .fc-onboarding-body>.fc-actions {justify-content:flex-end;margin:4px 0 -8px;}
.stitch-ui .stitch-guide-shell #onboarding-skip {font-size:12px;padding:8px 0;min-height:44px;text-decoration:underline;text-underline-offset:3px;}
/* Source contains mobile only; desktop uses its stated 1120px/12-column overview rule. */
@media(max-width:1100px) {
  .stitch-ui .stitch-header {grid-template-areas:"title account" "settings settings";grid-template-columns:1fr auto;padding:16px 24px;}
  .stitch-ui .topbar-actions {width:auto;}
  .stitch-ui .home-dashboard-grid {grid-template-columns:minmax(0,1.4fr) minmax(250px,1fr);gap:20px;}
  .stitch-ui .home-stat-grid>div {padding:12px;}
}
@media(max-width:940px) {
  .stitch-ui .home-dashboard-grid {grid-template-columns:1fr;grid-template-areas:"next" "progress" "options" "activity" "tools" "guide";gap:20px;}
  .stitch-ui .home-stat-grid {grid-template-columns:repeat(2,minmax(0,1fr));}
}
@media(max-width:760px) {
  .stitch-ui #app,.stitch-ui .module-app-shell #flow-main,.stitch-ui .module-app-shell #challenge-main {padding:12px 16px calc(100px + env(safe-area-inset-bottom));}
  .stitch-ui .stitch-header {grid-template-areas:"title account" "settings settings";grid-template-columns:minmax(0,1fr) auto;gap:10px;padding:10px 16px 0;min-height:112px;position:relative;box-shadow:0 1px 0 var(--stitch-card-border);}
  .stitch-ui .stitch-header-title {min-width:0;}
  .stitch-ui .stitch-header-title>h1,.stitch-ui .stitch-header-title>.eyebrow {position:absolute;clip:rect(0,0,0,0);clip-path:inset(50%);width:1px;height:1px;overflow:hidden;white-space:nowrap;}
  .stitch-ui .stitch-header-title>h1:focus {position:static;clip:auto;clip-path:none;width:auto;height:auto;overflow:visible;white-space:normal;margin-top:6px;}
  .stitch-mobile-brand {display:flex;align-items:center;gap:8px;min-height:44px;flex-wrap:wrap;}
  .stitch-ui .stitch-header>.account-chip {max-width:102px;padding:4px 4px 4px 10px;min-height:44px;}
  .stitch-ui .topbar-actions {gap:6px;flex-wrap:wrap;align-items:center;justify-content:flex-start;}
  .stitch-ui .header-selector-button {font-size:12px;min-height:44px;padding:8px 11px;gap:6px;width:auto;}
  .stitch-ui .header-selector {flex:0 1 auto;}
  .stitch-ui .header-selector-menu {left:0;right:auto;}
  .stitch-ui .header-selector:last-of-type .header-selector-menu {right:0;left:auto;}
  .stitch-ui .sidebar {padding:5px 6px max(5px,env(safe-area-inset-bottom));background:var(--stitch-nav-bg);backdrop-filter:blur(12px);border:0;box-shadow:0 -2px 12px rgba(0,0,0,.04);z-index:65;}
  .stitch-ui .nav-list {display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:0;padding:0;overflow:visible;}
  .stitch-ui .nav-list>.nav-item,.stitch-ui .stitch-more-trigger {display:flex;align-items:center;justify-content:center;flex-direction:column;min-width:0;min-height:58px;padding:6px 1px;gap:3px;line-height:1.4;font-size:11px;text-align:center;border:0;border-radius:0;background:transparent;color:var(--text-2);cursor:pointer;}
  .stitch-ui .nav-list>.nav-item>svg,.stitch-ui .stitch-more-trigger>svg {box-sizing:content-box;width:20px;height:20px;padding:3px 10px;border-radius:99px;}
  .stitch-ui .nav-list>.nav-item.is-active,.stitch-ui .stitch-more-trigger.is-active {background:transparent;color:var(--stitch-link);font-weight:650;}
  .stitch-ui .nav-list>.nav-item.is-active>svg,.stitch-ui .stitch-more-trigger.is-active>svg {background:var(--stitch-badge);}
  .stitch-ui .stitch-more-panel {position:absolute;right:12px;bottom:calc(100% + 8px);width:min(288px,calc(100vw - 24px));max-height:65vh;overflow-y:auto;padding:10px;background:var(--stitch-card);border:1px solid var(--ui-divider);border-radius:12px;box-shadow:var(--shadow-popover);}
  .stitch-ui .stitch-more-panel .nav-item {display:flex;flex-direction:row;justify-content:flex-start;padding:12px;min-height:48px;font-size:14px;gap:12px;text-align:left;}
  .stitch-ui .stitch-more-panel .nav-item>svg {width:18px;height:18px;}
  .stitch-ui .dashboard-welcome h2 {font-size:1.75rem;line-height:1.22;margin-bottom:8px;}
  .stitch-ui .home-dashboard {gap:16px;}
  .stitch-ui .home-dashboard-grid {gap:16px;}
  .stitch-ui .home-next,.stitch-ui .home-progress {padding:16px;}
  .stitch-ui .home-next h3 {font-size:20px;}
  .stitch-ui .home-first-guide {padding:16px;}
  .stitch-ui .stitch-guide-step {padding:16px;}
  .stitch-ui .home-option,.stitch-ui .home-option:first-child {padding:16px;}
  .stitch-ui .home-progress h3 {font-size:16px;}
  .stitch-ui .home-progress .section-header {display:flex;gap:6px;}
  .stitch-ui .home-stat-grid {gap:12px;}
  .stitch-ui .home-stat-grid>div {padding:14px;}
  .stitch-ui .home-stat-grid dd {font-size:32px;}
  .stitch-ui .home-toolbox {padding:0;}
  .stitch-ui .home-tool-links {padding-inline:12px;}
  .stitch-ui .home-empty {padding:28px 24px;}
  .stitch-ui .home-guide {padding:16px;border:0;border-radius:12px;background:var(--stitch-card);}
  .stitch-ui .page-stack:not(.home-dashboard) {gap:24px;}
  .stitch-ui :is(.page-intro,.flow-hero,.ch-intro,.learn-hero) :is(h1,h2) {font-size:1.75rem;}
}
@media(max-width:360px) {
  .stitch-ui .stitch-mobile-brand {gap:3px;}
  .stitch-ui .stitch-brand-link {font-size:14px;gap:3px;}
  .stitch-ui .stitch-header>.account-chip {max-width:80px;}
  .stitch-ui .header-selector-button {padding:8px;gap:4px;}
  .stitch-ui .header-selector-button>svg:first-child {width:14px;height:14px;}
  .stitch-ui .selector-chevron {width:12px;height:12px;}
  .stitch-ui .home-stat-grid>div {padding:12px;}
  .stitch-ui .home-progress .section-header {gap:0;}
}
@media(prefers-reduced-motion:reduce) {.stitch-ui * {scroll-behavior:auto!important;}}
@media(forced-colors:active) {
  .stitch-ui .home-next,.stitch-ui .home-progress,.stitch-ui .home-option,.stitch-ui .home-empty,.stitch-ui .home-tool-links,.stitch-ui .home-stat-grid>div,.stitch-ui .stitch-more-panel {border:1px solid CanvasText;}
  .stitch-ui .btn,.stitch-ui .stitch-more-trigger {border:1px solid ButtonText!important;}
  .stitch-ui .nav-item.is-active,.stitch-ui .stitch-more-trigger.is-active {outline:2px solid Highlight;outline-offset:-2px;}
  .stitch-ui .stitch-account-avatar {border:1px solid ButtonText;}
}
/* Override legacy compact-selector and details descendant rules without hiding controls. */
.stitch-ui .stitch-header .topbar-actions {max-width:none;overflow:visible;}
.stitch-ui .stitch-header .selector-chevron {display:block;}
.stitch-ui .stitch-header .header-selector-copy small {display:block;}
.stitch-ui .stitch-guide-shell .fc-onboarding>summary .stitch-guide-heading {display:flex;flex-direction:row;align-items:center;max-width:none;gap:8px;}
.stitch-ui .stitch-guide-shell .fc-onboarding>summary .stitch-guide-heading>span {max-width:none;}
.stitch-ui .stitch-guide-step .field {min-width:0;max-width:100%;grid-template-columns:minmax(0,1fr);}
.stitch-ui .stitch-guide-step select {min-width:0;width:100%;max-width:100%;}
@media(max-width:760px) {
 .stitch-ui .stitch-header .topbar-actions {width:100%;}
 .stitch-ui .stitch-header-title>h1:focus {position:absolute;clip:rect(0,0,0,0);clip-path:inset(50%);width:1px;height:1px;overflow:hidden;white-space:nowrap;margin:0;outline:none;}
}

.stitch-ui .topbar h1:focus {outline:none;}
/* All mobile selectors share a bounded menu rail, including wrapped pills at 320px. */
@media(max-width:760px) {
 .stitch-ui .stitch-header .topbar-actions {position:relative;}
 .stitch-ui .stitch-header .header-selector {position:static;}
 .stitch-ui .stitch-header .header-selector-menu,
 .stitch-ui .stitch-header .header-selector:last-of-type .header-selector-menu {
   left:0;right:0;top:calc(100% + 7px);width:100%;min-width:0;max-width:100%;max-height:55vh;overflow-y:auto;
 }
}
