/* BizatiKey: Studio Dark (default) and Bizati Cream. Self-hosted fonts only. */
:root, [data-theme="dark"] {
  --bg: #121110; --surface: #1c1a18; --raised: #24211e; --cap: #2b2825; --cap-top: #34302c;
  --text: #f3eee5; --accent: #ff3b00; --on-accent: #121110;
  color-scheme: dark;
}
[data-theme="cream"] {
  --bg: #f3eee4; --surface: #fffcf6; --raised: #f8f3ea; --cap: #ece5d8; --cap-top: #fbf7ef;
  --text: #151413; --accent: #c93200; --on-accent: #fffcf6;
  color-scheme: light;
}
:root {
  --muted: color-mix(in srgb, var(--text) 64%, var(--bg));
  --line: color-mix(in srgb, var(--text) 15%, transparent);
  --line-strong: color-mix(in srgb, var(--text) 32%, transparent);
  --wash: color-mix(in srgb, var(--text) 5%, transparent);
  --accent-wash: color-mix(in srgb, var(--accent) 14%, transparent);
  --display: "Space Grotesk", "IBM Plex Sans", system-ui, Arial, sans-serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --radius: 8px;
  --gutter: clamp(14px, 3vw, 36px);
  --pad-w: min(420px, 100vw);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; overflow-x: clip; }
