/* =========================================================================
   Personal Kanban — design system
   ========================================================================= */
:root {
  --font: 'Inter var', Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, system-ui, sans-serif;
  --r-lg: 8px;
  --r-md: 6px;
  --r-sm: 5px;
  --r-xl: 12px;   /* floating surfaces: menus, toast */
  --r-2xl: 14px;  /* the card sheet */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --col-w: 300px;
  --appbar-h: 56px;

  --c-slate: #64748b;
  --c-stone: #78716c;
  --c-red: #ef4444;
  --c-orange: #f97316;
  --c-amber: #f59e0b;
  --c-yellow: #eab308;
  --c-lime: #84cc16;
  --c-green: #22c55e;
  --c-emerald: #10b981;
  --c-teal: #14b8a6;
  --c-cyan: #06b6d4;
  --c-sky: #0ea5e9;
  --c-blue: #3b82f6;
  --c-indigo: #6366f1;
  --c-violet: #8b5cf6;
  --c-fuchsia: #d946ef;
  --c-pink: #ec4899;
  --c-rose: #f43f5e;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0c0e14;
  --bg-grad: radial-gradient(1400px 720px at 8% -12%, rgba(56, 84, 152, 0.4) 0%, transparent 60%),
    radial-gradient(1200px 640px at 96% -8%, rgba(108, 66, 158, 0.32) 0%, transparent 56%),
    radial-gradient(900px 500px at 55% 115%, rgba(34, 96, 126, 0.22) 0%, transparent 60%);
  --surface: #191f2b;
  --surface-2: #202736;
  --surface-3: #273042;
  --surface-hover: #252e3f;
  --col-bg: rgba(21, 25, 35, 0.58);
  --border: rgba(154, 170, 200, 0.17);
  --border-soft: rgba(154, 170, 200, 0.11);
  --text: #e9edf4;
  --text-dim: #99a3b6;
  --text-faint: #7d879c;
  --card-hi: inset 0 1px 0 rgba(255, 255, 255, 0.045);
  --shadow: 0 18px 46px -20px rgba(0, 0, 0, 0.75);
  --shadow-col: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-card: 0 1px 1px rgba(0, 0, 0, 0.28), 0 2px 6px -2px rgba(0, 0, 0, 0.35);
  --shadow-card-hover: 0 3px 6px -2px rgba(0, 0, 0, 0.4), 0 12px 24px -10px rgba(0, 0, 0, 0.55);
  --shadow-drag: 0 24px 50px -12px rgba(0, 0, 0, 0.75);
  --glass: rgba(11, 13, 18, 0.66);
  --scrim: rgba(3, 5, 10, 0.62);
}

:root[data-theme='light'] {
  color-scheme: light;
  --bg: #f2f4f8;
  --bg-grad: radial-gradient(1400px 720px at 8% -12%, rgba(122, 152, 255, 0.2) 0%, transparent 60%),
    radial-gradient(1200px 640px at 96% -8%, rgba(196, 146, 255, 0.16) 0%, transparent 56%),
    radial-gradient(900px 500px at 55% 115%, rgba(84, 180, 220, 0.1) 0%, transparent 60%);
  --surface: #ffffff;
  --surface-2: #f3f5f9;
  --surface-3: #ebeef5;
  --surface-hover: #e9edf5;
  --col-bg: rgba(255, 255, 255, 0.52);
  --border: #dfe4ee;
  --border-soft: #e9edf4;
  --text: #171f2e;
  --text-dim: #55607a;
  --text-faint: #7c8499;
  --card-hi: none;
  --shadow: 0 20px 46px -22px rgba(30, 41, 74, 0.35);
  --shadow-col: 0 1px 2px rgba(30, 41, 74, 0.05);
  --shadow-card: 0 1px 1px rgba(30, 41, 74, 0.05), 0 2px 5px -2px rgba(30, 41, 74, 0.1);
  --shadow-card-hover: 0 3px 8px -3px rgba(30, 41, 74, 0.14), 0 14px 28px -14px rgba(30, 41, 74, 0.28);
  --shadow-drag: 0 26px 54px -14px rgba(30, 41, 74, 0.4);
  --glass: rgba(250, 251, 253, 0.7);
  --scrim: rgba(20, 28, 48, 0.42);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overscroll-behavior: none;
}

button { font-family: inherit; }
::selection { background: color-mix(in srgb, var(--c-blue) 30%, transparent); }

/* =========================================================================
   App bar
   ========================================================================= */
.appbar {
  height: var(--appbar-h);
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 clamp(12px, 2vw, 22px);
  padding-top: env(safe-area-inset-top);
  background: var(--glass);
  backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid var(--border-soft);
  z-index: 30;
}
.appbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 0 0 auto; }
.appbar-center { display: flex; align-items: center; justify-content: center; flex: 1 1 auto; min-width: 0; }
.appbar-right { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.tool-sep { width: 1px; height: 20px; background: var(--border); margin: 0 6px; flex: none; }

.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--c-violet), var(--c-blue));
  box-shadow: 0 4px 12px -4px color-mix(in srgb, var(--c-violet) 70%, transparent);
}
.board-name {
  font-size: clamp(15px, 2vw, 17px); font-weight: 650; letter-spacing: -0.015em;
  color: var(--text); background: none; border: none; cursor: pointer;
  padding: 6px 9px; border-radius: 9px; max-width: 42vw;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background 0.15s;
}
.board-name:hover { background: var(--surface-hover); }

.search {
  display: flex; align-items: center; gap: 8px; height: 36px;
  width: min(460px, 100%); flex: none;
  background: color-mix(in srgb, var(--surface-2) 65%, transparent);
  border: 1px solid var(--border-soft);
  border-radius: 10px; padding: 0 11px; color: var(--text-faint);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.search:focus-within {
  background: var(--surface);
  border-color: color-mix(in srgb, var(--c-blue) 55%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-blue) 15%, transparent);
}
.search input {
  border: none; background: none; outline: none; color: var(--text);
  font-size: 13.5px; flex: 1 1 auto; width: auto; min-width: 0; font-family: inherit;
}
.search input::placeholder { color: var(--text-faint); }
.search-kbd {
  flex: none; display: grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px;
  border: 1px solid var(--border); border-radius: 5px; background: var(--surface);
  font: 600 11px/1 var(--font); color: var(--text-faint);
}
.search:focus-within .search-kbd { opacity: 0; }

