/* OsioPlan theme — deep slate surfaces with a mint accent */
:root {
  --bg: #0b1016; --surface: #111922; --surface2: #17212c; --surface3: #1e2a37; --surface4: #263445;
  --line: #22303f; --line2: #2c3c4e;
  --text: #e4ebf2; --muted: #8193a8; --dim: #5d7085;
  --accent: #5ef0c8; --accent-strong: #2fd0a8; --accent-ink: #052b22; --accent-soft: rgba(94,240,200,.12); --accent-line: rgba(94,240,200,.45);
  --sky: #4cc9f0; --violet: #c9a7ff; --amber: #ffd166; --red: #ff5d6c; --green: #7ee787;
  --yellow: var(--amber); --orange: #ffa45c; --accent2: var(--accent);
  --r: 8px; --r-lg: 12px;
  --icon-plus: #0b1016;
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; font-size: 13px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; user-select: none; }
button, select, input, textarea { font: inherit; color: inherit; }
button { background: var(--surface3); border: 1px solid var(--line2); border-radius: var(--r); padding: 6px 13px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background .12s, border-color .12s; }
button svg { width: 16px; height: 16px; flex-shrink: 0; }
button:hover { background: var(--surface4); }
button.primary, button.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.primary:hover { background: #7ff5d6; }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover { background: var(--surface3); color: var(--text); }
button:disabled { opacity: .4; cursor: default; }
select, input[type=number], input[type=text], input[type=search], textarea { background: var(--bg); border: 1px solid var(--line2); border-radius: 6px; padding: 5px 8px; outline: none; }
select:focus, input:focus, textarea:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=range] { accent-color: var(--accent); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent-strong); width: 15px; height: 15px; vertical-align: middle; }
input[type=color] { border: 1px solid var(--line2); border-radius: 6px; background: var(--bg); padding: 2px; height: 26px; }
a { color: var(--sky); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.spacer { flex: 1; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface4); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- App bar (shared by home, wizard, planner) ---------------- */
.appbar { height: 52px; display: flex; align-items: center; gap: 14px; padding: 0 12px 0 10px; background: var(--surface); border-bottom: 1px solid var(--line); flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: 9px; cursor: pointer; padding-right: 6px; }
.brand .logo { width: 30px; height: 30px; display: block; }
.brand .logo svg { width: 30px; height: 30px; display: block; }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: .2px; }
.menus { display: flex; align-items: center; gap: 1px; padding-left: 10px; border-left: 1px solid var(--line); height: 26px; }
.mb-item { padding: 4px 9px; cursor: default; border-radius: 6px; color: var(--muted); white-space: nowrap; }
.mb-item:hover, .mb-item.open { background: var(--surface3); color: var(--text); }
.case { min-width: 0; padding-left: 12px; border-left: 1px solid var(--line); }
.case-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.case-sub { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px; }
.flow { flex: 1; display: flex; align-items: center; justify-content: center; gap: 0; min-width: 0; }
.flow-step { background: transparent; border: 0; padding: 4px 8px; color: var(--muted); border-radius: 20px; font-size: 12.5px; cursor: default; }
.flow-step[data-cmd] { cursor: pointer; }
.flow-step[data-cmd]:hover { background: var(--surface3); color: var(--text); }
.flow-step i { width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-style: normal; font-size: 11px; font-weight: 700; background: var(--surface3); border: 1px solid var(--line2); }
.flow-step i svg { width: 12px; height: 12px; }
.flow-step.done i { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.flow-step.current { color: var(--text); background: var(--accent-soft); font-weight: 600; }
.flow-step.current i { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.flow-line { width: 18px; height: 1px; background: var(--line2); flex-shrink: 0; }
.flow { flex: 1 0 auto; } /* the steps never shrink: the patient name / path beside them ellipsises instead */
.case { flex: 0 1 auto; }
.flow-step { white-space: nowrap; flex-shrink: 0; }
/* the jaw switch needs room: on narrower screens only the current step keeps its name */
@media (max-width: 2000px) { .flow-step:not(.current) .fl { display: none; } .flow-line { width: 10px; } }
.appbar-right { display: flex; align-items: center; gap: 4px; }
.ab { width: 34px; height: 34px; padding: 0; background: transparent; border-color: transparent; color: var(--muted); }
.ab svg { width: 19px; height: 19px; }
.ab:hover { color: var(--text); }
.ab-sep { width: 1px; height: 22px; background: var(--line); margin: 0 6px; }
.jaw-seg { display: flex; height: 34px; padding: 3px; gap: 2px; background: var(--surface2); border-radius: 9px; margin-right: 8px; }
.jaw-seg button { height: 28px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-weight: 600; }
.jaw-seg button.on { background: var(--accent); color: #0b1016; }
.layout-btn { height: 34px; background: var(--surface2); color: var(--text); }
.layout-btn svg:first-child { width: 17px; height: 17px; color: var(--accent); }
.layout-btn svg:last-child { width: 14px; height: 14px; color: var(--muted); }
.save-btn { height: 34px; margin-left: 6px; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.save-btn:hover { background: #7ff5d6; }

/* ---------------- Workspace ---------------- */
.workspace { flex: 1; display: flex; min-height: 0; }
.rail { width: 60px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; padding: 6px 0 8px; gap: 4px; overflow-y: auto; overflow-x: hidden; }
.rail::-webkit-scrollbar { width: 0; }
.rail-group { display: flex; flex-direction: column; align-items: center; gap: 2px; padding-bottom: 6px; border-bottom: 1px solid var(--line); width: 100%; }
.rail-group:last-child { border-bottom: 0; }
.rail-label { font-size: 9.5px; text-transform: uppercase; letter-spacing: .8px; color: var(--dim); margin: 4px 0 2px; }
.tb { width: 40px; height: 36px; padding: 0; background: transparent; border: 1px solid transparent; border-radius: 9px; color: #b8c6d4; position: relative; }
.tb svg { width: 21px; height: 21px; }
.tb:hover { background: var(--surface3); color: var(--text); }
.tb.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.tb.drop::after { content: ''; position: absolute; right: 3px; bottom: 3px; border: 3px solid transparent; border-right-color: var(--muted); border-bottom-color: var(--muted); }
.tb-group { display: flex; flex-direction: column; gap: 2px; }
.tb-group.toggles .tb { color: var(--dim); }
.tb-group.toggles .tb.on { background: transparent; border-color: transparent; color: var(--sky); }
.tb-group.toggles .tb.on::before { content: ''; position: absolute; left: -10px; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--sky); }

#views { flex: 1; display: grid; gap: 6px; padding: 6px; background: var(--bg); min-width: 0; min-height: 0; position: relative; }
#views.maxed > .vp:not(.maxed), #views.maxed > .vp3d:not(.maxed), #views.maxed > .vp-group:not(.maxed) { display: none; }
.vp-group { display: grid; gap: 6px; min-width: 0; min-height: 0; }
.vp-group > .vp, .vp-group > .vp3d { min-height: 0; }
.vp, .vp3d { position: relative; display: flex; flex-direction: column; background: #05080b; min-width: 0; min-height: 0; overflow: hidden; border-radius: 10px; border: 1px solid var(--line); }
.vp.focus, .vp3d.focus { border-color: var(--accent-line); box-shadow: 0 0 0 1px var(--accent-soft); }
.vp-body { flex: 1; position: relative; min-width: 0; min-height: 0; }
/* a view whose slider has its own column on the right (Implant axis) */
.vp.has-vslider { display: grid; grid-template-columns: minmax(0,1fr) 34px; grid-template-rows: minmax(0,1fr) auto; }
.vp.has-vslider > .vp-strip { grid-column: 1 / -1; }
.vp-vslider { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0; background: var(--surface); border-left: 1px solid var(--line); min-height: 0; }
.vp-vslider .sb-nav { flex: 1; flex-direction: column-reverse; margin: 0; min-width: 0; min-height: 0; width: 100%; align-items: center; }
.vp-vslider .sb-slider { flex: 1; width: 100%; justify-content: center; min-height: 40px; }
.vp-vslider .sb-slider input { writing-mode: vertical-lr; direction: rtl; width: 18px; height: 100%; }
.vs-lbl { font-size: 10.5px; color: var(--muted); }
.vp-body canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
.vp3d .vp-body canvas { cursor: grab; }
/* per-view toolbar along the bottom */
.vp-strip { height: 30px; flex-shrink: 0; display: flex; align-items: center; gap: 2px; padding: 0 4px; background: var(--surface); border-top: 1px solid var(--line); }
.sb-top { display: flex; gap: 1px; }
.sb { width: 26px; height: 24px; padding: 0; background: transparent; border: 0; border-radius: 6px; color: var(--muted); }
.sb svg { width: 16px; height: 16px; }
.sb:hover { background: var(--surface3); color: var(--text); }
.sb.on { color: var(--accent); }
.sb.txt { width: auto; padding: 0 6px; font-size: 11px; font-weight: 700; letter-spacing: .3px; }
.sb.txt.on { background: var(--surface3); }
.sec-bar { grid-column: 1 / -1; border: 1px solid var(--line); border-radius: 8px; }
.vp-group.sections > .vp > .vp-strip { display: none; }
.sec-vbar { grid-column: -2 / -1; grid-row: 1 / -2; width: 30px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px 0; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.sec-vbar input { flex: 1; width: 18px; min-height: 40px; margin: 0; writing-mode: vertical-lr; direction: rtl; }
.sb-nav { flex: 1; display: flex; align-items: center; gap: 2px; min-width: 40px; margin-left: 4px; }
.sb-slider { flex: 1; display: flex; align-items: center; min-width: 20px; }
.sb-slider input { width: 100%; margin: 0; height: 14px; }
.sb-fill { flex: 1; }
.vp3d-foot { position: absolute; left: 8px; right: 8px; bottom: 8px; height: 34px; display: flex; align-items: center; gap: 6px; padding: 0 6px; background: rgba(17,25,34,.88); border: 1px solid var(--line); border-radius: 9px; }
.vp3d-foot select { height: 24px; padding: 0 6px; font-size: 12px; }
.vp3d-foot input[type=range] { flex: 1; }
.orient { position: absolute; right: 8px; top: 8px; display: flex; gap: 2px; padding: 3px; background: rgba(17,25,34,.88); border: 1px solid var(--line); border-radius: 9px; }
.orient button { padding: 3px 8px; font-size: 11.5px; background: transparent; border: 0; border-radius: 6px; color: var(--muted); }
.orient button:hover { background: var(--surface3); color: var(--text); }
.vp3d-title { position: absolute; left: 8px; top: 8px; color: var(--text); font-size: 12px; font-weight: 600; pointer-events: none; padding: 5px 10px; background: rgba(11,16,22,.78); border-radius: 20px; }
.maxed { position: absolute !important; inset: 6px !important; z-index: 30; }

/* ---------------- Inspector (right) ---------------- */
.inspector { width: 400px; flex-shrink: 0; display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--line); min-height: 0; }
.insp-tabs { display: flex; gap: 2px; padding: 6px 6px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.vtab { width: 36px; height: 34px; display: flex; align-items: center; justify-content: center; color: var(--muted); cursor: pointer; border-radius: 8px 8px 0 0; position: relative; }
.vtab svg { width: 19px; height: 19px; }
.vtab:hover { background: var(--surface2); color: var(--text); }
.vtab.active { background: var(--surface2); color: var(--accent); }
.vtab.active::after { content: ''; position: absolute; left: 6px; right: 6px; bottom: 0; height: 2px; border-radius: 2px; background: var(--accent); }
.inspector.collapsed { width: 50px; }
.inspector.collapsed .insp-tabs { flex-direction: column; border-bottom: 0; padding: 6px; }
.inspector.collapsed .vtab { width: 36px; border-radius: 8px; }
.inspector.collapsed .vtab.active::after { display: none; }
.dock-panel { flex: 1; display: flex; flex-direction: column; min-height: 0; background: var(--surface2); }
.dp-head { height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 8px 0 14px; font-weight: 650; font-size: 14px; border-bottom: 1px solid var(--line); }
.dp-head button { margin-left: 0; background: transparent; border: 0; font-size: 18px; padding: 2px 8px; color: var(--muted); }
.mode-chip { margin-left: auto; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--accent); background: var(--accent-soft); padding: 3px 8px; border-radius: 20px; }
.dp-body { flex: 1; overflow-y: auto; padding: 12px 14px 16px; }

/* panel content */
.sec { margin: 0 0 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.sec-h { padding: 9px 12px; font-weight: 600; font-size: 12px; display: flex; align-items: center; gap: 6px; cursor: default; color: #c4d0dc; text-transform: uppercase; letter-spacing: .5px; }
.sec-h.collapsible { cursor: pointer; }
.sec-h.collapsible::after { content: ''; margin-left: auto; width: 6px; height: 6px; border-right: 1.6px solid var(--muted); border-bottom: 1.6px solid var(--muted); transform: rotate(45deg); }
.sec.closed .sec-h.collapsible::after { transform: rotate(-45deg); }
.sec.closed .sec-b { display: none; }
.sec-b { padding: 4px 12px 12px; }
.pbtn { display: flex; width: 100%; margin: 0 0 8px; padding: 7px; background: var(--surface3); border: 1px solid var(--line2); }
.pbtn.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.pbtn-row { display: flex; gap: 8px; }
.pbtn-row .pbtn { flex: 1; }
.prow { display: flex; align-items: center; gap: 8px; margin: 7px 0; }
.prow > label:first-child { width: 150px; flex-shrink: 0; color: #c4d0dc; }
.prow input[type=range] { flex: 1; }
.prow input[type=number] { width: 90px; }
.prow .unit { color: var(--muted); font-size: 12px; }
.chk-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.chk-row label { flex: 1; }
.chk-row input[type=number] { width: 90px; }
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
table.grid th { background: var(--surface3); font-weight: 600; font-size: 11.5px; color: #b8c6d4; padding: 8px 6px; text-align: center; }
table.grid td { padding: 7px 6px; border-top: 1px solid var(--line); }
table.grid tr.sel td { background: var(--accent-soft); color: var(--text); box-shadow: inset 0 1px 0 var(--accent-line), inset 0 -1px 0 var(--accent-line); }
table.grid tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--accent), inset 0 1px 0 var(--accent-line), inset 0 -1px 0 var(--accent-line); }
table.grid tr.click { cursor: pointer; }
table.grid tr.click:hover td { background: var(--surface3); }
table.grid tr.sel.click:hover td { background: rgba(94,240,200,.18); }
table.grid td.c { text-align: center; }
table.grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid input[type=text], table.grid input[type=number] { background: var(--bg); }
.swatch { display: inline-block; width: 22px; height: 14px; border-radius: 4px; vertical-align: middle; }
.result-box { background: var(--bg); border: 1px solid var(--line); padding: 10px 12px; border-radius: 10px; min-height: 60px; font-size: 12.5px; line-height: 1.55; }
.result-box .bad { color: #ff8a95; }
.result-box .warn { color: var(--amber); }
.result-box .good { color: var(--green); }
.instr { color: var(--muted); text-align: center; margin: 10px 0; }
.shots { display: flex; flex-direction: column; gap: 6px; max-height: 420px; overflow-y: auto; background: var(--bg); padding: 6px; border-radius: 10px; }
.shot { position: relative; background: #000; display: flex; justify-content: center; cursor: pointer; border: 2px solid transparent; border-radius: 8px; overflow: hidden; }
.shot.sel { border-color: var(--accent); }
.shot img { max-width: 100%; max-height: 150px; display: block; }
.shot button { position: absolute; top: 4px; right: 4px; padding: 0 6px; font-size: 11px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 5px 14px; font-size: 12.5px; }
.kv > span:nth-child(odd) { color: var(--muted); }
textarea { width: 100%; min-height: 80px; resize: vertical; }
.note-item { background: var(--surface); padding: 8px 10px; margin-bottom: 8px; border-radius: 10px; border: 1px solid var(--line); border-left: 3px solid var(--violet); }
.note-item .meta { color: var(--muted); font-size: 11px; display: flex; gap: 10px; }

/* ---------------- Status bar ---------------- */
.statusbar { height: 26px; display: flex; align-items: center; gap: 16px; padding: 0 12px; background: var(--surface); border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; flex-shrink: 0; }
.dot-live { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 6px var(--accent); margin-right: -8px; }
.statusbar #density { min-width: 120px; text-align: right; color: var(--sky); font-variant-numeric: tabular-nums; }
.statusbar #pos { font-variant-numeric: tabular-nums; }

/* ---------------- Dropdown menu ---------------- */
.dropmenu { position: fixed; z-index: 1000; background: var(--surface2); border: 1px solid var(--line2); border-radius: 10px; box-shadow: 0 14px 40px rgba(0,0,0,.55); padding: 5px; min-width: 240px; }
.dm-row { display: flex; align-items: center; height: 30px; padding: 0 10px 0 2px; cursor: default; border-radius: 6px; }
.dm-row:hover { background: var(--surface4); }
.dm-row.disabled { opacity: .4; }
.dm-row.disabled:hover { background: transparent; }
.dm-check { width: 20px; text-align: center; color: var(--accent); font-weight: 700; }
.dm-icon { width: 24px; display: flex; align-items: center; color: var(--muted); }
.dm-icon svg { width: 17px; height: 17px; }
.dm-label { flex: 1; padding-right: 30px; }
.dm-key { color: var(--dim); font-size: 11.5px; }
.dm-sep { height: 1px; background: var(--line2); margin: 4px 6px; }

/* ---------------- Dialogs ---------------- */
.dlg-overlay { position: fixed; inset: 0; z-index: 500; background: rgba(4,7,10,.6); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; }
.dlg { background: var(--surface2); border: 1px solid var(--line2); border-radius: 14px; box-shadow: 0 24px 70px rgba(0,0,0,.6); display: flex; flex-direction: column; max-height: 94vh; max-width: 96vw; overflow: hidden; }
.dlg-title { height: 48px; display: flex; align-items: center; gap: 10px; padding: 0 0 0 18px; flex-shrink: 0; font-weight: 650; font-size: 15px; border-bottom: 1px solid var(--line); }
.dlg-logo { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.dlg-x { margin-left: auto; background: transparent; border: 0; color: var(--muted); width: 44px; height: 44px; font-size: 14px; border-radius: 0; }
.dlg-x:hover { background: var(--surface3); color: var(--text); }
.dlg-body { flex: 1; overflow: auto; padding: 16px 18px; min-height: 0; }
.dlg-buttons { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; flex-shrink: 0; border-top: 1px solid var(--line); background: var(--surface); }
.dlg-buttons button { min-width: 90px; }
.msg { line-height: 1.6; }
.dtabs { display: inline-flex; gap: 2px; margin-bottom: 12px; padding: 3px; background: var(--bg); border-radius: 10px; border: 1px solid var(--line); }
.dtabs button { background: transparent; border: 0; padding: 6px 14px; border-radius: 7px; color: var(--muted); }
.dtabs button.active { background: var(--surface4); color: var(--text); font-weight: 600; }
.dsec { background: var(--surface); margin-bottom: 12px; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.dsec-h { padding: 9px 12px; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: #c4d0dc; }
.dsec-b { padding: 4px 12px 12px; }
.listbox { background: var(--bg); overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.listbox .lb-row { padding: 8px 10px; cursor: pointer; border-radius: 7px; }
.listbox .lb-row:hover { background: var(--surface3); }
.listbox .lb-row.sel { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.radio-col label { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.preview-box { background: #0d131a; position: relative; border-radius: 10px; overflow: hidden; }
.preview-box canvas { width: 100%; height: 100%; display: block; }
.pinfo { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; }
.pinfo-img { background: #000; border-radius: 10px; overflow: hidden; min-height: 300px; display: flex; align-items: center; justify-content: center; }
.pinfo-img img { width: 100%; height: 100%; object-fit: contain; }
.pinfo-table { display: grid; grid-template-columns: 110px 1fr; gap: 9px 12px; font-size: 13px; }
.pinfo-table span:nth-child(odd) { color: var(--muted); }
.open-project-btn { width: 100%; margin-top: 18px; height: 42px; font-size: 14px; }

/* ---------------- Busy / toast ---------------- */
.busy-ov { position: fixed; inset: 0; z-index: 900; background: rgba(4,7,10,.55); display: flex; align-items: center; justify-content: center; }
.busy { width: 380px; background: var(--surface2); border: 1px solid var(--line2); border-radius: 14px; padding: 24px; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.5); }
.spinner { width: 30px; height: 30px; border: 3px solid var(--surface4); border-top-color: var(--accent); border-radius: 50%; margin: 0 auto 12px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.bar { height: 6px; background: var(--bg); margin-top: 14px; border-radius: 6px; overflow: hidden; }
.bar div { height: 100%; width: 0; background: var(--accent); transition: width .15s; border-radius: 6px; }
.toast { position: fixed; left: 50%; bottom: 44px; transform: translate(-50%, 20px); opacity: 0; z-index: 950; background: var(--surface3); border: 1px solid var(--line2); border-radius: 22px; padding: 9px 18px; transition: all .25s; pointer-events: none; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- Home screen ---------------- */
#home { background: radial-gradient(1200px 600px at 10% -10%, rgba(94,240,200,.07), transparent 60%), var(--bg); }
.home-main { flex: 1; display: grid; grid-template-columns: minmax(360px, 440px) 1fr; gap: 28px; padding: 28px 32px 24px; min-height: 0; }
.home-main h1 { font-size: 13px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); font-weight: 600; margin: 0 0 14px; }
.home-start { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.start-card { display: flex; align-items: center; gap: 16px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; cursor: pointer; transition: border-color .15s, transform .15s, background .15s; }
.start-card:hover { border-color: var(--accent-line); background: var(--surface2); transform: translateY(-1px); }
.start-card .art { width: 124px; height: 86px; flex-shrink: 0; background: var(--bg); border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.start-card .art svg { width: 116px; height: 80px; }
.start-card b { display: block; font-size: 16px; margin-bottom: 4px; }
.start-card span { color: var(--muted); line-height: 1.45; font-size: 12.5px; }
.start-card > svg:last-child { width: 18px; height: 18px; color: var(--dim); flex-shrink: 0; margin-left: auto; }
.start-card.primary { background: linear-gradient(135deg, rgba(94,240,200,.12), rgba(94,240,200,.03)); border-color: var(--accent-line); }
.start-card.primary b { color: var(--accent); }
.start-card.small > svg:first-child { width: 28px; height: 28px; color: var(--sky); margin: 0 8px; flex-shrink: 0; }
.home-note { color: var(--dim); font-size: 12px; margin-top: auto; line-height: 1.5; }
.home-recent { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px 18px 8px; }
.recent-head { display: flex; align-items: center; gap: 12px; }
.recent-head h1 { margin: 0 !important; }
.search { margin-left: auto; display: flex; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--line2); border-radius: 20px; padding: 0 12px; height: 34px; width: 300px; }
.search svg { width: 16px; height: 16px; color: var(--muted); }
.search input { border: 0; background: transparent; flex: 1; padding: 0; box-shadow: none !important; }
.recents { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; align-content: start; padding: 16px 2px 10px; }
.rcard { background: var(--surface2); border: 1px solid var(--line); border-radius: 12px; padding: 8px; cursor: pointer; transition: border-color .15s, background .15s; min-width: 0; }
.rcard:hover { border-color: var(--accent-line); background: var(--surface3); }
.rcard .thumb { position: relative; height: 112px; background: #000; border-radius: 8px; overflow: hidden; display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.rcard .thumb img { width: 100%; height: 100%; object-fit: cover; }
.rcard .thumb > svg { width: 40px; height: 40px; color: var(--dim); }
.rcard .jaw { position: absolute; left: 6px; bottom: 6px; font-size: 10.5px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: rgba(11,16,22,.8); color: var(--accent); }
.rcard .rt { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }
.rcard .rd { color: var(--muted); font-size: 11.5px; margin-top: 2px; padding: 0 2px; }
.rcard .rp { color: var(--dim); font-size: 11px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }
.rcard.missing { opacity: .45; }
.recent-empty { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 60px 0; color: var(--muted); }
.recent-empty svg { width: 46px; height: 46px; color: var(--dim); }
.recent-empty b { color: var(--text); font-size: 15px; }

/* ---------------- Wizard ---------------- */
.wz-main { flex: 1; display: flex; min-height: 0; }
.wz-steps { width: 280px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--line); padding: 22px 16px 16px; display: flex; flex-direction: column; gap: 6px; }
.wz-st { display: flex; gap: 12px; padding: 10px 10px; border-radius: 12px; position: relative; color: var(--muted); }
.wz-st i { width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-style: normal; font-weight: 700; background: var(--surface3); border: 1px solid var(--line2); }
.wz-st i svg { width: 15px; height: 15px; }
.wz-st b { display: block; color: inherit; font-size: 14px; margin: 3px 0 2px; }
.wz-st span { font-size: 12px; line-height: 1.4; color: var(--dim); }
.wz-st.done { color: var(--text); }
.wz-st.done i { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.wz-st.cur { background: var(--surface2); color: var(--text); border: 1px solid var(--line2); }
.wz-st.cur i { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.wz-st.cur span { color: var(--muted); }
.wz-actions { display: flex; gap: 8px; }
.wz-actions button { flex: 1; height: 40px; }
.wz-actions button svg { width: 15px; height: 15px; }
.wz-body { flex: 1; display: flex; min-height: 0; min-width: 0; }
.wz-left { width: 440px; padding: 22px 20px; display: flex; flex-direction: column; gap: 12px; border-right: 1px solid var(--line); overflow-y: auto; }
.wz-right { flex: 1; background: #05080b; position: relative; margin: 14px; border-radius: 12px; border: 1px solid var(--line); overflow: hidden; }
.wz-right canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.wz-right.split { background: transparent; border: 0; display: flex; flex-direction: column; gap: 10px; border-radius: 0; overflow: visible; }
.wz-right .frame { position: relative; background: #05080b; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.drop-card { display: flex; align-items: center; gap: 14px; padding: 16px; border: 1.5px dashed var(--line2); border-radius: 14px; cursor: pointer; background: var(--surface); transition: border-color .15s, background .15s; }
.drop-card:hover { border-color: var(--accent-line); background: var(--surface2); }
.drop-card > svg { width: 34px; height: 34px; color: var(--sky); flex-shrink: 0; }
.drop-card b { display: block; font-size: 14.5px; margin-bottom: 3px; }
.drop-card span { color: var(--muted); font-size: 12px; }
.drop-card em { margin-left: auto; font-style: normal; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 12px; background: var(--surface3); color: var(--muted); white-space: nowrap; }
.drop-card em.req { background: rgba(255,93,108,.14); color: #ff8a95; }
.drop-card em.ok { background: var(--accent-soft); color: var(--accent); padding: 4px; display: flex; }
.drop-card em.ok svg { width: 14px; height: 14px; }
.drop-card.done { border-style: solid; border-color: var(--accent-line); }
.info-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.align-grid { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 12px; flex: 1; min-height: 0; padding: 14px; }
.align-view { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; min-height: 0; overflow: hidden; }
.align-view .h { padding: 9px 12px; font-weight: 600; display: flex; gap: 10px; align-items: baseline; }
.align-view .h .muted { font-weight: 400; font-size: 12px; }
.align-view .c { flex: 1; position: relative; margin: 0 8px 8px; background: #05080b; border-radius: 8px; overflow: hidden; min-height: 0; }
.align-view canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; }
.align-opts { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
.align-opts .h { padding: 10px 12px 4px; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: #c4d0dc; }
.align-opts .b { padding: 4px 12px 10px; }
.align-opts .prow > label:first-child { width: 90px; }
.voi-grid { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 6px 8px; align-items: center; }
.voi-grid input { width: 100%; }
.curve-tools { display: flex; flex-direction: column; gap: 8px; }
table.grid input[type=number] { width: 62px; }
.wz-actions button[data-back] { flex: 0 0 auto; } .wz-actions button { white-space: nowrap; }

.sb-select { height: 24px; padding: 0 4px; font-size: 11.5px; border-radius: 6px; background: var(--surface2); margin-left: 2px; }
.vp-strip .sb-select + .sb-fill { flex: 1; }
.sb-lbl { font-size: 11px; color: var(--muted); margin: 0 2px 0 6px; }
.vp-strip { flex-wrap: wrap; height: auto; min-height: 30px; padding: 2px 4px; }
.vp-strip .sb-nav { min-width: 90px; }

/* 3D colour panel */
.c3d-pop { position: absolute; right: 10px; top: 44px; z-index: 5; width: 250px; padding: 10px 12px; background: rgba(13,19,26,.94); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.c3d-h { font-weight: 700; font-size: 12.5px; margin-bottom: 6px; }
.c3d-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 12.5px; }
.c3d-row input[type=color] { width: 30px; height: 22px; padding: 0; border: 0; background: none; }
.c3d-row span { flex: 1; }
.c3d-note { color: var(--muted); font-size: 11px; margin-top: 6px; }
