/* croqi app: a work tool. Dense, quiet, one accent. The marketing page has its own look in home.css.
   app.css: tokens, the rail and the controls every screen shares. board.css: the library. work.css: the part and generation screens. */
:root {
  /* v7 "Atölye": a graphite workspace in Illustrator's grammar. The drawing is the only white thing on
     screen; one steel accent for what you can press or have chosen; status inks stay quiet. */
  --frame: #18191b;
  --page: #1f2022;
  --surface: #28292c;
  --raise: #313336;
  --paste: #3a3c40;
  --ink: #ececec;
  --ink-muted: #a4a8ad;
  --line: #ffffff17;
  --line-strong: #ffffff2b;
  --accent: #6ea9e3;
  --accent-fill: #2d6aa0;
  --accent-deep: #3479b5;
  --accent-wash: #6ea9e326;
  --danger: #ff8078;
  --ok: #62c795;
  --amber: #e6b857;
  --r-1: 6px;
  --r-2: 10px;
  --control-h: 32px;
  --night: #18191b;
  --night-2: #232427;
  --night-line: #ffffff14;
  --night-text: #c9cdd1;
  --night-muted: #8d9298;
  --strip-w: 52px;
  --bar-h: 44px;
  --status-h: 26px;
  --font-ui: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'DM Mono', ui-monospace, Menlo, monospace;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --dur-press: 140ms;
  --dur-ui: 180ms;
  --shadow-lift: 0 8px 20px -10px #00000080;
  --shadow-pop: 0 18px 40px -14px #000000b3, 0 2px 6px #00000059;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 400 13px/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 20px; letter-spacing: -.01em; }
h2 { font-size: 15px; }
h3 { font-size: 11px; font-family: var(--font-mono); font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.quiet { margin: 0; color: var(--ink-muted); font-size: 12px; }
kbd { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; background: #ffffff08; color: var(--ink-muted); font: 500 11px/1 var(--font-mono); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* one icon set: a 16px sprite in app.html, drawn with the text colour */
.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  height: var(--control-h); padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: var(--r-1);
  background: var(--surface); color: var(--ink); font-weight: 600; white-space: nowrap; text-decoration: none;
}
.btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn-primary { border-color: var(--accent-fill); background: var(--accent-fill); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-deep); border-color: var(--accent-deep); color: #fff; }
.btn-quiet { border-color: transparent; background: transparent; color: var(--ink-muted); font-weight: 500; }
.btn-quiet:hover { color: var(--danger); border-color: var(--line); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-muted); font-weight: 500; }
.btn-ghost:hover:not(:disabled) { border-color: transparent; background: #ffffff0f; color: var(--ink); }
.btn-danger { border-color: #b3382c; background: #b3382c; color: #fff; }   /* the brick fill; --danger is the text ink */
.btn-danger:hover:not(:disabled) { background: #8b2e25; border-color: #8b2e25; color: #fff; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
label.btn { position: relative; overflow: hidden; }
label.btn input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.icon-btn { display: grid; place-items: center; width: 30px; height: 30px; flex: none; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--ink-muted); }
.icon-btn:hover:not(:disabled) { background: #ffffff12; color: var(--ink); }
.icon-btn[aria-pressed="true"] { color: var(--amber); }
.icon-btn[aria-pressed="true"] .i { fill: currentColor; }
.tool {
  white-space: nowrap;
  height: 26px; padding: 0 9px;
  border: 1px solid var(--line); border-radius: var(--r-1);
  background: var(--surface); color: var(--ink-muted);
  font: 500 11px/1 var(--font-mono);
}
.tool:hover { color: var(--accent); border-color: var(--accent); }
.tool[aria-pressed="true"] { background: var(--accent-wash); border-color: var(--accent); color: var(--accent); }

/* ---------- the shell: an application bar, a tool strip, the work, a status bar ---------- */
.shell {
  display: grid; grid-template-columns: var(--strip-w) minmax(0, 1fr); grid-template-rows: var(--bar-h) minmax(0, 1fr) var(--status-h);
  height: 100vh; height: 100dvh; background: var(--page);
}
.main { grid-column: 2; grid-row: 2; min-width: 0; min-height: 0; overflow: auto; }

.topbar { grid-column: 1 / -1; display: flex; align-items: stretch; min-width: 0; background: var(--frame); border-bottom: 1px solid var(--line); }
.brand { display: grid; place-items: center; width: var(--strip-w); flex: none; border-right: 1px solid var(--line); text-decoration: none; }
.brand img { display: block; width: 22px; height: 22px; border-radius: 5px; }
.doc-tabs { display: flex; align-items: stretch; min-width: 0; overflow: hidden; }
.doc-tab {
  position: relative; display: flex; align-items: center; gap: 8px; max-width: 220px; min-width: 0; padding: 0 8px 0 14px;
  border: 0; border-right: 1px solid var(--line); background: transparent; color: var(--ink-muted); font-size: 12.5px; white-space: nowrap;
}
.doc-tab:hover { color: var(--ink); background: #ffffff06; }
.doc-tab.is-active { color: var(--ink); background: var(--surface); }
.doc-tab.is-active::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--accent); }
.doc-tab-name { overflow: hidden; text-overflow: ellipsis; }
.doc-tab-x { display: grid; place-items: center; width: 20px; height: 20px; flex: none; border-radius: 4px; color: var(--ink-muted); opacity: 0; }
.doc-tab:hover .doc-tab-x, .doc-tab.is-active .doc-tab-x, .doc-tab-x:focus-visible { opacity: 1; }
.doc-tab-x:hover { background: #ffffff14; color: var(--ink); }
.doc-tab-x .i { width: 12px; height: 12px; }
.topbar-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; padding: 0 12px; }
.cmd {
  display: flex; align-items: center; gap: 8px; width: 300px; height: 30px; padding: 0 6px 0 10px;
  border: 1px solid var(--line); border-radius: 7px; background: var(--raise); color: var(--ink-muted); text-align: left;
}
.cmd span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmd:hover { border-color: var(--line-strong); color: var(--ink); }

/* the live queue: a chip that says what is running, a list behind it */
.jobs { position: relative; }
.queue-chip {
  display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 8px 0 10px;
  border: 1px solid var(--line); border-radius: 7px; background: transparent; color: var(--ink); font-size: 12px; font-weight: 500;
}
.queue-chip:hover, .queue-chip[aria-expanded="true"] { border-color: var(--line-strong); }
.queue-chip .i { color: var(--ink-muted); }
.queue-dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--ok); }
.queue-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 360px; padding: 6px 0;
  border: 1px solid var(--line-strong); border-radius: var(--r-2); background: var(--surface); box-shadow: var(--shadow-pop);
}
.queue-pop-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0; padding: 8px 14px 8px; }
.queue-pop-head b { font-size: 13px; }
.queue-pop-head span { color: var(--ink-muted); font-size: 12px; }
.jobs ul { display: grid; margin: 0; padding: 0; list-style: none; font-size: 12.5px; }
.jobs li + li { border-top: 1px solid var(--line); }
.jobs-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; width: 100%; padding: 10px 14px; border: 0; background: transparent; color: var(--ink); text-align: left; font: inherit; }
.jobs-row > :first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jobs-row > :last-child { font: 500 11px var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink-muted); }
button.jobs-row { cursor: pointer; }
button.jobs-row:hover { background: #ffffff08; }
.jobs-row.is-queued > :first-child { color: var(--ink-muted); }   /* waiting for a free slot: quieter than what is running */

/* the tool strip: icons, their names on hover, the address decides which one is marked */
.side {
  grid-column: 1; grid-row: 2; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0;
  background: var(--frame); border-right: 1px solid var(--line); color: var(--night-muted);
}
.side-nav { display: grid; gap: 2px; }
.side-rule { width: 24px; margin: 8px 0; border: 0; border-top: 1px solid var(--line); }
.side-foot { margin-top: auto; }
.side-item {
  position: relative; display: grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border: 0; border-radius: 8px; background: transparent; color: inherit;
}
.side-item .i { width: 18px; height: 18px; }
.side-label, .side-item .count { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.side-item.is-active, .side-item[aria-current="page"] { background: #ffffff14; color: var(--ink); }
.side-item.is-active::before { content: ""; position: absolute; left: -8px; top: 9px; bottom: 9px; width: 2px; border-radius: 2px; background: var(--accent); }
[data-tip] { position: relative; }
.side-item[data-tip]::after, #keysOpen[data-tip]::after {
  content: attr(data-tip); position: absolute; z-index: 40; left: calc(100% + 10px); top: 50%; transform: translate(-4px, -50%);
  padding: 6px 9px; border: 1px solid var(--line-strong); border-radius: 6px; background: #0e0f10; color: var(--ink);
  font: 500 12px/1.2 var(--font-ui); white-space: nowrap; pointer-events: none; opacity: 0;
  transition: opacity 120ms ease, transform var(--dur-ui) var(--ease-out);
}
#keysOpen[data-tip]::after { left: auto; right: 0; top: calc(100% + 8px); transform: translateY(-4px); }
.side-item:hover::after, .side-item:focus-visible::after, #keysOpen:hover::after, #keysOpen:focus-visible::after { opacity: 1; transform: translate(0, -50%); }
#keysOpen:hover::after, #keysOpen:focus-visible::after { transform: none; }

/* the status bar: where you are on the left, the keys that work here on the right */
.statusbar {
  grid-column: 1 / -1; grid-row: 3; display: flex; align-items: center; gap: 16px; min-width: 0; padding: 0 12px;
  background: var(--frame); border-top: 1px solid var(--line); color: var(--ink-muted); font-size: 11.5px; white-space: nowrap; overflow: hidden;
}
.status-left, .status-right { display: flex; align-items: center; gap: 12px; min-width: 0; }
.status-right { margin-left: auto; gap: 14px; }
.status-sep { width: 1px; height: 12px; background: var(--line-strong); }
.status-hint { display: inline-flex; align-items: center; gap: 3px; }
.status-hint kbd { height: 16px; min-width: 16px; font-size: 11px; }
.status-ok { color: var(--ok); }

/* the folder column beside the board: folder -> fabric -> garment type, only the branches that exist */
.lib-tree { position: sticky; top: 0; align-self: start; height: calc(100vh - var(--bar-h) - var(--status-h)); height: calc(100dvh - var(--bar-h) - var(--status-h)); padding: 14px 8px; overflow-y: auto; border-right: 1px solid var(--line); background: var(--surface); }
.lib-tree .side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 6px 8px; }
.lib-tree h2 { font: 600 12px/1 var(--font-ui); color: var(--ink-muted); }
.side-add { padding: 3px 6px; border: 0; border-radius: 5px; background: transparent; color: var(--ink-muted); font: 500 12px var(--font-ui); }
.side-add:hover { background: #ffffff0f; color: var(--ink); }
#seasonTree { display: grid; gap: 1px; }
.tree-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; min-height: 30px; padding: 4px 8px; border: 0; border-radius: 6px;
  background: transparent; color: var(--ink-muted); text-align: left; font-size: 12.5px;
}
.tree-item:hover { background: #ffffff0a; color: var(--ink); }
.tree-item.is-active { background: #ffffff14; color: var(--ink); font-weight: 600; }
.tree-label { display: flex; align-items: center; gap: 9px; min-width: 0; }
.tree-dot { width: 8px; height: 8px; flex: none; border-radius: 2px; background: var(--night-muted); }
.tree-count { color: var(--ink-muted); font: 500 11px var(--font-mono); }
.tree-item.is-active .tree-count { color: var(--ink); }
.tree-level-0 { font-weight: 600; color: var(--ink); }
.tree-level-1 { padding-left: 8px; }
.tree-level-2 { padding-left: 25px; font-size: 12px; }
.tree-level-3 { padding-left: 40px; font-size: 12px; }
.tree-new { padding: 2px 0 2px 8px; }
.tree-new input {
  width: 100%; height: 28px; padding: 0 8px;
  border: 1px solid var(--accent); border-radius: var(--r-1); background: var(--raise); font-size: 13px;
}

/* Ctrl K: one field, everything the app has, grouped */
.dialog.cmd-palette { width: min(620px, calc(100vw - 32px)); margin-top: 12vh; padding: 0; overflow: hidden; }
.palette-in { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 14px; border-bottom: 1px solid var(--line); color: var(--ink-muted); }
.palette-in input { flex: 1; height: 100%; border: 0; outline: none; background: transparent; font-size: 14px; }
.palette-list { max-height: min(56vh, 460px); padding: 6px; overflow-y: auto; }
.palette-group { margin: 8px 10px 4px; color: var(--ink-muted); font-size: 11.5px; font-weight: 600; }
.palette-item { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; width: 100%; height: 36px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--ink-muted); font-size: 13px; text-align: left; }
.palette-item .palette-label { overflow: hidden; color: var(--ink); text-overflow: ellipsis; white-space: nowrap; }
.palette-item small { color: var(--ink-muted); font-size: 12px; }
.palette-item.is-hot { background: var(--accent-wash); }
.palette-empty { margin: 14px 10px; color: var(--ink-muted); }

/* the shortcut sheet */
.dialog.keys { width: min(760px, calc(100vw - 32px)); padding: 0; }
.keys .dialog-head { padding: 16px 20px 12px; }
.keys-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 26px; padding: 16px 20px 22px; }
.keys-grid h3 { margin: 0 0 10px; }
.keys-grid dl { display: grid; gap: 8px; margin: 0; }
.keys-grid dl div { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--ink); }
.keys-grid dd { display: flex; gap: 3px; margin: 0; }

