:root {
  --av-bg: #f6f8fc;
  --av-panel: #ffffff;
  --av-panel-soft: #f8fafc;
  --av-border: #e2e8f0;
  --av-border-strong: #bfdbfe;
  --av-text: #0f172a;
  --av-muted: #475569;
  --av-faint: #64748b;
  --av-primary: #2563eb;
  --av-primary-dark: #1d4ed8;
  --av-cyan: #2563eb;
  --av-blue: #2563eb;
  --av-green: #047857;
  --av-red: #be123c;
  --av-yellow: #b45309;
  --av-purple: #6d28d9;
  --av-radius: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--av-text);
  background: var(--av-bg);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: linear-gradient(180deg, #f8fbff 0, var(--av-bg) 42%, #fff 100%); color: var(--av-text); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .52; cursor: not-allowed; }
input, select, textarea, video, audio { max-width: 100%; min-width: 0; }
button, .av-btn { max-width: 100%; overflow-wrap: anywhere; }
[hidden] { display: none !important; }
.av-main, .av-grid, .av-grid > *, .av-card-body, .av-command-box, .av-scenes, .av-analysis-body, .av-field { min-width: 0; }
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(37,99,235,.35); outline-offset: 3px; }
[id] { scroll-margin-top: 116px; }
a { color: inherit; }
.av-skip { position: fixed; z-index: 100; top: -50px; left: 12px; background: var(--av-text); color: #fff; padding: 10px 14px; border-radius: 9px; font-size: 12px; }
.av-skip:focus { top: 10px; }

.av-shell { min-height: 100vh; padding-top: 64px; }
.av-topbar { position: fixed; top: 0; width: 100%; z-index: 20; min-height: 64px; display: flex; align-items: center; gap: 14px; padding: 10px max(16px, calc((100vw - 1240px) / 2)); border-bottom: 1px solid rgba(226,232,240,.85); background: rgba(255,255,255,.92); backdrop-filter: blur(16px); }
.av-brand { display: inline-flex; align-items: center; gap: 9px; min-width: 128px; text-decoration: none; }
.av-brand-mark { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 11px; background: linear-gradient(135deg, #2563eb, #4f46e5); color: #fff; box-shadow: 0 8px 18px rgba(37,99,235,.2); }
.av-brand strong { display: block; font-size: 14px; letter-spacing: -.01em; }
.av-brand small { display: block; color: var(--av-faint); font-size: 10px; margin-top: 1px; }
.av-connection { display: inline-flex; align-items: center; gap: 7px; color: var(--av-faint); font-size: 11px; }
.av-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
.av-dot.online { background: #10b981; box-shadow: 0 0 0 4px rgba(16,185,129,.12); }
.av-dot.offline { background: #e11d48; box-shadow: 0 0 0 4px rgba(225,29,72,.1); }
.av-topbar-spacer { flex: 1; }
.av-home-link { text-decoration: none; }
.av-btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--av-border); border-radius: 10px; padding: 9px 14px; background: #fff; color: var(--av-text); font-size: 12px; font-weight: 650; line-height: 1.15; transition: border-color .18s ease, box-shadow .18s ease, background .18s ease, transform .18s ease; }
.av-btn:hover:not(:disabled) { border-color: #93c5fd; box-shadow: 0 8px 18px rgba(15,23,42,.08); transform: translateY(-1px); }
.av-btn.primary { border-color: transparent; background: var(--av-primary); color: #fff; box-shadow: 0 8px 18px rgba(37,99,235,.2); }
.av-btn.primary:hover:not(:disabled) { background: var(--av-primary-dark); }
.av-btn.green { border-color: transparent; background: var(--av-green); color: #fff; }
.av-btn.danger { border-color: #fecdd3; background: #fff1f2; color: var(--av-red); }
.av-btn.ghost { background: transparent; }
.av-icon-btn { width: 44px; min-height: 44px; display: inline-grid; place-items: center; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--av-muted); }
.av-icon-btn:hover:not(:disabled) { border-color: var(--av-border); background: #f8fafc; color: var(--av-text); }

.av-layout { width: min(1240px, 100%); margin: 0 auto; }
.av-main { min-width: 0; padding: 30px 16px 42px; }
.av-project-head { display: flex; align-items: flex-end; gap: 18px; margin-bottom: 20px; }
.av-project-head > div { min-width: 0; flex: 1; }
.av-project-head h1 { margin: 3px 0 0; font-size: clamp(25px, 4vw, 38px); line-height: 1.12; letter-spacing: -.035em; }
.av-project-head p { margin: 7px 0 0; color: var(--av-muted); font-size: 13px; line-height: 1.55; }
.av-eyebrow { color: var(--av-primary) !important; font-size: 10px !important; font-weight: 800; letter-spacing: .14em; }
.av-workflow { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 7px; margin-bottom: 16px; padding: 7px; border: 1px solid var(--av-border); border-radius: 14px; background: #fff; box-shadow: 0 2px 8px rgba(15,23,42,.03); }
.av-workflow a { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; color: var(--av-muted); border-radius: 9px; text-decoration: none; font-size: 11px; font-weight: 700; text-align: center; }
.av-workflow a:hover { color: var(--av-primary); background: #eff6ff; }
.av-workflow span { display: grid; place-items: center; width: 23px; height: 23px; border-radius: 50%; background: #eff6ff; color: var(--av-primary); font-size: 10px; }
.av-library { margin-bottom: 14px; border: 1px solid var(--av-border); border-radius: 12px; background: rgba(255,255,255,.8); }
.av-library summary, .av-inline-details summary, .av-disclosure summary { cursor: pointer; list-style: none; }
.av-library summary::-webkit-details-marker, .av-inline-details summary::-webkit-details-marker, .av-disclosure summary::-webkit-details-marker { display: none; }
.av-library summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 46px; padding: 11px 14px; color: var(--av-text); font-size: 12px; font-weight: 750; }
.av-library summary::after, .av-inline-details summary::after, .av-disclosure summary::after { content: '＋'; color: var(--av-primary); font-size: 16px; }
.av-library[open] summary::after, .av-inline-details[open] summary::after, .av-disclosure[open] summary::after { content: '−'; }
.av-library summary span { color: var(--av-faint); font-size: 10px; font-weight: 500; }
.av-library-body { padding: 0 14px 14px; border-top: 1px solid var(--av-border); }
.av-side-title { display: flex; align-items: center; justify-content: space-between; padding: 10px 0 5px; color: var(--av-faint); font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.av-project-list { display: flex; flex-wrap: wrap; gap: 7px; }
.av-project { min-width: 180px; flex: 1 1 220px; text-align: left; padding: 10px; border: 1px solid var(--av-border); border-radius: 10px; background: #fff; color: var(--av-text); }
.av-project:hover, .av-project.active { border-color: #93c5fd; background: #eff6ff; }
.av-project-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 700; }
.av-project-meta { margin-top: 3px; color: var(--av-faint); font-size: 10px; }
.av-side-note, .av-note, .av-analysis-note { color: var(--av-faint); font-size: 11px; line-height: 1.55; overflow-wrap: anywhere; }
.av-note, .av-analysis-note { margin: 0; }
.av-side-note { margin: 10px 0 0; }

.av-alert { display: none; padding: 10px 12px; border: 1px solid var(--av-border); border-radius: 10px; font-size: 11px; line-height: 1.5; }
.av-alert.show { display: block; }
.av-alert.info { border-color: #bfdbfe; background: #eff6ff; color: #1e40af; }
.av-alert.success { border-color: #a7f3d0; background: #ecfdf5; color: #065f46; }
.av-alert.error { border-color: #fecdd3; background: #fff1f2; color: #9f1239; }
.av-grid { display: grid; grid-template-columns: minmax(0,1fr); gap: 16px; min-width: 0; margin-top: 16px; }
.av-creation-column, .av-preview-column, .av-tools-column, .av-settings-column { min-width: 0; display: grid; gap: 16px; align-content: start; }
.av-card { min-width: 0; overflow: hidden; border: 1px solid var(--av-border); border-radius: var(--av-radius); background: var(--av-panel); box-shadow: 0 4px 18px rgba(15,23,42,.045); }
.av-card-head { display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 13px 16px; border-bottom: 1px solid var(--av-border); }
.av-card-head > div { min-width: 0; flex: 1; }
.av-card-head h2, .av-card-head h3 { margin: 0; font-size: 15px; letter-spacing: -.015em; }
.av-card-head p { margin: 3px 0 0; color: var(--av-faint); font-size: 11px; line-height: 1.4; }
.av-card-head small { margin-left: auto; color: var(--av-faint); font-size: 10px; }
.av-card-body { min-width: 0; padding: 16px; }
.av-step { flex: 0 0 auto; display: grid; place-items: center; width: 31px; height: 31px; border-radius: 9px; background: #eff6ff; color: var(--av-primary); font-size: 10px; font-weight: 850; }
.av-idea-card { border-color: #bfdbfe; box-shadow: 0 10px 28px rgba(37,99,235,.09); }
.av-input-label, .av-field label { display: block; color: var(--av-muted); font-size: 11px; font-weight: 700; }
.av-command-box { display: grid; gap: 10px; }
.av-command-box textarea { width: 100%; min-height: 106px; resize: vertical; border: 1px solid #cbd5e1; border-radius: 11px; background: #fff; color: var(--av-text); padding: 12px; font-size: 14px; line-height: 1.5; outline: none; }
.av-command-box textarea:focus, .av-field input:focus, .av-field textarea:focus, .av-field select:focus { border-color: #60a5fa; outline: 3px solid rgba(96,165,250,.16); }
.av-command-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.av-command-actions .av-btn { flex: 0 1 auto; }
.av-command-hint { color: var(--av-faint); font-size: 10px; }
.av-target-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; padding: 10px; border: 1px solid #dbeafe; border-radius: 10px; background: #f8fbff; }
.av-target-status { flex: 1 1 150px; min-width: 0; margin: 0; color: #1e40af; font-size: 12px; font-weight: 650; line-height: 1.5; overflow-wrap: anywhere; }
.av-target-row .av-btn { flex: 0 0 auto; }
.av-local-status { margin: 0; padding: 10px 12px; border: 1px solid #bfdbfe; border-radius: 10px; background: #eff6ff; color: #1e40af; font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; }
.av-local-status:empty { margin: 0; padding: 0; border: 0; }
.av-local-status.error { border-color: #fecdd3; background: #fff1f2; color: #9f1239; }
.av-local-status.success { border-color: #a7f3d0; background: #ecfdf5; color: #065f46; }
.av-inline-details { min-width: 0; border-top: 1px solid var(--av-border); }
.av-inline-details summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; color: var(--av-muted); font-size: 11px; font-weight: 700; }
.av-inline-details summary::after { font-size: 14px; }
.av-inline-details[open] { padding-bottom: 8px; }
.av-brief-copy { margin: 8px 0; color: var(--av-text); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 1.6; }
.av-chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.av-chip { padding: 6px 9px; border: 1px solid #bfdbfe; border-radius: 999px; background: #eff6ff; color: #1d4ed8; font-size: 10px; }
.av-plan { display: none; margin-top: 14px; border: 1px dashed #93c5fd; border-radius: 11px; background: #f8fbff; }
.av-plan.show { display: block; }
.av-plan-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid #dbeafe; }
.av-plan-head strong { font-size: 12px; }
.av-plan-head span { margin-left: auto; color: var(--av-faint); font-size: 10px; }
.av-plan-body { padding: 11px 12px; }
.av-plan-summary { margin-bottom: 8px; color: #1e3a8a; font-size: 11px; line-height: 1.5; white-space: pre-wrap; }
.av-plan-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.av-plan pre { max-height: 240px; margin: 0; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--av-muted); font: 10px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
.av-op { display: grid; grid-template-columns: 20px minmax(0,1fr); gap: 8px; padding: 8px 0; border-top: 1px solid var(--av-border); font-size: 11px; }
.av-op small { display: block; margin-top: 3px; color: var(--av-faint); overflow-wrap: anywhere; }

.av-upload { display: grid; justify-items: center; gap: 5px; padding: 22px 14px; border: 1px dashed #93c5fd; border-radius: 12px; background: #f8fbff; color: var(--av-faint); font-size: 11px; text-align: center; }
.av-upload.drag { border-color: #34d399; background: #ecfdf5; }
.av-upload strong { color: var(--av-text); font-size: 13px; }
.av-upload-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: #dbeafe; color: var(--av-primary); }
.av-upload input { display: none; }
.av-check { display: flex; align-items: center; gap: 8px; min-height: 44px; color: var(--av-muted); font-size: 11px; line-height: 1.45; }
.av-check input, .av-analysis-checkbox input { flex: 0 0 auto; width: 16px; height: 16px; margin: 1px 0 0; accent-color: var(--av-primary); }
.av-asset-list { display: grid; gap: 7px; max-height: 210px; overflow: auto; }
.av-asset { display: flex; align-items: center; gap: 9px; min-width: 0; padding: 8px; border: 1px solid var(--av-border); border-radius: 10px; background: #fff; font-size: 11px; }
.av-asset-name { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.av-asset small { color: var(--av-faint); }
.av-asset .av-asset-assign { flex: 0 1 148px; font-size: 11px; }

.av-preview-stage { min-height: 260px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--av-border); border-radius: 12px; background: linear-gradient(145deg, #f8fafc, #eef2ff); }
#render-preview { width: 100%; max-height: 430px; background: #0f172a; }
#preview-empty { padding: 32px 18px; color: var(--av-faint); text-align: center; }
#preview-empty strong { display: block; margin-top: 8px; color: var(--av-text); font-size: 13px; }
#preview-empty p { margin: 5px 0 0; font-size: 11px; line-height: 1.5; }
.av-empty-icon { color: #93c5fd; }
.av-render-button { width: 100%; margin-top: 12px; }
.av-preview-body { display: grid; gap: 12px; }
.av-job { padding: 11px; border: 1px solid var(--av-border); border-radius: 10px; background: #f8fafc; }
.av-job-state { display: flex; align-items: center; gap: 8px; font-size: 11px; }
.av-job-state strong { flex: 1; }
.av-job p { margin: 6px 0 0; color: var(--av-faint); font-size: 10px; line-height: 1.4; }
.av-progress { height: 7px; margin: 9px 0 4px; overflow: hidden; border-radius: 99px; background: #e2e8f0; }
.av-progress i { display: block; width: 0; height: 100%; background: linear-gradient(90deg, #2563eb, #7c3aed); transition: width .25s ease; }
.av-export-body { display: grid; gap: 11px; }
.av-export-body .av-btn { width: 100%; }
.av-render-mode { display: grid; gap: 6px; padding: 15px 16px 0; }
.av-render-mode > label { color: var(--av-muted); font-size: 11px; font-weight: 700; }
.av-render-mode select, #review-rework-reason { min-width: 0; width: 100%; min-height: 44px; padding: 9px 10px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; color: var(--av-text); font-size: 12px; }
.av-render-mode .av-note { margin: 0; }
.av-review-panel { display: grid; min-width: 0; gap: 10px; }
.av-review-panel > strong { font-size: 13px; color: #1e3a8a; }
.av-review-panel .av-note { margin: 0; }
.av-review-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.av-review-actions .av-btn { flex: 1 1 145px; width: auto; }
.av-review-attestations { display: grid; gap: 10px; min-width: 0; margin: 0; padding: 12px; border: 1px solid #bfdbfe; border-radius: 9px; background: #eff6ff; }
.av-review-attestations legend { max-width: 100%; padding: 0 4px; color: #1e3a8a; font-size: 11px; font-weight: 750; }
.av-review-attestations .av-check { align-items: flex-start; line-height: 1.6; }
.av-review-attestations input { flex: 0 0 auto; margin-top: 4px; }
.av-review-binding { font-size: 10px; line-height: 1.65; white-space: pre-line; overflow-wrap: anywhere; color: var(--av-muted); }
.av-review-error { color: #b91c1c; }
#review-details[open] { display: grid; gap: 9px; }
.av-variant-tools summary small { margin-left: auto; color: var(--av-faint); font-size: 10px; font-weight: 500; }
.av-variant-body, .av-variant-plan, .av-variant-batch { display: grid; min-width: 0; gap: 10px; }
.av-variant-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.av-variant-options .av-check { min-width: 0; padding: 9px; border: 1px solid var(--av-border); border-radius: 9px; background: #fff; }
.av-variant-options .av-check span { display: grid; gap: 2px; min-width: 0; }
.av-variant-options .av-check strong { color: var(--av-text); font-size: 12px; }
.av-variant-options .av-check small { color: var(--av-faint); font-size: 10px; }
.av-variant-options .av-check:has(input:checked) { border-color: #93c5fd; background: #eff6ff; }
.av-variant-options .av-check:has(input:disabled) { opacity: .6; }
.av-variant-plan, .av-variant-batch { padding: 11px; border: 1px solid #bfdbfe; border-radius: 10px; background: #f8fbff; }
.av-variant-batch { border-color: #cbd5e1; background: #fff; }
.av-variant-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 7px; }
.av-variant-head strong { color: #1e3a8a; font-size: 12px; }
.av-variant-head span { color: var(--av-faint); font-size: 10px; }
.av-variant-list { display: grid; min-width: 0; gap: 7px; }
.av-variant-item { display: grid; min-width: 0; gap: 4px; padding: 9px; border: 1px solid var(--av-border); border-radius: 8px; background: #fff; }
.av-variant-item strong { font-size: 11px; }
.av-variant-item small, .av-variant-item p { margin: 0; color: var(--av-muted); font-size: 10px; line-height: 1.5; overflow-wrap: anywhere; }
.av-variant-item .av-chip-row { align-items: center; }
.av-variant-item .av-btn { min-height: 44px; padding: 7px 10px; font-size: 10px; }
.av-variant-status { color: #1e3a8a !important; font-weight: 750; }
.av-variant-status.error { color: var(--av-red) !important; }
.av-variant-status.success { color: var(--av-green) !important; }
#variant-plan-json { max-height: 220px; margin: 0; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--av-muted); font-size: 10px; line-height: 1.45; }
.av-continuity-body, .av-continuity-form, .av-continuity-lifecycle { display: grid; min-width: 0; gap: 12px; align-content: start; }
.av-continuity-picker { display: grid; min-width: 0; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; align-items: end; }
.av-continuity-grid { display: grid; min-width: 0; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
.av-continuity-actions { display: flex; min-width: 0; flex-wrap: wrap; gap: 7px; }
.av-continuity-actions .av-btn { flex: 1 1 145px; }
.av-continuity-binding { min-width: 0; display: grid; gap: 10px; padding: 12px; border: 1px solid var(--av-border); border-radius: 9px; background: #f8fafc; }
.av-continuity-binding h4 { margin: 0; font-size: 12px; }
.av-continuity-list { display: grid; min-width: 0; gap: 7px; max-height: 260px; overflow: auto; padding-right: 3px; }
.av-reference-item { display: grid; min-width: 0; gap: 4px; padding: 9px; border: 1px solid var(--av-border); border-radius: 8px; background: #fff; }
.av-reference-item.selected { border-color: #93c5fd; box-shadow: 0 0 0 2px #dbeafe; }
.av-reference-item button { justify-self: start; }
.av-reference-meta { color: var(--av-muted); font-size: 10px; line-height: 1.5; overflow-wrap: anywhere; }
@media (max-width: 420px) { .av-continuity-picker { grid-template-columns: minmax(0, 1fr); } }
.av-tools-label { padding: 3px 3px 0; }
.av-tools-label span { color: var(--av-primary); font-size: 10px; font-weight: 850; letter-spacing: .12em; }
.av-tools-label p { margin: 4px 0 0; color: var(--av-faint); font-size: 11px; }
.av-tools-column { grid-template-columns: 1fr; }
.av-disclosure { overflow: visible; }
.av-disclosure summary { display: flex; align-items: center; gap: 10px; min-height: 66px; padding: 12px 15px; }
.av-disclosure summary > span:nth-child(2) { min-width: 0; flex: 1; }
.av-disclosure summary strong, .av-disclosure summary small { display: block; }
.av-disclosure summary strong { font-size: 13px; }
.av-disclosure summary small { margin-top: 3px; color: var(--av-faint); font-size: 10px; font-weight: 500; overflow-wrap: anywhere; }
.av-disclosure-icon { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 8px; background: #f1f5f9; color: var(--av-faint); font-size: 10px; font-weight: 850; }
.av-disclosure[open] .av-disclosure-icon { background: #dbeafe; color: var(--av-primary); }
.av-disclosure > .av-card-body { border-top: 1px solid var(--av-border); }
.av-section-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 11px; }
.av-section-actions .av-note { margin: 0; }
.av-scenes { display: grid; gap: 9px; }
.av-scene { overflow: hidden; border: 1px solid var(--av-border); border-radius: 11px; background: #fff; }
.av-scene.selected { border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(147,197,253,.18); }
.av-scene-top { display: flex; align-items: center; gap: 9px; padding: 10px 11px; cursor: pointer; }
.av-scene-index { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 8px; background: #eff6ff; color: var(--av-primary); font-size: 11px; font-weight: 850; }
.av-scene-title { min-width: 0; flex: 1; }
.av-scene-title strong, .av-scene-title small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.av-scene-title strong { font-size: 12px; }
.av-scene-title small { margin-top: 3px; color: var(--av-faint); font-size: 10px; }
.av-scene-tools { display: flex; gap: 3px; }
.av-scene-editor { display: none; gap: 9px; padding: 12px; border-top: 1px solid var(--av-border); background: #f8fafc; }
.av-scene.open .av-scene-editor { display: grid; }
.av-two, .av-form-row { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.av-three { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; }
.av-field { display: grid; gap: 5px; min-width: 0; }
.av-field input, .av-field textarea, .av-field select { width: 100%; min-height: 44px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; color: var(--av-text); padding: 9px 10px; font-size: 12px; outline: none; }
.av-field textarea { min-height: 58px; resize: vertical; line-height: 1.45; }
.av-scene-actions, .av-cut-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.av-speech-tools { margin-top: 14px; }
.av-timeline-wrap { min-width: 0; overflow-x: auto; padding-bottom: 4px; }
.av-ruler { position: relative; min-width: 680px; height: 24px; border-bottom: 1px solid var(--av-border); color: var(--av-faint); font-size: 9px; }
.av-ruler span { position: absolute; bottom: 4px; transform: translateX(-50%); }
.av-track { display: grid; grid-template-columns: 92px minmax(580px,1fr); gap: 8px; align-items: center; min-width: 680px; margin-top: 8px; }
.av-track-label { padding-right: 6px; color: var(--av-faint); font-size: 10px; text-align: right; }
.av-track-lane { display: flex; gap: 3px; height: 38px; padding: 3px; border: 1px solid var(--av-border); border-radius: 8px; background: #f8fafc; }
.av-scene-block { position: relative; min-width: 42px; overflow: hidden; border: 1px solid #93c5fd; border-radius: 6px; background: #dbeafe; cursor: pointer; }
.av-scene-block.active { outline: 2px solid #f59e0b; outline-offset: 1px; }
.av-scene-block span { position: absolute; inset: 0; display: grid; place-items: center; color: #1e3a8a; font-size: 10px; font-weight: 800; }
.av-playhead { width: 100%; height: 8px; margin-top: 9px; accent-color: var(--av-primary); }
.av-time-readout { color: var(--av-faint); font-size: 10px; text-align: right; }
.av-cut-panel { margin-top: 14px; padding: 12px; border: 1px solid #dbeafe; border-radius: 10px; background: #f8fbff; }
.av-cut-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 7px 12px; }
.av-cut-heading h3 { margin: 0; font-size: 12px; }
.av-cut-heading span { min-width: 0; color: var(--av-muted); font-size: 10px; overflow-wrap: anywhere; }
.av-cut-status, .av-cut-note, .av-source-window { color: var(--av-muted); font-size: 10px; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }
.av-cut-status { margin: 8px 0; }
.av-cut-note { margin: 7px 0; }
.av-cut-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-top: 10px; }
.av-cut-group { display: grid; align-content: start; gap: 8px; min-width: 0; padding: 10px; border: 1px solid var(--av-border); border-radius: 8px; background: #fff; }
.av-cut-group small { color: var(--av-faint); font-size: 10px; line-height: 1.5; overflow-wrap: anywhere; }
.av-cut-examples { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 10px; color: var(--av-faint); font-size: 10px; }
.av-cut-examples button { min-height: 44px; padding: 6px 8px; border: 1px solid #bfdbfe; border-radius: 7px; background: #fff; color: var(--av-primary); font-size: 10px; text-align: left; }
.av-source-window { padding: 9px; border-left: 2px solid var(--av-primary); border-radius: 3px; background: #eff6ff; }

.av-analysis-body { display: grid; gap: 12px; }
.av-analysis-toolbar { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; align-items: end; }
.av-analysis-toolbar .av-field { grid-column: 1 / -1; }
.av-analysis-checkbox { display: flex; align-items: flex-start; gap: 7px; color: var(--av-muted); font-size: 11px; line-height: 1.5; }
.av-analysis-status { margin: 0; padding: 10px; border: 1px solid var(--av-border); border-radius: 9px; color: var(--av-muted); font-size: 11px; line-height: 1.55; }
.av-analysis-status.error { border-color: #fecdd3; color: #9f1239; }
.av-analysis-status.busy { border-color: #bfdbfe; color: #1d4ed8; }
.av-analysis-source-player { display: grid; gap: 8px; padding: 10px; border: 1px solid #dbeafe; border-radius: 9px; background: #f8fbff; }
.av-analysis-player-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: 11px; }
.av-analysis-player-head small { color: var(--av-faint); overflow-wrap: anywhere; }
.av-analysis-source-player video, .av-analysis-source-player audio { width: 100%; max-height: 260px; }
.av-analysis-source-player[hidden], .av-analysis-source-player video[hidden], .av-analysis-source-player audio[hidden], .av-analysis-results[hidden] { display: none; }
.av-analysis-results { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; min-width: 0; }
.av-analysis-result { min-width: 0; }
.av-analysis-result h3, .av-analysis-selection h3 { margin: 0 0 7px; font-size: 12px; }
.av-analysis-list { display: grid; gap: 8px; max-height: 360px; overflow: auto; margin-top: 8px; }
.av-analysis-item { padding: 9px; border: 1px solid var(--av-border); border-radius: 8px; background: #fff; overflow-wrap: anywhere; }
.av-analysis-item p { margin: 7px 0 0; font-size: 11px; line-height: 1.55; white-space: pre-wrap; }
.av-analysis-item button { max-width: 100%; white-space: normal; text-align: left; }
.av-analysis-words { margin-top: 8px; color: var(--av-muted); font-size: 10px; }
.av-analysis-words summary { cursor: pointer; min-height: 32px; }
.av-analysis-word-list { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 7px; }
.av-analysis-word-list button { min-height: 44px; padding: 7px 9px; border: 1px solid #bfdbfe; border-radius: 7px; background: #eff6ff; color: #1e40af; font-size: 11px; }
.av-analysis-search { display: grid; gap: 5px; color: var(--av-faint); font-size: 10px; }
.av-analysis-search input { width: 100%; min-height: 44px; border: 1px solid #cbd5e1; border-radius: 8px; padding: 8px; }
.av-analysis-selection { display: grid; gap: 9px; padding: 13px; border: 1px solid #dbeafe; border-radius: 10px; background: #f8fbff; }
.av-analysis-context { margin: 0; color: var(--av-muted); font-size: 11px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.av-analysis-caution { margin: 0; color: #92400e; font-size: 10px; line-height: 1.55; }
.av-analysis-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.av-inspector-section { display: grid; gap: 11px; }
.av-metric-row { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; }
.av-metric { padding: 9px; border: 1px solid var(--av-border); border-radius: 9px; background: #f8fafc; }
.av-metric b { display: block; font-size: 15px; }
.av-metric span { display: block; margin-top: 2px; color: var(--av-faint); font-size: 9px; }
.av-event-log { display: grid; gap: 5px; max-height: 220px; overflow: auto; }
.av-event { color: var(--av-muted); font-size: 10px; line-height: 1.4; }
.av-event time { margin-right: 6px; color: var(--av-faint); }
.av-event.error { color: var(--av-red); }
.av-studio-footer { padding: 26px 0 0; color: var(--av-faint); font-size: 10px; text-align: center; }

.av-modal { position: fixed; inset: 0; z-index: 60; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(15,23,42,.42); backdrop-filter: blur(4px); }
.av-modal.open { display: flex; }
.av-dialog { width: min(480px,100%); overflow: hidden; border: 1px solid var(--av-border); border-radius: 16px; background: #fff; box-shadow: 0 24px 70px rgba(15,23,42,.18); }
.av-dialog-head { display: flex; align-items: center; gap: 8px; padding: 15px 16px; border-bottom: 1px solid var(--av-border); }
.av-dialog-head h2 { margin: 0; font-size: 16px; }
.av-dialog-head button { margin-left: auto; }
.av-dialog-body { display: grid; gap: 12px; padding: 16px; }
.av-dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--av-border); }
.av-export-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }

/* Optional local stock library. Keep this compact below the user upload
 * surface and avoid making catalog availability a Studio prerequisite. */
.av-stock-library { overflow: hidden; }
.av-stock-library > summary { display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 12px 14px; }
.av-stock-library > summary > span:nth-child(2) { display: grid; gap: 2px; min-width: 0; }
.av-stock-library > summary strong { color: var(--av-text); font-size: 12px; }
.av-stock-library > summary small { color: var(--av-faint); font-size: 10px; font-weight: 500; overflow-wrap: anywhere; }
.av-stock-library-body { display: grid; gap: 11px; border-top: 1px solid var(--av-border); }
.av-stock-toolbar { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(130px,.8fr); gap: 9px; }
.av-stock-toolbar .av-field { gap: 5px; }
.av-stock-toolbar .av-field > span { color: var(--av-faint); font-size: 10px; font-weight: 700; }
.av-stock-list { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,260px),1fr)); gap: 10px; min-width: 0; }
.av-stock-item { display: grid; grid-template-columns: minmax(102px,.7fr) minmax(0,1.3fr); gap: 10px; min-width: 0; padding: 10px; border: 1px solid var(--av-border); border-radius: 11px; background: #fff; box-shadow: 0 1px 2px rgba(15,23,42,.03); }
.av-stock-item:hover { border-color: #bfdbfe; box-shadow: 0 8px 20px rgba(37,99,235,.08); }
.av-stock-preview { display: grid; align-content: start; gap: 7px; min-width: 0; }
.av-stock-poster, .av-stock-video { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; background: #e2e8f0; }
.av-stock-preview-button { min-height: 38px; padding: 7px 9px; font-size: 10px; }
.av-stock-copy { display: grid; align-content: start; gap: 5px; min-width: 0; }
.av-stock-title { color: var(--av-text); font-size: 12px; font-weight: 800; line-height: 1.35; overflow-wrap: anywhere; }
.av-stock-meta { color: var(--av-primary-dark); font-size: 10px; font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
.av-stock-note, .av-stock-provenance { margin: 0; color: var(--av-faint); font-size: 10px; line-height: 1.45; overflow-wrap: anywhere; }
.av-stock-provenance { font-size: 9px; }
.av-stock-add { width: 100%; min-height: 39px; margin-top: 2px; padding: 7px 9px; font-size: 10px; }

@media (max-width: 430px) {
  .av-stock-toolbar { grid-template-columns: minmax(0,1fr); }
  .av-stock-item { grid-template-columns: minmax(0,1fr); }
  .av-stock-poster, .av-stock-video { aspect-ratio: 16 / 8; }
}

@media (min-width: 760px) {
  .av-main { padding: 36px 24px 52px; }
  .av-grid { grid-template-columns: minmax(0,1.04fr) minmax(0,.96fr); align-items: start; }
  .av-tools-column { grid-column: 1 / -1; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .av-settings-column { grid-column: 1 / -1; grid-template-columns: repeat(3,minmax(0,1fr)); }
  .av-tools-label { grid-column: 1 / -1; }
  .av-library { margin-bottom: 16px; }
}
@media (max-width: 620px) {
  .av-shell { padding-top: 100px; }
  .av-topbar { flex-wrap: wrap; gap: 8px; padding: 9px 12px; }
  .av-home-link { display: none; }
  .av-connection { order: 3; width: 100%; }
  .av-topbar-spacer { display: none; }
  .av-brand { flex: 1; }
  .av-main { padding: 24px 12px 38px; }
  .av-project-head { align-items: flex-start; }
  .av-project-head h1 { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; font-size: 27px; }
  .av-workflow { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .av-workflow a { justify-content: flex-start; padding-left: 8px; }
  .av-card-head { padding: 12px 13px; }
  .av-card-body { padding: 13px; }
  .av-command-actions .av-btn { flex: 1 1 145px; }
  .av-two, .av-three, .av-form-row, .av-cut-grid, .av-analysis-results, .av-analysis-toolbar { grid-template-columns: minmax(0,1fr); }
  .av-analysis-toolbar .av-field { grid-column: auto; }
  .av-section-actions { align-items: flex-start; flex-direction: column; }
  .av-section-actions .av-btn { width: 100%; }
  .av-export-options { grid-template-columns: minmax(0,1fr); }
  .av-variant-options { grid-template-columns: minmax(0,1fr); }
  .av-project-head > .av-btn { padding-inline: 10px; }
  .av-scene-top { flex-wrap: wrap; }
  .av-scene-tools { width: 100%; justify-content: flex-end; }
  .av-field input:not([type=color]), .av-field textarea, .av-field select, .av-command-box textarea, .av-analysis-search input { font-size: 16px; }
}
