@font-face {
  font-family: "Qiuer UI";
  src: url("/alibaba-puhuiti-regular.woff2?v=20260905-28") format("woff2"), url("/alibaba-puhuiti-regular.ttf?v=20260831-03") format("truetype");
  font-style: normal;
  font-weight: 400 700;
  font-display: block;
}

:root {
  --font-rounded: "Qiuer UI", sans-serif;
  --ink: #1e302c;
  --muted: #6b7975;
  --line: #dfe8e4;
  --line-strong: #cbd8d3;
  --surface: #fff;
  --surface-soft: #f6faf8;
  --canvas: #eef5f2;
  --accent: #168779;
  --accent-dark: #0f6f64;
  --accent-soft: #e7f5ef;
  --blue: #3f7096;
  --blue-soft: #edf3f8;
  --coral: #d76b52;
  --error: #a53b32;
  --success: #397c50;
  --radius-control: 14px;
  --radius-card: 18px;
  --radius-panel: 24px;
  --shadow-panel: 0 18px 52px rgba(31, 50, 47, .085);
  --shadow-card: 0 7px 22px rgba(31, 50, 47, .055);
  color: var(--ink);
  background: var(--canvas);
  font-family: var(--font-rounded);
}

html.apple-platform {
  --font-rounded: ui-rounded, "SF Pro Rounded", "SFNSRounded", "SF Compact Rounded", "Yuanti SC", "Yuanti TC", "STYuanti-SC-Regular", "圆体-简", "圆体-繁", -apple-system, BlinkMacSystemFont, sans-serif;
}

