/* ==========================================================================
   Knuds board — "ink and enamel"
   Cold blue-green ink for the ground, warm brass for the one thing you do
   most (drop a card in the slot), enamel-pin colours for columns and labels.
   ========================================================================== */

:root {
  --display: "Bricolage Grotesque", "Instrument Sans", system-ui, sans-serif;
  --body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Consolas, monospace;

  --r-sm: 8px;
  --r-md: 11px;
  --r-lg: 15px;
  --r-xl: 20px;

  --lane-w: 306px;
  --slot-h: 60px;

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* -------------------------------------------------------------- dark (default) */
[data-theme="dark"] {
  --bg: #0b1416;
  --trough: #0e1a1d;
  --field: #122126;
  --surface: #16262b;
  --surface-hi: #1c3037;
  --line: #23383f;
  --line-soft: #1a2b31;

  --text: #e4edea;
  --text-dim: #8ba29f;
  --text-faint: #64807c;

  --brass: #e9a63c;
  --brass-ink: #22190a;
  --brass-soft: rgba(233, 166, 60, 0.14);
  --brass-glow: rgba(233, 166, 60, 0.2);

  --c-jade: #4cb8a3;
  --c-jade-soft: rgba(76, 184, 163, 0.15);
  --c-periwinkle: #8792f8;
  --c-periwinkle-soft: rgba(135, 146, 248, 0.16);
  --c-coral: #f2786e;
  --c-coral-soft: rgba(242, 120, 110, 0.16);
  --c-brass: #e9a63c;
  --c-brass-soft: rgba(233, 166, 60, 0.15);
  --c-lilac: #c690ea;
  --c-lilac-soft: rgba(198, 144, 234, 0.16);
  --c-slate: #90a7a4;
  --c-slate-soft: rgba(144, 167, 164, 0.15);

  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.02);
  --shadow-lift: 0 18px 44px rgba(0, 0, 0, 0.55);
  --shadow-pop: 0 14px 34px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

/* -------------------------------------------------------------------- light */
[data-theme="light"] {
  --bg: #e8eeeb;
  --trough: #dfe7e3;
  --field: #ffffff;
  --surface: #ffffff;
  --surface-hi: #f3f7f5;
  --line: #c5d2cd;
  --line-soft: #d5ded9;

  --text: #0f1c1f;
  --text-dim: #506661;
  --text-faint: #6d8480;

  --brass: #8f5d0c;
  --brass-ink: #fffaf1;
  --brass-soft: rgba(143, 93, 12, 0.1);
  --brass-glow: rgba(143, 93, 12, 0.18);

  --c-jade: #10796a;
  --c-jade-soft: rgba(16, 121, 106, 0.12);
  --c-periwinkle: #4152cf;
  --c-periwinkle-soft: rgba(65, 82, 207, 0.11);
  --c-coral: #c4423a;
  --c-coral-soft: rgba(196, 66, 58, 0.11);
  --c-brass: #8f5d0c;
  --c-brass-soft: rgba(143, 93, 12, 0.11);
  --c-lilac: #7e3fab;
  --c-lilac-soft: rgba(126, 63, 171, 0.11);
  --c-slate: #4f6561;
  --c-slate-soft: rgba(79, 101, 97, 0.11);

  --shadow-card: 0 1px 2px rgba(15, 28, 31, 0.06);
  --shadow-lift: 0 18px 40px rgba(15, 28, 31, 0.22);
  --shadow-pop: 0 12px 30px rgba(15, 28, 31, 0.16);
  color-scheme: light;
}

/* ------------------------------------------------------------------- reset */
*,
*::before,
*::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

.mono {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
}

.sprite { display: none; }

.ico {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ico--sm { width: 16px; height: 16px; }
[data-theme="dark"] .ico--light-only,
[data-theme="light"] .ico--dark-only { display: none; }

/* ==========================================================================
   Sign in
   ========================================================================== */

body.gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(120% 80% at 50% -10%, var(--trough), transparent 60%),
    var(--bg);
}

.gate-panel {
  width: 100%;
  max-width: 312px;
}




.gate-form { display: grid; gap: 14px; }

.gate-error {
  margin: 0;
  color: var(--c-coral);
  font-size: 0.875rem;
}


/* ==========================================================================
   Shared controls
   ========================================================================== */

.field { display: grid; gap: 6px; min-width: 0; }

.field-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text-dim);
}

