/* ==========================================================================
   Design Tokens
   ========================================================================== */
:root {
  /* Surfaces */
  --bg: #f8f8f8;
  --bg-gradient: radial-gradient(ellipse at top, #f6f7fb 0%, #f8f8f8 50%);
  --surface: #ffffff;
  --surface-soft: #fafbfd;
  --surface-muted: #f1f3f8;

  /* Text */
  --text: #0f172a;
  --text-soft: #334155;
  --text-muted: #64748b;
  --text-faint: #94a3b8;

  /* Borders */
  --border: #e2e8f0;
  --border-soft: #eef0f6;
  --border-strong: #cbd5e1;

  /* Brand */
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-soft: #eef2ff;
  --primary-ring: rgba(99, 102, 241, 0.18);

  /* Status */
  --danger: #e11d48;
  --danger-hover: #be123c;
  --danger-soft: #fff1f2;
  --success: #10b981;

  /* Priority */
  --prio-low: #10b981;
  --prio-low-soft: #d1fae5;
  --prio-low-text: #047857;
  --prio-medium: #f59e0b;
  --prio-medium-soft: #fef3c7;
  --prio-medium-text: #b45309;
  --prio-high: #ef4444;
  --prio-high-soft: #fee2e2;
  --prio-high-text: #b91c1c;

  /* Composite surface colors (translucent overlays for blur effects, dots, etc.) */
  --cell-bg: rgba(255, 255, 255, 0.55);
  --cell-bg-hover: rgba(255, 255, 255, 0.8);
  --header-bg: rgba(255, 255, 255, 0.85);
  --grid-dot: rgba(15, 23, 42, 0.05);
  --overlay-bg: rgba(15, 23, 42, 0.45);

  /* Effects */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 10px 30px -8px rgba(15, 23, 42, 0.18), 0 6px 12px -6px rgba(15, 23, 42, 0.1);
  --shadow-xl: 0 20px 50px -12px rgba(15, 23, 42, 0.25);

  /* Radii */
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-pill: 999px;

  /* Motion */
  --t-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-base: 180ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-slow: 240ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Dark Theme
   ========================================================================== */
[data-theme="dark"] {
  /* Surfaces */
  --bg: #0b1120;
  --bg-gradient: radial-gradient(ellipse at top, #1e293b 0%, #0b1120 60%);
  --surface: #1e293b;
  --surface-soft: #223044;
  --surface-muted: #2b3a52;

  /* Text */
  --text: #f1f5f9;
  --text-soft: #cbd5e1;
  --text-muted: #94a3b8;
  --text-faint: #64748b;

  /* Borders */
  --border: #334155;
  --border-soft: #1e293b;
  --border-strong: #475569;

  /* Brand */
  --primary: #818cf8;
  --primary-hover: #a5b4fc;
  --primary-soft: #1e1b4b;
  --primary-ring: rgba(129, 140, 248, 0.28);

  /* Status */
  --danger: #f87171;
  --danger-hover: #fca5a5;
  --danger-soft: #3b0a0a;
  --success: #34d399;

  /* Priority */
  --prio-low: #34d399;
  --prio-low-soft: #042f1f;
  --prio-low-text: #6ee7b7;
  --prio-medium: #fbbf24;
  --prio-medium-soft: #3a2204;
  --prio-medium-text: #fde68a;
  --prio-high: #f87171;
  --prio-high-soft: #3a0a0a;
  --prio-high-text: #fecaca;

  /* Composite */
  --cell-bg: rgba(30, 41, 59, 0.5);
  --cell-bg-hover: rgba(30, 41, 59, 0.8);
  --header-bg: rgba(11, 17, 32, 0.85);
  --grid-dot: rgba(241, 245, 249, 0.06);
  --overlay-bg: rgba(0, 0, 0, 0.6);

  /* Stronger shadows for dark surfaces */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.55), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 30px -8px rgba(0, 0, 0, 0.7), 0 6px 12px -6px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 50px -12px rgba(0, 0, 0, 0.8);
}

/* ==========================================================================
   Base
   ========================================================================== */
* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 200ms ease, color 200ms ease;
}

#app {
  min-height: 100vh;
}

button {
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

input, textarea, select {
  font-family: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  background: var(--primary-soft);
  color: var(--primary-hover);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text-soft);
  box-shadow: var(--shadow-xs);
  transition: all var(--t-fast);
  white-space: nowrap;
}

.btn:hover {
  background: var(--surface-muted);
  border-color: var(--border-strong);
  color: var(--text);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-xs);
}

.btn--primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.25), 0 1px 3px rgba(79, 70, 229, 0.15);
}

.btn--primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
  box-shadow: 0 4px 12px -2px rgba(79, 70, 229, 0.4), 0 2px 4px rgba(79, 70, 229, 0.2);
}

