/*
 * kit.css · the Studio Fabi tools kit (Capsule Dock)
 *
 * Every shared component, one class name each, built only from tokens.css.
 * The subject is the page; one capsule (the dock) at the bottom holds the
 * settings; a chip opens one sheet on the right; the navy split primary ends
 * the dock. kit.js runs the behaviour. See kit/README.md for the API.
 *
 *  1 Base and utilities           12 Swatches, hex, colour popover
 *  2 Ground and header            13 Switch rows, sliders, stepper
 *  3 Stage, layouts, tray        14 Fields, upload tile, file row
 *  4 Hero field and readout       15 Buttons and toggles
 *  5 Status pill and notices      16 Popovers, menus, options pop
 *  6 Dock, chips, bubbles         17 Tooltip, toast, drop overlay
 *  7 Split primary                18 Dialogs and the phone notice
 *  8 Sheet and panels             19 Item lists and rows
 *  9 Sections, folds, (i)         20 Transport, tool palettes
 * 10 Segmented control            21 Progress, empty state, page mode
 * 11 Tiles, presets, preset chips 22 Responsive, touch, reduced motion
 *
 * Rules: element defaults use :where() so a tool's CSS always wins; no
 * colour or radius literals here except the custom swatch's hue wheel (and
 * #000 inside masks, where only the alpha counts); a tool adds CSS only for
 * its own subject, from tokens.
 *
 * Class names a tool's own markup may reuse without picking up kit styles:
 * .item (only .items > .item is styled), .lock (only svg.i.lock), .badge
 * (only on .tile and .preset-art), .sw (only button.sw), .pop (only div.pop),
 * .info (only button.info), .play (only .icon-btn.play), .time (only inside
 * .transport). Every other class here is the kit's: see PORTING.md, "Reserved
 * class names".
 */

/* 1 · BASE AND UTILITIES ---------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; }
body {
  min-height: 100%; background: var(--bg); color: var(--ink);
  font: 400 var(--fs-body)/var(--lh) var(--font); -webkit-font-smoothing: antialiased;
  transition: background-color var(--t-color) var(--ease-out), color var(--t-color) var(--ease-out);
}
body.app:not([data-layout='page']) { height: 100%; overflow: hidden; }
:where(button) { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; text-align: inherit; -webkit-tap-highlight-color: transparent; }
:where(input, textarea, select) { font: inherit; color: inherit; margin: 0; }
:where(p, h1, h2, h3, h4, ol, ul, dl, figure, fieldset) { margin: 0; }
:where(ol, ul)[role='list'], :where(ol.steps, ul.keys) { list-style: none; padding: 0; }
:where(a) { color: var(--accent); }
:where(kbd) { font: 600 var(--fs-meta)/1 var(--font); }
:focus:not(:focus-visible) { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
[aria-disabled='true'] { cursor: not-allowed; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.tnum { font-variant-numeric: tabular-nums; }
.grow { flex: 1 1 auto; min-width: 0; }
.eyebrow { font-size: var(--fs-meta); line-height: 18px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); }
@media (min-width: 761px) { [data-phone-only] { display: none !important; } }

/* one press feel for everything you can click */
:is(.icon-btn, .pill-btn, .btn-primary, .btn-sec, .btn-quiet, .btn-danger, .btn-mini, .chip, .tile, .pchip,
    .split-main, .split-more, .toolpal-btn, .floatbar-btn, .drop-tile, .hero-clear):active:not([aria-disabled='true']) { transform: scale(.97); }
button.sw:active:not([aria-disabled='true']) { transform: scale(.97); }

/* 2 · GROUND AND HEADER ----------------------------------------------------- */
.ground { position: fixed; inset: 0; z-index: var(--z-ground); background: var(--bg); overflow: hidden; pointer-events: none; transition: background-color var(--t-color) var(--ease-out); }
.ground::before {
  content: ''; position: absolute; inset: -8vmax; will-change: transform;
  background:
    radial-gradient(60vmax 45vmax at calc(8vmax + 15vw) calc(100% - 8vmax), var(--field-green), transparent 70%),
    radial-gradient(60vmax 45vmax at calc(8vmax + 85vw) calc(100% - 8vmax), var(--field-blue), transparent 70%);
  animation: sf-drift 38s ease-in-out infinite alternate;
}
@keyframes sf-drift { from { transform: translate3d(-5vmax, 1.5vmax, 0); } to { transform: translate3d(5vmax, -2.5vmax, 0); } }
html.paused .ground::before { animation-play-state: paused; }

.hdr { position: relative; z-index: var(--z-hdr); height: var(--hdr-h); padding: 0 var(--gutter); display: flex; align-items: center; gap: 16px; }
.hdr-brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.wordmark { display: inline-flex; align-items: center; height: 40px; flex: none; color: var(--ink); border-radius: var(--radius-xs); }
.wordmark svg { height: 24px; width: auto; fill: currentColor; display: block; }
.hdr-div { width: 1px; height: 20px; flex: none; background: var(--hdr-div); }
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; }
.crumbs a {
  display: inline-flex; align-items: center; min-height: 36px; font-size: var(--fs-body); color: var(--ink-soft); text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 0 calc(100% - 7px) / 0 1px no-repeat;
  transition: background-size var(--t-move) var(--ease-out), color var(--t-color) var(--ease-out);
}
.crumbs a:hover { background-size: 100% 1px; color: var(--ink); }
.crumbs .sep { color: var(--ink-faint); }
.crumbs h1, .crumbs [aria-current='page'] { font: 400 var(--fs-name)/24px var(--font-head); color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
.tag { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; flex: none; border-radius: var(--radius-pill); background: var(--well); box-shadow: inset 0 0 0 1px var(--edge); font-size: var(--fs-meta); font-weight: 500; color: var(--ink); }
.hdr-end { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.theme-btn .i { position: absolute; transition: transform var(--t-move) var(--ease-out), opacity var(--t-color) var(--ease-out); }
:root[data-theme='dark'] .theme-btn .sun, :root:not([data-theme='dark']) .theme-btn .moon { opacity: 0; transform: rotate(-90deg) scale(.4); }
.pill-dot { position: relative; width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--accent); }
.pill-dot::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: var(--accent); animation: sf-ping 1.8s var(--ease-out) infinite; }
@keyframes sf-ping { from { transform: scale(1); opacity: .6; } to { transform: scale(2.6); opacity: 0; } }
html.notice-open .pill-dot, html.notice-open .first-hint { visibility: hidden; }