.field-count { color: var(--text-faint); margin-left: 4px; }

.input {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  background: var(--field);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: border-color 0.14s var(--ease), box-shadow 0.14s var(--ease);
}
.input:focus {
  outline: none;
  border-color: var(--brass);
  box-shadow: 0 0 0 3px var(--brass-soft);
}
.input::placeholder { color: var(--text-faint); }

.input--sm { padding: 7px 10px; font-size: 0.875rem; }
.input--tiny { padding: 5px 8px; width: 74px; text-align: center; }
.input--notes { resize: vertical; min-height: 92px; line-height: 1.55; }

select.input {
  appearance: none;
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 14px center, right 9px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.field--inline {
  position: relative;
  flex: 1;
}
.field-ico {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}
.input--search { padding-left: 34px; }
.input--search::-webkit-search-cancel-button { filter: grayscale(1) opacity(0.6); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 0.9375rem;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: var(--surface-hi);
  white-space: nowrap;
  transition: background 0.14s var(--ease), border-color 0.14s var(--ease),
              transform 0.1s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn--sm { padding: 7px 12px; font-size: 0.875rem; }

.btn--slot {
  background: var(--brass);
  color: var(--brass-ink);
  border-color: var(--brass);
}
.btn--slot:hover { filter: brightness(1.06); }

.btn--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text-dim);
}
.btn--ghost:hover { color: var(--text); background: var(--surface-hi); }

.btn--danger {
  background: var(--c-coral);
  border-color: var(--c-coral);
  color: #2b0e0b;
}
[data-theme="light"] .btn--danger { color: #fff6f5; }
.btn--danger:hover { filter: brightness(1.06); }

.btn--danger-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--c-coral);
}
.btn--danger-ghost:hover { background: var(--c-coral-soft); }

.icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--text-dim);
  transition: background 0.14s var(--ease), color 0.14s var(--ease);
}
.icon-btn:hover { background: var(--surface-hi); color: var(--text); }

.dot-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brass);
}

.rule {
  height: 1px;
  border: 0;
  margin: 6px 0;
  background: var(--line-soft);
}

/* enamel chips ------------------------------------------------------------ */

.chipset { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--c-slate-soft);
  color: var(--c-slate);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip--toggle {
  background: transparent;
  border-color: var(--line);
  color: var(--text-dim);
}
.chip--toggle[aria-pressed="true"] {
  background: var(--brass-soft);
  border-color: var(--brass);
  color: var(--brass);
}

.chip--label[aria-pressed="false"] {
  background: transparent;
  border-color: var(--line);
}

.chip--mono { font-family: var(--mono); font-size: 0.6875rem; font-weight: 400; }

.c-jade { background: var(--c-jade-soft); color: var(--c-jade); }
.c-periwinkle { background: var(--c-periwinkle-soft); color: var(--c-periwinkle); }
.c-coral { background: var(--c-coral-soft); color: var(--c-coral); }
.c-brass { background: var(--c-brass-soft); color: var(--c-brass); }
.c-lilac { background: var(--c-lilac-soft); color: var(--c-lilac); }
.c-slate { background: var(--c-slate-soft); color: var(--c-slate); }

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
  background: var(--c-slate);
}
.dot.d-jade { background: var(--c-jade); }
.dot.d-periwinkle { background: var(--c-periwinkle); }
.dot.d-coral { background: var(--c-coral); }
.dot.d-brass { background: var(--c-brass); }
.dot.d-lilac { background: var(--c-lilac); }
.dot.d-slate { background: var(--c-slate); }

.swatches { display: flex; gap: 6px; padding: 8px 12px; }
.swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--c-slate);
  padding: 0;
}
.swatch[aria-pressed="true"] {
  border-color: var(--text);
  box-shadow: inset 0 0 0 2px var(--trough);
}

/* ==========================================================================
   App shell
   ========================================================================== */