.btn--icon {
  padding: 8px;
  width: 36px;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.history-buttons {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}

.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
  box-shadow: none;
  padding: 8px;
}

.btn--ghost:hover {
  background: var(--danger-soft);
  border-color: transparent;
  color: var(--danger);
  box-shadow: none;
}

.btn--danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  box-shadow: 0 1px 2px rgba(225, 29, 72, 0.25), 0 1px 3px rgba(225, 29, 72, 0.15);
}

.btn--danger:hover {
  background: var(--danger-hover);
  border-color: var(--danger-hover);
  color: #fff;
  box-shadow: 0 4px 12px -2px rgba(225, 29, 72, 0.4), 0 2px 4px rgba(225, 29, 72, 0.2);
}

.btn__plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  font-weight: 600;
  font-size: 14px;
  line-height: 1;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: transparent;
  border: none;
  border-radius: var(--r-md);
  color: var(--text-faint);
  transition: all var(--t-fast);
  flex-shrink: 0;
}

.icon-btn:hover:not(:disabled) {
  background: var(--danger-soft);
  color: var(--danger);
}

.icon-btn:disabled {
  cursor: not-allowed;
  opacity: 0.3;
}

/* ==========================================================================
   Overview
   ========================================================================== */
.overview {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 24px 64px;
}

.overview__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.overview__brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.overview__actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.overview__logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border-radius: var(--r-lg);
  box-shadow: 0 4px 12px -2px rgba(99, 102, 241, 0.4);
  flex-shrink: 0;
}

.overview__title {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
}

.overview__subtitle {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 14px;
}

.overview__create {
  display: flex;
  gap: 8px;
  margin-bottom: 36px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.overview__create input {
  flex: 1;
  padding: 10px 12px;
  font-size: 14px;
  border: none;
  background: transparent;
  color: var(--text);
}

.overview__create input::placeholder {
  color: var(--text-faint);
}

.overview__create input:focus {
  outline: none;
}

.overview__create:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-ring), var(--shadow-sm);
}

.overview__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* Board card */
.board-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all var(--t-base);
  display: flex;
  flex-direction: column;
  cursor: grab;
  outline: none;
}

.board-card:active {
  cursor: grabbing;
}

.board-card.dragging {
  opacity: 0.45;
  cursor: grabbing;
}

.board-card.dragging:hover {
  transform: none;
  box-shadow: var(--shadow-sm);
}

.board-card.drop-indicator-before::before,
.board-card.drop-indicator-after::after {
  content: '';
  position: absolute;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--primary);
  border-radius: 2px;
  z-index: 4;
  box-shadow: 0 0 0 2px var(--primary-ring);
  animation: drop-pulse 600ms ease-in-out infinite alternate;
}

.board-card.drop-indicator-before::before { left: 0; }
.board-card.drop-indicator-after::after { right: 0; }

@keyframes drop-pulse {
  from { opacity: 0.7; }
  to { opacity: 1; }
}

.board-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.board-card:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-ring), var(--shadow-lg);
}

.board-card:active {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.board-card__actions {
  position: absolute;
  top: 14px;
  right: 12px;
  z-index: 2;
  display: inline-flex;
  gap: 6px;
}

.board-card__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-faint);
  box-shadow: var(--shadow-xs);
  transition: all var(--t-fast);
}

/* Duplicate + delete only show on hover/focus; the pin shows too, unless it is
   active (pinned) – then it stays visible all the time. */
.board-card__action--hover,
.board-card__pin:not(.board-card__pin--active) {
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity var(--t-fast), transform var(--t-fast), background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}

.board-card:hover .board-card__action--hover,
.board-card:focus-within .board-card__action--hover,
.board-card:hover .board-card__pin,
.board-card:focus-within .board-card__pin {
  opacity: 1;
  transform: translateY(0);
}

.board-card__action:hover {
  background: var(--surface-muted);
  border-color: var(--border-strong);
  color: var(--primary);
}

.board-card__action--danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}

.board-card__pin:hover {
  background: var(--prio-medium-soft);
  border-color: var(--prio-medium);
  color: var(--prio-medium);
}

.board-card__pin--active {
  opacity: 1;
  color: var(--prio-medium);
  border-color: var(--prio-medium);
  background: var(--prio-medium-soft);
}

/* Archive drawer */
.overview__archive {
  margin-top: 28px;
}

/* The [hidden] attribute's UA `display: none` loses to `.overview__list`'s
   `display: grid`, so force it here for the collapsed archive list. */
.overview__archive[hidden],
.overview__archive-list[hidden] {
  display: none;
}

.archive-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 8px 6px;
  margin-bottom: 14px;
  background: transparent;
  border: none;
  border-radius: var(--r-md);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--t-fast);
}