/* 3 · STAGE, SUBJECT, LAYOUTS ----------------------------------------------- */
/* kit.js measures and writes --col-w, --col-top, --art-w, --art-h and --shift on .stage-col */
.stage { position: fixed; z-index: var(--z-stage); left: 0; right: 0; top: var(--hdr-h); bottom: 0; }
/* short desktop windows (under 620px tall): the stage scrolls above the dock and the pill becomes the mini status */
html.is-short .stage { bottom: calc(var(--gutter) + var(--tray-h) + var(--dock-h) + 8px); overflow-y: auto; }
html.is-short .stage-foot > .status { display: none; }
html.is-short .mini-status { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 8px 0 16px; font-size: var(--fs-meta); line-height: 18px; color: var(--ink); }
.stage-col {
  position: absolute; left: 50%; top: var(--col-top, 24px); width: var(--col-w, var(--art-w, 480px)); margin-left: calc(var(--col-w, var(--art-w, 480px)) / -2);
  display: flex; flex-direction: column; align-items: center;
  transform: translateX(var(--shift, 0px));
  transition: transform var(--t-sheet) var(--ease-out), width var(--t-sheet) var(--ease-out), margin-left var(--t-sheet) var(--ease-out), top var(--t-sheet) var(--ease-out);
}
.stage-head { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.stage-head > .readout { margin-top: -4px; }
.stage-foot { width: 100%; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 12px; }
.stage-head:not([hidden]) + :is(.subject, .subjects) { margin-top: 20px; }
:is(.subject, .subjects) + .stage-foot { margin-top: 16px; }
.subject {
  position: relative; flex: none; width: var(--art-w, 480px); height: var(--art-h, 480px);
  transition: width var(--t-sheet) var(--ease-out), height var(--t-sheet) var(--ease-out);
}
.subjects { display: flex; gap: 16px; flex: none; height: var(--art-h, 360px); transition: height var(--t-sheet) var(--ease-out); }
.subjects > .subject { width: auto; height: 100%; aspect-ratio: var(--ratio, 1); }
.vignette {
  position: absolute; left: 50%; top: 50%; z-index: 0; pointer-events: none; aspect-ratio: 1;
  width: calc(max(var(--art-w, 480px), var(--art-h, 480px)) + 280px); transform: translate(-50%, -50%);
  background: radial-gradient(circle at 1px 1px, var(--vignette-dot) 1px, transparent 1.4px) 0 0 / 16px 16px;
  -webkit-mask: radial-gradient(closest-side, #000 55%, transparent); mask: radial-gradient(closest-side, #000 55%, transparent);
}
.artboard {
  position: relative; z-index: 1; width: 100%; height: 100%; overflow: hidden;
  border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow-art);
  transition: background-color var(--t-color) var(--ease-out);
}
[data-checker='dark'] { --check-a: var(--check-dark-a); --check-b: var(--check-dark-b); }
.readout { max-width: 100%; min-height: 18px; display: flex; justify-content: center; gap: 5px; font-size: var(--fs-meta); line-height: 18px; color: var(--ink-soft); white-space: nowrap; min-width: 0; text-align: center; }
.readout b { flex: none; font-weight: 500; color: var(--ink); }
.readout .ev { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.readout.two { flex-wrap: wrap; gap: 0 5px; }
.readout.two > :last-child { flex-basis: 100%; }
.readout.two .sep { display: none; }
.readout .btn-link { min-height: 24px; margin: -3px 0; padding: 0 2px; }   /* a 24px target inside an 18px line */
.mini-status { display: none; }
.first-hint {
  position: fixed; z-index: var(--z-hint); left: 50%; bottom: calc(var(--gutter) + var(--tray-h) + var(--dock-h) + 8px); transform: translateX(-50%);
  max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis;
  font-size: var(--fs-meta); line-height: 18px; color: var(--ink-soft); white-space: nowrap; pointer-events: none; transition: opacity var(--t-sheet) var(--ease-out);
}
.first-hint.gone, html.is-short .first-hint { opacity: 0; }

/* inset fit (canvas layout: Moodboard, Mosaic): the tool's canvas fills the free rect */
/* phone band left above an open bottom sheet: taller where a transport stays visible */
body:is([data-layout='timeline'], [data-layout='shot']) { --phone-band: 264px; }
body[data-fit='inset'] .stage-col {
  left: var(--inset-l, var(--gutter)); right: var(--inset-r, var(--gutter)); top: 12px; bottom: var(--dock-zone);
  width: auto; margin: 0; transform: none; align-items: stretch;
  transition: right var(--t-sheet) var(--ease-out), left var(--t-sheet) var(--ease-out);
}
body[data-fit='inset'] .stage-col > .subject { flex: 1 1 auto; width: auto; height: auto; min-height: 0; margin-top: 8px; }
body[data-fit='inset'] .stage-head + .subject { margin-top: 12px; }
body[data-fit='inset'] .subject + .stage-foot { margin-top: 12px; }
/* timeline layout, tray form: the tray sits under the dock */
.tray {
  position: fixed; z-index: var(--z-stage); left: var(--gutter); right: var(--gutter); bottom: var(--gutter); height: 200px;
  display: flex; flex-direction: column; border-radius: var(--radius-lg); background: var(--surface); box-shadow: inset 0 0 0 1px var(--ring);
}
.tray-head { flex: none; height: 48px; padding: 0 8px 0 4px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--rule); }
.tray-body { position: relative; flex: 1 1 auto; min-height: 0; }
.tray-body > canvas { display: block; width: 100%; height: 100%; }

/* 4 · HERO FIELD AND READOUT ------------------------------------------------ */
.hero-field {
  position: relative; width: 100%; min-height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 8px 0 20px;
  border-radius: var(--radius-md); background: var(--surface); box-shadow: inset 0 0 0 1px var(--edge);
  transition: box-shadow var(--t-color) var(--ease-out), background-color var(--t-color) var(--ease-out);
}
.hero-field:focus-within { box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 4px var(--focus-glow); }
.hero-field.is-multi { align-items: flex-start; padding-top: 16px; padding-bottom: 16px; }
.hero-ic { color: var(--ink-soft); }
.hero-input { flex: 1; min-width: 0; padding: 16px 0; border: 0; background: none; outline: none; resize: none; font-size: var(--fs-field); line-height: 24px; color: var(--ink); }
textarea.hero-input { display: block; padding: 0; max-height: 96px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--edge) transparent; }
.hero-input::placeholder, .input::placeholder, .textarea::placeholder { color: var(--ink-faint); opacity: 1; }
.hero-input::-webkit-search-cancel-button { display: none; }
.hero-count { flex: none; font-size: var(--fs-meta); line-height: 18px; color: var(--ink-faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
.hero-clear { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: var(--radius-pill); color: var(--ink); }
.hero-clear > span { width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--radius-pill); background: var(--well); transition: background-color var(--t-color) var(--ease-out); }
.hero-clear:hover > span { background: var(--hover); }
.hero-clear .i { width: 16px; height: 16px; }
.hero-clear.is-empty { visibility: hidden; }
.hero-field.is-multi :is(.hero-ic, .hero-count) { margin-top: 2px; }
.hero-field.is-multi .hero-clear { margin: -8px 0; }

/* 5 · STATUS PILL AND NOTICES ----------------------------------------------- */
.status {
  position: relative; height: 40px; max-width: 100%; display: inline-flex; align-items: center; gap: 8px; padding: 0 14px 0 10px; overflow: hidden;
  border-radius: var(--radius-pill); background: var(--surface); box-shadow: inset 0 0 0 1px var(--status-ring);
  font-size: var(--fs-label); line-height: 20px; white-space: nowrap; transition: background-color var(--t-color) var(--ease-out);
}
.status:has(.btn-mini) { padding-right: 4px; }
.status.is-off { visibility: hidden; }
.status-ic { width: 20px; height: 20px; }
[data-level='ok'] > .status-ic { color: var(--ok); }
[data-level='info'] > .status-ic { color: var(--ink-soft); }
[data-level='warn'] > .status-ic { color: var(--warn); }
[data-level='bad'] > .status-ic { color: var(--bad); }
[data-level='busy'] > .status-ic { color: var(--accent); }
.status-t { flex: none; font-weight: 500; color: var(--ink); }
.status-d { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--ink-soft); }
.status-more {
  flex: none; height: 36px; padding: 0 4px; margin: 0 -2px; border-radius: var(--radius-xs); font-size: var(--fs-meta); font-weight: 500; color: var(--ink);
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--edge); transition: text-decoration-color var(--t-color) var(--ease-out);
}
.status-more:hover { text-decoration-color: currentColor; }
.status-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: calc(var(--p, 0) * 100%); background: var(--accent); transition: width var(--t-fade) linear; }
.status-list { border-radius: var(--radius-md); background: var(--well); padding: 4px 0; }
.status-row { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 8px 6px 14px; font-size: var(--fs-label); line-height: 20px; color: var(--ink); }
.status-list > .status-row + .status-row { border-top: 1px solid var(--rule); }
:not(.status-list) > .status-row { border-radius: var(--radius-md); background: var(--well); }
.status-row .status-t { display: block; }
.status-row .status-d { display: block; font-size: var(--fs-meta); line-height: 18px; white-space: normal; }