body.app {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: grid;
  /* Rows are assigned explicitly: hiding the filter bar must not shift the
     board out of the one flexible track. */
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.topbar {
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--trough);
  padding-top: max(9px, env(safe-area-inset-top));
}

.board-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 60vw;
  padding: 6px 8px 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  font-size: 0.875rem;
  font-weight: 600;
}
.board-switch:hover { color: var(--text); background: var(--surface-hi); }
.board-switch > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; gap: 2px; }

/* filter bar -------------------------------------------------------------- */

.filterbar {
  grid-row: 2;
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--trough);
}
.filterbar-row { display: flex; align-items: center; gap: 8px; }
.filterbar-row--chips {
  flex-wrap: wrap;
  gap: 6px 14px;
  overflow-x: auto;
  scrollbar-width: none;
}
.filterbar-row--chips::-webkit-scrollbar { display: none; }

/* ==========================================================================
   Board and columns
   ========================================================================== */

.board {
  grid-row: 3;
  display: flex;
  align-items: stretch;
  gap: 12px;
  padding: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  height: 100%;
}

.lane {
  position: relative;
  flex: 0 0 var(--lane-w);
  display: flex;
  flex-direction: column;
  max-height: 100%;
  background: var(--trough);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease);
}
.lane--target {
  border-color: var(--brass);
  background: var(--surface-hi);
}
.lane--dragging { opacity: 0.55; }

.lane-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 8px 9px 13px;
  cursor: grab;
  user-select: none;
  -webkit-touch-callout: none;
}
.lane-head:active { cursor: grabbing; }

.lane-name {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-family: var(--display);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lane-count {
  flex: none;
  color: var(--text-faint);
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--field);
}
.lane-count--over { color: var(--c-coral); background: var(--c-coral-soft); }

.lane-menu-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-faint);
}
.lane-menu-btn:hover { background: var(--field); color: var(--text); }

.lane-meter {
  height: 2px;
  margin: 0 13px 8px;
  border-radius: 2px;
  background: var(--field);
  overflow: hidden;
}
.lane-meter > i {
  display: block;
  height: 100%;
  background: var(--brass);
  transition: width 0.25s var(--ease);
}
.lane-meter > i.is-over { background: var(--c-coral); }

.lane-cards {
  flex: 1;
  min-height: 42px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 0 8px 8px;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
}

.lane-empty {
  margin: 2px 0 6px;
  padding: 14px 12px;
  border: 1px dashed var(--line-soft);
  border-radius: var(--r-md);
  color: var(--text-faint);
  font-size: 0.8125rem;
  text-align: center;
}


.lane-new {
  flex: 0 0 156px;
  align-self: flex-start;
  padding: 13px;
  border: 1px dashed var(--line);
  border-radius: var(--r-lg);
  background: transparent;
  color: var(--text-faint);
  font-size: 0.875rem;
  font-weight: 600;
  text-align: left;
}
.lane-new:hover { color: var(--text); border-color: var(--brass); }

/* dividers: a card-shaped thing that is only a line ------------------------- */

.divider {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 7px 8px 7px 4px;
  margin: 2px 0;
  border-radius: var(--r-sm);
  cursor: pointer;
  user-select: none;
  -webkit-touch-callout: none;
  color: var(--text-faint);
  touch-action: manipulation;
}
.divider:hover { background: var(--field); color: var(--text-dim); }

.divider-chevron {
  flex: none;
  transition: transform 0.16s var(--ease);
}
.divider--collapsed .divider-chevron { transform: rotate(-90deg); }

.divider-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
}

.divider-rule {
  flex: 1;
  height: 1px;
  min-width: 12px;
  background: var(--line);
}

.divider-count {
  flex: none;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--field);
  color: var(--text-faint);
}

.divider-menu {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-faint);
  opacity: 0;
}
.divider:hover .divider-menu,
.divider-menu:focus-visible { opacity: 1; }
@media (hover: none) {
  .divider-menu { opacity: 1; }
}

/* the automatic line a checklist column draws above whatever is ticked off */
.divider--auto { cursor: default; padding-left: 8px; }
.divider--auto:hover { background: transparent; color: var(--text-faint); }

