/* ============ Tokens ============ */
:root {
  --bg: #14171C;
  --surface: #1A1E25;
  --surface-2: #20242D;
  --surface-3: #262B35;
  --border: #2A2F3A;
  --border-soft: #232833;
  --text: #E8E6E1;
  --text-dim: #9BA0AC;
  --text-faint: #5C6270;

  --amber: #E8A33D;
  --violet: #8B7FE0;
  --teal: #4FB6A8;
  --rose: #E07A9E;
  --slate: #7C8798;
  --danger: #E0637A;

  --font-display: "Space Grotesk", ui-sans-serif, sans-serif;
  --font-body: "Inter", ui-sans-serif, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow-lift: 0 8px 24px rgba(0,0,0,0.35), 0 2px 6px rgba(0,0,0,0.25);

  --scrollbar-thumb: #33394490;
  --scrollbar-thumb-hover: #454c58;
  --hover-border: #3a4150;
  --topbar-bg: rgba(20,23,28,0.85);
}

/* Light theme: same roles, warm off-white instead of near-black. Applied
   via a data-theme attribute on <html>, set by theme.js before first
   paint (see base.html) so there's no flash of the wrong theme on load.
   Accent colors (amber/violet/teal/rose/slate/danger) are deepened a
   little from their dark-theme values — they're used both as solid chip
   fills (with dark text on top, sufficient contrast either way) and as
   standalone text/icon color (needs more contrast against a light
   background than against a near-black one), so these are a deliberate
   compromise between those two roles rather than tuned per-usage. */
[data-theme="light"] {
  --bg: #F6F4EF;
  --surface: #FFFFFF;
  --surface-2: #F2EFE8;
  --surface-3: #E9E4D9;
  --border: #DDD6C8;
  --border-soft: #E7E1D3;
  --text: #2B2823;
  --text-dim: #6B6459;
  --text-faint: #9C9484;

  --amber: #B8791E;
  --violet: #7563D6;
  --teal: #2E9483;
  --rose: #C8547A;
  --slate: #626D79;
  --danger: #CB4359;

  --shadow-lift: 0 8px 24px rgba(20,15,5,0.10), 0 2px 6px rgba(20,15,5,0.06);

  --scrollbar-thumb: #D8D2C4;
  --scrollbar-thumb-hover: #C7C0AF;
  --hover-border: #C9C2B2;
  --topbar-bg: rgba(255,255,255,0.85);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  height: 100%;
}

body {
  background-image:
    radial-gradient(circle at 15% 0%, rgba(139,127,224,0.06), transparent 40%),
    radial-gradient(circle at 85% 100%, rgba(79,182,168,0.05), transparent 40%);
  background-attachment: fixed;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

::selection { background: var(--violet); color: #14171C; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }

:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 2px;
}

/* ============ Auth screen ============ */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 32px;
  box-shadow: var(--shadow-lift);
}

.auth-mark { display: flex; gap: 6px; margin-bottom: 18px; }
.auth-mark-dot { width: 9px; height: 9px; border-radius: 50%; }
.auth-mark-dot.amber { background: var(--amber); }
.auth-mark-dot.violet { background: var(--violet); }
.auth-mark-dot.teal { background: var(--teal); }

.auth-card h1 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}

.auth-sub { color: var(--text-dim); font-size: 14px; margin: 0 0 24px; }

.auth-error {
  background: rgba(224,99,122,0.12);
  border: 1px solid rgba(224,99,122,0.35);
  color: var(--rose);
  font-size: 13px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.auth-form { display: flex; flex-direction: column; gap: 6px; }
.auth-form label { font-size: 12px; color: var(--text-dim); margin-top: 10px; }
.auth-form input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
}
.auth-form input:focus { border-color: var(--violet); }

.auth-form button {
  margin-top: 20px;
  background: var(--violet);
  color: #14171C;
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px;
  font-weight: 600;
  font-size: 14px;
  transition: filter 0.15s;
}
.auth-form button:hover { filter: brightness(1.1); }

.auth-hint { font-size: 12px; color: var(--text-faint); margin-top: 20px; line-height: 1.5; }
.auth-hint code {
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
}

/* ============ App shell ============ */
.app { height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 56px;
  border-bottom: 1px solid var(--border);
  background: var(--topbar-bg);
  backdrop-filter: blur(8px);
  flex-shrink: 0;
}

.topbar-left { display: flex; align-items: center; gap: 20px; }