/* 6 · DOCK, CHIPS, BUBBLES -------------------------------------------------- */
.dock {
  position: fixed; z-index: var(--z-dock); left: 50%; bottom: calc(var(--gutter) + var(--tray-h)); transform: translateX(-50%);
  width: max-content; max-width: calc(100vw - 2 * var(--gutter)); height: var(--dock-h); display: flex; align-items: center; gap: 4px; padding: 7px;
  border-radius: var(--radius-pill); border: 1px solid var(--dock-line); background: var(--dock-solid); box-shadow: var(--dock-shadow);
  transition: background-color var(--t-color) var(--ease-out), border-color var(--t-color) var(--ease-out);
}
.dock:empty { display: none; }
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .dock, .toolpal, .floatbar { background: var(--dock-bg); -webkit-backdrop-filter: blur(16px) saturate(1.2); backdrop-filter: blur(16px) saturate(1.2); }
}
.dock-chips { display: flex; align-items: center; gap: 4px; min-width: 0; }
.chip {
  --dot-ring: var(--dock-solid);
  position: relative; height: 48px; flex: none; display: inline-flex; align-items: center; gap: 10px; padding: 0 16px 0 8px;
  border-radius: var(--radius-pill); font-size: var(--fs-body); line-height: 20px; font-weight: 500; color: var(--ink); white-space: nowrap;
  transition: background-color var(--t-color) var(--ease-out), color var(--t-color) var(--ease-out), transform var(--t-press) var(--ease-out);
}
.chip:hover { background: var(--chip-hover); }
.chip[aria-expanded='true'] { --dot-ring: var(--solid); background: var(--solid); color: var(--solid-ink); }
.chip-s { display: none; }
.bub {
  position: relative; width: 32px; height: 32px; flex: none; display: grid; place-items: center; overflow: hidden;
  border-radius: 50%; background: var(--well); color: var(--ink); box-shadow: inset 0 0 0 1px var(--edge);
  font-size: var(--fs-label); font-weight: 600; font-variant-numeric: tabular-nums;
  transition: box-shadow var(--t-color) var(--ease-out), background-color var(--t-color) var(--ease-out);
}
.bub .i { width: 18px; height: 18px; }
.bub > svg:not(.i) { width: 20px; height: 20px; display: block; }
.bub > .bub-full { width: 100%; height: 100%; }   /* a full-bleed bubble picture: QR's colour split */
.bub > img { width: 100%; height: 100%; padding: 5px; object-fit: contain; background: var(--logo-bg); }
.chip[aria-expanded='true'] .bub { box-shadow: inset 0 0 0 1px var(--edge), 0 0 0 2px var(--solid-ink); }
.bub-count { background: var(--solid); color: var(--solid-ink); box-shadow: none; }
.chip[aria-expanded='true'] .bub-count { background: var(--solid-ink); color: var(--solid); }
.bub-ok .i { color: var(--ok); }
.bub-warn, .bub-bad { color: var(--status-ink); box-shadow: none; }
.bub-warn { background: var(--warn); }
.bub-bad { background: var(--bad); }
.bub-img { background: var(--logo-bg); }
.chip[aria-disabled='true'] { color: var(--ink-faint); }
.chip[aria-disabled='true'] .bub { background: transparent; box-shadow: none; outline: 1px dashed var(--edge); outline-offset: -1px; color: var(--ink-faint); }
.mdot { position: absolute; top: 6px; left: 34px; display: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--dot-ring); }
.chip.is-mod .mdot, .chip.is-warn .mdot, .chip.is-bad .mdot { display: block; }
.chip.is-warn .mdot { background: var(--warn); }
.chip.is-bad .mdot { background: var(--bad); }
.dock-div { width: 1px; height: 32px; margin: 0 8px; flex: none; background: var(--dock-div); }
/* measured fit: compact chips, then scrolling chips */
.dock.is-compact { padding: 7px 8px; }
.dock.is-compact .chip { width: 64px; height: 56px; flex-direction: column; justify-content: center; gap: 2px; padding: 2px 0 0; border-radius: var(--radius-chip); }
.dock.is-compact .chip-l, .dock.is-compact .split-long { display: none; }
.dock.is-compact .chip-s { display: block; font-size: var(--fs-meta); line-height: 16px; }
.dock.is-compact .split-short { display: inline; }
.dock.is-compact .mdot { top: 3px; left: calc(50% + 10px); }
.dock.is-scroll .dock-chips { overflow-x: auto; scrollbar-width: none; -webkit-mask: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
.dock.is-scroll .dock-chips.at-end { -webkit-mask: none; mask: none; }
.dock-chips::-webkit-scrollbar { display: none; }

/* 7 · SPLIT PRIMARY --------------------------------------------------------- */
.split { display: flex; align-items: center; height: 48px; flex: none; border-radius: var(--radius-pill); background: var(--solid); color: var(--solid-ink); transition: background-color var(--t-color) var(--ease-out); }
.split-main { height: 48px; display: inline-flex; align-items: center; gap: 12px; padding: 0 6px 0 18px; border-radius: var(--radius-pill); font-size: var(--fs-body); line-height: 20px; font-weight: 500; white-space: nowrap; transition: transform var(--t-press) var(--ease-out); }
.split[data-split] .split-main { border-radius: var(--radius-pill) 0 0 var(--radius-pill); }
.split-short { display: none; }
.split-sq { width: 36px; height: 36px; flex: none; display: grid; place-items: center; overflow: hidden; border-radius: var(--radius-xs); background: var(--brand); color: var(--brand-ink); }
.split-sq .i { width: 18px; height: 18px; stroke-width: 2; transition: transform var(--t-move) var(--ease-out); }
.split-main:hover .split-sq .i { transform: translateY(2px); }
.split-main:hover .split-sq [data-nudge='x'] { transform: translateX(2px); }
.split-sep { width: 1px; height: 24px; flex: none; background: var(--solid-sep); }
.split-more {
  min-width: 84px; height: 48px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  border-radius: 0 var(--radius-pill) var(--radius-pill) 0; font-size: var(--fs-meta); line-height: 16px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap;
  transition: background-color var(--t-color) var(--ease-out), transform var(--t-press) var(--ease-out);
}
.split-more .i { width: 16px; height: 16px; stroke-width: 2; transition: transform var(--t-move) var(--ease-out); }
.split-more[aria-expanded='true'] .i:last-child { transform: rotate(180deg); }
.split-more:hover { background: var(--solid-hover); }
.split-more:has(.split-val:empty) { min-width: 48px; }
.split[data-split='two'] .split-more { font-size: var(--fs-label); }
.split.is-off { background: var(--well); color: var(--ink-faint); outline: 1px dashed var(--edge); outline-offset: -1px; }
.split.is-off .split-sq { background: transparent; color: var(--ink-faint); }
.split.is-off .split-sep { background: var(--edge); }
.split.is-off .split-more:hover { background: none; }
.split.is-off .split-main:hover .split-sq .i { transform: none; }
html.is-busy { cursor: progress; }   /* Kit.busy: the page is inert apart from Cancel; the pointer says so */
.split.is-busy .split-main { background: linear-gradient(90deg, var(--solid-sep) calc(var(--p, 0) * 100%), transparent 0); font-variant-numeric: tabular-nums; }

/* 8 · SHEET AND PANELS ------------------------------------------------------ */
.sheet {
  position: fixed; z-index: var(--z-sheet); top: var(--sheet-top); right: var(--gutter); bottom: auto; width: var(--sheet-w);
  max-height: calc(100vh - var(--sheet-top) - var(--sheet-bot)); display: flex; flex-direction: column; overflow: hidden;
  border-radius: var(--radius-xl); background: var(--surface); box-shadow: inset 0 0 0 1px var(--ring), var(--shadow-pop);
  opacity: 0; visibility: hidden; transform: translateX(24px);
  transition: opacity var(--t-sheet) var(--ease-out), transform var(--t-sheet) var(--ease-out), visibility 0s linear var(--t-sheet), background-color var(--t-color) var(--ease-out);
}
body.sheet-open .sheet { opacity: 1; visibility: visible; transform: none; transition: opacity var(--t-sheet) var(--ease-out), transform var(--t-sheet) var(--ease-out), visibility 0s, background-color var(--t-color) var(--ease-out); }
.sheet-grab { display: none; }
.panel { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; animation: sf-fade .35s var(--ease-out); }
@keyframes sf-fade { from { opacity: 0; } to { opacity: 1; } }
.panel-head {
  position: relative; z-index: 1; flex: none; min-height: 72px; padding: 14px 16px 10px 24px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: 'title reset close' 'desc desc close'; align-items: start; column-gap: 6px;
  box-shadow: 0 1px 0 transparent; transition: box-shadow var(--t-color) var(--ease-out);
}
.sheet.is-scrolled .panel-head { box-shadow: 0 1px 0 var(--rule); }
.panel-title { grid-area: title; min-width: 0; font: 400 var(--fs-sheet)/28px var(--font-head); letter-spacing: -.01em; color: var(--ink); }
.panel-title:focus { outline: none; }
.panel-desc { grid-area: desc; margin-top: 2px; font-size: var(--fs-label); line-height: 20px; color: var(--ink-soft); }
.panel-head [data-reset] { grid-area: reset; margin: -6px 0; }
.panel-x { grid-area: close; grid-row: 1 / span 2; }
.panel-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 24px 20px; scrollbar-width: thin; scrollbar-color: var(--edge) transparent; }
.sheet.has-more .panel-body { -webkit-mask: linear-gradient(#000 calc(100% - 72px), rgba(0, 0, 0, .04) calc(100% - 12px)); mask: linear-gradient(#000 calc(100% - 72px), rgba(0, 0, 0, .04) calc(100% - 12px)); }
.more-cue {
  position: absolute; left: 50%; bottom: 10px; z-index: 2; transform: translateX(-50%); height: 32px; padding: 0 12px 0 8px;
  display: inline-flex; align-items: center; gap: 4px; border-radius: var(--radius-pill); background: var(--surface); color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--edge), var(--shadow-cue); font-size: var(--fs-meta); font-weight: 500;
  opacity: 0; visibility: hidden; transition: opacity var(--t-color) var(--ease-out), visibility 0s linear var(--t-color), background-color var(--t-color) var(--ease-out);
}
.more-cue .i { width: 16px; height: 16px; }
.more-cue:hover { background: var(--hover); }
.sheet.has-more .more-cue { opacity: 1; visibility: visible; transition: opacity var(--t-color) var(--ease-out), visibility 0s, background-color var(--t-color) var(--ease-out); }

/* 9 · SECTIONS, FIELDS, FOLDS, (i) ------------------------------------------ */
.sec + .sec, .sec + .fold, .fold + .sec { margin-top: var(--sec-gap); }
.sec-head, .field-head { display: flex; align-items: center; gap: 4px; min-height: 20px; margin-bottom: 8px; }
.field-head { min-height: 24px; }
.sec-title { font-size: var(--fs-body); line-height: 20px; font-weight: 600; color: var(--ink); }
.sec-val { margin-left: auto; padding-left: 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-meta); line-height: 18px; color: var(--ink-soft); transition: color var(--t-fade) var(--ease-out); }
.sec-val.is-peek { color: var(--ink); font-weight: 500; }
:not(.grid-2) > .field + .field, .grid-2 + .field, .field + .grid-2 { margin-top: 16px; }
.label { font-size: var(--fs-label); line-height: 20px; font-weight: 500; color: var(--ink); }
.hint { margin-top: 8px; font-size: var(--fs-meta); line-height: 18px; color: var(--ink-soft); }
.hint .i { width: 16px; height: 16px; margin-right: 4px; vertical-align: -3px; }
.panel-body > .hint:last-child:not(:first-child) { margin-top: 20px; }   /* the closing line under a sheet's last section */
.reveal { margin-top: 16px; display: flex; flex-direction: column; gap: 18px; animation: sf-fade .35s var(--ease-out); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@container (max-width: 340px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
.panel-body { container-type: inline-size; }
.fold { border-top: 1px solid var(--rule); }
.fold:last-child { border-bottom: 1px solid var(--rule); }
.fold + .fold { margin-top: 0; }
.fold-head { min-height: 48px; display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; border-radius: var(--radius-xs); }
.fold-head::-webkit-details-marker { display: none; }
.fold-head:hover .sec-title { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--edge); }
.fold-head:focus-visible { outline-offset: -2px; }
.fold-val { margin-left: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-meta); color: var(--ink-soft); }
.fold-head > .i { color: var(--ink-soft); transition: transform var(--t-move) var(--ease-out); }
.fold[open] > .fold-head > .i { transform: rotate(180deg); }
.fold-body { padding: 4px 0 20px; animation: sf-fade .35s var(--ease-out); }
.fold-body > .switch-row:first-child { margin-top: -4px; }
button.info { position: relative; width: 36px; height: 36px; margin: -8px -6px; flex: none; display: inline-grid; place-items: center; border-radius: var(--radius-pill); cursor: help; }
button.info > span { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: var(--hover-soft); color: var(--ink-soft); font: 600 var(--fs-meta)/1 var(--font); transition: background-color var(--t-color) var(--ease-out); }
button.info:hover > span { background: var(--hover); }

/* 10 · SEGMENTED CONTROL ---------------------------------------------------- */
.seg { position: relative; display: flex; align-items: center; padding: 4px; isolation: isolate; border-radius: var(--radius-sm); background: var(--surface); box-shadow: inset 0 0 0 1px var(--edge); }
.seg-ind { position: absolute; left: 0; top: 0; z-index: 0; border-radius: var(--radius-seg); background: var(--solid); pointer-events: none; opacity: 0; transition: transform var(--t-move) var(--ease-out), width var(--t-move) var(--ease-out), height var(--t-move) var(--ease-out), opacity var(--t-fade); }
.seg [role='radio'] {
  position: relative; z-index: 1; flex: 1 1 0; min-width: 0; height: 36px; padding: 0 10px; border: 1px solid transparent; border-radius: var(--radius-seg);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  font-size: var(--fs-label); line-height: 20px; font-weight: 500; color: var(--ink);
  transition: color var(--t-move) var(--ease-out), background-color 0s, transform var(--t-press) var(--ease-out);
}
.seg [role='radio']:not([aria-checked='true']):not([aria-disabled='true']):hover { background: var(--hover-soft); }
.seg [role='radio']:active:not([aria-disabled='true']) { transform: scale(.97); }
.seg [role='radio'][aria-checked='true'] { color: var(--solid-ink); font-weight: 600; background-color: var(--solid); transition: color var(--t-move) var(--ease-out), background-color 0s linear .42s, transform var(--t-press) var(--ease-out); }
.seg.no-anim .seg-ind, .seg.no-anim [role='radio'][aria-checked='true'] { transition: none; }
.seg [role='radio'][aria-disabled='true'] { border-style: dashed; border-color: var(--edge); color: var(--ink-faint); }
.lbl { display: inline-grid; }
.lbl::after { content: attr(data-label); height: 0; overflow: hidden; visibility: hidden; font-weight: 600; }
/* the lock glyph is an icon (svg.i.lock): a tool's own .lock class (Moodboard's locked board items) is never touched */
.i.lock { display: none; width: 14px; height: 14px; color: var(--ink-faint); }
[aria-disabled='true'] .i.lock { display: inline-block; }
.seg-strip { width: max-content; max-width: 100%; height: 40px; padding: 2px; }
.seg-strip [role='radio'] { flex: none; height: 36px; padding: 0 14px; border-radius: var(--radius-xs); }
.seg-strip .seg-ind { border-radius: var(--radius-xs); }
.seg-strip .i { width: 18px; height: 18px; }
.seg-strip .tnum { color: var(--ink-faint); font-weight: 500; }
.seg-strip [aria-checked='true'] .tnum { color: var(--solid-ink-soft); }
.seg-full { width: 100%; height: 44px; }
.seg-two { height: 60px; }
.seg-two [role='radio'] { height: 52px; flex-direction: column; gap: 0; padding: 0 4px; }
.seg-sub { display: inline-flex; align-items: center; gap: 3px; font-size: var(--fs-meta); line-height: 16px; font-weight: 500; color: var(--ink-soft); transition: color var(--t-move) var(--ease-out); }
.seg [aria-checked='true'] .seg-sub { color: var(--solid-ink-soft); }
.seg [aria-disabled='true'] .seg-sub { color: var(--ink-faint); }

