/* ─────────────────────────────────────────────────────────────
   cozyCAD design tokens
   Sims-warm game UI × AutoCAD precision
   ───────────────────────────────────────────────────────────── */

:root {
  /* Surfaces — warm dark, lamplight study */
  --night:       #150f0c;
  --night-2:     #1a1512;
  --surface:     #241e1a;
  --surface-2:   #2e2724;
  --elevated:    #3a312c;
  --border:      #4a3f38;
  --border-soft: #3a312c;
  --muted:       #8b7f76;
  --dim:         #6b6058;

  /* Ink */
  --ink:         #f5ebe0;
  --ink-2:       #d9ccbc;
  --ink-3:       #a89d90;

  /* Accents — all share chroma ~0.11, lightness ~0.75 */
  --gold:        oklch(0.78 0.12 75);
  --gold-2:      oklch(0.68 0.14 60);
  --lavender:    oklch(0.76 0.10 300);
  --sage:        oklch(0.76 0.09 150);
  --ember:       oklch(0.70 0.15 40);
  --blush:       oklch(0.74 0.11 15);
  --cream:       #f5ebe0;

  /* Semantic */
  --build:       var(--lavender);    /* placing new things */
  --edit:        var(--gold);        /* editing selected */
  --danger:      var(--blush);
  --success:     var(--sage);

  /* Current accent (swappable via tweaks) */
  --accent:      var(--gold);
  --accent-ink:  #1a1410;

  /* Radii */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-pill: 999px;

  /* Density — "cozy" by default */
  --dock-h: 124px;
  --circle-size: 68px;
  --row-h: 36px;
  --gap: 10px;
  --pad: 14px;

  /* Type */
  --fs-micro: 10px;
  --fs-tiny: 11px;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-base: 14px;
  --fs-md: 16px;
  --fs-lg: 20px;
  --fs-xl: 28px;

  --font-ui:   'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --font-display: 'Fraunces', 'Inter', serif;

  /* Shadows — soft warm, no generic black drops */
  --glow:        0 0 24px -4px color-mix(in oklab, var(--accent) 60%, transparent);
  --glow-sm:     0 0 12px -2px color-mix(in oklab, var(--accent) 50%, transparent);
  --shadow-1:    0 1px 0 rgba(255, 236, 200, 0.04) inset, 0 2px 8px rgba(0,0,0,0.35);
  --shadow-2:    0 1px 0 rgba(255, 236, 200, 0.05) inset, 0 8px 28px rgba(0,0,0,0.5);
  --shadow-plate: 0 1px 0 rgba(255, 240, 210, 0.06) inset,
                  0 -1px 0 rgba(0,0,0,0.35) inset,
                  0 2px 6px rgba(0,0,0,0.35);
  --shadow-dock: 0 -1px 0 rgba(255,240,210,0.04) inset,
                 0 1px 0 rgba(0,0,0,0.4) inset,
                 0 -8px 32px rgba(0,0,0,0.5);

  /* Motion */
  --ease: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Light theme variant */
body[data-theme="light"] {
  --night:       #f1e6d6;
  --night-2:     #eaddc9;
  --surface:     #f7ecd9;
  --surface-2:   #ede0ca;
  --elevated:    #fff4e1;
  --border:      #d9c6a7;
  --border-soft: #e4d4b8;
  --muted:       #9b8a72;
  --dim:         #b8a68b;
  --ink:         #3a2d1e;
  --ink-2:       #5c4a35;
  --ink-3:       #8a7558;
  --accent-ink:  #1a1410;
  --shadow-1:    0 1px 0 rgba(255,255,255,0.6) inset, 0 2px 8px rgba(120,80,30,0.12);
  --shadow-2:    0 1px 0 rgba(255,255,255,0.7) inset, 0 8px 28px rgba(120,80,30,0.18);
  --shadow-plate: 0 1px 0 rgba(255,255,255,0.7) inset,
                  0 -1px 0 rgba(120,80,30,0.15) inset,
                  0 2px 6px rgba(120,80,30,0.15);
  --shadow-dock: 0 1px 0 rgba(255,255,255,0.5) inset,
                 0 -1px 0 rgba(120,80,30,0.15) inset,
                 0 -8px 32px rgba(120,80,30,0.15);
}

/* Density variants */
body[data-density="compact"]     { --dock-h: 104px; --circle-size: 56px; --row-h: 30px; --gap: 8px; --pad: 10px; --fs-xs: 11px; --fs-sm: 12px; --fs-base: 13px; }
body[data-density="comfortable"] { --dock-h: 124px; --circle-size: 68px; --row-h: 36px; --gap: 10px; --pad: 14px; }
body[data-density="cozy"]        { --dock-h: 144px; --circle-size: 78px; --row-h: 40px; --gap: 12px; --pad: 16px; --fs-sm: 14px; --fs-base: 15px; }

/* Radius variants */
body[data-radius="sharp"]    { --r-xs: 2px; --r-sm: 3px; --r-md: 5px;  --r-lg: 7px;  --r-xl: 10px; }
body[data-radius="soft"]     { --r-xs: 4px; --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-xl: 20px; }
body[data-radius="pillowy"]  { --r-xs: 6px; --r-sm: 10px; --r-md: 16px; --r-lg: 22px; --r-xl: 30px; }

/* Accent variants */
body[data-accent="gold"]     { --accent: var(--gold); }
body[data-accent="lavender"] { --accent: var(--lavender); }
body[data-accent="sage"]     { --accent: var(--sage); }
body[data-accent="ember"]    { --accent: var(--ember); }
body[data-accent="blush"]    { --accent: var(--blush); }

/* ── Reset ──────────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--font-ui);
  background: var(--night);
  color: var(--ink);
  font-size: var(--fs-sm);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: 0.005em;
}
button { font: inherit; color: inherit; background: transparent; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--night-2);
  border: 1px solid var(--border);
  color: var(--ink-2);
  line-height: 1;
  display: inline-block;
  box-shadow: 0 1px 0 rgba(0,0,0,0.4);
}
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
::selection { background: color-mix(in oklab, var(--accent) 35%, transparent); color: var(--ink); }

/* ── App shell ───────────────────────────────────────────── */
.app {
  position: fixed; inset: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  overflow: hidden;
}

/* ── Scene (mock 3D canvas) ──────────────────────────────── */
.scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 40%, color-mix(in oklab, var(--accent) 10%, var(--night)) 0%, var(--night) 55%, var(--night-2) 100%);
}
.scene-grid {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 1px 1px, color-mix(in oklab, var(--ink) 14%, transparent) 1px, transparent 0);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse at 50% 55%, #000 0%, #000 45%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 55%, #000 0%, #000 45%, transparent 80%);
  pointer-events: none;
}
.scene-horizon {
  position: absolute; left: 0; right: 0; bottom: 0; height: 48%;
  background: linear-gradient(180deg, transparent 0%, color-mix(in oklab, var(--accent) 6%, transparent) 40%, color-mix(in oklab, var(--accent) 15%, transparent) 100%);
  pointer-events: none;
}