.archive-toggle:hover {
  color: var(--text);
}

.archive-toggle__chevron {
  transition: transform var(--t-fast);
}

.archive-toggle[aria-expanded="true"] .archive-toggle__chevron {
  transform: rotate(90deg);
}

.board-card--archived {
  opacity: 0.78;
  cursor: pointer;
}

.board-card--archived:hover {
  opacity: 1;
}

.board-card__hint {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  letter-spacing: 0.005em;
  transition: gap var(--t-fast);
}

.board-card:hover .board-card__hint {
  gap: 8px;
}

.board-card__hint svg {
  transition: transform var(--t-fast);
}

.board-card:hover .board-card__hint svg {
  transform: translateX(2px);
}

.board-card__accent {
  height: 6px;
  width: 100%;
}

.board-card__body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.board-card__title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.015em;
  word-break: break-word;
}

.board-card__meta {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
}

.board-card__date {
  font-weight: 500;
  color: var(--text-soft);
}

.board-card__stats {
  display: flex;
  gap: 14px;
  padding: 10px 0;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  margin: 4px 0 6px;
}

.stat {
  font-size: 12px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.stat strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

/* Empty state */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 56px 24px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg);
}

.empty-state__icon {
  font-size: 40px;
  margin-bottom: 12px;
  filter: grayscale(0.2);
}

.empty-state h2 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 600;
}

.empty-state p {
  margin: 0 0 16px;
  color: var(--text-muted);
}

/* ==========================================================================
   Board view
   ========================================================================== */
.board {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.board__header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 24px;
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 10;
}

.board__back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px 6px 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--r-md);
  transition: all var(--t-fast);
}

.board__back:hover {
  background: var(--surface-muted);
  color: var(--primary);
}

.board__title-wrap {
  flex: 1;
  min-width: 0;
}

.board__title {
  margin: 0;
  padding: 4px 8px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  word-break: break-word;
  background: transparent;
  border: none;
  border-radius: var(--r-md);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background var(--t-fast);
  font-family: inherit;
  display: inline-block;
  max-width: 100%;
}

.board__title:hover {
  background: var(--surface-muted);
}

.board__title:focus-visible {
  outline: none;
  background: var(--surface-muted);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.board__meta {
  display: block;
  padding: 0 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.board__toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.board__toolbar::before {
  content: '';
  display: inline-block;
  width: 1px;
  height: 22px;
  background: var(--border);
  margin-right: 2px;
}

.board__toolbar-add {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Language toggle (text button: DE / EN) */
.lang-toggle {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

/* Search */
.board__search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 200px;
  min-width: 0;
  max-width: 340px;
}

.board__search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}

.board__search {
  width: 100%;
  padding: 8px 12px 8px 32px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: all var(--t-fast);
  min-width: 0;
}

.board__search::placeholder {
  color: var(--text-faint);
}

.board__search:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.board__search-wrap:focus-within .board__search-icon {
  color: var(--primary);
}

/* Native clear button (X) – just tighten its spacing */
.board__search::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: var(--text-faint);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='currentColor'%3E%3Cpath d='M6.28 6.28a1 1 0 011.44 0L10 8.56l2.28-2.28a1 1 0 011.44 1.44L11.44 10l2.28 2.28a1 1 0 11-1.44 1.44L10 11.44l-2.28 2.28a1 1 0 11-1.44-1.44L8.56 10 6.28 7.72a1 1 0 010-1.44z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='currentColor'%3E%3Cpath d='M6.28 6.28a1 1 0 011.44 0L10 8.56l2.28-2.28a1 1 0 011.44 1.44L11.44 10l2.28 2.28a1 1 0 11-1.44 1.44L10 11.44l-2.28 2.28a1 1 0 11-1.44-1.44L8.56 10 6.28 7.72a1 1 0 010-1.44z'/%3E%3C/svg%3E") center / contain no-repeat;
  cursor: pointer;
}
.board__search::-webkit-search-cancel-button:hover {
  background: var(--danger);
}

.board__grid-wrap {
  flex: 1;
  overflow: auto;
  padding: 24px 28px 40px;
  background-image:
    radial-gradient(circle at 1px 1px, var(--grid-dot) 1px, transparent 0);
  background-size: 22px 22px;
  background-position: 0 0;
}

.board__grid {
  display: grid;
  gap: 16px;
}

/* Quiet hint shown when the whole board has no (matching) tasks */
.board__empty {
  max-width: 380px;
  margin: 28px auto 0;
  padding: 8px 16px;
  text-align: center;
  color: var(--text-faint);
}

.board__empty-icon {
  font-size: 26px;
  line-height: 1;
  margin-bottom: 6px;
  opacity: 0.6;
}

.board__empty h2 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

.board__empty p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
}

.board__empty strong {
  color: var(--text-muted);
  font-weight: 600;
}