/* 11 · TILES, PRESETS, PRESET CHIPS ----------------------------------------- */
.tiles { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 8px; }
.tile {
  position: relative; min-height: var(--tile-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 6px 4px 4px;
  border: 1px solid var(--edge); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink);
  transition: background-color var(--t-color) var(--ease-out), color var(--t-color) var(--ease-out), border-color var(--t-color) var(--ease-out), transform var(--t-press) var(--ease-out);
}
.tile:not([aria-pressed='true']):not([aria-disabled='true']):hover { background: var(--hover); }
.tile[aria-pressed='true'] { border-color: var(--solid); background: var(--solid); color: var(--solid-ink); }
.tile[aria-disabled='true'] { border-style: dashed; color: var(--ink-faint); }
.tile-g { width: 28px; height: 28px; display: grid; place-items: center; }
.tile-g > svg { width: 28px; height: 28px; display: block; overflow: visible; }
.tile-g > .i { width: 24px; height: 24px; }
.tile-g > img { width: 28px; height: 28px; padding: 2px; object-fit: contain; border-radius: var(--radius-3xs); background: var(--logo-bg); box-shadow: inset 0 0 0 1px var(--rule); }
.tile-cap { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-meta); line-height: 16px; font-weight: 500; }
.tile-meta { font-size: var(--fs-meta); line-height: 16px; color: var(--ink-soft); }
.tile[aria-pressed='true'] .tile-meta { color: var(--solid-ink-soft); }
.tile > .i.lock { position: absolute; top: 6px; right: 6px; }
/* the check badge lives only on tiles and preset art (a tool's own .badge, like Expression's camera badge, is untouched) */
:is(.tile, .preset-art) > .badge { position: absolute; top: 6px; right: 6px; width: 18px; height: 18px; display: none; place-items: center; border-radius: 50%; background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 2px var(--surface); }
:is(.tile, .preset-art) > .badge .i { width: 12px; height: 12px; stroke-width: 3; }
.tile[aria-pressed='true'] > .badge, .preset[aria-pressed='true'] > .preset-art > .badge { display: grid; }
.presets { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 12px; }
.preset { display: flex; flex-direction: column; align-items: center; gap: 8px; border-radius: var(--radius-md); }
.preset-art {
  position: relative; width: 100%; aspect-ratio: var(--ratio, 1); display: grid; place-items: center; overflow: hidden;
  border: 1px solid var(--edge); border-radius: var(--radius-md); background: var(--surface);
  transition: transform .6s var(--ease-out), box-shadow .6s var(--ease-out), border-color var(--t-color) var(--ease-out);
}
.preset-art > :is(svg, img, canvas) { max-width: 80%; max-height: 80%; display: block; }
.preset-art > .badge { top: 8px; right: 8px; }
.preset:hover .preset-art { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.preset:active .preset-art { transform: scale(.985); transition-duration: .15s; }
.preset[aria-pressed='true'] .preset-art { border-color: var(--solid); box-shadow: 0 0 0 1px var(--solid); }
.preset-cap { font-size: var(--fs-meta); line-height: 16px; font-weight: 500; color: var(--ink); }
.pchips { display: flex; flex-wrap: wrap; gap: 8px; }
.pchip { width: 48px; height: 40px; display: grid; place-items: center; border-radius: var(--radius-sm); }
.pchip > span { position: relative; width: 48px; height: 32px; display: grid; place-items: center; border-radius: var(--radius-xs); background: linear-gradient(135deg, var(--a), var(--b)); box-shadow: inset 0 0 0 1px var(--ring); transition: box-shadow var(--t-color) var(--ease-out), transform var(--t-color) var(--ease-out); }
.pchip:hover > span { transform: translateY(-2px); }
.pchip[aria-pressed='true'] > span { transform: none; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--solid); }
.pchip .chk { color: var(--brand-ink); filter: drop-shadow(0 1px 1px var(--chk-shadow)); }

/* 12 · SWATCHES, HEX, COLOUR POPOVER ---------------------------------------- */
.swatches { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
button.sw { position: relative; width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 50%; transition: background-color var(--t-color) var(--ease-out), transform var(--t-press) var(--ease-out); }
button.sw:not([aria-pressed='true']):hover { background: var(--hover); }
.sw-dot { position: relative; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background-color: var(--c); box-shadow: inset 0 0 0 1px var(--sw-edge, var(--ring)); transition: box-shadow var(--t-color) var(--ease-out); }
.sw-dot.checker { --check-size: 10px; background-position: 1px 1px; }
button.sw.needs-edge { --sw-edge: var(--edge); }
button.sw[aria-pressed='true'] .sw-dot { box-shadow: inset 0 0 0 1px var(--sw-edge, var(--ring)), 0 0 0 2px var(--surface), 0 0 0 4px var(--solid); }
.chk { display: none; width: 16px; height: 16px; stroke-width: 2.6; }
[aria-pressed='true'] .chk { display: block; }
.sw-dot.wheel { background: conic-gradient(#ff3b3b, #ffb23b, #f5f53b, #3bd96b, #3bc6f5, #3b5bff, #b63bff, #ff3b9d, #ff3b3b); }
.sw-dot .plus { width: 14px; height: 14px; display: grid; place-items: center; border-radius: 50%; background: var(--surface); color: var(--ink); }
.sw-dot .plus .i { width: 10px; height: 10px; stroke-width: 2.6; }
.pen { position: absolute; right: -1px; bottom: -1px; width: 14px; height: 14px; display: grid; place-items: center; border-radius: 50%; background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--edge); }
.pen .i { width: 9px; height: 9px; stroke-width: 2.4; }
.hex {
  width: 96px; height: 36px; margin-left: 4px; flex: none; display: inline-flex; align-items: center; gap: 1px; padding: 0 10px;
  border-radius: var(--radius-xs); background: var(--well); box-shadow: inset 0 0 0 1px var(--edge); transition: box-shadow var(--t-color) var(--ease-out);
}
.hex > span { font-size: var(--fs-label); color: var(--ink-faint); }
.hex input { width: 100%; height: 100%; min-width: 0; padding: 0; border: 0; background: none; outline: none; font-size: var(--fs-label); font-weight: 500; letter-spacing: .02em; text-transform: uppercase; font-variant-numeric: tabular-nums; color: var(--ink); }
.hex input::placeholder { color: var(--ink-faint); opacity: 1; text-transform: none; letter-spacing: 0; }
.hex:focus-within, .val:focus-within { box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--focus-glow); }
.hex.is-bad, .val.is-bad { box-shadow: inset 0 0 0 1px var(--bad), 0 0 0 3px var(--bad-glow); }
.hex.is-none:not(:focus-within) > span { display: none; }
@container (max-width: 336px) { .swatches .hex { margin-left: 0; flex-basis: 100%; max-width: 116px; } }
.cpop { width: 248px; padding: 12px; }
.cpop-row { display: flex; align-items: center; gap: 10px; }
.cpop .hex { flex: 1; width: auto; height: 40px; margin: 0; }
.cpop .eyebrow { padding: 12px 0 6px; }
.cpop .cp-name { padding: 0 0 8px; }
.cp-native { position: relative; width: 40px; height: 40px; flex: none; border-radius: 50%; }
.cp-native input { display: block; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.cp-native input::-webkit-color-swatch-wrapper { padding: 0; }
.cp-native input::-webkit-color-swatch { border: 0; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--edge); }
.cp-native input::-moz-color-swatch { border: 0; border-radius: 50%; }
.cp-recent { display: flex; flex-wrap: wrap; gap: 4px; font-size: var(--fs-meta); line-height: 18px; color: var(--ink-soft); }
.cp-recent button.sw { width: 36px; height: 36px; }
.cp-recent .sw-dot { width: 28px; height: 28px; }

/* 13 · SWITCH ROWS, SLIDERS, STEPPER ---------------------------------------- */
.switch-row { position: relative; min-height: 56px; margin: 0 -12px; padding: 6px 12px; display: flex; align-items: center; gap: 16px; border-radius: var(--radius-sm); cursor: pointer; transition: background-color var(--t-color) var(--ease-out); }
.switch-row:hover { background: var(--hover-soft); }
.switch-row:has(.switch:focus-visible) { outline: 2px solid var(--accent); outline-offset: 0; }
.switch-row button.info { z-index: 2; }
.switch-row:has(.switch[aria-disabled='true']) { cursor: not-allowed; color: var(--ink-faint); }
.switch-t { display: flex; align-items: center; gap: 4px; font-size: var(--fs-body); line-height: 20px; font-weight: 600; color: var(--ink); }
.switch-s { display: block; font-size: var(--fs-meta); line-height: 18px; color: var(--ink-soft); }
.switch { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; border-radius: var(--radius-sm); background: none; cursor: pointer; -webkit-appearance: none; appearance: none; }
.switch:focus-visible { outline: none; }
.track { position: relative; width: 44px; height: 26px; flex: none; border-radius: var(--radius-pill); background: var(--well); box-shadow: inset 0 0 0 1px var(--edge); transition: background-color var(--t-color) var(--ease-out), box-shadow var(--t-color) var(--ease-out); }
.track::before { content: ''; position: absolute; top: 4px; left: 4px; width: 18px; height: 18px; border-radius: 50%; background: var(--ink-soft); transition: transform var(--t-move) var(--ease-out), background-color var(--t-color) var(--ease-out); }
.switch:checked + .track { background: var(--solid); box-shadow: inset 0 0 0 1px var(--solid); }
.switch:checked + .track::before { transform: translateX(18px); background: var(--solid-ink); }
.switch[aria-disabled='true'] + .track { background: transparent; box-shadow: none; outline: 1px dashed var(--edge); outline-offset: -1px; }
.slider + .slider, .reveal > .slider + .slider { margin-top: 0; }
.sec > .slider + .slider { margin-top: 16px; }
.sec > .slider + .switch-row { margin-top: 12px; }
.sl-row { display: flex; align-items: center; gap: 12px; }
.sl-track { position: relative; flex: 1; min-width: 0; height: 36px; }
.range { --f: .5; display: block; width: 100%; height: 36px; margin: 0; background: transparent; cursor: pointer; -webkit-appearance: none; appearance: none; }
.range::-webkit-slider-runnable-track { height: 6px; border-radius: var(--radius-pill); background: linear-gradient(var(--accent), var(--accent)) 0 0 / calc(10px + (100% - 20px) * var(--f)) 100% no-repeat, var(--well); box-shadow: inset 0 0 0 1px var(--edge); }
.range::-webkit-slider-thumb { width: 20px; height: 20px; margin-top: -7px; border-radius: 50%; border: 2px solid var(--surface); background: var(--solid); box-shadow: var(--shadow-thumb); transition: transform var(--t-press) var(--ease-out); -webkit-appearance: none; }
.range:active::-webkit-slider-thumb { transform: scale(1.1); }
.range::-moz-range-track { height: 6px; border-radius: var(--radius-pill); background: var(--well); box-shadow: inset 0 0 0 1px var(--edge); }
.range::-moz-range-progress { height: 6px; border-radius: var(--radius-pill); background: var(--accent); }
.range::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--surface); background: var(--solid); box-shadow: var(--shadow-thumb); }
.range:focus-visible { outline: none; }
.range:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--accent); outline-offset: 2px; }
.range:focus-visible::-moz-range-thumb { outline: 2px solid var(--accent); outline-offset: 2px; }
.ticks { position: absolute; left: 8.5px; right: 8.5px; top: 27px; height: 3px; display: flex; justify-content: space-between; pointer-events: none; }
.ticks i { width: 3px; height: 3px; border-radius: 50%; background: var(--edge); }
.val { position: relative; width: max(64px, calc(var(--u-pad, 10px) + 30px)); height: 36px; flex: none; display: block; cursor: text; border-radius: var(--radius-xs); background: var(--well); box-shadow: inset 0 0 0 1px var(--edge); transition: box-shadow var(--t-color) var(--ease-out); }
.val input { display: block; width: 100%; height: 100%; padding: 0 var(--u-pad, 10px) 0 4px; border: 0; border-radius: var(--radius-xs); background: none; outline: none; text-align: right; font-size: var(--fs-label); line-height: 20px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--ink); }
.val-u { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: var(--fs-meta); line-height: 18px; color: var(--ink-faint); pointer-events: none; }
.stepper { display: inline-flex; align-items: center; gap: 6px; }
.stepper .icon-btn { width: 36px; height: 36px; }
.stepper .val input { text-align: center; padding: 0 4px; }