/* ---------- form primitives ---------- */
.field { display: grid; gap: 7px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* the ⓘ beside a prompt label: quiet until you look for it */
.info { display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0;
        border-radius: 50%; background: transparent; color: var(--ink-muted); cursor: pointer;
        transition: background-color 120ms ease, color 120ms ease; }
.info:hover, .info:focus-visible { background: var(--accent-wash); color: var(--accent); }
.field-head .info { margin-left: auto; }
.field-label + .info { margin-left: 6px; }

.guide { width: min(560px, calc(100vw - 32px)); }
.guide h2 { margin: 0 0 6px; font: 600 16px/1.3 var(--font-ui); }
.guide-list { display: grid; gap: 12px; margin: 16px 0 0; padding: 0; list-style: none; }
.guide-list li { display: grid; gap: 2px; }
.guide-list b { font-weight: 600; font-size: 13px; }
.guide-list span { color: var(--ink-muted); font-size: 12.5px; line-height: 1.5; }
.guide #guideFooter { margin: 16px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
.field input[list] {
  width: 100%; min-width: 0; height: var(--control-h); padding: 0 10px;
  border: 1px solid var(--line-strong); border-radius: var(--r-1); background: var(--surface);
}
.field-label { font: 500 11px/1.3 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); }
.field-label em { font-family: var(--font-ui); font-size: 12px; font-style: normal; letter-spacing: 0; text-transform: none; }
textarea { width: 100%; resize: vertical; padding: 9px 10px; border: 1px solid var(--line-strong); border-radius: var(--r-1); background: var(--surface); }
textarea::placeholder { color: #9aa5ad; }
select {
  width: 100%; height: var(--control-h); padding: 0 8px;
  border: 1px solid var(--line-strong); border-radius: var(--r-1); background: var(--surface);
}
.counter { justify-self: end; color: var(--ink-muted); font: 500 11px var(--font-mono); }
.segment {
  display: inline-flex; justify-self: start; gap: 2px; padding: 3px;
  border: 1px solid var(--line-strong); border-radius: var(--r-1); background: var(--page);
}
.segment button {
  height: 26px; padding: 0 12px; border: 0; border-radius: 4px; background: transparent;
  color: var(--ink-muted); font-size: 12px; font-weight: 600; white-space: nowrap;
}
.segment button[aria-checked="true"], .segment button[aria-selected="true"], .segment button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px #0000000f; }
.summary { margin: 0; color: var(--ink-muted); font-size: 12px; }

/* a menu that opens from the control that asked for it; the script places it */
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 5; width: 280px; padding: 6px;
  border: 1px solid var(--line-strong); border-radius: var(--r-2); background: var(--surface);
  box-shadow: var(--shadow-pop);
}
.menu button { display: block; width: 100%; padding: 9px 10px; border: 0; border-radius: var(--r-1); background: transparent; text-align: left; font-size: 13px; }
.menu button:hover { background: var(--accent-wash); color: var(--accent); }
.menu-note { margin: 6px 4px 2px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--ink-muted); font-size: 11px; line-height: 1.5; }
.menu-note code { font: 500 11px var(--font-mono); color: var(--ink); }
.pop { position: fixed; z-index: 30; width: 232px; padding: 6px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-pop); }
.pop.is-anchored { position: absolute; right: 0; top: calc(100% + 6px); }
.pop h3 { margin: 4px 8px 6px; }
.pop button { display: flex; align-items: center; gap: 9px; width: 100%; height: 32px; padding: 0 8px; border: 0; border-radius: 7px; background: transparent; text-align: left; }
.pop button[aria-checked="true"], .pop button.is-chosen { background: var(--accent-wash); color: var(--accent); font-weight: 600; }
.pop .dot { width: 8px; height: 8px; flex: none; border-radius: 2px; background: var(--night-muted); }
.pop hr { margin: 6px 4px; border: 0; border-top: 1px solid var(--line); }
.pop .is-danger { color: var(--danger); }