.board__empty-query {
  font-weight: 600;
  color: var(--text-muted);
}

/* Headers */
.grid-corner {
  position: sticky;
  top: 0;
  left: 0;
  background: transparent;
  z-index: 3;
}

.col-header {
  position: sticky;
  top: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  z-index: 2;
  box-shadow: var(--shadow-sm);
  cursor: grab;
  transition: box-shadow var(--t-fast);
}

.col-header:active { cursor: grabbing; }
.col-header.dragging {
  opacity: 0.45;
  cursor: grabbing;
}
.col-header.drop-indicator-before {
  box-shadow: var(--shadow-sm), inset 3px 0 0 var(--primary);
}
.col-header.drop-indicator-after {
  box-shadow: var(--shadow-sm), inset -3px 0 0 var(--primary);
}

.col-header:hover {
  box-shadow: var(--shadow-md);
}

.col-header__main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
  padding: 4px 6px;
  margin: -4px -6px;
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background var(--t-fast);
  overflow: hidden;
}

.col-header__main:hover {
  background: var(--surface-muted);
}

.col-header__main:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.col-header__name {
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text);
}

.col-header__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface-muted);
  border-radius: var(--r-pill);
  transition: all var(--t-fast);
}

.col-header__count:not([data-zero]),
.swimlane-header__count:not([data-zero]) {
  color: var(--primary-hover);
  background: var(--primary-soft);
}

.swimlane-header {
  position: sticky;
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 12px 12px;
  font-weight: 600;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  grid-template-areas: "toggle main count delete";
  align-items: start;
  gap: 8px;
  z-index: 1;
  min-height: 96px;
  box-shadow: var(--shadow-sm);
  cursor: grab;
  transition: box-shadow var(--t-fast);
}

.swimlane-header:active { cursor: grabbing; }
.swimlane-header.dragging {
  opacity: 0.45;
  cursor: grabbing;
}
.swimlane-header.drop-indicator-before {
  box-shadow: var(--shadow-sm), inset 0 3px 0 var(--primary);
}
.swimlane-header.drop-indicator-after {
  box-shadow: var(--shadow-sm), inset 0 -3px 0 var(--primary);
}

/* While reordering headers, dim the task drop-hover so the row/column hint is the focus */
.board__grid.grid--reordering .cell.drop-hover {
  border-color: transparent;
  background: var(--cell-bg);
  box-shadow: none;
}

.swimlane-header:hover {
  box-shadow: var(--shadow-md);
}

.swimlane-header__main {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 4px 6px;
  margin: -4px -6px;
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background var(--t-fast);
}

.swimlane-header__main:hover {
  background: var(--surface-muted);
}

.swimlane-header__main:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.swimlane-header__name {
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text);
  flex: 1;
}

.swimlane-header__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface-muted);
  border-radius: var(--r-pill);
  transition: all var(--t-fast);
}

.swimlane-header__main {
  grid-area: main;
}

.swimlane-header__count {
  grid-area: count;
  justify-self: end;
}

.swimlane-header__delete {
  grid-area: delete;
  justify-self: end;
}

.swimlane-header__toggle {
  grid-area: toggle;
  width: 22px;
  height: 22px;
  padding: 0;
  color: var(--text-muted);
  transition: color var(--t-fast), transform var(--t-fast);
}

.swimlane-header__toggle:hover {
  color: var(--text);
}

.swimlane-header__toggle svg {
  transition: transform var(--t-fast);
}

/* Collapsed: header spans the whole row as a compact horizontal bar; the
   per-column cells for this lane are skipped in the renderer. */
.swimlane-header--collapsed {
  grid-column: 1 / -1;
  grid-template-columns: auto 1fr auto auto;
  grid-template-areas: "toggle main count delete";
  align-items: center;
  gap: 10px;
  min-height: 0;
  padding: 8px 12px;
}

.swimlane-header--collapsed .swimlane-header__count {
  justify-self: end;
}

.swimlane-header--collapsed .swimlane-header__toggle svg {
  transform: rotate(-90deg);
}

.swimlane-header--collapsed .swimlane-header__delete {
  justify-self: auto;
}

.cell {
  border: 1.5px dashed transparent;
  border-radius: var(--r-md);
  padding: 4px;
  display: grid;
  grid-template-columns: repeat(var(--sub-cols, 1), minmax(0, 1fr));
  align-content: start;
  gap: 8px;
  min-width: 0;
  min-height: 96px;
  transition: background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
}

.cell__add {
  grid-column: 1 / -1;
}

.cell.drop-hover {
  border-color: rgba(99, 102, 241, 0.35);
  background: rgba(99, 102, 241, 0.05);
}