/* ── Dock (the bottom chrome) ────────────────────────────── */
.dock {
  position: relative;
  height: var(--dock-h);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border-top: 1px solid var(--border);
  box-shadow: var(--shadow-dock);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: stretch;
  z-index: 10;
}

/* Circle-button mode rail */
.rail {
  display: flex;
  align-items: center;
  gap: var(--gap);
  padding: 0 var(--pad);
  border-right: 1px solid var(--border-soft);
}

.circle-btn {
  width: var(--circle-size);
  height: var(--circle-size);
  border-radius: var(--r-pill);
  background: linear-gradient(180deg, var(--elevated) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-plate);
  color: var(--ink-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  position: relative;
  transition: transform 0.15s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}
.circle-btn svg { width: 22px; height: 22px; stroke-width: 1.8; }
.circle-btn .lbl { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.circle-btn .hk {
  position: absolute; top: -6px; right: -6px;
  width: 20px; height: 20px;
  border-radius: var(--r-pill);
  background: var(--night-2);
  border: 1px solid var(--border);
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 600;
  display: grid; place-items: center;
}
.circle-btn:hover { transform: translateY(-1px); border-color: color-mix(in oklab, var(--accent) 40%, var(--border)); }
.circle-btn:hover .lbl, .circle-btn:hover svg { color: var(--ink); }

.circle-btn.is-active {
  background: linear-gradient(180deg, color-mix(in oklab, var(--accent) 28%, var(--elevated)) 0%, color-mix(in oklab, var(--accent) 14%, var(--surface-2)) 100%);
  border-color: color-mix(in oklab, var(--accent) 55%, var(--border));
  color: var(--ink);
  box-shadow: var(--shadow-plate), var(--glow);
}
.circle-btn.is-active .lbl { color: var(--accent); }
.circle-btn.is-active .hk { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

.circle-btn.danger.is-active {
  background: linear-gradient(180deg, color-mix(in oklab, var(--blush) 30%, var(--elevated)) 0%, color-mix(in oklab, var(--blush) 14%, var(--surface-2)) 100%);
  border-color: color-mix(in oklab, var(--blush) 55%, var(--border));
  box-shadow: var(--shadow-plate), 0 0 24px -4px color-mix(in oklab, var(--blush) 60%, transparent);
}
.circle-btn.danger.is-active .lbl { color: var(--blush); }
.circle-btn.danger.is-active .hk { background: var(--blush); }

/* ── Dock panel (the 5-column info area) ─────────────────── */
.panel {
  display: flex;
  align-items: stretch;
  padding: var(--pad);
  gap: var(--pad);
  min-width: 0;
  overflow: hidden;
}

.col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding-right: var(--pad);
  border-right: 1px solid var(--border-soft);
}
.col:last-child { border-right: 0; padding-right: 0; }
.col.groups   { width: 136px; }
.col.subs     { width: 128px; }
.col.body     { flex: 1; min-width: 280px; }
.col.xform    { width: 184px; }
.col.settings { width: 180px; }

.col-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}
.col-label .sub { color: var(--ink-3); font-weight: 600; letter-spacing: 0.08em; margin-left: 6px; text-transform: none; font-size: 10px; }

/* ── List buttons (for groups / subs columns) ───────────── */
.list-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--row-h);
  padding: 0 10px;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--ink-3);
  font-size: var(--fs-xs);
  font-weight: 500;
  text-align: left;
  border: 1px solid transparent;
  transition: background 0.15s var(--ease), color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.list-btn .ico { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.75; }
.list-btn:hover { background: color-mix(in oklab, var(--ink) 4%, transparent); color: var(--ink); }
.list-btn.is-active {
  background: color-mix(in oklab, var(--accent) 14%, transparent);
  border-color: color-mix(in oklab, var(--accent) 30%, transparent);
  color: var(--accent);
  font-weight: 600;
}
.list-btn.is-active .ico { opacity: 1; color: var(--accent); }
.list-btn .count { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--muted); }

/* When editing (select mode), tint list-btn gold */
.col.subs.edit-mode .list-btn.is-active { background: color-mix(in oklab, var(--gold) 14%, transparent); border-color: color-mix(in oklab, var(--gold) 30%, transparent); color: var(--gold); }

/* ── Chip buttons (materials, presets) ──────────────────── */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--r-md);
  background: var(--night-2);
  border: 1px solid var(--border);
  color: var(--ink-3);
  font-size: var(--fs-xs);
  font-weight: 500;
  transition: all 0.15s var(--ease);
  box-shadow: var(--shadow-plate);
}
.chip:hover { border-color: var(--muted); color: var(--ink); }
.chip.is-active {
  background: linear-gradient(180deg, color-mix(in oklab, var(--build) 28%, var(--night-2)) 0%, color-mix(in oklab, var(--build) 12%, var(--night-2)) 100%);
  border-color: color-mix(in oklab, var(--build) 55%, var(--border));
  color: var(--build);
  font-weight: 600;
}
.chip.edit.is-active {
  background: linear-gradient(180deg, color-mix(in oklab, var(--gold) 28%, var(--night-2)) 0%, color-mix(in oklab, var(--gold) 12%, var(--night-2)) 100%);
  border-color: color-mix(in oklab, var(--gold) 55%, var(--border));
  color: var(--gold);
}
.chip .swatch { width: 12px; height: 12px; border-radius: 3px; box-shadow: 0 0 0 1px rgba(0,0,0,0.3) inset; }
.chip .mono { font-family: var(--font-mono); font-size: 11px; }