/* quick entry, one per column ---------------------------------------------- */

.lane-quick { margin: 0 8px 8px; }

.lane-quick-input {
  width: 100%;
  padding: 8px 11px;
  background: transparent;
  color: var(--text);
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
  font-size: 0.875rem;
  transition: border-color 0.14s var(--ease), background 0.14s var(--ease),
              box-shadow 0.14s var(--ease);
}
.lane-quick-input::placeholder { color: var(--text-faint); }
.lane-quick-input:hover { border-color: var(--text-faint); }
.lane-quick-input:focus {
  outline: none;
  background: var(--field);
  border-style: solid;
  border-color: var(--brass);
  box-shadow: 0 0 0 3px var(--brass-soft);
}

/* who else can see this column -------------------------------------------- */

.lane-shared {
  flex: none;
  display: grid;
  place-items: center;
  color: var(--c-jade);
}

/* somebody else's column, sitting at the end of your board */
.lane--foreign { border-color: var(--c-periwinkle-soft); }
.lane--foreign .lane-head { cursor: default; }
.lane--foreign .lane-name:hover { color: var(--text); }

.lane-owner {
  flex: none;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--c-periwinkle-soft);
  color: var(--c-periwinkle);
}

.sharelist { display: grid; gap: 0; max-height: 190px; overflow-y: auto; }
.sharelist-note {
  margin: 0;
  padding: 4px 12px 8px;
  font-size: 0.8125rem;
  color: var(--text-faint);
}

/* pasted images ------------------------------------------------------------ */

.card-shots {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
}
.card-shot {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--field);
}
.card-shot-more { color: var(--text-faint); }
.lane--compact .card-shots { display: none; }

.shots { display: flex; flex-wrap: wrap; gap: 8px; }
.shot { position: relative; margin: 0; }
.shot img {
  display: block;
  max-width: 148px;
  max-height: 148px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--field);
}
.shot-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-dim);
}
.shot-remove:hover { color: var(--c-coral); border-color: var(--c-coral); }

/* docs --------------------------------------------------------------------- */

.doc-head {
  margin: 0;
  font-family: var(--display);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.modal-body .doc-head { margin-top: 22px; }
.modal-body .doc-head + .muted { margin-top: 6px; }

/* the gutter you pull to set a column's width ------------------------------ */

.lane-resize {
  position: absolute;
  z-index: 2;
  top: 0;
  bottom: 0;
  right: -7px;
  width: 12px;
  cursor: col-resize;
  touch-action: none;
}
.lane-resize::after {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 5px;
  width: 2px;
  border-radius: 1px;
  background: transparent;
  transition: background 0.14s var(--ease);
}
.lane-resize:hover::after,
.lane-resize.is-active::after { background: var(--brass); }

/* cards ------------------------------------------------------------------- */

.card {
  position: relative;
  padding: 10px 12px 10px 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-touch-callout: none;
  overflow: hidden;
  /* Without this the column's flexbox squashes cards once they overflow,
     and overflow:hidden then eats the end of long titles. */
  flex: none;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  transition: border-color 0.14s var(--ease), transform 0.1s var(--ease);
}
.card:hover { border-color: var(--surface-hi); }
[data-theme="light"] .card:hover { border-color: var(--text-faint); }

.card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: transparent;
}
.card[data-priority="1"]::before { background: var(--c-slate); }
.card[data-priority="2"]::before { background: var(--c-jade); }
.card[data-priority="3"]::before { background: var(--c-brass); }
.card[data-priority="4"]::before { background: var(--c-coral); }

.card-main { min-width: 0; flex: 1; }

.card-check {
  flex: none;
  appearance: none;
  width: 20px;
  height: 20px;
  margin: 0;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: border-color 0.14s var(--ease), background 0.14s var(--ease);
}
.card-check:hover { border-color: var(--text-faint); }
.card-check::after {
  content: "";
  width: 9px;
  height: 5px;
  border: 2px solid var(--brass-ink);
  border-top: 0;
  border-right: 0;
  transform: rotate(-45deg) translate(1px, -1px);
  opacity: 0;
}
.card-check:checked {
  background: var(--brass);
  border-color: var(--brass);
}
.card-check:checked::after { opacity: 1; }

