/* ShapeCraft experiment: conversation first, with immutable models in the thread. */
body[data-view="ai"] {
  --bg:#252423; --panel:#1c1b1a; --panel-2:#302e2d; --line:#353432;
  --text:#f6f4f2; --muted:#93908d; --accent:#b9dacb; --accent-dim:#8daf9f;
  --brand:#86cf1b; /* ShapeCraft neon green */
  --surface:#2a2928; --surface-2:#302e2d; --line-soft:#393734; --fg-dim:#b4b1af;
  --bevel:9px; /* anime.js-style chamfered module corner */
  font-family:var(--font-body);
}
/* anime.js-style technical micro-labels: mono, uppercase, tracked out. */
.nav-section, .model-kind, #ai-panel .chat-model, .nav-usage small,
#ai-panel .welcome-kicker, .eyebrow, .usage-card-label, .model-version,
.composer-note {
  font-family:var(--font-code); text-transform:uppercase; letter-spacing:.09em;
}
/* Quiet, narrow scrollbars across chat, navigation, and model/usage overlays. */
body[data-view="ai"] ::-webkit-scrollbar { width:6px; height:6px; }
body[data-view="ai"] ::-webkit-scrollbar-track { background:transparent; }
body[data-view="ai"] ::-webkit-scrollbar-thumb { background:#4a4847; border-radius:6px; }
body[data-view="ai"] ::-webkit-scrollbar-thumb:hover { background:#615e5b; }
body[data-view="ai"] ::-webkit-scrollbar-corner { background:transparent; }
body[data-view="ai"] ::-webkit-scrollbar-button { display:none; }
@supports not selector(::-webkit-scrollbar) {
  body[data-view="ai"] * { scrollbar-width:thin; scrollbar-color:#4a4847 transparent; }
}
body[data-view="ai"] > #viewport { display:none; }
body[data-view="ai"] #ai-empty { display:none; }
body[data-view="ai"] #ai-panel { width:100%; max-width:none; min-width:0; height:100dvh; flex-direction:row; border:0; background:var(--bg); }
/* Width tracks the widest nav entry (usually the longest design name), clamped so one long name can't swallow the viewport. */
.studio-nav { width:fit-content; min-width:240px; max-width:420px; flex:none; display:flex; flex-direction:column; padding:28px 14px 16px; background:#1c1b1a; }
.studio-brand { display:flex; align-items:center; gap:9px; padding:0 10px 28px; color:var(--brand); text-decoration:none; font-size:21px; font-weight:650; letter-spacing:.3px; }
.brand-mark { font-size:33px; color:var(--brand); font-weight:400; }
.studio-brand small { font-size:10px; color:var(--muted); letter-spacing:1.5px; margin-left:auto; }
.nav-new { display:block; color:var(--text); text-decoration:none; padding:12px; border:1px solid var(--line); border-radius:4px; font-size:16px; }
.nav-new:hover { background:#2d2b2a; }
.nav-section { margin:32px 12px 12px; color:#8b8885; font-size:12px; letter-spacing:1.3px; }
.nav-designs { overflow:auto; min-height:0; }
.nav-design { display:flex; flex-direction:column; gap:5px; padding:12px; margin:3px 0; border-radius:4px; text-decoration:none; color:var(--text); font-size:15px; }
.nav-design span { overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.nav-design small { font-size:12px; color:#93908d; }
.nav-design[data-status="running"] small, .nav-design[data-status="queued"] small { color:#d5b77a; }
.nav-design[data-status="running"] small::before { content:""; display:inline-block; width:7px; height:7px; margin-right:6px; border:1px solid currentColor; border-right-color:transparent; border-radius:50%; animation:nav-spin 1s linear infinite; }
.nav-design[data-unread="true"] small { color:#9dccaf; }
.nav-design[data-unread="true"] small::before { content:""; display:inline-block; width:5px; height:5px; margin-right:7px; border-radius:50%; background:currentColor; }
.nav-design[data-status="failed"] small, .nav-design[data-status="interrupted"] small { color:#e8aa96; }
.nav-sync { color:#bfa881; font-size:13px; padding:0 12px; }
@keyframes nav-spin { to { transform:rotate(360deg); } }
@media (prefers-reduced-motion:reduce) { .nav-design[data-status="running"] small::before { animation:none; } }
.nav-design.selected, .nav-design:hover { background:#302e2d; }
.nav-bottom { margin-top:auto; padding:20px 0 4px; font-size:13px; color:#8b8885; display:flex; flex-direction:column; gap:14px; }
.nav-bottom > div { display:flex; align-items:center; gap:8px; padding:0 12px; }
#ai-panel .nav-usage { display:flex; align-items:center; gap:9px; text-align:left; padding:12px; background:transparent; border:1px solid #353432; border-radius:4px; font-size:16px; }
.nav-usage small { margin-left:auto; color:#93908d; font-size:12px; }
.nav-usage small.credits { color:#86cf1b; font-family:"JetBrains Mono",ui-monospace,Menlo,monospace; letter-spacing:.02em; }
.nav-usage small.credits.out { color:#e2683c; }
#ai-panel .nav-usage:hover { background:#2d2b2a; }
.local-dot { width:6px; height:6px; border-radius:50%; background:#9fbaa8; }
.conversation { flex:1; min-width:0; display:flex; flex-direction:column; position:relative; }
/* Narrow GitHub-style branch graph of the revision tree, pinned to the right edge. */
#ai-panel .rev-graph { flex:none; min-width:26px; max-width:150px; overflow:auto; background:#191817; border-left:1px solid #2a2928; padding:6px 0; }
.rev-graph:empty { display:none; }
.rev-graph-svg { display:block; margin:0 auto; }
.rev-edge { fill:none; stroke-width:2; opacity:.65; }
.rev-node circle { stroke:#191817; stroke-width:2; cursor:pointer; transition:stroke .12s, filter .12s; }
.rev-node:hover circle { stroke:#ffffffaa; }
.rev-node.viewing circle { stroke:#b9dacb; stroke-width:3; filter:drop-shadow(0 0 5px #b9dacbbb); }
.flow-dot { filter:drop-shadow(0 0 4px #ffffffcc); }
.rev-node.selected circle { stroke:#ffffff; stroke-width:2.5; }
.rev-node.current circle { stroke-dasharray:2 2; stroke:#cfe3d8; }
.rev-node.current.selected circle { stroke-dasharray:none; stroke:#f6f4f2; }
.rev-node:focus-visible { outline:none; }
.rev-node:focus-visible circle { stroke:#b9dacb; stroke-width:3; }
@keyframes rev-flash { 0%,30% { box-shadow:0 0 0 2px #b9dacbcc; } 100% { box-shadow:0 0 0 2px transparent; } }
.model-card.rev-flash { animation:rev-flash 1.4s ease-out; }
#ai-panel .chat-header { min-height:74px; padding:16px 28px; gap:20px; border:0; }
#ai-panel .chat-header > div { display:flex; flex-direction:column; gap:3px; white-space:nowrap; }
#ai-panel .chat-header strong { font-size:20px; letter-spacing:.2px; font-weight:550; color:var(--brand); }
#ai-panel .chat-model { margin:0; font-size:12px; color:#8b8885; }
#ai-panel #ai-topbar { position:static; padding:0; min-height:0; background:transparent; border:0; flex:1; }
#ai-panel .ai-title { text-align:center; color:#b4b1af; font-size:14px; font-weight:400; }
#ai-panel button, .model-dialog button { font-family:inherit; }
#ai-panel button.primary, #ai-topbar button.primary, .model-dialog button.primary { background:#ece9e6; color:#201f1e; border-color:#ece9e6; }
#ai-panel #ai-topbar button { background:transparent; font-size:13px; padding:7px 10px; }
#ai-panel #ai-topbar button.primary { background:#ece9e6; color:#201f1e; }
#ai-panel .ai-gallery { display:none; }
#ai-panel .chat-messages { padding:28px max(24px, calc((100% - 760px) / 2)) 36px; }
#ai-panel .chat-welcome { text-align:center; padding:8vh 0 20px; }
#ai-panel .welcome-icon { display:block; font-size:55px; color:#b9dacb; }
#ai-panel .welcome-kicker { font-size:12px; letter-spacing:2px; color:#a3aaa6; margin:20px 0; }
#ai-panel .chat-welcome h2 { font-size:clamp(29px,3.45vw,41px); font-weight:500; letter-spacing:-1px; margin:16px 0 12px; }
#ai-panel .chat-welcome p { color:#b4b1af; }
.starter-prompts { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; margin-top:42px; text-align:left; }
#ai-panel .starter-prompts button { text-align:left; line-height:1.6; background:var(--surface); border:1px solid var(--line-soft); border-radius:10px; padding:16px 15px; font-size:14px; }
#ai-panel .starter-prompts button:hover { box-shadow:inset 0 0 0 1px var(--brand); }
.starter-prompts span { display:block; font-size:12px; color:#93908d; margin-top:10px; }
#ai-panel .chat-message { font-size:16px; line-height:1.75; margin-bottom:30px; }
#ai-panel .chat-message.user { width:fit-content; max-width:85%; margin-left:auto; padding:12px 20px; border-radius:4px; background:#302e2d; }
#ai-panel .chat-message.user .message-head { display:none; }
#ai-panel .chat-message.assistant .message-head strong { font-size:14px; color:#c0d5c8; font-weight:500; }
#ai-panel .message-head time { font-size:12px; color:#7f7c79; }
#ai-panel .message-duration, #ai-panel .message-activity, #ai-panel .message-copy { font-size:12px; }
/* "Thinking…" indicator shown in the thread until the assistant's reply streams in. */
#ai-panel .chat-thinking { margin-bottom:30px; }
#ai-panel .chat-thinking .thinking { display:flex; align-items:center; gap:11px; margin-top:6px; color:var(--muted); }
.thinking-label { font-family:var(--font-code); text-transform:uppercase; letter-spacing:.11em; font-size:12px; }
.thinking-dots { display:inline-flex; gap:5px; }
.thinking-dots i { width:6px; height:6px; border-radius:50%; background:var(--brand); opacity:.3; animation:thinking-pulse 1.2s ease-in-out infinite; }
.thinking-dots i:nth-child(2) { animation-delay:.18s; }
.thinking-dots i:nth-child(3) { animation-delay:.36s; }
@keyframes thinking-pulse { 0%,80%,100% { opacity:.25; transform:translateY(0); } 40% { opacity:1; transform:translateY(-3px); } }
@media (prefers-reduced-motion:reduce) { .thinking-dots i { animation:none; opacity:.6; } }
/* web_search sources: a "N sources" chip under a reply opens a right-side bibliography panel. */
.sources-chip { display:inline-flex; align-items:center; gap:7px; margin-top:12px; font-family:var(--font-code); text-transform:uppercase; letter-spacing:.07em; font-weight:700; font-size:11px; border-radius:999px; padding:8px 15px; border:0; background:#7c3aed; color:#fff; cursor:pointer; box-shadow:0 2px 12px rgba(124,58,237,.4); transition:background .12s, box-shadow .12s, transform .08s; }
.sources-chip::before { content:"◇"; color:#e9d5ff; font-size:12px; }
.sources-chip:hover { background:#8b5cf6; box-shadow:0 4px 16px rgba(124,58,237,.55); }
.sources-chip:active { transform:translateY(1px); }
.sources-panel { position:fixed; top:0; right:0; width:min(360px,90vw); height:100dvh; z-index:60; background:#1c1b1a; border-left:1px solid var(--line); box-shadow:-8px 0 30px #0007; display:flex; flex-direction:column; }
.sources-panel[hidden] { display:none; }
.sources-panel header { display:flex; align-items:center; justify-content:space-between; padding:20px 22px; border-bottom:1px solid var(--line-soft); }
.sources-panel h3 { margin:0; font-family:var(--font-code); text-transform:uppercase; letter-spacing:.1em; font-size:13px; font-weight:500; }
.sources-close { background:transparent; border:0; color:var(--fg-dim); font-size:22px; cursor:pointer; line-height:1; }
.sources-list { list-style:none; margin:0; padding:10px; overflow-y:auto; display:flex; flex-direction:column; gap:4px; }
.source-link { display:flex; gap:11px; align-items:flex-start; padding:12px 13px; border-radius:3px; text-decoration:none; color:inherit; }
.source-link:hover { background:var(--surface-2); }
.source-num { flex:none; width:20px; height:20px; border-radius:2px; background:var(--surface-2); color:var(--brand); font-family:var(--font-code); font-size:11px; display:flex; align-items:center; justify-content:center; margin-top:1px; }
.source-body { display:flex; flex-direction:column; gap:3px; min-width:0; }
.source-title { font-size:13px; color:var(--text); line-height:1.4; }
.source-domain { font-family:var(--font-code); font-size:11px; color:var(--brand); }
.composer-home { width:min(760px,calc(100% - 48px)); margin:0 auto; padding-bottom:10px; }
#ai-panel .chat-composer, .model-dialog .chat-composer { margin:0; padding:16px; border:1px solid #3b3a38; background:#302e2d; border-radius:4px; box-shadow:0 6px 30px #0001; }
.chat-composer.drag-over { outline:2px dashed var(--brand); outline-offset:3px; background:#86cf1b14; }
#ai-panel .chat-composer textarea, .model-dialog .chat-composer textarea { resize:none; min-height:54px; font-size:16px; color:#ece9e6; }
.chat-composer textarea::placeholder { color:#93908d; }
#ai-panel .chat-attach, .model-dialog .chat-attach { background:transparent; border:0; font-size:25px; padding:2px 6px; }
#ai-panel .chat-send, .model-dialog .chat-send { border-radius:4px; padding:9px 16px; font-size:13px; font-family:var(--font-code); text-transform:uppercase; letter-spacing:.08em; }
.composer-note { text-align:center; font-size:12px; color:#8b8885; margin:12px 0 0; }
#ai-panel .chat-run, .model-dialog .chat-run { border:0; padding:8px 4px 12px; font-size:13px; }
/* Active-run status ("Generating · Medium effort · 0:41") — bold, with a glowing green animated gradient. */
#ai-panel .chat-run .run-active, .model-dialog .chat-run .run-active {
  font-family:var(--font-code); font-weight:700; letter-spacing:.04em; font-size:14px;
  background:linear-gradient(90deg,#4e9e0f,#86cf1b,#d6ff7a,#86cf1b,#4e9e0f); background-size:220% 100%;
  -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; color:transparent;
  filter:drop-shadow(0 0 7px #86cf1b66); animation:run-shimmer 2.2s linear infinite;
}
@keyframes run-shimmer { to { background-position:220% 0; } }
@media (prefers-reduced-motion:reduce) { #ai-panel .chat-run .run-active, .model-dialog .chat-run .run-active { animation:none; } }
#ai-panel .chat-latest { position:absolute; bottom:198px; left:50%; transform:translateX(-50%); z-index:4; border-radius:4px; background:#302e2d; box-shadow:0 4px 14px #0004; }
.chat-reference { display:flex; align-items:center; gap:8px; margin-bottom:10px; font-size:13px; color:#bfd5c9; }
.chat-reference button { margin-left:auto; padding:1px 5px !important; background:transparent !important; border:0 !important; color:#d5d3d1; cursor:pointer; }
/* anime.js-style beveled module: chamfered corners with a hairline inset border. */
.model-card { margin:22px 0 30px; background:var(--surface); border:1px solid var(--line-soft); border-radius:12px; overflow:hidden; }
.model-card header { display:flex; align-items:center; justify-content:space-between; padding:14px 20px; gap:10px; border-bottom:1px solid var(--line-soft); background:var(--surface-2); }
.model-kind { font-size:10px; color:var(--brand); }
.model-card h3 { font-size:16px; font-weight:500; margin:3px 0 0; }
.model-version { border:1px solid var(--line-soft); border-radius:2px; padding:3px 9px; font-size:11px; color:var(--fg-dim); white-space:nowrap; }
.model-stage { height:320px; position:relative; background:#f0f4f9; }
#ai-panel .model-preview { padding:0; border:0; border-radius:0; width:100%; height:100%; background:#f0f4f9; position:absolute; inset:0; overflow:hidden; }
.model-preview img { display:block; width:100%; height:100%; object-fit:contain; }
.model-preview span { position:absolute; bottom:18px; left:50%; transform:translateX(-50%); padding:7px 13px; border-radius:4px; background:#303030e8; color:#d5d3d1; font-size:12px; white-space:nowrap; }
.model-stage canvas { display:block; touch-action:none; }
.model-stage.interactive::after { content:'Drag to rotate · Scroll to zoom'; position:absolute; bottom:12px; left:0; right:0; text-align:center; pointer-events:none; color:#b4b1af; font-size:12px; }
/* STL + STEP download buttons pinned on the thumbnail (green). */
.model-dl { position:absolute; top:10px; right:10px; z-index:3; display:inline-flex; gap:6px; }
#ai-panel .model-dl button { display:inline-flex; align-items:center; gap:5px; font-family:var(--font-code); font-size:10px; letter-spacing:.09em; text-transform:uppercase;
  color:var(--brand); background:#1c1b1ad9; border:1px solid var(--brand); border-radius:6px; padding:6px 9px; cursor:pointer;
  -webkit-backdrop-filter:blur(3px); backdrop-filter:blur(3px); transition:background .12s, color .12s; }
#ai-panel .model-dl button:hover { background:var(--brand); color:#10210a; border-color:var(--brand); }
#ai-panel .model-dl button[hidden] { display:none; }
/* Spinner shown on a download button while the file is built on the server. */
.btn-spinner { display:inline-block; width:1em; height:1em; vertical-align:-0.15em; border:2px solid currentColor;
  border-top-color:transparent; border-radius:50%; animation:btn-spin .6s linear infinite; }
@keyframes btn-spin { to { transform:rotate(360deg); } }
@media (prefers-reduced-motion:reduce) { .btn-spinner { animation-duration:1.4s; } }
.model-error { padding:0 16px; color:var(--warn); font-size:14px; }
.model-dialog { width:calc(100vw - 64px); max-width:1500px; height:calc(100dvh - 64px); max-height:none; padding:0; border:1px solid #3b3a38; border-radius:5px; background:#252423; color:#f6f4f2; overflow:hidden; }
.model-dialog::backdrop { background:#000a; backdrop-filter:blur(5px); }
.model-dialog-header { height:64px; display:flex; align-items:center; justify-content:space-between; padding:0 24px; border-bottom:1px solid #353432; }
.model-dialog-header > div { display:flex; align-items:center; gap:16px; }
.inspect-title { font-size:15px; font-weight:500; }
.inspect-version { font-size:11px; color:#b4b1af; }
.model-dialog button { background:#302e2d; color:#ece9e6; border:1px solid #3b3a38; border-radius:4px; padding:7px 10px; cursor:pointer; }
.model-dialog button:disabled { opacity:.5; cursor:default; }
.model-dialog .inspect-close { background:transparent; border:0; font-size:26px; }
.model-dialog-body { display:flex; height:calc(100% - 64px); min-height:0; }
.inspect-stage { flex:1; min-width:0; position:relative; }
/* Interactive axis gizmo (top/front/side view navigator), lower-right of the viewer. */
.view-widget { position:absolute; right:14px; bottom:14px; z-index:3; display:flex; flex-direction:column; align-items:center; gap:8px; }
.wire-toggle { font:600 11px/1 var(--mono, ui-monospace, monospace); letter-spacing:.04em; text-transform:uppercase; color:#cfd3da; background:rgba(20,24,30,.72); border:1px solid rgba(255,255,255,.14); border-radius:6px; padding:5px 9px; cursor:pointer; backdrop-filter:blur(4px); transition:background .12s, border-color .12s, color .12s; }
.wire-toggle:hover { background:rgba(32,38,46,.85); border-color:rgba(255,255,255,.26); }
.wire-toggle.on { color:#0e1116; background:#86cf1b; border-color:#86cf1b; }
.wire-toggle.loading { opacity:.7; cursor:progress; }
.exploded-overlay { position:absolute; inset:0; width:100%; height:100%; object-fit:contain; background:#202123; z-index:4; cursor:pointer; }
/* Scene-hierarchy panel (left of the viewport): browse the part tree, click a part to isolate it. */
.hier-panel { position:absolute; left:14px; top:14px; bottom:14px; width:264px; max-width:42%; z-index:5; display:flex; flex-direction:column; background:rgba(16,19,24,.9); border:1px solid rgba(255,255,255,.14); border-radius:8px; backdrop-filter:blur(6px); overflow:hidden; }
.hier-panel header { display:flex; align-items:center; justify-content:space-between; padding:8px 10px; font:600 11px/1 var(--mono, ui-monospace, monospace); letter-spacing:.06em; text-transform:uppercase; color:#cfd3da; border-bottom:1px solid rgba(255,255,255,.1); }
.hier-close { background:none; border:0; color:#cfd3da; font-size:16px; line-height:1; cursor:pointer; }
.hier-body { flex:1; overflow:auto; padding:6px 8px; font:500 12px/1.45 var(--mono, ui-monospace, monospace); }
.hier-kids { margin-left:11px; border-left:1px solid rgba(255,255,255,.08); padding-left:3px; }
.hier-row { display:flex; align-items:center; gap:3px; border-radius:4px; }
.hier-row:hover { background:rgba(255,255,255,.06); }
.hier-tw { width:14px; flex:0 0 14px; text-align:center; color:#8a9099; user-select:none; }
.hier-swatch { width:9px; height:9px; flex:0 0 9px; border-radius:2px; box-shadow:0 0 0 1px rgba(0,0,0,.35); }
.hier-row.has-kids .hier-tw { cursor:pointer; }
.hier-name { flex:1; min-width:0; text-align:left; background:none; border:0; color:#dfe3ea; padding:3px 4px; border-radius:3px; cursor:pointer; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.hier-name:hover:not(:disabled) { color:#86cf1b; }
.hier-name:disabled { color:#9aa0a8; cursor:default; }
.hier-name.on { color:#0e1116; background:#86cf1b; }
.axis-gizmo { width:108px; height:108px; overflow:visible; }
.axis-gizmo circle { transition:filter .1s; }
.axis-gizmo circle:hover { filter:drop-shadow(0 0 4px var(--glow)) drop-shadow(0 0 7px var(--glow)); }
body[data-view="ai"] .model-dialog #viewport { width:100%; height:100%; display:block; }
body[data-view="ai"] .model-dialog #stats { top:16px; left:16px; min-width:0; font-size:10px; }
.model-dialog #stats summary { cursor:pointer; color:#b4b1af; margin-top:5px; }
body[data-view="ai"] .model-dialog #ai-parameters { top:16px; right:16px; max-width:200px; }
.model-dialog #ai-parameters fieldset { border:0; margin:0; padding:0; min-width:0; }
.model-dialog #ai-parameters fieldset:disabled { opacity:.55; }
.model-dialog #ai-parameters .param-head { display:flex; justify-content:space-between; align-items:baseline; gap:8px; }
.model-dialog #ai-parameters .param-val { color:#8b8885; font-variant-numeric:tabular-nums; }
.model-dialog #ai-parameters input[type=range] { width:100%; margin:3px 0 0; padding:0; border:0; background:transparent; accent-color:#b9dacb; cursor:pointer; }
.model-dialog #ai-parameters .param-bool { flex-direction:row; align-items:center; gap:9px; }
.model-dialog #ai-parameters .param-bool input[type=checkbox] { width:auto; margin:0; accent-color:#b9dacb; cursor:pointer; }
/* Parameters the AI recently tweaked: shown first, highlighted value, wrapped in an animated marching-dash outline. */
.model-dialog #ai-parameters .param-changed { position:relative; }
.model-dialog #ai-parameters .param-changed .param-val { color:#b9dacb; }
.model-dialog #ai-parameters .param-changed::before {
  content:""; position:absolute; inset:-3px; border-radius:6px; pointer-events:none;
  background-image:linear-gradient(90deg,#b9dacb 50%,transparent 0),linear-gradient(90deg,#b9dacb 50%,transparent 0),linear-gradient(0deg,#b9dacb 50%,transparent 0),linear-gradient(0deg,#b9dacb 50%,transparent 0);
  background-size:10px 1.5px,10px 1.5px,1.5px 10px,1.5px 10px;
  background-repeat:repeat-x,repeat-x,repeat-y,repeat-y;
  background-position:0 0,0 100%,0 0,100% 0;
  animation:param-march .6s linear infinite;
}
@keyframes param-march { to { background-position:10px 0,-10px 100%,0 -10px,100% 10px; } }
/* Collapse to the tweaked param(s); the "Parameters · N more" header reveals the rest. */
.model-dialog #ai-parameters .param-extra { display:none; }
.model-dialog #ai-parameters .param-fields.expanded .param-extra:not([hidden]) { display:flex; }
.model-dialog #ai-parameters .param-header { display:flex; align-items:center; gap:7px; width:100%; margin-top:4px; padding:9px 14px; background:transparent; border:0; color:#d5d3d1; font-size:13px; text-align:left; cursor:pointer; }
.model-dialog #ai-parameters .param-header:hover { color:#f6f4f2; }
.model-dialog #ai-parameters .param-tri { display:inline-block; width:8px; font-size:8px; color:#8b8885; }
.model-dialog #ai-parameters .param-count { color:#8b8885; font-size:12px; }
@media (prefers-reduced-motion:reduce) { .model-dialog #ai-parameters .param-changed::before { animation:none; } }
.model-dialog .anno-dock { bottom:48px; }
.model-dialog .anno-bar { gap:7px; }
.model-dialog .anno-bar .grp + .grp { padding-left:7px; }
.model-dialog .anno-bar .tbtn { font-size:11px; }
.inspect-chat { width:340px; flex:none; display:flex; flex-direction:column; padding:28px 20px 20px; background:#272625; border-left:1px solid #353432; overflow:auto; }
.eyebrow { color:#b4c7bb; font-size:9px; letter-spacing:1.5px; }
.inspect-chat h2 { font-size:22px; font-weight:500; line-height:1.3; margin:18px 0 10px; }
.inspect-chat p { font-size:13px; line-height:1.8; color:#b4b1af; }
.inspect-composer { margin-top:auto; padding-top:28px; }
.model-dialog .chat-composer { padding:12px; border-radius:4px; }
.model-dialog .composer-actions span { font-size:9px; }
.model-dialog .chat-composer textarea { min-height:90px; }
#ai-panel .designs-toggle { display:none; }
@media(max-width:1100px) {
  .studio-nav { width:200px; }
  #ai-panel .chat-header { padding:16px; gap:10px; }
  #ai-panel .ai-title { display:none; }
  .inspect-chat { width:300px; }
  .model-dialog .composer-actions { gap:6px; }
  .model-dialog .effort-control { padding:4px 6px; gap:4px; font-size:11px; }
  .model-dialog .chat-attach { padding:2px 3px; }
  .model-dialog .chat-send { padding:8px 10px; }
}
@media(max-width:760px) {
  .studio-nav { display:none; position:absolute; z-index:12; top:64px; bottom:0; width:240px; box-shadow:12px 0 30px #0005; }
  #ai-panel.nav-visible .studio-nav { display:flex; }
  #ai-panel .designs-toggle { display:block; background:transparent; border:0; padding:4px; }
  #ai-panel .chat-header { min-height:64px; padding:10px 14px; }
  #ai-panel .chat-model { font-size:8px; }
  #ai-panel .chat-header strong { font-size:14px; }
  #ai-panel #ai-topbar { justify-content:flex-end; gap:5px; }
  #ai-panel #ai-topbar button { padding:6px; font-size:10px; }
  #ai-panel .chat-messages { padding:12px 16px 24px; }
  #ai-panel .chat-welcome { padding-top:3vh; }
  .starter-prompts { grid-template-columns:1fr; gap:8px; margin-top:25px; }
  #ai-panel .starter-prompts button { padding:12px; }
  .starter-prompts span { display:inline; margin-left:8px; }
  .composer-home { width:calc(100% - 24px); }
  .model-stage { height:260px; }
  .model-dialog { width:100vw; height:100dvh; max-width:none; border-radius:0; border:0; }
  .model-dialog-body { flex-direction:column; }
  .inspect-stage { flex:1; min-height:280px; }
  .inspect-chat { width:100%; border-left:0; border-top:1px solid #3b3a38; padding:12px; max-height:38%; }
  .inspect-chat > h2,.inspect-chat > p,.inspect-chat > .eyebrow { display:none; }
  .inspect-composer { margin:0; padding:0; }
  .model-dialog .chat-composer textarea { min-height:46px; }
  body[data-view="ai"] .model-dialog #stats { display:none; }
  .model-dialog .anno-dock { bottom:12px; }
  .model-dialog #status { display:none; }
  .model-dialog-header { padding:0 16px; }
}
/* Actions and load states shared by blank, generated, and template designs. */
.nav-row { display:flex; align-items:center; position:relative; }
.nav-row .nav-design { flex:1; min-width:0; padding-right:34px; }
#ai-panel .nav-more { position:absolute; right:8px; padding:5px 3px; border:0; background:transparent; font-size:10px; }
.nav-empty { color:#7f7c79; font-size:12px; padding:0 12px; line-height:1.6; }
.design-menu { position:relative; flex:none; }
.design-menu summary { list-style:none; cursor:pointer; padding:8px; letter-spacing:2px; font-size:12px; }
.design-menu > div { position:absolute; right:0; top:34px; min-width:145px; display:flex; flex-direction:column; padding:6px; background:#302e2d; border:1px solid #3b3a38; border-radius:10px; z-index:10; box-shadow:0 10px 30px #0004; }
#ai-panel .design-menu button { text-align:left; border:0; }
#ai-panel .design-menu button:hover { background:#3b3a38; }
.start-template { display:inline-block; margin-top:28px; color:#b8c8bf; font-size:12px; text-decoration:none; }
.start-template:hover { text-decoration:underline; }
.model-loading { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:12px; padding:24px; background:#201f1e; }
.model-loading img { max-width:90%; max-height:65%; object-fit:contain; border-radius:4px; }
.model-loading p { font-size:13px; color:#b4b1af; max-width:500px; line-height:1.6; text-align:center; }
.inspect-actions { display:flex; gap:8px; align-items:center; }
.model-dialog #ai-parameters select { width:100%; padding:7px; border-radius:5px; background:#252423; border:1px solid #3b3a38; color:#ece9e6; }
/* (STL/STEP downloads moved onto the thumbnail; see .model-dl above.) */
.model-preview:focus-visible, a:focus-visible, button:focus-visible, summary:focus-visible { outline:2px solid #b9dacb; outline-offset:3px; }
@media(max-width:760px) { .inspect-actions { gap:4px; } .model-dialog .inspect-actions button { font-size:10px; padding:7px; } .inspect-version { font-size:9px; } .model-dialog-header { gap:8px; } .model-dialog-header > div { gap:8px; } }
#ai-panel .chat-header > #ai-topbar { flex-direction:row; }
.effort-control { display:inline-flex; align-items:center; gap:7px; margin-left:auto; padding:5px 9px; border:1px solid #56685c; border-radius:4px; background:#2b352f; color:#c0d5c8; font-size:12px; font-weight:500; white-space:nowrap; cursor:pointer; }
.effort-control:hover { border-color:#849f8e; background:#333f37; }
.effort-control:focus-within { outline:2px solid #b9dacb; outline-offset:3px; }
.effort-control select { width:auto; margin:0; padding:2px 0; border:0; background:transparent; color:#edf4ef; font:inherit; cursor:pointer; }
.effort-control select option { background:#302e2d; color:#ece9e6; }
/* Settings button + Auto-effort chip + Settings dialog. */
#ai-panel .nav-settings { display:flex; align-items:center; gap:9px; text-align:left; padding:12px; background:transparent; border:1px solid var(--line); border-radius:4px; font-size:16px; }
#ai-panel .nav-settings:hover { background:#2d2b2a; }
.effort-auto { margin-left:auto; display:inline-flex; align-items:center; gap:6px; padding:5px 11px; border:1px solid #56685c; border-radius:4px; background:#2b352f; color:#c0d5c8; font-size:12px; font-weight:500; white-space:nowrap; cursor:pointer; }
.effort-auto b { color:var(--brand); font-weight:600; }
.effort-auto:hover { border-color:#849f8e; background:#333f37; }
.settings-dialog { width:min(460px,calc(100vw - 40px)); max-width:none; padding:0; border:1px solid var(--line); border-radius:8px; background:#1c1b1a; color:var(--text); }
.settings-dialog::backdrop { background:#000a; -webkit-backdrop-filter:blur(4px); backdrop-filter:blur(4px); }
.settings-dialog header { display:flex; align-items:center; justify-content:space-between; padding:20px 24px; border-bottom:1px solid var(--line-soft); }
.settings-dialog h2 { margin:0; font-family:var(--font-code); text-transform:uppercase; letter-spacing:.1em; font-size:15px; font-weight:500; }
.settings-close { background:transparent; border:0; color:var(--fg-dim); font-size:24px; cursor:pointer; line-height:1; }
.settings-body { padding:12px 24px 24px; display:flex; flex-direction:column; gap:4px; }
.setting-row { display:flex; align-items:center; justify-content:space-between; gap:20px; padding:16px 0; border-bottom:1px solid var(--line-soft); cursor:pointer; }
.setting-row.set-cap-row { border-bottom:0; }
.setting-label { display:flex; flex-direction:column; gap:4px; }
.setting-label b { font-weight:600; font-size:15px; }
.setting-label small { color:var(--muted); font-size:12px; line-height:1.5; max-width:300px; }
.set-auto { width:18px; height:18px; accent-color:var(--brand); cursor:pointer; flex:none; }
.set-cap { background:#302e2d; color:var(--text); border:1px solid var(--line); border-radius:4px; padding:7px 10px; font:inherit; cursor:pointer; flex:none; }
.settings-note { color:var(--warn); font-size:12px; margin:8px 0 0; }
.effort-control select:focus-visible { outline:none; }
.composer-actions .composer-hint { margin-left:auto; }
.composer-actions .chat-send { margin-left:0; flex-shrink:0; white-space:nowrap; }
.model-dialog .composer-hint { display:none; }
select:focus-visible { outline:2px solid #b9dacb; outline-offset:3px; }
.usage-dialog { width:min(1060px,calc(100vw - 48px)); max-width:none; max-height:calc(100dvh - 48px); padding:0; border:1px solid #3b3a38; border-radius:5px; background:#252423; color:#f6f4f2; font-size:13px; }
.usage-dialog::backdrop { background:#000a; backdrop-filter:blur(4px); }
.usage-header { position:sticky; top:0; z-index:2; background:#252423; display:flex; justify-content:space-between; align-items:flex-start; gap:16px; padding:28px 32px 22px; border-bottom:1px solid #353432; }
.usage-header h2 { font-size:28px; font-weight:500; margin:8px 0; letter-spacing:-.6px; }
.usage-header p { color:#93908d; margin:0; font-size:12px; }
.usage-close { padding:0 6px; border:0; background:transparent; color:#b4b1af; font:inherit; font-size:28px; cursor:pointer; }
.usage-body { padding:24px 32px; }
.usage-overview { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-bottom:32px; }
.usage-card { display:flex; flex-direction:column; gap:12px; border:1px solid #393734; border-radius:4px; padding:22px; background:#2d2b2a; }
.usage-card-label { color:#a9c4b5; font-size:12px; }
.usage-amount { font-size:clamp(22px,3vw,34px); letter-spacing:-.6px; font-weight:500; font-variant-numeric:tabular-nums; }
.usage-card-meta { color:#b4b1af; font-size:12px; }
.usage-section-head { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.usage-dialog h3 { font-size:15px; font-weight:500; margin:28px 0 14px; }
.usage-section-head h3 { margin:0; }
.usage-section-head label { display:flex; align-items:center; gap:8px; color:#b4b1af; font-size:12px; }
.usage-section-head select { font:inherit; background:#302e2d; color:#ece9e6; border:1px solid #454442; padding:7px 10px; border-radius:4px; }
.usage-scope,.usage-updated { color:#7f7c79; font-size:11px; }
.usage-table-scroll { overflow:auto; }
.usage-dialog table { width:100%; border-collapse:collapse; font-size:12px; font-variant-numeric:tabular-nums; }
.usage-dialog th { text-align:right; color:#93908d; font-size:10px; font-weight:400; white-space:nowrap; padding:14px 12px; border-bottom:1px solid #3b3a38; }
.usage-dialog td { text-align:right; padding:14px 12px; border-bottom:1px solid #2d2b2a; white-space:nowrap; }
.usage-dialog th:first-child,.usage-dialog td:first-child { text-align:left; padding-left:0; }
.usage-dialog th:last-child,.usage-dialog td:last-child { padding-right:0; }
.usage-name { max-width:260px; overflow:hidden; text-overflow:ellipsis; }
.usage-name small { display:block; color:#7f7c79; font-size:10px; padding-top:5px; }
.usage-cost { color:#c5ddd0; }
.usage-breakdown { display:grid; grid-template-columns:repeat(6,1fr); gap:12px; margin:0; padding:18px; background:#2b2a29; border-radius:10px; }
.usage-breakdown dt { font-size:10px; color:#93908d; margin-bottom:9px; }
.usage-breakdown dd { margin:0; font-variant-numeric:tabular-nums; }
.usage-note,.usage-method p { color:#93908d; font-size:11px; line-height:1.8; }
.usage-dialog details { margin-top:24px; border-top:1px solid #353432; padding-top:20px; }
.usage-dialog summary { cursor:pointer; font-size:12px; color:#d5d3d1; }
.usage-dialog summary span { color:#7f7c79; margin-left:8px; font-size:10px; }
.usage-method a { color:#b9dacb; }
.usage-test,.usage-missing,.usage-error { padding:12px 14px; color:#e2c492; border:1px solid #5b4c36; border-radius:4px; font-size:12px; line-height:1.6; }
.usage-test { margin:0 0 18px; }
.usage-empty { color:#93908d; text-align:center; padding:20px; }
.usage-updated { margin:24px 0 0; }
@media(max-width:760px) {
  .composer-actions .composer-hint { display:none; }
  .usage-dialog { width:calc(100vw - 20px); max-height:calc(100dvh - 20px); border-radius:4px; }
  .usage-header { padding:20px; }.usage-body { padding:20px; }
  .usage-overview { gap:10px; }.usage-card { padding:14px; }
  .usage-card-meta { font-size:10px; line-height:1.6; }
  .usage-breakdown { grid-template-columns:repeat(3,1fr); gap:20px 12px; }
  .usage-designs :is(th,td):nth-child(2),.usage-designs :is(th,td):nth-child(3),.usage-designs :is(th,td):nth-child(4) { display:none; }
  .usage-dialog .usage-designs :is(th,td) { font-size:11px; padding-left:6px; padding-right:6px; }
  .usage-dialog .usage-designs :is(th,td):first-child { padding-left:0; }
  .usage-dialog .usage-designs :is(th,td):last-child { padding-right:0; }
  .usage-designs .usage-name { max-width:clamp(95px,36vw,145px); }
}