.chip-grid {
  display: grid;
  gap: 6px;
}

/* ── Numeric input ───────────────────────────────────────── */
.num {
  display: inline-flex;
  align-items: center;
  gap: 0;
  height: 28px;
  background: var(--night-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color 0.15s var(--ease);
}
.num:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in oklab, var(--accent) 25%, transparent); }
.num input {
  width: 58px;
  height: 100%;
  padding: 0 6px 0 10px;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  text-align: right;
  -moz-appearance: textfield;
}
.num input::-webkit-outer-spin-button,
.num input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.num .unit {
  padding: 0 8px 0 0;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
}
.num .step {
  width: 20px; height: 100%;
  background: transparent;
  color: var(--muted);
  display: grid; place-items: center;
  border-left: 1px solid var(--border-soft);
  font-size: 10px;
}
.num .step:hover { background: color-mix(in oklab, var(--ink) 5%, transparent); color: var(--ink); }

/* Inline field row */
.field-row { display: flex; align-items: center; gap: 8px; }
.field-row > .lbl { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 600; width: 46px; flex-shrink: 0; }
.field-row > .val { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--ink-2); }

/* ── Toggle switch ───────────────────────────────────────── */
.toggle {
  display: inline-flex; align-items: center; gap: 8px;
  height: 26px;
  padding: 0 10px 0 6px;
  border-radius: var(--r-md);
  background: var(--night-2);
  border: 1px solid var(--border);
  color: var(--ink-3);
  font-size: var(--fs-xs);
  font-weight: 500;
  transition: all 0.15s var(--ease);
  cursor: pointer;
  user-select: none;
}
.toggle .sw {
  width: 22px; height: 12px;
  border-radius: var(--r-pill);
  background: var(--elevated);
  position: relative;
  transition: background 0.15s var(--ease);
  flex-shrink: 0;
}
.toggle .sw::after {
  content: '';
  position: absolute;
  left: 2px; top: 2px;
  width: 8px; height: 8px;
  border-radius: var(--r-pill);
  background: var(--muted);
  transition: transform 0.15s var(--ease), background 0.15s var(--ease);
}
.toggle.is-on { border-color: color-mix(in oklab, var(--accent) 55%, var(--border)); color: var(--ink); }
.toggle.is-on .sw { background: color-mix(in oklab, var(--accent) 50%, var(--elevated)); }
.toggle.is-on .sw::after { transform: translateX(10px); background: var(--accent); }
.toggle .k { margin-left: auto; font-family: var(--font-mono); font-size: 9px; color: var(--muted); }
.toggle:hover { border-color: var(--muted); color: var(--ink); }

/* ── Top chrome: left brand + right camera/floor ─────────── */
.topbar {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 16px;
  pointer-events: none;
  z-index: 8;
}
.topbar > * { pointer-events: auto; }

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px 8px 10px;
  background: color-mix(in oklab, var(--surface) 80%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}
.brand .mark {
  width: 28px; height: 28px; border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--accent) 0%, color-mix(in oklab, var(--accent) 60%, var(--ember)) 100%);
  display: grid; place-items: center;
  color: var(--accent-ink);
  font-weight: 800;
  box-shadow: 0 2px 8px -2px color-mix(in oklab, var(--accent) 60%, transparent);
}
.brand .name { font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.brand .name b { color: var(--accent); }
.brand .proj { font-size: 10px; color: var(--muted); letter-spacing: 0.05em; font-family: var(--font-mono); margin-top: 1px; }

.stats-strip {
  display: flex; gap: 1px;
  background: color-mix(in oklab, var(--surface) 80%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-left: 10px;
  box-shadow: var(--shadow-1);
}
.stats-strip .stat {
  padding: 6px 12px;
  display: flex; align-items: center; gap: 6px;
  background: color-mix(in oklab, var(--surface) 60%, transparent);
}
.stats-strip .stat .v { font-family: var(--font-mono); font-weight: 600; font-size: 13px; color: var(--ink); }
.stats-strip .stat .k { font-size: 10px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600; }

/* Camera stack (top-right) */
.cam-stack {
  display: flex; flex-direction: column; gap: 8px;
  align-items: flex-end;
}
.cam-seg {
  display: flex;
  background: color-mix(in oklab, var(--surface) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 4px;
  gap: 2px;
  box-shadow: var(--shadow-1);
}
.cam-seg button {
  padding: 8px 12px;
  border-radius: var(--r-md);
  color: var(--ink-3);
  font-size: var(--fs-xs);
  font-weight: 600;
  display: flex; align-items: center; gap: 6px;
  transition: all 0.15s var(--ease);
}
.cam-seg button svg { width: 14px; height: 14px; }
.cam-seg button:hover { color: var(--ink); background: color-mix(in oklab, var(--ink) 5%, transparent); }
.cam-seg button.is-active {
  color: var(--accent-ink);
  background: linear-gradient(180deg, var(--accent) 0%, color-mix(in oklab, var(--accent) 80%, var(--ember)) 100%);
  box-shadow: 0 2px 8px -2px color-mix(in oklab, var(--accent) 60%, transparent);
}

/* Floor stack */
.floor-stack {
  display: flex; flex-direction: column;
  background: color-mix(in oklab, var(--surface) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-1);
  width: 148px;
}
.floor-stack .hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px;
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); font-weight: 700;
  border-bottom: 1px solid var(--border-soft);
}
.floor-stack .hdr .add { color: var(--accent); font-size: 14px; line-height: 1; }
.floor-stack .row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 12px;
  font-size: var(--fs-xs);
  color: var(--ink-3);
  cursor: pointer;
  border-bottom: 1px solid var(--border-soft);
  transition: background 0.15s var(--ease);
}
.floor-stack .row:last-child { border-bottom: 0; }
.floor-stack .row:hover { background: color-mix(in oklab, var(--ink) 4%, transparent); color: var(--ink); }
.floor-stack .row.is-active { background: color-mix(in oklab, var(--accent) 14%, transparent); color: var(--accent); font-weight: 600; }
.floor-stack .row .num { font-family: var(--font-mono); font-weight: 700; font-size: 14px; }
.floor-stack .row .cnt { font-family: var(--font-mono); font-size: 10px; color: var(--muted); }
.floor-stack .row.is-active .cnt { color: color-mix(in oklab, var(--accent) 70%, var(--muted)); }