.brand { display: flex; align-items: center; gap: 9px; }
.brand-mark { display: flex; gap: 4px; }
.brand-dot { width: 7px; height: 7px; border-radius: 50%; }
.brand-dot.amber { background: var(--amber); }
.brand-dot.violet { background: var(--violet); }
.brand-dot.teal { background: var(--teal); }
.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--text-dim);
}

.board-switcher { position: relative; }
.board-switcher-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.board-switcher-btn:hover { background: var(--surface-2); }
.board-switcher-btn svg { color: var(--text-faint); }

.board-switcher-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 200px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lift);
  padding: 6px;
  display: none;
  flex-direction: column;
  z-index: 50;
}
.board-switcher-menu.open { display: flex; }
.board-switcher-item {
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--text-dim);
  background: none;
  border: none;
  text-align: left;
  width: 100%;
}
.board-switcher-item:hover { background: var(--surface-3); color: var(--text); }
.board-switcher-item.active { color: var(--violet); font-weight: 500; }
.board-switcher-item.new-board { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 10px; color: var(--teal); }

.board-switcher-row {
  display: flex;
  align-items: center;
  gap: 2px;
}
.board-switcher-row .board-switcher-item { flex: 1; }
.board-delete-icon-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-faint);
  padding: 6px;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.1s, color 0.1s, background 0.1s;
}
.board-switcher-row:hover .board-delete-icon-btn { opacity: 1; }
.board-delete-icon-btn:hover { color: var(--danger); background: rgba(224,99,122,0.1); }

.board-rename-icon-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-faint);
  padding: 6px;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.1s, color 0.1s, background 0.1s;
}
.board-switcher-row:hover .board-rename-icon-btn { opacity: 1; }
.board-rename-icon-btn:hover { color: var(--violet); background: var(--surface-3); }

.delete-board-warning,
.modal-message {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
  margin: 0 0 16px;
}
.delete-board-warning strong { color: var(--text); }

.topbar-right { display: flex; align-items: center; gap: 14px; }
.user-chip {
  font-size: 13px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}
.logout-link {
  font-size: 13px;
  color: var(--text-faint);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}
.logout-link:hover { color: var(--text); border-color: var(--text-faint); }

.archive-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 13px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}
.archive-btn:hover { color: var(--text); border-color: var(--text-faint); }
.archive-badge {
  background: var(--violet);
  color: #14171C;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
}

/* ============ Filter bar ============ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 12px;
  width: 220px;
  color: var(--text-faint);
  transition: border-color 0.15s;
}
.search-box:focus-within { border-color: var(--violet); color: var(--text-dim); }
.search-box input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-size: 13px;
}
.search-box input::placeholder { color: var(--text-faint); }

.include-archived-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-faint);
  user-select: none;
}
.include-archived-toggle input { accent-color: var(--violet); }

.filter-dropdown-wrap { position: relative; }
.filter-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 12.5px;
  transition: all 0.15s;
}
.filter-btn:hover { border-color: var(--text-faint); color: var(--text); }

.filter-count {
  background: var(--violet);
  color: #14171C;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
}

.filter-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 220px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lift);
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
  max-height: 260px;
  overflow-y: auto;
  z-index: 60;
}
.filter-dropdown.open { display: flex; }

.filter-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--text-dim);
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}
.filter-dropdown-item:hover { background: var(--surface-3); }
.filter-dropdown-item .swatch { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.filter-dropdown-item .lbl-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-dropdown-item .check { color: var(--teal); opacity: 0; }
.filter-dropdown-item.selected .check { opacity: 1; }
.filter-dropdown-empty { font-size: 12px; color: var(--text-faint); padding: 7px 9px; }

.filter-note { font-size: 11.5px; color: var(--text-faint); font-style: italic; }

.filter-clear-btn {
  background: none;
  border: none;
  color: var(--rose);
  font-size: 12.5px;
  padding: 6px 8px;
  margin-left: auto;
}
.filter-clear-btn:hover { text-decoration: underline; }

.matrix-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 13px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  margin-left: auto;
  cursor: pointer;
}
.matrix-toggle-btn:hover { color: var(--text); border-color: var(--text-faint); }
.matrix-toggle-btn.active { color: var(--violet); border-color: var(--violet); background: rgba(139,127,224,0.1); }

.empty-filter-note {
  color: var(--text-faint);
  font-size: 12px;
  text-align: center;
  padding: 16px 8px;
  font-style: italic;
}

/* ============ Board ============ */
.board-wrap { flex: 1; overflow: auto; padding: 24px; }
.board { display: flex; gap: 18px; align-items: flex-start; height: 100%; }