/* 14 · FIELDS, UPLOAD TILE, FILE ROW ---------------------------------------- */
.input, .textarea, .select select {
  width: 100%; height: 40px; padding: 0 12px; border: 0; outline: none; border-radius: var(--radius-xs);
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--edge); font-size: var(--fs-input); line-height: 20px; color: var(--ink);
  transition: box-shadow var(--t-color) var(--ease-out), background-color var(--t-color) var(--ease-out);
}
.textarea { display: block; height: auto; min-height: 96px; padding: 10px 12px; line-height: var(--lh-read); resize: vertical; }
:is(.input, .textarea, .select select):focus { box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--focus-glow); }
:is(.input, .textarea)[aria-invalid='true'] { box-shadow: inset 0 0 0 1px var(--bad), 0 0 0 3px var(--bad-glow); }
.select { position: relative; display: block; }
.select select { padding-right: 36px; cursor: pointer; -webkit-appearance: none; appearance: none; }
.select > .i { position: absolute; right: 12px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--ink-soft); pointer-events: none; }
/* a text field with a fixed prefix or suffix ('€', 'px', '@'): <label class="affix"><span class="affix-t">€</span><input class="input"></label> */
.affix { position: relative; display: block; }
.affix > .affix-t { position: absolute; top: 50%; left: 12px; transform: translateY(-50%); font-size: var(--fs-input); line-height: 20px; color: var(--ink-faint); pointer-events: none; }
.affix > .input { padding-left: 30px; }
.affix.end > .affix-t { left: auto; right: 12px; }
.affix.end > .input { padding-left: 12px; padding-right: 40px; }
.input-count { color: var(--ink-faint); }
.input-count.is-max { color: var(--ink); }
.drop-tile {
  width: 100%; min-height: 64px; display: flex; align-items: center; gap: 12px; padding: 12px 16px; text-align: left;
  border: 1px dashed var(--edge); border-radius: var(--radius-md); background: var(--surface); color: var(--ink);
  transition: background-color var(--t-color) var(--ease-out), border-color var(--t-color) var(--ease-out);
}
.drop-tile:hover { background: var(--hover-soft); }
.drop-tile.over { border-color: var(--accent); background: var(--drop-fill); }
.bub-ic { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent-icon); }
.bub-ic .i { width: 18px; height: 18px; }
.file-row { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: var(--radius-md); background: var(--well); }
:is(.sec, .fold-body, .field) > * + .file-row { margin-top: 12px; }
.stage-head .file-row { min-height: 56px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--edge); }
.file-thumb { width: 48px; height: 48px; flex: none; display: grid; place-items: center; overflow: hidden; border-radius: var(--radius-xs); background-color: var(--surface); color: var(--ink-soft); --check-size: 8px; }
.file-thumb > :is(img, video, canvas) { width: 100%; height: 100%; object-fit: contain; display: block; }
.file-meta { flex: 1; min-width: 0; }
.file-name, .file-d { display: block; }
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-label); line-height: 20px; font-weight: 500; color: var(--ink); }
.file-d { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-meta); line-height: 18px; color: var(--ink-faint); }
.drop-tile .file-d { color: var(--ink-soft); }
.privacy { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: var(--fs-meta); line-height: 18px; color: var(--ink-soft); }
.privacy .i { width: 16px; height: 16px; }