.card--checked { opacity: 0.55; }
.card--checked .card-title {
  text-decoration: line-through;
  text-decoration-color: var(--text-faint);
  color: var(--text-dim);
}

.card-title {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.card--done .card-title {
  color: var(--text-dim);
  text-decoration: line-through;
  text-decoration-color: var(--text-faint);
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
}
.card-meta:empty { display: none; }

.due--today { background: var(--c-brass-soft); color: var(--c-brass); }
.due--over { background: var(--c-coral-soft); color: var(--c-coral); }

.card-notes-flag { color: var(--text-faint); font-size: 0.6875rem; }

.card--ghost { display: none; }
.card--new { animation: drop 0.26s var(--ease) both; }

@keyframes drop {
  from { opacity: 0; transform: translateY(16px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.drag-clone {
  position: fixed;
  z-index: 90;
  pointer-events: none;
  box-shadow: var(--shadow-lift);
  transform: rotate(-1.4deg) scale(1.03);
  cursor: grabbing;
}

.placeholder {
  border: 1px dashed var(--brass);
  border-radius: var(--r-md);
  background: var(--brass-soft);
  flex: none;
}

.lane--ghost { display: none; }

.drag-clone--lane {
  transform: rotate(-0.5deg) scale(1.01);
  overflow: hidden;
}

.lane-placeholder {
  flex: 0 0 var(--lane-w);
  align-self: stretch;
  border: 1px dashed var(--brass);
  border-radius: var(--r-lg);
  background: var(--brass-soft);
}

/* the bin, which only exists while a card is in the air */
.binzone {
  position: fixed;
  z-index: 70;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border: 1px dashed var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  color: var(--text-dim);
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 150%);
  transition: transform 0.22s var(--ease), opacity 0.22s var(--ease),
              background 0.14s var(--ease), color 0.14s var(--ease),
              border-color 0.14s var(--ease);
}
.binzone.is-live { opacity: 1; transform: translate(-50%, 0); }
.binzone.is-hot {
  background: var(--c-coral);
  border-color: var(--c-coral);
  border-style: solid;
  color: #2b0e0b;
  transform: translate(-50%, 0) scale(1.04);
}
[data-theme="light"] .binzone.is-hot { color: #fff6f5; }

/* squeezed columns: same cards, far less air ------------------------------- */

.lane--compact .lane-cards { gap: 4px; }

.lane--compact .card {
  padding: 5px 10px 5px 11px;
  border-radius: var(--r-sm);
  gap: 7px;
}
.lane--compact .card-title {
  font-size: 0.8125rem;
  line-height: 1.3;
}
.lane--compact .card-meta { display: none; }
.lane--compact .card-check { width: 15px; height: 15px; margin-top: 0; }
.lane--compact .divider { padding-top: 4px; padding-bottom: 4px; margin: 0; }
.lane--compact .lane-quick-input { padding: 6px 10px; font-size: 0.8125rem; }

.lane-name[role="button"] { cursor: pointer; }
.lane-name[role="button"]:hover { color: var(--brass); }

/* ==========================================================================
   The slot — the one thing this app is for
   ========================================================================== */

.slot {
  grid-row: 4;
  border-top: 1px solid var(--line);
  background: var(--trough);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
}

.slot-inner {
  display: flex;
  gap: 8px;
}

.slot-field {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
/* the brass lip of the slot */
.slot-field::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--brass);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.24s var(--ease);
}
.slot-field:focus-within {
  border-color: var(--brass);
  box-shadow: 0 0 0 3px var(--brass-soft);
}
.slot-field:focus-within::before { transform: scaleX(1); }

.slot-input {
  flex: 1;
  min-width: 0;
  padding: 12px 13px;
  border: 0;
  background: transparent;
  font-size: 1rem;
}
.slot-input:focus { outline: none; }
.slot-input::placeholder { color: var(--text-faint); }

.slot-hint {
  padding-right: 12px;
  color: var(--text-faint);
  white-space: nowrap;
  transition: opacity 0.16s var(--ease);
}
.slot-field:focus-within .slot-hint { opacity: 0; }

.slot-lane {
  flex: none;
  max-width: 130px;
  padding: 0 26px 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--field);
  color: var(--text-dim);
  font-size: 0.8125rem;
  font-weight: 600;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 13px center, right 8px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.slot-parse {
  margin: 6px 0 0;
  color: var(--text-faint);
  min-height: 0;
}
.slot-parse:empty { display: none; }
.slot-parse b { color: var(--brass); font-weight: 500; }

/* ==========================================================================
   Popovers, sheet, modal, toasts
   ========================================================================== */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(4, 10, 11, 0.62);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease);
}
.scrim.is-open { opacity: 1; pointer-events: auto; }
[data-theme="light"] .scrim { background: rgba(15, 28, 31, 0.34); }

.popover {
  position: fixed;
  z-index: 60;
  min-width: 226px;
  max-width: min(300px, calc(100vw - 20px));
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  visibility: hidden;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.14s var(--ease), transform 0.14s var(--ease), visibility 0.14s;
}
.popover.is-open { visibility: visible; opacity: 1; transform: none; }

.popover-title {
  margin: 0;
  padding: 7px 12px 5px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.popover-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text);
  font-size: 0.875rem;
  text-align: left;
}
.popover-item:hover { background: var(--surface-hi); }
.popover-item:disabled {
  color: var(--text-faint);
  cursor: default;
  background: transparent;
}
.popover-item--danger { color: var(--c-coral); }
.popover-item--danger:hover { background: var(--c-coral-soft); }
.popover-item--active { color: var(--brass); font-weight: 600; }
.popover-meta { margin-left: auto; color: var(--text-faint); }