/* ============ Eisenhower matrix view ============ */
.matrix-view {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 18px;
  height: 100%;
  min-height: 520px;
}
.matrix-quadrant {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-top: 3px solid var(--border);
}
.matrix-quadrant-do-first { border-top-color: var(--danger); }
.matrix-quadrant-schedule { border-top-color: var(--teal); }
.matrix-quadrant-delegate { border-top-color: var(--amber); }
.matrix-quadrant-eliminate { border-top-color: var(--text-faint); }

.matrix-quadrant-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
  flex-shrink: 0;
}
.matrix-quadrant-title { font-family: var(--font-display); font-weight: 600; font-size: 14px; color: var(--text); }
.matrix-quadrant-hint { font-size: 11.5px; color: var(--text-faint); }
.matrix-quadrant-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  background: var(--surface-2);
  padding: 1px 8px;
  border-radius: 10px;
}
.matrix-quadrant-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

@media (max-width: 900px) {
  .matrix-view { grid-template-columns: 1fr; grid-template-rows: none; min-height: 0; }
  .matrix-quadrant { min-height: 220px; }
}

.column {
  width: 300px;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: 100%;
  overflow: hidden;
  border-top: 3px solid var(--col-color, var(--slate));
}

.column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px 10px;
  flex-shrink: 0;
}

.column-title-group { display: flex; align-items: center; gap: 8px; min-width: 0; }
.column-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--col-color, var(--slate)); flex-shrink: 0; }
.column-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 2px 4px;
  border-radius: 4px;
  min-width: 0;
  max-width: 160px;
}
.column-name:hover, .column-name:focus { background: var(--surface-2); }

.column-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  background: var(--surface-2);
  padding: 1px 7px;
  border-radius: 20px;
}

.column-menu-btn {
  background: none; border: none; color: var(--text-faint);
  padding: 4px; border-radius: 4px; display: flex;
}
.column-menu-btn:hover { background: var(--surface-2); color: var(--text); }

.column-archive-btn {
  background: none; border: none; color: var(--text-faint);
  padding: 4px; border-radius: 4px; display: flex;
}
.column-archive-btn:hover { background: var(--surface-2); color: var(--text); }
.column-archive-btn.active { color: var(--teal); }

.column-wip-btn {
  background: none; border: none; color: var(--text-faint);
  padding: 4px; border-radius: 4px; display: flex;
}
.column-wip-btn:hover { background: var(--surface-2); color: var(--text); }
.column-wip-btn.active { color: var(--violet); }

.column-count.over-limit {
  color: var(--danger);
  background: rgba(224, 99, 122, 0.15);
  font-weight: 600;
  animation: wip-limit-pulse 2s ease-in-out infinite;
}
.column.over-wip-limit .column-header { animation: wip-limit-header-pulse 2s ease-in-out infinite; }
@keyframes wip-limit-pulse {
  0%, 100% { background: rgba(224, 99, 122, 0.15); }
  50% { background: rgba(224, 99, 122, 0.35); }
}
@keyframes wip-limit-header-pulse {
  0%, 100% { box-shadow: inset 0 -1px 0 rgba(224, 99, 122, 0); }
  50% { box-shadow: inset 0 -1px 0 rgba(224, 99, 122, 0.6); }
}

/* ============ Archived matches strip ============ */
.archive-match-strip {
  margin-top: 18px;
  border-top: 1px dashed var(--border);
  padding-top: 14px;
}
.archive-match-header {
  font-size: 12px;
  color: var(--text-faint);
  margin-bottom: 8px;
  font-family: var(--font-mono);
}
.archive-match-list { display: flex; gap: 10px; flex-wrap: wrap; }
.archive-match-card {
  width: 220px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  opacity: 0.75;
}
.archive-match-card:hover { opacity: 1; }
.archive-match-card .card-title { font-size: 13px; margin: 0 0 4px; color: var(--text); }
.archive-match-card .archive-match-meta { font-size: 11px; color: var(--text-faint); }
.archive-match-card .archive-restore-btn {
  margin-top: 8px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
}
.archive-match-card .archive-restore-btn:hover { border-color: var(--teal); color: var(--teal); }