.cell__add {
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
  padding: 6px;
  color: var(--text-faint);
  font-size: 12px;
  font-weight: 500;
  transition:
    background-color 260ms cubic-bezier(0.4, 0, 0.2, 1),
    color 260ms cubic-bezier(0.4, 0, 0.2, 1),
    border-color 260ms cubic-bezier(0.4, 0, 0.2, 1);
}

.cell__add:hover {
  background: var(--surface);
  color: var(--text-soft);
  border-color: var(--border-strong);
}

/* ---- Quick-Add inline form ---- */
.cell__quick-add {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cell__quick-add-input {
  width: 100%;
  padding: 9px 11px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--primary);
  border-radius: var(--r-md);
  box-shadow: 0 0 0 3px var(--primary-ring);
  outline: none;
  min-width: 0;
}

.cell__quick-add-input::placeholder {
  color: var(--text-faint);
}

.cell__quick-add-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 0 2px;
}

.cell__quick-add-hint {
  font-size: 10.5px;
  color: var(--text-faint);
  font-weight: 500;
  letter-spacing: 0.01em;
}

.cell__quick-add-more {
  background: transparent;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 11px;
  font-weight: 500;
  color: var(--primary);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cell__quick-add-more:hover {
  color: var(--primary-hover);
}

/* ==========================================================================
   Task card
   ========================================================================== */
.task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 12px 10px;
  box-shadow: var(--shadow-sm);
  cursor: grab;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  transition: all var(--t-fast);
  position: relative;
  overflow: hidden;
}

/* Entrance animation only for genuinely new cards (added by the FLIP renderer).
   Kept off the base class so it can't fight the FLIP transform on moved cards. */
.task-card--entering {
  animation: task-enter 200ms cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

@keyframes task-enter {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* While a FLIP move is animating, lift the card above its siblings. */
.task-card.is-flipping {
  z-index: 5;
}

.task-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.task-card:active {
  cursor: grabbing;
}

.task-card.dragging {
  opacity: 0.4;
  transform: rotate(1deg) scale(0.98);
  cursor: grabbing;
}

/* Drop indicator – 1D (single sub-column): horizontal line at top / bottom */
.cell[data-sub-cols="1"] .task-card.drop-indicator-before {
  box-shadow: var(--shadow-sm), inset 0 3px 0 var(--primary);
}
.cell[data-sub-cols="1"] .task-card.drop-indicator-after {
  box-shadow: var(--shadow-sm), inset 0 -3px 0 var(--primary);
}

/* Drop indicator – 2D (multi sub-column grid): vertical line at left / right */
.cell:not([data-sub-cols="1"]) .task-card.drop-indicator-before {
  box-shadow: var(--shadow-sm), inset 3px 0 0 var(--primary);
}
.cell:not([data-sub-cols="1"]) .task-card.drop-indicator-after {
  box-shadow: var(--shadow-sm), inset -3px 0 0 var(--primary);
}

/* Keep the indicator visible even when the target card is hovered during drag */
.cell[data-sub-cols="1"] .task-card.drop-indicator-before:hover {
  box-shadow: var(--shadow-sm), inset 0 3px 0 var(--primary);
  transform: none;
}
.cell[data-sub-cols="1"] .task-card.drop-indicator-after:hover {
  box-shadow: var(--shadow-sm), inset 0 -3px 0 var(--primary);
  transform: none;
}
.cell:not([data-sub-cols="1"]) .task-card.drop-indicator-before:hover {
  box-shadow: var(--shadow-sm), inset 3px 0 0 var(--primary);
  transform: none;
}
.cell:not([data-sub-cols="1"]) .task-card.drop-indicator-after:hover {
  box-shadow: var(--shadow-sm), inset -3px 0 0 var(--primary);
  transform: none;
}

.task-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.task-card__title {
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1.4;
  letter-spacing: -0.005em;
  overflow-wrap: anywhere;
  word-break: break-word;
  flex: 1;
  min-width: 0;
  color: var(--text);
}

.task-card__delete {
  opacity: 0;
  transition: opacity var(--t-fast);
  margin-top: -2px;
  margin-right: -4px;
}

.task-card:hover .task-card__delete {
  opacity: 1;
}

.task-card__desc {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-muted);
  overflow-wrap: anywhere;
  word-break: break-word;
  max-height: calc(1.5em * 6);
  overflow: hidden;
  min-width: 0;
}

.task-card__desc > :first-child { margin-top: 0; }
.task-card__desc > :last-child { margin-bottom: 0; }
.task-card__desc p { margin: 0; }
.task-card__desc p + p,
.task-card__desc p + ul,
.task-card__desc p + ol,
.task-card__desc ul + p,
.task-card__desc ol + p {
  margin-top: 4px;
}
.task-card__desc ul,
.task-card__desc ol {
  margin: 0;
  padding-left: 18px;
}
.task-card__desc li { margin: 0; }
.task-card__desc a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.task-card__desc a:hover { color: var(--primary-hover); }
.task-card__desc strong { font-weight: 700; color: var(--text); }
.task-card__desc em { font-style: italic; }
.task-card__desc code {
  background: var(--surface-muted);
  color: var(--text);
  padding: 0 4px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.task-card__footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  margin-top: 2px;
}

.task-card__assignee {
  margin-left: auto;
}

/* Checklist progress badge (on the card) */
.badge--checklist {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px 2px 6px;
  border-radius: var(--r-pill);
  font-size: 10.5px;
  font-weight: 600;
  background: var(--surface-muted);
  color: var(--text-muted);
}

.badge--checklist svg {
  flex-shrink: 0;
}

.badge--checklist-done {
  background: var(--prio-low-soft);
  color: var(--prio-low-text);
}

.task-card__assignee {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  min-width: 0;
}

.task-card__assignee-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 110px;
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  border-radius: 50%;
  letter-spacing: 0;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px var(--surface);
}