html.windows-platform { --font-rounded: "Qiuer UI", sans-serif; }

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; font-family: var(--font-rounded); }
body { margin: 0; min-width: 320px; min-height: 100dvh; color: var(--ink); background: var(--canvas); font-family: var(--font-rounded); font-size: 14px; font-style: normal; font-synthesis: none; line-height: 1.6; }
button, input, select, textarea { font: inherit; font-style: normal; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid rgba(17, 135, 122, .28); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3, strong { font-weight: 600; }
svg { display: block; }

.legal-page { min-height: 100dvh; background: linear-gradient(180deg, #eef7f3 0%, #f8fbfa 42%, #fff 100%); }
.legal-shell { width: min(100% - 32px, 920px); margin: 0 auto; padding: 24px 0 64px; }
.legal-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; margin-bottom: 28px; }
.legal-header .secondary-button { text-decoration: none; }
.legal-document { border: 1px solid rgba(182, 216, 205, .9); border-radius: 28px; padding: clamp(24px, 5vw, 56px); background: rgba(255,255,255,.86); box-shadow: var(--shadow-panel); }
.legal-document h1 { margin-top: 8px; font-size: clamp(30px, 5vw, 46px); line-height: 1.2; }
.legal-updated { margin-top: 12px; color: var(--muted); font-size: 12px; }
.legal-document h2 { margin-top: 32px; font-size: 18px; line-height: 1.35; }
.legal-document p:not(.eyebrow):not(.legal-updated) { margin-top: 10px; color: #4e625c; font-size: 14px; line-height: 1.9; }
.legal-links { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 36px; border-top: 1px solid var(--line); padding-top: 20px; }
.legal-links a { color: var(--accent-dark); font-weight: 600; text-decoration: none; }
.legal-links a:hover { text-decoration: underline; }

.topbar { position: sticky; z-index: 30; top: 0; height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); padding: 0 clamp(20px, 3vw, 44px); background: rgba(255, 255, 255, .94); backdrop-filter: blur(16px); }
.brand { min-width: 0; display: flex; align-items: center; gap: 12px; color: var(--ink); font-size: 17px; text-decoration: none; }
.brand-copy { min-width: 0; flex: 0 1 auto; }
.brand-copy strong, .brand-copy small { display: block; }
.brand-copy strong { line-height: 1.2; white-space: nowrap; }
.brand-copy small { margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 400; }
.brand-mark { width: 34px; height: 34px; flex: 0 0 34px; display: block; overflow: hidden; border-radius: 11px; line-height: 0; }
.brand-logo { display: block; width: 34px; height: 34px; border-radius: 11px; object-fit: cover; }
.workspace-taskbar { position: sticky; z-index: 25; top: 72px; display: block; padding: 10px 0 0; background: rgba(238, 245, 242, .84); }
.workspace-taskbar-inner { width: min(calc(100% - 40px), 1780px); min-height: 66px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 18px; margin: 0 auto; border: 1px solid rgba(191, 220, 210, .88); border-radius: 22px; padding: 8px 12px 8px 16px; background: rgba(255, 255, 255, .68); box-shadow: 0 10px 30px rgba(30, 91, 79, .08), inset 0 1px 0 rgba(255, 255, 255, .88); backdrop-filter: blur(20px) saturate(1.1); }
.workspace-taskbar-heading { min-width: 118px; display: flex; align-items: center; gap: 9px; }
.workspace-taskbar-heading > span:last-child { min-width: 0; }
.workspace-taskbar-heading strong, .workspace-taskbar-heading small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-taskbar-heading strong { font-size: 12px; line-height: 1.3; }
.workspace-taskbar-heading small { margin-top: 2px; color: var(--muted); font-size: 9px; line-height: 1.3; }
.workspace-taskbar-icon { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border: 1px solid rgba(130, 196, 177, .7); border-radius: 12px; color: #fff; background: linear-gradient(145deg, #168779, #4b9b8b); box-shadow: 0 6px 14px rgba(22, 135, 121, .16); }
.workspace-taskbar-icon svg { width: 16px; height: 16px; }
.workspace-tab-list { min-width: 0; display: flex; align-items: center; gap: 8px; overflow-x: auto; padding: 1px 0; scrollbar-width: none; }
.workspace-tab-list::-webkit-scrollbar { display: none; }
.workspace-tab { min-width: 156px; max-width: 240px; flex: 0 1 240px; display: flex; align-items: stretch; border: 1px solid rgba(201, 225, 217, .96); border-radius: 15px; background: rgba(247, 252, 249, .72); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .78); transition: background .24s ease, border-color .24s ease, transform .24s ease, box-shadow .24s ease; animation: workspace-tab-in .32s cubic-bezier(.2, .8, .2, 1) both; }
.workspace-tab.active { border-color: #8acbbb; background: rgba(255, 255, 255, .96); box-shadow: 0 5px 15px rgba(33, 112, 97, .1), inset 0 1px 0 rgba(255, 255, 255, .96); transform: translateY(-1px); }
.workspace-tab-main { min-width: 0; flex: 1; display: flex; align-items: center; gap: 8px; border: 0; border-radius: 14px 0 0 14px; padding: 7px 9px 7px 11px; color: var(--muted); background: transparent; text-align: left; cursor: pointer; }
.workspace-tab-main:hover { color: var(--ink); background: rgba(232, 246, 240, .74); }
.workspace-tab.active .workspace-tab-main { color: var(--ink); }
.workspace-tab-dot { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: #b8cbc5; box-shadow: 0 0 0 3px rgba(184, 203, 197, .18); }
.workspace-tab.active .workspace-tab-dot { background: var(--accent); box-shadow: 0 0 0 3px rgba(22, 135, 121, .13); }
.workspace-tab-copy { min-width: 0; display: block; }
.workspace-tab-copy strong, .workspace-tab-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-tab-copy strong { font-size: 11px; font-weight: 600; line-height: 1.35; }
.workspace-tab-copy small { margin-top: 1px; color: var(--muted); font-size: 9px; line-height: 1.25; }
.workspace-tab-close { width: 30px; min-width: 30px; flex: 0 0 30px; display: grid; place-items: center; border: 0; border-left: 1px solid rgba(201, 225, 217, .8); border-radius: 0 14px 14px 0; padding: 0; color: var(--muted); background: transparent; font-family: inherit; font-size: 18px; font-weight: 400; line-height: 1; cursor: pointer; transition: color .18s ease, background .18s ease; }
.workspace-tab-close:hover { color: var(--error); background: rgba(215, 107, 82, .1); }
.workspace-tab-close:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; color: var(--accent-dark); }
.workspace-tab.active .workspace-tab-close { border-left-color: rgba(138, 203, 187, .7); }
.workspace-taskbar-hint { flex: 0 0 auto; border: 1px solid #cde6dd; border-radius: 999px; padding: 6px 9px; color: var(--accent-dark); background: var(--accent-soft); font-size: 9px; font-weight: 600; white-space: nowrap; }
.workspace-taskbar-actions { display: flex; align-items: center; gap: 8px; }
.workspace-history-toggle { min-height: 38px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid rgba(184, 218, 207, .92); border-radius: 13px; padding: 0 11px; color: var(--accent-dark); background: rgba(255, 255, 255, .76); font-size: 10px; font-weight: 600; white-space: nowrap; cursor: pointer; transition: border-color .2s ease, background .2s ease, box-shadow .2s ease, transform .2s ease; }
.workspace-history-toggle svg { width: 15px; height: 15px; }
.workspace-history-toggle:hover, .workspace-history-toggle[aria-expanded="true"] { border-color: #82c7b5; background: #fff; box-shadow: 0 6px 16px rgba(22, 135, 121, .12); transform: translateY(-1px); }
.workspace-history-host { position: absolute; top: calc(100% + 8px); left: 50%; width: min(calc(100% - 40px), 1780px); max-height: min(66dvh, 720px); overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; border: 1px solid rgba(180, 215, 204, .94); border-radius: 24px; padding: 20px; background: rgba(250, 253, 252, .94); box-shadow: 0 24px 70px rgba(24, 67, 59, .18), inset 0 1px 0 rgba(255, 255, 255, .94); backdrop-filter: blur(24px) saturate(1.12); transform: translateX(-50%); }
.workspace-history-host .history-panel { margin-top: 0; border-top: 0; padding-top: 0; }
.workspace-history-host .history-heading { position: sticky; z-index: 2; top: -20px; margin: -20px -20px 14px; border-bottom: 1px solid rgba(205, 226, 219, .86); padding: 18px 20px 14px; background: rgba(250, 253, 252, .94); backdrop-filter: blur(18px); }
@keyframes workspace-tab-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.auth-gateway { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; overflow: auto; padding: 36px 20px; background-color: #155e59; background-image: linear-gradient(rgba(7, 67, 63, .28), rgba(5, 48, 46, .46)), url("/login-water-bg.jpg?v=20260829-01"); background-position: center; background-repeat: no-repeat; background-size: cover; }
.auth-gateway::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(4, 45, 43, .20), rgba(13, 103, 94, .04) 52%, rgba(4, 45, 43, .16)); pointer-events: none; }
.gateway-panel { position: relative; width: min(440px, 100%); border: 1px solid rgba(255, 255, 255, .68); border-radius: 32px; padding: 30px; color: var(--ink); background: rgba(255, 255, 255, .94); box-shadow: 0 28px 90px rgba(4, 42, 40, .34); backdrop-filter: blur(20px); }
.gateway-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 30px; }
.gateway-brand img { width: 48px; height: 48px; border-radius: 16px; box-shadow: 0 8px 22px rgba(19, 126, 111, .2); }
.gateway-brand strong, .gateway-brand small { display: block; }
.gateway-brand strong { font-size: 16px; line-height: 1.25; }
.gateway-brand small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.gateway-heading h1 { font-size: 28px; line-height: 1.25; }
.gateway-heading > p:last-child { margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.gateway-panel .field-label { margin-top: 20px; }
.gateway-panel .field-label:first-of-type { margin-top: 27px; }
.gateway-panel input { min-height: 48px; border-radius: 15px; }
.gateway-panel .secret-field input { width: 100%; }
.gateway-submit { width: 100%; min-height: 50px; margin-top: 24px; border-radius: 16px; font-size: 13px; }
.gateway-forgot { display: block; min-height: 30px; margin: 8px auto 0; padding: 3px 8px; color: var(--accent-dark); font-size: 10px; }
.gateway-footer { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 9px; margin-top: 22px; color: var(--muted); font-size: 11px; }
.gateway-footer .text-button { min-height: 30px; padding: 3px 6px; color: var(--accent-dark); }
.gateway-footer a { color: var(--muted); text-decoration: none; }
.gateway-footer a:hover { color: var(--accent-dark); }
.gateway-legal-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 14px; color: rgba(28, 73, 67, .66); font-size: 10px; }
.gateway-legal-links a { color: inherit; text-decoration: none; }
.gateway-legal-links a:hover { color: var(--accent-dark); text-decoration: underline; }
.gateway-status { margin-top: 14px; color: var(--muted); font-size: 10px; text-align: center; }
.auth-pending .gateway-panel form, .auth-pending .gateway-footer { visibility: hidden; }
.auth-pending .gateway-status { margin: 0; padding: 18px 0; font-size: 11px; }
.header-account { display: flex; align-items: center; gap: 17px; }
.header-usage { min-width: 92px; border-right: 1px solid var(--line); padding-right: 17px; }
.header-usage span, .header-usage strong { display: block; }
.header-usage span { color: var(--muted); font-size: 10px; }
.header-usage strong { margin-top: 2px; color: var(--accent-dark); font-size: 13px; }
.header-account-menu { position: relative; }
.header-account-menu summary { display: flex; align-items: center; gap: 9px; list-style: none; border-radius: 17px; padding: 5px 9px 5px 5px; cursor: pointer; }
.header-account-menu summary::-webkit-details-marker { display: none; }
.header-account-menu summary:hover, .header-account-menu[open] summary { background: var(--accent-soft); }
.header-avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 13px; color: #fff; background: linear-gradient(145deg, #168779, #4d83aa); font-size: 13px; font-weight: 600; }
.header-account-copy { min-width: 74px; }
.header-account-copy strong, .header-account-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-account-copy strong { max-width: 150px; font-size: 12px; }
.header-account-copy small { margin-top: 1px; color: var(--muted); font-size: 10px; }
.header-chevron { color: var(--muted); font-size: 17px; line-height: 1; }
.header-menu-panel { position: absolute; z-index: 40; top: calc(100% + 9px); right: 0; width: 188px; display: grid; gap: 3px; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; padding: 7px; background: rgba(255, 255, 255, .98); box-shadow: 0 18px 44px rgba(31, 50, 47, .15); }
.header-menu-panel button { width: 100%; min-height: 37px; display: flex; align-items: center; gap: 8px; overflow: hidden; border: 0; border-radius: 11px; padding: 0 10px; color: var(--ink); background: transparent; font-size: 11px; font-weight: 600; text-align: left; cursor: pointer; }
.header-menu-panel button svg { width: 16px; height: 16px; max-width: 16px; max-height: 16px; flex: 0 0 16px; }
.header-menu-panel button span { min-width: 0; }
.header-menu-panel button:hover { background: var(--surface-soft); color: var(--accent-dark); }
.header-menu-rule { height: 1px; margin: 4px 5px; background: var(--line); }
.header-menu-panel .header-logout { color: var(--coral); }
.is-authenticated .workflow-nav > .nav-caption:first-child, .is-authenticated .account-card { display: none; }
.is-authenticated .workflow-caption { margin-top: 0; }
.header-link { min-height: 40px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid transparent; border-radius: var(--radius-control); padding: 0 12px; color: #40534e; font-size: 13px; font-weight: 600; text-decoration: none; }
.header-link:hover { border-color: var(--line); background: var(--surface-soft); }
.header-link svg { width: 17px; height: 17px; }

.app-shell { width: min(calc(100% - 40px), 1780px); min-height: calc(100vh - 112px); display: grid; grid-template-columns: 236px minmax(680px, 1fr) minmax(410px, 470px); align-items: stretch; margin: 20px auto 32px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--surface); box-shadow: var(--shadow-panel); }
.workflow-nav { min-width: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); padding: 30px 18px 22px; background: #f4f7f5; }
.nav-caption { margin: 0 8px 10px; color: #7b8e88; font-size: 10px; font-weight: 600; }
.workflow-caption { margin-top: 28px; }
.account-card { border: 1px solid #d8e9e2; border-radius: var(--radius-card); padding: 14px; background: #fff; box-shadow: 0 5px 16px rgba(39, 75, 66, .05); }
.account-card.authenticated { border-color: #a9d4c5; background: #fbfefc; }
.account-summary { min-width: 0; display: flex; align-items: center; gap: 10px; }
.account-summary > span:last-child { min-width: 0; }
.account-summary strong, .account-summary small { display: block; overflow-wrap: anywhere; }
.account-summary strong { font-size: 13px; line-height: 1.4; }
.account-summary small { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.project-avatar { width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center; border-radius: 13px; color: #fff; background: linear-gradient(145deg, #79b8a6, #4d83aa); font-size: 13px; font-weight: 600; box-shadow: 0 4px 10px rgba(19, 126, 111, .16); }
.account-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 13px; }
.account-primary, .account-secondary { min-width: 0; min-height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 11px; padding: 6px 9px; font-size: 11px; font-weight: 600; cursor: pointer; }
.account-primary { border: 1px solid var(--accent); color: #fff; background: var(--accent); }
.account-primary:hover { border-color: var(--accent-dark); background: var(--accent-dark); }
.account-secondary { border: 1px solid var(--line-strong); color: #40534e; background: #fff; }
.account-secondary:hover { border-color: #9ecabb; background: var(--accent-soft); }
#memberActions { grid-template-columns: 1fr; }
.account-primary svg, .account-secondary svg, .account-admin-link svg { width: 14px; height: 14px; }
.account-admin-link { min-height: 34px; display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 8px; border-top: 1px solid var(--line); padding-top: 9px; color: var(--muted); font-size: 10px; font-weight: 600; text-decoration: none; }
.account-admin-link:hover { color: var(--accent); }

.step-list { display: grid; gap: 7px; }
.step-item { width: 100%; min-height: 44px; display: grid; grid-template-columns: 30px minmax(0, 1fr) 8px; align-items: center; gap: 8px; border: 0; border-radius: var(--radius-control); padding: 9px 10px; color: #657873; background: transparent; text-align: left; cursor: pointer; }
.step-item b { font-size: 10px; font-weight: 600; }
.step-item span { min-width: 0; overflow: hidden; font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.step-item i { width: 6px; height: 6px; border-radius: 50%; background: #c4d3ce; }
.step-item:hover, .step-item.active { color: var(--ink); background: #e3f1eb; }
.step-item.active b { color: var(--accent); }
.step-item.active i { background: var(--accent); }
.nav-footer { display: flex; align-items: flex-start; gap: 9px; margin-top: auto; border-top: 1px solid #d7e5e0; padding: 18px 7px 0; color: var(--muted); }
.nav-footer strong, .nav-footer small { display: block; }
.nav-footer strong { color: var(--ink); font-size: 11px; }
.nav-footer small { margin-top: 3px; font-size: 10px; line-height: 1.5; }
.security-icon { color: var(--accent); font-size: 20px; line-height: 1; }

.studio-content { min-width: 0; padding: 48px clamp(34px, 4vw, 72px) 68px; background: var(--surface); }
.project-bar { min-width: 0; display: grid; grid-template-columns: minmax(170px, 1fr) minmax(220px, 1.2fr) auto; align-items: end; gap: 18px; margin-bottom: 30px; border: 1px solid #dce9e4; border-radius: var(--radius-card); padding: 16px 18px; background: #f8fcfa; }
.project-bar > div { min-width: 0; }
.project-bar > div strong, .project-bar > div small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-bar > div strong { font-size: 14px; }
.project-bar > div small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.project-select-wrap { min-width: 0; }
.project-select-wrap > span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 10px; font-weight: 600; }
.project-select-wrap select { min-height: 42px; }
.project-bar .secondary-button { min-height: 42px; }
.content-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 38px; }
.content-heading > div:first-child { min-width: 0; }
.content-heading h1 { font-size: 32px; line-height: 1.28; }
.content-heading p:not(.eyebrow) { max-width: 620px; margin-top: 9px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.eyebrow { margin-bottom: 5px; color: var(--accent); font-size: 10px; font-weight: 600; }
.quota-chip { flex: 0 0 auto; border: 1px solid #d7ebe3; border-radius: var(--radius-control); padding: 10px 14px; background: #eef8f4; }
.quota-chip span, .quota-chip strong { display: block; }
.quota-chip span { color: var(--muted); font-size: 10px; }
.quota-chip strong { margin-top: 3px; font-size: 13px; }
.mode-section, .form-section { scroll-margin-top: 92px; border-top: 1px solid #e9f1ee; padding-top: 28px; }
.form-section { margin-top: 34px; }
.section-title { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 20px; }
.section-index { width: 28px; height: 28px; flex: 0 0 28px; display: grid; place-items: center; border-radius: 8px; color: var(--accent); background: var(--accent-soft); font-size: 11px; font-weight: 600; }
.section-title h2 { font-size: 19px; line-height: 1.4; }
.section-title p { margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.mode-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: stretch; gap: 13px; }
.mode-card { position: relative; min-width: 0; min-height: 164px; display: flex; flex-direction: column; align-items: flex-start; gap: 14px; border: 1px solid #dce8e3; border-radius: var(--radius-card); padding: 18px; color: var(--ink); background: #fbfdfc; text-align: left; cursor: pointer; transition: border-color .2s, background .2s, box-shadow .2s, transform .2s; }
.mode-card:hover { transform: translateY(-2px); }
.mode-card:hover, .mode-card.active { border-color: #8bc8b7; background: #f1faf6; box-shadow: var(--shadow-card); }
.mode-card:disabled { display: none; }
.mode-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 12px; color: #fff; font-size: 16px; }
.mode-icon svg { width: 19px; height: 19px; }
.reference-icon { background: #418e81; }
.original-icon { background: var(--blue); }
.advanced-icon { background: #66775f; }
.one-shot-icon { background: #168779; }
.mode-card-copy { min-width: 0; }
.mode-card-copy strong, .mode-card-copy small { display: block; overflow-wrap: anywhere; }
.mode-card-copy strong { font-size: 14px; }
.mode-card-copy small { margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.mode-tag { margin-top: auto; border-radius: 999px; padding: 4px 8px; color: var(--accent); background: #e7f5ef; font-size: 10px; font-weight: 600; }
.muted-tag { color: #66775f; background: #edf1eb; }
.mode-notice, .continuity-hint, .advanced-plan { display: flex; align-items: flex-start; gap: 9px; margin-top: 16px; border: 1px solid #dcece5; border-radius: var(--radius-control); padding: 12px 14px; background: #f0f8f4; font-size: 12px; line-height: 1.6; }
.mode-notice strong { flex: 0 0 auto; }
.mode-notice span { color: var(--muted); overflow-wrap: anywhere; }
.high-risk-hint { border-color: #e6d7a8; background: #fcf8eb; }

.field-label, legend { display: block; margin: 0 0 8px; padding: 0; color: #314640; font-size: 13px; font-weight: 600; line-height: 1.35; }
.field-label span { color: var(--muted); font-weight: 400; }
.field-help { margin: 8px 0 20px; color: var(--muted); font-size: 11px; line-height: 1.65; overflow-wrap: anywhere; }
.style-preset-section { margin-top: 20px; }
.style-preset-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 16px; }
.style-preset-category { min-width: 0; }
.style-preset-category.single { grid-column: span 1; }
.style-preset-category:not(.single) { grid-column: span 2; }
.style-preset-category-heading { min-height: 30px; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 9px; padding: 0 2px; }
.style-preset-category-heading strong { color: #3d514b; font-size: 11px; line-height: 1.35; }
.style-preset-category-heading span { color: var(--muted); font-size: 9px; white-space: nowrap; }
.style-preset-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.style-preset-category.single .style-preset-options { grid-template-columns: 1fr; }
.style-preset { min-width: 0; height: 80px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 5px; border: 1px solid var(--line); border-radius: var(--radius-card); padding: 12px 14px; color: var(--ink); background: rgba(251, 253, 252, .9); text-align: left; cursor: pointer; transition: border-color .18s, background .18s, box-shadow .18s, transform .18s; }
.style-preset:hover { border-color: #9bcdbf; background: var(--surface-soft); box-shadow: var(--shadow-card); transform: translateY(-1px); }
.style-preset.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px rgba(22, 135, 121, .08), 0 7px 18px rgba(22, 135, 121, .08); }
.style-preset:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.style-preset:focus-visible, .realism-mode:focus-visible, .region-option:focus-visible { outline: 3px solid rgba(22, 135, 121, .22); outline-offset: 2px; }
.style-preset strong, .style-preset small { display: block; overflow-wrap: anywhere; }
.style-preset strong { font-size: 12px; line-height: 1.35; }
.style-preset small { color: var(--muted); font-size: 10px; line-height: 1.45; }
.style-preset-empty { grid-column: 1 / -1; border: 1px dashed var(--line-strong); border-radius: var(--radius-control); padding: 16px; color: var(--muted); font-size: 11px; text-align: center; }
.style-prompt-detail { margin-top: 12px; overflow: hidden; border: 1px solid #cfe3dc; border-radius: var(--radius-card); background: rgba(246, 251, 249, .84); }
.style-prompt-detail-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid #dcebe6; padding: 11px 13px; }
.style-prompt-detail-heading strong { font-size: 12px; }
.style-prompt-detail-heading span { color: var(--accent-dark); font-size: 9px; font-weight: 600; }
.style-prompt-copy { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 10px; padding: 10px 13px; }
.style-prompt-copy + .style-prompt-copy { border-top: 1px solid #e3ede9; }
.style-prompt-copy > span { color: var(--accent-dark); font-size: 10px; font-weight: 600; }
.style-prompt-copy p { color: #50635d; font-size: 10px; line-height: 1.65; overflow-wrap: anywhere; }
.style-prompt-copy.negative > span { color: #8c594d; }
.realism-section { margin-top: 18px; }
.realism-mode-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: hidden; border: 1px solid var(--line-strong); border-radius: var(--radius-card); background: #f7faf9; }
.realism-mode { min-width: 0; min-height: 66px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; border: 0; border-right: 1px solid var(--line); padding: 10px 12px; color: var(--ink); background: transparent; text-align: left; cursor: pointer; transition: color .18s, background .18s, box-shadow .18s; }
.realism-mode:last-child { border-right: 0; }
.realism-mode:hover { background: #eef7f3; }
.realism-mode.active { color: var(--accent-dark); background: var(--accent-soft); box-shadow: inset 0 -2px 0 var(--accent); }
.realism-mode:disabled { opacity: .55; cursor: not-allowed; }
.realism-mode strong, .realism-mode small { display: block; overflow-wrap: anywhere; }
.realism-mode strong { font-size: 11px; font-weight: 600; line-height: 1.4; }
.realism-mode small { color: var(--muted); font-size: 9px; line-height: 1.45; }
.realism-mode-detail { margin: 8px 2px 20px; color: var(--muted); font-size: 10px; line-height: 1.55; overflow-wrap: anywhere; }
.region-section { margin-top: 18px; }
.region-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.region-option { min-width: 0; min-height: 66px; display: flex; flex-direction: column; justify-content: center; gap: 4px; border: 1px solid var(--line); border-radius: var(--radius-card); padding: 10px 12px; color: var(--ink); background: #fbfdfc; text-align: left; cursor: pointer; transition: border-color .18s, background .18s, box-shadow .18s, transform .18s; }
.region-option:hover { border-color: #9bcdbf; background: var(--surface-soft); transform: translateY(-1px); }
.region-option.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px rgba(22, 135, 121, .08); }
.region-option:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.region-option strong, .region-option small { display: block; overflow-wrap: anywhere; }
.region-option strong { font-size: 11px; font-weight: 600; line-height: 1.4; }
.region-option small { color: var(--muted); font-size: 9px; line-height: 1.45; }
.label-row, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.char-count { flex: 0 0 auto; color: var(--muted); font-size: 10px; }
input[type="password"], input[type="text"], input[type="url"], input[type="email"], input[type="number"], input[type="search"], select, textarea { width: 100%; min-width: 0; border: 1px solid var(--line-strong); border-radius: var(--radius-control); padding: 12px 14px; color: var(--ink); background: var(--surface); outline: none; }
input[type="password"], input[type="text"], input[type="url"], input[type="email"], input[type="number"], input[type="search"], select { min-height: 48px; }
select { appearance: none; padding-right: 36px; }
textarea { min-height: 142px; resize: vertical; line-height: 1.6; }
.negative-wrap textarea { min-height: 94px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(22, 135, 121, .12); }
input:disabled, select:disabled, textarea:disabled { color: #87938f; background: #f2f5f4; cursor: not-allowed; }
.reference-controls { margin-bottom: 20px; }
.analysis-choice, .reference-intent { margin-bottom: 18px; }
.choice-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice { position: relative; min-width: 0; display: flex; align-items: center; gap: 10px; border: 1px solid #d8e5e0; border-radius: var(--radius-control); padding: 13px; background: #fbfdfc; cursor: pointer; }
.choice.active { border-color: #8bc8b7; background: #f0faf5; }
.choice-disabled { opacity: .58; cursor: not-allowed; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice strong, .choice small { display: block; }
.choice strong { font-size: 13px; }
.choice small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.choice em { margin-left: auto; color: var(--muted); font-size: 10px; font-style: normal; font-weight: 600; }
.reference-intent { border-top: 1px solid #e5eeea; padding-top: 16px; }
.reference-intent-row .choice { align-items: flex-start; min-height: 82px; }
.reference-intent-row .choice em { border-radius: 999px; padding: 3px 7px; color: var(--accent); background: var(--accent-soft); }
.reference-source-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.reference-source { min-width: 0; }
.reference-source .field-label { margin-bottom: 0; }
.source-required, .source-optional { color: var(--accent-dark); font-size: 10px; font-weight: 600; }
.source-optional { color: var(--muted); }
.media-file-input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.media-dropzone { min-height: 126px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; margin-top: 8px; border: 1px dashed #aacbc1; border-radius: var(--radius-control); padding: 16px; color: var(--ink); background: #f8fcfa; text-align: center; cursor: pointer; transition: border-color .16s ease, background .16s ease, box-shadow .16s ease; }
.media-dropzone:hover, .media-dropzone:focus, .media-dropzone.dragging { border-color: var(--accent); background: #f0faf6; outline: none; box-shadow: 0 0 0 3px rgba(22, 135, 121, .1); }
.media-dropzone.needs-reselect { border-style: solid; border-color: #c7a768; color: #6f5827; background: #fffaf0; box-shadow: inset 0 0 0 1px rgba(199, 167, 104, .12); }
.media-dropzone.needs-reselect .drop-mark { color: #8a6b2e; }
.media-dropzone.disabled { opacity: .55; cursor: not-allowed; }
.media-dropzone strong, .media-dropzone small { display: block; }
.media-dropzone strong { font-size: 12px; font-weight: 600; }
.media-dropzone small { color: var(--muted); font-size: 10px; }
.drop-mark { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 10px; color: #fff; background: var(--accent); font-size: 18px; line-height: 1; }
.reference-preview { min-width: 0; display: grid; grid-template-columns: 62px minmax(0, 1fr) auto; align-items: center; gap: 10px; margin-top: 8px; border: 1px solid #cde4da; border-radius: var(--radius-control); padding: 8px; background: #f1faf6; }
.reference-preview img { width: 62px; height: 48px; border-radius: 8px; object-fit: cover; background: #e4efeb; }
.reference-preview > div { min-width: 0; }
.reference-preview strong, .reference-preview small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reference-preview strong { color: var(--accent-dark); font-size: 11px; }
.reference-preview small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.icon-text-button { min-height: 30px; border: 0; padding: 4px 6px; color: var(--muted); background: transparent; font-size: 10px; cursor: pointer; }
.icon-text-button:hover { color: #b44c42; }
.compact-url { display: block; margin-top: 8px; }
.compact-url span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; }
.compact-url input[type="url"] { min-height: 40px; padding: 9px 11px; font-size: 11px; }
.reference-video-label { margin-top: 18px; }
.transient-media-note { margin-bottom: 0; }
.reference-creative-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; margin-top: 14px; border: 1px solid #cfe7de; border-radius: var(--radius-card); padding: 14px; background: linear-gradient(135deg, #f8fcfa, #eff9f4); box-shadow: 0 6px 18px rgba(39, 75, 66, .05); }
.reference-creative-card strong, .reference-creative-card small { display: block; }
.reference-creative-card strong { color: var(--ink); font-size: 13px; line-height: 1.35; }
.reference-creative-card small { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.reference-analyze-button { min-width: 190px; margin-top: 0; white-space: nowrap; }
.reference-analyze-button:disabled { cursor: not-allowed; opacity: .62; }
.prompt-wrap { margin-top: 18px; }
.continuity-hint { color: #776d43; background: #faf8ee; border-color: #ece3c7; }
.continuity-hint strong, .continuity-hint small { display: block; }
.continuity-hint strong { font-size: 11px; }
.continuity-hint small { margin-top: 3px; font-size: 10px; line-height: 1.55; }
.hint-mark { color: #a28a36; font-weight: 600; }

.spec-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 220px); align-items: stretch; gap: 24px; }
.spec-main { min-width: 0; }
.spec-field { min-width: 0; }
.spec-field > .field-label { display: block; margin-bottom: 7px; }
.inline-label { margin-top: 20px; }
.segments { width: 100%; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); overflow: hidden; border: 1px solid var(--line-strong); border-radius: var(--radius-control); background: #fcfefd; }
.segment { min-width: 0; min-height: 48px; border: 0; border-right: 1px solid var(--line); padding: 6px 5px; color: var(--muted); background: transparent; font-size: 11px; line-height: 1.25; cursor: pointer; }
.segment:last-child { border-right: 0; }
.segment:hover { color: var(--ink); background: var(--surface-soft); }
.segment.active { color: #fff; background: var(--ink); }
.ratio-options { min-height: 66px; }
.ratio-option { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.ratio-option i { width: min(28px, 76%); max-height: 20px; display: block; border: 1.5px solid currentColor; border-radius: 2px; opacity: .8; }
.ratio-option[data-value="21:9"] i { aspect-ratio: 21 / 9; }
.ratio-option[data-value="16:9"] i { aspect-ratio: 16 / 9; }
.ratio-option[data-value="4:3"] i { aspect-ratio: 4 / 3; }
.ratio-option[data-value="1:1"] i { aspect-ratio: 1; }
.ratio-option[data-value="3:4"] i { aspect-ratio: 3 / 4; }
.ratio-option[data-value="9:16"] i { aspect-ratio: 9 / 16; }
.ratio-option.active { background: var(--accent); }
.duration-row { display: grid; grid-template-columns: minmax(170px, .8fr) minmax(260px, 1.2fr); align-items: center; gap: 20px; margin-top: 22px; }
.duration-row > div:first-child { min-width: 0; min-height: 48px; display: flex; flex-direction: column; justify-content: center; }
.duration-row .field-label { margin-bottom: 3px; }
.duration-row small { color: var(--muted); font-size: 10px; line-height: 1.35; }
.duration-control { min-width: 0; height: 48px; display: grid; grid-template-columns: 42px minmax(60px, 1fr) 42px 58px; align-items: center; overflow: hidden; border: 1px solid var(--line-strong); border-radius: var(--radius-control); background: #fff; }
.step-button { align-self: stretch; border: 0; color: #465954; background: #f1f7f4; font-size: 18px; cursor: pointer; }
.step-button:hover { color: var(--accent); background: var(--accent-soft); }
.duration-control output { font-size: 11px; font-weight: 600; text-align: center; }
input[type="range"] { min-width: 0; height: 3px; margin: 0 10px; accent-color: var(--accent); }
.resolution-row { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; align-items: center; gap: 12px; margin-top: 22px; }
.resolution-row .field-label { margin: 0; }
.resolution-options .segment.active { background: var(--blue); }
.format-badge { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; border: 1px solid #bfd4e2; border-radius: 999px; padding: 5px 9px; color: var(--blue); background: var(--blue-soft); font-size: 9px; font-weight: 600; white-space: nowrap; }
.spec-summary { min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 8px; border: 1px solid #dce9e4; border-radius: var(--radius-card); padding: 18px; background: #f7fbf9; }
.spec-summary > span, .spec-summary > strong { display: block; overflow-wrap: anywhere; }
.spec-summary > span { color: var(--muted); font-size: 11px; line-height: 1.4; }
.spec-summary > strong { font-size: 15px; line-height: 1.4; }
.summary-rule { width: 100%; margin: 4px 0; border-top: 1px solid #deebe6; }
.summary-note { line-height: 1.65; }
.advanced-plan { flex-wrap: wrap; }
.advanced-plan span { color: var(--muted); }
.advanced-plan small { width: 100%; color: var(--muted); }

.creative-plan-panel { margin-top: 20px; border: 1px solid #d6e8e0; border-radius: var(--radius-card); padding: 22px; background: #fbfefc; box-shadow: var(--shadow-card); }

/* The model and output controls stay visible as one compact workbench strip. */
.studio-active #specSection { margin-top: 0; border-top: 0; padding-top: 0; }
.studio-active #specSection > .section-title { display: none; }
.studio-active #specSection .spec-layout { display: grid; grid-template-columns: minmax(180px, 1.15fr) minmax(210px, 1.4fr) minmax(210px, 1.35fr) minmax(160px, .9fr) minmax(150px, .9fr); gap: 10px; align-items: stretch; }
.studio-active #specSection .spec-main { display: contents; }
.studio-active #specSection .spec-field { display: flex; min-height: 78px; flex-direction: column; justify-content: center; border: 1px solid #d9dce1; border-radius: 14px; padding: 10px 11px; background: #fafafb; }
.studio-active #specSection .spec-field > .field-label { margin-bottom: 6px; }
.studio-active #specSection .spec-model-field { grid-column: 1; }
.studio-active #specSection .spec-ratio-field { grid-column: 2; }
.studio-active #specSection .spec-duration-field { grid-column: 3; }
.studio-active #specSection .spec-resolution-field { grid-column: 4; }
.studio-active #specSection .spec-summary { grid-column: 5; min-height: 78px; border-radius: 14px; padding: 10px 11px; }
.studio-active #specSection .ratio-options { min-height: 42px; }
.studio-active #specSection .ratio-option { min-height: 40px; gap: 3px; }
.studio-active #specSection .ratio-option i { width: min(18px, 60%); max-height: 13px; }
.studio-active #specSection .duration-row { grid-template-columns: 1fr; gap: 6px; margin-top: 0; }
.studio-active #specSection .duration-row > div:first-child { min-height: 0; }
.studio-active #specSection .duration-row small { display: none; }
.studio-active #specSection .duration-control { height: 39px; grid-template-columns: 30px minmax(34px, 1fr) 30px 50px; }
.studio-active #specSection .step-button { font-size: 15px; }
.studio-active #specSection .resolution-row { grid-template-columns: 1fr; gap: 6px; margin-top: 0; }
.studio-active #specSection .resolution-row > .field-label { margin: 0; }
.studio-active #specSection .resolution-options { min-height: 39px; }
.studio-active #specSection .resolution-options .segment { min-height: 37px; font-size: 10px; }
.studio-active #specSection .format-badge { display: none; }
.studio-active #specSection .advanced-plan { grid-column: 1 / -1; margin-top: 10px; }
.studio-active #specSection > .creative-plan-panel { grid-column: 1 / -1; }
.studio-active #briefSection { margin-top: 22px; }
.studio-active .project-bar { display: none; }
.studio-active #modeSection { display: none; }
.idea-chooser { margin: 18px 0 22px; border: 1px solid #dbeae4; border-radius: var(--radius-control); padding: 16px; background: #f7fcfa; }
.idea-chooser .section-heading { align-items: flex-start; margin-bottom: 14px; }
.idea-chooser .section-heading p { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.idea-list { display: grid; gap: 9px; }
.idea-card { min-width: 0; display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; border: 1px solid #dfeae6; border-radius: var(--radius-control); padding: 13px; background: #fff; cursor: pointer; transition: border-color .2s, background .2s, box-shadow .2s, transform .2s; }
.idea-card:hover { border-color: #afd5c8; background: #fbfefc; transform: translateY(-1px); }
.idea-card.active { border-color: #8bc8b7; background: #f0faf5; box-shadow: inset 0 0 0 1px rgba(22, 135, 121, .08); }
.idea-card input { margin: 3px 0 0; accent-color: var(--accent); }
.idea-copy { min-width: 0; }
.idea-copy strong, .idea-copy span, .idea-copy small { display: block; overflow-wrap: anywhere; }
.idea-copy strong { font-size: 13px; line-height: 1.45; }
.idea-copy span { margin-top: 4px; color: #40534e; font-size: 11px; line-height: 1.55; }
.idea-copy small { margin-top: 6px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.idea-copy .idea-contract-row { display: grid; grid-template-columns: 42px minmax(0, 1fr); align-items: start; gap: 7px; }
.idea-copy .idea-contract-row b { color: #52625e; font-size: 9px; font-weight: 700; line-height: 1.7; }
.idea-copy .idea-contract-row span { margin: 0; color: inherit; font-size: inherit; line-height: inherit; }
.idea-copy .idea-contract-locked b { color: #126f63; }
.idea-copy .idea-contract-flexible { color: #72807c; }
.idea-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 14px; }
.idea-actions button { flex: 1 1 170px; margin: 0; }
.continuity-assets { margin: 18px 0 22px; border: 1px solid #dbeae4; border-radius: var(--radius-control); padding: 16px; background: #f7fcfa; }
.continuity-assets .section-heading { align-items: flex-start; margin-bottom: 14px; }
.continuity-assets .section-heading p { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.asset-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.asset-group { min-width: 0; border: 1px solid #e1ede8; border-radius: var(--radius-control); padding: 12px; background: #fff; }
.asset-group-wide { grid-column: 1 / -1; }
.asset-group-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.asset-group-heading > div { min-width: 0; }
.asset-group-heading .field-label { margin-bottom: 2px; }
.asset-group-heading small { display: block; color: var(--muted); font-size: 10px; line-height: 1.45; }
.asset-add-button { min-height: 30px; flex: 0 0 auto; padding: 5px 8px; font-size: 10px; }
.asset-list { display: grid; gap: 8px; }
.asset-empty { border: 1px dashed #d6e6df; border-radius: 10px; padding: 12px; color: var(--muted); font-size: 10px; text-align: center; }
.asset-row { min-width: 0; display: grid; grid-template-columns: minmax(100px, .55fr) minmax(0, 1.4fr) auto; align-items: start; gap: 7px; }
.asset-row input, .asset-row textarea { min-height: 38px; padding: 8px 10px; border-radius: 10px; font-size: 10px; }
.asset-row textarea { min-height: 54px; resize: vertical; }
.asset-row .asset-url-input { grid-column: 1 / 3; }
.asset-remove-button { min-height: 34px; padding: 6px; font-size: 10px; }
.asset-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.asset-actions .secondary-button { min-height: 36px; }
.asset-actions .form-message { margin: 0; font-size: 10px; }
.plan-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.plan-title-input { width: min(100%, 520px); margin-top: 3px; border: 0; border-bottom: 1px solid transparent; border-radius: 0; padding: 0 0 4px; color: var(--ink); background: transparent; font-size: 18px; font-weight: 600; line-height: 1.35; }
.plan-title-input:focus { border-bottom-color: var(--accent); outline: 0; box-shadow: none; }
.plan-logline { margin-top: 12px; color: #40534e; font-size: 13px; line-height: 1.7; }
.plan-editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.plan-field { min-width: 0; }
.plan-field-wide { grid-column: 1 / -1; }
.plan-field > span, .plan-version-bar label > span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 10px; font-weight: 600; }
.plan-field textarea { min-height: 84px; font-size: 11px; line-height: 1.6; }
.plan-field-wide textarea { min-height: 74px; }
.plan-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 11px; color: var(--muted); font-size: 11px; }
.plan-integrity { margin-left: auto; border: 1px solid #dce7e3; border-radius: 999px; padding: 3px 8px; color: #52625e; background: #f7faf9; font-size: 10px; font-weight: 650; }
.plan-integrity[data-status="consistent"], .plan-integrity[data-status="modified"] { border-color: #b9ddd2; color: #126f63; background: #eff9f5; }
.plan-integrity[data-status="drifted"] { border-color: #edc4be; color: #a13d32; background: #fff4f2; }
.plan-version-bar { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 9px; margin-top: 16px; border-top: 1px solid #e5eeea; padding-top: 14px; }
.plan-version-bar label { min-width: 190px; flex: 1 1 220px; }
.plan-version-bar select { width: 100%; min-height: 40px; }
.plan-version-bar .secondary-button, .plan-version-bar .text-button { min-height: 40px; width: auto; margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.plan-script, .plan-shots { margin-top: 15px; border-top: 1px solid #e5eeea; padding-top: 14px; }
.plan-script > span { color: var(--muted); font-size: 10px; font-weight: 600; }
.plan-script p { margin-top: 6px; font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.plan-shot { min-width: 0; display: grid; grid-template-columns: 26px 28px minmax(0, 1fr); align-items: start; gap: 9px; margin-top: 9px; border: 1px solid #dfeae6; border-radius: var(--radius-control); padding: 13px; background: #fff; cursor: pointer; }
.plan-shot.active { border-color: #8bc8b7; background: #f0faf5; box-shadow: inset 0 0 0 1px rgba(22, 135, 121, .08); }
.plan-shot[data-status="failed"] { border-color: #e4b6b1; }
.plan-shot input { margin: 3px 0 0; accent-color: var(--accent); }
.shot-number { color: var(--accent); font-size: 11px; font-weight: 600; }
.shot-copy { min-width: 0; }
.shot-copy strong, .shot-copy small, .shot-result { display: block; overflow-wrap: anywhere; }
.shot-copy strong { font-size: 12px; line-height: 1.5; }
.shot-copy small { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.shot-result { margin-top: 7px; color: var(--blue); font-size: 10px; font-weight: 600; }
.shot-result a { color: var(--accent); }
.production-editor { margin-top: 18px; border-top: 1px solid #e5eeea; padding-top: 16px; }
.production-editor textarea { min-height: 180px; }
.production-editor .production-negative-label { margin-top: 16px; }
.production-editor .production-negative-label + textarea { min-height: 96px; }
.production-editor .field-help { margin-bottom: 0; }
.shot-audio-panel { margin-top: 18px; border-top: 1px solid #e5eeea; padding-top: 18px; }
.shot-audio-panel .section-heading { align-items: flex-start; margin-bottom: 14px; }
.shot-audio-panel .section-heading p { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.shot-audio-panel .section-heading strong { font-size: 15px; }
.shot-audio-options { display: grid; grid-template-columns: auto minmax(0, 1fr) auto minmax(120px, .6fr) auto minmax(100px, .5fr); align-items: center; gap: 8px; margin-top: 10px; }
.shot-audio-options .field-label { margin: 0; font-size: 11px; }
.shot-audio-options select { min-height: 40px; padding: 8px 30px 8px 10px; font-size: 10px; }
.shot-audio-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 12px; }
.shot-audio-actions button { margin: 0; }
.shot-audio-panel .form-message { margin: 10px 0 0; font-size: 10px; }
.asset-ready { color: var(--success); background: #edf8f0; }
.plan-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }
.plan-actions button { flex: 1 1 160px; margin: 0; }

.primary-button, .secondary-button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: var(--radius-control); padding: 0 14px; font-size: 12px; font-weight: 600; text-decoration: none; cursor: pointer; transition: border-color .2s, background .2s, box-shadow .2s, transform .2s; }
.primary-button { width: 100%; border: 1px solid var(--accent); color: #fff; background: var(--accent); box-shadow: 0 5px 12px rgba(17, 135, 122, .14); }
.primary-button:hover { border-color: var(--accent-dark); background: var(--accent-dark); box-shadow: 0 7px 16px rgba(12, 109, 99, .18); transform: translateY(-1px); }
.secondary-button { border: 1px solid var(--line-strong); color: var(--ink); background: #fff; box-shadow: 0 3px 10px rgba(39, 79, 68, .04); }
.secondary-button:hover { border-color: #8cc8b8; background: #f1faf6; }
.primary-button:disabled, .secondary-button:disabled { opacity: .55; cursor: wait; transform: none; }
.primary-button svg, .secondary-button svg { width: 17px; height: 17px; }
.secondary-button.disabled { opacity: .45; pointer-events: none; }
.form-actions { display: grid; grid-template-columns: minmax(0, 1fr) 240px; align-items: stretch; gap: 16px; margin-top: 26px; }
.form-actions .auth-panel, .form-actions #generateButton { width: 100%; min-height: 64px; height: auto; margin: 0; }
.auth-panel { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 1px solid #d9e8e2; border-radius: var(--radius-control); padding: 12px 14px; background: #f7fbf9; }
.auth-panel.authenticated { border-color: #afd0c6; background: #eef9f4; }
.auth-copy { min-width: 0; }
.auth-copy strong, .auth-copy span { display: block; overflow-wrap: anywhere; }
.auth-copy strong { font-size: 13px; }
.auth-copy span { margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.auth-state-mark { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border-radius: 50%; color: var(--accent); background: #e5f5ef; }
.auth-state-mark svg { width: 18px; height: 18px; }
.error-message { margin: 12px 0 0; border: 1px solid #efcbc7; border-radius: 12px; padding: 10px 12px; color: var(--error); background: #fff5f3; font-size: 11px; line-height: 1.55; overflow-wrap: anywhere; }
.form-message { margin: 12px 0 0; border-radius: 12px; padding: 10px 12px; font-size: 11px; line-height: 1.55; overflow-wrap: anywhere; }
.success-message { border: 1px solid #bfdbc6; color: var(--success); background: #f0f8f2; }

.output-panel { min-width: 0; border-left: 1px solid var(--line); padding: 36px 26px 44px; background: #f5f7f6; }
.output-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.output-heading h2 { font-size: 20px; }
.task-badge { min-width: max-content; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line-strong); border-radius: 999px; padding: 5px 10px; color: var(--muted); background: #f8faf9; font-size: 10px; font-weight: 600; line-height: 1.2; white-space: nowrap; }
.task-badge.running { color: var(--accent); border-color: #91c7c2; background: #eef8f7; }
.task-badge.queued { color: #5d6670; border-color: #cdd2d8; background: #f1f3f5; }
.task-badge.done { color: var(--success); border-color: #acd0ae; background: #f0f7f0; }
.task-badge.failed { color: var(--error); border-color: #dfb3af; background: #fff3f1; }
.task-badge.refunded { color: #735d26; border-color: #dbc78d; background: #fff9e9; }
.stage { position: relative; width: 100%; min-height: 360px; max-height: calc(100vh - 260px); overflow: hidden; border: 1px solid #d5e1dd; border-radius: var(--radius-card); aspect-ratio: 16 / 9; background: #111918; box-shadow: 0 10px 24px rgba(28, 53, 47, .12); }
.stage[data-ratio="21:9"] { aspect-ratio: 21 / 9; }
.stage[data-ratio="4:3"] { width: min(82%, 760px); margin-inline: auto; aspect-ratio: 4 / 3; }
.stage[data-ratio="9:16"] { width: min(72%, 460px); margin-inline: auto; aspect-ratio: 9 / 16; max-height: 660px; }
.stage[data-ratio="3:4"] { width: min(78%, 520px); margin-inline: auto; aspect-ratio: 3 / 4; max-height: 660px; }
.stage[data-ratio="1:1"] { width: min(88%, 620px); margin-inline: auto; aspect-ratio: 1; max-height: 620px; }
.stage-meta { position: absolute; z-index: 2; top: 14px; right: 14px; display: flex; gap: 6px; }
.stage-meta span { border: 1px solid rgba(255,255,255,.22); border-radius: 999px; padding: 5px 8px; color: rgba(255,255,255,.8); background: rgba(10,18,17,.56); font-size: 9px; font-weight: 600; backdrop-filter: blur(8px); }
#idleCanvas, #videoPlayer { width: 100%; height: 100%; display: block; object-fit: contain; }
#idleCanvas { opacity: .78; }
.stage-activity { position: absolute; z-index: 1; inset: 0; display: grid; place-items: center; overflow: hidden; pointer-events: none; }
.stage-activity[hidden] { display: none; }
.stage.is-generating #idleCanvas { opacity: .34; filter: saturate(.35) brightness(.72); }
.activity-field { position: relative; width: min(72%, 250px); aspect-ratio: 1; display: grid; place-items: center; }
.activity-ring { position: absolute; inset: 15%; border: 1px solid rgba(224, 228, 235, .4); border-radius: 50%; opacity: 0; transform: scale(.62); animation: siri-ring 2.8s cubic-bezier(.22, .72, .24, 1) infinite; }
.activity-ring-two { inset: 8%; border-color: rgba(188, 194, 205, .26); animation-delay: .38s; }
.activity-ring-three { inset: 0; border-color: rgba(145, 151, 163, .18); animation-delay: .76s; }
.activity-signal { position: relative; width: 42%; height: 42%; display: flex; align-items: center; justify-content: center; gap: 5%; border: 1px solid rgba(241, 243, 247, .54); border-radius: 50%; background: rgba(31, 33, 40, .56); box-shadow: 0 0 34px rgba(213, 218, 228, .14), inset 0 1px 0 rgba(255, 255, 255, .18); backdrop-filter: blur(10px); animation: siri-core 2.2s ease-in-out infinite; }
.activity-signal::before { content: ""; position: absolute; inset: 10%; border: 1px solid rgba(255, 255, 255, .1); border-radius: 50%; }
.activity-signal i { position: relative; z-index: 1; width: 5%; min-width: 2px; height: 22%; border-radius: 999px; background: #eef0f4; transform: scaleY(.42); animation: siri-wave 1.05s ease-in-out infinite; }
.activity-signal i:nth-child(2) { animation-delay: -.88s; }
.activity-signal i:nth-child(3) { animation-delay: -.72s; }
.activity-signal i:nth-child(4) { animation-delay: -.56s; }
.activity-signal i:nth-child(5) { animation-delay: -.4s; }
.activity-signal i:nth-child(6) { animation-delay: -.24s; }
.activity-signal i:nth-child(7) { animation-delay: -.08s; }
.activity-signal i:nth-child(8) { animation-delay: -.24s; }
.activity-signal i:nth-child(9) { animation-delay: -.4s; }
@keyframes siri-ring { 0% { opacity: 0; transform: scale(.58); } 18%, 48% { opacity: .86; } 78%, 100% { opacity: 0; transform: scale(1); } }
@keyframes siri-core { 0%, 100% { transform: scale(.94); box-shadow: 0 0 28px rgba(213, 218, 228, .1), inset 0 1px 0 rgba(255, 255, 255, .16); } 50% { transform: scale(1.04); box-shadow: 0 0 46px rgba(213, 218, 228, .2), inset 0 1px 0 rgba(255, 255, 255, .24); } }
@keyframes siri-wave { 0%, 100% { height: 20%; opacity: .48; transform: scaleY(.42); } 50% { height: 52%; opacity: 1; transform: scaleY(1); } }
.stage-state { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; color: #fff; text-align: center; }
.state-icon { width: 48px; height: 48px; display: grid; place-items: center; margin-bottom: 14px; border: 1px solid rgba(255,255,255,.35); border-radius: 50%; background: rgba(10,15,16,.44); }
.state-icon svg { width: 22px; height: 22px; }
.stage-state strong { font-size: 15px; }
.stage-state span { max-width: 300px; margin-top: 6px; color: rgba(255,255,255,.72); font-size: 11px; line-height: 1.55; }
.progress-track { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; overflow: hidden; background: rgba(255,255,255,.18); }
.progress-track span { display: block; width: 32%; height: 100%; background: var(--coral); animation: progress 1.4s ease-in-out infinite alternate; }
@keyframes progress { from { transform: translateX(-80%); } to { transform: translateX(290%); } }
.result-bar { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 20px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 16px 0; }
.result-copy { min-width: 0; flex: 1; }
.result-copy span, .result-copy strong, #taskId { display: block; }
.result-copy span { margin-bottom: 4px; color: var(--muted); font-size: 10px; }
.result-copy strong { max-width: 100%; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
#taskId { max-width: 100%; margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 9px; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.result-actions { flex: 0 0 auto; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.result-actions .secondary-button { min-height: 38px; padding: 0 11px; font-size: 10px; }
.output-note { display: flex; align-items: flex-start; gap: 9px; padding-top: 16px; color: var(--muted); font-size: 11px; line-height: 1.65; }
.output-note span:last-child { overflow-wrap: anywhere; }
.project-task-panel { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.project-task-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.project-task-heading > div { min-width: 0; }
.project-task-heading strong { display: block; margin-top: 4px; font-size: 13px; }
.project-task-heading .text-button { min-height: 30px; padding: 5px 7px; font-size: 10px; white-space: nowrap; }
.editor-entry-button { min-height: 42px !important; padding: 8px 14px !important; color: var(--accent-dark); background: var(--accent-soft); font-size: 11px; font-weight: 600; box-shadow: 0 4px 12px rgba(22, 135, 121, .08); }
.editor-entry-button:hover { border-color: #8fc8b8; color: #fff; background: var(--accent); box-shadow: 0 6px 16px rgba(22, 135, 121, .16); }
.project-task-heading-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.project-task-list { display: grid; gap: 7px; max-height: 154px; margin-top: 10px; overflow-y: auto; padding-right: 2px; scrollbar-gutter: stable; }
.project-task-row { min-width: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; border: 1px solid var(--line); border-radius: 11px; padding: 8px 9px; background: #fff; }
.project-task-copy { min-width: 0; flex: 1; }
.project-task-copy strong, .project-task-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-task-copy strong { font-size: 11px; }
.project-task-copy small { margin-top: 2px; color: var(--muted); font-size: 9px; line-height: 1.4; }
.project-task-copy .project-task-detail { color: #7a642e; white-space: normal; overflow-wrap: anywhere; }
.project-task-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; padding-top: 1px; }
.project-task-actions .text-button { min-height: 28px; padding: 4px 6px; font-size: 9px; }
.project-task-actions .task-badge { padding: 4px 7px; font-size: 9px; }

@media (min-width: 1221px) {
  body.studio-page, body.studio-page.studio-active { height: 100dvh; min-height: 0; overflow: hidden; }
  .app-shell { width: min(calc(100% - 40px), 1780px); height: calc(100dvh - 200px); min-height: 0; grid-template-columns: 220px minmax(0, 1fr) minmax(340px, 390px); }
  .app-shell > * { min-height: 0; }
  .workflow-nav { position: static; align-self: stretch; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
  .output-panel { overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
  .studio-content { overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
  .stage { min-height: 0; max-height: calc(100dvh - 330px); }
  .stage[data-ratio="9:16"] { width: min(72%, 300px, max(140px, calc((100dvh - 330px) * .5625))); }
}

/* The taskbar can grow when project tabs or status content change. Let the
   active workbench fill the remaining viewport instead of guessing its height. */
@media (min-width: 1221px) {
  body.studio-page.studio-active {
    display: flex;
    flex-direction: column;
  }

  body.studio-page.studio-active > .topbar,
  body.studio-page.studio-active > .workspace-taskbar {
    flex: 0 0 auto;
  }

  body.studio-page.studio-active > .app-shell {
    flex: 1 1 0;
    width: min(calc(100% - 40px), 1780px);
    height: auto;
    min-height: 0;
    margin-top: 16px;
    margin-bottom: 0;
  }
}

.history-panel { margin-top: 30px; border-top: 1px solid var(--line); padding-top: 24px; }
.history-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.history-heading h2 { font-size: 18px; }
.history-heading-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.history-heading-actions .history-close-button { position: static; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 10px; font-size: 21px; line-height: 1; background: rgba(255, 255, 255, .76); }
.history-heading-actions .history-close-button:hover { border-color: #9bcdbf; color: var(--accent-dark); background: var(--accent-soft); }
.history-empty, .history-retention { color: var(--muted); font-size: 11px; line-height: 1.6; }
.history-list { display: grid; gap: 8px; }
.history-project-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--surface); }
.history-project-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px; }
.history-project-copy { min-width: 0; flex: 1; }
.history-project-copy strong, .history-project-copy small, .history-project-copy > span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-project-copy strong { font-size: 13px; }
.history-project-copy small, .history-project-copy > span { color: var(--muted); font-size: 10px; line-height: 1.5; }
.history-project-copy small { margin-top: 4px; }
.history-project-actions { flex: 0 0 auto; display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.history-project-actions .text-button { min-height: 30px; padding: 5px 8px; font-size: 10px; white-space: nowrap; }
.history-project-actions .history-continue { color: var(--accent-dark); background: var(--accent-soft); }
.history-project-actions .history-delete { color: #a65b5b; }
.history-project-actions .history-delete:hover { color: #8f3f3f; border-color: rgba(166, 91, 91, .35); background: rgba(166, 91, 91, .08); }
.history-project-details { border-top: 1px solid var(--line); padding: 14px; background: var(--surface-soft); }
.history-model-heading, .history-detail-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--ink); font-size: 11px; }
.history-model-heading span { color: var(--muted); font-size: 10px; }
.history-model-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 7px; margin-top: 8px; }
.history-detail-empty { color: var(--muted); font-size: 10px; }
.history-model-row { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 10px; border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; background: #fff; }
.history-model-row strong, .history-model-row small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-model-row strong { font-size: 11px; }
.history-model-row small { grid-column: 1 / -1; color: var(--muted); font-size: 9px; line-height: 1.45; }
.history-model-row span { color: var(--accent-dark); font-size: 10px; white-space: nowrap; }
.history-detail-heading { margin-top: 16px; }
.history-record-list { display: grid; gap: 6px; margin-top: 8px; }
.history-detail-row { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid rgba(210, 225, 219, .72); padding: 8px 0; }
.history-detail-copy { min-width: 0; flex: 1; }
.history-detail-copy strong, .history-detail-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-detail-copy strong { font-size: 10px; }
.history-detail-copy small { margin-top: 3px; color: var(--muted); font-size: 9px; line-height: 1.45; }
.history-detail-copy .history-record-detail { color: #7a642e; white-space: normal; overflow-wrap: anywhere; }
.history-usage-action { flex: 0 0 auto; color: var(--muted); font-size: 9px; white-space: nowrap; }
.history-row { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; border: 1px solid var(--line); border-radius: var(--radius-control); padding: 12px 14px; background: var(--surface); }
.history-row-main { min-width: 0; flex: 1; }
.history-row-main strong, .history-row-main small, .history-row-main > span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-row-main strong { font-size: 12px; }
.history-row-main small, .history-row-main > span { color: var(--muted); font-size: 10px; line-height: 1.5; }
.history-row-main small { margin-top: 3px; }
.history-row-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; }
.history-row-actions .text-button { min-height: 30px; padding: 5px 8px; font-size: 10px; }
.history-retention { margin-top: 12px; }
.account-center-dialog .history-panel { margin-top: 0; border-top: 0; }
.history-dialog { width: min(760px, calc(100% - 32px)); max-height: min(860px, calc(100vh - 32px)); }
.history-dialog-content { padding: 30px; }
.history-dialog .history-panel { margin-top: 0; border-top: 0; padding-top: 0; }
.admin-history { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 24px; }
.usage-view-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 18px 0 16px; border-bottom: 1px solid var(--line); }
.usage-view-tab { min-height: 40px; border: 0; border-radius: var(--radius-control) var(--radius-control) 0 0; padding: 0 14px; color: var(--muted); background: transparent; font-size: 11px; font-weight: 600; cursor: pointer; }
.usage-view-tab:hover { color: var(--ink); background: var(--surface-soft); }
.usage-view-tab.active { color: var(--accent-dark); background: var(--accent-soft); box-shadow: inset 0 -2px 0 var(--accent); }
.usage-view-panel[hidden] { display: none; }
.usage-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.usage-toolbar label { flex: 0 0 auto; color: var(--muted); font-size: 11px; font-weight: 600; }
.usage-toolbar select { width: min(300px, 100%); min-height: 40px; padding-block: 8px; }
.usage-summary-note { margin: 0 0 14px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.employee-management { margin-top: 30px; border-top: 1px solid var(--line); padding-top: 28px; }
.team-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-top: 18px; }
.team-block { min-width: 0; }
.team-projects { grid-column: 1 / -1; }
.team-block-heading { margin-bottom: 10px; }
.team-block-heading strong, .team-block-heading small { display: block; }
.team-block-heading strong { font-size: 13px; }
.team-block-heading small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.owner-topup-heading { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 20px; }
.owner-topup-row { align-items: center; }
.owner-topup-row .admin-list-actions { min-width: 0; }
.owner-topup-row .task-badge { flex: 0 0 auto; }
.owner-topup-row .topup-approve { color: var(--accent-dark); }
.owner-topup-row .topup-reject { color: var(--error); }
.admin-list { display: grid; gap: 8px; }
.admin-list-row { min-width: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; border: 1px solid var(--line); border-radius: var(--radius-control); padding: 13px 14px; background: var(--surface-soft); }
.admin-list-row > div:first-child { min-width: 0; }
.admin-list-row strong, .admin-list-row small, .admin-list-row p { display: block; overflow-wrap: anywhere; }
.admin-list-row strong { font-size: 12px; }
.admin-list-row small, .admin-list-row p { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.employee-actions { align-items: center; }
.quota-editor { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.quota-editor input { width: 88px; min-height: 32px; padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 9px; color: var(--ink); background: #fff; font-size: 10px; }
.admin-list-actions { flex: 0 0 auto; display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.admin-list-actions .text-button { min-height: 30px; padding: 4px 7px; font-size: 10px; }
.admin-list-empty { border: 1px dashed var(--line-strong); border-radius: var(--radius-control); padding: 18px; color: var(--muted); font-size: 11px; text-align: center; }
.admin-project-row { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-control); background: #fff; }
.admin-project-row summary { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 14px; cursor: pointer; list-style: none; }
.admin-project-row summary::-webkit-details-marker { display: none; }
.admin-project-row summary > span:first-child { min-width: 0; }
.admin-project-row summary strong, .admin-project-row summary small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-project-row summary strong { font-size: 12px; }
.admin-project-row summary small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.admin-project-detail { display: grid; gap: 7px; border-top: 1px solid var(--line); padding: 12px 14px; }
.admin-project-detail p { color: #40534e; font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; }
.admin-project-detail small { color: var(--muted); font-size: 10px; line-height: 1.55; overflow-wrap: anywhere; }
.usage-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin: 14px 0 16px; }
.usage-card { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-control); padding: 13px; background: var(--surface-soft); }
.usage-card strong, .usage-card small, .usage-card span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usage-card strong { font-size: 12px; }
.usage-card small, .usage-card span { color: var(--muted); font-size: 10px; line-height: 1.5; }
.history-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-control); background: #fff; scrollbar-gutter: stable; }
.history-table { width: 100%; min-width: 1260px; border-collapse: collapse; table-layout: fixed; font-size: 10.5px; }
.history-table col.history-col-user { width: 106px; }
.history-table col.history-col-prompt { width: 300px; }
.history-table col.history-col-spec { width: 220px; }
.history-table col.history-col-token { width: 184px; }
.history-table col.history-col-cost { width: 150px; }
.history-table col.history-col-status { width: 86px; }
.history-table col.history-col-time { width: 150px; }
.history-table col.history-col-file { width: 64px; }
.history-table th, .history-table td { border-bottom: 1px solid var(--line); padding: 10px 12px; text-align: center; vertical-align: middle; }
.history-table th { color: var(--muted); background: var(--surface-soft); font-size: 10px; font-weight: 600; letter-spacing: 0; white-space: nowrap; }
.history-table tbody tr:nth-child(even) { background: #fbfdfc; }
.history-table tbody tr:hover { background: #f7fbf9; }
.history-table tr:last-child td { border-bottom: 0; }
.history-table td { line-height: 1.5; }
.history-table .admin-prompt { overflow-wrap: anywhere; }
.history-table td:nth-child(1), .history-table td:nth-child(6), .history-table td:nth-child(7), .history-table td:nth-child(8) { white-space: nowrap; }
.history-table td:nth-child(3), .history-table td:nth-child(4), .history-table td:nth-child(5) { overflow-wrap: anywhere; }
.admin-prompt-text { display: -webkit-box; overflow: hidden; color: #40534e; line-height: 1.5; text-align: left; white-space: pre-wrap; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.admin-prompt-text.expanded { display: block; overflow: visible; -webkit-line-clamp: unset; }
.history-table .admin-prompt-toggle { width: auto; min-height: 26px; margin: 7px auto 0; border: 1px solid #d7e6e1; border-radius: 9px; padding: 3px 8px; background: #fff; white-space: nowrap; }
.history-table .admin-prompt-toggle:hover { border-color: #9bcdbf; background: var(--accent-soft); }
.history-table .text-button { min-height: 28px; padding: 4px 8px; font-size: 10px; white-space: nowrap; }
.history-table button:disabled { opacity: .45; cursor: not-allowed; }
.history-table .history-empty-cell { padding: 34px 16px; color: var(--muted); text-align: center; white-space: normal; }
.model-history-table { min-width: 980px; }

.login-dialog { width: min(460px, calc(100% - 32px)); border: 1px solid var(--line); border-radius: var(--radius-panel); padding: 0; color: var(--ink); background: var(--surface); box-shadow: 0 22px 70px rgba(19, 55, 47, .20); }
.new-task-dialog { width: min(620px, calc(100% - 32px)); border-color: rgba(176, 217, 205, .92); background: rgba(249, 254, 252, .74); box-shadow: 0 30px 90px rgba(14, 81, 70, .25), inset 0 1px 0 rgba(255, 255, 255, .9); backdrop-filter: blur(26px) saturate(1.16); }
.new-task-content { padding: 28px; }
.new-task-content .dialog-heading { margin-bottom: 18px; }
.new-task-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.new-task-option { min-width: 0; display: grid; grid-template-columns: 40px minmax(0, 1fr) 20px; align-items: center; gap: 11px; border: 1px solid rgba(198, 224, 216, .92); border-radius: 18px; padding: 12px; color: var(--ink); background: rgba(255, 255, 255, .58); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .72); text-align: left; cursor: pointer; transition: border-color .22s ease, background .22s ease, transform .22s ease, box-shadow .22s ease; }
.new-task-option:hover, .new-task-option:focus-visible { border-color: #83c4b3; background: rgba(255, 255, 255, .9); box-shadow: 0 9px 22px rgba(20, 113, 96, .10), inset 0 1px 0 rgba(255, 255, 255, .92); transform: translateY(-2px); }
.new-task-option-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 14px; color: #fff; background: linear-gradient(145deg, #2f9b8b, #4f7fa1); box-shadow: 0 7px 16px rgba(22, 135, 121, .16); }
.new-task-option:nth-child(2) .new-task-option-icon { background: linear-gradient(145deg, #668b77, #4b7c70); }
.new-task-option:nth-child(3) .new-task-option-icon { background: linear-gradient(145deg, #6e879d, #52749a); }
.new-task-option-icon svg { width: 19px; height: 19px; }
.new-task-option strong, .new-task-option small { display: block; overflow-wrap: anywhere; }
.new-task-option strong { font-size: 13px; line-height: 1.35; }
.new-task-option small { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.new-task-option-arrow { color: var(--accent); font-size: 25px; font-weight: 400; line-height: 1; text-align: center; }
.new-task-secondary { display: flex; align-items: center; gap: 8px; margin-top: 15px; border-top: 1px solid rgba(210, 230, 223, .88); padding-top: 13px; }
.new-task-secondary .text-button { min-height: 30px; padding: 5px 7px; }
.new-task-secondary small { color: var(--muted); font-size: 10px; line-height: 1.45; }
.project-mode-summary { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; border: 1px solid #d9e8e2; border-radius: 14px; padding: 9px 11px; color: var(--ink); background: #f5faf8; }
.project-mode-summary-icon { width: 32px; height: 32px; flex: 0 0 32px; display: grid; place-items: center; border-radius: 11px; color: #fff; background: #24262b; }
.project-mode-summary-icon svg { width: 16px; height: 16px; }
.project-mode-summary small, .project-mode-summary strong { display: block; }
.project-mode-summary small { color: var(--muted); font-size: 9px; }
.project-mode-summary strong { margin-top: 2px; font-size: 12px; }
.register-dialog { width: min(520px, calc(100% - 32px)); }
.reset-dialog { width: min(460px, calc(100% - 32px)); }
.reset-content { padding: 30px; }
.reset-content form { padding: 0; }
.reset-content .dialog-heading { margin-bottom: 20px; }
.reset-content .form-message { margin-top: 12px; }
.account-center-dialog { width: min(700px, calc(100% - 32px)); }
.asset-library-dialog { width: min(1120px, calc(100% - 32px)); max-height: min(880px, calc(100vh - 32px)); }
.asset-library-content { padding: 30px; }
.asset-library-toolbar { display: grid; grid-template-columns: auto minmax(220px, 360px); align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.asset-type-filter { display: inline-flex; overflow: hidden; border: 1px solid var(--line-strong); border-radius: var(--radius-control); background: #fff; }
.asset-filter { min-height: 38px; border: 0; border-right: 1px solid var(--line); padding: 0 14px; color: var(--muted); background: transparent; font-size: 11px; font-weight: 600; cursor: pointer; }
.asset-filter:last-child { border-right: 0; }
.asset-filter.active { color: #fff; background: var(--ink); }
.asset-library-toolbar input { min-height: 40px; padding-block: 8px; }
.asset-library-layout { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(340px, .92fr); gap: 22px; }
.asset-library-list { display: grid; align-content: start; gap: 9px; max-height: 650px; overflow-y: auto; padding-right: 3px; scrollbar-gutter: stable; }
.asset-library-item { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 14px; border: 1px solid var(--line); border-radius: var(--radius-control); padding: 14px; background: var(--surface-soft); }
.asset-library-item-copy { min-width: 0; }
.asset-library-item-copy strong, .asset-library-item-copy small, .asset-library-item-copy p { display: block; overflow-wrap: anywhere; }
.asset-library-item-copy strong { margin-top: 5px; font-size: 13px; }
.asset-library-item-copy small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.asset-library-item-copy p { display: -webkit-box; overflow: hidden; margin-top: 8px; color: #40534e; font-size: 11px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.asset-kind { display: inline-flex; border-radius: 999px; padding: 3px 7px; color: var(--accent-dark); background: var(--accent-soft); font-size: 9px; font-weight: 600; }
.asset-library-item-actions { display: flex; flex-direction: column; gap: 5px; }
.asset-library-item-actions .secondary-button, .asset-library-item-actions .text-button { min-height: 32px; margin: 0; padding: 5px 9px; font-size: 10px; white-space: nowrap; }
.asset-editor { min-width: 0; border-left: 1px solid var(--line); padding-left: 22px; }
.asset-editor-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.asset-editor-heading .field-label, .asset-editor-heading small { display: block; }
.asset-editor-heading small { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.asset-editor-type { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.asset-editor-type .choice { min-height: 42px; padding: 9px 12px; }
.asset-editor-label { margin-top: 15px; }
.library-dropzone { min-height: 106px; }
.asset-editor-actions { display: flex; justify-content: flex-end; margin-top: 9px; }
.asset-editor-actions button { margin: 0; }
.asset-editor textarea { min-height: 90px; }
.asset-editor #libraryAssetProfile { min-height: 168px; }
.selected-assets { margin-top: 18px; border: 1px solid var(--line); border-radius: var(--radius-control); padding: 14px; background: #fbfdfc; }
.asset-selection-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.asset-selection-heading .field-label, .asset-selection-heading small { display: block; margin: 0; }
.asset-selection-heading small { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.selected-asset-list { display: grid; gap: 7px; margin-top: 10px; }
.selected-asset-item { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding-top: 9px; }
.selected-asset-item > div { min-width: 0; }
.selected-asset-item span, .selected-asset-item strong, .selected-asset-item small { display: block; }
.selected-asset-item span { color: var(--accent-dark); font-size: 9px; font-weight: 600; }
.selected-asset-item strong { margin-top: 2px; font-size: 11px; }
.selected-asset-item small { max-width: 680px; overflow: hidden; margin-top: 2px; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.login-dialog::backdrop { background: rgba(18, 31, 29, .42); backdrop-filter: blur(3px); }
.login-dialog form, .register-content { padding: 30px; }
.register-dialog form { display: grid; padding: 32px; }
.register-dialog .dialog-heading { margin-bottom: 26px; }
.register-dialog .field-label { margin-top: 16px; }
.register-dialog .field-label:first-of-type { margin-top: 0; }
.register-dialog textarea { min-height: 104px; }
.register-dialog .field-help { margin: 14px 0 0; }
.register-dialog .dialog-submit { width: 100%; margin-top: 22px; }
.register-dialog .error-message, .register-dialog .success-message { margin-top: 12px; }
.account-center-content { padding: 30px; }
.account-center-content > .dialog-heading { margin-bottom: 20px; }
.account-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.account-tab { min-height: 36px; border: 0; border-radius: 10px; padding: 6px 12px; color: var(--muted); background: transparent; font-size: 11px; font-weight: 600; cursor: pointer; }
.account-tab:hover { color: var(--ink); background: var(--surface-soft); }
.account-tab.active { color: var(--accent-dark); background: var(--accent-soft); }
.account-tab-panel { padding-top: 22px; }
.account-tab-panel form { padding: 0; }
.account-tab-panel .field-label.security-field { margin-top: 16px; }
.security-events-panel { margin-top: 26px; border-top: 1px solid var(--line); padding-top: 22px; }
.security-events-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.security-events-heading h3 { font-size: 14px; line-height: 1.4; }
.security-events-heading p { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.security-event-list { display: grid; gap: 7px; margin-top: 12px; max-height: 230px; overflow-y: auto; scrollbar-gutter: stable; }
.security-event-row { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--line); border-radius: var(--radius-control); padding: 10px 12px; background: var(--surface-soft); }
.security-event-row > div { min-width: 0; }
.security-event-row strong, .security-event-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.security-event-row strong { font-size: 11px; }
.security-event-row small, .security-event-row > span { color: var(--muted); font-size: 9px; line-height: 1.45; }
.security-event-row > span { flex: 0 0 auto; white-space: nowrap; }
.security-empty { color: var(--muted); font-size: 10px; line-height: 1.6; }
.revoke-sessions-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(150px, 190px) auto; align-items: end; gap: 10px; margin-top: 18px; border: 1px solid var(--line); border-radius: var(--radius-control); padding: 13px; background: #fbfdfc; }
.revoke-sessions-form > div { min-width: 0; }
.revoke-sessions-form strong, .revoke-sessions-form small { display: block; }
.revoke-sessions-form strong { font-size: 11px; }
.revoke-sessions-form small { margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.45; }
.revoke-sessions-form input { min-width: 0; min-height: 38px; }
.revoke-sessions-form button { min-height: 38px; margin: 0; white-space: nowrap; }
.revoke-sessions-form .form-message { grid-column: 1 / -1; margin: 0; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.dialog-heading h2 { font-size: 23px; line-height: 1.35; }
.secret-field { position: relative; }
.secret-field input { padding-right: 50px; }
.icon-button { position: absolute; top: 5px; right: 5px; width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 10px; color: var(--muted); background: transparent; cursor: pointer; }
.icon-button:hover { color: var(--ink); background: var(--surface-soft); }
.icon-button svg { width: 18px; height: 18px; }
.dialog-close { position: static; width: 34px; height: 34px; flex: 0 0 34px; font-size: 22px; line-height: 1; }
.dialog-submit { margin-top: 20px; }
.register-state { display: flex; align-items: flex-start; gap: 13px; border: 1px solid var(--line); border-radius: var(--radius-card); padding: 16px; background: var(--surface-soft); }
.register-state > div { min-width: 0; }
.register-state strong { display: block; font-size: 13px; }
.register-state p { margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.65; overflow-wrap: anywhere; }

.admin-workspace { min-height: calc(100vh - 72px); display: grid; place-items: start center; padding: 32px 24px 42px; background: var(--canvas); }
.admin-panel { width: min(1360px, 100%); border: 1px solid var(--line); border-radius: var(--radius-panel); padding: 38px; background: var(--surface); box-shadow: var(--shadow-panel); }
.admin-panel.admin-locked { width: min(620px, 100%); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.admin-heading { align-items: flex-start; margin-bottom: 30px; }
.admin-heading h1 { font-size: 30px; line-height: 1.3; }
.admin-lead { max-width: 620px; margin-top: 9px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.security-mark { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; border-radius: 50%; color: var(--accent); background: var(--accent-soft); }
.security-mark svg { width: 21px; height: 21px; }
#loginForm { width: min(480px, 100%); }
.admin-panel.admin-locked #loginForm { margin-top: 8px; }
.admin-session-check { display: grid; justify-items: center; gap: 10px; padding: 16px 0 4px; text-align: center; }
.admin-session-check .security-mark { margin-bottom: 5px; }
.admin-session-check > p:not(.error-message) { color: var(--muted); font-size: 11px; }
.admin-session-check .admin-action { min-width: 150px; margin-top: 8px; text-decoration: none; }
.role-editor { display: grid; gap: 4px; }
.role-editor span { color: var(--muted); font-size: 9px; }
.role-editor select { min-height: 32px; border-radius: 10px; padding: 4px 28px 4px 8px; font-size: 10px; }
.admin-action { margin-top: 20px; }
.key-manager { border-top: 0; padding-top: 0; }
.admin-console-tabs { display: flex; gap: 8px; margin: 0 0 26px; border-bottom: 1px solid var(--line); }
.admin-console-tab, .admin-section-tab { min-height: 42px; border: 0; border-radius: var(--radius-control) var(--radius-control) 0 0; padding: 0 16px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 600; cursor: pointer; }
.admin-console-tab:hover, .admin-section-tab:hover { color: var(--ink); background: var(--surface-soft); }
.admin-console-tab.active, .admin-section-tab.active { color: var(--accent-dark); background: var(--accent-soft); box-shadow: inset 0 -2px 0 var(--accent); }
.admin-reauth-dialog { width: min(470px, calc(100% - 32px)); border-radius: 28px; }
.admin-reauth-dialog form { padding: 30px; }
.reauth-copy { margin: -8px 0 22px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.audit-help { margin: -8px 0 18px; }
.audit-table { min-width: 920px; }
.audit-table th:nth-child(1) { width: 150px; }
.audit-table th:nth-child(2) { width: 150px; }
.audit-table th:nth-child(3) { width: 110px; }
.audit-table th:nth-child(4) { width: 180px; }
.audit-table th:nth-child(5) { width: 80px; }
.audit-table td { overflow-wrap: anywhere; }
.admin-console-panel[hidden], .admin-section-panel[hidden] { display: none; }
.console-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 0 0 20px; }
.console-heading > div { min-width: 0; }
.console-heading > div span, .console-heading > div strong { display: block; overflow-wrap: anywhere; }
.console-heading > div span { color: var(--accent); font-size: 10px; font-weight: 600; }
.console-heading > div strong { margin-top: 5px; font-size: 18px; }
.admin-section-tabs { display: flex; gap: 8px; margin: 0 0 24px; border-bottom: 1px solid var(--line); }
.team-wallet { margin: 0 0 24px; border: 1px solid #cfe4dc; border-radius: var(--radius-control); padding: 18px; background: #f4fbf8; }
.team-wallet-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.team-wallet-heading span:first-child, .team-wallet-heading strong { display: block; }
.team-wallet-heading span:first-child { color: var(--accent); font-size: 10px; font-weight: 600; }
.team-wallet-heading strong { margin-top: 5px; font-size: 17px; }
.team-wallet-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.team-wallet-summary > div { min-width: 0; border: 1px solid #dcece6; border-radius: 10px; padding: 11px 12px; background: #fff; }
.team-wallet-summary span, .team-wallet-summary strong { display: block; overflow-wrap: anywhere; }
.team-wallet-summary span { color: var(--muted); font-size: 10px; }
.team-wallet-summary strong { margin-top: 5px; font-size: 14px; }
.team-wallet-actions { margin-top: 12px; }
.team-wallet-actions .field-help { margin: 0; }
.allocation-editor { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.allocation-editor input { width: 76px; min-height: 32px; padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 9px; color: var(--ink); background: #fff; font-size: 10px; }
.team-editor { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.team-editor select { min-height: 32px; max-width: 120px; padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 9px; color: var(--ink); background: #fff; font-size: 10px; }
.owner-team-tools { margin: 0 0 24px; border-top: 1px solid var(--line); padding-top: 18px; }
.create-team-form { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.create-team-form input, .create-team-form select { min-height: 36px; min-width: 180px; border: 1px solid var(--line-strong); border-radius: 9px; padding: 7px 10px; background: #fff; color: var(--ink); font-size: 11px; }
.owner-team-row { margin-top: 8px; }
.admin-page [hidden] { display: none !important; }
.model-manager { display: grid; grid-template-columns: minmax(300px, 360px) minmax(0, 1fr); gap: 22px 30px; }
.model-manager > .section-heading { grid-column: 1 / -1; margin-bottom: 0; border-top: 1px solid var(--line); padding-top: 26px; }
.section-heading > div { min-width: 0; }
.section-heading > div span, .section-heading > div strong { display: block; overflow-wrap: anywhere; }
.section-heading > div span { color: var(--accent); font-size: 10px; font-weight: 600; }
.section-heading > div strong { margin-top: 5px; font-size: 17px; }
.section-badge { flex: 0 0 auto; border-radius: 999px; padding: 6px 10px; color: var(--accent-dark); background: var(--accent-soft); font-size: 10px; font-weight: 600; }
.model-list { min-width: 0; display: grid; align-content: start; gap: 10px; }
.model-row { min-width: 0; display: flex; align-items: flex-start; flex-direction: column; gap: 12px; border: 1px solid #dfeae6; border-radius: var(--radius-control); padding: 15px; background: #fbfdfc; }
.model-row > div:first-child { min-width: 0; width: 100%; }
.model-row strong, .model-row small { display: block; overflow-wrap: anywhere; }
.model-row strong { font-size: 13px; line-height: 1.45; }
.model-row small { margin-top: 5px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.model-row-actions { width: 100%; display: flex; align-items: center; justify-content: flex-start; flex-wrap: wrap; gap: 8px; }
.model-row-actions .text-button { width: auto; min-height: 32px; margin: 0; border-radius: 9px; padding: 5px 8px; font-size: 10px; }
.model-row-actions .text-button:hover { background: #edf6f2; }
.model-row-actions .model-default { border: 1px solid #71b6a4; color: #176f62; background: #fff; box-shadow: inset 0 0 0 1px rgba(113, 182, 164, .12); }
.model-row-actions .model-default:hover { border-color: #2e8f7c; color: #125d52; background: #e8f6f1; box-shadow: 0 4px 12px rgba(22, 135, 121, .12); }
.model-row.is-default { border-color: #76c7b4; box-shadow: 0 7px 20px rgba(22, 135, 121, .1), inset 0 0 0 1px rgba(118, 199, 180, .16); }
.model-row-actions .model-default.is-current, .model-row-actions .model-default.is-current:disabled { border-color: #167b6d; color: #fff; background: #167b6d; box-shadow: 0 5px 13px rgba(22, 123, 109, .22); cursor: default; opacity: 1; }
.model-form { min-width: 0; border: 1px solid #dfeae5; border-radius: var(--radius-card); padding: 24px; background: #fff; box-shadow: var(--shadow-card); }
.model-form .model-preset-button { display: block; margin: 0 0 20px auto; border: 1px solid var(--line-strong); background: var(--surface-soft); }
.ecommerce-sequence-option { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; }
.ecommerce-sequence-option input { width: 17px; height: 17px; flex: 0 0 17px; accent-color: var(--accent); }
.ecommerce-sequence-option strong, .ecommerce-sequence-option small { display: block; line-height: 1.45; }
.ecommerce-sequence-option strong { font-size: 11px; }
.ecommerce-sequence-option small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.ecommerce-sequence-option:has(input:disabled) { opacity: .65; cursor: not-allowed; }
.model-form .field-label:not(:first-child) { margin-top: 17px; }
.capability-grid { min-width: 0; display: grid; grid-template-columns: minmax(130px, .65fr) minmax(0, 1.35fr); gap: 12px 16px; margin-top: 20px; border-radius: var(--radius-control); padding: 18px; background: var(--surface-soft); }
.capability-grid .field-label { align-self: center; margin: 0; }
.capability-grid input, .capability-grid select { min-width: 0; }
.workflow-capability-options { min-width: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.workflow-capability-options label { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: #fff; cursor: pointer; }
.workflow-capability-options input { width: 15px; min-height: 15px; accent-color: var(--accent); }
.workflow-capability-options span { font-size: 11px; font-weight: 600; }
.pricing-help { grid-column: 1 / -1; margin: 2px 0 0; color: var(--muted); font-size: 11px; line-height: 1.65; }
.capability-toggles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.toggle-row { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 20px 0; cursor: pointer; }
.capability-toggles .toggle-row { margin: 16px 0 0; border: 1px solid var(--line); border-radius: var(--radius-control); padding: 13px; }
.toggle-row > span:first-child { min-width: 0; }
.toggle-row strong, .toggle-row small { display: block; overflow-wrap: anywhere; }
.toggle-row strong { font-size: 12px; }
.toggle-row small { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.toggle-row input { position: absolute; opacity: 0; pointer-events: none; }
.toggle { width: 42px; height: 24px; flex: 0 0 42px; border-radius: 999px; padding: 3px; background: #c8d2ce; transition: background .2s; }
.toggle::after { content: ""; width: 18px; height: 18px; display: block; border-radius: 50%; background: #fff; transition: transform .2s; }
.toggle-row input:checked + .toggle { background: var(--accent); }
.toggle-row input:checked + .toggle::after { transform: translateX(18px); }
.model-manager > #resetModelButton { grid-column: 1; grid-row: 3; align-self: start; margin: 0; border: 1px dashed #bed3cc; background: #f7fbf9; }
.text-button { min-height: 40px; border: 0; border-radius: var(--radius-control); padding: 8px 12px; color: var(--muted); background: transparent; font-size: 11px; font-weight: 600; cursor: pointer; }
.text-button:hover { color: var(--ink); background: var(--surface-soft); }
#lockButton { max-width: 180px; display: block; margin: 28px auto 0; }
.admin-security-note { display: flex; align-items: flex-start; gap: 9px; margin-top: 28px; border-top: 1px solid var(--line); padding-top: 18px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.admin-security-note svg { width: 17px; height: 17px; flex: 0 0 17px; margin-top: 1px; }

@media (min-width: 1221px) {
  html, body { overflow-x: clip; }
  .output-panel { border-left: 1px solid var(--line); padding: 28px 22px 36px; }
  .studio-content { padding-inline: clamp(28px, 3vw, 54px); }
  .output-panel .stage[data-ratio="3:4"] { width: min(78%, 260px); }
  .output-panel .stage[data-ratio="1:1"] { width: min(88%, 300px); }
}

@media (max-width: 1220px) and (min-width: 901px) {
  html, body { overflow-x: clip; }
  .app-shell { width: min(calc(100% - 40px), 1780px); min-height: calc(100dvh - 188px); display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 36%); align-items: stretch; overflow: hidden; }
  .workflow-nav { display: none; }
  .studio-content, .output-panel { min-width: 0; margin-left: 0; }
  .studio-content { padding: 38px clamp(28px, 4vw, 48px) 56px; }
  .mode-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .output-panel { border-top: 0; border-left: 1px solid var(--line); padding: 30px 22px 42px; }
  .output-panel .stage { width: min(100%, 420px); min-height: 260px; max-height: 560px; margin-inline: auto; }
  .output-panel .stage[data-ratio="9:16"] { width: min(80%, 330px); }
  .output-panel .stage[data-ratio="3:4"] { width: min(88%, 370px); }
  .output-panel .stage[data-ratio="1:1"] { width: min(100%, 400px); }
}

@media (max-width: 1000px) {
  .project-bar { grid-template-columns: 1fr minmax(220px, 1fr); }
  .project-bar .secondary-button { grid-column: 2; justify-self: end; }
  .mode-grid { grid-template-columns: 1fr; }
  .mode-card { min-height: 0; display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: start; }
  .mode-tag { align-self: center; margin-top: 0; }
  .spec-layout { grid-template-columns: 1fr; gap: 16px; }
  .spec-summary { margin-top: 0; }
}

@media (min-width: 761px) and (max-width: 900px) {
  html, body { overflow-x: clip; }
  .app-shell { width: min(calc(100% - 40px), 1780px); display: grid; grid-template-columns: minmax(0, 1fr); overflow: hidden; }
  .workflow-nav { display: none; }
  .studio-content, .output-panel { min-width: 0; margin-left: 0; }
  .studio-content { padding: 38px clamp(30px, 5vw, 46px) 54px; }
  .output-panel { border-top: 1px solid var(--line); border-left: 0; padding: 36px clamp(30px, 5vw, 46px) 48px; }
  .output-panel .stage { width: min(100%, 640px); min-height: 260px; max-height: 620px; margin-inline: auto; }
  .output-panel .stage[data-ratio="9:16"] { width: min(52%, 390px); }
  .output-panel .stage[data-ratio="3:4"] { width: min(66%, 470px); }
  .output-panel .stage[data-ratio="1:1"] { width: min(78%, 540px); }
}

@media (max-width: 760px) {
  html, body { overflow-x: clip; }
  .topbar { position: relative; z-index: 30; min-height: 64px; height: auto; padding: 12px 20px; }
  .workspace-taskbar { position: relative; top: auto; padding: 8px 0 0; background: var(--canvas); }
  .workspace-taskbar-inner { width: calc(100% - 28px); min-height: 58px; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 10px; border-radius: 18px; padding: 7px 9px 9px 11px; }
  .workspace-taskbar-heading { min-width: 104px; gap: 7px; }
  .workspace-taskbar-icon { width: 30px; height: 30px; flex-basis: 30px; border-radius: 10px; }
  .workspace-taskbar-icon svg { width: 14px; height: 14px; }
  .workspace-taskbar-hint { display: none; }
  .workspace-taskbar-actions { justify-self: end; }
  .workspace-history-toggle { min-height: 34px; padding-inline: 9px; }
  .workspace-tab-list { grid-column: 1 / -1; grid-row: 2; gap: 6px; }
  .workspace-tab { min-width: 142px; max-width: 190px; }
  .workspace-history-host { top: calc(100% + 6px); width: calc(100% - 28px); max-height: min(70dvh, 620px); border-radius: 20px; padding: 16px; }
  .workspace-history-host .history-heading { top: -16px; margin: -16px -16px 12px; padding: 15px 16px 12px; }
  .header-account { gap: 8px; }
  .header-usage { display: none; }
  .header-account-copy { display: none; }
  .header-account-menu summary { padding-right: 4px; }
  .header-menu-panel { right: -4px; }
  .app-shell { display: grid; width: 100%; min-height: 0; grid-template-columns: 1fr; margin: 0; border: 0; border-radius: 0; box-shadow: none; overflow: visible; }
  .workflow-nav, .studio-content, .output-panel { grid-column: 1; grid-row: auto; }
  .workflow-nav { position: static; width: auto; height: auto; max-height: none; overflow: visible; border-right: 0; border-bottom: 1px solid var(--line); padding: 22px 24px; }
  .account-card { max-width: 460px; }
  .step-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .step-item { grid-template-columns: 24px minmax(0, 1fr); }
  .step-item i { display: none; }
  .nav-footer { margin-top: 20px; }
  .studio-content, .output-panel { margin-left: 0; }
  .studio-content { padding: 38px 24px 54px; }
  .output-panel { border-top: 1px solid var(--line); border-left: 0; padding: 32px 24px 44px; }
  .stage { min-height: 0; max-height: none; }
  .admin-workspace { padding: 24px; }
  .admin-panel { padding: 30px 24px; }
  .model-manager { grid-template-columns: 1fr; }
  .model-manager > .section-heading, .model-manager > #resetModelButton { grid-column: 1; grid-row: auto; }
  .asset-library-layout { grid-template-columns: 1fr; }
  .asset-editor { border-top: 1px solid var(--line); border-left: 0; padding-top: 22px; padding-left: 0; }
  .asset-library-list { max-height: 360px; }
}

/* Mode lobby and post-production handoff */
.header-workspace-nav { display: flex; align-items: center; gap: 5px; margin-left: auto; }
.header-workspace-button { min-height: 38px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid transparent; border-radius: 12px; padding: 0 11px; color: var(--muted); background: transparent; font-size: 11px; font-weight: 600; text-decoration: none; cursor: pointer; }
.header-workspace-button svg { width: 15px; height: 15px; }
.header-workspace-button:hover, .header-workspace-button.active { border-color: #c6e2d8; color: var(--accent-dark); background: var(--accent-soft); }
.mode-gateway { position: fixed; z-index: 20; inset: 72px 0 0; display: grid; place-items: center; overflow-x: hidden; overflow-y: auto; padding: clamp(34px, 7vh, 90px) clamp(20px, 5vw, 72px); isolation: isolate; background: #2a8c83; }
.mode-gateway::before { content: ""; position: absolute; z-index: -2; inset: -24px; background: url("/login-water-bg.jpg?v=20260829-01") center / cover no-repeat; filter: blur(13px); transform: scale(1.04); }
.mode-gateway::after { content: ""; position: absolute; z-index: -1; inset: 0; background: rgba(14, 91, 85, .42); }
.mode-gateway-grid { width: min(1240px, 100%); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(16px, 1.8vw, 26px); }
.mode-entry-card { position: relative; min-width: 0; min-height: 0; aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 15px; border: 1px solid rgba(255, 255, 255, .52); border-radius: 28px; padding: clamp(24px, 2.5vw, 34px); color: #fff; background: rgba(255, 255, 255, .17); box-shadow: 0 24px 70px rgba(4, 54, 51, .2), inset 0 1px 0 rgba(255, 255, 255, .25); text-align: center; backdrop-filter: blur(18px); cursor: pointer; transition: transform .35s ease, background .35s ease, border-color .35s ease, box-shadow .35s ease; }
.mode-entry-card:hover, .mode-entry-card:focus-visible { border-color: rgba(255, 255, 255, .86); background: rgba(255, 255, 255, .28); box-shadow: 0 28px 80px rgba(4, 54, 51, .28), inset 0 1px 0 rgba(255, 255, 255, .34); transform: translateY(-7px); }
.mode-entry-number { position: absolute; top: clamp(22px, 2.5vw, 34px); left: clamp(24px, 2.5vw, 34px); color: rgba(255, 255, 255, .72); font-size: 11px; font-weight: 600; letter-spacing: .08em; }
.mode-entry-icon { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 36%; color: #fff; font-size: 24px; box-shadow: 0 10px 24px rgba(4, 54, 51, .16); }
.mode-entry-icon svg { width: 30px; height: 30px; }
.mode-entry-copy { width: 100%; min-width: 0; margin-top: 2px; }
.mode-entry-copy strong, .mode-entry-copy small { display: block; overflow-wrap: anywhere; }
.mode-entry-copy strong { font-size: 25px; line-height: 1.25; }
.mode-entry-copy small { max-width: 240px; margin-top: 9px; color: rgba(255, 255, 255, .78); font-size: 12px; line-height: 1.7; }
.mode-entry-arrow { margin-top: 8px; border-bottom: 1px solid rgba(255, 255, 255, .56); padding-bottom: 3px; color: #fff; font-size: 11px; font-weight: 600; }
.mode-gateway[hidden] { display: none; }
.workspace-taskbar { display: none; }
body.studio-active .workspace-taskbar { display: block; }
.mode-gateway-active { min-height: 100vh; overflow: hidden; background: #2a8c83; }
.studio-active { overflow: auto; background: var(--canvas); }
.studio-active .mode-section { margin-bottom: 6px; border-top: 0; padding-top: 0; }
.studio-active .mode-section .section-title, .studio-active .mode-section .mode-notice { display: none; }
.studio-active .mode-grid { display: flex; gap: 8px; overflow-x: auto; padding: 2px 1px 7px; scrollbar-width: none; }
.studio-active .mode-grid::-webkit-scrollbar { display: none; }
.studio-active .mode-card { min-height: 58px; flex: 1 0 150px; display: grid; grid-template-columns: 30px minmax(0, 1fr); align-items: center; gap: 8px; border-radius: 16px; padding: 9px 11px; }
.studio-active .mode-icon { width: 30px; height: 30px; border-radius: 10px; font-size: 14px; }
.studio-active .mode-icon svg { width: 16px; height: 16px; }
.studio-active .mode-card-copy strong { font-size: 12px; }
.studio-active .mode-card-copy small, .studio-active .mode-tag { display: none; }
.studio-active .mode-card:hover { transform: translateY(-1px); }
.studio-active .mode-section { animation: mode-strip-arrive .5s cubic-bezier(.2, .8, .2, 1) both; }
.studio-active .app-shell { animation: studio-arrive .42s ease both; }
.project-task-heading .editor-entry-button { display: none; }
.edit-handoff-panel { margin-top: 18px; border: 1px solid #b9ded3; border-radius: 22px; padding: 17px; background: #effaf5; box-shadow: 0 12px 28px rgba(22, 135, 121, .08); }
.edit-handoff-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.edit-handoff-heading h3 { margin-top: 2px; font-size: 16px; }
.edit-handoff-state { border-radius: 999px; padding: 4px 8px; color: var(--accent-dark); background: #d9f1e8; font-size: 9px; font-weight: 600; white-space: nowrap; }
.edit-primary-entry { display: block; margin-top: 14px; border-radius: 15px; padding: 13px 14px; color: #fff; background: var(--accent); box-shadow: 0 8px 18px rgba(22, 135, 121, .17); text-decoration: none; transition: transform .2s ease, background .2s ease, box-shadow .2s ease; }
.edit-primary-entry:hover { background: var(--accent-dark); box-shadow: 0 11px 24px rgba(15, 111, 100, .23); transform: translateY(-2px); }
.edit-primary-entry > span { display: flex; align-items: center; gap: 8px; }
.edit-primary-entry svg { width: 16px; height: 16px; }
.edit-primary-entry strong, .edit-primary-entry small { display: block; }
.edit-primary-entry strong { font-size: 12px; }
.edit-primary-entry small { margin: 4px 0 0 24px; color: rgba(255, 255, 255, .78); font-size: 10px; line-height: 1.45; }
.edit-tool-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin-top: 9px; }
.edit-tool-grid a { min-width: 0; display: flex; align-items: flex-start; gap: 7px; border: 1px solid #cce5dc; border-radius: 12px; padding: 9px 8px; color: var(--ink); background: rgba(255, 255, 255, .72); text-decoration: none; transition: border-color .2s, background .2s, transform .2s; }
.edit-tool-grid a:hover { border-color: #86c7b4; background: #fff; transform: translateY(-1px); }
.edit-tool-grid svg { width: 15px; height: 15px; flex: 0 0 15px; margin-top: 1px; color: var(--accent); }
.edit-tool-grid span, .edit-tool-grid strong, .edit-tool-grid small { min-width: 0; display: block; }
.edit-tool-grid strong { font-size: 10px; line-height: 1.35; }
.edit-tool-grid small { margin-top: 3px; color: var(--muted); font-size: 9px; line-height: 1.35; }
@keyframes studio-arrive { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes mode-strip-arrive { from { opacity: 0; transform: translateY(-18px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

@media (max-width: 1040px) and (min-width: 761px) {
  .mode-gateway-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .header-workspace-nav { gap: 2px; }
  .header-workspace-button { min-height: 34px; padding-inline: 7px; font-size: 10px; }
  .header-workspace-button svg { width: 14px; height: 14px; }
  .mode-gateway { inset: 64px 0 0; place-items: start center; padding: 28px 18px 40px; }
  .mode-gateway-grid { grid-template-columns: 1fr; gap: 12px; }
  .mode-entry-card { min-height: 145px; aspect-ratio: auto; display: grid; grid-template-columns: 28px 42px minmax(0, 1fr) auto; grid-template-rows: minmax(54px, auto); align-items: center; column-gap: 14px; row-gap: 0; border-radius: 24px; padding: 18px; text-align: left; }
  .mode-entry-number { position: static; grid-column: 1; grid-row: 1; align-self: center; line-height: 1; }
  .mode-entry-icon { width: 42px; height: 42px; grid-column: 2; grid-row: 1; align-self: center; border-radius: 36%; font-size: 18px; }
  .mode-entry-icon svg { width: 22px; height: 22px; }
  .mode-entry-copy { grid-column: 3; grid-row: 1; align-self: center; display: flex; flex-direction: column; justify-content: center; margin-top: 0; }
  .mode-entry-copy strong { font-size: 18px; line-height: 1.25; }
  .mode-entry-copy small { max-width: none; margin-top: 4px; font-size: 11px; line-height: 1.45; }
  .mode-entry-arrow { grid-column: 4; grid-row: 1; align-self: center; justify-self: end; margin-top: 0; line-height: 1.3; }
  .edit-tool-grid { grid-template-columns: 1fr; }
  .studio-active .workflow-nav { display: none; }
  .studio-active .studio-content { padding-top: 28px; }
  .studio-active .mode-grid { overflow: visible; }
  .studio-active .mode-card { min-width: 0; flex: 1 1 0; grid-template-columns: 24px minmax(0, 1fr); padding-inline: 8px; }
  .studio-active .mode-icon { width: 24px; height: 24px; border-radius: 8px; font-size: 12px; }
  .studio-active .mode-icon svg { width: 14px; height: 14px; }
  .studio-active .mode-card-copy strong { font-size: 10px; white-space: nowrap; }
}

/* Keep the galaxy visible in the tall narrow gateway. The desktop crop is
   too wide for this layout, so use the image height as the stable reference
   and let the cards sit on a lighter glass layer. */
@media (max-width: 760px) {
  .mode-gateway::before {
    display: block;
    background-position: 46% 68%;
    background-size: auto 145%;
  }
  .mode-gateway {
    background-position: center, 50% 52%;
    background-size: cover, auto 135%;
  }
  .mode-gateway::after { background: rgba(4, 5, 8, .08); }
  .mode-entry-card {
    border-color: rgba(255, 255, 255, .3);
    background: rgba(20, 22, 28, .44);
    backdrop-filter: blur(15px) saturate(.78);
  }
}

body[data-entry-tool="audio"] .editor-inspector, body[data-entry-tool="caption"] .editor-inspector { box-shadow: inset 0 3px 0 var(--accent); }
body[data-entry-tool="ai-edit"] .ai-edit-button { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 4px rgba(22, 135, 121, .1); }

@media (max-width: 600px) {
  .studio-page .header-workspace-button span { display: none; }
  .studio-page .header-workspace-button { width: 32px; justify-content: center; padding: 0; }
  .mode-entry-card { grid-template-columns: 24px 42px minmax(0, 1fr) auto; column-gap: 10px; padding-inline: 16px; }
}

@media (max-width: 420px) {
  .studio-page .topbar { padding-inline: 14px; }
  .studio-page .brand-copy { display: none; }
}

/* Commercial registration surface */
.register-dialog { width: min(860px, calc(100% - 32px)); max-height: min(90dvh, 760px); overflow: auto; padding: 0; }
.register-shell { display: grid; grid-template-columns: minmax(250px, .78fr) minmax(420px, 1.22fr); }
.register-aside { min-width: 0; display: flex; flex-direction: column; padding: 34px; color: #f5f6f8; background: #17191e; }
.register-aside-icon { width: 46px; height: 46px; display: grid; place-items: center; margin-bottom: 38px; border: 1px solid rgba(255,255,255,.16); border-radius: 15px; color: #fff; background: rgba(255,255,255,.08); }
.register-aside-icon svg { width: 22px; height: 22px; }
.register-aside .eyebrow { color: #8ccdc1; }
.register-aside h2 { max-width: 240px; font-size: 24px; line-height: 1.35; }
.register-aside > div > p:last-child { margin-top: 10px; color: #aeb2b9; font-size: 11px; line-height: 1.7; }
.register-steps { display: grid; gap: 18px; margin: auto 0 0; padding: 32px 0 0; list-style: none; }
.register-steps li { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; gap: 11px; color: #858a92; }
.register-steps li b { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid #464a51; border-radius: 9px; font-size: 10px; }
.register-steps li strong, .register-steps li small { display: block; }
.register-steps li strong { font-size: 11px; }
.register-steps li small { margin-top: 2px; font-size: 9px; }
.register-steps li.active { color: #f5f6f8; }
.register-steps li.active b { border-color: #64ad9f; color: #102824; background: #84c8bb; }
.register-shell > form { min-width: 0; padding: 34px; background: #fff; }
.register-shell .dialog-heading { margin-bottom: 24px; }
.register-shell .dialog-heading > div > p:last-child { margin-top: 5px; color: var(--muted); font-size: 10px; }
.register-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.register-field-grid label { min-width: 0; }
.register-field-grid .field-label { margin: 0 0 7px; }
.register-password-help, .register-review-note { margin-top: 7px; color: var(--muted); font-size: 9px; line-height: 1.55; }
.register-consent { display: flex; align-items: flex-start; gap: 8px; margin-top: 18px; color: #666b72; font-size: 10px; line-height: 1.55; }
.register-consent input { width: 15px; height: 15px; flex: 0 0 15px; margin: 1px 0 0; accent-color: #137d72; }
.register-consent a { color: #176b63; font-weight: 600; text-decoration: none; }
.register-shell .dialog-submit { width: 100%; min-height: 46px; margin-top: 18px; border-radius: 13px; }
.register-review-note { text-align: center; }

@media (max-width: 720px) {
  .register-dialog { width: min(540px, calc(100% - 22px)); }
  .register-shell { grid-template-columns: 1fr; }
  .register-aside { display: none; }
  .register-shell > form { padding: 25px 20px; }
  .register-field-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .auth-gateway { padding: 20px 14px; background-position: 56% center; }
  .gateway-panel { border-radius: 26px; padding: 25px 20px 20px; }
  .gateway-brand { margin-bottom: 24px; }
  .gateway-heading h1 { font-size: 25px; }
}

@media (max-width: 760px) {
  .shot-audio-options { grid-template-columns: 1fr 1fr; }
  .shot-audio-options .field-label { margin-top: 4px; }
  .asset-groups { grid-template-columns: 1fr; }
  .asset-group-wide { grid-column: auto; }
  .asset-row { grid-template-columns: 1fr auto; }
  .asset-row textarea { grid-column: 1 / -1; }
  .asset-row .asset-url-input { grid-column: 1 / -1; }
  .plan-editor-grid { grid-template-columns: 1fr; }
  .plan-field-wide { grid-column: auto; }
  .plan-version-bar { align-items: stretch; }
  .plan-version-bar label, .plan-version-bar .secondary-button, .plan-version-bar .text-button { width: 100%; }
  .reference-source-grid { grid-template-columns: 1fr; }
  .reference-creative-card { grid-template-columns: 1fr; align-items: stretch; }
  .reference-analyze-button { width: 100%; min-width: 0; }
  .project-bar { grid-template-columns: 1fr; align-items: stretch; }
  .project-bar .secondary-button { grid-column: 1; justify-self: stretch; }
  .content-heading { flex-direction: column; }
  .quota-chip { align-self: flex-start; }
  .duration-row { grid-template-columns: 1fr; gap: 10px; }
  .resolution-row { grid-template-columns: 1fr; align-items: stretch; }
  .resolution-row .field-label { margin-bottom: 0; }
  .format-badge { justify-self: start; }
  .form-actions { grid-template-columns: 1fr; }
  .result-bar { align-items: stretch; flex-direction: column; }
  .result-actions { width: 100%; }
  .result-actions .secondary-button { flex: 1; }
  .capability-grid { grid-template-columns: 1fr; }
  .capability-grid .field-label { margin: 4px 0 -4px; }
  .history-row { align-items: stretch; flex-direction: column; }
  .history-row-actions { width: 100%; justify-content: flex-end; }
  .history-project-summary { align-items: stretch; flex-direction: column; gap: 10px; }
  .history-project-actions { justify-content: flex-end; }
  .history-detail-row { align-items: flex-start; flex-direction: column; }
  .history-detail-row .history-row-actions { width: 100%; }
  .team-grid { grid-template-columns: 1fr; }
  .team-projects { grid-column: 1; }
  .admin-list-row { flex-direction: column; }
  .admin-list-actions { width: 100%; justify-content: flex-start; }
  .owner-topup-row .admin-list-actions { align-items: center; }
  .usage-toolbar { align-items: stretch; flex-direction: column; }
  .usage-toolbar select { width: 100%; }
  .asset-library-toolbar { grid-template-columns: 1fr; }
  .asset-library-item { grid-template-columns: 1fr; }
  .asset-library-item-actions { flex-direction: row; flex-wrap: wrap; }
  .asset-selection-heading { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 760px) {
  .new-task-content { padding: 24px 20px; }
}

@media (max-width: 900px) {
  .topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; justify-content: initial; gap: 10px; }
  .brand { grid-column: 1; min-width: 0; }
  .header-workspace-nav { grid-column: 2; order: initial; margin-left: 0; }
  .header-account { grid-column: 3; order: initial; justify-self: end; margin-left: 0; }
}

@media (max-width: 600px) {
  .brand-copy small { display: none; }
  .header-link { min-height: 36px; padding: 0 8px; font-size: 11px; }
  .workflow-nav { padding-inline: 16px; }
  .step-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-heading h1 { font-size: 27px; }
  .studio-content, .output-panel { padding-inline: 18px; }
  .mode-card { grid-template-columns: 36px minmax(0, 1fr); }
  .mode-tag { grid-column: 2; justify-self: start; }
  .choice-row { grid-template-columns: 1fr; }
  .style-preset-list { grid-template-columns: 1fr; }
  .style-preset-category.single, .style-preset-category:not(.single) { grid-column: span 1; }
  .style-preset-options { grid-template-columns: 1fr; }
  .style-preset-category-heading { min-height: 0; flex-direction: column; gap: 3px; }
  .style-preset-category-heading span { text-align: left; }
  .realism-mode-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .realism-mode { border-bottom: 1px solid var(--line); }
  .realism-mode:nth-child(2n) { border-right: 0; }
  .realism-mode:nth-last-child(-n + 2) { border-bottom: 0; }
  .region-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ratio-options { grid-auto-flow: initial; grid-template-columns: repeat(3, 1fr); }
  .ratio-option { min-height: 58px; border-bottom: 1px solid var(--line); }
  .ratio-option:nth-child(3n) { border-right: 0; }
  .ratio-option:nth-last-child(-n + 3) { border-bottom: 0; }
  .plan-actions { flex-direction: column; }
  .plan-actions button { flex-basis: auto; }
  .result-actions { flex-direction: column; }
  .login-dialog form, .register-content { padding: 24px 20px; }
  .register-dialog form { padding: 24px 20px; }
  .account-center-content { padding: 24px 20px; }
  .history-dialog-content { padding: 24px 20px; }
  .asset-library-content { padding: 24px 20px; }
  .account-tabs { overflow-x: auto; }
  .account-tab { flex: 1 0 auto; }
  .revoke-sessions-form { grid-template-columns: 1fr; align-items: stretch; }
  .revoke-sessions-form button { width: 100%; }
  .revoke-sessions-form .form-message { grid-column: auto; }
  .admin-workspace { padding: 0; }
  .admin-panel { border: 0; border-radius: 0; padding: 28px 18px 44px; box-shadow: none; }
  .admin-heading h1 { font-size: 26px; }
  .admin-console-tabs, .admin-section-tabs { overflow-x: auto; }
  .admin-console-tab, .admin-section-tab { flex: 0 0 auto; }
  .admin-reauth-dialog form { padding: 26px 20px; }
  .console-heading { flex-direction: column; }
  .model-form { padding: 18px; }
  .capability-toggles { grid-template-columns: 1fr; }
}

/* Editing workspace: keep the media bin and inspector available while the center scrolls. */
.editor-page { min-width: 320px; background: var(--canvas); }
.editor-topbar { position: sticky; z-index: 30; top: 0; min-height: 70px; display: grid; grid-template-columns: 38px auto minmax(180px, 1fr) auto auto; align-items: center; gap: 14px; border-bottom: 1px solid var(--line); padding: 0 clamp(16px, 2.6vw, 40px); background: rgba(255, 255, 255, .96); backdrop-filter: blur(16px); }
.editor-back { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: #fff; text-decoration: none; }
.editor-back:hover { color: var(--ink); border-color: #9bcdbf; background: var(--surface-soft); }
.editor-back svg { width: 17px; height: 17px; }
.editor-brand { min-width: 0; gap: 9px; font-size: 15px; }
.editor-brand .brand-mark, .editor-brand .brand-logo { width: 32px; height: 32px; }
.editor-brand .brand-copy small { font-size: 10px; }
.editor-project-picker { min-width: 0; width: min(360px, 100%); display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 9px; justify-self: center; color: var(--muted); font-size: 10px; font-weight: 600; }
.editor-project-picker select { min-height: 38px; padding: 8px 32px 8px 11px; font-size: 11px; }
.editor-save-state { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.editor-save-state > span:first-child { width: 7px; height: 7px; border-radius: 50%; background: #b6c7c1; }
.editor-save-state > span:first-child[data-state="saved"] { background: var(--success); }
.editor-save-state > span:first-child[data-state="dirty"], .editor-save-state > span:first-child[data-state="saving"] { background: #d39a45; }
.editor-save-state > span:first-child[data-state="error"] { background: var(--coral); }
.editor-header-actions { display: flex; align-items: center; gap: 8px; }
.history-actions { display: inline-flex; align-items: center; gap: 4px; padding: 3px; border: 1px solid rgba(194, 216, 209, .72); border-radius: 13px; background: rgba(238, 247, 243, .76); }
.history-actions .icon-button { position: static; width: 34px; height: 34px; border: 0; border-radius: 10px; background: transparent; }
.history-actions .icon-button:hover:not(:disabled) { color: var(--accent-dark); background: rgba(255, 255, 255, .9); }
.history-actions .icon-button:disabled { opacity: .34; cursor: not-allowed; }
.editor-header-actions .primary-button, .editor-header-actions .secondary-button { width: auto; min-height: 38px; padding-inline: 12px; font-size: 11px; }
.ai-edit-button { color: var(--accent-dark); background: var(--accent-soft); font-weight: 600; }
.ai-edit-button:hover:not(:disabled) { color: #fff; background: var(--accent); }
.ai-edit-undo { min-height: 34px; padding-inline: 7px; color: var(--coral); font-size: 10px; white-space: nowrap; }
.icon-command svg { width: 15px; height: 15px; }
.editor-shell { width: min(1740px, calc(100% - 32px)); height: calc(100vh - 102px); min-height: 0; display: grid; grid-template-columns: 236px minmax(0, 1fr) 304px; overflow: hidden; margin: 16px auto 20px; border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--surface); box-shadow: var(--shadow-panel); }
.editor-media, .editor-inspector { min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 22px 16px; background: #f5faf7; }
.editor-media { border-right: 1px solid var(--line); }
.editor-inspector { border-left: 1px solid var(--line); background: #fff; }
.editor-pane-heading, .editor-preview-heading, .timeline-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.editor-pane-heading { margin-bottom: 18px; }
.editor-pane-heading h1, .editor-pane-heading h2, .editor-preview-heading h2, .timeline-heading h2 { font-size: 17px; line-height: 1.35; }
.editor-pane-heading .icon-button { position: static; width: 32px; height: 32px; flex: 0 0 32px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.media-filter { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.media-filter button { min-height: 34px; flex: 1; border: 0; border-radius: 9px 9px 0 0; color: var(--muted); background: transparent; font-size: 10px; font-weight: 600; cursor: pointer; }
.media-filter button:hover { color: var(--ink); background: #eaf5f0; }
.media-filter button.active { color: var(--accent-dark); background: #e3f2eb; box-shadow: inset 0 -2px 0 var(--accent); }
.editor-media-list { display: grid; align-content: start; gap: 8px; }
.media-item { min-width: 0; display: grid; grid-template-columns: 48px minmax(0, 1fr) 30px; align-items: center; gap: 9px; border: 1px solid #dce9e4; border-radius: var(--radius-control); padding: 8px; background: #fff; }
.media-item:hover { border-color: #9bcdbf; box-shadow: 0 4px 12px rgba(39, 75, 66, .06); }
.media-thumb { position: relative; width: 48px; height: 38px; display: grid; place-items: center; overflow: hidden; border-radius: 8px; color: #fff; background: #315953; }
.media-thumb svg { width: 16px; height: 16px; opacity: .8; }
.media-thumb span { position: absolute; right: 3px; bottom: 2px; border-radius: 4px; padding: 1px 3px; color: #fff; background: rgba(13, 37, 33, .72); font-size: 8px; line-height: 1.2; }
.media-copy { min-width: 0; }
.media-copy strong, .media-copy small, .media-state { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-copy strong { font-size: 11px; }
.media-copy small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.media-state { width: fit-content; max-width: 100%; margin-top: 4px; border-radius: 999px; padding: 2px 5px; font-size: 8px; font-weight: 600; }
.media-state.done { color: var(--success); background: #e9f6ed; }
.media-state.running { color: #9b6a21; background: #fff5db; }
.media-state.failed { color: var(--error); background: #fff0ed; }
.media-add { position: static; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 9px; color: var(--accent-dark); background: var(--surface-soft); font-size: 18px; line-height: 1; }
.media-add:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.media-add:disabled { opacity: .35; cursor: not-allowed; }
.editor-canvas-column { min-width: 0; min-height: 0; display: grid; grid-template-rows: max-content max-content; align-content: start; gap: 18px; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 22px; background: #fbfdfc; }
.editor-preview, .timeline-panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-card); background: #fff; box-shadow: var(--shadow-card); }
.editor-preview { min-height: 0; display: flex; flex-direction: column; overflow: hidden; padding: 18px; }
.editor-preview-heading { flex: 0 0 auto; margin-bottom: 12px; }
.editor-stage { position: relative; flex: 0 0 auto; width: min(100%, 980px); aspect-ratio: 16 / 9; min-width: 0; min-height: 0; max-width: 100%; max-height: min(55vh, 560px); display: grid; place-items: center; overflow: hidden; margin: auto; border-radius: 12px; color: #b7cbc5; background: #163531; box-shadow: inset 0 0 0 1px rgba(255,255,255,.07); }
.editor-stage[data-ratio="21:9"] { aspect-ratio: 21 / 9; }
.editor-stage[data-ratio="4:3"] { aspect-ratio: 4 / 3; }
.editor-stage[data-ratio="1:1"] { width: min(100%, 640px); aspect-ratio: 1; }
.editor-stage[data-ratio="3:4"] { width: min(100%, 540px); aspect-ratio: 3 / 4; }
.editor-stage[data-ratio="9:16"] { width: min(100%, 420px); aspect-ratio: 9 / 16; }
.editor-stage video { width: 100%; height: 100%; display: block; object-fit: contain; background: #163531; }
.editor-stage-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; color: #b7cbc5; pointer-events: none; }
.editor-stage-empty svg { width: 34px; height: 34px; opacity: .8; }
.editor-stage-empty strong { font-size: 11px; font-weight: 600; }
.editor-caption { position: absolute; right: 6%; bottom: 12%; max-width: 86%; border-radius: 5px; padding: 5px 9px; color: #fff; background: rgba(0, 0, 0, .68); font-size: 12px; line-height: 1.5; text-align: center; white-space: pre-wrap; pointer-events: none; }
.editor-transport { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; color: var(--muted); font-size: 10px; }
.editor-transport strong { min-width: 0; overflow: hidden; color: var(--ink); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.editor-transport-actions { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 10px; }
.editor-transport-actions .icon-button { position: static; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.editor-transport-actions .icon-button:hover { color: var(--accent-dark); border-color: #9bcdbf; background: var(--accent-soft); }
.editor-transport-actions .secondary-button { min-height: 32px; padding: 0 11px; font-size: 10px; }
.timeline-panel { padding: 16px 18px 18px; }
.timeline-heading { align-items: center; margin-bottom: 12px; }
.timeline-help { margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.45; }
.ai-edit-summary { max-width: 560px; margin-top: 6px; color: var(--accent-dark); font-size: 9px; line-height: 1.5; }
.timeline-heading-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 12px; }
.timeline-summary { display: flex; align-items: baseline; gap: 9px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.timeline-summary strong { color: var(--ink); font-size: 14px; }
.timeline-precision { display: inline-flex; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; }
.timeline-precision button { min-width: 34px; min-height: 28px; border: 0; border-right: 1px solid var(--line); color: var(--muted); background: transparent; font-size: 9px; font-weight: 600; cursor: pointer; }
.timeline-precision button:last-child { border-right: 0; }
.timeline-precision button:hover { color: var(--ink); background: var(--surface-soft); }
.timeline-precision button.active { color: var(--accent-dark); background: var(--accent-soft); }
.timeline-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 8px; color: var(--muted); font-size: 9px; }
.ai-edit-settings { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; margin: -2px 0 12px; padding: 10px 11px; border: 1px solid #dfece7; border-radius: 9px; background: #f7fbf9; }
.ai-edit-settings label { min-width: 118px; display: grid; gap: 4px; color: var(--muted); font-size: 9px; font-weight: 600; }
.ai-edit-settings select { min-height: 32px; padding: 6px 24px 6px 8px; font-size: 10px; }
.ai-edit-settings .ai-edit-check { min-width: auto; display: flex; align-items: center; gap: 6px; min-height: 32px; color: var(--ink); }
.ai-edit-check input { accent-color: var(--accent); }
.ai-edit-review { margin: 0 0 12px; border: 1px solid #cfe5dc; border-radius: 12px; padding: 12px; background: #fbfefd; }
.ai-edit-review-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.ai-edit-review-heading > div { min-width: 0; display: grid; gap: 3px; }
.ai-edit-review-heading strong { font-size: 11px; }
.ai-edit-review-heading span { color: var(--muted); font-size: 9px; line-height: 1.4; }
.ai-edit-review-heading .icon-button { position: static; width: 26px; height: 26px; flex: 0 0 26px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.ai-edit-review-list { display: grid; gap: 6px; max-height: 220px; overflow-y: auto; margin-top: 10px; padding-right: 2px; }
.ai-edit-review-item { min-width: 0; border: 1px solid #dfede7; border-radius: 9px; padding: 8px 9px; background: #f7fbf9; }
.ai-edit-review-item.is-removed { border-color: #f0c9be; background: #fff8f5; }
.ai-edit-review-item-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ai-edit-review-item-heading strong { min-width: 0; overflow: hidden; color: var(--ink); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.ai-edit-review-item-heading span { flex: 0 0 auto; color: var(--accent-dark); font-size: 9px; font-weight: 600; }
.ai-edit-review-item.is-removed .ai-edit-review-item-heading span { color: var(--error); }
.ai-edit-review-item p { margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.45; }
.ai-edit-review-item small { display: block; margin-top: 3px; overflow-wrap: anywhere; color: var(--ink); font-size: 9px; line-height: 1.45; }
.ai-edit-review-actions { display: flex; justify-content: flex-end; gap: 7px; margin-top: 10px; }
.ai-edit-review-actions button { min-height: 32px; padding-inline: 10px; font-size: 10px; }
.timeline-toolbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.timeline-zoom { display: inline-flex !important; align-items: center; gap: 6px; color: var(--muted); font-size: 9px; }
.timeline-zoom input { width: 82px; accent-color: var(--accent); }
.timeline-zoom output { min-width: 34px; color: var(--accent-dark); font-size: 9px; font-weight: 600; }
.timeline-toolbar .secondary-button { min-height: 32px; padding: 0 10px; font-size: 9px; }
.timeline-toolbar .secondary-button:disabled { opacity: .45; cursor: not-allowed; }
.timeline-viewport { overflow-x: auto; padding: 0 2px 6px; scrollbar-gutter: stable; }
.timeline-ruler { position: relative; height: 24px; min-width: 100%; border-bottom: 1px solid #dce8e3; color: var(--muted); }
.timeline-ruler-tick { position: absolute; top: 0; bottom: 0; display: block; width: 1px; transform: translateX(-.5px); cursor: pointer; }
.timeline-ruler-tick i { position: absolute; left: 0; bottom: 0; width: 1px; height: 7px; background: #b9cbc5; }
.timeline-ruler-tick b { position: absolute; top: 0; left: 4px; color: var(--muted); font-size: 8px; font-weight: 600; white-space: nowrap; }
.timeline-track { position: relative; min-width: 100%; }
.timeline-list { min-height: 90px; display: flex; align-items: stretch; gap: 5px; overflow: visible; padding: 6px 0 5px; }
.timeline-clip { position: relative; min-width: 74px; flex: 0 0 auto; display: grid; grid-template-columns: 25px minmax(0, 1fr); align-items: center; gap: 7px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; padding: 10px 11px; background: #f7fbf9; cursor: grab; transition: border-color .15s, background .15s, box-shadow .15s; }
.timeline-clip:hover { border-color: #9bcdbf; }
.timeline-clip.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px rgba(22, 135, 121, .08); }
.timeline-clip.dragging { opacity: .45; cursor: grabbing; }
.timeline-clip.trimming { border-color: var(--coral); box-shadow: 0 0 0 2px rgba(224, 126, 101, .14); cursor: ew-resize; }
.timeline-index { color: var(--accent); font-size: 12px; font-weight: 600; }
.timeline-copy { min-width: 0; padding-right: 22px; }
.timeline-clip strong, .timeline-clip small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeline-clip strong { font-size: 11px; }
.timeline-clip small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.timeline-clip i { position: absolute; right: 8px; bottom: 7px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.timeline-handle { position: absolute; z-index: 2; top: 0; bottom: 0; width: 9px; border: 0; padding: 0; background: transparent; cursor: ew-resize; }
.timeline-handle::after { content: ""; position: absolute; top: 25%; bottom: 25%; left: 3px; width: 3px; border-radius: 3px; background: rgba(22, 135, 121, .65); }
.timeline-handle:hover::after, .timeline-clip.trimming .timeline-handle::after { background: var(--coral); }
.timeline-handle-start { left: 0; }
.timeline-handle-end { right: 0; }
.timeline-remove { position: absolute; top: 7px; right: 7px; width: 22px; height: 22px; display: grid; place-items: center; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: 17px; line-height: 1; cursor: pointer; }
.timeline-remove:hover { color: var(--error); background: #fff0ed; }
.timeline-playhead { position: absolute; z-index: 5; top: 0; bottom: 0; width: 2px; transform: translateX(-1px); background: var(--coral); pointer-events: none; }
.timeline-playhead::before { content: ""; position: absolute; top: -1px; left: -5px; width: 0; height: 0; border-right: 6px solid transparent; border-left: 6px solid transparent; border-top: 7px solid var(--coral); }
.timeline-playhead span { position: absolute; top: 6px; left: 4px; width: 1px; height: 8px; background: var(--coral); }
.editor-inspector .editor-pane-heading { margin-bottom: 14px; }
.inspector-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.inspector-tabs button { min-width: 0; min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; border: 0; border-radius: 9px 9px 0 0; color: var(--muted); background: transparent; font-size: 10px; font-weight: 600; cursor: pointer; }
.inspector-tabs button:hover { color: var(--ink); background: var(--surface-soft); }
.inspector-tabs button.active { color: var(--accent-dark); background: var(--accent-soft); box-shadow: inset 0 -2px 0 var(--accent); }
.inspector-tabs svg { width: 14px; height: 14px; }
.inspector-panel { min-width: 0; }
.inspector-panel fieldset { min-width: 0; border: 0; margin: 0; padding: 0; }
.inspector-label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.inspector-label-row .field-label { margin: 0; }
.inspector-label-row .text-button { min-height: 28px; padding: 4px 7px; font-size: 10px; }
.inspector-field { margin-top: 16px; }
.trim-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.trim-grid label, .speech-inline label { min-width: 0; color: var(--muted); font-size: 10px; font-weight: 600; }
.trim-grid label > div { position: relative; margin-top: 5px; }
.trim-grid input { min-height: 40px; padding: 8px 28px 8px 10px; font-size: 11px; }
.trim-grid em { position: absolute; top: 11px; right: 9px; color: var(--muted); font-size: 9px; font-style: normal; }
.range-field { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #314640; font-size: 11px; font-weight: 600; }
.range-field output { color: var(--accent-dark); font-size: 10px; font-weight: 600; }
.inspector-panel input[type="range"] { width: 100%; accent-color: var(--accent); }
.clip-order-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 18px; }
.clip-order-actions .icon-button { position: static; width: 100%; height: 34px; border: 1px solid var(--line); border-radius: 9px; }
.clip-order-actions .icon-button:hover:not(:disabled) { border-color: #9bcdbf; color: var(--accent-dark); background: var(--accent-soft); }
.clip-order-actions .icon-button:disabled { opacity: .35; cursor: not-allowed; }
.danger-icon:hover:not(:disabled) { color: var(--error) !important; background: #fff2ef !important; }
.inspector-command-list { display: grid; gap: 7px; margin-top: 18px; }
.inspector-command-list .secondary-button { width: 100%; min-height: 38px; font-size: 10px; }
.inspector-command-list .text-button { min-height: 32px; font-size: 10px; }
.audio-file-control { min-width: 0; min-height: 54px; display: flex; align-items: center; gap: 9px; border: 1px dashed #aacbc1; border-radius: var(--radius-control); padding: 9px 11px; color: var(--muted); background: #f8fcfa; cursor: pointer; }
.audio-file-control:hover { border-color: var(--accent); color: var(--ink); background: #f0faf6; }
.audio-file-control input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.audio-file-control svg { width: 17px; height: 17px; flex: 0 0 17px; color: var(--accent); }
.audio-file-control span { min-width: 0; overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.compact-toggle { margin: 16px 0; }
.compact-toggle .toggle { width: 38px; height: 22px; flex-basis: 38px; }
.compact-toggle .toggle::after { width: 16px; height: 16px; }
.compact-toggle input:checked + .toggle::after { transform: translateX(16px); }
.inspector-divider { height: 1px; margin: 20px 0; background: var(--line); }
.narration-fields { min-width: 0; }
.speech-inline { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; margin-top: 16px; }
.speech-inline select { min-height: 38px; margin-top: 5px; padding: 8px 28px 8px 10px; font-size: 10px; }
.speech-inline button { min-height: 38px; padding-inline: 9px; font-size: 10px; white-space: nowrap; }
.narration-preview { width: 100%; height: 34px; margin-top: 12px; }
.inspector-wide-button { width: 100%; margin-top: 18px; }
.editor-empty { border: 1px dashed var(--line-strong); border-radius: var(--radius-control); padding: 18px 10px; color: var(--muted); font-size: 10px; line-height: 1.6; text-align: center; }
.editor-status { position: fixed; z-index: 50; right: 20px; bottom: 20px; max-width: min(420px, calc(100% - 40px)); border: 1px solid #b9dccd; border-radius: 10px; padding: 11px 14px; color: var(--accent-dark); background: #effaf5; box-shadow: var(--shadow-card); font-size: 11px; line-height: 1.5; }
.editor-status.error { border-color: #e2b5ad; color: var(--error); background: #fff3f0; }
.export-dialog { width: min(440px, calc(100% - 32px)); border: 1px solid var(--line); border-radius: var(--radius-panel); padding: 0; color: var(--ink); background: var(--surface); box-shadow: 0 22px 70px rgba(19, 55, 47, .2); }
.export-dialog::backdrop { background: rgba(18, 31, 29, .42); backdrop-filter: blur(3px); }
.export-dialog-content { padding: 28px; }
.export-dialog-content .dialog-heading { margin-bottom: 22px; }
.export-dialog-content h2 { font-size: 20px; }
.export-progress { height: 8px; overflow: hidden; border-radius: 999px; background: #e4efeb; }
.export-progress span { width: 0; height: 100%; display: block; border-radius: inherit; background: var(--accent); transition: width .2s ease; }
.export-dialog-content > strong { display: block; min-width: 0; margin-top: 16px; font-size: 12px; overflow-wrap: anywhere; word-break: break-word; }
.export-dialog-content.has-error > strong { color: var(--error); }
.export-dialog-content.has-error .export-progress span { background: var(--coral); }
.export-dialog-content > p { min-width: 0; margin-top: 5px; color: var(--muted); font-size: 10px; line-height: 1.55; overflow-wrap: anywhere; word-break: break-word; }
.export-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
.export-options label { min-width: 0; display: grid; gap: 5px; color: var(--muted); font-size: 10px; font-weight: 600; }
.export-options select { min-height: 38px; padding: 8px 28px 8px 10px; font-size: 11px; }
.export-quality-hint { min-height: 32px; }
.export-dialog-actions { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 18px; }
.export-dialog-actions .primary-button { min-height: 38px; padding-inline: 18px; font-size: 11px; }
.export-dialog-actions .text-button { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media (max-width: 1120px) and (min-width: 821px) {
  .editor-page { overflow-x: hidden; overflow-y: auto; }
  .editor-shell { height: auto; min-height: calc(100vh - 102px); grid-template-columns: 210px minmax(0, 1fr); overflow: visible; }
  .editor-canvas-column { padding: 18px; }
  .editor-inspector { grid-column: 1 / -1; border-top: 1px solid var(--line); border-left: 0; padding: 24px; }
  .editor-topbar { grid-template-columns: 38px auto minmax(150px, 1fr) auto; }
  .editor-save-state { display: none; }
}

@media (min-width: 821px) {
  .editor-page { overflow: hidden; }
}

@media (max-width: 820px) {
  .editor-topbar { min-height: 64px; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 9px; padding: 10px 14px; }
  .editor-brand .brand-copy small, .editor-project-picker > span, .editor-save-state { display: none; }
  .editor-project-picker { grid-column: 2; grid-row: 2; width: 100%; }
  .editor-header-actions { grid-column: 3; grid-row: 1; }
  .editor-header-actions .secondary-button { min-width: 38px; width: 38px; padding: 0; }
  .editor-header-actions .secondary-button span { display: none; }
  .history-actions { padding: 2px; }
  .history-actions .icon-button { width: 32px; height: 32px; }
  .editor-shell { width: 100%; height: auto; min-height: 0; grid-template-columns: 1fr; overflow: visible; margin: 0; border: 0; border-radius: 0; box-shadow: none; }
  .editor-media, .editor-inspector { max-height: none; overflow: visible; border: 0; }
  .editor-media { max-height: 290px; border-bottom: 1px solid var(--line); padding: 18px 16px; }
  .editor-media-list { max-height: 184px; overflow-y: auto; }
  .editor-canvas-column { order: 2; min-height: 650px; overflow: visible; padding: 14px; }
  .editor-inspector { order: 3; border-top: 1px solid var(--line); padding: 20px 16px 28px; }
  .editor-stage { width: 100%; }
  .timeline-clip { flex-basis: 168px; }
}

@media (max-width: 480px) {
  .editor-brand .brand-copy { display: none; }
  .editor-header-actions { gap: 5px; }
  .history-actions { display: none; }
  .editor-header-actions .ai-edit-undo { display: none; }
  .editor-header-actions .primary-button { min-width: 38px; width: 38px; padding: 0; }
  .editor-header-actions .primary-button span { display: none; }
  .editor-preview { padding: 12px; }
  .timeline-panel { padding: 13px 12px; }
  .editor-transport { align-items: flex-start; flex-direction: column; gap: 2px; }
  .speech-inline { grid-template-columns: 1fr; }
  .speech-inline button { width: 100%; }
  .timeline-toolbar { align-items: flex-start; flex-direction: column; }
  .timeline-toolbar-actions { width: 100%; justify-content: space-between; gap: 8px; }
  .ai-edit-settings { align-items: stretch; }
  .ai-edit-settings label { flex: 1 1 120px; }
}

/* Unified post-login surfaces: lake glass, clear hierarchy, stable controls. */
.editor-page, .admin-page { position: relative; isolation: isolate; background: #eaf3ef; }
.editor-page::before, .admin-page::before { content: ""; position: fixed; z-index: -2; inset: 0; background: url("/login-water-bg.jpg?v=20260829-01") center / cover no-repeat; opacity: .16; filter: saturate(.8); pointer-events: none; }
.editor-page::after, .admin-page::after { content: ""; position: fixed; z-index: -1; inset: 0; background: rgba(235, 245, 241, .88); pointer-events: none; }

.editor-topbar, .admin-page > .topbar { border-bottom-color: rgba(185, 211, 202, .72); background: rgba(250, 253, 252, .82); box-shadow: 0 8px 30px rgba(31, 75, 67, .06); backdrop-filter: blur(24px) saturate(1.18); }
.editor-back, .admin-page .header-link { border-color: rgba(188, 216, 207, .82); border-radius: 16px; background: rgba(255, 255, 255, .72); box-shadow: 0 5px 14px rgba(31, 75, 67, .05); }
.editor-project-picker select { border-color: rgba(184, 211, 202, .86); border-radius: 16px; background-color: rgba(255, 255, 255, .82); box-shadow: inset 0 1px 0 rgba(255,255,255,.9); }
.editor-header-actions .primary-button, .editor-header-actions .secondary-button { min-height: 42px; border-radius: 15px; padding-inline: 15px; }
.editor-header-actions .ai-edit-button { border-color: #b8ded2; background: rgba(230, 247, 240, .9); box-shadow: 0 6px 18px rgba(22, 135, 121, .08); }
.editor-save-state { border: 1px solid rgba(194, 216, 209, .7); border-radius: 999px; padding: 6px 10px; background: rgba(255,255,255,.58); }

.editor-shell { width: min(1760px, calc(100% - 36px)); height: calc(100dvh - 106px); grid-template-columns: 250px minmax(0, 1fr) 316px; border-color: rgba(184, 211, 202, .78); border-radius: 30px; background: rgba(250, 253, 252, .66); box-shadow: 0 28px 80px rgba(25, 68, 60, .12), inset 0 1px 0 rgba(255,255,255,.88); backdrop-filter: blur(22px) saturate(1.08); }
.editor-media, .editor-inspector { padding: 24px 18px; background: rgba(246, 251, 248, .76); }
.editor-media { border-right-color: rgba(193, 215, 208, .76); }
.editor-inspector { border-left-color: rgba(193, 215, 208, .76); background: rgba(255, 255, 255, .79); }
.editor-canvas-column { gap: 20px; padding: 24px; background: rgba(248, 252, 250, .48); }
.editor-pane-heading h1, .editor-pane-heading h2, .editor-preview-heading h2, .timeline-heading h2 { font-size: 18px; }
.editor-pane-heading .eyebrow, .editor-preview-heading .eyebrow, .timeline-heading .eyebrow { color: #167f72; }

.media-filter, .inspector-tabs { gap: 4px; border: 1px solid rgba(194, 216, 209, .72); border-radius: 16px; padding: 4px; background: rgba(238, 247, 243, .76); }
.media-filter { margin-bottom: 16px; }
.media-filter button, .inspector-tabs button { border-radius: 12px; box-shadow: none; }
.media-filter button.active, .inspector-tabs button.active { color: var(--accent-dark); background: #fff; box-shadow: 0 5px 14px rgba(31, 75, 67, .09); }
.media-item { border-color: rgba(193, 218, 209, .78); border-radius: 18px; padding: 10px; background: rgba(255,255,255,.8); box-shadow: 0 5px 16px rgba(31, 75, 67, .035); }
.media-item:hover { border-color: #8fcbbb; background: #fff; box-shadow: 0 10px 24px rgba(31, 75, 67, .08); }
.media-thumb { border-radius: 12px; background: #285a53; }
.media-add { border-radius: 12px; }

.editor-preview, .timeline-panel { border-color: rgba(187, 214, 205, .78); border-radius: 24px; background: rgba(255,255,255,.86); box-shadow: 0 14px 38px rgba(31, 75, 67, .075), inset 0 1px 0 rgba(255,255,255,.9); }
.editor-preview { padding: 20px; }
.editor-stage { border-radius: 22px; background: #123d38; box-shadow: 0 18px 42px rgba(13, 56, 50, .2), inset 0 0 0 1px rgba(255,255,255,.12); }
.editor-stage video { background: #123d38; }
.editor-caption { border: 1px solid rgba(255,255,255,.2); border-radius: 12px; padding: 7px 12px; background: rgba(7, 28, 25, .72); backdrop-filter: blur(10px); }
.editor-transport { margin-top: 15px; border-top: 1px solid rgba(210, 226, 220, .75); padding-top: 12px; }
.editor-transport-actions .icon-button, .editor-transport-actions .secondary-button { border-radius: 13px; }

.timeline-panel { padding: 19px 20px 21px; }
.ai-edit-settings { margin-top: 2px; border-color: rgba(190, 216, 208, .76); border-radius: 16px; padding: 12px; background: rgba(237, 247, 243, .78); }
.ai-edit-settings select { border-radius: 11px; background-color: rgba(255,255,255,.9); }
.ai-edit-summary { max-width: 620px; border-left: 3px solid var(--accent); padding-left: 9px; font-size: 10px; }
.timeline-precision { border-radius: 11px; }
.timeline-viewport { border: 1px solid rgba(202, 220, 214, .72); border-radius: 16px; padding: 7px 9px 9px; background: rgba(248, 252, 250, .78); }
.timeline-clip { border-radius: 13px; background: rgba(255,255,255,.9); }
.timeline-clip.active { border-color: var(--accent); background: #eaf8f2; box-shadow: 0 6px 16px rgba(22, 135, 121, .1), inset 0 0 0 1px rgba(22, 135, 121, .08); }
.timeline-remove { border-radius: 9px; }

.editor-inspector input[type="text"], .editor-inspector input[type="number"], .editor-inspector select, .editor-inspector textarea { border-radius: 14px; background-color: rgba(255,255,255,.88); }
.clip-order-actions .icon-button, .inspector-command-list .secondary-button, .audio-file-control { border-radius: 14px; }
.editor-empty { border-radius: 16px; background: rgba(255,255,255,.44); }
.editor-status { border-radius: 18px; background: rgba(239, 250, 245, .94); box-shadow: 0 16px 42px rgba(31, 75, 67, .15); backdrop-filter: blur(16px); }
.export-dialog { border-color: rgba(183, 211, 202, .82); border-radius: 30px; background: rgba(252,254,253,.95); backdrop-filter: blur(24px); }

.admin-workspace { padding: 36px 24px 50px; background: transparent; }
.admin-panel { width: min(1420px, 100%); border-color: rgba(183, 211, 202, .78); border-radius: 32px; padding: 42px; background: rgba(252, 254, 253, .84); box-shadow: 0 30px 90px rgba(25, 68, 60, .12), inset 0 1px 0 rgba(255,255,255,.92); backdrop-filter: blur(24px) saturate(1.08); }
.admin-panel.admin-locked { background: rgba(252,254,253,.91); }
.admin-heading { margin-bottom: 34px; }
.admin-heading h1 { font-size: 32px; }
.security-mark { border-radius: 16px; background: #e4f5ee; box-shadow: 0 8px 20px rgba(22,135,121,.08); }
.admin-console-tabs, .admin-section-tabs, .usage-view-tabs { gap: 5px; overflow-x: auto; border: 1px solid rgba(195, 217, 210, .76); border-radius: 17px; padding: 5px; background: rgba(239,247,244,.76); scrollbar-width: none; }
.admin-console-tab, .admin-section-tab, .usage-view-tab { flex: 0 0 auto; border-radius: 12px; }
.admin-console-tab.active, .admin-section-tab.active, .usage-view-tab.active { color: var(--accent-dark); background: #fff; box-shadow: 0 6px 17px rgba(31,75,67,.09); }
.console-heading { margin: 4px 0 24px; border-bottom: 1px solid rgba(205, 222, 216, .72); padding-bottom: 18px; }
.usage-card, .admin-list-row, .model-row { border-color: rgba(192, 216, 208, .78); border-radius: 18px; background: rgba(255,255,255,.76); box-shadow: 0 5px 16px rgba(31,75,67,.035); }
.usage-card { padding: 16px; }
.admin-list-row:hover, .model-row:hover { border-color: #97cdbf; background: #fff; }
.history-table-wrap { border-color: rgba(190, 215, 207, .8); border-radius: 18px; background: rgba(255,255,255,.82); box-shadow: 0 7px 22px rgba(31,75,67,.045); }
.history-table thead { background: #edf6f2; }
.model-manager { gap: 26px 32px; }
.model-form { border-color: rgba(188, 214, 205, .82); border-radius: 24px; padding: 28px; background: rgba(255,255,255,.86); box-shadow: 0 16px 40px rgba(31,75,67,.075); }
.capability-grid, .capability-toggles .toggle-row { border-radius: 18px; background: rgba(241,248,245,.82); }
.workflow-capability-options label { border-radius: 13px; }
.admin-page input[type="password"], .admin-page input[type="text"], .admin-page input[type="url"], .admin-page input[type="email"], .admin-page input[type="number"], .admin-page select, .admin-page textarea { border-radius: 15px; background-color: rgba(255,255,255,.9); }
.admin-security-note { border: 1px solid rgba(190,216,207,.72); border-radius: 18px; padding: 15px; background: rgba(239,248,244,.7); }

/* Align employee status badges with the editable role and balance controls. */
.admin-page .employee-actions { align-items: flex-end; }
.admin-page .employee-actions > .task-badge { min-height: 32px; box-sizing: border-box; align-self: flex-end; padding-block: 4px; }
.admin-page .employee-actions > .text-button { align-self: flex-end; }

@media (max-width: 1120px) and (min-width: 821px) {
  .editor-shell { border-radius: 26px; }
  .editor-inspector { background: rgba(255,255,255,.78); }
}

@media (max-width: 820px) {
  .editor-page, .admin-page { overflow-x: clip; }
  .editor-topbar { background: rgba(250,253,252,.94); }
  .editor-shell { background: rgba(250,253,252,.84); }
  .editor-media, .editor-canvas-column, .editor-inspector { background: rgba(250,253,252,.86); }
  .editor-preview, .timeline-panel { border-radius: 22px; }
  .editor-stage { border-radius: 18px; }
  .admin-workspace { padding: 12px; }
  .admin-panel { border: 1px solid rgba(183,211,202,.74); border-radius: 26px; padding: 28px 18px 42px; }
}

@media (max-width: 1120px) and (min-width: 821px) {
  .editor-page { overflow-x: hidden; overflow-y: auto; }
}

@media (max-width: 820px) {
  .editor-shell { width: 100%; height: auto; grid-template-columns: minmax(0, 1fr); overflow: visible; margin: 0; border: 0; border-radius: 0; box-shadow: none; }
  .editor-media, .editor-canvas-column, .editor-inspector { width: 100%; min-width: 0; box-sizing: border-box; }
  .editor-canvas-column { grid-template-rows: max-content max-content; }
  .editor-preview, .timeline-panel { width: 100%; box-sizing: border-box; }
}

/* Final typography pass: one rounded family, with a calm three-level weight scale. */
body, body * { font-family: var(--font-rounded); font-synthesis: none; }
body { font-size: 14px; font-weight: 400; }
h1, h2, h3, strong { font-weight: 600; }
b, button, label, legend, .eyebrow, .nav-caption, .step-item b, .step-item span,
.account-primary, .account-secondary, .header-link, .header-workspace-button,
.primary-button, .secondary-button, .text-button, .mode-tag, .task-badge,
.format-badge, .section-badge, .source-required, .source-optional { font-weight: 500; }
.content-heading h1, .gateway-heading h1, .admin-heading h1 { font-size: 30px; line-height: 1.3; }
.section-title h2, .output-heading h2, .dialog-heading h2 { font-size: 20px; line-height: 1.35; }
.field-label, legend { font-size: 12px; line-height: 1.45; }
.primary-button, .secondary-button { font-size: 12px; }
.field-help, .content-heading p:not(.eyebrow), .admin-lead { line-height: 1.65; }
.mode-card-copy strong, .choice strong, .idea-copy strong, .shot-copy strong { font-weight: 600; }
.mode-card-copy small, .choice small, .idea-copy span, .shot-copy small { line-height: 1.6; }
.header-account-copy strong, .header-usage strong, .quota-chip strong { font-weight: 600; }
.timeline-ruler-tick b, .timeline-clip strong, .timeline-index, .range-field output { font-weight: 500; }
body input, body select, body textarea { font-size: 13px; line-height: 1.5; }
body input::placeholder, body textarea::placeholder { color: #8b9894; opacity: 1; }
body .field-label, body legend { font-size: 12px; font-weight: 500; }
body .field-label span { font-weight: 400; }
body .eyebrow, body .nav-caption { font-size: 10px; font-weight: 500; letter-spacing: .04em; }
body .content-heading h1, body .gateway-heading h1, body .admin-heading h1 { font-weight: 600; }
body .section-title h2, body .output-heading h2, body .dialog-heading h2 { font-weight: 600; }
body .primary-button, body .secondary-button, body .text-button, body button, body select { font-weight: 500; }
body strong, body b { font-weight: 600; }

@media (max-width: 480px) {
  .content-heading h1, .gateway-heading h1, .admin-heading h1 { font-size: 26px; }
  .section-title h2, .output-heading h2, .dialog-heading h2 { font-size: 19px; }
}

/* Final responsive alignment pass: keep the brand, project picker, and actions in stable grid areas. */
@media (max-width: 820px) {
  .editor-topbar .editor-back { grid-column: 1; grid-row: 1; }
  .editor-topbar .editor-brand { grid-column: 2; grid-row: 1; }
  .editor-topbar .editor-project-picker { grid-column: 1 / -1; grid-row: 2; grid-template-columns: minmax(0, 1fr); }
  .editor-topbar .editor-header-actions { grid-column: 3; grid-row: 1; }
}

@media (max-width: 420px) {
  .studio-page .brand-copy { display: block; }
  .studio-page .brand-copy strong { font-size: 14px; }
  .studio-page .brand { gap: 9px; }
  .editor-topbar .editor-brand .brand-copy { display: block; }
  .editor-topbar .editor-brand .brand-copy strong { font-size: 13px; }
}

/* Product hierarchy pass: keep the workbench quiet, then give the active task and result the strongest contrast. */
.studio-page .topbar {
  height: 58px;
  border-bottom-color: rgba(176, 205, 195, .78);
  background: rgba(252, 254, 253, .88);
  box-shadow: 0 8px 28px rgba(30, 82, 70, .06);
}
.studio-page .brand { gap: 10px; font-size: 16px; }
.studio-page .brand-mark { width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center; padding: 0; border: 0; background: transparent; }
.studio-page .brand-logo { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 12px; }
.studio-page .header-workspace-nav { gap: 2px; padding: 3px; border: 1px solid rgba(196, 220, 211, .84); border-radius: 14px; background: rgba(240, 248, 244, .76); }
.studio-page .header-workspace-button { min-height: 33px; gap: 5px; border-radius: 10px; padding-inline: 8px; font-size: 10px; }
.studio-page .header-workspace-button svg { width: 14px; height: 14px; }
.studio-page .header-workspace-button.active { border-color: transparent; color: #12695e; background: #fff; box-shadow: 0 4px 12px rgba(31, 75, 67, .1); }
.studio-page .header-account { margin-left: auto; }
.studio-page .header-account-menu summary { min-height: 40px; }
.studio-page .workspace-taskbar { top: 58px; padding-top: 6px; background: rgba(233, 243, 239, .78); }
.studio-page .workspace-taskbar-inner { min-height: 50px; border-radius: 16px; padding-block: 5px; background: rgba(255, 255, 255, .74); }
.studio-page .app-shell { margin-top: 10px; border-color: rgba(186, 214, 205, .84); border-radius: 26px; background: rgba(252, 254, 253, .82); box-shadow: 0 24px 66px rgba(31, 75, 67, .1), inset 0 1px 0 rgba(255,255,255,.92); }
.studio-page .workflow-nav { padding: 25px 16px 20px; background: rgba(242, 248, 245, .78); }
.studio-page .studio-content { padding: 35px clamp(28px, 3.6vw, 58px) 58px; background: rgba(255,255,255,.72); }
.studio-page .content-heading { margin-bottom: 26px; padding-bottom: 23px; border-bottom: 1px solid rgba(218, 232, 226, .9); }
.studio-page .content-heading h1 { font-size: 29px; letter-spacing: 0; }
.studio-page .content-heading p:not(.eyebrow) { max-width: 580px; margin-top: 7px; font-size: 12px; }
.studio-page .quota-chip { border-color: rgba(170, 211, 196, .88); border-radius: 13px; padding: 9px 13px; background: rgba(231, 246, 239, .82); }
.studio-page .project-bar { margin-bottom: 25px; border-color: rgba(198, 221, 212, .9); border-radius: 16px; padding: 13px 15px; background: rgba(247, 252, 249, .86); box-shadow: 0 5px 15px rgba(31, 75, 67, .035); }
.studio-page .project-bar .secondary-button { min-height: 40px; }
.studio-page .mode-section, .studio-page .form-section { border-top-color: rgba(224, 236, 231, .94); padding-top: 25px; }
.studio-page .section-title { gap: 11px; margin-bottom: 17px; }
.studio-page .section-index { width: 26px; height: 26px; flex-basis: 26px; border-radius: 9px; color: #fff; background: #438f82; box-shadow: 0 5px 12px rgba(22, 135, 121, .14); }
.studio-page .section-title h2 { font-size: 18px; }
.studio-page .section-title p { margin-top: 3px; font-size: 11px; }
.studio-page .mode-grid { gap: 10px; }
.studio-page .mode-card { min-height: 60px; border-color: rgba(211, 228, 221, .92); border-radius: 16px; padding: 6px 10px; background: rgba(251, 253, 252, .86); }
.studio-page .mode-card.active { border-color: #72bda9; background: #f0faf5; box-shadow: 0 8px 20px rgba(22, 135, 121, .1), inset 0 0 0 1px rgba(22, 135, 121, .08); }
.studio-page .mode-card-copy strong { font-size: 13px; }
.studio-page .mode-card-copy small { margin-top: 5px; font-size: 11px; }
.studio-page .mode-tag { padding: 4px 7px; font-size: 9px; }
.studio-page .field-label, .studio-page legend { margin-bottom: 7px; font-size: 12px; }
.studio-page .field-help { margin-block: 7px 17px; font-size: 10px; line-height: 1.6; }
.studio-page input, .studio-page select, .studio-page textarea { border-color: rgba(199, 220, 212, .96); border-radius: 12px; background: rgba(255,255,255,.88); }
.studio-page input:focus, .studio-page select:focus, .studio-page textarea:focus { border-color: #72bca8; box-shadow: 0 0 0 4px rgba(22, 135, 121, .1); }
.studio-page .form-actions { margin-top: 22px; }
.studio-page .form-actions .auth-panel, .studio-page .form-actions #generateButton { min-height: 60px; border-radius: 15px; }
.studio-page .output-panel { padding: 31px 22px 38px; border-left-color: rgba(192, 216, 207, .88); background: rgba(243, 248, 245, .72); }
.studio-page .output-heading { margin-bottom: 17px; }
.studio-page .output-heading h2 { font-size: 18px; }
.studio-page .stage { border: 1px solid rgba(100, 160, 146, .38); border-radius: 20px; box-shadow: 0 17px 36px rgba(13, 56, 50, .17), inset 0 0 0 1px rgba(255,255,255,.12); }
.studio-page .result-bar { margin-top: 13px; border-color: rgba(194, 217, 208, .88); border-radius: 16px; padding: 12px; background: rgba(255,255,255,.78); }
.studio-page .result-copy strong { font-size: 12px; }
.studio-page .result-actions { gap: 7px; }
.studio-page .result-actions .secondary-button { min-height: 35px; border-radius: 10px; padding-inline: 9px; font-size: 10px; }
.studio-page .edit-handoff-panel { margin-top: 15px; border-color: rgba(169, 211, 198, .92); border-radius: 17px; padding: 14px; background: rgba(237, 249, 243, .86); box-shadow: 0 10px 24px rgba(22, 135, 121, .07); }
.studio-page .edit-primary-entry { margin-top: 12px; border-radius: 12px; padding: 11px 12px; }
.studio-page .edit-tool-grid { gap: 6px; }
.studio-page .edit-tool-grid a { border-radius: 10px; padding: 8px 7px; }

.release-current { min-width: 0; display: flex; align-items: center; gap: 12px; margin-bottom: 16px; border: 1px solid #9dd2c0; border-radius: 16px; padding: 13px 15px; background: #eaf8f1; }
.release-current-mark { width: 10px; height: 10px; flex: 0 0 10px; border-radius: 50%; background: #168779; box-shadow: 0 0 0 5px rgba(22, 135, 121, .12); }
.release-current-copy { min-width: 0; }
.release-current strong, .release-current small { display: block; overflow-wrap: anywhere; }
.release-current strong { font-size: 13px; }
.release-current small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.release-list { display: grid; gap: 9px; }
.release-row { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 18px; border: 1px solid rgba(199, 220, 212, .94); border-radius: 15px; padding: 13px 14px; background: rgba(255,255,255,.78); transition: border-color .2s ease, box-shadow .2s ease, background .2s ease; }
.release-row:hover { border-color: #8fcbbb; background: #fff; box-shadow: 0 7px 18px rgba(31, 75, 67, .06); }
.release-row.is-current { border-color: #76c7b4; background: rgba(235, 249, 243, .88); box-shadow: inset 0 0 0 1px rgba(118, 199, 180, .12); }
.release-row-copy { min-width: 0; }
.release-row-copy strong, .release-row-copy small, .release-row-copy p { display: block; overflow-wrap: anywhere; }
.release-row-copy strong { font-size: 13px; }
.release-row-copy small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.release-row-copy p { margin-top: 5px; color: #526660; font-size: 10px; line-height: 1.45; }
.release-row-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
.release-rollback { min-height: 34px; border: 1px solid #76bba9; border-radius: 10px; padding: 5px 9px; color: #176f62; background: #fff; font-size: 10px; white-space: nowrap; }
.release-rollback:hover:not(:disabled) { border-color: #258d7a; color: #fff; background: #168779; box-shadow: 0 5px 13px rgba(22, 135, 121, .16); }
.release-rollback:disabled { color: #78958d; background: #edf6f2; cursor: default; opacity: 1; }
.release-row.is-current .release-rollback:disabled { border-color: #167b6d; color: #fff; background: #167b6d; }
.release-empty { border: 1px dashed rgba(183, 210, 201, .94); border-radius: 15px; padding: 22px 16px; color: var(--muted); background: rgba(248, 252, 250, .74); font-size: 11px; text-align: center; }
.release-help { margin-top: 15px; }

@media (min-width: 1221px) {
  .studio-page:not(.studio-active) .app-shell { height: calc(100dvh - 188px); }
  .studio-page .studio-content { padding-top: 30px; }
}

@media (max-width: 760px) {
  .studio-page .topbar { height: auto; min-height: 54px; padding-block: 8px; }
  .studio-page .header-workspace-nav { gap: 1px; padding: 3px; }
  .studio-page .header-workspace-button { min-height: 31px; border-radius: 9px; padding-inline: 6px; }
  .studio-page .header-workspace-button svg { width: 13px; height: 13px; }
  .studio-page .workspace-taskbar { top: auto; padding-top: 5px; }
  .studio-page .workspace-taskbar-inner { min-height: 50px; padding-block: 5px; }
  .studio-page .app-shell { margin-top: 10px; border-radius: 0; }
  .studio-page .studio-content { padding: 28px 18px 48px; }
  .studio-page .content-heading { padding-bottom: 18px; }
  .studio-page .output-panel { padding: 28px 18px 42px; }
  .release-row { align-items: stretch; flex-direction: column; gap: 11px; }
  .release-row-actions { justify-content: space-between; }
  .release-row-actions .release-rollback { flex: 1; }
}

/* Give the employee console room for its controls while keeping the review list compact. */
@media (min-width: 1121px) {
  .admin-page .team-grid {
    grid-template-columns: minmax(260px, .68fr) minmax(0, 1.32fr);
    align-items: start;
  }

  .admin-page .team-grid > .team-block {
    align-self: start;
  }

  .admin-page #employeeList .admin-list-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .admin-page #employeeList .employee-actions {
    min-width: 0;
    flex-wrap: nowrap;
  }
}

@media (max-width: 1120px) and (min-width: 761px) {
  .admin-page .team-grid {
    grid-template-columns: 1fr;
  }

  .admin-page .team-projects {
    grid-column: 1;
  }
}

/* Keep the locked admin state spacious and centered, without adding a second inner card. */
.admin-page .admin-panel.admin-locked .admin-heading {
  margin-bottom: 24px;
}

.admin-page .admin-panel.admin-locked .admin-heading > .security-mark {
  display: none;
}

.admin-page .admin-panel.admin-locked #loginForm {
  width: 100%;
  margin-top: 0;
}

.admin-page .admin-panel.admin-locked .admin-session-check {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "mark"
    "title"
    "copy"
    "action"
    "error";
  justify-items: center;
  row-gap: 9px;
  border: 0;
  border-radius: 0;
  padding: 52px 0 44px;
  background: transparent;
  text-align: center;
}

.admin-page .admin-panel.admin-locked .admin-session-check .security-mark {
  grid-area: mark;
  align-self: center;
  width: 58px;
  height: 58px;
  margin: 0 0 5px;
  border-radius: 18px;
  box-shadow: 0 12px 28px rgba(22, 135, 121, .1);
}

.admin-page .admin-panel.admin-locked .admin-session-check > strong {
  grid-area: title;
  align-self: center;
  line-height: 1.4;
}

.admin-page .admin-panel.admin-locked .admin-session-check > p:not(.error-message) {
  grid-area: copy;
  margin: 0;
  line-height: 1.55;
}

.admin-page .admin-panel.admin-locked .admin-session-check .admin-action {
  grid-area: action;
  margin-top: 8px;
}

.admin-page .admin-panel.admin-locked .admin-session-check .error-message {
  grid-area: error;
  margin-top: 6px;
}

.admin-page .admin-panel.admin-locked .admin-security-note {
  margin-top: 0;
  border-top: 1px solid rgba(205, 225, 218, .86);
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  border-radius: 0;
  padding: 14px 2px 0;
  background: transparent;
}

@media (max-width: 620px) {
  .admin-page .admin-panel.admin-locked .admin-session-check {
    padding: 42px 0 34px;
  }

  .admin-page .admin-panel.admin-locked .admin-session-check .security-mark {
    width: 52px;
    height: 52px;
    border-radius: 16px;
  }
}

/* Keep the header and three-column workbench inside the viewport at browser zoom levels. */
html, body { max-width: 100%; overflow-x: hidden; }
.topbar, .header-workspace-nav, .header-account, .header-account-menu, .header-account-menu summary { min-width: 0; }
.header-account-copy { min-width: 0; }

@media (min-width: 901px) {
  .studio-page .topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: clamp(10px, 2vw, 20px); }
  .studio-page .brand { grid-column: 1; justify-self: start; }
  .studio-page .header-workspace-nav { grid-column: 2; justify-self: center; margin-left: 0; }
  .studio-page .header-account { grid-column: 3; justify-self: end; margin-left: 0; }
}

@media (min-width: 1221px) {
  .studio-page .app-shell { width: calc(100% - 40px); max-width: 1780px; grid-template-columns: clamp(190px, 14vw, 220px) minmax(0, 1fr) clamp(320px, 24vw, 390px); }
  .studio-page .app-shell > *, .studio-page .studio-content, .studio-page .output-panel { min-width: 0; }
  .studio-page .studio-content, .studio-page .output-panel { overflow-x: hidden; }
}

/* Keep the active mode strip close to the taskbar without changing form spacing. */
.studio-page.studio-active .studio-content { padding-top: 14px; }
.studio-page.studio-active .mode-section { border-top: 0; padding-top: 0; }

/* 2026 monochrome identity: the supplied mark leads a black, white, and silver galaxy system. */
:root {
  --ink: #15161a;
  --muted: #696d75;
  --line: #dddfe4;
  --line-strong: #c7cad1;
  --surface: #fff;
  --surface-soft: #f4f5f7;
  --canvas: #e7e9ed;
  --accent: #202126;
  --accent-dark: #07080a;
  --accent-soft: #eceef1;
  --blue: #53697f;
  --blue-soft: #eef1f4;
  --coral: #b34f48;
  --error: #a43c35;
  --success: #397c50;
  --shadow-panel: 0 24px 70px rgba(3, 5, 9, .16);
  --shadow-card: 0 8px 24px rgba(16, 18, 24, .07);
  color: var(--ink);
  background: #0b0c10;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
.style-preset:focus-visible,
.realism-mode:focus-visible,
.region-option:focus-visible {
  outline-color: rgba(28, 30, 36, .34);
}

.brand-mark,
.brand-logo,
.gateway-brand img {
  background: transparent;
  box-shadow: none;
}

.studio-page,
.editor-page,
.admin-page,
.legal-page {
  background-color: #0b0c10;
  background-image: linear-gradient(rgba(5, 6, 9, .3), rgba(5, 6, 9, .58)), url("/galaxy-bg.jpg?v=20260910-01");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
}

.studio-page .topbar,
.editor-topbar,
.admin-page > .topbar {
  border-bottom-color: rgba(255, 255, 255, .16);
  color: #f7f8fa;
  background: rgba(9, 10, 14, .76);
  box-shadow: 0 10px 32px rgba(0, 0, 0, .22);
  backdrop-filter: blur(24px) saturate(.82);
}

.studio-page .topbar .brand,
.editor-topbar .brand,
.admin-page > .topbar .brand,
.studio-page .header-account-copy strong,
.editor-topbar .editor-save-state,
.admin-page > .topbar .header-link {
  color: #f7f8fa;
}

.studio-page .header-usage,
.studio-page .header-menu-rule { border-color: rgba(255, 255, 255, .16); }
.studio-page .header-usage span,
.studio-page .header-account-copy small,
.studio-page .header-chevron { color: #aeb2ba; }
.studio-page .header-usage strong { color: #fff; }
.studio-page .header-account-menu summary:hover,
.studio-page .header-account-menu[open] summary { background: rgba(255, 255, 255, .11); }
.header-avatar,
.project-avatar { color: #fff; background: #23252b; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16); }
.header-menu-panel { border-color: #d6d8de; background: rgba(250, 250, 251, .98); box-shadow: 0 20px 50px rgba(0, 0, 0, .24); }
.header-menu-panel button:hover { color: #050506; background: #eceef1; }

.studio-page .header-workspace-nav {
  border-color: rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .07);
}
.studio-page .header-workspace-button { color: #aeb2ba; }
.studio-page .header-workspace-button:hover { color: #fff; background: rgba(255, 255, 255, .09); }
.studio-page .header-workspace-button.active { border-color: rgba(255, 255, 255, .18); color: #101115; background: #f7f8fa; box-shadow: 0 6px 18px rgba(0, 0, 0, .24); }

.studio-page .workspace-taskbar { background: rgba(8, 9, 13, .22); }
.studio-page .workspace-taskbar-inner {
  border-color: rgba(255, 255, 255, .18);
  color: #f5f6f8;
  background: rgba(16, 17, 22, .78);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .24), inset 0 1px 0 rgba(255, 255, 255, .08);
  backdrop-filter: blur(24px) saturate(.82);
}
.workspace-taskbar-heading small { color: #aeb2ba; }
.workspace-taskbar-icon { border-color: rgba(255, 255, 255, .2); color: #fff; background: #292b31; box-shadow: none; }
.workspace-tab { border-color: rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .07); box-shadow: none; }
.workspace-tab-main { color: #b7bbc2; }
.workspace-tab-main:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.workspace-tab.active { border-color: #fff; background: #f7f8fa; box-shadow: 0 8px 20px rgba(0, 0, 0, .24); }
.workspace-tab.active .workspace-tab-main { color: #121318; }
.workspace-tab-copy small { color: #989da6; }
.workspace-tab.active .workspace-tab-copy small { color: #696d75; }
.workspace-tab-dot { background: #777c85; box-shadow: 0 0 0 3px rgba(255, 255, 255, .06); }
.workspace-tab.active .workspace-tab-dot { background: #141519; box-shadow: 0 0 0 3px rgba(20, 21, 25, .1); }
.workspace-tab-close { border-left-color: rgba(255, 255, 255, .12); color: #aeb2ba; }
.workspace-tab.active .workspace-tab-close { border-left-color: #d9dbe0; color: #696d75; }
.workspace-history-toggle { border-color: rgba(255, 255, 255, .18); color: #f4f5f7; background: rgba(255, 255, 255, .08); }
.workspace-history-toggle:hover,
.workspace-history-toggle[aria-expanded="true"] { border-color: rgba(255, 255, 255, .42); color: #111216; background: #fff; box-shadow: 0 8px 22px rgba(0, 0, 0, .22); }
.workspace-history-host { border-color: #d4d6dc; background: rgba(248, 248, 250, .97); box-shadow: 0 28px 76px rgba(0, 0, 0, .3); }
.workspace-history-host .history-heading { border-bottom-color: #dddfe4; background: rgba(248, 248, 250, .97); }

.auth-gateway {
  background-color: #07080b;
  background-image: linear-gradient(rgba(4, 5, 8, .32), rgba(4, 5, 8, .62)), url("/galaxy-bg.jpg?v=20260910-01");
}
.auth-gateway::before { background: linear-gradient(90deg, rgba(0, 0, 0, .3), transparent 52%, rgba(0, 0, 0, .22)); }
.gateway-panel { border-color: rgba(255, 255, 255, .46); background: rgba(248, 248, 250, .9); box-shadow: 0 32px 100px rgba(0, 0, 0, .48); backdrop-filter: blur(28px) saturate(.78); }
.gateway-brand img { border: 1px solid rgba(16, 17, 21, .1); }
.gateway-legal-links { color: #747881; }

.mode-gateway {
  background-color: #07080b;
  background-image: linear-gradient(rgba(4, 5, 8, .14), rgba(4, 5, 8, .28)), url("/galaxy-bg.jpg?v=20260910-01");
  background-position: center, 50% 55%;
  background-repeat: no-repeat;
  background-size: cover, cover;
}
.mode-gateway::before {
  display: block;
  z-index: 0;
  inset: 0;
  background: url("/galaxy-bg.jpg?v=20260910-01") center 55% / cover no-repeat;
  filter: brightness(1.2) contrast(1.12) saturate(1.08);
  opacity: .9;
  transform: scale(1.015);
}
.mode-gateway::after { background: rgba(4, 5, 8, .12); pointer-events: none; }
.mode-gateway-grid { position: relative; z-index: 1; }
.mode-entry-card { border-color: rgba(255, 255, 255, .26); background: rgba(20, 22, 28, .54); box-shadow: 0 26px 74px rgba(0, 0, 0, .32), inset 0 1px 0 rgba(255, 255, 255, .13); backdrop-filter: blur(20px) saturate(.72); }
.mode-entry-card:hover,
.mode-entry-card:focus-visible { border-color: rgba(255, 255, 255, .72); background: rgba(43, 45, 53, .64); box-shadow: 0 30px 86px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .22); }
.mode-entry-icon { border: 1px solid rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .1) !important; box-shadow: none; }
.mode-gateway-active { background: #07080b; }

.studio-active { background-color: #0b0c10; background-image: linear-gradient(rgba(5, 6, 9, .3), rgba(5, 6, 9, .58)), url("/galaxy-bg.jpg?v=20260910-01"); }
.studio-page .app-shell { border-color: rgba(255, 255, 255, .34); background: rgba(250, 250, 251, .93); box-shadow: 0 28px 80px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .82); backdrop-filter: blur(20px) saturate(.8); }
.studio-page .workflow-nav { border-color: #d9dbe0; background: rgba(239, 240, 243, .9); }
.studio-page .studio-content { background: rgba(255, 255, 255, .94); }
.studio-page .output-panel { border-left-color: #d7d9de; background: rgba(241, 242, 245, .92); }
.studio-page .content-heading { border-bottom-color: #e1e3e7; }
.studio-page .project-bar,
.account-card,
.history-card,
.idea-card,
.shot-card,
.selected-assets { border-color: #d9dce1; background: rgba(248, 248, 249, .9); box-shadow: none; }
.studio-page .quota-chip { border-color: #d2d5db; background: #eef0f3; }
.studio-page .mode-section,
.studio-page .form-section,
.reference-intent { border-color: #e2e4e8; }
.studio-page .section-index { color: #fff; background: #23252a; box-shadow: 0 5px 14px rgba(0, 0, 0, .16); }
.studio-page .mode-card,
.style-preset,
.region-option,
.choice { border-color: #d9dce1; background: #fafafb; }
.studio-page .mode-card:hover,
.style-preset:hover,
.region-option:hover,
.choice:hover { border-color: #aeb2ba; background: #f2f3f5; }
.studio-page .mode-card.active,
.style-preset.active,
.region-option.active,
.choice.active { border-color: #24262b; background: #eceef1; box-shadow: inset 0 0 0 1px rgba(16, 17, 21, .08), 0 8px 20px rgba(16, 17, 21, .08); }
.mode-icon { background: #2a2c32 !important; }
.original-icon { background: #53697f !important; }
.advanced-icon { background: #555861 !important; }
.mode-tag,
.reference-intent-row .choice em { color: #202126; background: #e8eaed; }
.muted-tag { color: #60646d; background: #edeef0; }
.style-preset-category-heading strong,
.field-label,
legend { color: #35373d; }
.style-prompt-detail,
.mode-notice,
.continuity-hint,
.advanced-plan { border-color: #d9dce1; background: #f2f3f5; }
.style-prompt-detail-heading,
.style-prompt-copy + .style-prompt-copy { border-color: #dfe1e5; }
.style-prompt-detail-heading span,
.style-prompt-copy > span { color: #34363c; }
.style-prompt-copy p { color: #5f636b; }
.realism-mode-list { border-color: #cfd2d8; background: #f4f5f6; }
.realism-mode { border-color: #d9dce1; }
.realism-mode:hover { background: #eceef1; }
.realism-mode.active { color: #08090b; background: #e2e4e8; box-shadow: inset 0 -2px 0 #16171b; }
.studio-page input,
.studio-page select,
.studio-page textarea { border-color: #d2d5da; background-color: rgba(255, 255, 255, .96); }
.studio-page input:focus,
.studio-page select:focus,
.studio-page textarea:focus,
input:focus,
select:focus,
textarea:focus { border-color: #3c3e45; box-shadow: 0 0 0 4px rgba(23, 24, 29, .1); }
.primary-button,
.account-primary,
.edit-primary-entry { border-color: #16171b; color: #fff; background: #1b1c20; box-shadow: 0 8px 20px rgba(0, 0, 0, .17); }
.primary-button:hover:not(:disabled),
.account-primary:hover,
.edit-primary-entry:hover { border-color: #000; color: #fff; background: #050506; box-shadow: 0 10px 24px rgba(0, 0, 0, .24); }
.secondary-button,
.account-secondary { border-color: #c9ccd2; color: #282a30; background: #fff; }
.secondary-button:hover:not(:disabled),
.account-secondary:hover { border-color: #8f949d; color: #090a0c; background: #f0f1f3; }
.step-item { color: #676b73; }
.step-item:hover,
.step-item.active { color: #0d0e11; background: #dfe1e5; }
.step-item.active b { color: #111216; }
.step-item.active i { background: #17181c; }
.nav-footer { border-color: #d6d8dd; }
.security-icon,
.edit-tool-grid svg { color: #303238; }
.studio-page .stage,
.editor-stage { border-color: #41444c; background: #090a0d; box-shadow: 0 18px 42px rgba(0, 0, 0, .28), inset 0 0 0 1px rgba(255, 255, 255, .1); }
.studio-page .stage video,
.editor-stage video { background: #090a0d; }
.studio-page .stage,
.editor-stage-empty { color: #b5b9c1; }
.studio-page .result-bar,
.studio-page .edit-handoff-panel { border-color: #d2d5da; background: rgba(248, 248, 249, .92); box-shadow: 0 10px 24px rgba(18, 19, 24, .06); }
.edit-handoff-state { color: #22242a; background: #e3e5e8; }
.edit-tool-grid a { border-color: #d4d7dc; background: rgba(255, 255, 255, .84); }
.edit-tool-grid a:hover { border-color: #a4a8b0; background: #fff; }

.editor-page::before,
.admin-page::before { background: url("/galaxy-bg.jpg?v=20260910-01") center / cover no-repeat; opacity: 1; filter: none; }
.editor-page::after,
.admin-page::after { background: rgba(8, 9, 13, .38); }
.editor-back,
.admin-page .header-link { border-color: rgba(255, 255, 255, .18); color: #f5f6f8; background: rgba(255, 255, 255, .08); box-shadow: none; }
.editor-back:hover,
.admin-page .header-link:hover { border-color: rgba(255, 255, 255, .4); color: #fff; background: rgba(255, 255, 255, .14); }
.editor-project-picker { color: #b6bac2; }
.editor-project-picker select { border-color: rgba(255, 255, 255, .2); color: #f5f6f8; background-color: rgba(255, 255, 255, .1); box-shadow: none; }
.editor-project-picker select option { color: #17181c; background: #fff; }
.editor-save-state { border-color: rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .07); }
.editor-header-actions .ai-edit-button { border-color: rgba(255, 255, 255, .26); color: #f7f8fa; background: rgba(255, 255, 255, .12); box-shadow: none; }
.editor-shell { border-color: rgba(255, 255, 255, .34); background: rgba(247, 247, 249, .9); box-shadow: 0 28px 80px rgba(0, 0, 0, .32), inset 0 1px 0 rgba(255, 255, 255, .82); backdrop-filter: blur(22px) saturate(.78); }
.editor-media,
.editor-inspector { border-color: #d8dae0; background: rgba(245, 246, 248, .92); }
.editor-inspector { background: rgba(255, 255, 255, .94); }
.editor-canvas-column { background: rgba(238, 239, 242, .88); }
.editor-pane-heading .eyebrow,
.editor-preview-heading .eyebrow,
.timeline-heading .eyebrow,
.eyebrow { color: #303238; }
.editor-preview,
.timeline-panel,
.media-item,
.model-form,
.usage-card,
.admin-list-row,
.model-row { border-color: #d5d8dd; background: rgba(255, 255, 255, .92); box-shadow: 0 10px 28px rgba(13, 14, 18, .08); }
.media-filter,
.inspector-tabs,
.ai-edit-settings,
.timeline-viewport,
.capability-grid,
.capability-toggles .toggle-row { border-color: #d6d8dd; background: rgba(235, 237, 240, .9); }
.media-filter button.active,
.inspector-tabs button.active { color: #111216; background: #fff; box-shadow: 0 5px 14px rgba(0, 0, 0, .1); }
.media-item:hover { border-color: #a9adb5; box-shadow: 0 10px 24px rgba(0, 0, 0, .1); }
.media-thumb { background: #24262b; }
.timeline-clip.active { border-color: #22242a; background: #e6e8eb; box-shadow: inset 0 0 0 1px rgba(15, 16, 19, .09); }
.ai-edit-summary { border-color: #25272d; }
.toggle { background: #b7bac1; }
input:checked + .toggle { background: #24262b; }
.editor-status { border-color: #cfd2d8; color: #292b31; background: rgba(247, 247, 249, .96); box-shadow: 0 16px 42px rgba(0, 0, 0, .2); }
.export-dialog { border-color: #ced1d7; background: rgba(250, 250, 251, .97); }

.admin-panel { border-color: rgba(255, 255, 255, .36); background: rgba(249, 249, 250, .93); box-shadow: 0 30px 90px rgba(0, 0, 0, .34), inset 0 1px 0 rgba(255, 255, 255, .9); backdrop-filter: blur(24px) saturate(.76); }
.admin-panel.admin-locked { background: rgba(249, 249, 250, .95); }
.security-mark { color: #fff; background: #25272d; box-shadow: 0 8px 20px rgba(0, 0, 0, .14); }
.admin-console-tabs,
.admin-section-tabs,
.usage-view-tabs { border-color: #d3d6db; background: #eceef1; }
.admin-console-tab.active,
.admin-section-tab.active,
.usage-view-tab.active { color: #111216; background: #fff; box-shadow: 0 6px 17px rgba(0, 0, 0, .1); }
.admin-list-row:hover,
.model-row:hover { border-color: #a5a9b1; background: #fff; }
.history-table-wrap { border-color: #d3d6db; background: rgba(255, 255, 255, .92); box-shadow: 0 7px 22px rgba(0, 0, 0, .07); }
.history-table thead { background: #eceef1; }
.admin-security-note { border-color: #d4d7dc; background: #f1f2f4; }
.model-row.is-default,
.release-row.is-current { border-color: #34363c; background: #eceef1; box-shadow: inset 0 0 0 1px rgba(16, 17, 21, .08); }
.model-row-actions .model-default { border-color: #8f949d; color: #27292f; background: #fff; }
.model-row-actions .model-default:hover { border-color: #25272d; color: #fff; background: #25272d; }
.model-row-actions .model-default.is-current,
.model-row-actions .model-default.is-current:disabled,
.release-row.is-current .release-rollback:disabled { border-color: #18191d; color: #fff; background: #18191d; box-shadow: none; }
.release-current { border-color: #c6c9cf; background: #eceef1; }
.release-current-mark { background: #1b1c20; box-shadow: 0 0 0 5px rgba(27, 28, 32, .1); }
.release-row { border-color: #d6d8dd; background: rgba(255, 255, 255, .84); }
.release-row:hover { border-color: #a9adb5; box-shadow: 0 7px 18px rgba(0, 0, 0, .08); }
.release-row-copy p { color: #5e626a; }
.release-rollback { border-color: #9498a1; color: #292b31; background: #fff; }
.release-rollback:hover:not(:disabled) { border-color: #1d1e23; color: #fff; background: #1d1e23; box-shadow: none; }
.release-rollback:disabled { color: #777b84; background: #edeef0; }
.release-empty { border-color: #cfd2d8; background: rgba(246, 247, 248, .82); }

.legal-page { background-color: #0b0c10; }
.legal-header .brand { color: #fff; }
.legal-header .secondary-button { border-color: rgba(255, 255, 255, .3); color: #fff; background: rgba(255, 255, 255, .1); backdrop-filter: blur(14px); }
.legal-header .secondary-button:hover { border-color: #fff; color: #111216; background: #fff; }
.legal-document { border-color: rgba(255, 255, 255, .45); background: rgba(250, 250, 251, .94); box-shadow: 0 30px 90px rgba(0, 0, 0, .38); backdrop-filter: blur(22px) saturate(.78); }
.legal-document p:not(.eyebrow):not(.legal-updated) { color: #50535a; }
.legal-links a { color: #18191d; }

@media (prefers-reduced-motion: reduce) {
  .mode-entry-card,
  .workspace-tab,
  .studio-active .mode-section,
  .studio-active .app-shell { animation: none; transition-duration: .01ms; }
}

/* Workflow polish: one logo curvature, compact specs, and only actionable navigation. */
.brand-mark,
.brand-logo,
.studio-page .brand-logo,
.gateway-brand img {
  border-radius: 18.667%;
}

.spec-layout { align-items: start; }
.spec-summary {
  justify-content: flex-start;
  gap: 6px;
  border-color: #d5d8dd;
  padding: 15px 16px;
  background: #f4f5f7;
}
.spec-summary > strong { color: #16171b; }
.summary-rule { border-color: #d7d9de; }
.segments { border-color: #cfd2d8; background: #fafafb; }
.segment { border-color: #d9dce1; }
.segment:hover { color: #111216; background: #eceef1; }
.segment.active,
.ratio-option.active,
.resolution-options .segment.active { color: #fff; background: #1b1c20; }
.duration-control { border-color: #cfd2d8; background: #fff; }
.step-button { color: #4f535b; background: #eceef1; }
.step-button:hover { color: #08090b; background: #dfe1e5; }
.format-badge { border-color: #c8cbd1; color: #555961; background: #eef0f2; }

/* The active preview signal uses the same quiet graphite language as the UI. */
.stage-activity { background: radial-gradient(circle at 50% 50%, rgba(205, 210, 220, .1), transparent 42%); }
.stage.is-generating .stage-state { z-index: 2; transform: translateY(23%); }
.stage.is-generating .stage-state .state-icon { border-color: rgba(255, 255, 255, .18); background: rgba(15, 17, 22, .5); }
.stage.is-generating .progress-track span { background: #d5d8df; }

@media (prefers-reduced-motion: reduce) {
  .activity-ring,
  .activity-signal,
  .activity-signal i { animation: none; }
  .activity-ring { opacity: .35; transform: scale(.82); }
  .activity-signal i { height: 34%; opacity: .8; transform: none; }
}

/* Keep every creation mode in the same neutral icon system. */
.mode-entry-icon.reference-icon,
.mode-entry-icon.original-icon,
.mode-entry-icon.advanced-icon,
.mode-entry-icon.one-shot-icon,
.mode-icon.reference-icon,
.mode-icon.original-icon,
.mode-icon.advanced-icon,
.mode-icon.one-shot-icon {
  border: 1px solid rgba(255, 255, 255, .2);
  color: #fff;
  background: #44474e !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
  transition: border-color .2s ease, background-color .2s ease;
}

.mode-entry-card:hover .mode-entry-icon,
.mode-entry-card:focus-visible .mode-entry-icon {
  border-color: rgba(255, 255, 255, .34);
  background: #51545c !important;
}

@media (min-width: 1221px) {
  .step-item[data-target="outputSection"] { display: none; }
}

/* Keep the compact model strip usable when the studio has less desktop width. */
@media (min-width: 761px) and (max-width: 1100px) {
  .studio-active #specSection .spec-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .studio-active #specSection .spec-model-field,
  .studio-active #specSection .spec-ratio-field,
  .studio-active #specSection .spec-duration-field,
  .studio-active #specSection .spec-resolution-field {
    grid-column: auto;
  }
  .studio-active #specSection .spec-summary {
    grid-column: 1 / -1;
  }
}

/* Dialog and form surfaces share one restrained system instead of competing
   border, focus, and spacing treatments. */
.login-dialog,
.export-dialog {
  border-color: #d7d9de;
  border-radius: 26px;
  background: rgba(250, 250, 251, .97);
  box-shadow: 0 28px 80px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .88);
  backdrop-filter: blur(24px) saturate(.86);
}
.login-dialog::backdrop,
.export-dialog::backdrop {
  background: rgba(5, 6, 9, .62);
  backdrop-filter: blur(12px) saturate(.78);
}
.login-dialog form,
.reset-content,
.asset-library-content,
.export-dialog-content {
  padding: 28px;
}
.dialog-heading { align-items: center; margin-bottom: 22px; }
.dialog-heading h2 { color: #16171b; font-size: 22px; line-height: 1.3; }
.dialog-heading .eyebrow { color: #686c74; letter-spacing: .08em; }
.dialog-close {
  border-radius: 50%;
  color: #747880;
  background: #eef0f2;
  font-size: 20px;
  transition: color .18s ease, background-color .18s ease, transform .18s ease;
}
.dialog-close:hover { color: #111216; background: #e2e4e8; transform: rotate(4deg); }
.login-dialog .field-label { color: #3c3e45; }
.login-dialog .field-label:not(:first-of-type) { margin-top: 16px; }
.login-dialog input,
.login-dialog select,
.login-dialog textarea,
.export-dialog select {
  border-color: #d0d3d9;
  border-radius: 13px;
  background: #f7f8f9;
}
.login-dialog input,
.login-dialog select { min-height: 46px; }
.login-dialog textarea { min-height: 118px; }
.login-dialog input:focus,
.login-dialog select:focus,
.login-dialog textarea:focus,
.export-dialog select:focus,
.studio-page input:focus-visible,
.studio-page select:focus-visible,
.studio-page textarea:focus-visible {
  outline: none !important;
  border-color: #5d6169;
  box-shadow: 0 0 0 3px rgba(35, 37, 42, .13);
}
.login-dialog .dialog-submit { min-height: 48px; margin-top: 19px; border-radius: 14px; }

.new-task-dialog {
  width: min(640px, calc(100% - 32px));
  border-color: #d7d9de;
  background: rgba(250, 250, 251, .96);
}
.new-task-content { padding: 28px; }
.new-task-content .dialog-heading { margin-bottom: 20px; }
.new-task-options { gap: 10px; }
.new-task-option {
  border-color: #d9dce1;
  border-radius: 15px;
  padding: 11px;
  background: #f7f8f9;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .86);
}
.new-task-option:hover,
.new-task-option:focus-visible {
  border-color: #25272d;
  background: #fff;
  box-shadow: 0 8px 20px rgba(15, 16, 20, .09);
  transform: translateY(-1px);
}
.new-task-option-icon,
.new-task-option:nth-child(2) .new-task-option-icon,
.new-task-option:nth-child(3) .new-task-option-icon,
.new-task-option:nth-child(4) .new-task-option-icon {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 12px;
  background: #24262b;
  box-shadow: none;
}
.new-task-option-arrow { color: #676b73; font-size: 22px; }
.new-task-secondary { border-top-color: #dfe1e5; }
.project-dialog-secondary {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 13px;
  border-top: 1px solid #dfe1e5;
  padding-top: 11px;
}
.project-dialog-secondary .text-button { min-height: 30px; padding: 5px 7px; }
.project-dialog-secondary small { color: var(--muted); font-size: 10px; line-height: 1.45; }

.project-mode-summary {
  margin-bottom: 17px;
  border-color: #d9dce1;
  border-radius: 15px;
  padding: 10px 12px;
  background: #eef0f2;
}
.project-mode-summary-icon { width: 34px; height: 34px; flex-basis: 34px; border-radius: 11px; background: #24262b; }
#projectForm .dialog-submit { margin-top: 18px; }

/* Project creation is a single focused action: keep every field on one
   alignment line and let the selected mode read as metadata, not a second card. */
#projectForm {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  row-gap: 0;
}
#projectForm .dialog-heading {
  margin-bottom: 22px;
}
#projectForm .dialog-heading h2 {
  font-size: 24px;
  letter-spacing: 0;
}
#projectForm .project-mode-summary {
  min-height: 70px;
  margin-bottom: 22px;
  border-color: #e0e2e6;
  border-radius: 16px;
  padding: 12px 14px;
  background: #f1f2f4;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .82);
}
#projectForm .project-mode-summary-icon {
  width: 40px;
  height: 40px;
  flex-basis: 40px;
  border-radius: 13px;
  background: #24262b;
}
#projectForm .project-mode-summary-icon svg {
  width: 18px;
  height: 18px;
}
#projectForm .project-mode-summary small {
  color: #777b83;
  font-size: 10px;
  line-height: 1.25;
}
#projectForm .project-mode-summary strong {
  margin-top: 3px;
  color: #202126;
  font-size: 13px;
  line-height: 1.3;
}
#projectForm .field-label {
  margin: 0 0 7px;
  color: #4b4e55;
  font-size: 12px;
  line-height: 1.35;
}
#projectForm .field-label:not(:first-of-type) {
  margin-top: 4px;
}
#projectForm input {
  display: block;
  width: 100%;
  min-height: 50px;
  margin-bottom: 18px;
  border: 1px solid #d6d8dd;
  border-radius: 14px;
  padding: 0 16px;
  color: #202126;
  background: #fbfbfc;
  background-clip: padding-box;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease;
}
#projectForm input:hover {
  border-color: #c1c4ca;
  background: #fff;
}
#projectForm input:focus,
#projectForm input:focus-visible {
  outline: none !important;
  border: 1px solid #aeb2ba;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(105, 110, 120, .08);
}
#projectForm .dialog-submit {
  min-height: 52px;
  margin-top: 18px;
  border-radius: 16px;
  letter-spacing: 0;
  box-shadow: 0 10px 24px rgba(18, 19, 23, .16);
}
#projectForm .dialog-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 13px 28px rgba(18, 19, 23, .21);
}

/* Keep the other dialog forms on the same width, focus, and control rhythm. */
.login-dialog form > input,
.login-dialog form > select,
.login-dialog form > textarea,
.login-dialog .reset-content input,
.login-dialog .reset-content select,
.login-dialog .reset-content textarea {
  width: 100%;
}
.login-dialog form > input:focus,
.login-dialog form > select:focus,
.login-dialog form > textarea:focus,
.login-dialog .reset-content input:focus,
.login-dialog .reset-content select:focus,
.login-dialog .reset-content textarea:focus {
  outline: none !important;
}

@media (max-width: 520px) {
  #projectForm .dialog-heading h2 { font-size: 21px; }
  #projectForm .project-mode-summary { margin-bottom: 19px; }
  #projectForm input { margin-bottom: 15px; }
  #projectForm .dialog-submit { margin-top: 15px; }
}

/* Adaptive workbench: the active stage owns the working space while the
   remaining mode-specific stages stay available as a quiet, ordered rail. */
@keyframes workflow-stage-open {
  from { opacity: .72; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}

.studio-page.studio-active .workflow-nav {
  display: none;
}

.studio-page.studio-active .app-shell {
  grid-template-columns: minmax(0, 1fr);
}

.studio-page.studio-active .studio-content {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 10px 14px 12px;
}

.studio-page.studio-active .content-heading {
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  padding-bottom: 10px;
}

.studio-page.studio-active .content-heading h1 {
  font-size: 21px;
  line-height: 1.25;
}

.studio-page.studio-active .content-heading p:not(.eyebrow) {
  max-width: 760px;
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.35;
}

.studio-page.studio-active .quota-chip {
  padding: 8px 11px;
}

.workflow-rail {
  --workflow-open: minmax(0, 1fr);
  --workflow-closed: 52px;
  min-width: 0;
  min-height: 0;
  flex: 1 1 0;
  display: grid;
  grid-template-columns: var(--workflow-open) repeat(3, var(--workflow-closed));
  gap: 6px;
  overflow: hidden;
  transition: grid-template-columns .48s cubic-bezier(.2, .8, .2, 1);
}

.workflow-rail > form {
  display: contents;
}

.workflow-rail[data-active-stage="2"] {
  grid-template-columns: var(--workflow-open) repeat(3, var(--workflow-closed));
}

.workflow-rail[data-active-stage="3"] {
  grid-template-columns: var(--workflow-closed) var(--workflow-open) repeat(2, var(--workflow-closed));
}

.workflow-rail[data-active-stage="4"] {
  grid-template-columns: repeat(2, var(--workflow-closed)) var(--workflow-open) var(--workflow-closed);
}

.workflow-rail[data-active-stage="5"] {
  grid-template-columns: repeat(3, var(--workflow-closed)) var(--workflow-open);
}

.workflow-stage {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(215, 218, 225, .94);
  border-radius: 18px;
  background: rgba(244, 245, 247, .78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .82);
  transition: opacity .28s ease, transform .48s cubic-bezier(.2, .8, .2, 1), background-color .28s ease, border-color .28s ease, box-shadow .28s ease;
}

.workflow-stage.is-open {
  border-color: rgba(191, 195, 204, .98);
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 14px 32px rgba(15, 16, 20, .11), inset 0 1px 0 rgba(255, 255, 255, .98);
  animation: workflow-stage-open .48s cubic-bezier(.2, .8, .2, 1) both;
}

.workflow-stage.is-complete {
  border-color: rgba(184, 188, 197, .92);
}

.workflow-stage-header {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  border: 0;
  border-bottom: 1px solid rgba(218, 220, 226, .78);
  padding: 8px 10px;
  color: #6d7078;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: color .22s ease, background-color .22s ease, border-color .22s ease;
}

.workflow-stage-header:hover,
.workflow-stage-header:focus-visible {
  color: #24262b;
  background: rgba(255, 255, 255, .6);
}

.workflow-stage.is-open .workflow-stage-header {
  color: #22242a;
  border-bottom-color: rgba(215, 217, 223, .96);
}

.workflow-stage-number {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(191, 194, 201, .8);
  border-radius: 10px;
  color: #777a82;
  background: rgba(235, 236, 239, .9);
  font-size: 9px;
  font-weight: 600;
  line-height: 1;
  transition: color .22s ease, border-color .22s ease, background-color .22s ease;
}

.workflow-stage.is-open .workflow-stage-number,
.workflow-stage.is-complete .workflow-stage-number {
  border-color: #35373d;
  color: #fff;
  background: #35373d;
}

.workflow-stage-heading {
  min-width: 0;
  flex: 1 1 auto;
}

.workflow-stage-heading strong,
.workflow-stage-heading small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-stage-heading strong {
  color: inherit;
  font-size: 12px;
  line-height: 1.35;
}

.workflow-stage-heading small {
  margin-top: 3px;
  color: #92959c;
  font-size: 9px;
  line-height: 1.35;
}

.workflow-stage-status {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: #bfc1c7;
  box-shadow: 0 0 0 3px rgba(191, 193, 199, .17);
}

.workflow-stage.is-open .workflow-stage-status {
  background: #303238;
  box-shadow: 0 0 0 3px rgba(48, 50, 56, .12);
}

.workflow-stage.is-complete .workflow-stage-status {
  background: #70737b;
}

.workflow-stage-chevron {
  flex: 0 0 auto;
  color: #9b9ea5;
  font-size: 17px;
  line-height: 1;
  transform: rotate(-90deg);
  transition: color .22s ease, transform .4s cubic-bezier(.2, .8, .2, 1);
}

.workflow-stage.is-open .workflow-stage-chevron {
  color: #35373d;
  transform: rotate(0deg);
}

.workflow-stage-body {
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 12px;
  opacity: 1;
  transition: opacity .22s ease, padding .35s ease;
}

.workflow-stage:not(.is-open) .workflow-stage-body {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.workflow-stage:not(.is-open) .workflow-stage-header {
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  border-bottom: 0;
  padding: 16px 7px;
  text-align: center;
}

.workflow-stage:not(.is-open) .workflow-stage-heading {
  flex: 0 0 auto;
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.workflow-stage:not(.is-open) .workflow-stage-heading strong,
.workflow-stage:not(.is-open) .workflow-stage-heading small {
  overflow: visible;
  white-space: normal;
}

.workflow-stage:not(.is-open) .workflow-stage-heading small {
  display: none;
}

.workflow-stage:not(.is-open) .workflow-stage-status {
  order: 3;
}

.workflow-stage:not(.is-open) .workflow-stage-chevron {
  order: 2;
  transform: rotate(-90deg);
}

.workflow-stage.is-open .workflow-next-button,
.workflow-stage.is-open .workflow-start-button {
  width: 100%;
}

.workflow-stage-body > .form-section,
.workflow-stage-body > .creative-plan-panel,
.workflow-stage-body > .output-panel {
  margin-top: 0;
}

.workflow-stage-body > #briefSection,
.workflow-stage-body > #creativePlanPanel,
.workflow-stage-body > #outputSection {
  border-top: 0;
  padding-top: 0;
}

.workflow-stage-body > #briefSection > .section-title,
.workflow-stage-body > #creativePlanPanel > .plan-heading,
.workflow-stage-body > #outputSection > .output-heading {
  margin-top: 0;
}

.workflow-stage-body > #specSection {
  margin: 0;
}

.workflow-stage-body > #specSection > .section-title {
  display: none;
}

.workflow-stage-body > #specSection .advanced-plan {
  margin-top: 10px;
}

.workflow-stage-body > #formActions,
.workflow-stage-body > .form-actions {
  width: min(100%, 980px);
  margin-top: 16px;
}

.workflow-stage-body > .form-actions {
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  align-items: center;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid #e2e4e8;
}

.workflow-stage-body > .form-actions .auth-panel {
  min-height: 46px;
  padding: 8px 11px;
  border-radius: 12px;
  background: #f5f6f7;
}

.workflow-stage-body > .form-actions .auth-copy strong {
  font-size: 12px;
}

.workflow-stage-body > .form-actions .auth-copy span {
  margin-top: 2px;
  font-size: 10px;
}

.workflow-stage-body > .form-actions #generateButton {
  min-height: 46px;
  border-radius: 12px;
}

.workflow-stage-body > #formError,
.workflow-stage-body > .error-message {
  margin-bottom: 0;
}

.workflow-stage-body > #outputSection {
  min-width: 0;
}

.workflow-stage-body > #outputSection .stage {
  min-height: 260px;
  max-height: none;
}

@media (min-width: 761px) and (max-width: 1220px) {
  .studio-page.studio-active .app-shell {
    width: calc(100% - 24px);
    margin-top: 12px;
  }

  .studio-page.studio-active .studio-content {
    padding-inline: 12px;
  }

  .workflow-rail {
    --workflow-open: minmax(0, 1fr);
    --workflow-closed: 48px;
  }

  .workflow-stage-body {
    padding: 10px;
  }
}

@media (max-width: 760px) {
  .studio-page.studio-active .app-shell {
    width: 100%;
    min-height: calc(100dvh - 128px);
    margin: 8px 0 0;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .studio-page.studio-active .studio-content {
    overflow: visible;
    padding: 10px 10px 14px;
  }

  .studio-page.studio-active .content-heading {
    align-items: flex-start;
    margin-bottom: 8px;
    padding-bottom: 8px;
  }

  .studio-page.studio-active .content-heading h1 {
    font-size: 20px;
  }

  .studio-page.studio-active .content-heading p:not(.eyebrow),
  .studio-page.studio-active .quota-chip {
    display: none;
  }

  .workflow-rail {
    min-height: 0;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    padding-bottom: 4px;
  }

  .workflow-rail::-webkit-scrollbar {
    display: none;
  }

  .workflow-stage,
  .workflow-rail[data-active-stage="2"] .workflow-stage,
  .workflow-rail[data-active-stage="3"] .workflow-stage,
  .workflow-rail[data-active-stage="4"] .workflow-stage,
  .workflow-rail[data-active-stage="5"] .workflow-stage {
    flex: 0 0 min(82vw, 480px);
    height: 100%;
    scroll-snap-align: start;
  }

  .workflow-stage:not(.is-open) .workflow-stage-body {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
  }

  .workflow-stage:not(.is-open) .workflow-stage-header {
    min-height: 56px;
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    gap: 9px;
    border-bottom: 1px solid rgba(218, 220, 226, .78);
    padding: 8px 10px;
    text-align: left;
  }

  .workflow-stage:not(.is-open) .workflow-stage-heading {
    flex: 1 1 auto;
    writing-mode: initial;
  }

  .workflow-stage:not(.is-open) .workflow-stage-heading strong,
  .workflow-stage:not(.is-open) .workflow-stage-heading small {
    overflow: hidden;
    white-space: nowrap;
  }

  .workflow-stage:not(.is-open) .workflow-stage-heading small {
    display: block;
  }

  .workflow-stage:not(.is-open) .workflow-stage-status,
  .workflow-stage:not(.is-open) .workflow-stage-chevron {
    order: initial;
  }

  .workflow-stage-body {
    padding: 10px;
  }

  .workflow-stage-body > #outputSection .stage {
    min-height: 220px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .workflow-stage,
  .workflow-stage-header,
  .workflow-stage-number,
  .workflow-stage-chevron,
  .workflow-stage-body {
    transition-duration: .01ms !important;
  }

  .workflow-stage.is-open {
    animation: none;
  }
}

/* Compact adaptive workbench: keep navigation quiet and reserve the viewport
   for the active stage's actual controls. */
@media (min-width: 761px) {
  body.studio-page.studio-active {
    height: 100dvh;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .studio-page.studio-active > .topbar {
    flex: 0 0 50px;
    height: 50px;
    min-height: 50px;
    padding-inline: clamp(16px, 2.2vw, 32px);
  }

  .studio-page.studio-active .brand {
    gap: 8px;
    font-size: 14px;
  }

  .studio-page.studio-active .brand-mark,
  .studio-page.studio-active .brand-logo {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
    border-radius: 10px;
  }

  .studio-page.studio-active .header-workspace-nav {
    padding: 2px;
    border-radius: 11px;
  }

  .studio-page.studio-active .header-workspace-button {
    min-height: 28px;
    gap: 5px;
    border-radius: 8px;
    padding-inline: 8px;
    font-size: 10px;
  }

  .studio-page.studio-active .header-workspace-button svg {
    width: 13px;
    height: 13px;
  }

  .studio-page.studio-active .header-account-menu summary {
    min-height: 34px;
  }

  .studio-page.studio-active .workspace-taskbar {
    flex: 0 0 auto;
    top: 50px;
    padding-top: 4px;
  }

  .studio-page.studio-active .workspace-taskbar-inner {
    width: min(calc(100% - 32px), 1780px);
    min-height: 42px;
    gap: 10px;
    border-radius: 13px;
    padding: 4px 7px 4px 10px;
  }

  .studio-page.studio-active .workspace-taskbar-heading {
    min-width: 104px;
    gap: 7px;
  }

  .studio-page.studio-active .workspace-taskbar-heading strong {
    font-size: 11px;
  }

  .studio-page.studio-active .workspace-taskbar-heading small {
    font-size: 8px;
  }

  .studio-page.studio-active .workspace-taskbar-icon {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
    border-radius: 9px;
  }

  .studio-page.studio-active .workspace-taskbar-icon svg {
    width: 14px;
    height: 14px;
  }

  .studio-page.studio-active .workspace-tab-list {
    gap: 6px;
  }

  .studio-page.studio-active .workspace-tab {
    min-width: 132px;
    max-width: 210px;
    border-radius: 11px;
  }

  .studio-page.studio-active .workspace-tab-main {
    gap: 6px;
    border-radius: 10px 0 0 10px;
    padding: 5px 7px 5px 8px;
  }

  .studio-page.studio-active .workspace-tab-close {
    width: 25px;
    min-width: 25px;
    flex-basis: 25px;
    border-radius: 0 10px 10px 0;
    font-size: 16px;
  }

  .studio-page.studio-active .workspace-tab-copy strong {
    font-size: 10px;
  }

  .studio-page.studio-active .workspace-tab-copy small {
    font-size: 8px;
  }

  .studio-page.studio-active .workspace-taskbar-hint {
    display: none;
  }

  .studio-page.studio-active .workspace-taskbar-actions {
    gap: 5px;
  }

  .studio-page.studio-active .workspace-history-toggle {
    min-height: 30px;
    gap: 5px;
    border-radius: 9px;
    padding-inline: 8px;
    font-size: 9px;
  }

  .studio-page.studio-active .workspace-history-toggle svg {
    width: 13px;
    height: 13px;
  }

  .studio-page.studio-active > .app-shell {
    flex: 1 1 0;
    width: min(calc(100% - 32px), 1780px);
    min-height: 0;
    margin: 8px auto 8px;
  }

  .studio-page.studio-active .studio-content {
    padding: 8px 10px 10px;
  }

  .studio-page.studio-active .content-heading {
    margin-bottom: 6px;
    padding-bottom: 7px;
  }

  .studio-page.studio-active .content-heading h1 {
    font-size: 18px;
  }

  .studio-page.studio-active .content-heading p:not(.eyebrow) {
    display: none;
  }

  .studio-page.studio-active .quota-chip {
    padding: 6px 9px;
    border-radius: 10px;
  }

  .workflow-rail {
    --workflow-closed: 42px;
    gap: 5px;
  }

  .workflow-stage {
    border-radius: 14px;
  }

  .workflow-stage-header {
    min-height: 46px;
    gap: 7px;
    padding: 6px 8px;
  }

  .workflow-stage-number {
    width: 24px;
    height: 24px;
    flex-basis: 24px;
    border-radius: 8px;
    font-size: 8px;
  }

  .workflow-stage-heading strong {
    font-size: 11px;
  }

  .workflow-stage-heading small {
    margin-top: 2px;
    font-size: 8px;
  }

  .workflow-stage-status {
    width: 6px;
    height: 6px;
    flex-basis: 6px;
  }

  .workflow-stage-chevron {
    font-size: 14px;
  }

  .workflow-stage-body {
    padding: 9px;
  }

  .workflow-stage:not(.is-open) .workflow-stage-header {
    gap: 8px;
    padding: 12px 5px;
  }

  .workflow-stage:not(.is-open) .workflow-stage-heading strong {
    font-size: 10px;
  }

  .workflow-stage.is-open .workflow-next-button,
  .workflow-stage.is-open .workflow-start-button {
    min-height: 36px;
    margin-top: 10px;
    font-size: 10px;
  }

  .workflow-stage-body > #specSection .spec-layout {
    grid-template-columns: minmax(0, 1.45fr) minmax(200px, .8fr);
    gap: 9px;
  }

  .workflow-stage-body > #specSection .spec-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
    gap: 9px;
  }

  .workflow-stage-body > #specSection .spec-field {
    min-height: 68px;
    border-radius: 11px;
    padding: 8px 9px;
  }

  .workflow-stage-body > #specSection .spec-model-field,
  .workflow-stage-body > #specSection .spec-ratio-field,
  .workflow-stage-body > #specSection .spec-duration-field,
  .workflow-stage-body > #specSection .spec-resolution-field {
    grid-column: auto;
  }

  .workflow-stage-body > #specSection .spec-summary {
    min-height: 68px;
    border-radius: 11px;
    padding: 8px 10px;
  }

  .workflow-stage-body > #specSection .spec-summary > strong {
    font-size: 13px;
  }

  .workflow-stage-body > #specSection .ratio-options {
    min-height: 36px;
  }

  .workflow-stage-body > #specSection .ratio-option {
    min-height: 34px;
  }

  .workflow-stage-body > #specSection .duration-control {
    height: 34px;
  }

  .workflow-stage-body > #specSection .resolution-options {
    min-height: 34px;
  }

  .workflow-stage-body > #specSection .resolution-options .segment {
    min-height: 32px;
  }

  .workflow-stage-body > #specSection .advanced-plan {
    margin-top: 8px;
    padding: 8px 10px;
  }

  .workflow-stage-body > #briefSection {
    margin-top: 0;
  }

  .workflow-stage-body > #briefSection > .section-title {
    margin-bottom: 9px;
  }

  .workflow-stage-body > #briefSection .prompt-wrap {
    max-width: 780px;
    margin-top: 10px;
  }

  .workflow-stage-body > #briefSection .prompt-wrap textarea {
    min-height: 76px;
    max-height: 110px;
    resize: vertical;
  }

  .workflow-stage-body > #briefSection .style-preset-section,
  .workflow-stage-body > #briefSection .realism-section,
  .workflow-stage-body > #briefSection .region-section {
    margin-top: 12px;
  }

  .workflow-stage-body > #briefSection .field-help {
    margin-block: 5px 9px;
  }

  .workflow-stage-body > #formActions,
  .workflow-stage-body > .form-actions {
    width: min(100%, 980px);
    max-width: 980px;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
    gap: 12px;
    margin-top: 10px;
  }

  .workflow-stage-body > #formActions .auth-panel,
  .workflow-stage-body > .form-actions .auth-panel,
  .workflow-stage-body > #formActions #generateButton,
  .workflow-stage-body > .form-actions #generateButton {
    min-height: 46px;
    border-radius: 11px;
  }

  .workflow-stage-body > #formError,
  .workflow-stage-body > .error-message {
    max-width: 780px;
  }

  .workflow-stage-body > #ideaChooser {
    margin: 0;
    padding: 12px;
  }

  .workflow-stage-body > #ideaChooser .idea-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .workflow-stage-body > #ideaChooser .idea-card {
    padding: 9px;
  }

  .workflow-stage-body > #ideaChooser .idea-actions {
    margin-top: 9px;
  }

  .workflow-stage-body > #creativePlanPanel,
  .workflow-stage-body > #outputSection {
    padding: 0;
  }

  .workflow-stage-body > #creativePlanPanel .plan-editor-grid {
    gap: 8px;
    margin-top: 10px;
  }

  .workflow-stage-body > #creativePlanPanel .plan-field textarea {
    min-height: 64px;
  }

  .workflow-stage-body > #creativePlanPanel .production-editor textarea {
    min-height: 120px;
  }

  .workflow-stage-body > #outputSection .stage {
    min-height: 220px;
  }
}

@media (min-width: 761px) and (max-width: 1220px) {
  .workflow-rail {
    --workflow-closed: 38px;
  }

  .workflow-stage-body > #specSection .spec-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .studio-page.studio-active .topbar {
    min-height: 52px;
    padding-block: 7px;
  }

  .studio-page.studio-active .workspace-taskbar {
    padding-top: 3px;
  }

  .studio-page.studio-active .workspace-taskbar-inner {
    min-height: 48px;
    border-radius: 14px;
    padding-block: 4px;
  }

  .studio-page.studio-active .workspace-taskbar-heading {
    min-width: 92px;
  }

  .studio-page.studio-active .workspace-taskbar-hint {
    display: none;
  }

  .studio-page.studio-active .studio-content {
    padding: 7px 8px 10px;
  }

  .studio-page.studio-active .content-heading {
    margin-bottom: 6px;
    padding-bottom: 6px;
  }

  .studio-page.studio-active .content-heading h1 {
    font-size: 18px;
  }

  .workflow-rail {
    gap: 6px;
  }

  .workflow-stage,
  .workflow-rail[data-active-stage="2"] .workflow-stage,
  .workflow-rail[data-active-stage="3"] .workflow-stage,
  .workflow-rail[data-active-stage="4"] .workflow-stage,
  .workflow-rail[data-active-stage="5"] .workflow-stage {
    flex-basis: min(86vw, 480px);
  }

  .workflow-stage-body {
    padding: 8px;
  }

  .workflow-stage-body > #briefSection .prompt-wrap textarea {
    min-height: 88px;
  }
}

/* Content-led layout for the horizontal workbench. The stage body may fill
   the viewport, but its controls should keep their natural height. */
.workflow-stage-body > #specSection {
  height: max-content;
  min-height: 0;
  overflow: visible;
}

.workflow-stage-body > #specSection .spec-layout {
  grid-template-columns: minmax(0, 1fr) minmax(220px, .72fr);
  align-items: start;
  height: max-content;
  min-height: 0;
  gap: 12px;
}

.workflow-stage-body > #specSection .spec-main {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  align-items: start;
  grid-auto-rows: max-content;
  height: max-content;
  min-height: 0;
  gap: 10px;
}

.workflow-stage-body > #specSection .spec-model-field,
.workflow-stage-body > #specSection .spec-ratio-field,
.workflow-stage-body > #specSection .spec-duration-field,
.workflow-stage-body > #specSection .spec-resolution-field {
  grid-column: auto !important;
  grid-row: auto;
}

.workflow-stage-body > #specSection .spec-field,
.workflow-stage-body > #specSection .spec-summary {
  align-self: start;
  height: auto;
  min-height: 0;
  box-sizing: border-box;
}

.workflow-stage-body > #specSection .spec-field {
  justify-content: flex-start;
}

.workflow-stage-body > #specSection .spec-summary {
  grid-column: 2 !important;
  grid-row: 1 / span 2;
}

.workflow-stage-body > #specSection .spec-model-field select {
  min-height: 40px;
}

.workflow-stage-body > #briefSection {
  height: max-content;
  min-height: 0;
  overflow: visible;
}

.workflow-stage-body > #briefSection .style-preset-list,
.workflow-stage-body > #briefSection .style-preset-options,
.workflow-stage-body > #briefSection .realism-mode-list,
.workflow-stage-body > #briefSection .region-list {
  align-items: start;
  align-content: start;
  grid-auto-rows: max-content;
  height: max-content;
  min-height: 0;
}

.workflow-stage-body > #briefSection .style-preset-category,
.workflow-stage-body > #briefSection .style-preset,
.workflow-stage-body > #briefSection .realism-mode,
.workflow-stage-body > #briefSection .region-option {
  align-self: start;
  height: auto;
  min-height: 0;
}

.workflow-stage-body > #briefSection .style-preset {
  min-height: 72px;
}

.workflow-stage-body > #briefSection .realism-mode,
.workflow-stage-body > #briefSection .region-option {
  min-height: 58px;
}

/* Reference intent is a compact decision point. Keep the grid row driven by
   its text instead of letting the active stage stretch the cards to viewport
   height and push the upload controls below the fold. */
.workflow-stage-body > #briefSection #referenceControls,
.workflow-stage-body > #briefSection .analysis-choice,
.workflow-stage-body > #briefSection .reference-intent {
  align-self: start;
  height: max-content;
  min-height: 0;
}

.workflow-stage-body > #briefSection .reference-intent-row {
  align-items: start;
  align-content: start;
  grid-auto-rows: max-content;
  grid-template-rows: 82px;
  height: max-content;
  min-height: 0;
}

.workflow-stage-body > #briefSection .reference-intent-row .choice {
  align-self: start;
  height: 82px;
  max-height: 82px;
  min-height: 82px;
  box-sizing: border-box;
  overflow: hidden;
}

.workflow-stage-body > #briefSection .reference-intent-row .choice > span {
  min-width: 0;
}

.workflow-stage-body > #briefSection .reference-intent-row .choice small {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

@media (min-width: 761px) and (max-width: 1220px) {
  .workflow-stage-body > #specSection .spec-layout {
    grid-template-columns: minmax(0, 1fr) minmax(190px, .72fr);
  }
}

@media (max-width: 760px) {
  .workflow-stage-body > .form-actions {
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding-top: 10px;
  }

  .workflow-stage-body > #specSection .spec-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .workflow-stage-body > #specSection .spec-main {
    grid-template-columns: minmax(0, 1fr);
  }

  .workflow-stage-body > #specSection .spec-summary {
    grid-column: 1 !important;
    grid-row: auto;
  }
}

/* Purpose, visual language and pace are independent decisions. Keep each row
   visible and compact so a user can combine them without horizontal scrolling. */
.workflow-stage-body > #briefSection .style-preset-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 11px;
  overflow: visible;
  padding: 1px;
}

.workflow-stage-body > #briefSection .style-preset-category {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.workflow-stage-body > #briefSection .style-preset-category-heading {
  display: flex;
  min-height: 0;
  margin: 0;
  padding: 0;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.workflow-stage-body > #briefSection .style-preset-category-heading strong {
  color: #32353a;
  font-size: 11px;
  line-height: 1.35;
}

.workflow-stage-body > #briefSection .style-preset-category-heading span {
  color: #8a8e96;
  font-size: 8px;
  line-height: 1.35;
  white-space: normal;
}

.workflow-stage-body > #briefSection .style-preset-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  align-items: stretch;
  gap: 7px;
  min-width: 0;
}

.workflow-stage-body > #briefSection .style-preset {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 58px;
  height: 58px;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  border-radius: 11px;
  padding: 8px 26px 8px 10px;
}

.workflow-stage-body > #briefSection .style-preset strong,
.workflow-stage-body > #briefSection .style-preset small {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-stage-body > #briefSection .style-preset strong {
  font-size: 11px;
  line-height: 1.35;
}

.workflow-stage-body > #briefSection .style-preset small {
  width: 100%;
  color: #74777f;
  font-size: 9px;
  line-height: 1.4;
  white-space: normal;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.workflow-stage-body > #briefSection .style-preset.active::after {
  content: "";
  position: absolute;
  top: 9px;
  right: 9px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(22, 135, 121, .12);
}

@media (max-width: 760px) {
  .workflow-stage-body > #briefSection .style-preset-category {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  .workflow-stage-body > #briefSection .style-preset-category-heading {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: baseline;
    gap: 7px;
  }

  .workflow-stage-body > #briefSection .style-preset-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .workflow-stage-body > #briefSection .style-preset-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* One-shot is intentionally a shorter public workflow. The plan and shot
   stages remain mounted for the existing generation pipeline, but are not
   presented as extra steps to someone who only asked for one video. */
.workflow-rail[data-mode="one-shot"] {
  grid-template-columns: minmax(0, 1fr) var(--workflow-closed);
}

.workflow-rail[data-mode="one-shot"][data-active-stage="2"] {
  grid-template-columns: minmax(0, 1fr) var(--workflow-closed);
}

.workflow-rail[data-mode="one-shot"][data-active-stage="5"] {
  grid-template-columns: var(--workflow-closed) minmax(0, 1fr);
}

.workflow-rail[data-mode="one-shot"] #workflowStage3,
.workflow-rail[data-mode="one-shot"] #workflowStage4 {
  display: none;
}

.workflow-rail[data-mode="one-shot"] > form {
  display: contents;
}

.workflow-rail[data-mode="one-shot"] > #workflowStage5 {
  grid-column: 2;
}

.workflow-rail[data-mode="one-shot"] .workflow-stage-body > #briefSection > .section-title {
  margin-bottom: 16px;
}

.workflow-rail[data-mode="one-shot"] .workflow-stage-body > #briefSection .prompt-wrap {
  max-width: 900px;
  margin-top: 0;
}

.workflow-rail[data-mode="one-shot"] .workflow-stage-body > #briefSection .prompt-wrap textarea {
  min-height: 116px;
  max-height: 220px;
  border-color: #cfd2d8;
  background: #fff;
  font-size: 14px;
  line-height: 1.65;
}

.workflow-rail[data-mode="one-shot"] .workflow-stage-body > .form-actions {
  max-width: 900px;
  margin-top: 16px;
}

.workflow-rail[data-mode="one-shot"] .workflow-stage-body > .form-actions .auth-panel {
  background: #f7f7f8;
}

.workflow-rail[data-mode="one-shot"] .workflow-stage-body > .form-actions #generateButton {
  box-shadow: 0 8px 20px rgba(21, 22, 26, .12);
}

.one-shot-more-settings {
  margin-top: 12px;
  border: 1px solid #e0e2e6;
  border-radius: 14px;
  background: #fafafa;
}

.studio-page:not([data-current-mode="one-shot"]) .one-shot-more-settings > summary {
  display: none;
}

.studio-page:not([data-current-mode="one-shot"]) .one-shot-more-settings {
  margin-top: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.studio-page:not([data-current-mode="one-shot"]) .one-shot-more-content {
  display: contents;
  padding: 0;
}

.one-shot-more-settings > summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  color: #33353b;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.one-shot-more-settings > summary::-webkit-details-marker {
  display: none;
}

.one-shot-more-settings > summary:focus-visible {
  outline: 2px solid #8e939d;
  outline-offset: -2px;
  border-radius: 13px;
}

.one-shot-more-title {
  font-size: 11px;
  font-weight: 650;
}

.one-shot-more-detail {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: #858891;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.one-shot-more-chevron {
  color: #8e929a;
  font-size: 15px;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform .22s ease;
}

.one-shot-more-settings[open] > summary {
  border-bottom: 1px solid #e4e5e8;
}

.one-shot-more-settings[open] .one-shot-more-chevron {
  transform: rotate(180deg);
}

.one-shot-more-content {
  display: grid;
  gap: 12px;
  padding: 0 11px 12px;
}

.workflow-rail[data-mode="one-shot"] .one-shot-more-content .style-preset-list {
  grid-template-columns: minmax(0, 1fr);
}

@media (max-width: 760px) {
  .workflow-rail[data-mode="one-shot"] {
    grid-template-columns: minmax(82vw, 1fr) minmax(82vw, 1fr) minmax(82vw, 1fr);
  }

  .workflow-rail[data-mode="one-shot"][data-active-stage="2"] {
    grid-template-columns: minmax(82vw, 1fr) minmax(82vw, 1fr) minmax(82vw, 1fr);
  }

  .workflow-rail[data-mode="one-shot"][data-active-stage="5"] {
    grid-template-columns: minmax(82vw, 1fr) minmax(82vw, 1fr) minmax(82vw, 1fr);
  }

  .workflow-rail[data-mode="one-shot"] > #workflowStage5 {
    grid-column: auto;
  }

  .one-shot-more-settings > summary {
    min-height: 40px;
  }

  .workflow-rail[data-mode="one-shot"] .workflow-stage-body > #briefSection .prompt-wrap textarea {
    min-height: 104px;
    font-size: 13px;
  }
}

/* Final workflow layout: one state machine owns both navigation and content. */
.workflow-stage.is-workflow-hidden {
  display: none !important;
}

.workflow-stage-feedback {
  width: min(100%, 780px);
  margin: 9px 0 0;
  border: 1px solid #e5c7c7;
  border-radius: 11px;
  padding: 9px 11px;
  color: #8a2f2f;
  background: #fff7f7;
  font-size: 10px;
  line-height: 1.5;
}

.workflow-stage-feedback[hidden] {
  display: none;
}

/* Adaptive workflow widths: mode selection stays separate, while the
   workbench only reserves columns for stages visible in the current mode. */
@media (min-width: 761px) {
  .workflow-rail[data-stage-count="2"] {
    grid-template-columns: var(--workflow-open) var(--workflow-closed);
  }

  .workflow-rail[data-stage-count="2"][data-active-stage="5"] {
    grid-template-columns: var(--workflow-closed) var(--workflow-open);
  }

  .workflow-rail[data-stage-count="3"] {
    grid-template-columns: var(--workflow-open) repeat(2, var(--workflow-closed));
  }

  .workflow-rail[data-stage-count="3"][data-active-stage="3"] {
    grid-template-columns: var(--workflow-closed) var(--workflow-open) var(--workflow-closed);
  }

  .workflow-rail[data-stage-count="3"][data-active-stage="5"] {
    grid-template-columns: repeat(2, var(--workflow-closed)) var(--workflow-open);
  }
}

@media (min-width: 761px) {
  .workflow-rail {
    --workflow-closed: 40px;
    gap: 5px;
  }

  .workflow-stage {
    border-color: rgba(215, 217, 222, .92);
    border-radius: 15px;
    background: rgba(246, 246, 247, .88);
  }

  .workflow-stage.is-open {
    border-color: rgba(196, 198, 204, .96);
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 10px 26px rgba(15, 16, 20, .09), inset 0 1px 0 rgba(255, 255, 255, .98);
  }

  .workflow-stage-header {
    min-height: 44px;
    padding: 6px 8px;
  }

  .workflow-stage-body {
    padding: 10px;
  }

  .workflow-stage:not(.is-open) .workflow-stage-body {
    height: 0;
    min-height: 0;
    flex: 0 0 0;
    overflow: hidden;
    padding: 0;
  }

  .workflow-stage:not(.is-open) .workflow-stage-header {
    width: 100%;
    flex: 1 1 auto;
    gap: 8px;
    padding: 11px 4px;
  }

  .workflow-stage:not(.is-open) .workflow-stage-number {
    width: 23px;
    height: 23px;
    flex-basis: 23px;
    border-radius: 8px;
  }

  .workflow-stage:not(.is-open) .workflow-stage-heading strong {
    font-size: 9px;
    line-height: 1.4;
  }

  .workflow-stage:not(.is-open) .workflow-stage-status {
    margin-top: auto;
  }

  .workflow-rail[data-mode="one-shot"] {
    grid-template-columns: minmax(0, 1fr) var(--workflow-closed);
  }

  .workflow-rail[data-mode="one-shot"][data-active-stage="2"] {
    grid-template-columns: minmax(0, 1fr) var(--workflow-closed);
  }

  .workflow-rail[data-mode="one-shot"][data-active-stage="5"] {
    grid-template-columns: var(--workflow-closed) minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .studio-page.studio-active .studio-content {
    min-height: 0;
    overflow: hidden;
  }

  .workflow-rail,
  .workflow-rail[data-mode="one-shot"],
  .workflow-rail[data-mode="one-shot"][data-active-stage="2"],
  .workflow-rail[data-mode="one-shot"][data-active-stage="5"] {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: max-content;
    align-content: start;
    gap: 6px;
    overflow-x: hidden;
    overflow-y: auto;
    scroll-snap-type: none;
    padding: 0 0 4px;
  }

  .workflow-stage,
  .workflow-rail[data-active-stage="2"] .workflow-stage,
  .workflow-rail[data-active-stage="3"] .workflow-stage,
  .workflow-rail[data-active-stage="4"] .workflow-stage,
  .workflow-rail[data-active-stage="5"] .workflow-stage {
    width: 100%;
    height: auto;
    min-height: 0;
    flex: none;
    border-radius: 13px;
    scroll-snap-align: none;
  }

  .workflow-stage-header,
  .workflow-stage:not(.is-open) .workflow-stage-header {
    min-height: 42px;
    flex: 0 0 42px;
    padding: 6px 8px;
  }

  .workflow-stage.is-open {
    min-height: min(68dvh, 680px);
  }

  .workflow-stage.is-open .workflow-stage-body {
    min-height: 0;
    max-height: none;
    flex: 1 1 auto;
    overflow: auto;
    padding: 8px;
  }

  .workflow-stage:not(.is-open) .workflow-stage-body {
    display: none;
  }

  .workflow-stage:not(.is-open) .workflow-stage-heading small {
    display: none;
  }

  .workflow-stage-feedback {
    width: 100%;
  }
}

/* Model-first workbench. The model is a stable context column; the active
   workflow keeps the remaining width for the actual creative operation. */
.studio-workbench {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(214px, 238px) minmax(0, 1fr);
  gap: 10px;
}

.studio-workbench > .workflow-rail {
  min-width: 0;
  min-height: 0;
}

.model-sidebar {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid #dfe1e5;
  border-radius: 17px;
  padding: 13px;
  color: #25272c;
  background: rgba(249, 249, 250, .94);
  box-shadow: 0 7px 18px rgba(22, 23, 27, .055), inset 0 1px 0 rgba(255, 255, 255, .9);
}

.model-sidebar-heading,
.model-sidebar-identity,
.format-strip-heading {
  display: flex;
  align-items: center;
  min-width: 0;
}

.model-sidebar-heading {
  justify-content: space-between;
  gap: 8px;
}

.model-sidebar-heading > div,
.model-sidebar-identity > div,
.format-strip-heading > div {
  min-width: 0;
}

.model-sidebar-heading strong {
  display: block;
  margin-top: 3px;
  font-size: 14px;
  line-height: 1.25;
}

.model-sidebar-state {
  flex: 0 0 auto;
  border: 1px solid #d4d7dc;
  border-radius: 999px;
  padding: 4px 7px;
  color: #6d7179;
  background: #fff;
  font-size: 9px;
  line-height: 1;
  white-space: nowrap;
}

.model-sidebar.is-ready .model-sidebar-state {
  border-color: #c5c9cf;
  color: #292b30;
  background: #eceef1;
}

.model-sidebar-identity {
  align-items: flex-start;
  gap: 9px;
  padding-bottom: 11px;
  border-bottom: 1px solid #e2e4e7;
}

.model-sidebar-mark {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  color: #fff;
  background: #27292e;
}

.model-sidebar-mark svg {
  width: 15px;
  height: 15px;
}

.model-sidebar-identity strong,
.model-sidebar-identity small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-sidebar-identity strong {
  font-size: 12px;
  line-height: 1.35;
}

.model-sidebar-identity small {
  margin-top: 3px;
  color: #858890;
  font-size: 9px;
  line-height: 1.3;
}

.model-sidebar-identity .model-sidebar-provider {
  color: #a0a3aa;
}

.model-sidebar-select-slot {
  min-width: 0;
}

.model-sidebar-field {
  display: grid !important;
  gap: 6px;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
}

.model-sidebar-field .field-label {
  margin: 0 !important;
  color: #6c7078;
  font-size: 10px;
}

.model-sidebar-field select {
  width: 100%;
  min-width: 0;
  min-height: 39px;
  border: 1px solid #cfd2d7;
  border-radius: 11px;
  padding: 0 28px 0 10px;
  color: #24262b;
  background-color: #fff;
  box-shadow: none;
  font-size: 11px;
}

.model-sidebar-field select:focus-visible {
  outline: 2px solid rgba(56, 59, 65, .18);
  outline-offset: 2px;
}

.model-sidebar-capabilities {
  display: grid;
  gap: 0;
  border-top: 1px solid #e2e4e7;
}

.model-sidebar-capability {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 8px 0;
  border-bottom: 1px solid #e2e4e7;
}

.model-sidebar-capability span {
  color: #898c94;
  font-size: 9px;
  line-height: 1.2;
}

.model-sidebar-capability strong {
  overflow-wrap: anywhere;
  color: #383a40;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.4;
}

.model-sidebar-note {
  margin: auto 0 0;
  color: #9699a1;
  font-size: 9px;
  line-height: 1.55;
}

/* The format controls belong to the creative brief, so the user sees the
   output consequence immediately after writing the idea. */
.format-strip-wrap {
  min-width: 0;
  margin-top: 13px;
  border-top: 1px solid #e2e4e8;
  padding-top: 11px;
}

.format-strip-heading {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.format-strip-heading strong,
.format-strip-heading small {
  display: block;
}

.format-strip-heading strong {
  color: #2d2f34;
  font-size: 11px;
  line-height: 1.3;
}

.format-strip-heading small {
  margin-top: 2px;
  color: #9699a0;
  font-size: 9px;
  line-height: 1.3;
}

.format-strip-heading > span {
  flex: 0 0 auto;
  color: #62666e;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.format-strip-wrap .spec-layout {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(158px, .3fr);
  align-items: stretch;
  gap: 8px;
  margin: 0;
}

.format-strip-wrap .spec-main {
  display: grid !important;
  grid-template-columns: minmax(200px, 1.25fr) minmax(205px, 1fr) minmax(160px, .82fr);
  align-items: stretch;
  gap: 8px;
}

.format-strip-wrap .spec-field,
.format-strip-wrap .spec-summary {
  min-width: 0;
  min-height: 72px;
  box-sizing: border-box;
  border: 1px solid #e0e2e6;
  border-radius: 12px;
  padding: 9px 10px;
  background: #fafafb;
}

.format-strip-wrap .spec-field {
  justify-content: flex-start;
}

.format-strip-wrap .spec-field > .field-label {
  margin: 0 0 7px;
  color: #686c74;
  font-size: 10px;
}

.format-strip-wrap .ratio-options {
  min-height: 39px;
  border-radius: 9px;
}

.format-strip-wrap .ratio-option {
  min-height: 37px;
  gap: 3px;
  font-size: 9px;
}

.format-strip-wrap .ratio-option i {
  width: min(20px, 70%);
  max-height: 14px;
  border-width: 1px;
}

.format-strip-wrap .duration-row,
.format-strip-wrap .resolution-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  margin-top: 0;
}

.format-strip-wrap .duration-row > div:first-child {
  min-height: 0;
}

.format-strip-wrap .duration-row .field-label {
  margin: 0 0 2px;
}

.format-strip-wrap .duration-row small {
  overflow: hidden;
  color: #999ca3;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.format-strip-wrap .duration-control {
  height: 34px;
  grid-template-columns: 28px minmax(42px, 1fr) 28px 48px;
  border-radius: 9px;
}

.format-strip-wrap .step-button {
  font-size: 15px;
}

.format-strip-wrap .duration-control output {
  font-size: 9px;
}

.format-strip-wrap input[type="range"] {
  margin-inline: 6px;
}

.format-strip-wrap .resolution-row .field-label {
  margin: 0;
}

.format-strip-wrap .resolution-options {
  min-height: 34px;
  border-radius: 9px;
}

.format-strip-wrap .resolution-options .segment {
  min-height: 32px;
  font-size: 9px;
}

.format-strip-wrap .format-badge {
  align-self: flex-start;
  padding: 4px 7px;
  font-size: 8px;
}

.format-strip-wrap .spec-summary {
  justify-content: flex-start;
  gap: 5px;
  padding: 9px 10px;
  background: #f1f2f4;
}

.format-strip-wrap .spec-summary > span {
  font-size: 9px;
}

.format-strip-wrap .spec-summary > strong {
  font-size: 12px;
  line-height: 1.3;
}

.format-strip-wrap .summary-rule {
  margin: 2px 0;
}

.format-strip-wrap .advanced-plan {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 11px;
  font-size: 9px;
}

.format-strip-wrap .advanced-plan strong {
  font-size: 10px;
}

.format-strip-wrap .advanced-plan small {
  line-height: 1.45;
}

.workflow-stage-body > #specSection {
  height: auto;
  min-height: 0;
}

.workflow-stage-body > #specSection > .section-title {
  display: flex;
  margin: 0 0 10px;
}

.workflow-stage-body > #briefSection > .section-title {
  display: none !important;
}

.workflow-stage-body > #specSection > .section-title h2 {
  font-size: 14px;
}

.workflow-stage-body > #specSection > .section-title p {
  max-width: 420px;
  font-size: 9px;
}

@media (min-width: 761px) and (max-width: 1220px) {
  .studio-workbench {
    grid-template-columns: minmax(188px, 204px) minmax(0, 1fr);
  }

  .format-strip-wrap .spec-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .format-strip-wrap .spec-main {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .studio-workbench {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    gap: 8px;
  }

  .model-sidebar {
    max-height: 174px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-content: start;
    gap: 8px 12px;
    overflow: auto;
    border-radius: 14px;
    padding: 10px;
  }

  .model-sidebar-heading,
  .model-sidebar-identity,
  .model-sidebar-select-slot {
    grid-column: 1 / -1;
  }

  .model-sidebar-heading {
    align-items: center;
  }

  .model-sidebar-heading strong {
    font-size: 12px;
  }

  .model-sidebar-identity {
    padding-bottom: 8px;
  }

  .model-sidebar-capabilities {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 12px;
    border-top: 0;
  }

  .model-sidebar-capability {
    padding: 6px 0;
  }

  .model-sidebar-note {
    display: none;
  }

  .studio-workbench > .workflow-rail {
    min-height: 0;
  }

  .format-strip-wrap .spec-layout,
  .format-strip-wrap .spec-main {
    grid-template-columns: minmax(0, 1fr);
  }

  .format-strip-wrap .spec-summary {
    min-height: 58px;
  }

  .format-strip-wrap .spec-summary .summary-note {
    display: none;
  }

  .workflow-stage.is-open {
    min-height: min(66dvh, 620px);
  }
}

/* The model context now lives in the left sidebar, so the rail contains
   stages 02-05 only. Keep the compact mobile presentation single-column. */
@media (max-width: 760px) {
  .workflow-rail[data-active-stage="2"],
  .workflow-rail[data-active-stage="3"],
  .workflow-rail[data-active-stage="4"],
  .workflow-rail[data-active-stage="5"] {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Final narrow layout: let the page own scrolling and keep the active stage
   focused. Older mobile rules intentionally remain above this block so the
   desktop workbench can keep its horizontal rail. */
@media (max-width: 760px) {
  html,
  body {
    overflow-x: hidden;
  }

  body.studio-page.studio-active {
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .studio-page.studio-active > .topbar {
    position: sticky;
    top: 0;
    height: 52px;
    min-height: 52px;
    gap: 6px;
    padding: 6px 12px;
  }

  .studio-page.studio-active .brand {
    min-width: 0;
    gap: 6px;
    font-size: 13px;
  }

  .studio-page.studio-active .brand-mark,
  .studio-page.studio-active .brand-logo {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
    border-radius: 9px;
  }

  .studio-page.studio-active .header-workspace-nav {
    flex: 0 0 auto;
    gap: 2px;
    margin-left: auto;
  }

  .studio-page.studio-active .header-workspace-button {
    min-height: 34px;
    width: 34px;
    justify-content: center;
    gap: 0;
    border-radius: 9px;
    padding: 0;
  }

  .studio-page.studio-active .header-workspace-button span {
    display: none;
  }

  .studio-page.studio-active .header-account-menu summary {
    min-height: 34px;
    padding: 3px;
  }

  .studio-page.studio-active .workspace-taskbar {
    position: sticky;
    top: 52px;
    z-index: 25;
    padding: 5px 0 0;
    background: rgba(8, 9, 13, .18);
  }

  .studio-page.studio-active .workspace-taskbar-inner {
    width: calc(100% - 20px);
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-radius: 13px;
    padding: 4px 5px 4px 7px;
  }

  .studio-page.studio-active .workspace-taskbar-heading {
    min-width: 0;
    flex: 0 0 auto;
    gap: 6px;
  }

  .studio-page.studio-active .workspace-taskbar-heading > span:last-child {
    max-width: 72px;
  }

  .studio-page.studio-active .workspace-taskbar-heading strong {
    font-size: 10px;
  }

  .studio-page.studio-active .workspace-taskbar-heading small {
    font-size: 8px;
  }

  .studio-page.studio-active .workspace-taskbar-icon {
    width: 26px;
    height: 26px;
    flex-basis: 26px;
    border-radius: 8px;
  }

  .studio-page.studio-active .workspace-taskbar-icon svg {
    width: 13px;
    height: 13px;
  }

  .studio-page.studio-active .workspace-tab-list {
    flex: 1 1 auto;
    min-width: 0;
    gap: 4px;
    overflow-x: auto;
  }

  .studio-page.studio-active .workspace-tab {
    min-width: 104px;
    max-width: 164px;
    border-radius: 9px;
  }

  .studio-page.studio-active .workspace-tab-main {
    min-height: 32px;
    gap: 5px;
    border-radius: 8px 0 0 8px;
    padding: 4px 6px;
  }

  .studio-page.studio-active .workspace-tab-close {
    width: 23px;
    min-width: 23px;
    flex-basis: 23px;
    border-radius: 0 8px 8px 0;
  }

  .studio-page.studio-active .workspace-tab-copy strong {
    font-size: 9px;
  }

  .studio-page.studio-active .workspace-tab-copy small {
    display: none;
  }

  .studio-page.studio-active .workspace-taskbar-actions {
    flex: 0 0 auto;
    gap: 3px;
  }

  .studio-page.studio-active .workspace-history-toggle {
    min-height: 32px;
    width: 32px;
    justify-content: center;
    gap: 0;
    border-radius: 9px;
    padding: 0;
  }

  .studio-page.studio-active .workspace-history-toggle span {
    display: none;
  }

  .studio-page.studio-active .workspace-history-toggle svg {
    width: 14px;
    height: 14px;
  }

  .studio-page.studio-active > .app-shell {
    width: 100%;
    min-height: 0;
    height: auto;
    margin: 0;
    border-radius: 0;
  }

  .studio-page.studio-active .studio-content {
    min-height: 0;
    display: block;
    overflow: visible;
    padding: 8px 10px 18px;
  }

  .studio-page.studio-active .content-heading {
    margin-bottom: 8px;
    padding-bottom: 7px;
  }

  .studio-page.studio-active .content-heading h1 {
    font-size: 17px;
    line-height: 1.25;
  }

  .studio-page.studio-active .content-heading p:not(.eyebrow),
  .studio-page.studio-active .quota-chip {
    display: none;
  }

  .studio-workbench {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    min-height: 0;
  }

  .model-sidebar {
    max-height: none;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(122px, .86fr);
    align-content: start;
    gap: 7px 9px;
    overflow: visible;
    border-radius: 13px;
    padding: 9px;
  }

  .model-sidebar-heading {
    grid-column: 1 / -1;
  }

  .model-sidebar-heading strong {
    font-size: 11px;
  }

  .model-sidebar-identity {
    grid-column: 1;
    align-self: center;
    padding: 0;
    border-bottom: 0;
  }

  .model-sidebar-mark {
    flex-basis: 27px;
    width: 27px;
    height: 27px;
    border-radius: 8px;
  }

  .model-sidebar-mark svg {
    width: 13px;
    height: 13px;
  }

  .model-sidebar-identity strong {
    font-size: 10px;
  }

  .model-sidebar-identity small {
    margin-top: 2px;
    font-size: 8px;
  }

  .model-sidebar-select-slot {
    grid-column: 2;
    align-self: center;
  }

  .model-sidebar-field {
    gap: 4px;
  }

  .model-sidebar-field .field-label {
    font-size: 9px;
  }

  .model-sidebar-field select {
    min-height: 34px;
    border-radius: 9px;
    font-size: 10px;
  }

  .model-sidebar-capabilities {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: 9px;
    border-top: 1px solid #e2e4e7;
  }

  .model-sidebar-capability {
    min-height: 39px;
    padding: 6px 0;
  }

  .model-sidebar-capability span {
    font-size: 8px;
  }

  .model-sidebar-capability strong {
    font-size: 9px;
    line-height: 1.25;
  }

  .model-sidebar-capability:last-child {
    grid-column: 1 / -1;
  }

  .model-sidebar-note {
    display: none;
  }

  .workflow-rail,
  .workflow-rail[data-mode="one-shot"],
  .workflow-rail[data-mode="one-shot"][data-active-stage="2"],
  .workflow-rail[data-mode="one-shot"][data-active-stage="5"] {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: max-content;
    align-content: start;
    gap: 6px;
    min-height: 0;
    overflow: visible;
    padding: 0;
  }

  .workflow-stage,
  .workflow-rail[data-active-stage="2"] .workflow-stage,
  .workflow-rail[data-active-stage="3"] .workflow-stage,
  .workflow-rail[data-active-stage="4"] .workflow-stage,
  .workflow-rail[data-active-stage="5"] .workflow-stage {
    width: 100%;
    height: auto;
    min-height: 0;
    flex: none;
    border-radius: 12px;
    scroll-margin-top: 108px;
  }

  .workflow-stage-header,
  .workflow-stage:not(.is-open) .workflow-stage-header {
    min-height: 40px;
    flex: 0 0 40px;
    gap: 7px;
    padding: 6px 8px;
  }

  .workflow-stage-number {
    width: 24px;
    height: 24px;
    flex-basis: 24px;
    border-radius: 8px;
    font-size: 8px;
  }

  .workflow-stage-heading strong {
    font-size: 10px;
  }

  .workflow-stage-heading small {
    font-size: 8px;
  }

  .workflow-stage:not(.is-open) .workflow-stage-heading small {
    display: none;
  }

  .workflow-stage.is-open {
    min-height: 0;
  }

  .workflow-stage.is-open .workflow-stage-body {
    min-height: 0;
    max-height: none;
    flex: none;
    overflow: visible;
    padding: 8px;
  }

  .workflow-stage:not(.is-open) .workflow-stage-body {
    display: none;
  }

  .workflow-stage-body > #briefSection .prompt-wrap textarea {
    min-height: 92px;
    max-height: 180px;
  }

  .workflow-stage-body > #briefSection .style-preset-list,
  .workflow-rail[data-mode="one-shot"] .one-shot-more-content .style-preset-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .workflow-stage-body > #briefSection .style-preset-options,
  .workflow-rail[data-mode="one-shot"] .one-shot-more-content .style-preset-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workflow-stage-body > #specSection .spec-main,
  .format-strip-wrap .spec-main {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .format-strip-wrap .spec-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
  }

  .format-strip-wrap .spec-model-field,
  .format-strip-wrap .spec-ratio-field {
    grid-column: 1 / -1;
  }

  .format-strip-wrap .spec-field,
  .format-strip-wrap .spec-summary {
    min-height: 0;
    border-radius: 10px;
    padding: 8px;
  }

  .format-strip-wrap .ratio-options {
    min-height: 34px;
  }

  .format-strip-wrap .ratio-option {
    min-height: 32px;
  }

  .format-strip-wrap .duration-control {
    grid-template-columns: 25px minmax(30px, 1fr) 25px 45px;
  }

  .format-strip-wrap .spec-summary {
    min-height: 54px;
  }

  .workflow-stage-body > #formActions,
  .workflow-stage-body > .form-actions {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
    margin-top: 10px;
  }

  .workflow-stage-body > #formActions .auth-panel,
  .workflow-stage-body > .form-actions .auth-panel,
  .workflow-stage-body > #formActions #generateButton,
  .workflow-stage-body > .form-actions #generateButton {
    min-height: 44px;
  }

  .workflow-stage-body > #outputSection .stage {
    min-height: 210px;
  }
}

@media (max-width: 420px) {
  .studio-page.studio-active > .topbar {
    padding-inline: 9px;
  }

  .studio-page.studio-active .header-workspace-button,
  .studio-page.studio-active .workspace-history-toggle {
    width: 30px;
  }

  .studio-page.studio-active .workspace-taskbar-inner {
    width: calc(100% - 14px);
  }

  .studio-page.studio-active .workspace-taskbar-heading > span:last-child {
    display: none;
  }

  .studio-page.studio-active .workspace-tab {
    min-width: 92px;
  }

  .model-sidebar {
    grid-template-columns: minmax(0, 1fr);
  }

  .model-sidebar-identity,
  .model-sidebar-select-slot {
    grid-column: 1 / -1;
  }

  .model-sidebar-select-slot {
    margin-top: -1px;
  }

  .model-sidebar-capabilities {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .model-sidebar-capability:last-child {
    grid-column: 1 / -1;
  }

  .format-strip-wrap .spec-main {
    grid-template-columns: minmax(0, 1fr);
  }

  .format-strip-wrap .spec-model-field,
  .format-strip-wrap .spec-ratio-field {
    grid-column: auto;
  }
}

.register-dialog { width: min(860px, calc(100% - 32px)); padding: 0; }
.register-dialog .register-shell > form { padding: 34px; }
.register-dialog .register-field-grid .field-label { margin: 0 0 7px; }
.register-dialog .register-password-help,
.register-dialog .register-review-note { margin-top: 7px; }
.register-dialog .register-consent { margin-top: 18px; }

@media (max-width: 720px) {
  .register-dialog { width: min(540px, calc(100% - 22px)); }
  .register-dialog .register-shell > form { padding: 25px 20px; }
}

/* Project home: a compact operational dashboard replaces the mode-card lobby. */
.mode-gateway.project-home {
  inset: 58px 0 0;
  display: block;
  padding: clamp(28px, 4.6vh, 52px) clamp(20px, 4vw, 56px) 56px;
  color: #f7f8fa;
  background-position: center, 50% 52%;
}

.mode-gateway.project-home[hidden] { display: none; }
.project-home::after { background: rgba(4, 5, 8, .38); }
.project-home-shell { position: relative; z-index: 1; width: min(1240px, 100%); margin: 0 auto; }
.project-home-heading { display: flex; align-items: end; justify-content: space-between; gap: 28px; margin-bottom: 24px; }
.project-home-heading .eyebrow,
.project-home-section-heading .eyebrow { color: rgba(235, 238, 243, .62); }
.project-home-heading h1 { margin-top: 5px; color: #fff; font-size: clamp(29px, 3vw, 40px); line-height: 1.12; letter-spacing: 0; }
.project-home-heading > div:first-child > p:last-child { max-width: 620px; margin-top: 9px; color: rgba(239, 241, 245, .72); font-size: 13px; line-height: 1.65; }
.project-home-summary { flex: 0 0 auto; display: flex; align-items: center; gap: 18px; border: 1px solid rgba(255, 255, 255, .18); border-radius: 16px; padding: 12px 16px; background: rgba(13, 14, 19, .44); backdrop-filter: blur(18px) saturate(.8); }
.project-home-summary > span { min-width: 62px; }
.project-home-summary strong,
.project-home-summary small { display: block; }
.project-home-summary strong { color: #fff; font-size: 17px; line-height: 1.2; }
.project-home-summary small { margin-top: 3px; color: rgba(232, 235, 240, .58); font-size: 9px; }
.project-home-summary i { width: 1px; height: 27px; background: rgba(255, 255, 255, .16); }

.project-home-composer { border: 1px solid rgba(255, 255, 255, .56); border-radius: 24px; color: #17181c; background: rgba(250, 250, 251, .95); box-shadow: 0 24px 68px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .96); overflow: hidden; backdrop-filter: blur(24px) saturate(.82); }
.project-home-composer-main { padding: 24px 26px 18px; }
.project-home-composer-label { display: flex; align-items: center; gap: 11px; }
.project-home-composer-label strong,
.project-home-composer-label small { display: block; }
.project-home-composer-label strong { color: #202126; font-size: 13px; line-height: 1.35; }
.project-home-composer-label small { margin-top: 3px; color: #777b84; font-size: 10px; line-height: 1.4; }
.project-home-spark { width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center; border-radius: 12px; color: #fff; background: #24262b; }
.project-home-spark svg { width: 17px; height: 17px; }
.project-home #projectHomePrompt { width: 100%; min-height: 82px; max-height: 170px; margin-top: 15px; border: 0; border-radius: 0; padding: 3px 0; color: #17181c; background: transparent; box-shadow: none; resize: vertical; font: inherit; font-size: 17px; line-height: 1.65; letter-spacing: 0; }
.project-home #projectHomePrompt::placeholder { color: #a0a3aa; }
.project-home #projectHomePrompt:focus { outline: none; border: 0; box-shadow: none; }
.project-home-composer-footer { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid #e0e2e6; padding: 11px 13px 11px 18px; background: #f2f3f5; }
.project-purpose-switch,
.new-task-purpose-options { display: flex; align-items: center; gap: 5px; }
.project-purpose-option { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 12px; padding: 0 11px; color: #696d75; background: transparent; font-size: 10px; font-weight: 600; white-space: nowrap; cursor: pointer; transition: color .2s ease, border-color .2s ease, background .2s ease, box-shadow .2s ease; }
.project-purpose-option svg { width: 14px; height: 14px; }
.project-purpose-option:hover { color: #202126; background: #e6e8eb; }
.project-purpose-option.active { border-color: #cfd2d7; color: #111216; background: #fff; box-shadow: 0 5px 14px rgba(16, 17, 21, .08); }
.project-home-start { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; border: 1px solid #141519; border-radius: 14px; padding: 0 18px; color: #fff; background: #1c1d21; box-shadow: 0 8px 20px rgba(0, 0, 0, .17); font-size: 12px; font-weight: 650; cursor: pointer; transition: transform .2s ease, background .2s ease, box-shadow .2s ease; }
.project-home-start svg { width: 15px; height: 15px; }
.project-home-start:hover { background: #050506; box-shadow: 0 10px 24px rgba(0, 0, 0, .24); transform: translateY(-1px); }
.project-home-message { border-top: 1px solid #ead5d5; padding: 9px 26px; color: #8b3434; background: #fff1f1; font-size: 10px; }

.project-home-content { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); align-items: stretch; gap: 16px; margin-top: 16px; }
.project-home-projects,
.project-home-activity { min-width: 0; display: flex; flex-direction: column; border: 1px solid rgba(255, 255, 255, .32); border-radius: 20px; padding: 20px; color: #1a1b1f; background: rgba(248, 248, 250, .9); box-shadow: 0 18px 46px rgba(0, 0, 0, .22), inset 0 1px 0 rgba(255, 255, 255, .7); backdrop-filter: blur(20px) saturate(.78); }
.project-home-section-heading { min-height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 10px; }
.project-home-section-heading .eyebrow { color: #858992; }
.project-home-section-heading h2 { margin-top: 3px; color: #202126; font-size: 18px; line-height: 1.3; letter-spacing: 0; }
.project-home-link { min-height: 34px; border: 0; border-radius: 10px; padding: 0 10px; color: #575b63; background: transparent; font-size: 10px; font-weight: 600; cursor: pointer; }
.project-home-link:hover { color: #111216; background: #e7e9ec; }
.recent-project-list { display: grid; }
.project-home-project-row { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; border-top: 1px solid #e0e2e6; padding: 9px 0; }
.project-home-project-main { min-width: 0; display: grid; grid-template-columns: 42px minmax(0, 1fr); align-items: center; gap: 12px; border: 0; border-radius: 13px; padding: 7px 9px; color: #1c1d21; background: transparent; text-align: left; cursor: pointer; transition: background .2s ease; }
.project-home-project-main:hover { background: #eceef1; }
.project-home-project-icon { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid #d2d5da; border-radius: 13px; color: #f7f8fa; background: #303238; }
.project-home-project-icon svg { width: 18px; height: 18px; }
.project-home-project-copy { min-width: 0; }
.project-home-project-copy strong,
.project-home-project-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-home-project-copy strong { font-size: 12px; line-height: 1.4; }
.project-home-project-copy small { margin-top: 4px; color: #747881; font-size: 9px; line-height: 1.4; }
.project-home-project-meta { display: flex; align-items: center; gap: 8px; padding-right: 5px; }
.project-home-project-status { display: inline-flex; align-items: center; gap: 6px; color: #666a72; font-size: 9px; white-space: nowrap; }
.project-home-project-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #9da1a9; }
.project-home-project-status.running::before { background: #2c8c70; box-shadow: 0 0 0 4px rgba(44, 140, 112, .12); }
.project-home-project-status.done::before { background: #303238; }
.project-home-project-status.failed::before { background: #b65252; }
.project-home-project-status.planned::before { background: #77869a; }
.project-home-continue { min-height: 32px; border: 1px solid #d0d3d8; border-radius: 10px; padding: 0 10px; color: #27292e; background: #fff; font-size: 10px; font-weight: 600; cursor: pointer; }
.project-home-continue:hover { border-color: #25272c; color: #fff; background: #25272c; }

.project-home-activity-badge { border: 1px solid #d5d8dd; border-radius: 999px; padding: 5px 8px; color: #747881; background: #eceef1; font-size: 9px; white-space: nowrap; }
.project-home-activity-badge.active { border-color: #bfd7cd; color: #246b58; background: #e3f1eb; }
.project-home-activity-badge.failed { border-color: #e3c0bd; color: #984743; background: #faeae9; }
.active-generation-list { flex: 1; display: grid; align-content: start; gap: 7px; }
.active-generation-row { min-width: 0; display: grid; grid-template-columns: 35px minmax(0, 1fr) 14px; align-items: center; gap: 10px; border: 1px solid #d9dce1; border-radius: 14px; padding: 11px; color: #202126; background: #fff; text-align: left; cursor: pointer; transition: border-color .2s ease, transform .2s ease; }
.active-generation-row:hover { border-color: #8e939c; transform: translateY(-1px); }
.active-generation-row > span:nth-child(2) { min-width: 0; }
.active-generation-row strong,
.active-generation-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.active-generation-row strong { font-size: 11px; }
.active-generation-row small { margin-top: 4px; color: #777b83; font-size: 9px; }
.active-generation-row > svg { width: 14px; height: 14px; color: #777b83; }
.active-generation-signal { width: 35px; height: 35px; display: flex; align-items: center; justify-content: center; gap: 2px; border-radius: 11px; color: #fff; background: #292b30; }
.active-generation-signal i { width: 2px; height: 8px; border-radius: 2px; background: #fff; animation: project-signal 1.1s ease-in-out infinite; }
.active-generation-signal i:nth-child(2) { height: 14px; animation-delay: -.2s; }
.active-generation-signal i:nth-child(3) { animation-delay: -.4s; }
.active-generation-signal > svg { width: 16px; height: 16px; }
.active-generation-row.completed .active-generation-signal { border: 1px solid #d7dae0; color: #656a73; background: #eef0f3; }
.active-generation-row.failed { border-color: #e3c7c4; background: #fffafa; }
.active-generation-row.failed:hover { border-color: #bd7771; }
.active-generation-row.failed .active-generation-signal { background: #9b514c; }
.active-generation-row.failed .active-generation-signal > svg { width: 17px; height: 17px; }
@keyframes project-signal { 0%, 100% { transform: scaleY(.55); opacity: .52; } 50% { transform: scaleY(1); opacity: 1; } }
.project-home-activity-empty,
.project-home-empty-state { min-height: 84px; display: flex; align-items: center; gap: 12px; border-top: 1px solid #e0e2e6; color: #777b83; }
.project-home-activity-empty { flex: 1; }
.project-home-activity-empty > span,
.project-home-empty-state > span { width: 38px; height: 38px; flex: 0 0 38px; display: grid; place-items: center; border: 1px solid #d9dce1; border-radius: 12px; color: #6b6f77; background: #f0f1f3; }
.project-home-activity-empty svg,
.project-home-empty-state svg { width: 17px; height: 17px; }
.project-home-activity-empty strong,
.project-home-activity-empty small,
.project-home-empty-state strong,
.project-home-empty-state small { display: block; }
.project-home-activity-empty strong,
.project-home-empty-state strong { color: #42454b; font-size: 11px; }
.project-home-activity-empty small,
.project-home-empty-state small { margin-top: 4px; font-size: 9px; line-height: 1.5; }

/* New-project setup uses the same hierarchy as the dashboard. */
.new-task-dialog { width: min(720px, calc(100% - 32px)); }
.new-task-content { padding: 27px; }
.new-task-content .dialog-heading { align-items: start; margin-bottom: 18px; }
.new-task-content .dialog-heading h2 { font-size: 24px; letter-spacing: 0; }
.new-task-content .dialog-heading p:last-child { margin-top: 5px; color: #777b83; font-size: 10px; }
.new-task-purpose { margin-bottom: 20px; }
.new-task-section-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.new-task-section-heading > span { width: 26px; height: 26px; flex: 0 0 26px; display: grid; place-items: center; border: 1px solid #d5d8dd; border-radius: 9px; color: #666a72; background: #f1f2f4; font-size: 9px; font-weight: 700; }
.new-task-section-heading strong,
.new-task-section-heading small { display: block; }
.new-task-section-heading strong { color: #26282d; font-size: 12px; }
.new-task-section-heading small { margin-top: 2px; color: #7c8088; font-size: 9px; }
.new-task-purpose-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.new-task-purpose-options .project-purpose-option { min-width: 0; min-height: 42px; border-color: #d9dce1; background: #f5f6f7; }
.new-task-purpose-options .project-purpose-option:hover { border-color: #aeb2ba; background: #fff; }
.new-task-purpose-options .project-purpose-option.active { border-color: #26282d; color: #fff; background: #26282d; box-shadow: none; }
.new-task-method-heading { margin-bottom: 10px; }
.new-task-options { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.new-task-option { position: relative; min-height: 74px; grid-template-columns: 40px minmax(0, 1fr) auto 16px; gap: 10px; border-radius: 14px; padding: 11px; }
.new-task-option > span:nth-child(2) { min-width: 0; }
.new-task-option-icon { grid-column: 1; }
.new-task-option em { grid-column: 3; border-radius: 999px; padding: 4px 6px; color: #43464d; background: #e3e5e8; font-size: 8px; font-style: normal; font-weight: 700; white-space: nowrap; }
.new-task-option-arrow { grid-column: 4; font-size: 19px; }
.new-task-option strong { font-size: 12px; }
.new-task-option small { margin-top: 3px; font-size: 9px; }
.new-task-option.recommended { border-color: #bfc3ca; background: #f0f1f3; }

@media (max-width: 820px) {
  .mode-gateway.project-home { inset: 58px 0 0; padding: 26px 18px 42px; }
  .project-home-heading { align-items: center; margin-bottom: 18px; }
  .project-home-heading h1 { font-size: 30px; }
  .project-home-content { grid-template-columns: minmax(0, 1fr); }
  .project-home-activity { order: -1; }
  .active-generation-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-home-activity-empty { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .mode-gateway.project-home { inset: 54px 0 0; padding: 21px 12px 34px; }
  .project-home-heading { align-items: flex-start; gap: 12px; }
  .project-home-heading h1 { font-size: 25px; }
  .project-home-heading > div:first-child > p:last-child { font-size: 11px; line-height: 1.55; }
  .project-home-summary { gap: 10px; border-radius: 13px; padding: 9px 10px; }
  .project-home-summary > span { min-width: 43px; }
  .project-home-summary strong { font-size: 14px; }
  .project-home-summary small { font-size: 8px; }
  .project-home-composer { border-radius: 19px; }
  .project-home-composer-main { padding: 18px 17px 13px; }
  .project-home #projectHomePrompt { min-height: 90px; margin-top: 12px; font-size: 15px; }
  .project-home-composer-footer { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; padding: 10px; }
  .project-purpose-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
  .project-purpose-option { min-width: 0; min-height: 34px; padding: 0 7px; font-size: 9px; }
  .project-home-start { min-height: 72px; flex-direction: column; gap: 4px; border-radius: 13px; padding: 0 14px; }
  .project-home-projects,
  .project-home-activity { border-radius: 17px; padding: 15px; }
  .active-generation-list { grid-template-columns: minmax(0, 1fr); }
  .project-home-project-row { grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
  .project-home-project-main { grid-template-columns: 37px minmax(0, 1fr); gap: 9px; padding-inline: 4px; }
  .project-home-project-icon { width: 37px; height: 37px; border-radius: 12px; }
  .project-home-project-meta { padding-right: 0; }
  .project-home-project-status { display: none; }
  .project-home-continue { min-width: 48px; padding-inline: 8px; }
  .new-task-dialog { width: min(540px, calc(100% - 22px)); }
  .new-task-content { padding: 21px 18px; }
  .new-task-purpose-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .new-task-options { grid-template-columns: minmax(0, 1fr); }
  .project-task-row { flex-direction: column; }
  .project-task-actions { width: 100%; justify-content: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
  .active-generation-signal i { animation: none; }
}