/* ============ Archive panel (slide-over) ============ */
.archive-overlay {
  position: fixed; inset: 0;
  background: rgba(10,11,14,0.6);
  backdrop-filter: blur(3px);
  display: none;
  justify-content: flex-end;
  z-index: 100;
}
.archive-overlay.open { display: flex; }
.archive-panel {
  width: 100%;
  max-width: 420px;
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lift);
  display: flex;
  flex-direction: column;
  padding: 24px;
  overflow-y: auto;
}
.archive-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.archive-panel-header h2 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}
.archive-panel-list { display: flex; flex-direction: column; gap: 10px; }
.archive-panel-empty { color: var(--text-faint); font-size: 13px; font-style: italic; padding: 20px 0; text-align: center; }
.archive-panel-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.archive-panel-item .archive-item-title { font-size: 13.5px; color: var(--text); margin: 0 0 4px; cursor: pointer; }
.archive-panel-item .archive-item-title:hover { text-decoration: underline; }
.archive-panel-item .archive-item-meta { font-size: 11.5px; color: var(--text-faint); margin-bottom: 10px; }
.archive-panel-item .archive-item-actions { display: flex; gap: 8px; }
.archive-item-actions button {
  font-size: 11.5px;
  padding: 5px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-dim);
}
.archive-item-actions .archive-restore-btn:hover { border-color: var(--teal); color: var(--teal); }
.archive-item-actions .archive-delete-btn:hover { border-color: var(--danger); color: var(--danger); }

.card-list {
  flex: 1;
  overflow-y: auto;
  padding: 2px 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 40px;
}

.add-card-btn {
  margin: 4px 10px 10px;
  background: none;
  border: 1px dashed var(--border);
  color: var(--text-faint);
  border-radius: var(--radius-sm);
  padding: 8px;
  font-size: 12.5px;
  text-align: left;
  transition: all 0.15s;
}
.add-card-btn:hover { border-color: var(--text-faint); color: var(--text-dim); background: var(--surface-2); }

.add-column {
  width: 260px;
  flex-shrink: 0;
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text-faint);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 13px;
  height: 44px;
  transition: all 0.15s;
}
.add-column:hover { color: var(--text-dim); border-color: var(--text-faint); }

/* ============ Card ============ */
.card {
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 10px 10px 10px 16px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  overflow: hidden;
}
.card:hover { border-color: var(--hover-border); }
.card.sortable-ghost { opacity: 0.35; }
.card.sortable-chosen { box-shadow: var(--shadow-lift); }

.card-rail {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--border);
}
.card-rail-fill {
  position: absolute;
  left: 0; bottom: 0;
  width: 100%;
  background: var(--col-color, var(--slate));
  transition: height 0.2s;
}

.card-title {
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.4;
  margin: 0 0 6px;
  word-break: break-word;
}

.card-meta-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.card-deadline {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface-3);
  color: var(--text-faint);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.card-deadline.soon { background: rgba(232,163,61,0.15); color: var(--amber); }
.card-deadline.overdue { background: rgba(224,99,122,0.15); color: var(--danger); }

.card-priority-flag {
  width: 6px; height: 6px; border-radius: 50%;
}
.card-priority-flag.high { background: var(--danger); }
.card-priority-flag.low { background: var(--text-faint); }

.card-subtask-badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.card-subtask-badge.complete { color: var(--teal); }

.card-recur-badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.card-attachment-badge {
  font-size: 10.5px;
  color: var(--text-faint);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* ============ Modal ============ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(10,11,14,0.6);
  backdrop-filter: blur(3px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 20px;
  overflow-y: auto;
  z-index: 100;
}
.modal-overlay.open { display: flex; }

/* This one opens from a button *inside* the card modal, so it needs to
   stack above it — otherwise it renders behind, and clicks meant for it
   land on the card modal's own overlay instead (closing the card and
   clearing which card was active). */
/* Modals that can be opened *from within* the card modal (z-index 100)
   need a higher z-index so they render on top instead of hidden behind
   it — same root cause as the earlier "move card doesn't work" bug. */
#moveToBoardOverlay { z-index: 110; }
#confirmOverlay { z-index: 110; }
#recurOverlay { z-index: 110; }

.card-modal {
  width: 100%;
  max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px;
  position: relative;
  box-shadow: var(--shadow-lift);
}

.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: none; border: none;
  color: var(--text-faint);
  font-size: 22px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }

.modal-col-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  background: var(--surface-2);
  padding: 3px 9px;
  border-radius: 20px;
  margin-bottom: 14px;
}
.modal-col-badge .dot { width: 6px; height: 6px; border-radius: 50%; }

.modal-title-input {
  width: 100%;
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  padding: 4px 0;
  margin-bottom: 18px;
  letter-spacing: -0.01em;
}
.modal-title-input:focus { outline: none; }