/* Priority badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px 2px 7px;
  border-radius: var(--r-pill);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.task-card.prio-none .badge--prio {
  background: var(--surface-muted);
  color: var(--text-muted);
}
/* ---- Task labels (multi-tag) ---- */
.task-card__labels {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}

.task-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.01em;
  border-radius: var(--r-pill);
  background: var(--text-faint);
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.task-label--removable {
  padding-right: 4px;
}

.task-label__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.task-label__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  background: rgba(0, 0, 0, 0.12);
  border: none;
  border-radius: 50%;
  color: inherit;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity var(--t-fast), background var(--t-fast);
}

.task-label__remove:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.25);
}

.task-card.prio-low .badge--prio {
  background: var(--prio-low-soft);
  color: var(--prio-low-text);
}
.task-card.prio-medium .badge--prio {
  background: var(--prio-medium-soft);
  color: var(--prio-medium-text);
}
.task-card.prio-high .badge--prio {
  background: var(--prio-high-soft);
  color: var(--prio-high-text);
}

/* ==========================================================================
   Modal
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
  opacity: 0;
  transition: opacity var(--t-base);
}

.modal-overlay.modal-overlay--open,
.modal-overlay:not(.modal-overlay--closing) {
  opacity: 1;
}

.modal-overlay--closing {
  opacity: 0;
}

.modal {
  background: var(--surface);
  border-radius: var(--r-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  transform: translateY(8px) scale(0.98);
  transition: transform var(--t-base);
  animation: modal-enter var(--t-base) ease-out forwards;
}

.modal--small {
  max-width: 400px;
}

@keyframes modal-enter {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border-soft);
}

.modal__header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.modal__title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.modal__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
}

.modal__icon--danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.modal__icon--info {
  background: var(--primary-soft);
  color: var(--primary);
}

.modal__body {
  padding: 16px 20px 8px;
}

.modal__message {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-soft);
  white-space: pre-wrap;
}

.modal__footer--padded {
  padding: 12px 20px 18px;
}

.modal__footer--stack {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.modal__footer--stack .btn {
  width: 100%;
}

/* ---- Keyboard shortcuts help ---- */
.shortcuts-list {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shortcuts-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.shortcuts-row dt {
  flex: 0 0 110px;
  margin: 0;
  text-align: right;
}

.shortcuts-row dd {
  flex: 1;
  margin: 0;
  font-size: 13px;
  color: var(--text-soft);
}

kbd {
  display: inline-block;
  padding: 2px 7px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  white-space: nowrap;
}

.modal__close {
  background: transparent;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: var(--text-faint);
  width: 30px;
  height: 30px;
  border-radius: var(--r-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast);
}

.modal__close:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.modal__form {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal__form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-soft);
  letter-spacing: 0.005em;
}

.modal__form input,
.modal__form textarea,
.modal__form select {
  padding: 9px 11px;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: all var(--t-fast);
}

.modal__form input::placeholder,
.modal__form textarea::placeholder {
  color: var(--text-faint);
}

.modal__form input:focus,
.modal__form textarea:focus,
.modal__form select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.modal__form textarea {
  resize: vertical;
  min-height: 64px;
  font-family: inherit;
}

/* ---- Description field with markdown preview toggle ---- */
.modal__description-field {
  position: relative;
}