/* ── Compass / crosshair HUD ─────────────────────────────── */
.crosshair {
  position: absolute;
  left: 50%; top: 50%; transform: translate(-50%, -50%);
  pointer-events: none;
  color: var(--accent);
  width: 44px; height: 44px;
  opacity: 0.7;
}

.coord-hud {
  position: absolute; bottom: 16px; left: 16px;
  display: flex; gap: 6px;
  pointer-events: none;
}
.coord-hud .pill {
  background: color-mix(in oklab, var(--surface) 85%, transparent);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 5px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  display: flex; align-items: center; gap: 6px;
}
.coord-hud .pill .k { color: var(--muted); font-weight: 600; }
.coord-hud .pill .v { color: var(--ink); }

/* Compass */
.compass {
  position: absolute; bottom: 16px; right: 16px;
  width: 68px; height: 68px;
  background: color-mix(in oklab, var(--surface) 82%, transparent);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  display: grid; place-items: center;
  box-shadow: var(--shadow-1);
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-weight: 700;
}

/* ── Wall / furniture mock in scene ──────────────────────── */
.scene-overlay { position: absolute; inset: 0; pointer-events: none; }

/* ── Toast ───────────────────────────────────────────────── */
.toast-stack {
  position: absolute; left: 16px; bottom: 92px;
  right: auto; top: auto; transform: none;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 20;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px 10px 10px;
  background: linear-gradient(180deg, var(--elevated) 0%, var(--surface) 100%);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  min-width: 240px;
  max-width: 360px;
  animation: toast-in 0.35s var(--ease-bounce);
  pointer-events: auto;
}
.toast .tico {
  width: 34px; height: 34px; border-radius: var(--r-md);
  background: color-mix(in oklab, var(--accent) 20%, var(--night-2));
  border: 1px solid color-mix(in oklab, var(--accent) 40%, var(--border));
  color: var(--accent);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.toast.milestone .tico {
  background: linear-gradient(135deg, var(--gold) 0%, var(--ember) 100%);
  color: var(--accent-ink);
  border-color: transparent;
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--gold) 20%, transparent), 0 0 16px -2px color-mix(in oklab, var(--gold) 50%, transparent);
}
.toast .ttl { font-size: var(--fs-sm); font-weight: 600; color: var(--ink); }
.toast .sub { font-size: var(--fs-xs); color: var(--muted); }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px) scale(0.92); }
  to   { opacity: 1; transform: translateX(0)    scale(1);    }
}

/* ── Ghost wall preview line ─────────────────────────────── */
.ghost-wall {
  position: absolute;
  height: 8px;
  background: color-mix(in oklab, var(--build) 35%, transparent);
  border: 1.5px dashed color-mix(in oklab, var(--build) 80%, transparent);
  border-radius: 2px;
  transform-origin: 0 50%;
  pointer-events: none;
}
.dim-tag {
  position: absolute;
  padding: 3px 8px;
  background: color-mix(in oklab, var(--build) 85%, transparent);
  color: #1a1410;
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 11px;
  white-space: nowrap;
  box-shadow: 0 2px 6px -2px rgba(0,0,0,0.4);
}
.dim-tag.gold { background: color-mix(in oklab, var(--gold) 90%, transparent); }

/* ── ESC Menu ────────────────────────────────────────────── */
.esc-overlay {
  position: absolute; inset: 0;
  background: color-mix(in oklab, var(--night) 70%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: grid; place-items: center;
  z-index: 100;
  animation: fade-in 0.2s var(--ease);
}
.esc-panel {
  width: 780px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-2);
  overflow: hidden;
  animation: panel-in 0.3s var(--ease-bounce);
}
.esc-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-soft);
}
.esc-hdr .title { font-family: var(--font-display); font-size: 22px; font-weight: 700; }
.esc-hdr .title b { color: var(--accent); }
.esc-hdr .hint { font-size: var(--fs-xs); color: var(--muted); font-family: var(--font-mono); }

.esc-body { display: grid; grid-template-columns: 260px 1fr; min-height: 420px; }
.esc-nav {
  padding: 14px;
  border-right: 1px solid var(--border-soft);
  display: flex; flex-direction: column; gap: 2px;
}
.esc-nav .item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  color: var(--ink-3);
  font-weight: 500;
  transition: all 0.15s var(--ease);
  border: 1px solid transparent;
}
.esc-nav .item svg { width: 18px; height: 18px; }
.esc-nav .item .k { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--muted); }
.esc-nav .item:hover { background: color-mix(in oklab, var(--ink) 4%, transparent); color: var(--ink); }
.esc-nav .item.is-active {
  background: color-mix(in oklab, var(--accent) 12%, transparent);
  border-color: color-mix(in oklab, var(--accent) 25%, transparent);
  color: var(--accent);
  font-weight: 600;
}
.esc-content { padding: 20px 24px; overflow: auto; }