.modal-row.modal-meta-row { display: flex; gap: 16px; margin-bottom: 22px; }
.meta-field { flex: 1; min-width: 0; }
.meta-field label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  margin-bottom: 6px;
}
.meta-field input, .meta-field select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  font-family: var(--font-mono);
}
.meta-field input:focus, .meta-field select:focus { border-color: var(--violet); }
.recur-summary-btn {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  font-family: var(--font-mono);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.recur-summary-btn:hover { border-color: var(--text-faint); }
.recur-summary-btn.active { color: var(--violet); border-color: var(--violet); }

.recur-kind-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.recur-kind-tab {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: var(--radius-sm);
  padding: 8px 0;
  font-size: 13px;
  cursor: pointer;
}
.recur-kind-tab:hover { border-color: var(--text-faint); color: var(--text); }
.recur-kind-tab.active { border-color: var(--violet); color: var(--violet); background: rgba(139,127,224,0.1); }

.recur-interval-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-dim);
}
.recur-interval-row input {
  width: 64px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  font-family: var(--font-mono);
}
.recur-interval-row input:focus { border-color: var(--violet); }

.recur-sub-row { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.recur-sub-row .prompt-label { margin: 0; white-space: nowrap; }
.recur-sub-row select, .recur-sub-row input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  font-family: var(--font-mono);
}
.recur-sub-row select:focus, .recur-sub-row input:focus { border-color: var(--violet); }
#recurMonthdayInput { width: 64px; }
.recur-monthday-hint { font-size: 12px; color: var(--text-faint); }

.recur-modal-footer #recurRemoveBtn { margin-right: auto; }

.modal-section { margin-bottom: 22px; }
.section-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  margin-bottom: 8px;
}
.section-label-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.section-label-row .section-label { margin-bottom: 0; }
.subtask-count { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }

.modal-section textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13.5px;
  line-height: 1.5;
  resize: vertical;
  font-family: var(--font-body);
}
.modal-section textarea:focus { border-color: var(--violet); }

.subtask-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.subtask-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border-radius: 6px;
}
.subtask-item:hover { background: var(--surface-2); }
.subtask-item input[type=checkbox] {
  width: 15px; height: 15px;
  accent-color: var(--teal);
  flex-shrink: 0;
}
.subtask-item .subtask-title {
  flex: 1;
  font-size: 13px;
  background: none;
  border: none;
  color: var(--text);
  padding: 2px 0;
}
.subtask-item.done .subtask-title { color: var(--text-faint); text-decoration: line-through; }
.subtask-remove {
  background: none; border: none; color: var(--text-faint);
  opacity: 0; font-size: 15px; padding: 2px 6px; border-radius: 4px;
}
.subtask-item:hover .subtask-remove { opacity: 1; }
.subtask-remove:hover { color: var(--danger); }

.subtask-add-form { display: flex; gap: 8px; }
.subtask-add-form input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
}
.subtask-add-form input:focus { border-color: var(--violet); }
.subtask-add-form button {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 12.5px;
}
.subtask-add-form button:hover { color: var(--text); border-color: var(--text-faint); }

.link-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }

.link-preview {
  position: relative;
  display: flex;
  border: 1px solid var(--border-soft);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.15s;
}
.link-preview:hover { border-color: var(--hover-border); }

.link-preview-link {
  display: flex;
  flex: 1;
  min-width: 0;
  color: inherit;
}
.link-preview-link:hover .link-preview-title { color: var(--violet); }

.link-preview-body {
  flex: 1;
  min-width: 0;
  padding: 10px 34px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  justify-content: center;
}

.link-preview-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.15s;
}

.link-preview-desc {
  font-size: 11.5px;
  color: var(--text-dim);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.link-preview-meta { display: flex; align-items: center; gap: 6px; }
.link-preview-favicon { width: 14px; height: 14px; border-radius: 3px; flex-shrink: 0; object-fit: cover; }
.link-preview-domain {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-preview-thumb {
  width: 96px;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
  background-color: var(--surface-3);
}

.link-preview.errored .link-preview-body { padding-right: 34px; }
.link-preview-error-note {
  font-size: 11px;
  color: var(--text-faint);
  font-style: italic;
}

.link-preview-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(20,23,28,0.55);
  border: none;
  color: #C7CCD6;
  font-size: 15px;
  line-height: 1;
  padding: 3px 7px;
  border-radius: 5px;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
}
.link-preview:hover .link-preview-remove { opacity: 1; }
.link-preview-remove:hover { color: var(--danger); background: rgba(20,23,28,0.85); }

.link-add-form { display: flex; gap: 8px; }
.link-add-form input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
}
.link-add-form input:focus { border-color: var(--violet); }
.link-add-form button {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 12.5px;
  min-width: 64px;
}
.link-add-form button:hover:not(:disabled) { color: var(--text); border-color: var(--text-faint); }
.link-add-form button:disabled { opacity: 0.6; cursor: default; }

