/* Route/state adapters; desktop composition and palette come from desktop.css. */
[hidden] { display: none !important; }
html, body { min-width: 0; }
.app.app-shell { width: 100%; min-width: 0; height: 100dvh; min-height: 0; }
.app:not(.ready) { visibility: hidden; }
.auth-view .app.app-shell { grid-template-columns: minmax(0, 1fr); }
.auth-view .sidebar { display: none; }
.sidebar { min-height: 0; overflow-y: auto; }
.main-shell { height: 100%; min-height: 0; }
.app-shell [data-screen] { display: none; }
.app-shell [data-screen].active { display: flex; }
.app-shell .legacy-surface[data-screen] {
  position: relative; inset: auto; min-height: 0; height: 100%; width: 100%;
  max-width: 850px; margin: 0 auto; padding: 24px; gap: 12px;
  opacity: 1; visibility: visible; pointer-events: auto; transform: none;
  filter: none; transition: none; overflow-y: auto; flex-direction: column;
  --accent: var(--brand); --accent-pressed: var(--brand-dark);
}
.legacy-surface[data-screen] > * { flex-shrink: 0; }
.legacy-surface.auth-screen { justify-content: flex-start; padding-top: 8vh !important; max-width: 540px !important; }
.legacy-surface .voice-state { display: block; }
.legacy-surface .subhead { position: static; }
.legacy-surface .primary-button, .legacy-surface .secondary-button { min-height: 42px; }
.legacy-surface .job-preview { max-height: 48vh; object-fit: contain; }
.legacy-surface .notice-card { max-width: 440px; }
.brand-btn { color: #fff; }
/* Sidebar user entry shows the display name (D047); long names end in "…". */
.brand, .brand-btn, .brand-copy { min-width: 0; }
.brand-copy { display: block; overflow: hidden; }
.brand-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item.is-active { background: rgba(48, 69, 111, 0.18); color: #fff; }
.asset-frame .asset-image:not([src]), .asset-frame.has-image [data-placeholder-person] { display: none; }
.portrait-stage { width: 100%; min-height: 0; flex: 1; }
.portrait-stage img { object-fit: contain; }
.portrait-badge { flex-shrink: 0; }
.script-editor:focus-visible { box-shadow: inset 0 0 0 2px var(--line-strong); }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
.history-panel { flex: 1; min-height: 0; }
.history-scroll { min-height: 0; overflow: auto; }
.history-table th { position: sticky; top: 0; z-index: 1; }
.history-table td:first-child { overflow-wrap: anywhere; }
.history-table .record-title { font-size: 13px; }
.history-tools { flex-wrap: wrap; }
.record-empty { padding: 32px !important; text-align: center !important; color: var(--muted); }
.toast:not([hidden]) { opacity: 1; transform: none; }
.toast { max-width: min(380px, calc(100vw - 32px)); z-index: 100; }
body.ui-hidden .app-shell { display: none; }
.mode-card.is-active { border-color: var(--warning); background: var(--surface-blue); box-shadow: 0 0 0 2px rgba(176,143,53,.2); }
.mode-card.is-active .radio-mark { border: 5px solid var(--brand); }
.retention-note:empty { display: none; }
.voice-summary { min-width: 0; }
.voice-summary > span:last-child { min-width: 0; }
.voice-summary strong, .voice-summary span { overflow-wrap: anywhere; }
@media (min-width: 1221px) {
  .workspace-grid { grid-template-columns: minmax(240px,.82fr) minmax(300px,1.35fr) minmax(250px,.76fr); }
}
@media (max-width: 960px), (max-height: 620px) {
  body { overflow: auto; height: auto; }
  .app.app-shell { height: auto; min-height: 100dvh; }
  .main-shell { height: auto; overflow: visible; }
  .page { height: auto; overflow: visible; }
  .app-shell .legacy-surface[data-screen] { height: auto; min-height: 100dvh; overflow: visible; }
  .workspace-grid { display: grid; grid-template-columns: minmax(0,1fr); }
  .settings-panel { grid-column: auto; }
  .settings-body { grid-template-columns: minmax(0,1fr); }
  .script-editor { min-height: 220px; }
  .portrait-stage { height: 230px; flex: none; }
  .portrait-wrap { flex: none; }
  .history-scroll { max-height: 70vh; }
}
@media (max-width: 600px) {
  .app.app-shell { grid-template-columns: minmax(0,1fr); }
  .sidebar { position: static; height: auto; padding: 12px; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; }
  .brand { padding: 0; grid-column: 1/-1; }
  .brand-copy span, .nav-label { display: none; }
  .nav-list { display: contents; }
  .nav-item { padding: 10px 6px; gap: 6px; font-size: 12px; }
  .page { padding: 16px 12px; }
  .page-heading { gap: 12px; }
  .page-heading h1 { font-size: 24px; }
  .history-table { min-width: 540px; }
  .app-shell .legacy-surface[data-screen] { padding: 16px; min-height: 75vh; }
}

/* Light motion (D045). Every effect is 0.2-0.3 s and is switched off when the
   system asks to reduce motion. */
::view-transition { pointer-events: none; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 200ms; animation-timing-function: ease-out; }
.app .progress-bar { transition: width 300ms ease-out; }
.app .progress-bar.no-transition { transition: none; }
.just-completed { animation: done-flash 300ms ease-out; }
@keyframes done-flash {
  from { background-color: #e6f3eb; box-shadow: 0 0 0 3px rgba(47, 125, 91, .28); }
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  .app .progress-bar, .app .duration-fill { transition: none !important; }
  .just-completed { animation: none !important; }
}

/* Site-wide element-rise entrance (D045 option A): the direct blocks of the
   screen being entered rise in over 260 ms, like the PPT page. */
@media (prefers-reduced-motion: no-preference) {
  .app.rise-ready [data-screen].active > :not(.workspace-grid, [hidden]),
  .app.rise-ready [data-screen].active > .workspace-grid > * {
    animation: element-rise 260ms cubic-bezier(.16, 1, .3, 1) both;
    animation-delay: calc(var(--rise, 0) * 40ms);
  }
  .app.rise-ready [data-screen].active > :nth-child(2),
  .app.rise-ready [data-screen].active > .workspace-grid > :nth-child(1) { --rise: 1; }
  .app.rise-ready [data-screen].active > :nth-child(3),
  .app.rise-ready [data-screen].active > .workspace-grid > :nth-child(2) { --rise: 2; }
  .app.rise-ready [data-screen].active > :nth-child(4),
  .app.rise-ready [data-screen].active > .workspace-grid > :nth-child(3) { --rise: 3; }
  .app.rise-ready [data-screen].active > :nth-child(n + 5) { --rise: 4; }
}