.template-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.template-card {
  background: var(--night-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: all 0.15s var(--ease);
  cursor: pointer;
}
.template-card:hover { border-color: color-mix(in oklab, var(--accent) 50%, var(--border)); transform: translateY(-2px); box-shadow: var(--glow-sm); }
.template-card .thumb {
  aspect-ratio: 4/3;
  background: var(--night);
  display: grid; place-items: center;
  position: relative;
  overflow: hidden;
}
.template-card .info { padding: 10px 12px; }
.template-card .ttl { font-weight: 600; font-size: var(--fs-sm); }
.template-card .sub { font-size: 11px; color: var(--muted); font-family: var(--font-mono); margin-top: 2px; }

.export-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 12px; }
.export-card {
  padding: 14px;
  background: var(--night-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  display: flex; align-items: flex-start; gap: 12px;
  transition: all 0.15s var(--ease);
  cursor: pointer;
  text-align: left;
}
.export-card:hover { border-color: color-mix(in oklab, var(--accent) 50%, var(--border)); }
.export-card .tag { font-family: var(--font-mono); font-weight: 700; font-size: 13px; color: var(--accent); padding: 4px 8px; background: color-mix(in oklab, var(--accent) 12%, transparent); border-radius: 4px; }
.export-card .info .ttl { font-weight: 600; font-size: var(--fs-sm); }
.export-card .info .sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

@keyframes fade-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes panel-in { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: scale(1); } }

/* ── Paper Space (the 2D CAD mode) ───────────────────────── */
.paperspace {
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(0deg, transparent 0 49px, color-mix(in oklab, var(--ink) 4%, transparent) 49px 50px),
    repeating-linear-gradient(90deg, transparent 0 49px, color-mix(in oklab, var(--ink) 4%, transparent) 49px 50px),
    #f4ead4;
  color: #2a2115;
  overflow: hidden;
}
.paperspace .sheet {
  position: absolute;
  background: #faf2dd;
  border: 1px solid #b9a074;
  box-shadow: 0 20px 60px -16px rgba(58, 40, 20, 0.35);
}
.paperspace .sheet-title {
  position: absolute;
  right: 0; bottom: 0;
  width: 260px; height: 96px;
  background: #faf2dd;
  border-left: 1.5px solid #2a2115;
  border-top: 1.5px solid #2a2115;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 10px;
}
.paperspace .sheet-title .row { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px dashed #a68f68; }
.paperspace .sheet-title .row:last-child { border-bottom: 0; }
.paperspace .sheet-title .row .k { text-transform: uppercase; letter-spacing: 0.05em; color: #6a5640; }
.paperspace .sheet-title .row .v { color: #2a2115; font-weight: 600; }
.paperspace .sheet-title .ttl {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1.5px solid #2a2115;
  padding-bottom: 4px;
  margin-bottom: 4px;
}

/* ── Tweaks panel ────────────────────────────────────────── */
.tweaks {
  position: fixed;
  bottom: calc(var(--dock-h) + 20px);
  left: 20px;
  width: 276px;
  background: linear-gradient(180deg, var(--elevated) 0%, var(--surface) 100%);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  z-index: 50;
  overflow: hidden;
  animation: panel-in 0.3s var(--ease-bounce);
}
.tweaks .hdr {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
}
.tweaks .hdr .ttl { font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.tweaks .body { padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.tweaks .group { display: flex; flex-direction: column; gap: 6px; }
.tweaks .group .lbl { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.tweaks .swatch-row { display: flex; gap: 6px; }
.tweaks .swatch {
  flex: 1; height: 30px;
  border-radius: var(--r-md);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: transform 0.15s var(--ease), border-color 0.15s var(--ease);
}
.tweaks .swatch:hover { transform: translateY(-1px); }
.tweaks .swatch.is-on { border-color: var(--ink); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--ink); }
.tweaks .seg {
  display: flex;
  background: var(--night-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 2px;
  gap: 2px;
}
.tweaks .seg button {
  flex: 1;
  padding: 6px 8px;
  border-radius: calc(var(--r-md) - 2px);
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--ink-3);
  text-transform: capitalize;
  transition: all 0.15s var(--ease);
}
.tweaks .seg button.is-on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.tweaks .seg button:hover:not(.is-on) { color: var(--ink); background: color-mix(in oklab, var(--ink) 5%, transparent); }

/* Theme picker grid (Tweaks → Theme) */
.tweaks { width: 280px; }
.tweaks .theme-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.tweaks .theme-tile {
  position: relative;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  padding: 8px 10px 9px;
  display: flex; flex-direction: column; gap: 6px;
  cursor: pointer;
  transition: transform 0.15s var(--ease), box-shadow 0.2s var(--ease);
  text-align: left;
}
.tweaks .theme-tile:hover { transform: translateY(-1px); }
.tweaks .theme-tile .theme-sw {
  display: flex; gap: 3px;
}
.tweaks .theme-tile .theme-sw span {
  width: 14px; height: 14px; border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.25) inset;
}
.tweaks .theme-tile .theme-nm {
  font-size: 11px; font-weight: 600; letter-spacing: 0.005em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Misc utility */
.sep-v { width: 1px; background: var(--border-soft); align-self: stretch; }
.row { display: flex; align-items: center; gap: 8px; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 6px; }

/* Catalog tile (furniture) */
.tile {
  aspect-ratio: 1;
  background: var(--night-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  color: var(--ink-3);
  transition: all 0.15s var(--ease);
  position: relative;
  cursor: pointer;
}
.tile .big { font-size: 26px; line-height: 1; filter: grayscale(0.05); }
.tile .ttl { font-size: 10px; font-weight: 600; }
.tile:hover { border-color: color-mix(in oklab, var(--build) 50%, var(--border)); color: var(--ink); transform: translateY(-1px); }
.tile.is-active {
  background: linear-gradient(180deg, color-mix(in oklab, var(--build) 28%, var(--night-2)) 0%, color-mix(in oklab, var(--build) 12%, var(--night-2)) 100%);
  border-color: color-mix(in oklab, var(--build) 60%, var(--border));
  color: var(--build);
  box-shadow: 0 0 16px -4px color-mix(in oklab, var(--build) 60%, transparent);
}
.tile .dim-badge {
  position: absolute; top: 3px; right: 3px;
  font-family: var(--font-mono); font-size: 9px;
  color: var(--muted);
  background: color-mix(in oklab, var(--night) 60%, transparent);
  padding: 1px 4px; border-radius: 3px;
}

.tiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 6px;
  align-content: start;
  max-height: calc(var(--dock-h) - 56px);
  overflow: hidden;
}


/* ═══════════════════════════════════════════════════════════════
   cozyCAD form-kit — canonical form controls
   All controls use a single 3-step scale:
   --ctrl-sm (24)  --ctrl-md (32)  --ctrl-lg (40)
   ═══════════════════════════════════════════════════════════════ */

:root {
  --ctrl-sm: 24px;
  --ctrl-md: 32px;
  --ctrl-lg: 40px;
  --fk-ring: 1.5px;
  --fk-gap-x: 10px;
  --fk-gap-y: 8px;
  --fk-label-fs: 11px;
  --fk-label-track: 0.08em;
}

/* ── Field label — the caps kicker ─────────────────────────── */
.fk-label {
  display: flex; align-items: baseline; gap: 8px;
  font-family: var(--font-ui);
  font-size: var(--fk-label-fs);
  font-weight: 700;
  letter-spacing: var(--fk-label-track);
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 6px;
  white-space: nowrap;
}
.fk-label-hint {
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
  font-size: 11px;
}
.fk-group { display: flex; flex-direction: column; }
.fk-group + .fk-group { margin-top: 12px; }

/* ── Slider ────────────────────────────────────────────────── */
.fk-slider-row { display: flex; align-items: center; gap: var(--fk-gap-x); min-width: 0; }
.fk-slider-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  height: var(--ctrl-md);
  display: flex;
  align-items: center;
}
.fk-slider-wrap::before {
  content: '';
  position: absolute; left: 0; right: 0; top: 50%;
  height: 6px;
  margin-top: -3px;
  background: color-mix(in oklab, var(--ink) 10%, var(--night-2));
  border-radius: 3px;
  pointer-events: none;
}
.fk-slider-wrap::after {
  content: '';
  position: absolute; left: 0; top: 50%;
  height: 6px;
  margin-top: -3px;
  width: var(--fill, 0%);
  background: var(--a, var(--accent));
  border-radius: 3px;
  pointer-events: none;
  box-shadow: 0 0 12px -2px color-mix(in oklab, var(--a, var(--accent)) 60%, transparent);
  transition: width 80ms var(--ease);
}
.fk-slider {
  position: relative; z-index: 2;
  width: 100%;
  height: 18px;
  background: transparent;
  -webkit-appearance: none; appearance: none;
  cursor: pointer;
  padding: 0; margin: 0;
  outline: none;
}
.fk-slider::-webkit-slider-runnable-track {
  background: transparent;
  height: 18px;
  border: none;
}
.fk-slider::-moz-range-track {
  background: transparent;
  height: 18px;
  border: none;
}
.fk-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--a, var(--accent));
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  cursor: grab;
  transition: transform 0.12s var(--ease);
  margin-top: 0;
}
.fk-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--a, var(--accent));
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  cursor: grab;
}
.fk-slider:active::-webkit-slider-thumb { transform: scale(1.1); cursor: grabbing; }