.card-link-badge {
  font-size: 10.5px;
  color: var(--text-faint);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.attachment-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.attachment-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
}
.attachment-item .att-name { flex: 1; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-item .att-size { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); }
.attachment-item a { color: var(--teal); }
.attachment-item .att-remove { background: none; border: none; color: var(--text-faint); font-size: 15px; padding: 0 4px; }
.attachment-item .att-remove:hover { color: var(--danger); }

.attachment-upload-btn {
  display: inline-block;
  background: none;
  border: 1px dashed var(--border);
  color: var(--text-faint);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 12.5px;
  cursor: pointer;
}
.attachment-upload-btn:hover { color: var(--text-dim); border-color: var(--text-faint); }

.modal-footer { border-top: 1px solid var(--border); padding-top: 16px; display: flex; justify-content: flex-end; gap: 10px; }
.btn-secondary {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-size: 12.5px;
}
.btn-secondary:hover { border-color: var(--text-faint); color: var(--text); }
.btn-primary {
  background: var(--violet);
  color: #14171C;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 12.5px;
  font-weight: 600;
  transition: filter 0.15s;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:disabled { opacity: 0.5; filter: none; cursor: default; }

/* ============ Generic prompt modal ============ */
.prompt-modal {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  box-shadow: var(--shadow-lift);
}
.prompt-modal h2 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 16px;
}
.prompt-label {
  display: block;
  font-size: 12px;
  color: var(--text-faint);
  margin-bottom: 6px;
}
.prompt-input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
}
.prompt-input:focus { border-color: var(--violet); }
.prompt-modal .modal-footer { margin-top: 20px; padding-top: 0; border-top: none; }
.prompt-modal .prompt-label:not(:first-of-type) { margin-top: 14px; }
.move-board-note {
  margin-top: 12px;
  font-size: 12px;
  color: var(--amber);
  line-height: 1.5;
}
.prompt-error {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--danger);
  line-height: 1.4;
}
.btn-danger {
  background: none;
  border: 1px solid rgba(224,99,122,0.3);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-size: 12.5px;
}
.btn-danger:hover { background: rgba(224,99,122,0.1); }
.btn-danger:disabled { opacity: 0.4; cursor: default; background: none; }

/* ============ Quill rich text (dark theme override) ============ */
.ql-toolbar.ql-snow {
  border: 1px solid var(--border) !important;
  border-bottom: none !important;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: var(--surface-2);
  padding: 6px 8px;
}
.ql-container.ql-snow {
  border: 1px solid var(--border) !important;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: var(--surface-2);
  font-family: var(--font-body);
  font-size: 13.5px;
}
.ql-editor {
  color: var(--text);
  min-height: 90px;
  max-height: 320px;
  overflow-y: auto;
  line-height: 1.55;
}
.ql-editor.ql-blank::before { color: var(--text-faint); font-style: normal; }
.ql-snow .ql-stroke { stroke: var(--text-dim); }
.ql-snow .ql-fill, .ql-snow .ql-stroke.ql-fill { fill: var(--text-dim); }
.ql-snow .ql-picker { color: var(--text-dim); }
.ql-snow .ql-picker-options {
  background: var(--surface-3);
  border: 1px solid var(--border) !important;
}
.ql-snow.ql-toolbar button:hover .ql-stroke,
.ql-snow .ql-toolbar button:hover .ql-stroke { stroke: var(--violet); }
.ql-snow.ql-toolbar button:hover .ql-fill,
.ql-snow .ql-toolbar button:hover .ql-fill { fill: var(--violet); }
.ql-snow.ql-toolbar button.ql-active .ql-stroke,
.ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-stroke { stroke: var(--violet); }
.ql-snow.ql-toolbar button.ql-active .ql-fill { fill: var(--violet); }
.ql-snow .ql-tooltip {
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: var(--shadow-lift);
}
.ql-snow .ql-tooltip input[type=text] {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}
.ql-editor a { color: var(--teal); }
.ql-editor code {
  background: var(--surface-3);
  color: var(--amber);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
}
.ql-editor blockquote {
  border-left: 3px solid var(--border);
  color: var(--text-dim);
  padding-left: 12px;
  margin-left: 0;
}

/* ============ Labels ============ */
.label-chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.label-chip-row:empty { display: none; }