.popover-field,
.popover-check {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px;
  font-size: 0.875rem;
  color: var(--text-dim);
}
.popover-field span { flex: 1; }
.popover-check input { accent-color: var(--brass); width: 16px; height: 16px; }

/* card sheet -------------------------------------------------------------- */

.sheet {
  position: fixed;
  z-index: 50;
  right: 0;
  top: 0;
  bottom: 0;
  width: min(430px, 100vw);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-left: 1px solid var(--line);
  visibility: hidden;
  transform: translateX(100%);
  transition: transform 0.26s var(--ease), visibility 0.26s;
}
.sheet.is-open { visibility: visible; transform: none; }

.sheet-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 10px 12px 18px;
  border-bottom: 1px solid var(--line-soft);
  padding-top: max(12px, env(safe-area-inset-top));
}
.sheet-lane {
  flex: 1;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px 24px;
  display: grid;
  gap: 18px;
  align-content: start;
}

.sheet-title {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  resize: none;
  overflow: hidden;
  font-family: var(--display);
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
}
.sheet-title:focus { outline: none; }

.sheet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(142px, 1fr));
  gap: 12px;
}

.sheet-stamp { margin: 0; color: var(--text-faint); }

.sheet-foot {
  display: flex;
  gap: 8px;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line-soft);
}
.sheet-foot .btn { flex: 1; }

.checklist { display: grid; gap: 2px; margin-bottom: 8px; }

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 5px 4px;
  border-radius: var(--r-sm);
}
.check-row:hover { background: var(--surface-hi); }
.check-row input[type="checkbox"] {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: var(--brass);
  flex: none;
}
.check-row span {
  flex: 1;
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}
.check-row.is-done span { color: var(--text-faint); text-decoration: line-through; }
.check-row button {
  border: 0;
  background: transparent;
  color: var(--text-faint);
  padding: 0 2px;
  opacity: 0;
}
.check-row:hover button,
.check-row button:focus-visible { opacity: 1; }

.checklist-add { display: flex; gap: 6px; }
.checklist-add .input { flex: 1; }

/* modal ------------------------------------------------------------------- */

.modal {
  position: fixed;
  z-index: 55;
  left: 50%;
  top: 50%;
  width: min(560px, calc(100vw - 24px));
  max-height: min(76dvh, 680px);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lift);
  visibility: hidden;
  opacity: 0;
  transform: translate(-50%, -48%) scale(0.98);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease), visibility 0.2s;
}
.modal.is-open {
  visibility: visible;
  opacity: 1;
  transform: translate(-50%, -50%);
}

.modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 10px 14px 20px;
  border-bottom: 1px solid var(--line-soft);
}
.modal-title {
  flex: 1;
  margin: 0;
  font-family: var(--display);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.modal-body {
  overflow-y: auto;
  padding: 18px 20px 22px;
}
.modal-body > * + * { margin-top: 16px; }

.stack { display: grid; gap: 10px; }
.row { display: flex; align-items: center; gap: 8px; }
.row--between { justify-content: space-between; }
.muted { color: var(--text-dim); font-size: 0.875rem; margin: 0; }
.empty-note {
  margin: 0;
  padding: 26px 12px;
  text-align: center;
  color: var(--text-faint);
  font-size: 0.875rem;
}

.arch-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
}
.arch-row:last-child { border-bottom: 0; }
.arch-main { flex: 1; min-width: 0; }
.arch-title { font-size: 0.9375rem; overflow-wrap: anywhere; }
.arch-meta { color: var(--text-faint); margin-top: 3px; }

.label-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.label-row .input { flex: 1; }

.kbd {
  display: inline-block;
  min-width: 22px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--field);
  font-family: var(--mono);
  font-size: 0.6875rem;
  text-align: center;
}
.shortcut-list { display: grid; gap: 8px; }
.shortcut-list > div {
  display: grid;
  grid-template-columns: 78px 1fr;
  align-items: center;
  justify-items: start;
  gap: 12px;
  font-size: 0.875rem;
}

/* stacked ask dialogs sit above the sheet and the main modal */
.scrim--top { z-index: 96; }
.modal--top { z-index: 97; }

/* toasts ------------------------------------------------------------------ */

.toasts {
  position: fixed;
  z-index: 80;
  left: 50%;
  bottom: calc(78px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  width: max-content;
  max-width: calc(100vw - 24px);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-pop);
  font-size: 0.875rem;
  pointer-events: auto;
  animation: toast-in 0.2s var(--ease) both;
}
.toast--error { border-color: var(--c-coral); color: var(--c-coral); }
.toast button {
  border: 0;
  background: transparent;
  color: var(--brass);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0;
}
.toast.is-leaving { animation: toast-out 0.16s var(--ease) both; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(6px); }
}

/* ==========================================================================
   Small screens
   ========================================================================== */

@media (max-width: 720px) {
  .board {
    scroll-snap-type: x mandatory;
    padding: 10px;
    gap: 10px;
  }
  .lane {
    flex: 0 0 min(88vw, 340px);
    scroll-snap-align: center;
  }
  .lane-new { flex: 0 0 min(60vw, 220px); }
  /* Columns snap to the viewport on a phone, so there is nothing to pull. */
  .lane-resize { display: none; }

  /* Thumbs are blunt: a bigger, rounder target that is hard to miss. */
  .card-check { width: 28px; height: 28px; border-width: 2px; }
  .card-check::after { width: 12px; height: 7px; border-width: 2.5px; }
  .lane--compact .card-check { width: 24px; height: 24px; }
  .card { gap: 11px; }
  .check-row input[type="checkbox"] { width: 22px; height: 22px; margin-top: 1px; }
  .check-row { padding: 8px 4px; }

  .board-switch { max-width: 52vw; }
  .topbar { gap: 6px; padding-inline: 8px; }

  .slot-lane { max-width: 104px; font-size: 0.75rem; }
  .slot-hint { display: none; }
  .btn--slot .btn-text { display: none; }
  .btn--slot { padding-inline: 14px; }

  .sheet {
    right: 0;
    left: 0;
    top: auto;
    width: auto;
    max-height: 90dvh;
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    transform: translateY(100%);
  }
  .sheet-head { padding-top: 12px; }
  .sheet-head::before {
    content: "";
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 38px;
    height: 4px;
    border-radius: 2px;
    background: var(--line);
  }

  .modal {
    top: auto;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 88dvh;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    transform: translate(0, 100%);
  }
  .modal.is-open { transform: translate(0, 0); }
}

@media (hover: none) {
  .check-row button { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