.tool-btn {
  position: relative; height: 36px; min-width: 36px; padding: 0 9px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 9px; border: 1px solid transparent; background: transparent;
  color: var(--text-dim); cursor: pointer; transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.tool-btn:hover { background: var(--surface-hover); color: var(--text); }
.tool-btn.active { color: var(--c-blue); background: color-mix(in srgb, var(--c-blue) 10%, transparent); }
.filter-count {
  position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--c-blue); color: #fff; font-size: 10.5px; font-weight: 700;
  display: grid; place-items: center;
}
/* Due bell: shown only when one or more cards are overdue; the whole icon is red
   with a count badge — a purely visual "something is due now" cue. */
.due-bell { color: var(--c-red); position: relative; }
.due-count {
  position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--c-red); color: #fff; font-size: 10.5px; font-weight: 700;
  display: grid; place-items: center;
}
/* Timer shows just a clock icon when idle; the countdown appears only while
   running so it doesn't sit in the bar as a stray "25:00" number. */
.pomo-time { font-variant-numeric: tabular-nums; font-weight: 640; font-size: 13px; display: none; }
.pomo-btn.running { color: var(--c-red); background: color-mix(in srgb, var(--c-red) 10%, transparent); }
.pomo-btn.running .pomo-ico { display: none; }
.pomo-btn.running .pomo-time { display: inline; }

/* theme icon swap */
.ico-sun { display: none; }
.ico-moon { display: block; }
:root[data-theme='dark'] .ico-sun { display: block; }
:root[data-theme='dark'] .ico-moon { display: none; }
/* When following the OS, a small dot marks the button as "auto/system". */
#theme-btn.is-system::after {
  content: ''; position: absolute; right: 4px; bottom: 4px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--c-blue); box-shadow: 0 0 0 2px var(--bg);
}

/* =========================================================================
   Board & columns
   ========================================================================= */
.board {
  flex: 1; min-height: 0;
  display: flex; align-items: stretch; gap: 14px;
  padding: 16px clamp(12px, 2vw, 22px) 20px;
  overflow-x: auto; overflow-y: hidden;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--text-faint) 35%, transparent) transparent;
}
.board::-webkit-scrollbar { height: 8px; }
.board::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text-faint) 35%, transparent); border-radius: 20px; }
.board::-webkit-scrollbar-track { background: transparent; }

.column {
  /* Grow to share the free width (so collapsing columns lets the rest fill the
     screen) but never shrink below --col-w — overflow scrolls instead. */
  flex: 1 0 var(--col-w); width: auto; min-width: 0;
  max-height: 100%; display: flex; flex-direction: column;
  background: var(--col-bg); backdrop-filter: blur(10px);
  border: 1px solid var(--border-soft); border-radius: var(--r-lg);
  box-shadow: var(--shadow-col); transition: box-shadow 0.15s, border-color 0.15s;
}
.column.drop-target { border-color: color-mix(in srgb, var(--c-blue) 55%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-blue) 20%, transparent), var(--shadow-col); }

.col-head {
  display: flex; align-items: center; gap: 8px; padding: 10px 10px 8px 14px;
  cursor: grab; touch-action: manipulation; user-select: none;
}
.col-head:active { cursor: grabbing; }
.col-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 0%, transparent); }
.col-name {
  flex: 1; min-width: 0; font-weight: 640; font-size: 13.5px; letter-spacing: -0.005em; color: var(--text);
  background: none; border: none; outline: none; padding: 4px 6px; border-radius: 7px;
  font-family: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.col-name:focus { background: var(--surface-hover); white-space: normal; }
.col-count {
  font-size: 12px; font-weight: 600; color: var(--text-faint);
  font-variant-numeric: tabular-nums; padding: 2px 4px; flex: none;
}
.col-count.over { color: var(--c-red); background: color-mix(in srgb, var(--c-red) 14%, transparent); border-radius: 8px; padding: 2px 7px; }
.col-menu { border: none; background: none; color: var(--text-faint); cursor: pointer; padding: 4px; border-radius: 7px; display: grid; place-items: center; }
.col-menu:hover { background: var(--surface-hover); color: var(--text); }
/* Add-card "+" in the header — always visible (unlike the hover-only chrome),
   green accent so it's easy to find without scrolling to the column bottom. */
.col-add { border: none; background: none; color: var(--c-green); cursor: pointer; padding: 4px; border-radius: 7px; display: grid; place-items: center; flex: none; }
.col-add:hover { background: color-mix(in srgb, var(--c-green) 16%, transparent); }
/* Column chrome stays visible (so it's discoverable, like the "+"), just quiet
   until you engage with the column on pointer devices. */
@media (hover: hover) {
  .col-collapse, .col-menu { opacity: 0.6; transition: opacity 0.15s, background 0.15s, color 0.15s; }
  .column:hover .col-collapse, .column:focus-within .col-collapse,
  .column:hover .col-menu, .column:focus-within .col-menu { opacity: 1; }
}

.card-list {
  list-style: none; margin: 0; padding: 2px 10px 8px;
  overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 40px;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--text-faint) 30%, transparent) transparent;
}
.card-list::-webkit-scrollbar { width: 6px; }
.card-list::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text-faint) 30%, transparent); border-radius: 20px; }

/* =========================================================================
   Card
   ========================================================================= */
.card {
  position: relative; background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--r-md); padding: 11px 13px 12px; flex: none;
  box-shadow: var(--shadow-card), var(--card-hi);
  cursor: pointer; touch-action: manipulation; list-style: none; overflow: hidden;
  transition: transform 0.13s var(--ease), box-shadow 0.16s, border-color 0.16s;
}
/* Colour anchor (Option C, hybrid): a 3px left bar (the scan anchor) + a quiet
   oklab wash (keeps dark ambers/greens clean) + a softly tinted border so
   same-category cards still separate. Uniform rounded corners; the bar's corners
   are clipped by the card's overflow:hidden. */
.card.has-accent {
  padding-left: 14px;
  background: color-mix(in oklab, var(--card-accent) 7%, var(--surface));
  border-color: color-mix(in srgb, var(--card-accent) 26%, var(--border));
}
.card.has-accent::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--card-accent);
}
.card > * { position: relative; z-index: 1; }
/* The drag ghost is an <li> cloned onto <body>; kill any list marker (dot). */
.drag-ghost { list-style: none; scale: 1.03; } /* subtle "lifted" feel */
.drag-ghost::marker { content: ''; }
@media (hover: hover) {
  .card:hover {
    transform: translateY(-1px);
    border-color: var(--border);
    box-shadow: var(--shadow-card-hover), var(--card-hi);
  }
  /* Keep (and slightly deepen) the category border on hover instead of washing
     it back to neutral. */
  .card.has-accent:hover { border-color: color-mix(in srgb, var(--card-accent) 42%, var(--border)); }
}
.card.source-hidden { opacity: 0; pointer-events: none; }