.label-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 500;
  padding: 3px 9px 3px 7px;
  border-radius: 20px;
  background: color-mix(in srgb, var(--chip-color, var(--slate)) 18%, var(--surface-2));
  color: var(--chip-color, var(--text));
  border: 1px solid color-mix(in srgb, var(--chip-color, var(--slate)) 35%, transparent);
}
.label-chip .label-chip-remove {
  background: none; border: none; color: inherit;
  opacity: 0.6; font-size: 13px; line-height: 1; padding: 0;
}
.label-chip .label-chip-remove:hover { opacity: 1; }

.label-add-wrap { position: relative; display: inline-block; }
.label-add-btn {
  background: none;
  border: 1px dashed var(--border);
  color: var(--text-faint);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 11.5px;
}
.label-add-btn:hover { color: var(--text-dim); border-color: var(--text-faint); }

.label-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 240px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lift);
  padding: 8px;
  display: none;
  z-index: 60;
}
.label-dropdown.open { display: block; }

.label-dropdown-list { display: flex; flex-direction: column; gap: 2px; max-height: 180px; overflow-y: auto; }
.label-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--text-dim);
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}
.label-dropdown-item:hover { background: var(--surface-3); }
.label-dropdown-item .swatch { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.label-dropdown-item .lbl-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.label-dropdown-item .check { color: var(--teal); opacity: 0; }
.label-dropdown-item.selected .check { opacity: 1; }
.label-dropdown-empty { font-size: 12px; color: var(--text-faint); padding: 6px 8px; }

.label-dropdown-divider { border-top: 1px solid var(--border); margin: 8px 0; }

.label-create-form { display: flex; flex-direction: column; gap: 8px; }
.label-create-form input {
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12.5px;
}
.label-color-swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.label-color-swatches .swatch-btn {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
}
.label-color-swatches .swatch-btn.selected { border-color: var(--text); }
.label-create-form button[type=submit] {
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
}
.label-create-form button[type=submit]:hover { color: var(--text); border-color: var(--text-faint); }

.card-label-row { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.card-label-dot-row { display: flex; gap: 4px; }
.card-label-bar {
  height: 4px;
  width: 22px;
  border-radius: 3px;
  background: var(--lbl-color, var(--slate));
}

/* ============ Activity feed ============ */
.comment-add-form { display: flex; gap: 8px; margin-bottom: 12px; }
.comment-add-form input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
}
.comment-add-form input:focus { border-color: var(--violet); }
.comment-add-form button {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 12.5px;
}
.comment-add-form button:hover { color: var(--text); border-color: var(--text-faint); }

.activity-feed { display: flex; flex-direction: column; gap: 2px; max-height: 280px; overflow-y: auto; }

.activity-item, .comment-item {
  display: flex;
  gap: 10px;
  padding: 8px 4px;
  font-size: 12.5px;
}

.activity-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-faint);
  margin-top: 5px;
  flex-shrink: 0;
}
.activity-text { color: var(--text-faint); flex: 1; line-height: 1.5; }
.activity-text b { color: var(--text-dim); font-weight: 500; }
.activity-time {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
  white-space: nowrap;
  margin-top: 1px;
}

.comment-item {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  align-items: flex-start;
}
.comment-body-wrap { flex: 1; min-width: 0; }
.comment-body { color: var(--text); line-height: 1.5; word-break: break-word; }
.comment-time { font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); margin-top: 4px; }
.comment-remove {
  background: none; border: none; color: var(--text-faint);
  opacity: 0; font-size: 14px; padding: 0 2px; flex-shrink: 0;
}
.comment-item:hover .comment-remove { opacity: 1; }
.comment-remove:hover { color: var(--danger); }

/* ============ Toast ============ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s;
  z-index: 200;
  box-shadow: var(--shadow-lift);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.toast-action-btn {
  background: none;
  border: none;
  color: var(--teal);
  font-weight: 600;
  font-size: 13px;
  margin-left: 14px;
  padding: 0;
  cursor: pointer;
}
.toast-action-btn:hover { text-decoration: underline; }

/* ============ Celebration (confetti + checkmark on completing a card) ============
   Purely cosmetic — triggered client-side in board.js when a card is
   dragged into a "Done"-like column. The JS already skips creating these
   elements entirely under prefers-reduced-motion (see celebrateCard()),
   which also avoids them getting stuck on-screen forever under the global
   `animation: none !important` rule further down this file. */