/* 15 · BUTTONS AND TOGGLES -------------------------------------------------- */
.icon-btn {
  position: relative; width: 40px; height: 40px; flex: none; display: inline-grid; place-items: center;
  border-radius: var(--radius-pill); background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--edge);
  transition: background-color var(--t-color) var(--ease-out), color var(--t-color) var(--ease-out), transform var(--t-press) var(--ease-out);
}
.pill-btn {
  position: relative; height: 40px; padding: 0 16px 0 12px; flex: none; display: inline-flex; align-items: center; gap: 8px;
  border-radius: var(--radius-pill); background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--edge); font-size: var(--fs-label); font-weight: 500; white-space: nowrap;
  transition: background-color var(--t-color) var(--ease-out), color var(--t-color) var(--ease-out), transform var(--t-press) var(--ease-out);
}
:is(.icon-btn, .pill-btn, .btn-sec, .btn-danger):hover { background: var(--hover); }
:is(.icon-btn, .pill-btn)[aria-expanded='true'], :is(.icon-btn, .pill-btn)[aria-pressed='true'] { background: var(--solid); color: var(--solid-ink); box-shadow: none; }
.btn-primary {
  height: 44px; padding: 0 22px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; border-radius: var(--radius-sm);
  background: var(--solid); color: var(--solid-ink); font-size: var(--fs-body); font-weight: 500; white-space: nowrap;
  transition: background-color var(--t-color) var(--ease-out), color var(--t-color) var(--ease-out), transform var(--t-press) var(--ease-out);
}
.btn-primary:has(.btn-sq) { padding-right: 6px; }
@media (hover: hover) { .btn-primary:hover, .btn-mini:hover { background-color: var(--brand); color: var(--brand-ink); } }
.btn-sq { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: var(--radius-2xs); background: var(--brand); color: var(--brand-ink); }
.btn-sq .i { width: 18px; height: 18px; stroke-width: 2; transition: transform var(--t-move) var(--ease-out); }
@media (hover: hover) { .btn-primary:hover .btn-sq .i { transform: translateX(2px); } }
@media (hover: hover) { .btn-primary:hover .btn-sq { background: var(--solid); } }
.btn-sec, .btn-danger {
  height: 40px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--edge); font-size: var(--fs-label); font-weight: 500; white-space: nowrap;
  transition: background-color var(--t-color) var(--ease-out), transform var(--t-press) var(--ease-out);
}
.btn-danger .i { color: var(--bad); }
.btn-quiet {
  height: 40px; padding: 0 10px; display: inline-flex; align-items: center; gap: 6px; flex: none; border-radius: var(--radius-pill);
  font-size: var(--fs-label); font-weight: 500; color: var(--ink); text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px;
  transition: text-decoration-color var(--t-color) var(--ease-out), background-color var(--t-color) var(--ease-out);
}
.btn-quiet .i { width: 16px; height: 16px; }
.btn-quiet:hover { text-decoration-color: currentColor; background: var(--hover-soft); }
.btn-link { display: inline-flex; align-items: center; min-height: 36px; margin: -6px 0; font-weight: 500; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; transition: color var(--t-color) var(--ease-out); }
.btn-link:hover { color: var(--ink); }
.btn-mini {
  height: 36px; padding: 0 14px; flex: none; border: solid transparent; border-width: 2px 0; border-radius: var(--radius-pill);
  background: var(--solid); background-clip: padding-box; color: var(--solid-ink); font-size: var(--fs-meta); font-weight: 500; white-space: nowrap;
  transition: background-color var(--t-color) var(--ease-out), color var(--t-color) var(--ease-out), transform var(--t-press) var(--ease-out);
}
.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
a:is(.btn-primary, .btn-sec, .btn-danger, .btn-mini, .pill-btn, .icon-btn) { text-decoration: none; }
:is(.btn-primary, .btn-sec, .btn-danger, .btn-mini, .icon-btn, .pill-btn, .toolpal-btn, .floatbar-btn, .drop-tile)[aria-disabled='true'] {
  background: var(--well); color: var(--ink-faint); box-shadow: none; outline: 1px dashed var(--edge); outline-offset: -1px;
}
.btn-sq:is([aria-disabled='true'] *) { background: transparent; color: var(--ink-faint); }
[aria-disabled='true']:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* disabled fields and groups (Kit.disable): dashed edge, faint text, no fill; the reason shows on hover, focus and click */
:is(.input, .textarea, .select select, .hex)[aria-disabled='true'], [aria-disabled='true'] :is(.input, .textarea, .select select, .hex, .val),
.slider[aria-disabled='true'] .val, .stepper[aria-disabled='true'] .val {
  background: transparent; box-shadow: none; outline: 1px dashed var(--edge); outline-offset: -1px; color: var(--ink-faint); cursor: not-allowed;
}
[aria-disabled='true'] :is(.input, .textarea, .val input, .hex input), :is(.input, .textarea)[aria-disabled='true'] { color: var(--ink-faint); cursor: not-allowed; }
.slider[aria-disabled='true'] :is(.label, .sec-title), .stepper[aria-disabled='true'] + .hint, .swatches[aria-disabled='true'] + .hint { color: var(--ink-faint); }
.slider[aria-disabled='true'] .range, input.range[aria-disabled='true'] { pointer-events: none; }
.slider[aria-disabled='true'] .range::-webkit-slider-runnable-track { background: var(--well); }
.slider[aria-disabled='true'] .range::-webkit-slider-thumb { background: var(--edge); box-shadow: none; }
.slider[aria-disabled='true'] .range::-moz-range-progress { background: transparent; }
.slider[aria-disabled='true'] .range::-moz-range-thumb { background: var(--edge); box-shadow: none; }
.slider[aria-disabled='true'] .ticks i { background: var(--rule); }
.seg[role='radiogroup'][aria-disabled='true'] { box-shadow: none; outline: 1px dashed var(--edge); outline-offset: -1px; }
.seg[role='radiogroup'][aria-disabled='true'] [role='radio'] { color: var(--ink-faint); }
.seg[role='radiogroup'][aria-disabled='true'] .seg-ind { background: var(--hover); }
.seg[role='radiogroup'][aria-disabled='true'] [aria-checked='true'] { background-color: var(--hover); color: var(--ink-faint); }
.swatches[aria-disabled='true'] button.sw { opacity: .45; }   /* the swatch colours are content: faded and dashed, never recoloured */
.swatches[aria-disabled='true'] { outline: 1px dashed var(--edge); outline-offset: 2px; border-radius: var(--radius-xs); }
.select:has(select[aria-disabled='true']) > .i, [aria-disabled='true'] .select > .i { color: var(--ink-faint); }

/* 16 · POPOVERS, MENUS, OPTIONS POP ----------------------------------------- */
/* popovers are div.pop (a tool's own .pop class, like Expression's countdown animation, is untouched) */
div.pop {
  position: fixed; z-index: var(--z-pop); left: 0; top: 0; padding: 6px; max-height: calc(100vh - 16px); overflow-y: auto;
  border-radius: var(--radius-md); background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--ring), var(--shadow-pop);
  opacity: 0; visibility: hidden; transform: translateY(6px) scale(.98); transform-origin: var(--origin, top right);
  transition: opacity var(--t-fade) var(--ease-out), transform var(--t-color) var(--ease-out), visibility 0s linear var(--t-color);
}
div.pop.show { opacity: 1; visibility: visible; transform: none; transition: opacity var(--t-fade) var(--ease-out), transform var(--t-color) var(--ease-out), visibility 0s; }
.menu { width: 240px; }
div.pop > .eyebrow { padding: 8px 10px 6px; }
.mi {
  position: relative; width: 100%; min-height: 40px; display: flex; align-items: center; gap: 10px; padding: 0 10px; border-radius: var(--radius-xs);
  font-size: var(--fs-body); line-height: 20px; text-align: left; color: var(--ink); transition: background-color var(--t-fade) var(--ease-out);
}
.mi:hover:not([aria-disabled='true']), .mi:focus-visible { background: var(--hover-soft); }
.mi:focus-visible { outline-offset: -2px; }
.mi .i { width: 18px; height: 18px; color: var(--ink-soft); }
.mi-s { display: block; font-size: var(--fs-meta); line-height: 18px; color: var(--ink-soft); }
.mi.two { min-height: 52px; padding-top: 6px; padding-bottom: 6px; }
.mi-meta { font-size: var(--fs-meta); color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.mi .mi-check, .mi .mi-lock { display: none; }
.mi[aria-checked='true'] .mi-check, .mi[aria-disabled='true'] .mi-lock { display: block; }
.mi .mi-check { color: inherit; }
.mi[aria-disabled='true'] { color: var(--ink-faint); outline: 1px dashed var(--edge); outline-offset: -3px; }
.mi[aria-disabled='true']:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.mi[aria-disabled='true'] .i { color: var(--ink-faint); }
.mi .mi-lock { width: 14px; height: 14px; }
.menu[data-choice] .mi[aria-checked='true'] { background: var(--solid); color: var(--solid-ink); }
.menu[data-choice] .mi[aria-checked='true'] :is(.i, .mi-s) { color: var(--solid-ink-soft); }
.menu[data-choice] .mi[aria-checked='true'] .mi-check { color: var(--solid-ink); }
.menu-sep { height: 1px; margin: 6px 4px; background: var(--rule); }
.menu-note { display: flex; align-items: center; gap: 8px; padding: 6px 10px 8px; font-size: var(--fs-meta); line-height: 18px; color: var(--ink-soft); }
.menu-note .i { width: 16px; height: 16px; }
.opts { width: 248px; }
.opts-cols { width: min(520px, calc(100vw - 32px)); display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 6px; }
.opts-set { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 14px; }
.opts-cols .opts-set { border-left: 1px solid var(--rule); }

/* 17 · TOOLTIP, TOAST, DROP OVERLAY ----------------------------------------- */
.tip {
  position: fixed; z-index: var(--z-tip); left: 0; top: 0; max-width: 260px; padding: 10px 12px; pointer-events: none;
  border-radius: var(--radius-sm); background: var(--tip-bg); color: var(--tip-ink); box-shadow: var(--shadow-tip); font-size: var(--fs-meta); line-height: 18px;
  opacity: 0; transform: translateY(6px); transition: opacity var(--t-fade) var(--ease-out), transform var(--t-move) var(--ease-out);
}
.tip.show { opacity: 1; transform: none; }
.tip b { font-weight: 600; }
.tip code { font: 500 var(--fs-meta)/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.tip kbd, .keys kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: 6px; padding: 0 5px; border-radius: var(--radius-3xs); box-shadow: inset 0 0 0 1px currentColor; }
.tip .tsum { display: flex; align-items: center; gap: 6px; }
/* right, bottom, margin, border and overflow undo the popover defaults: while a modal dialog is open the toast joins the top layer */
.toast {
  position: fixed; z-index: var(--z-toast); left: var(--toast-x, 50%); top: var(--toast-y, 8px); right: auto; bottom: auto; margin: 0; border: 0; overflow: visible; height: 48px; max-width: calc(100vw - 32px);
  display: flex; align-items: center; gap: 10px; padding: 0 18px 0 10px; border-radius: var(--radius-pill); white-space: nowrap;
  background: var(--toast-bg); color: var(--toast-ink); box-shadow: 0 0 0 1px var(--toast-ring), var(--shadow-toast); font-size: var(--fs-body); line-height: 20px;
  opacity: 0; visibility: hidden; transform: translate(-50%, -12px);
  transition: opacity var(--t-color) var(--ease-out), transform var(--t-move) var(--ease-out), visibility 0s linear var(--t-move);
}
.toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); transition: opacity var(--t-color) var(--ease-out), transform var(--t-move) var(--ease-out), visibility 0s; }
.toast.is-sticky { padding-right: 6px; }
.toast-ic { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--toast-ic); color: var(--brand-ink); }
.toast.is-error .toast-ic { background: var(--toast-bad); }
.toast-ic .i { width: 16px; height: 16px; stroke-width: 2.4; }
.toast-msg { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.toast-act { height: 36px; padding: 0 6px; margin-left: 2px; flex: none; border-radius: var(--radius-2xs); font-size: var(--fs-label); font-weight: 600; color: var(--toast-ink); text-decoration: underline; text-underline-offset: 3px; }
.toast-act:hover { text-decoration-thickness: 2px; }
.toast :focus-visible { outline-color: var(--toast-focus); }
.toast-x { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 50%; color: var(--toast-ink); }
.toast-x:hover { background: var(--solid-hover); }
.toast-x .i { width: 16px; height: 16px; }
.drop { position: fixed; z-index: var(--z-drop); top: var(--hdr-h); left: 0; right: 0; bottom: 0; pointer-events: none; opacity: 0; transition: opacity var(--t-fade) var(--ease-out); }
.drop.show { opacity: 1; }
.drop-in { position: absolute; inset: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; border: 2px dashed var(--accent); border-radius: var(--radius-lg); background: var(--drop-fill); }
.drop-in.two { flex-direction: row; gap: 0; padding: 0; border: 0; background: none; }
.drop-target { flex: 1; align-self: stretch; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; margin: 0 6px; border: 2px dashed var(--edge); border-radius: var(--radius-lg); background: var(--drop-fill); opacity: .7; transition: opacity var(--t-fade), border-color var(--t-fade); }
.drop-target.is-hot { border-color: var(--accent); opacity: 1; }
.drop-card, .drop-target { text-align: center; }
.drop-card { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 20px 28px; border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-float); }
.drop-bub { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--brand); color: var(--brand-ink); }
.drop p { font-size: var(--fs-body); line-height: 20px; font-weight: 500; color: var(--ink); }