/* ── Unit field (editable number w/ unit chip) ─────────────── */
.fk-unitfield {
  display: inline-flex;
  align-items: stretch;
  height: var(--ctrl-md);
  background: var(--night);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow: hidden;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
  flex-shrink: 0;
}
.fk-unitfield.size-sm { height: var(--ctrl-sm); }
.fk-unitfield.size-lg { height: var(--ctrl-lg); }
.fk-unitfield:focus-within {
  border-color: var(--a);
  box-shadow: 0 0 0 var(--fk-ring) color-mix(in oklab, var(--a) 35%, transparent);
}
.fk-unitfield.is-scrubbing { border-color: var(--a); cursor: ew-resize; }
.fk-unitfield-input {
  flex: 1; min-width: 0;
  padding: 0 6px 0 10px;
  background: transparent;
  border: 0; outline: 0;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.fk-unitfield-input::-webkit-outer-spin-button,
.fk-unitfield-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.fk-unitfield-chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px;
  padding: 0 6px;
  background: var(--surface-2);
  border-left: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: lowercase;
  cursor: ew-resize;
  user-select: none;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.fk-unitfield-chip:hover { background: var(--elevated); color: var(--ink-2); }

/* ── Segmented pill ────────────────────────────────────────── */
.fk-seg {
  display: inline-flex;
  padding: 3px;
  height: var(--ctrl-lg);
  background: var(--night);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  gap: 2px;
}
.fk-seg-btn {
  flex: 1;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  min-width: 56px;
  background: transparent;
  border: 0;
  border-radius: var(--r-pill);
  color: var(--ink-3);
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease), box-shadow 0.15s var(--ease);
  line-height: 1.15;
}
.fk-seg-btn:hover:not(:disabled) { color: var(--ink); }
.fk-seg-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.fk-seg-btn.is-on {
  color: var(--a);
  background: color-mix(in oklab, var(--a) 12%, var(--night-2));
  box-shadow: inset 0 0 0 var(--fk-ring) var(--a);
}
.fk-seg-icon { display: inline-flex; }
.fk-seg-label { font-size: 12px; font-weight: 600; }
.fk-seg-sub {
  font-size: 9.5px;
  color: var(--muted);
  font-weight: 500;
  margin-top: 1px;
  letter-spacing: 0;
}
.fk-seg-btn.is-on .fk-seg-sub { color: color-mix(in oklab, var(--a) 60%, var(--ink-2)); }