.modal__field-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.modal__preview-toggle {
  background: transparent;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 11px;
  font-weight: 500;
  color: var(--primary);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.modal__preview-toggle:hover { color: var(--primary-hover); }

.modal__description-preview {
  min-height: 64px;
  padding: 9px 11px;
  font-size: 14px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.modal__description-preview > :first-child { margin-top: 0; }
.modal__description-preview > :last-child { margin-bottom: 0; }
.modal__description-preview p { margin: 0 0 8px; }
.modal__description-preview ul,
.modal__description-preview ol {
  margin: 0 0 8px;
  padding-left: 22px;
}
.modal__description-preview a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.modal__description-preview a:hover { color: var(--primary-hover); }
.modal__description-preview strong { font-weight: 700; }
.modal__description-preview em { font-style: italic; }
.modal__description-preview code {
  background: var(--surface-muted);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}
.modal__description-preview__empty {
  margin: 0;
  color: var(--text-faint);
  font-style: italic;
}

.modal__hint {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-faint);
}

.modal__hint code {
  background: var(--surface-muted);
  color: var(--text-muted);
  padding: 0 4px;
  border-radius: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95em;
}

.modal__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ---- Labels section inside task modal ---- */
.modal__labels-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
}

.modal__section-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  letter-spacing: 0.005em;
}

.modal__labels-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 24px;
  align-items: center;
}

.modal__labels-empty {
  font-size: 12px;
  color: var(--text-faint);
  font-style: italic;
}

.modal__label-add {
  display: flex;
  gap: 6px;
  align-items: stretch;
}

.modal__label-input {
  flex: 1;
  min-width: 0;
  padding: 6px 9px !important;
  font-size: 11.5px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  transition: all var(--t-fast);
}

.modal__label-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.modal__label-add-btn {
  flex-shrink: 0;
  padding: 3px 9px;
  font-size: 11px;
  border-radius: var(--r-sm);
}

.modal__label-color-slot .color-picker__label {
  font-size: 11px;
  color: var(--text-muted);
}

/* ---- Checklist section inside task modal ---- */
.modal__checklist-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
}

.modal__section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.modal__checklist-progress {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 1px 8px;
  background: var(--surface-muted);
  border-radius: var(--r-pill);
  min-width: 0;
}

.modal__checklist-progress:empty {
  display: none;
}

.modal__checklist-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 24px;
}

.modal__checklist-empty {
  font-size: 12px;
  color: var(--text-faint);
  font-style: italic;
  padding: 4px 2px;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
}

.checklist-checkbox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: color var(--t-fast), background var(--t-fast);
}

.checklist-checkbox:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.checklist-item--done .checklist-checkbox {
  color: var(--prio-low);
}

.checklist-text {
  flex: 1;
  min-width: 0;
  padding: 4px 8px !important;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  transition: all var(--t-fast);
}

.checklist-text:hover {
  background: var(--surface-muted);
}

.checklist-text:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.checklist-item--done .checklist-text {
  text-decoration: line-through;
  color: var(--text-faint);
}

.checklist-remove {
  width: 22px;
  height: 22px;
  opacity: 0;
  transition: opacity var(--t-fast);
}

.checklist-item:hover .checklist-remove,
.checklist-item:focus-within .checklist-remove {
  opacity: 1;
}

.modal__checklist-add {
  display: flex;
  gap: 6px;
  align-items: stretch;
}

.modal__checklist-input {
  flex: 1;
  min-width: 0;
  padding: 6px 9px !important;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: all var(--t-fast);
}

.modal__checklist-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.modal__checklist-add-btn {
  flex-shrink: 0;
  padding: 5px 10px;
  font-size: 11.5px;
}

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 6px;
}

/* Tablet / narrow desktop: the board header has too many items to fit one row.
   Push the toolbar to its own line so the title can breathe. */
@media (max-width: 1080px) and (min-width: 601px) {
  .board__toolbar {
    flex: 1 0 100%;
  }

  .board__toolbar .history-buttons {
    margin-left: auto;
  }
}

@media (max-width: 600px) {
  .modal__row {
    grid-template-columns: 1fr;
  }

  /* ----- Overview ----- */
  .overview {
    padding: 32px 16px 48px;
  }

  .overview__brand {
    gap: 12px;
  }

  .overview__logo {
    width: 40px;
    height: 40px;
  }

  .overview__title {
    font-size: 22px;
  }

  .overview__subtitle {
    display: none;
  }

  .overview__actions {
    flex: 1 0 100%;
    justify-content: flex-end;
    gap: 8px;
  }

  .overview__actions .btn--icon {
    width: 40px;
    height: 40px;
  }

  .overview__create {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 6px;
  }

  .overview__create input {
    padding: 11px 12px;
  }

  .overview__create .btn {
    width: 100%;
    padding: 11px 14px;
    justify-content: center;
  }

  /* ----- Board header ----- */
  .board__header {
    padding: 10px 14px;
    gap: 10px;
  }

  .board__back {
    padding: 6px 8px 6px 4px;
  }

  .board__back span {
    display: none;
  }

  .board__title-wrap {
    flex: 1;
    min-width: 0;
  }

  .board__title {
    font-size: 15px;
    padding: 3px 6px;
  }

  .board__meta {
    display: none;
  }

  .board__search-wrap {
    flex: 1 0 100%;
    max-width: none;
  }

  .board__toolbar {
    flex: 1 0 100%;
    gap: 8px;
    row-gap: 8px;
  }

  .board__toolbar::before {
    display: none;
  }

  /* Row 1: history (left) + theme/lang/account (right). Row 2: add-buttons full width. */
  .board__toolbar .history-buttons {
    order: 1;
    flex: 0 0 auto;
  }

  .board__toolbar .theme-toggle {
    order: 2;
    margin-left: auto;
    flex: 0 0 auto;
    width: 36px;
  }

  .board__toolbar .lang-toggle {
    order: 2;
    flex: 0 0 auto;
    width: 36px;
  }

  .board__toolbar .account-btn {
    order: 2;
    flex: 0 0 auto;
    width: 36px;
  }

  .board__toolbar-add {
    order: 3;
    flex: 1 0 100%;
    gap: 6px;
  }

  .board__toolbar-add .btn {
    flex: 1;
    min-width: 0;
    padding: 9px 8px;
    font-size: 12.5px;
  }

  /* ----- Board grid padding ----- */
  .board__grid-wrap {
    padding: 16px 14px 32px;
  }
}