.card-labels { display: flex; flex-wrap: wrap; gap: 5px 8px; margin-bottom: 7px; }
/* Card labels: a small colour dot + quiet name. The loud tinted pills live only
   in the editor sheet, where the labels are the thing being edited. */
.card-label {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.01em; color: var(--text-dim); white-space: nowrap;
}
.card-label::before { content: ''; width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--dot); }
.chip {
  display: inline-flex; align-items: center; height: 18px; padding: 0 7px;
  font-size: 10.5px; font-weight: 640; letter-spacing: 0.01em; border-radius: 6px; white-space: nowrap;
  color: var(--chip-fg); background: var(--chip-bg);
}
/* Light mode: the raw palette colour on its own 20% tint is too low-contrast —
   pull the text toward --text so chip labels stay legible. */
:root[data-theme='light'] .sheet-labels .chip:not(.important-chip) { color: color-mix(in srgb, var(--chip-fg) 52%, var(--text)); }
.chip.removable { border: none; cursor: pointer; font-family: inherit; }
.chip .chip-x { margin-left: 5px; font-size: 9px; opacity: 0.5; }
.chip.removable:hover .chip-x { opacity: 1; }
/* Priority "Wichtig": a red ! marker on the card, and a red chip in the sheet. */
/* Priority corner flag: a plain red dog-ear in the card's top-right corner
   (clipped by the card's rounded corner). The red mark alone signals priority. */
.card > .card-flag {
  position: absolute; top: 0; right: 0; z-index: 2; width: 22px; height: 22px; overflow: hidden; pointer-events: none;
}
.card-flag::before {
  content: ''; position: absolute; top: 0; right: 0;
  border-style: solid; border-width: 0 22px 22px 0;
  border-color: transparent var(--c-red) transparent transparent;
}
.chip.important-chip { color: #fff; background: var(--c-red); gap: 1px; }
.chip.important-chip .imp-mark { display: inline-grid; place-items: center; width: 13px; height: 13px; margin-right: 3px; border-radius: 50%; background: rgba(255,255,255,0.28); font-size: 10px; font-weight: 800; }
.menu .item .imp-ic { display: inline-grid; place-items: center; width: 16px; height: 16px; flex: none; border-radius: 50%; background: var(--c-red); color: #fff; font-size: 11px; font-weight: 800; }
.card-title { font-size: 14px; font-weight: 560; letter-spacing: -0.006em; line-height: 1.42; color: var(--text); word-break: break-word; }

.card-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.card-meta:empty { display: none; }
.day-sep {
  list-style: none; margin: 4px 2px 2px; padding: 2px 2px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint);
  display: flex; align-items: center; gap: 8px;
}
.day-sep::after { content: ''; flex: 1; height: 1px; background: var(--border-soft); }
/* Filtered column count + empty/no-match resting state. */
.col-count.filtered, .cc-count.filtered { color: var(--c-blue); background: color-mix(in srgb, var(--c-blue) 10%, transparent); border-radius: 8px; padding: 2px 7px; }
.col-empty {
  list-style: none; margin: 6px 2px; padding: 18px 10px; text-align: center;
  font-size: 12px; color: var(--text-faint); border: 1.5px dashed var(--border-soft); border-radius: var(--r-md);
}
.card-checklist { list-style: none; margin: 9px 0 2px; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.card-checklist li { display: flex; align-items: flex-start; gap: 9px; font-size: 12.5px; line-height: 1.35; color: var(--text-dim); }
.cc-box {
  position: relative; flex: none; width: 16px; height: 16px; margin-top: 1px; border: 1.5px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); cursor: pointer; padding: 0; transition: border-color 0.12s, background 0.12s;
}
.cc-box::after { content: ''; position: absolute; inset: -8px; } /* ~32px touch target, visual size unchanged */
@media (hover: none) {
  .card-checklist { gap: 6px; }
  .subtask-grip, .subtask-del, .subtask-icon { padding: 8px; margin-top: 0; }
}
.cc-box:hover { border-color: var(--c-green); background: color-mix(in srgb, var(--c-green) 14%, var(--surface)); }
.cc-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-checklist .cc-more { color: var(--text-faint); font-size: 11.5px; padding-left: 22px; }
.badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600;
  padding: 2px 8px; border-radius: 7px; background: var(--surface-2); color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.badge svg { width: 12px; height: 12px; opacity: 0.9; }
.badge.due-soon { color: var(--c-amber); background: color-mix(in srgb, var(--c-amber) 14%, transparent); }
.badge.due-over { color: var(--c-red); background: color-mix(in srgb, var(--c-red) 14%, transparent); }
.badge.checks.complete { color: var(--c-green); background: color-mix(in srgb, var(--c-green) 14%, transparent); }
.badge.checks { gap: 5px; }
.mini-progress { display: inline-block; width: 44px; height: 4px; border-radius: 3px; background: color-mix(in srgb, var(--text-faint) 24%, transparent); overflow: hidden; vertical-align: middle; }
.mini-progress i { display: block; height: 100%; border-radius: 3px; transition: width 0.25s var(--ease); }
.badge.icon-only { padding: 2px 6px; }

/* Drag ghost + placeholder */
.drag-ghost {
  position: fixed; top: 0; left: 0; z-index: 200; pointer-events: none;
  box-shadow: var(--shadow-drag); border-radius: var(--r-md);
  opacity: 0.97; will-change: transform;
}
/* Performance: backdrop blur on every column is expensive to repaint while
   dragging/auto-scrolling on mobile — drop it for the duration of the drag. */
body.dragging .column,
body.dragging .appbar { backdrop-filter: none; }
.drag-ghost.col-ghost { border-radius: var(--r-lg); }
.placeholder {
  border: 2px dashed color-mix(in srgb, var(--c-blue) 45%, transparent);
  background: color-mix(in srgb, var(--c-blue) 7%, transparent);
  border-radius: var(--r-md); flex: none;
}
.col-placeholder {
  flex: 0 0 var(--col-w); width: var(--col-w); align-self: stretch;
  border-radius: var(--r-lg); border: 2px dashed color-mix(in srgb, var(--c-blue) 45%, transparent);
  background: color-mix(in srgb, var(--c-blue) 6%, transparent);
}
body.dragging, body.dragging * { cursor: grabbing !important; }
body.dragging { user-select: none; }
/* While dragging a card, turn off column snap AND smooth-scroll so the board can
   auto-scroll sideways to reach far columns. Mandatory snap froze the viewport;
   smooth-scroll made each per-frame nudge animate, so the board crawled. */
body.dragging .board { scroll-snap-type: none; scroll-behavior: auto; }

/* =========================================================================
   Popover menus
   ========================================================================= */
.menu {
  position: fixed; z-index: 120; min-width: 214px; max-width: min(300px, 92vw);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl);
  box-shadow: var(--shadow); padding: 6px; animation: pop 0.14s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.98); } }