.celebrate-check {
  position: fixed;
  transform: translate(-50%, -50%) scale(0.2);
  font-size: 42px;
  font-weight: bold;
  color: var(--teal);
  z-index: 9999;
  pointer-events: none;
  animation: celebrate-check-pop 700ms ease-out forwards;
  text-shadow: 0 0 16px rgba(79, 182, 168, 0.6);
}
@keyframes celebrate-check-pop {
  0% { transform: translate(-50%, -50%) scale(0.2); opacity: 0; }
  30% { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
  50% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}
.celebrate-confetti {
  position: fixed;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  z-index: 9998;
  pointer-events: none;
  animation: celebrate-confetti-burst 900ms cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}
@keyframes celebrate-confetti-burst {
  0% { transform: translate(-50%, -50%) translate(0, 0) rotate(0deg); opacity: 1; }
  100% { transform: translate(-50%, -50%) translate(var(--dx), calc(var(--dy) + 90px)) rotate(var(--rot)); opacity: 0; }
}

/* ============ Responsive ============ */
@media (max-width: 720px) {
  .board { flex-direction: column; }
  .column { width: 100%; max-height: none; }
  .topbar { padding: 0 12px; }
  .brand-name { display: none; }
  .card-modal { padding: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ============ Stats dashboard ============ */
.stats-board-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  margin-left: 18px;
  padding-left: 18px;
  border-left: 1px solid var(--border);
}
.stats-board-name-suffix { color: var(--text-faint); font-weight: 500; }

.stats-main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 24px 60px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.stats-loading {
  text-align: center;
  color: var(--text-faint);
  padding: 80px 0;
  font-size: 14px;
}

.stats-kpi-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
}
.stats-kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 14px;
  text-align: center;
}
.stats-kpi-value {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.2;
}
.stats-kpi-label {
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 4px;
}

.stats-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-lift);
}
.stats-row { display: flex; gap: 20px; }
.stats-card-half { flex: 1; min-width: 0; }
.stats-card-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.stats-card-note {
  font-size: 12px;
  color: var(--text-faint);
  line-height: 1.5;
  margin: -8px 0 14px;
}
.stats-empty { color: var(--text-faint); font-size: 13px; font-style: italic; padding: 12px 0; }

.stats-streaks { font-size: 12px; font-weight: 500; color: var(--amber); font-family: var(--font-mono); }

.stats-legend { display: flex; gap: 16px; margin-bottom: 10px; }
.stats-legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); }
.stats-legend-swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

.stats-chart-svg { width: 100%; height: 220px; }
.stats-axis-label { font-size: 9px; fill: var(--text-faint); font-family: var(--font-mono); }

.stats-heatmap-svg { width: 100%; max-width: 640px; height: auto; }

.stats-donut-wrap { display: flex; align-items: center; gap: 24px; }
.stats-donut-svg { width: 150px; height: 150px; flex-shrink: 0; }
.stats-legend-col { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 0; }
.stats-legend-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stats-legend-count { margin-left: auto; font-family: var(--font-mono); color: var(--text-faint); }

.stats-priority-rows, .stats-column-rows { display: flex; flex-direction: column; gap: 12px; }
.stats-priority-row, .stats-column-row { display: flex; align-items: center; gap: 12px; }
.stats-priority-label { width: 56px; flex-shrink: 0; font-size: 12.5px; color: var(--text-dim); }
.stats-priority-track, .stats-column-track {
  flex: 1; height: 8px; background: var(--surface-2);
  border-radius: 4px; overflow: hidden;
}
.stats-priority-fill, .stats-column-fill { height: 100%; border-radius: 4px; }
.stats-priority-value, .stats-column-value {
  width: 48px; flex-shrink: 0; text-align: right;
  font-family: var(--font-mono); font-size: 12px; color: var(--text-faint);
}
.stats-column-name {
  width: 180px; flex-shrink: 0; font-size: 12.5px; color: var(--text-dim);
  display: flex; align-items: center; gap: 7px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stats-column-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.stats-column-count { color: var(--text-faint); font-size: 11px; margin-left: 4px; }

.stats-recent-list { display: flex; flex-direction: column; }
.stats-recent-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
}
.stats-recent-row:last-child { border-bottom: none; }
.stats-recent-title { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-recent-date { color: var(--text-faint); font-family: var(--font-mono); font-size: 12px; flex-shrink: 0; }

@media (max-width: 900px) {
  .stats-kpi-row { grid-template-columns: repeat(3, 1fr); }
  .stats-row { flex-direction: column; }
  .stats-donut-wrap { flex-direction: column; align-items: stretch; }
  .stats-board-name { display: none; }
}