/* 18 · DIALOGS AND THE PHONE NOTICE ----------------------------------------- */
dialog.dlg {
  width: min(520px, calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: 32px; overflow: auto; border: 0;
  border-radius: var(--radius-xl); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop);
}
dialog.dlg[open] { animation: sf-dlg-in var(--t-sheet) var(--ease-out); }
@keyframes sf-dlg-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
dialog.dlg::backdrop { background: var(--scrim); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
dialog.dlg-sm { width: min(440px, calc(100% - 32px)); padding: 28px; }
dialog.dlg-wide { width: min(760px, calc(100% - 32px)); }
.dlg-x { position: absolute; top: 20px; right: 20px; }
.dlg-title { margin-top: 6px; padding-right: 40px; font: 400 var(--fs-dialog)/36px var(--font-head); letter-spacing: -.01em; color: var(--ink); }
.dlg-sm .dlg-title { margin-top: 0; font-size: var(--fs-sheet); line-height: 28px; }
.dlg-sm .eyebrow + .dlg-title { margin-top: 4px; }
.dlg-body { margin-top: 12px; font-size: var(--fs-body); line-height: var(--lh-read); color: var(--ink-soft); }
.steps { margin-top: 24px; display: flex; flex-direction: column; gap: 18px; }
.steps li { display: flex; gap: 14px; }
.step-n { width: 28px; height: 28px; margin-top: -2px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--solid); color: var(--solid-ink); font-size: var(--fs-label); font-weight: 600; }
.steps p { font-size: var(--fs-body); line-height: var(--lh-read); color: var(--ink); }
.steps .btn-link { margin: 0; font-size: var(--fs-label); }
.dlg-foot { margin-top: 26px; padding-top: 20px; display: flex; align-items: center; gap: 16px; border-top: 1px solid var(--rule); }
.dlg-meta { flex: 1; font-size: var(--fs-meta); line-height: 18px; color: var(--ink-faint); text-wrap: balance; }
.dlg-actions { margin-top: 24px; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 10px; }
.keys { margin-top: 20px; display: flex; flex-direction: column; }
.keys li { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--rule); font-size: var(--fs-body); }
.keys li:first-child { border-top: 0; }
.keys .eyebrow { padding-top: 16px; border-top: 0; min-height: 0; }
.keys .k { display: flex; gap: 4px; flex: none; }
.keys kbd { min-width: 28px; height: 28px; margin: 0; padding: 0 8px; border-radius: var(--radius-2xs); background: var(--well); box-shadow: inset 0 0 0 1px var(--edge); font-weight: 500; color: var(--ink); }
.dlg-icon { width: 56px; height: 56px; margin-bottom: 16px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent-icon); }
.dlg-icon .i { width: 28px; height: 28px; stroke-width: 1.5; }
.dlg-notice .dlg-actions { flex-direction: column; align-items: stretch; }
.dlg-notice .dlg-actions > * { width: 100%; justify-content: center; }
.dlg-notice .btn-primary:has(.btn-sq) { justify-content: space-between; height: auto; min-height: 48px; padding-left: 22px; white-space: normal; text-align: left; }

/* 19 · ITEM LISTS AND ROWS -------------------------------------------------- */
.items { display: flex; flex-direction: column; gap: 8px; }
/* rows of Kit.items are .items > .item (a tool's own .item class, like Moodboard's board items, is untouched) */
.items > .item { border-radius: var(--radius-md); background: var(--surface); box-shadow: inset 0 0 0 1px var(--edge); }
.items > .item[open] { box-shadow: inset 0 0 0 1px var(--ink-soft); }
.item-head { min-height: 56px; display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 10px; cursor: pointer; list-style: none; border-radius: var(--radius-md); }
.item-head::-webkit-details-marker { display: none; }
.item-head:hover { background: var(--hover-soft); }
.item-head:focus-visible { outline-offset: -2px; }
.item-head > .i { color: var(--ink-soft); transition: transform var(--t-move) var(--ease-out); }
.items > .item[open] > .item-head > .i { transform: rotate(180deg); }
.item-lead { width: 32px; height: 32px; flex: none; display: grid; place-items: center; overflow: hidden; border-radius: 50%; background: var(--well); color: var(--ink-soft); font-size: var(--fs-meta); font-weight: 600; }
.item-lead > img { width: 100%; height: 100%; object-fit: cover; }
.item-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-body); line-height: 20px; font-weight: 500; color: var(--ink); }
.item-meta { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-meta); line-height: 18px; color: var(--ink-soft); }
.item-body { padding: 4px 12px 12px; display: flex; flex-direction: column; gap: 14px; animation: sf-fade .35s var(--ease-out); }
.item-body > .items { padding-left: 12px; border-left: 2px solid var(--rule); }
.item-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-top: 10px; border-top: 1px solid var(--rule); }
.item-actions .btn-danger { margin-left: auto; }
.items-add { position: sticky; bottom: 0; align-self: flex-start; z-index: 1; }
.rows { display: flex; flex-direction: column; gap: 8px; }
.row { min-height: 44px; display: flex; align-items: center; gap: 8px; }
.row > .input { flex: 1 1 auto; min-width: 0; }
.row > button.sw { width: 36px; height: 36px; }
.row > button.sw .sw-dot { width: 28px; height: 28px; }
.row-opt { min-height: 44px; display: inline-flex; align-items: center; gap: 6px; flex: none; font-size: var(--fs-meta); color: var(--ink); cursor: pointer; }
.row-opt input { width: 18px; height: 18px; margin: 0; accent-color: var(--solid); }

/* 20 · TRANSPORT, TOOL PALETTES --------------------------------------------- */
.transport { width: 100%; height: 48px; display: flex; align-items: center; gap: 10px; padding: 0 12px 0 4px; border-radius: var(--radius-pill); background: var(--surface); box-shadow: inset 0 0 0 1px var(--status-ring); }
.tray-head .transport { width: auto; flex: 1 1 auto; box-shadow: none; background: none; padding: 0; }
.icon-btn.play { background: var(--solid); color: var(--solid-ink); box-shadow: none; }
.icon-btn.play:hover { background: var(--brand); color: var(--brand-ink); }
.icon-btn.play .i { width: 18px; height: 18px; }
.icon-btn.play[aria-pressed='true'] .i-play, .icon-btn.play:not([aria-pressed='true']) .i-pause { display: none; }
.transport .sl-track { flex: 1 1 auto; }
.scrub-marks { position: absolute; left: 10px; right: 10px; top: 25px; height: 6px; pointer-events: none; }
.scrub-marks i { position: absolute; top: 0; width: 2px; height: 6px; margin-left: -1px; border-radius: 1px; background: var(--edge); }
.transport .time { flex: none; font-size: var(--fs-meta); line-height: 18px; color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.toolpal, .floatbar {
  position: fixed; z-index: var(--z-tool); display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px;
  border-radius: var(--radius-pill); border: 1px solid var(--dock-line); background: var(--dock-solid); box-shadow: var(--dock-shadow);
}
.toolpal { left: var(--gutter); top: calc(var(--hdr-h) + (100vh - var(--hdr-h) - var(--dock-zone)) / 2); transform: translateY(-50%); }
.toolpal-btn, .floatbar-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: var(--ink); transition: background-color var(--t-color) var(--ease-out), color var(--t-color) var(--ease-out), transform var(--t-press) var(--ease-out); }
.floatbar-btn { width: 40px; height: 40px; }
:is(.toolpal-btn, .floatbar-btn):hover { background: var(--chip-hover); }
:is(.toolpal-btn, .floatbar-btn)[aria-pressed='true'] { background: var(--solid); color: var(--solid-ink); }
.toolpal-div, .floatbar-div { width: 32px; height: 1px; margin: 2px 0; background: var(--dock-div); }