.menu-label { font-size: 10.5px; color: var(--text-faint); padding: 8px 10px 4px; text-transform: uppercase; letter-spacing: 0.07em; font-weight: 700; }
.menu button.item {
  display: flex; align-items: center; gap: 9px; width: 100%; border: none; background: none;
  color: var(--text); text-align: left; padding: 8px 10px; border-radius: 8px; font-size: 13.5px; cursor: pointer;
}
.menu button.item:hover { background: var(--surface-hover); }
.menu button.item.danger { color: var(--c-red); }
.menu button.item svg { width: 16px; height: 16px; flex: none; opacity: 0.8; }
.menu hr { border: none; border-top: 1px solid var(--border-soft); margin: 6px 4px; }
/* Fixed 6-per-row grid so the palette is always even rows (18 colours = 3×6). */
.swatch-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; padding: 6px 10px 9px; justify-items: center; }
.swatch {
  width: 23px; height: 23px; border-radius: 50%; cursor: pointer; border: 2px solid transparent;
  transition: transform 0.1s; position: relative;
}
.swatch:hover { transform: scale(1.15); }
.swatch.active { border-color: var(--surface); box-shadow: 0 0 0 2px currentColor; }
.menu input[type='number'], .menu input[type='text'] {
  width: 100%; border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  border-radius: 9px; padding: 8px 10px; font-size: 13.5px; font-family: inherit; outline: none;
}
.menu input:focus { border-color: var(--c-blue); }
.menu-toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 10px; font-size: 13.5px; color: var(--text); cursor: pointer; }
.menu-toggle input { width: 17px; height: 17px; accent-color: var(--c-blue); cursor: pointer; }
.menu-num { padding: 2px 10px 8px; }
.menu-num .menu-label { padding: 0 0 4px; }
.menu-hint { padding: 0 10px 6px; margin-top: -2px; font-size: 11.5px; color: var(--text-faint); }

/* In-app text prompt (board create/rename) — replaces native prompt() */
.text-prompt { min-width: 240px; }
.prompt-form { display: flex; gap: 6px; align-items: stretch; padding: 2px 6px 6px; }
.prompt-form .prompt-input { flex: 1; min-width: 0; }
.prompt-form .prompt-ok {
  flex: none; border: none; background: var(--c-blue); color: #fff; border-radius: 9px;
  padding: 8px 13px; font-size: 13px; font-weight: 650; font-family: inherit; cursor: pointer;
}
.prompt-form .prompt-ok:hover { filter: brightness(1.07); }

/* label rows (filter + manager) */
.label-row { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 8px; cursor: pointer; }
.label-row:hover { background: var(--surface-hover); }
.label-row .dot { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.label-row .name { flex: 1; min-width: 0; font-size: 13.5px; color: var(--text); }
.label-row input.name { border: none; background: none; outline: none; font-family: inherit; padding: 3px 5px; border-radius: 6px; }
.label-row input.name:focus { background: var(--surface-3); }
.label-row .check { width: 17px; height: 17px; border-radius: var(--r-sm); border: 1.5px solid var(--border); display: grid; place-items: center; color: #fff; }
.label-row .check.on { background: var(--c-blue); border-color: var(--c-blue); }
.label-row .edit { opacity: 0; color: var(--text-faint); border: none; background: none; cursor: pointer; padding: 4px; border-radius: 6px; display: grid; place-items: center; flex: none; transition: opacity 0.12s, color 0.12s, background 0.12s; }
.label-row .edit:hover { color: var(--text); background: var(--surface-hover); }
.label-row:hover .edit, .label-row:focus-within .edit { opacity: 1; }
@media (hover: none) { .label-row .edit { opacity: 0.6; } }
/* Label manager: colour swatch as a clickable dot + inline "new label" row. */
.label-manager .label-rows { max-height: 46vh; overflow-y: auto; }
.dot-btn { border: none; background: none; padding: 4px; border-radius: 6px; cursor: pointer; display: grid; place-items: center; flex: none; }
.dot-btn:hover { background: var(--surface-hover); }
.label-add { display: flex; align-items: center; gap: 6px; padding: 6px 6px 2px; }
.label-add-plus { flex: none; width: 14px; text-align: center; color: var(--text-faint); font-weight: 700; }
.label-add input { flex: 1; min-width: 0; border: none; background: none; outline: none; font-size: 13.5px; color: var(--text); font-family: inherit; padding: 6px 4px; }
.label-add input::placeholder { color: var(--text-faint); }
.label-add .dot { width: 13px; height: 13px; border-radius: 4px; }

/* =========================================================================
   Card sheet / modal
   ========================================================================= */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 90; background: var(--scrim); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; gap: 12px; padding: 20px; animation: fade 0.15s ease;
}
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: relative; width: min(600px, 100%); max-height: min(90vh, 820px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-2xl);
  box-shadow: var(--shadow); padding: 8px 22px 18px; animation: sheetIn 0.22s var(--ease);
  --card-accent: var(--c-slate);
}
/* The opened card uses one flat background colour — no coloured gradient wash. */
.sheet > * { position: relative; z-index: 1; }
@keyframes sheetIn { from { opacity: 0; transform: translateY(14px) scale(0.985); } }
.sheet-grab { display: none; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding-top: 12px; }
.sheet-labels { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; flex: 1; }
.sheet-labels .chip { height: 22px; padding: 0 9px; font-size: 11.5px; border-radius: 7px; }
.sheet-labels .add-label-btn {
  height: 24px; padding: 0 10px; border-radius: 8px; border: 1px dashed var(--border);
  background: none; color: var(--text-faint); font-size: 12px; font-weight: 600; cursor: pointer;
}
.sheet-labels .add-label-btn:hover { color: var(--text); border-color: var(--text-faint); }
.icon-btn { height: 34px; width: 34px; flex: none; display: grid; place-items: center; border-radius: 9px; border: 1px solid var(--border-soft); background: var(--surface-2); color: var(--text-dim); cursor: pointer; }
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }

.sheet-title {
  width: 100%; margin: 12px 0 4px; border: none; background: none; color: var(--text);
  font-size: clamp(19px, 3vw, 22px); font-weight: 700; letter-spacing: -0.02em; font-family: inherit; outline: none;
  line-height: 1.28; padding: 6px 8px; border-radius: 8px;
  display: block; resize: none; overflow: hidden;
}
.sheet-title:focus { background: var(--surface-2); }
.field { margin-top: 14px; }
.field-label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-faint); margin-bottom: 7px; }
/* Column field: a custom popover trigger (a native <select> can't show a colour
   dot per option). Styled to hang like the sibling sheet fields. The trigger
   shows the current column's dot + name; the popover lists all columns w/ dots. */
#field-column .col-trigger {
  display: flex; align-items: center; gap: 8px; width: calc(100% + 12px); margin-left: -12px;
  border: 1px solid var(--border-soft); background: transparent; color: var(--text);
  border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 14px; text-align: left; cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.col-trigger-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-trigger-caret { opacity: 0.55; flex: none; }
.col-select-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
@media (hover: hover) { #field-column .col-trigger:hover { background: var(--surface-2); border-color: var(--border); } }
#field-column .col-trigger:focus-visible { outline: none; background: var(--surface-2); border-color: var(--c-blue); }
/* Colour dot per row in the column popover. */
.menu-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.menu button.item.active { font-weight: 650; background: var(--surface-2); }
/* Due bell popover: one row per ringing card (tap to open) + silence-all. */
.due-menu { min-width: 244px; }
.due-item .due-item-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.due-item .due-item-when { color: var(--text-faint); font-size: 12px; flex: none; }
.sheet-grid { display: flex; flex-wrap: wrap; gap: 12px 14px; margin-top: 6px; }
.sheet-grid .field { flex: 1 1 200px; margin-top: 8px; }
input[type='date'], input[type='datetime-local'], select {
  width: 100%; border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  border-radius: 10px; padding: 10px 12px; font-size: 14px; font-family: inherit; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type='date']:focus, input[type='datetime-local']:focus, select:focus { border-color: var(--c-blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-blue) 13%, transparent); }
.sheet-desc {
  width: 100%; min-height: 40px; resize: none; overflow: hidden; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); border-radius: 11px; padding: 10px 12px;
  font-size: 14px; font-family: inherit; outline: none; line-height: 1.55;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.sheet-desc:focus { border-color: var(--c-blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-blue) 13%, transparent); }
/* Markdown cheat-sheet under the textarea — stays visible while editing, so the
   syntax is at hand once the placeholder disappears. */
.desc-hint { display: flex; flex-wrap: wrap; gap: 5px 6px; margin-top: 6px; }
.desc-hint code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11.5px;
  color: var(--text-faint); background: var(--surface-3); border-radius: 5px; padding: 1px 6px; white-space: nowrap;
}

.row-between { display: flex; align-items: baseline; justify-content: space-between; }
.checklist-progress { font-size: 12px; color: var(--text-faint); font-weight: 650; font-variant-numeric: tabular-nums; }
.progress-track { height: 5px; border-radius: 6px; background: var(--surface-3); overflow: hidden; margin-bottom: 8px; }
.progress-fill { height: 100%; background: var(--c-green); border-radius: 6px; transition: width 0.25s var(--ease), background 0.25s var(--ease); }
/* Rendered Markdown read view for the description — matches the textarea box and
   hangs 12px into the sheet padding like the other fields. Tap it to edit. */
.sheet-desc-view {
  width: calc(100% + 12px); margin-left: -12px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); border-radius: 11px; padding: 10px 12px;
  font-size: 14px; line-height: 1.55; cursor: text; word-break: break-word;
}
@media (hover: hover) { .sheet-desc-view:hover { border-color: color-mix(in srgb, var(--c-blue) 40%, var(--border)); } }
/* Live preview shown WHILE editing (below the textarea): dashed, labelled, not
   itself editable-looking, so it reads as a preview rather than the read view. */
.sheet-desc-view.is-preview { margin-top: 8px; background: transparent; border-style: dashed; border-color: var(--border-soft); cursor: default; }
.sheet-desc-view.is-preview::before {
  content: 'Vorschau'; display: block; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-faint); margin-bottom: 6px;
}
@media (hover: hover) { .sheet-desc-view.is-preview:hover { border-color: var(--border-soft); } }
.sheet-desc-view.md > :first-child { margin-top: 0; }
.sheet-desc-view.md > :last-child { margin-bottom: 0; }
.sheet-desc-view.md p { margin: 0 0 8px; }
.sheet-desc-view.md h3, .sheet-desc-view.md h4, .sheet-desc-view.md h5 { margin: 12px 0 6px; font-size: 15px; font-weight: 700; line-height: 1.3; }
.md img.md-img { display: block; max-width: 100%; height: auto; border-radius: 8px; margin: 8px 0; border: 1px solid var(--border-soft); }
.sheet-desc-view.md ul, .sheet-desc-view.md ol { margin: 4px 0 8px; padding-left: 20px; }
.sheet-desc-view.md li { margin: 2px 0; }
.sheet-desc-view.md code { background: var(--surface-3); padding: 1px 5px; border-radius: 5px; font-size: 0.9em; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.inline-link { color: var(--c-blue); text-decoration: underline; text-underline-offset: 2px; }
.desc-saved {
  display: block; text-align: right; margin-top: 5px; font-size: 11.5px; font-weight: 600; color: var(--c-green);
  opacity: 0; transition: opacity 0.2s;
}
.desc-saved.show { opacity: 1; }
.subtask-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.subtask { display: flex; align-items: flex-start; gap: 6px; padding: 5px 6px; border-radius: 9px; transition: background 0.12s; }
.subtask:hover { background: var(--surface-2); }
.subtask.dragging { background: var(--surface); box-shadow: var(--shadow-card); position: relative; z-index: 5; transition: none; }
.subtask.dragging .subtask-text { pointer-events: none; }
.subtask-grip {
  border: none; background: none; color: var(--text-faint); cursor: grab; padding: 3px 1px; flex: none;
  display: grid; place-items: center; border-radius: 6px; touch-action: none; margin-top: 2px;
  opacity: 0; transition: opacity 0.12s, color 0.12s;
}
.subtask-grip:hover { color: var(--text); }
.subtask-grip:active { cursor: grabbing; }
.subtask input[type='checkbox'] { width: 17px; height: 17px; accent-color: var(--c-green); cursor: pointer; flex: none; margin: 3px 0 0; }
.subtask-text {
  flex: 1; min-width: 0; font-size: 14px; line-height: 1.4; border: none; background: none; color: var(--text);
  outline: none; font-family: inherit; padding: 2px 4px; border-radius: 7px; resize: none; overflow: hidden; min-height: 24px;
}
.subtask-text:focus { background: var(--surface-3); }
.subtask.done .subtask-text { text-decoration: line-through; color: var(--text-faint); }
.subtask-del { border: none; background: none; color: var(--text-faint); cursor: pointer; opacity: 0; padding: 3px 4px; border-radius: 6px; flex: none; margin-top: 2px; font-size: 13px; transition: opacity 0.12s, color 0.12s; }
.subtask:hover .subtask-del { opacity: 1; }
.subtask-del:hover { color: var(--c-red); }
.subtask-icon { display: grid; place-items: center; border: none; background: none; color: var(--text-faint); cursor: pointer; opacity: 0; padding: 3px 4px; border-radius: 6px; flex: none; margin-top: 2px; text-decoration: none; transition: opacity 0.12s, color 0.12s; }
.subtask:hover .subtask-icon { opacity: 1; }
.subtask-convert:hover { color: var(--c-blue); }
.subtask-link { opacity: 0.7; color: var(--c-blue); }
.subtask:hover .subtask-link { opacity: 1; }
@media (hover: hover) { .subtask:hover .subtask-grip { opacity: 1; } }
@media (hover: none) { .subtask-grip, .subtask-del, .subtask-icon { opacity: 0.55; } }
body.sub-dragging, body.sub-dragging * { cursor: grabbing !important; user-select: none; }

.subtask-add input {
  width: 100%; margin-top: 6px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); border-radius: 9px; padding: 10px 12px; font-size: 14px; font-family: inherit; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.subtask-add input:focus { border-color: var(--c-blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-blue) 13%, transparent); }