body {
  background: var(--bg); color: var(--text); font: 400 0.92rem/1.5 var(--sans);
  -webkit-font-smoothing: antialiased; min-height: 100dvh; display: flex; flex-direction: column;
}
.num, input[type="number"], .ms, .badge, .ev-t { font-variant-numeric: tabular-nums; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -0.01em; margin: 0; }
p { margin: 0; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; padding: 0; margin: -1px; border: 0; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--on-accent); padding: 8px 12px; border-radius: 6px; z-index: 60; font-weight: 600; }
.skip:focus { left: 8px; }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ico.lg { width: 26px; height: 26px; }
.fine { color: var(--muted); font-size: 0.8rem; }
.lbl { display: block; font: 600 0.7rem/1.3 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
.eyebrow { font: 600 0.72rem/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 7px 12px;
  border: 1px solid var(--line-strong); border-radius: 6px; background: var(--raised); cursor: pointer;
  font-weight: 500; font-size: 0.85rem; line-height: 1.1; white-space: nowrap; text-decoration: none;
}
.btn:hover:not(:disabled) { border-color: var(--text); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.accent:hover:not(:disabled) { filter: brightness(1.08); border-color: var(--accent); }
.btn.rec-on { background: transparent; border-color: var(--accent); color: var(--accent); font-weight: 600; }
.btn.small { min-height: 30px; padding: 4px 9px; font-size: 0.78rem; }
.btn.icon-only { padding: 7px; justify-content: center; min-width: 36px; }
.btn.small.icon-only { min-width: 30px; padding: 5px; }
.btn.small .ico { width: 16px; height: 16px; }
.btn:disabled { opacity: 0.42; cursor: not-allowed; }
#themeToggle[aria-pressed="true"] { border-color: var(--line); color: inherit; background: transparent; }
.btn[aria-pressed="true"]:not(#themeToggle) { border-color: var(--accent); color: var(--accent); background: var(--accent-wash); }
.btn.capture { width: 100%; justify-content: center; border-style: dashed; margin: 4px 0 10px; white-space: normal; text-align: center; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
select, input[type="text"], input[type="number"], textarea {
  width: 100%; min-height: 36px; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--surface); max-width: 100%;
}
textarea { resize: vertical; font-family: var(--mono); font-size: 0.85rem; line-height: 1.45; }
select { cursor: pointer; }
.field { display: grid; gap: 4px; margin-bottom: 12px; min-width: 0; }
.field .lbl { margin-bottom: 0; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.ms-wrap { display: inline-flex; align-items: center; gap: 6px; }
.ms-wrap input { width: 110px; }
.unit { color: var(--muted); font: 500 0.75rem var(--mono); }
.mods { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 8px 16px; }
.mods legend { padding: 0 4px; margin: 0; }
.check, .radio { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.85rem; }
.check input, .radio input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.radios { display: grid; gap: 6px; margin-bottom: 14px; }
.radio { padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; }
.radio:has(input:checked) { border-color: var(--accent); background: var(--accent-wash); }
.radio:has(input:disabled) { opacity: 0.5; cursor: not-allowed; }
.readout { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.readout div { border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; min-width: 0; }
.readout dt { font: 600 0.66rem/1.2 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.readout dd { margin: 2px 0 0; font: 600 1rem/1.2 var(--mono); overflow-wrap: anywhere; }
.badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 34px; padding: 3px 7px;
  border: 1px solid var(--line-strong); border-radius: 4px; font: 600 0.72rem/1.2 var(--mono); background: var(--cap); white-space: nowrap;
}
.badge.muted { color: var(--muted); border-style: dashed; background: transparent; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--dot, var(--muted)); flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--dot, var(--muted)) 24%, transparent); }

/* ---------- top bar ---------- */
.topbar {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px 18px; align-items: center;
  padding: 12px var(--gutter); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 30px; height: 30px; fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; }
.brand-name { font: 700 1.3rem/1 var(--display); letter-spacing: -0.02em; }
.brand-ver { font: 500 0.72rem/1 var(--mono); color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 3px 5px; }
.profile-bar { display: flex; gap: 8px; align-items: center; min-width: 0; }
.profile-bar .field-inline { flex: 1 1 auto; min-width: 0; max-width: 320px; }
.top-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.agent-bar { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; justify-content: flex-end; min-width: 0; }
.agent-status { display: block; width: 220px; max-width: 100%; height: 34px; }
#armBtn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.tray-bar { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; justify-content: flex-end; min-width: 0; }
.tray-pill { font: 600 0.72rem/1 var(--mono); letter-spacing: 0.04em; color: var(--accent); border: 1px solid var(--accent); border-radius: 999px; padding: 6px 10px; background: var(--accent-wash); white-space: nowrap; }
.btn.quit:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.tray-note { flex-basis: 100%; text-align: right; margin: 0; }
.sample-row { flex-wrap: nowrap; }
.sample-row select { flex: 1 1 auto; min-width: 0; }
.profile-menu {
  position: sticky; top: 61px; z-index: 29; margin: 0 var(--gutter); padding: 16px; display: grid; gap: 12px;
  border: 1px solid var(--line-strong); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); background: var(--surface); max-width: 560px;
  box-shadow: 0 18px 40px rgb(0 0 0 / 0.28);
}
.pm-row { display: grid; gap: 6px; }
.pm-row label { font: 600 0.7rem var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.pm-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.scope {
  display: flex; gap: 10px; align-items: flex-start; margin: 14px var(--gutter) 0; padding: 10px 14px;
  border-left: 2px solid var(--accent); background: var(--wash); font-size: 0.84rem; color: var(--muted);
}
.scope strong { color: var(--text); }
.scope .ico { color: var(--accent); margin-top: 1px; }
.banner {
  display: flex; gap: 10px; align-items: center; margin: 12px var(--gutter) 0; padding: 8px 8px 8px 14px;
  border: 1px solid color-mix(in srgb, #ffd600 55%, var(--line)); border-radius: var(--radius); background: color-mix(in srgb, #ffd600 9%, var(--surface));
  font-size: 0.86rem;
}
.banner > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.banner > .ico { color: color-mix(in srgb, #ffd600 70%, var(--text)); }

main { flex: 1; padding: 18px var(--gutter) 28px; display: grid; gap: 22px; min-width: 0; }

/* ---------- keyboard stage ---------- */
.stage { min-width: 0; outline: none; }
.stage-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.stage-head h1 { font-size: clamp(1.6rem, 3.2vw, 2.6rem); line-height: 1.02; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 7px; padding: 3px; gap: 3px; }
.seg-btn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 6px 12px; border-radius: 5px; cursor: pointer; font-size: 0.84rem; font-weight: 500; }
.seg-btn[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.seg-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.stage-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
@media (min-width: 1100px) { .stage-body { grid-template-columns: minmax(0, 1fr) 290px; } }
.board-wrap { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 12px; }
.board-scroll { overflow-x: auto; overscroll-behavior-x: contain; border-radius: 6px; }
.board { display: block; width: 100%; height: auto; max-height: 64vh; user-select: none; -webkit-user-select: none; }
.board[data-wide="1"] { min-width: 680px; }
.board[data-wide="0"][data-mode="vector"] { max-width: 420px; margin: 0 auto; }
.board-hint { margin-top: 10px; font-size: 0.78rem; color: var(--muted); }

.board .deck { fill: var(--bg); stroke: var(--line); }
.board text { fill: var(--text); font-family: var(--mono); pointer-events: none; }
.board .key { cursor: pointer; outline: none; }
.board .cap { fill: var(--cap); stroke: color-mix(in srgb, var(--text) 18%, transparent); stroke-width: 1; transition: fill 0.12s; }
.board .key:hover .cap { fill: var(--cap-top); stroke: var(--line-strong); }
.board .gkey .cap { fill: color-mix(in srgb, var(--cap) 80%, var(--accent) 6%); }
.board .mkey .cap { fill: color-mix(in srgb, var(--cap) 90%, var(--bg)); }
.board .glow { stroke-width: 1.5; filter: drop-shadow(0 0 4px currentColor); }
.board .key.selected .cap { stroke: var(--accent); stroke-width: 2; }
.board .key:focus-visible .cap, .board .key:focus-visible .hb-shape { stroke: var(--accent); stroke-width: 3; }
.board .cap-legend { font-size: 9.5px; font-weight: 500; fill: color-mix(in srgb, var(--text) 84%, transparent); }
.board .cap-label { font-family: var(--display); font-size: 9.5px; font-weight: 700; }
.board .legend-sm { font-size: 6.5px; fill: var(--muted); }
.board .cap-sum { font-size: 6.5px; fill: var(--muted); }
.board .key.dim { opacity: 0.32; }
.board.cheat .key.assigned .glow { fill-opacity: 0.5; }
.board .photo { pointer-events: none; }
.board .hb-shape { stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.board .key.hb:not(.assigned) .hb-shape { fill: rgb(255 59 0 / 0.04); stroke: rgb(255 59 0 / 0.55); stroke-width: 1.25; }
.board .key.hb:hover .hb-shape { fill-opacity: 0.5; }
.board .key.hb:not(.assigned):hover .hb-shape { fill: rgb(255 59 0 / 0.18); }
.board .key.hb.selected .hb-shape { stroke: var(--accent); stroke-width: 2.5; }
.board .hb-label { font-family: var(--display); font-weight: 700; fill: #ffffff; paint-order: stroke; stroke: rgb(0 0 0 / 0.7); stroke-width: 3px; }
.board .frame { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 6 4; vector-effect: non-scaling-stroke; }
.board .preview { fill: color-mix(in srgb, var(--accent) 12%, transparent); stroke: color-mix(in srgb, var(--accent) 70%, transparent); stroke-width: 1; vector-effect: non-scaling-stroke; pointer-events: none; }
.board .handle { fill: var(--accent); stroke: #ffffff; stroke-width: 2; vector-effect: non-scaling-stroke; cursor: grab; outline: none; touch-action: none; }
.board .handle.dragging { cursor: grabbing; }
.board .handle:focus-visible { stroke: var(--text); stroke-width: 4; }
.board .handle.row { fill: var(--surface); stroke: var(--accent); stroke-width: 2.5; cursor: ns-resize; }
.board .frame.pending { stroke-dasharray: 4 3; fill: color-mix(in srgb, var(--accent) 18%, transparent); }
.board[data-mode="photo"] { cursor: default; }

.legend { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.legend-title { font-size: 1rem; margin-bottom: 8px; }
.legend-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 18px; }
.legend-list li { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; min-width: 0; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.legend-list .swatch { width: 12px; height: 12px; flex: none; }
.legend-list .swatch rect { fill-opacity: 0.45; }
.legend-list strong { font-weight: 600; white-space: nowrap; }
.legend-sum { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.rail { display: grid; gap: 0; align-content: start; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); min-width: 0; }
@media (min-width: 700px) and (max-width: 1099px) { .rail { grid-template-columns: 1fr 1fr; } }
.rail-group { padding: 14px; border-bottom: 1px solid var(--line); min-width: 0; }
.rail-group:last-child { border-bottom: 0; }
.rail-group .btn-row + .readout, .rail-group .readout + .btn-row { margin-top: 10px; }
.tool-panel { margin-top: 12px; padding: 12px; border: 1px dashed var(--line-strong); border-radius: 6px; display: grid; gap: 8px; }
.sel-code { font: 700 1.1rem/1.2 var(--mono); margin-bottom: 4px; overflow-wrap: anywhere; }

/* ---------- workbench ---------- */
.bench { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; min-width: 0; }
@media (min-width: 760px) { .bench { grid-template-columns: repeat(2, minmax(0, 1fr)); } .panel.wide { grid-column: 1 / -1; } }
@media (min-width: 1100px) { .bench { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1500px) { .bench { grid-template-columns: 1fr 1fr 0.85fr 1.5fr; } .panel.wide { grid-column: auto; } }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 16px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 1.05rem; display: flex; align-items: center; gap: 10px; }
.pn { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--accent); color: var(--accent); font: 600 0.75rem/1 var(--mono); }
.btn.plus { min-height: 38px; padding: 8px 14px; }

.asg-list, .lib-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 380px; overflow-y: auto; }
.asg-list li, .lib-list li { min-width: 0; }
.asg {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; padding: 9px 10px;
  border: 1px solid var(--line); border-radius: 6px; background: transparent; cursor: pointer;
}
.asg:hover { border-color: var(--line-strong); background: var(--wash); }
.asg.on { border-color: var(--accent); background: var(--accent-wash); }
.asg .ico { color: var(--muted); }
.asg-main { flex: 1; min-width: 0; display: grid; }
.asg-label { font-weight: 600; font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asg-sum { font-size: 0.75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { padding: 14px; border: 1px dashed var(--line); border-radius: 6px; text-align: center; }
.lib { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 8px; }
.lib-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.lib-head h3 { font-size: 0.95rem; }
.lib-item { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 6px; }
.lib-item .ico { color: var(--muted); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { border: 0; background: transparent; padding: 8px 12px; cursor: pointer; font-weight: 500; font-size: 0.85rem; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tab:hover { color: var(--text); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.tile {
  display: grid; gap: 6px; justify-items: start; text-align: left; padding: 12px; min-height: 104px;
  border: 1px solid var(--line); border-radius: 7px; background: var(--raised); cursor: pointer;
}
.tile:hover:not(:disabled) { border-color: var(--line-strong); }
.tile.on { border-color: var(--accent); background: var(--accent-wash); }
.tile.on .ico { color: var(--accent); }
.tile:disabled { opacity: 0.45; cursor: not-allowed; }
.tile-name { font: 600 0.9rem/1.2 var(--display); }
.tile-hint { font-size: 0.72rem; line-height: 1.35; color: var(--muted); }
.payload { border-top: 1px solid var(--line); padding-top: 12px; min-width: 0; }
.payload-title { display: flex; align-items: center; gap: 8px; font: 600 0.95rem var(--display); margin-bottom: 10px; }

.bindbox {
  display: grid; place-items: center; gap: 10px; min-height: 150px; padding: 18px; width: 100%;
  border: 2px dashed var(--line-strong); border-radius: 10px; background: var(--raised); cursor: pointer; text-align: center;
}
.bindbox:hover:not(:disabled) { border-color: var(--text); }
.bindbox.listening { border-color: var(--accent); background: var(--accent-wash); animation: pulse 1.4s ease-in-out infinite; }
.bindbox:disabled { opacity: 0.55; cursor: not-allowed; }
.bind-badge { font: 700 1.5rem/1 var(--mono); padding: 12px 18px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--cap); min-width: 72px; }
.bind-badge.muted { color: var(--muted); font-size: 1rem; border-style: dashed; background: transparent; }
.bind-text { font-size: 0.84rem; color: var(--muted); max-width: 30ch; }
@keyframes pulse { 50% { border-color: color-mix(in srgb, var(--accent) 40%, transparent); } }
.conflict { padding: 12px; border: 1px solid var(--accent); border-radius: 7px; background: var(--accent-wash); display: grid; gap: 10px; font-size: 0.85rem; }
.summary { overflow-wrap: anywhere; }

.pane { padding-top: 12px; min-width: 0; }
.rec-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.ins-mouse { display: inline-flex; gap: 6px; align-items: center; }
.ins-mouse select { width: auto; }
.rec-status { margin-bottom: 10px; }
body.recording #recBtn { animation: pulse 1.4s ease-in-out infinite; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 420px; overflow-y: auto; }
.step {
  display: grid; grid-template-columns: 16px 28px minmax(84px, auto) minmax(0, 1fr) auto; align-items: center; gap: 8px;
  padding: 5px 6px 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--raised); min-width: 0;
}
.step:focus-visible { outline-offset: 0; }
.step.dragging { opacity: 0.45; }
.step.drop { border-color: var(--accent); }
.step .grip { width: 16px; height: 16px; color: var(--muted); cursor: grab; }
.step-n { font: 500 0.72rem var(--mono); color: var(--muted); }
.step-kind { display: inline-flex; align-items: center; gap: 5px; font: 600 0.72rem/1 var(--mono); text-transform: uppercase; letter-spacing: 0.05em; padding: 4px 7px; border-radius: 4px; justify-self: start; }
.step-kind .ico { width: 14px; height: 14px; }
.step-kind.press { color: #10b981; background: color-mix(in srgb, #10b981 13%, transparent); }
.step-kind.release { color: #06b6d4; background: color-mix(in srgb, #06b6d4 13%, transparent); }
.step-kind.delay { color: var(--muted); background: var(--wash); }
[data-theme="cream"] .step-kind.press { color: #047857; }
[data-theme="cream"] .step-kind.release { color: #0e7490; }
.step-what { font: 600 0.85rem var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step .ms { width: 92px; min-height: 30px; padding: 4px 8px; text-align: right; font-family: var(--mono); font-size: 0.82rem; }
.step-tools { display: inline-flex; gap: 2px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.swatch-pick { position: relative; cursor: pointer; }
.swatch-pick input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip { display: block; width: 30px; height: 30px; border-radius: 6px; background: color-mix(in srgb, var(--chip) 38%, transparent); border: 2px solid var(--chip); }
.swatch-pick input:checked + .chip { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text); }
.swatch-pick input:focus-visible + .chip { outline: 2px solid var(--accent); outline-offset: 4px; }
p.guard { display: flex; gap: 8px; align-items: flex-start; font-size: 0.82rem; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; margin-top: 12px; }
p.guard .ico { color: #10b981; }

/* ---------- test pad drawer ---------- */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: var(--pad-w); z-index: 40; display: flex; flex-direction: column; gap: 10px;
  padding: 18px; background: var(--surface); border-left: 1px solid var(--line-strong); box-shadow: -18px 0 40px rgb(0 0 0 / 0.3); overflow-y: auto;
}
.drawer-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.drawer-head h2 { font-size: 1.3rem; }
.drawer textarea { min-height: 120px; }
.tp-state { margin-left: auto; font: 600 0.78rem var(--mono); color: var(--muted); }
.tp-log { list-style: none; margin: 0; padding: 0; flex: 1; min-height: 160px; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); font: 0.76rem/1.4 var(--mono); }
.ev { display: grid; grid-template-columns: 74px 52px minmax(0, 1fr); gap: 8px; padding: 5px 8px; border-bottom: 1px solid var(--line); }
.ev-t { color: var(--muted); text-align: right; }
.ev-src { color: var(--accent); overflow: hidden; text-overflow: ellipsis; }
.ev-d { overflow-wrap: anywhere; }
.ev.guard .ev-d, .ev-swallow .ev-d { color: var(--muted); }
.ev-run .ev-d { font-weight: 600; }
@media (min-width: 1200px) { body.pad-open main, body.pad-open .statusbar { margin-right: var(--pad-w); } }

/* ---------- status bar ---------- */
.statusbar {
  display: flex; flex-wrap: wrap; gap: 6px 20px; align-items: center; padding: 10px var(--gutter);
  border-top: 1px solid var(--line); font: 0.74rem var(--mono); color: var(--muted);
}
.offline { display: inline-flex; gap: 6px; align-items: center; margin-left: auto; }
.offline .ico { width: 14px; height: 14px; color: #10b981; }

/* ---------- small screens ---------- */
@media (max-width: 760px) {
  .topbar { grid-template-columns: minmax(0, 1fr) auto; position: static; }
  .profile-bar { grid-column: 1 / -1; grid-row: 2; }
  .profile-bar .field-inline { max-width: none; }
  .top-actions { grid-column: 1 / -1; grid-row: 3; justify-content: flex-start; }
  .top-actions .btn span:not(.sr-only) { font-size: 0.8rem; }
  .profile-menu { position: static; margin: 0 var(--gutter); }
  .step { grid-template-columns: 14px 24px minmax(0, 1fr) auto; row-gap: 6px; }
  .step > .grip { grid-column: 1; grid-row: 1; }
  .step > .step-n { grid-column: 2; grid-row: 1; }
  .step > .step-kind { grid-column: 3; grid-row: 1; }
  .step > .step-tools { grid-column: 4; grid-row: 1; }
  .step > .step-what, .step > .ms-wrap { grid-column: 2 / -1; grid-row: 2; }
  .offline { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