/* ---------- in-app dialogs (never the browser's own) ---------- */
.dialog {
  width: min(92vw, 400px); padding: 22px; border: 1px solid var(--line-strong); border-radius: var(--r-2);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop);
}
.dialog::backdrop { background: #000000a6; }
.dialog h2 { margin-bottom: 8px; font-size: 16px; }
.dialog p { margin: 0 0 20px; color: var(--ink-muted); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.dialog-wide { width: min(92vw, 860px); padding: 0; overflow: hidden; }
.dialog-wide[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; max-height: min(88vh, 760px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; font-size: 17px; letter-spacing: -.01em; }
.dialog-body { display: grid; align-content: start; gap: 14px; padding: 16px 18px; overflow-y: auto; }
.dialog-body p { margin: 0; }
.dialog-foot { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--page); }
.dialog-foot .sum { margin-right: auto; color: var(--ink-muted); font-size: 12px; }
.dialog-foot .sum b { color: var(--ink); }
.dropbar {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 14px 16px; overflow: hidden;
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-2); color: var(--ink-muted); cursor: pointer;
}
.dropbar .i { color: var(--accent); }
.dropbar .mono { margin-left: auto; }
.dropbar u { color: var(--ink); }
.dropbar input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropbar.is-dragging { border-color: var(--accent); background: var(--accent-wash); }
.apply-all { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.apply-all select { width: auto; min-width: 140px; }
.rows { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.row { display: grid; grid-template-columns: 48px minmax(0, 1.4fr) auto 140px 30px; gap: 12px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: var(--r-2); }
.row img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; background: #ece9e2; }
.row input { width: 100%; height: var(--control-h); padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r-1); background: var(--surface); }
.row-warning { margin: 4px 0 0; color: var(--amber); font-size: 12px; }
.row.has-warning { border-color: var(--amber); }
.swatch-pick { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }
.swatch-pick button { width: 28px; height: 28px; padding: 0; border: 2px solid transparent; border-radius: 8px; background: var(--tint, var(--night-muted)); box-shadow: inset 0 0 0 2px #fff; }
.swatch-pick button[aria-checked="true"] { border-color: var(--ink); }
.picker-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.picker-list button { display: grid; gap: 6px; width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: var(--r-2); background: var(--surface); text-align: left; }
.picker-list img { width: 100%; aspect-ratio: 1; object-fit: contain; border: 1px solid var(--line); border-radius: var(--r-1); background: #fff; }
.picker-list b { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.picker-list small { color: var(--ink-muted); font: 500 11px var(--font-mono); }
.name-field { display: grid; gap: 7px; margin: 0 0 16px; }
.name-field input { width: 100%; height: var(--control-h); padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r-1); background: var(--surface); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 22px; z-index: 40; transform: translate(-50%, 8px);
  max-width: min(92vw, 460px); padding: 11px 15px; border-radius: var(--r-1);
  border: 1px solid var(--line-strong); background: #0e0f10; color: var(--ink); font-size: 13px; box-shadow: var(--shadow-pop);
  opacity: 0; visibility: hidden; transition: opacity 120ms var(--ease-out), transform 120ms var(--ease-out), visibility 120ms;
}
.toast.is-visible { opacity: 1; visibility: visible; transform: translate(-50%, 0); transition-duration: var(--dur-ui); }
.toast.is-error { border-color: var(--danger); color: #ffd0cc; }

/* below 1000px the strip lies down along the bottom, the thumb's side of a phone */
@media (max-width: 1000px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: var(--bar-h) minmax(0, 1fr) 54px; }
  .main { grid-column: 1; }
  .statusbar { display: none; }
  .side { grid-column: 1; grid-row: 3; flex-direction: row; justify-content: space-around; padding: 0 6px; border-right: 0; border-top: 1px solid var(--line); }
  .side-nav { display: flex; gap: 2px; }
  .side-rule, .side-foot { display: none; }
  .side-item.is-active::before { left: 9px; right: 9px; top: auto; bottom: -9px; width: auto; height: 2px; }
  .side-item[data-tip]::after { display: none; }
  .doc-tab:not(.is-active) { display: none; }
  .cmd { width: 34px; padding: 0; justify-content: center; }
  .cmd span, .cmd kbd { display: none; }
  #jobsLabel { display: none; }
  .queue-pop { position: fixed; left: 8px; right: 8px; top: calc(var(--bar-h) + 6px); width: auto; }
  .keys-grid { grid-template-columns: 1fr; }
  .lib-tree { position: static; height: auto; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  #seasonTree { display: flex; flex-wrap: wrap; gap: 6px; }
  .tree-item { width: auto; padding: 6px 10px; }
  .tree-level-2, .tree-level-3 { padding-left: 10px; }
}
@media (max-width: 620px) {
  .dialog-wide { width: 96vw; }
  .row { grid-template-columns: 48px minmax(0, 1fr) 30px; }
  .row .segment, .row select { grid-column: 2 / 3; width: 100%; }
  .dialog-foot { flex-wrap: wrap; }
}

/* ---------- feel: the interface answers every press, and nothing appears from nowhere ---------- */
::selection { background: #6ea9e359; color: #fff; }
html { scrollbar-color: var(--line-strong) transparent; scrollbar-width: thin; accent-color: var(--accent); }
input, textarea { caret-color: var(--accent); }
.tree-count, .counter, .side-item .count { font-variant-numeric: tabular-nums; }
img:not([src]), img[src=""] { visibility: hidden; }   /* a screen that is still loading shows paper, not a broken-image icon */

.btn, .icon-btn, .tool, .segment button, .tree-item, .menu button, .pop button, .picker-list button {
  transition: transform var(--dur-press) var(--ease-out), border-color 120ms ease, background-color 120ms ease, color 120ms ease, box-shadow var(--dur-ui) var(--ease-out);
}
.btn:active:not(:disabled), .icon-btn:active:not(:disabled), .tool:active, .segment button:active { transform: scale(.97); }

/* fields say where you are */
textarea, select, .field input[list], .tree-new input, .row input, .name-field input { transition: border-color 120ms ease, box-shadow var(--dur-ui) var(--ease-out); }
textarea:hover, select:hover, .field input[list]:hover, .row input:hover, .name-field input:hover { border-color: var(--ink-muted); }
textarea:focus-visible, select:focus-visible, .field input[list]:focus-visible, .tree-new input:focus-visible, .row input:focus-visible, .name-field input:focus-visible {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash);
}

/* popovers open from their trigger; the dialog from its own centre */
.menu, .pop { transform-origin: top right; transition: opacity var(--dur-press) var(--ease-out), transform var(--dur-press) var(--ease-out); }
.dialog { transition: opacity var(--dur-ui) var(--ease-out), transform var(--dur-ui) var(--ease-out); }
.dialog::backdrop { transition: opacity var(--dur-ui) var(--ease-out); }
@starting-style {
  .menu, .pop { opacity: 0; transform: scale(.97) translateY(-4px); }
  .dialog[open] { opacity: 0; transform: scale(.97); }
  .dialog[open]::backdrop { opacity: 0; }
}

/* the rail answers a press the way everything else does */
@media (hover: hover) and (pointer: fine) {
  .side-item:hover { background: #ffffff0f; color: var(--ink); }
  .new-part:hover { background: #fff; }
  .pop button:hover { background: #ffffff0f; }
  .picker-list button:hover { border-color: var(--accent); }
  .dropbar:hover { border-color: var(--accent); background: var(--accent-wash); }
}
.side-item, .tree-item, .new-part, .side-add, .queue, .jobs-row { transition: transform var(--dur-press) var(--ease-out), background-color 120ms ease, color 120ms ease, border-color 120ms ease; }
.side-item:active, .tree-item:active, .new-part:active, .side-add:active, .queue:active { transform: scale(.98); }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
  .btn, .icon-btn, .tool, .segment button, .tree-item, .menu, .menu button, .pop, .pop button, .dialog, .picker-list button {
    transition-property: opacity, border-color, background-color, color;
  }
  .btn:active:not(:disabled), .icon-btn:active:not(:disabled), .tool:active, .segment button:active { transform: none; }
  .side-item, .tree-item, .new-part, .side-add, .queue, .jobs-row { transition-property: background-color, color, border-color; }
  .side-item:active, .tree-item:active, .new-part:active, .side-add:active, .queue:active { transform: none; }
}