/* Footer: an even action bar of icon+label cells (Löschen set apart in red). */
/* Floating action rail beside the sheet (KanbanFlow-style). */
.sheet-rail {
  align-self: center; display: flex; flex-direction: column; gap: 8px; flex: none;
  animation: sheetIn 0.22s var(--ease);
}
.rail-btn {
  display: flex; align-items: center; gap: 10px; padding: 0 14px 0 0;
  border: none; background: none; color: var(--text-dim); font-family: inherit;
  font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.rail-ic {
  width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border-soft); color: var(--text-dim);
  box-shadow: var(--shadow-card); transition: background 0.15s, color 0.15s, transform 0.12s, border-color 0.15s;
}
.rail-label {
  padding: 3px 10px; border-radius: var(--r-lg); border: none; box-shadow: none;
  background: var(--glass); backdrop-filter: blur(8px); color: var(--text-dim); transition: color 0.15s;
}
.rail-btn:hover .rail-ic { background: var(--surface-hover); color: var(--text); transform: translateY(-1px); }
.rail-btn:hover .rail-label { color: var(--text); }
.rail-btn.primary .rail-ic { background: var(--c-blue); border-color: transparent; color: #fff; }
.rail-btn.primary:hover .rail-ic { background: color-mix(in srgb, var(--c-blue) 88%, #000); color: #fff; }
.rail-btn.danger .rail-ic { color: var(--c-red); } /* red at rest so Löschen is never mistaken for Archivieren */
.rail-btn.danger:hover .rail-ic { background: color-mix(in srgb, var(--c-red) 14%, var(--surface)); color: var(--c-red); border-color: color-mix(in srgb, var(--c-red) 40%, transparent); }
.rail-btn.danger:hover .rail-label { color: var(--c-red); }
.rail-btn[hidden] { display: none; }
.rail-sep { width: 42px; height: 1px; margin: 2px 0; background: var(--border-soft); }
.sheet-updated { margin-top: 14px; text-align: right; }
.sheet-meta { font-size: 12px; color: var(--text-faint); }

/* ---------- Inline editing ----------
   Fields read as plain text and only reveal their box on hover/focus, so the
   detail feels like a read view yet every value edits in place (Trello/Linear
   style — no separate edit mode). */
.sheet :is(.sheet-title, .sheet-desc, input[type='date'], input[type='datetime-local'], select) {
  background: transparent; border-color: transparent; box-shadow: none;
  transition: background 0.12s, border-color 0.12s;
}
.sheet select { -webkit-appearance: none; appearance: none; background-image: none; }
/* Constant geometry: the box hangs 12px into the sheet's left padding so the
   flat text never shifts when a field is focused (Notion/Linear hanging field). */
.sheet :is(.sheet-desc, input[type='date'], input[type='datetime-local'], select) {
  padding-left: 12px; margin-left: -12px; width: calc(100% + 12px);
}
/* A subtle always-visible border so fields read as editable even without hover
   (essential on touch, where there is no hover); hover/focus fill + strengthen
   them below. The title stays borderless — it reads as a heading. */
.sheet :is(.sheet-desc, input[type='date'], input[type='datetime-local'], select) {
  border-color: var(--border-soft);
}
@media (hover: hover) {
  .sheet :is(.sheet-desc, input[type='date'], input[type='datetime-local'], select):hover {
    background: var(--surface-2); border-color: var(--border);
  }
}
.sheet :is(.sheet-title, .sheet-desc, input[type='date'], input[type='datetime-local'], select):focus {
  background: var(--surface-2); border-color: var(--c-blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-blue) 13%, transparent);
}
:root[data-theme='dark'] .sheet :is(input[type='date'], input[type='datetime-local'])::-webkit-calendar-picker-indicator { filter: invert(0.85); }

/* =========================================================================
   Toast + gate
   ========================================================================= */
.toast {
  position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(8px);
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  padding: 11px 17px; border-radius: var(--r-xl); box-shadow: var(--shadow); font-size: 13.5px; font-weight: 500;
  z-index: 150; opacity: 0; transition: opacity 0.2s, transform 0.2s var(--ease); max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
/* Error toasts are hard to miss: red, icon, and pinned to the TOP so they don't
   hide at the bottom edge of the screen. */
.toast.error {
  top: calc(20px + env(safe-area-inset-top)); bottom: auto;
  transform: translateX(-50%) translateY(-8px);
  background: color-mix(in srgb, var(--c-red) 13%, var(--surface));
  border-color: color-mix(in srgb, var(--c-red) 48%, transparent);
  box-shadow: 0 10px 30px color-mix(in srgb, var(--c-red) 30%, transparent);
  font-weight: 600;
}
.toast.error.show { transform: translateX(-50%) translateY(0); }
.toast-ic { display: inline-flex; align-items: center; color: var(--c-red); flex: none; }

.gate {
  position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 24px;
  background: var(--bg); background-image: var(--bg-grad);
}
.gate-card {
  width: min(390px, 100%); background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; box-shadow: var(--shadow); padding: 32px 28px; text-align: center; animation: sheetIn 0.22s var(--ease);
}
.gate-mark { color: var(--c-violet); margin-bottom: 10px; }
.gate-card h2 { margin: 0 0 6px; font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.gate-sub { margin: 0 0 20px; font-size: 13.5px; color: var(--text-dim); line-height: 1.5; }
.gate-card input {
  width: 100%; border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  border-radius: 12px; padding: 13px 15px; font-size: 15px; font-family: inherit; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.gate-card input:focus { border-color: var(--c-blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-blue) 18%, transparent); }
.gate-error { color: var(--c-red); font-size: 13px; font-weight: 500; margin-top: 10px; }
.gate-btn {
  width: 100%; margin-top: 16px; border: none; border-radius: 12px; padding: 13px; font-size: 15px;
  font-weight: 650; color: #fff; background: linear-gradient(135deg, var(--c-violet), var(--c-blue));
  cursor: pointer; transition: filter 0.15s, transform 0.1s;
}
.gate-btn:hover { filter: brightness(1.08); }
.gate-btn:active { transform: translateY(1px); }

/* =========================================================================
   Responsive
   ========================================================================= */
@media (min-width: 1800px) { :root { --col-w: 320px; } .board { gap: 18px; } }

/* Tablet / narrow desktop: the labeled rail is ~170px wide and pushes the
   centered sheet visibly off-axis. Icons-only keeps the sheet centered; the
   buttons keep their aria-labels/titles. */
@media (min-width: 761px) and (max-width: 1099px) {
  .rail-label { display: none; }
  .rail-btn { padding: 0; }
  .rail-sep { width: 42px; }
}
/* Touch tablets: gentle column snapping (proximity, never forced) so scrolling
   feels guided like on the phone without fighting free scroll. */
@media (min-width: 761px) and (hover: none) and (pointer: coarse) {
  .board { scroll-snap-type: x proximity; }
  .column { scroll-snap-align: start; }
}

@media (max-width: 760px) {
  :root { --col-w: 84vw; --appbar-h: 54px; }
  .board { gap: 12px; padding: 12px 12px 16px; scroll-snap-type: x mandatory; }
  /* scroll-snap-stop:always → a swipe advances at most ONE column, however fast
     you flick (no carousel spin past several columns). */
  .column { flex: 0 0 var(--col-w); scroll-snap-align: center; scroll-snap-stop: always; }
  .only-wide { display: none; }
  /* Keep the board name (= board switcher) always visible; let the search flex
     into the remaining space and shrink instead of pushing the name out. */
  .appbar { gap: 6px; }
  .appbar-left { flex: 0 0 auto; min-width: 0; }
  .appbar-center { flex: 1 1 auto; min-width: 0; }
  .appbar-right { flex: 0 0 auto; gap: 0; }
  .board-name { max-width: 38vw; }
  .search { width: 100%; min-width: 0; }
  .search input { width: auto; flex: 1 1 auto; min-width: 0; }
  .search-kbd { display: none; }
  .tool-sep { display: none; }
  /* 16px min on every text control so iOS Safari doesn't zoom the viewport on
     focus (which jolts the layout on each "add item" tap). */
  .search input, .subtask-add input, .sheet-desc, .subtask-text,
  input[type='date'], input[type='datetime-local'], select { font-size: 16px; }

  /* Card detail becomes a bottom sheet. Cap the height so the top edge (and its
     close button) never slides under the browser's address bar, and keep the
     grab handle + close button pinned while the body scrolls. */
  .sheet-backdrop { flex-direction: column; align-items: stretch; justify-content: flex-end; gap: 0; padding: 0; }
  .sheet {
    width: 100%; max-height: 86dvh; border-radius: 0; padding: 0 18px calc(18px + env(safe-area-inset-bottom));
    animation: sheetUp 0.26s var(--ease);
  }
  /* No room beside the sheet on phones: the rail becomes a flat horizontal
     toolbar capping the top of the bottom sheet. Flat icons on a tinted bar read
     as a clean toolbar instead of washed-out white circles on white. */
  .sheet-rail {
    order: -1; flex-direction: row; justify-content: space-around; align-self: stretch; gap: 2px;
    background: var(--surface-2); border-radius: 0; border-bottom: 1px solid var(--border);
    padding: 8px 6px; animation: sheetUp 0.26s var(--ease);
  }
  .sheet-rail .rail-btn { flex-direction: column; gap: 3px; padding: 6px 2px; flex: 1 1 0; min-width: 0; font-size: 11px; letter-spacing: 0.01em; border-radius: 10px; }
  .sheet-rail .rail-btn:active { background: var(--surface-hover); }
  .sheet-rail .rail-ic { width: 32px; height: 32px; background: none; border: none; box-shadow: none; color: var(--text-dim); transform: none; }
  .sheet-rail .rail-btn.primary .rail-ic { background: none; color: var(--c-blue); }
  .sheet-rail .rail-btn.danger .rail-ic { color: var(--c-red); }
  .sheet-rail .rail-label { padding: 0; border: none; background: none; box-shadow: none; color: var(--text-faint); }
  .sheet-rail .rail-sep { display: none; }
  @keyframes sheetUp { from { transform: translateY(100%); } }
  /* Grab handle caps the whole panel and is the swipe-to-dismiss affordance;
     it stays put (it's a sibling of the scrolling sheet) while the head + body
     scroll underneath. */
  .sheet-grab {
    display: block; order: -2; align-self: stretch; position: relative;
    background: var(--surface-2); border-radius: 18px 18px 0 0; padding: 11px 0 9px;
    cursor: grab; touch-action: none; animation: sheetUp 0.26s var(--ease);
  }
  .sheet-grab::before { content: ''; display: block; width: 40px; height: 5px; border-radius: 4px; background: var(--text-faint); opacity: 0.5; margin: 0 auto; }
  .sheet-grab:active { cursor: grabbing; }
  /* Header now scrolls with the content (no longer pinned); the grab handle is
     the persistent close affordance instead. */
  .sheet-head { margin: 0 -18px; padding: 6px 18px 8px; }
  /* Stacked on mobile: reset the 200px flex-basis (which becomes a 200px *height*
     in a column flex container and left huge gaps between the fields). */
  .sheet-grid { flex-direction: column; gap: 0; }
  .sheet-grid .field { flex: 0 0 auto; }
}

@media (max-width: 420px) {
  .search { padding: 0 9px; }
  .tool-btn { padding: 0 7px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.05ms !important; scroll-behavior: auto !important; }
}

/* ---------- Multi-board UI ---------- */
.board-name { display: inline-flex; align-items: center; gap: 5px; }
.board-name::after { content: '▾'; font-size: 10px; color: var(--text-faint); translate: 0 1px; }

.board-move-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.chip-btn {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-dim);
  border-radius: 20px; padding: 7px 13px; font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.chip-btn:hover { background: var(--surface-hover); color: var(--text); }

.comment-list { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.comment { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 10px; padding: 9px 11px; }
.comment-text { font-size: 13.5px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.comment-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 5px; }
.comment-time { font-size: 11px; color: var(--text-faint); }
.comment-del { border: none; background: none; color: var(--text-faint); cursor: pointer; font-size: 12px; padding: 2px 5px; border-radius: 6px; }
.comment-del:hover { color: var(--c-red); }

.sheet-heading { display: inline-flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 680; letter-spacing: -0.01em; color: var(--text); }
.sheet-heading svg { color: var(--text-dim); }
.archive-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.archive-item { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 11px; padding: 10px 12px; }
.archive-item .a-title { flex: 1; font-size: 14px; font-weight: 550; word-break: break-word; }
.archive-item .a-col { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.archive-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 40px 20px; }
.archive-empty svg { color: var(--text-faint); opacity: 0.5; margin-bottom: 8px; }
.archive-empty p { margin: 0; font-size: 15px; font-weight: 600; color: var(--text); }
.archive-empty span { font-size: 13px; color: var(--text-faint); max-width: 320px; line-height: 1.5; }

/* New-card draft: explicit Abbrechen / Hinzufügen, pinned to the sheet bottom.
   Matches the app's primary CTA (violet→blue gradient) so it reads as native. */
.sheet-draft-actions {
  display: flex; gap: 10px; margin-top: 16px; position: sticky; bottom: -18px; z-index: 2;
  padding: 12px 0 8px; background: linear-gradient(to top, var(--surface) 82%, transparent);
}
.draft-btn {
  border-radius: var(--r-xl); padding: 11px 16px; font-size: 14px; font-weight: 650; font-family: inherit;
  cursor: pointer; transition: filter 0.15s, transform 0.1s, background 0.15s, color 0.15s;
}
.draft-btn:active { transform: translateY(1px); }
.draft-cancel { flex: 1; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-dim); }
.draft-cancel:hover { background: var(--surface-hover); color: var(--text); }
.draft-add { flex: 1; border: none; color: #fff; background: var(--c-blue); }
.draft-add:hover { filter: brightness(1.07); }

/* attachments (card modal + file manager) */
.attach-list { display: flex; flex-direction: column; gap: 6px; }
.attach-item { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 10px; padding: 7px 9px; }
.attach-thumb { flex: none; width: 40px; height: 40px; border-radius: 7px; overflow: hidden; display: block; background: var(--surface-3); }
.attach-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-ic { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 7px; background: var(--surface-3); color: var(--text-faint); }
.attach-ic svg { width: 20px; height: 20px; }
.attach-name { flex: 1; min-width: 0; font-size: 13.5px; color: var(--text); text-decoration: none; word-break: break-word; }
.attach-name:hover { text-decoration: underline; }
.attach-size { flex: none; font-size: 11.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.attach-del { flex: none; border: none; background: none; color: var(--text-faint); cursor: pointer; font-size: 15px; line-height: 1; padding: 4px 6px; border-radius: 6px; }
.attach-del:hover { color: var(--c-red); background: color-mix(in srgb, var(--c-red) 12%, transparent); }

/* file manager */
.filemgr-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.fm-count { font-size: 13px; color: var(--text-faint); font-weight: 600; }
.fm-bulk { width: auto; flex: none; border: 1px solid color-mix(in srgb, var(--c-red) 35%, var(--border)); border-radius: 9px; padding: 7px 11px; font-size: 12.5px; }
.filemgr-body { margin-top: 10px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.fm-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.fm-card-head .fm-title { font-size: 13.5px; font-weight: 650; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-card-head .fm-col { font-size: 11px; color: var(--text-faint); margin-left: auto; flex: none; }
.fm-empty { padding: 30px 20px; text-align: center; color: var(--text-faint); font-size: 14px; }

/* board switcher list */
.board-row { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.board-row:hover { background: var(--surface-hover); }
.board-row.active { color: var(--c-blue); font-weight: 650; }
.board-row .b-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-blue); opacity: 0; }
.board-row.active .b-dot { opacity: 1; }

/* ---------- Accessibility + undo ---------- */
:focus-visible { outline: 2px solid var(--c-blue); outline-offset: 2px; }
.card:focus-visible { outline: 2px solid var(--c-blue); outline-offset: 2px; box-shadow: 0 0 0 4px color-mix(in srgb, var(--c-blue) 18%, transparent); }
.menu [role='menuitem']:focus-visible { outline: 2px solid var(--c-blue); outline-offset: -2px; }
.toast { display: flex; align-items: center; gap: 14px; }
.toast-action { border: none; background: none; color: var(--c-blue); font-weight: 700; font-size: 13.5px; cursor: pointer; padding: 3px 6px; border-radius: 7px; flex: none; }
.toast-action:hover { background: color-mix(in srgb, var(--c-blue) 14%, transparent); }
@media (prefers-reduced-motion: reduce) { .drag-ghost { scale: 1; } }

/* ---------- Collapsible columns (desktop) ---------- */
.col-collapse { border: none; background: none; color: var(--text-faint); cursor: pointer; padding: 4px; border-radius: 7px; display: grid; place-items: center; flex: none; }
.col-collapse:hover { background: var(--surface-hover); color: var(--text); }
.column.collapsed { flex: 0 0 44px; width: 44px; cursor: pointer; }
.col-collapsed {
  display: flex; flex-direction: column; align-items: center; gap: 11px;
  width: 100%; height: 100%; min-height: 180px; padding: 13px 0 16px;
  border: none; background: none; color: var(--text); cursor: pointer; border-radius: var(--r-lg);
  transition: background 0.15s;
}
.col-collapsed:hover { background: var(--surface-hover); }
.col-collapsed .cc-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.col-collapsed .cc-count { font-size: 11.5px; font-weight: 650; color: var(--text-faint); font-variant-numeric: tabular-nums; flex: none; }
.col-collapsed .cc-count.over { color: var(--c-red); background: color-mix(in srgb, var(--c-red) 14%, transparent); border-radius: 8px; padding: 2px 6px; }
.col-collapsed .cc-name { writing-mode: vertical-rl; text-orientation: mixed; font-weight: 640; font-size: 13px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) { .col-collapse { display: none !important; } }