/* ── Material row ──────────────────────────────────────────── */
.fk-matrow {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  height: var(--ctrl-lg);
  padding: 0 10px 0 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--ink-2);
  text-align: left;
  cursor: pointer;
  transition: all 0.15s var(--ease);
}
.fk-matrow:hover { border-color: var(--muted); color: var(--ink); background: color-mix(in oklab, var(--ink) 3%, transparent); }
.fk-matrow.is-on {
  border-color: var(--a);
  color: var(--ink);
  background: color-mix(in oklab, var(--a) 8%, var(--night));
  box-shadow: inset 0 0 0 calc(var(--fk-ring) - 1px) var(--a);
}
.fk-matrow-swatch {
  width: 22px; height: 22px;
  border-radius: var(--r-xs);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.25), inset 0 -2px 2px rgba(0,0,0,0.15);
  flex-shrink: 0;
}
.fk-matrow-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.fk-matrow-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fk-matrow-sub { font-size: 11px; color: var(--muted); margin-top: 1px; }
.fk-matrow-check {
  color: var(--a);
  font-weight: 700;
  font-size: 13px;
}

/* ── Picker list (left column) ─────────────────────────────── */
.fk-picker { display: flex; flex-direction: column; gap: 2px; }
.fk-picker-btn {
  display: flex; align-items: center; gap: 8px;
  height: var(--ctrl-md);
  padding: 0 10px;
  background: transparent;
  border: 0;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
  position: relative;
}
.fk-picker-btn:hover { background: color-mix(in oklab, var(--ink) 4%, transparent); color: var(--ink); }
.fk-picker-btn.is-on {
  color: var(--a);
  font-weight: 600;
}
.fk-picker-btn.is-on::before {
  content: '';
  position: absolute; left: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: var(--a);
  border-radius: 0 3px 3px 0;
}
.fk-picker-icon { width: 14px; height: 14px; opacity: 0.75; display: inline-flex; }
.fk-picker-btn.is-on .fk-picker-icon { opacity: 1; }
.fk-picker-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fk-picker-count { font-family: var(--font-mono); font-size: 10px; color: var(--muted); }

/* ── Toggle ────────────────────────────────────────────────── */
.fk-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  height: var(--ctrl-md);
  padding: 0 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--ink-2);
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s var(--ease);
  width: 100%;
  text-align: left;
}
.fk-toggle:hover { border-color: var(--muted); color: var(--ink); }
.fk-toggle.is-on { border-color: var(--a); color: var(--ink); }
.fk-toggle-sw {
  position: relative;
  width: 22px; height: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  flex-shrink: 0;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.fk-toggle-sw::after {
  content: '';
  position: absolute; top: 1px; left: 1px;
  width: 8px; height: 8px;
  background: var(--muted);
  border-radius: 50%;
  transition: transform 0.15s var(--ease), background 0.15s var(--ease);
}
.fk-toggle.is-on .fk-toggle-sw {
  background: color-mix(in oklab, var(--a) 50%, var(--elevated));
  border-color: var(--a);
}
.fk-toggle.is-on .fk-toggle-sw::after { transform: translateX(10px); background: var(--a); }
.fk-toggle-label { flex: 1; display: inline-flex; align-items: center; gap: 6px; }
.fk-toggle-hk { font-family: var(--font-mono); font-size: 10px; color: var(--muted); }

/* ── Checkbox ──────────────────────────────────────────────── */
.fk-check {
  display: inline-flex; align-items: center; gap: 8px;
  height: var(--ctrl-md); padding: 0 6px;
  color: var(--ink-2); cursor: pointer; font-size: 12px;
}
.fk-check input { position: absolute; opacity: 0; pointer-events: none; }
.fk-check-box {
  width: 16px; height: 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--night);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--a);
  transition: all 0.15s var(--ease);
}
.fk-check.is-on .fk-check-box { border-color: var(--a); background: color-mix(in oklab, var(--a) 15%, var(--night)); }
.fk-check:hover .fk-check-box { border-color: var(--muted); }

/* ── Dropdown ──────────────────────────────────────────────── */
.fk-dropdown {
  position: relative;
  display: inline-block;
}
.fk-dropdown select {
  height: var(--ctrl-md);
  padding: 0 28px 0 10px;
  background: var(--night);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 12px;
  cursor: pointer;
  -webkit-appearance: none; appearance: none;
  min-width: 140px;
  transition: border-color 0.15s var(--ease);
}
.fk-dropdown select:hover { border-color: var(--muted); }
.fk-dropdown select:focus { outline: none; border-color: var(--a); box-shadow: 0 0 0 var(--fk-ring) color-mix(in oklab, var(--a) 35%, transparent); }
.fk-dropdown-caret { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }

/* ── Color picker ──────────────────────────────────────────── */
.fk-colors { display: flex; flex-wrap: wrap; gap: 6px; }
.fk-colors-dot {
  width: 24px; height: 24px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(0,0,0,0.3);
  cursor: pointer;
  transition: transform 0.12s var(--ease), box-shadow 0.12s var(--ease);
  padding: 0;
}
.fk-colors-dot:hover { transform: scale(1.08); }
.fk-colors-dot.is-on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 calc(2px + var(--fk-ring)) var(--a); }

/* ── Kbd ───────────────────────────────────────────────────── */
.fk-kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  background: var(--night-2);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-2);
  white-space: nowrap;
}