/* Custom scrollbars (webkit) */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: var(--r-pill);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-faint);
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* ==========================================================================
   Color picker widget
   ========================================================================== */
.color-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.color-picker__label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-soft);
  letter-spacing: 0.005em;
}

.color-picker__swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.color-swatch {
  position: relative;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: var(--surface-muted);
  cursor: pointer;
  transition: transform var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
  flex-shrink: 0;
}

.color-picker--small .color-picker__swatches {
  gap: 5px;
}

.color-picker--small .color-swatch {
  width: 20px;
  height: 20px;
  border-width: 1.5px;
}

.color-picker--small .color-swatch--none::before {
  left: 3px;
  right: 3px;
}

.color-swatch:hover {
  transform: scale(1.1);
}

.color-swatch:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.color-swatch--selected {
  border-color: var(--text);
  box-shadow: inset 0 0 0 2px var(--surface);
}

.color-swatch--none {
  background: var(--surface);
  border: 2px dashed var(--border-strong);
}

.color-swatch--none::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 4px;
  right: 4px;
  height: 2px;
  background: var(--text-faint);
  transform: rotate(-45deg);
  transform-origin: center;
}

.color-swatch--none.color-swatch--selected {
  border-color: var(--text);
  border-style: solid;
}

/* ==========================================================================
   Color accents (columns, swimlanes, tasks)
   ========================================================================== */

/* Column header — top color strip */
.col-header[data-color] {
  padding-top: 14px;
}

.col-header[data-color]::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--accent);
}

.col-header {
  position: relative;
  overflow: hidden;
}

/* Swimlane header — left color strip */
.swimlane-header[data-color] {
  padding-left: 16px;
}

.swimlane-header[data-color]::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  background: var(--accent);
}

.swimlane-header {
  position: relative;
  overflow: hidden;
}

/* Task card — top color strip (sits above existing left priority strip) */
.task-card[data-color] {
  padding-top: 14px;
}

.task-card[data-color]::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--accent);
}

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

.auth__toolbar {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 8px;
}

.auth__card {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
}

.auth__card--busy { opacity: 0.7; pointer-events: none; }

.auth__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--primary);
}

.auth__brand h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.auth__logo { display: inline-flex; }

.auth__lead {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
}

.auth__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-soft);
}

.auth__field input {
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xs);
}

.auth__field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-ring), var(--shadow-xs);
}

.auth__submit { width: 100%; padding: 10px 14px; margin-top: 4px; }

.auth__message {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}
.auth__message[data-tone="error"] { color: var(--danger); }
.auth__message[data-tone="success"] { color: #059669; }

.auth__link {
  background: none;
  border: none;
  padding: 2px;
  font-size: 13px;
  color: var(--primary);
  text-align: center;
}
.auth__link:hover { color: var(--primary-hover); text-decoration: underline; }
.auth__link:disabled { opacity: 0.5; pointer-events: none; }
.auth__link--toggle { color: var(--text-muted); }
.auth__link--toggle:hover { color: var(--text-soft); }

.auth__divider {
  height: 1px;
  background: var(--border-soft);
  margin: 2px 0;
}

.auth__steps {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--text-soft);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth__hint {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}
.auth__hint code,
.auth__steps code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--surface-muted);
  padding: 2px 5px;
  border-radius: var(--r-sm);
}

.account-menu {
  position: fixed;
  z-index: 1000;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
}

.account-menu__email {
  margin: 0;
  font-size: 13px;
  color: var(--text-soft);
  word-break: break-all;
}

.account-menu__signout { width: 100%; }