/* 21 · PROGRESS, PULSE, EMPTY STATE, PAGE MODE ------------------------------ */
.progress { height: 6px; border-radius: var(--radius-pill); background: linear-gradient(var(--accent), var(--accent)) 0 0 / calc(var(--p, 0) * 100%) 100% no-repeat, var(--well); box-shadow: inset 0 0 0 1px var(--edge); }
.spinner { width: 16px; height: 16px; flex: none; display: inline-block; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: sf-spin .8s linear infinite; }
@keyframes sf-spin { to { transform: rotate(1turn); } }
.pulse { animation: sf-pulse 1s var(--ease-out) 2; }
@keyframes sf-pulse { from { box-shadow: 0 0 0 0 var(--pulse); } to { box-shadow: 0 0 0 14px transparent; } }
.empty { position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; padding: 24px; }
.empty-ghost { position: absolute; inset: 12px; opacity: .1; color: var(--ink); pointer-events: none; }
.empty-ghost > svg { width: 100%; height: 100%; display: block; }
.empty-card { position: relative; max-width: 320px; padding: 16px 20px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-float); }
.empty-t { font-size: var(--fs-body); line-height: 20px; font-weight: 500; color: var(--ink); }
.empty-d { font-size: var(--fs-meta); line-height: 18px; color: var(--ink-soft); }
.empty-card .btn-row { margin-top: 12px; justify-content: center; }
.empty-card .privacy { margin-top: 10px; justify-content: center; }
body[data-layout='page'] .hdr { position: sticky; top: 0; transition: background-color var(--t-color) var(--ease-out), box-shadow var(--t-color) var(--ease-out); }
body[data-layout='page'] .hdr.is-stuck { background: var(--hdr-frost); box-shadow: 0 1px 0 var(--rule); -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2); }
.page { position: relative; z-index: var(--z-stage); max-width: 1180px; margin: 0 auto; padding: 24px clamp(16px, 4vw, 40px) 64px; }
.page-hero { max-width: var(--col-max); margin: 24px auto 40px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.page-hero h1 { font: 400 var(--fs-hero)/1.05 var(--font-head); letter-spacing: -.02em; color: var(--ink); }
.page-hero > p:not(.readout) { font-size: var(--fs-body); line-height: var(--lh-read); color: var(--ink-soft); }
.page-foot a { display: inline-flex; align-items: center; min-height: 36px; }
.page-foot { position: relative; z-index: var(--z-stage); padding: 24px var(--gutter) 40px; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0 16px; font-size: var(--fs-meta); color: var(--ink-soft); }

/* the one checker (artboards 16px, swatches 10px, thumbnails 8px): after every component, so it wins */
.checker, .artboard[data-checker] {
  background-color: var(--check-a);
  background-image: conic-gradient(var(--check-b) 25%, transparent 0 50%, var(--check-b) 0 75%, transparent 0);
  background-size: var(--check-size, 16px) var(--check-size, 16px);
}

/* 22 · RESPONSIVE, TOUCH, REDUCED MOTION ------------------------------------ */
@media (max-width: 1039px) {
  .seg-strip { width: 100%; }
  .seg-strip [role='radio'] { flex: 1 1 0; padding: 0 8px; }
  .tile-cap.two { white-space: normal; text-align: center; line-height: 15px; }
}
@media (max-width: 1279px) {
  .stage-foot:has(.transport) { flex-direction: column; }
}
@media (max-width: 760px) {
  .hdr { gap: 6px; }
  .hdr-brand { gap: 6px; }
  .wordmark { height: 44px; }
  .wordmark svg { height: 19px; }
  .crumbs { gap: 5px; }
  .crumbs a { min-height: 44px; padding: 0 4px; margin: 0 -4px; background-position: 4px calc(100% - 9px); }
  .hdr-end { gap: 4px; }
  body:not([data-layout='page']) .theme-btn { display: none; }
  .hdr .pill-btn { width: 44px; height: 44px; padding: 0; justify-content: center; }
  .hdr .pill-l { display: none; }
  .hdr .pill-dot { position: absolute; top: 6px; right: 6px; }
  .stage { bottom: var(--dock-h); overflow-x: hidden; overflow-y: auto; }
  .stage-col { position: relative; left: 0; top: 0; width: 100%; min-height: 100%; margin: 0; padding: 16px 16px 40px; transform: none; justify-content: safe center; }
  body[data-fit='inset'] .stage-col { position: relative; inset: auto; height: 100%; padding: 12px 16px; }
  .seg-strip { height: 48px; overflow-x: auto; scrollbar-width: none; }
  .seg-strip [role='radio'] { height: 44px; padding: 0 10px; gap: 6px; }
  .hero-field { min-height: 48px; padding-left: 14px; gap: 10px; }
  .hero-input { padding: 13px 0; line-height: 22px; }
  .hero-field.is-multi { padding-top: 13px; padding-bottom: 13px; }
  .hero-clear { width: 44px; height: 44px; }
  .hero-field.is-multi .hero-clear { margin: -11px 0; }
  .stage-head + :is(.subject, .subjects) { margin-top: 16px; }
  :is(.subject, .subjects) + .stage-foot { margin-top: 12px; }
  .status { height: 52px; }
  .status .status-d { display: none; }
  .status .btn-mini { height: 44px; }
  .tray { position: relative; left: auto; right: auto; bottom: auto; width: 100%; margin-top: 16px; }
  /* the tray is the last child of main.stage: on phones it follows the column in the scrolling stage */
  .stage-col:has(~ .tray) { min-height: 0; padding-bottom: 0; }
  .stage > .tray { width: auto; margin: 16px 16px 24px; }
  .toolpal { position: relative; left: auto; top: auto; transform: none; flex-direction: row; align-self: center; margin-bottom: 8px; }
  .floatbar { flex-direction: row; }
  .toolpal-div, .floatbar-div { width: 1px; height: 32px; margin: 0 2px; }
  .floatbar-btn { width: 44px; height: 44px; }
  .dock, .dock.is-compact { left: 0; right: 0; bottom: 0; width: auto; max-width: none; height: var(--dock-h); transform: none; gap: 0; padding: 6px 12px calc(6px + env(safe-area-inset-bottom, 0px)); border-width: 1px 0 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .dock-chips { flex: 1; overflow-x: auto; scrollbar-width: none; gap: 2px; padding: 4px 2px; scroll-padding: 0 8px; -webkit-mask: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
  .dock-chips.at-end { -webkit-mask: none; mask: none; }
  .chip, .dock.is-compact .chip { width: 64px; height: 58px; flex-direction: column; justify-content: center; gap: 2px; padding: 2px 0 0; border-radius: var(--radius-chip); }
  .chip-l { display: none; }
  .chip-s { display: block; font-size: var(--fs-meta); line-height: 16px; }
  .chip .mdot { top: 4px; left: calc(50% + 10px); }
  .split { height: 48px; border-radius: var(--radius-split); }
  .split-main, .split[data-split] .split-main { width: 52px; height: 48px; padding: 0; flex-direction: column-reverse; justify-content: center; gap: 0; border-radius: var(--radius-split) 0 0 var(--radius-split); }
  .split:not([data-split]) .split-main { border-radius: var(--radius-split); }
  .split-long, .split-val { display: none; }
  .split-short { display: inline; font-size: var(--fs-meta); line-height: 16px; }
  .split-sq { width: 24px; height: 22px; background: none; color: inherit; }
  .split-more { min-width: 44px; width: 44px; padding: 0; border-radius: 0 var(--radius-split) var(--radius-split) 0; }
  .sheet {
    left: 0; right: 0; top: auto; bottom: var(--dock-h); width: auto; max-height: none;
    height: calc(100dvh - var(--hdr-h) - var(--dock-h) - var(--phone-band)); border-radius: var(--radius-xl) var(--radius-xl) 0 0; transform: translateY(24px);
  }
  .sheet-grab { display: block; flex: none; width: 36px; height: 4px; margin: 8px auto 0; border-radius: var(--radius-pill); background: var(--edge); }
  .panel-head { min-height: 64px; padding: 10px 12px 10px 20px; }
  .panel-desc { font-size: var(--fs-meta); line-height: 18px; }
  .panel-body { padding: 4px 20px 24px; }
  body.sheet-open :is(.stage-head, .stage-foot:not(:has([data-phone-keep])), .stage-foot > :not([data-phone-keep]), .vignette, .tray) { display: none; }
  body.sheet-open .stage { overflow: hidden; }
  body.sheet-open .stage-col { min-height: 0; padding-top: 12px; padding-bottom: 0; justify-content: flex-start; }
  body.sheet-open .stage-col > :is(.subject, .subjects) { margin-top: 0; }
  body.sheet-open[data-fit='inset'] .stage-col { height: var(--phone-band); }
  body.sheet-open .mini-status { display: flex; align-items: center; gap: 6px; height: 18px; margin-top: 6px; font-size: var(--fs-meta); line-height: 18px; color: var(--ink); }
  .mini-status .i { width: 16px; height: 16px; }
  .first-hint { bottom: calc(var(--dock-h) + 8px); }
  .toast { top: max(4px, env(safe-area-inset-top, 0px)); }
  .hex input, .val input, .hex > span { font-size: 16px; }
  .hex { width: 116px; }
  .menu, .opts { width: min(280px, calc(100vw - 32px)); }
  .opts-cols { grid-template-columns: minmax(0, 1fr); }
  .opts-cols .opts-set { border-left: 0; border-top: 1px solid var(--rule); }
  .presets { gap: 10px; }
  dialog.dlg { padding: 24px 20px; }
  dialog.dlg-notice { width: 100%; max-width: none; max-height: 90dvh; margin: auto 0 0; padding: 12px 20px calc(20px + env(safe-area-inset-bottom, 0px)); border-radius: var(--radius-xl) var(--radius-xl) 0 0; }
  dialog.dlg-notice[open] { animation-name: sf-sheet-up; }
  .dlg-notice .sheet-grab { margin: 0 auto 20px; }
  .dlg-notice :is(.dlg-body, .btn-primary, .btn-sec) { font-size: var(--fs-body); }
  .dlg-notice .dlg-actions > * { height: 48px; }
  @keyframes sf-sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
}
@media (max-width: 760px), (pointer: coarse) {
  .icon-btn, button.info, .hero-clear, button.sw { width: 44px; height: 44px; }
  button.info { margin: -12px -8px; }
  .pchip { height: 44px; }
  .seg [role='radio'] { height: 44px; }
  .seg-full { height: 52px; }
  .seg-two { height: 60px; }
  .seg-two [role='radio'] { height: 52px; }
  .sl-track, .range { height: 44px; }
  .ticks { top: 31px; }
  .scrub-marks { top: 29px; }
  .val { width: max(68px, calc(var(--u-pad, 10px) + 34px)); height: 44px; }
  .hex, .input, .select select, .btn-sec, .btn-danger, .btn-quiet, .btn-mini, .pill-btn, .toast-act, .toast-x { height: 44px; }
  .mi { min-height: 44px; }
  .btn-link { min-height: 44px; }
  .more-cue { height: 44px; padding: 0 16px 0 12px; }
  .stepper .icon-btn { width: 44px; height: 44px; }
  .btn-primary { height: 48px; }
  /* the custom colour popover, recent and row swatches, the status pill's '+N more' and the readout's link */
  .cpop .hex, .cp-native, .cp-native input { height: 44px; }
  .cp-native, .cp-native input { width: 44px; }
  .cp-recent button.sw, .row > button.sw { width: 44px; height: 44px; }
  .status { height: 52px; }
  .status .btn-mini, .status-more { height: 44px; }
  .readout .btn-link { min-height: 44px; margin: -13px 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-property: opacity, background-color, color, border-color, box-shadow !important; transition-duration: var(--t-fade) !important; }
  .ground::before { animation: none !important; }
  .sheet, div.pop, .tip { transform: none !important; }
  .toast, .toast.show { transform: translateX(-50%) !important; }
  .stage-col { transform: translateX(var(--shift, 0px)) !important; }
  .pulse { outline: 2px solid var(--accent) !important; outline-offset: 2px; }
  .spinner { animation: sf-spin 1.6s linear infinite !important; }
}
html.kit-init *, html.kit-init *::before { transition: none !important; }