/* ── Empty state ───────────────────────────────────────────── */
.fk-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px;
  padding: 28px 16px;
  color: var(--muted);
  text-align: center;
  flex: 1;
}
.fk-empty-icon { font-size: 32px; opacity: 0.5; }
.fk-empty-title { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.fk-empty-hint { font-size: 11px; color: var(--muted); max-width: 220px; line-height: 1.5; }

/* ── Error / info note ─────────────────────────────────────── */
.fk-note {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: color-mix(in oklab, var(--a) 10%, var(--night));
  border: 1px solid color-mix(in oklab, var(--a) 40%, var(--border));
  border-radius: var(--r-sm);
  color: color-mix(in oklab, var(--a) 80%, var(--ink));
  font-size: 12px;
  line-height: 1.4;
}

/* ── Hint strip variants ───────────────────────────────────── */
.fk-hint-inline {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
  padding: 8px 10px;
  background: color-mix(in oklab, var(--accent) 6%, var(--night));
  border: 1px solid color-mix(in oklab, var(--accent) 25%, var(--border));
  border-radius: var(--r-sm);
  font-size: 12px;
  color: var(--ink-2);
}
.fk-hint-inline svg { color: var(--accent); flex-shrink: 0; }
.fk-hint-x {
  margin-left: auto; background: transparent; border: 0;
  color: var(--muted); font-size: 14px; cursor: pointer;
  line-height: 1; padding: 2px 6px;
}
.fk-hint-x:hover { color: var(--ink); }

.fk-hint-popover { display: inline-block; position: relative; }
.fk-hint-trigger {
  width: 22px; height: 22px;
  background: var(--night);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--muted); font-weight: 700; font-size: 11px;
  cursor: pointer;
  transition: all 0.15s var(--ease);
}
.fk-hint-trigger:hover { color: var(--ink); border-color: var(--muted); }
.fk-hint-trigger.is-on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.fk-hint-popover-body {
  position: absolute; top: 28px; right: 0; z-index: 20;
  width: 260px;
  padding: 12px;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-2);
  font-size: 12px; color: var(--ink-2); line-height: 1.55;
}
.fk-hint-popover-title { font-weight: 700; color: var(--ink); margin-bottom: 6px; font-size: 12px; }

.fk-hint-collapse {
  border: 1px solid var(--border-soft);
  border-radius: var(--r-sm);
  background: var(--night);
}
.fk-hint-collapse-head {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 8px 10px;
  background: transparent; border: 0;
  color: var(--ink-2);
  font-size: 12px; font-weight: 500;
  cursor: pointer;
  text-align: left;
}
.fk-hint-collapse-head svg { color: var(--muted); }
.fk-hint-collapse-body {
  padding: 4px 10px 10px;
  font-size: 12px; color: var(--ink-2); line-height: 1.55;
  border-top: 1px solid var(--border-soft);
  padding-top: 10px;
}

.fk-hint-coach {
  display: flex; gap: 12px;
  padding: 12px;
  background: var(--elevated);
  border: 1px solid color-mix(in oklab, var(--accent) 40%, var(--border));
  border-radius: var(--r-md);
  box-shadow: var(--shadow-2);
  max-width: 320px;
  position: relative;
}
.fk-hint-coach-pulse {
  width: 12px; height: 12px; flex-shrink: 0;
  border-radius: 50%; background: var(--accent);
  margin-top: 4px;
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 35%, transparent);
  animation: fk-pulse 1.4s ease-out infinite;
}
@keyframes fk-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--accent) 60%, transparent); }
  70% { box-shadow: 0 0 0 10px color-mix(in oklab, var(--accent) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--accent) 0%, transparent); }
}
.fk-hint-coach-body { font-size: 12px; color: var(--ink-2); line-height: 1.55; }
.fk-hint-coach-title { font-weight: 700; color: var(--ink); margin-bottom: 4px; font-size: 12px; }
.fk-hint-coach-btn {
  margin-top: 8px; padding: 4px 10px;
  background: var(--accent); color: var(--accent-ink);
  border: 0; border-radius: var(--r-sm);
  font-size: 11px; font-weight: 600; cursor: pointer;
}

/* ── Tooltip ───────────────────────────────────────────────── */
.fk-tooltip-wrap { position: relative; display: inline-block; }
.fk-tooltip {
  position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%);
  padding: 5px 8px;
  background: var(--night-2);
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 10px;
  white-space: nowrap;
  box-shadow: var(--shadow-2);
  z-index: 30;
  pointer-events: none;
}

/* ── Modal ─────────────────────────────────────────────────── */
.fk-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: grid; place-items: center;
  z-index: 100;
  animation: fk-fade 0.18s var(--ease);
}
@keyframes fk-fade { from { opacity: 0 } to { opacity: 1 } }
.fk-modal {
  width: min(420px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  overflow: hidden;
}
.fk-modal-head {
  display: flex; align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
}
.fk-modal-title { flex: 1; font-family: var(--font-display); font-size: 18px; color: var(--ink); }
.fk-modal-x {
  background: transparent; border: 0;
  color: var(--muted); font-size: 20px; cursor: pointer;
  width: 24px; height: 24px; line-height: 1;
}
.fk-modal-x:hover { color: var(--ink); }
.fk-modal-body { padding: 16px; font-size: 13px; color: var(--ink-2); line-height: 1.55; }
.fk-modal-foot { padding: 12px 16px; border-top: 1px solid var(--border-soft); display: flex; gap: 8px; justify-content: flex-end; }

/* ── Shortcut card ─────────────────────────────────────────── */
.fk-shortcuts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}
.fk-shortcuts-group {}
.fk-shortcuts-title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.fk-shortcuts-list { display: flex; flex-direction: column; gap: 4px; }
.fk-shortcuts-row {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 6px;
  border-radius: var(--r-xs);
}
.fk-shortcuts-row:hover { background: color-mix(in oklab, var(--ink) 3%, transparent); }
.fk-shortcuts-keys { display: inline-flex; align-items: center; gap: 3px; flex-shrink: 0; min-width: 80px; }
.fk-shortcuts-plus { color: var(--muted); font-size: 10px; }
.fk-shortcuts-desc { font-size: 12px; color: var(--ink-2); }

/* ── Panel shell (adaptive columns) ────────────────────────── */
.fk-panel {
  display: grid;
  gap: 20px;
  padding: 16px 20px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  min-height: 220px;
  align-items: stretch;
}
.fk-panel-col { display: flex; flex-direction: column; position: relative; min-width: 0; }
.fk-panel-col + .fk-panel-col::before {
  content: '';
  position: absolute; left: -10px; top: 0; bottom: 0;
  width: 1px;
  background: var(--border-soft);
}
.fk-panel-col-label {
  font-family: var(--font-ui);
  font-size: var(--fk-label-fs);
  font-weight: 700;
  letter-spacing: var(--fk-label-track);
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 10px;
}
.fk-panel-col-body { flex: 1; display: flex; flex-direction: column; gap: 10px; }
