/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* Eliminate 300ms tap delay and iOS ghost-click on every interactive element */
button, select, input[type="submit"], input[type="button"], input[type="reset"] { touch-action: manipulation; }

:root {
  --font: 'DM Sans', system-ui, -apple-system, sans-serif;
  /* Type scale (base 14px on html) */
  --text-xs: 0.65rem;    /* ~9px - badges, micro labels */
  --text-sm: 0.75rem;    /* ~10.5px - captions, field labels */
  --text-base: 0.9rem;   /* ~12.6px - body, inputs, cards */
  --text-md: 1rem;       /* 14px - nav items, emphasis */
  --text-lg: 1.1rem;     /* ~15.4px - section titles, modal headers */
  --text-xl: 1.3rem;     /* ~18.2px - page headings */
  --text-2xl: 1.6rem;    /* ~22.4px - display, hero */
  /* Weight scale */
  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-extrabold: 800;
  /* Spacing - verbatim pixel values (2px steps to 20, then 8px grid) */
  --space-0: 0px;
  --space-2: 2px;
  --space-4: 4px;
  --space-6: 6px;
  --space-8: 8px;
  --space-10: 10px;
  --space-12: 12px;
  --space-14: 14px;
  --space-16: 16px;
  --space-18: 18px;
  --space-20: 20px;
  --space-24: 24px;
  --space-28: 28px;
  --space-32: 32px;
  --space-40: 40px;
  --space-48: 48px;
  --space-64: 64px;
  --space-96: 96px;
  /* Spacing - semantic aliases (adjust these to tune the whole system) */
  --space-xxs: var(--space-2);   /* 2px - hairline */
  --space-xs: var(--space-4);    /* 4px - tight internal */
  --space-s: var(--space-8);     /* 8px - standard gap */
  --space-m: var(--space-12);    /* 12px - field/card spacing */
  --space-l: var(--space-16);    /* 16px - section padding */
  --space-xl: var(--space-24);   /* 24px - group spacing */
  --space-xxl: var(--space-32);  /* 32px - section gaps */
  /* Radius scale */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 100px;
  /* Aliases → token vars (tokens.css provides the values) */
  --bg: var(--surface-canvas);
  --surface: var(--surface-base);
  --surface-raised: var(--surface-raised);
  --border: var(--outline-default);
  --border-outer: var(--outline-muted);
  --highlight: var(--surface-highlight);
  --text: var(--content-primary);
  --text-secondary: var(--content-secondary);
  --header-bg: var(--surface-header);
  --accent: var(--accent-primary1);
  --accent-text: var(--accent-primary1-text);
  --radius: 14px;
  --shadow-card: 0 2px 8px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.03);
  --shadow-hover: 0 8px 32px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
  --shadow-glass: inset 0 1px 0 0 var(--highlight), 0 1px 3px rgba(0,0,0,0.06);
  --blur: 20px;
  --shadow-accent: var(--color-primary1-800, #00626f);
  --shadow-accent-hover: var(--color-primary1-900, #004d57);
  --planner-tint: color-mix(in srgb, var(--color-primary1-100, #cef7ff) 45%, white);
  --planner-tint-dark: var(--color-primary1-900, rgba(0, 37, 44, 0.85));
  /* Status column header defaults - tokens.css sets the real values;
     these are fallbacks only if tokens fail to load */
  --status-todo-bg: #2B6CB0;
  --status-in-progress-bg: rgb(170, 51, 208);
  --status-blocked-bg: #C53030;
  /* Status text - overridden by JS when user picks a custom column colour */
  --status-todo-text: #FFFFFF;
  --status-in-progress-text: #FFFFFF;
  --status-blocked-text: #FFFFFF;
  --status-done-text: #FFFFFF;
  /* Glass surface layers (white-based for glassmorphism depth) */
  --glass-dialog: rgba(255,255,255,0.82);
  --glass-nav: rgba(255,255,255,0.85);
  --glass-overlay: rgba(255,255,255,0.88);
  --glass-card: rgba(255,255,255,0.92);
  --glass-border: rgba(255,255,255,0.6);
  --glass-border-strong: rgba(255,255,255,0.7);
  --glass-border-subtle: rgba(255,255,255,0.35);
  --glass-highlight: rgba(255,255,255,0.8);
  --glass-shadow: 0 8px 32px rgba(0,0,0,0.12);
  --glass-shadow-inset: inset 0 1px 0 rgba(255,255,255,0.6);
  /* Form input surfaces */
  --input-bg: rgba(255,255,255,0.93);
  --input-bg-hover: rgba(255,255,255,0.97);
  --input-border: rgba(0,0,0,0.08);
  --input-shadow: inset 0 1px 2px rgba(0,0,0,0.06);
  /* Today marker */
  --today-text: #E53E3E;
  --today-bg: #FFF5F5;
  --today-border: #FEB2B2;
  --today-line: #E53E3E;
  /* Neutral interaction states */
  --hover-overlay: rgba(0,0,0,0.04);
  --active-overlay: rgba(0,0,0,0.08);
  /* Hamburger / icon colours */
  --icon-primary: var(--content-primary);
  --icon-on-dark: #fff;
  /* Auth/landing page surface */
  --surface-landing: #fafafa;
  /* Home prompt accent card - light values (sourced from qp-ux-proposal.html) */
  --glass-card-accent:        color-mix(in srgb, var(--accent-primary1) 10%, rgba(255,255,255,0.88));
  --glass-card-accent-border: color-mix(in srgb, var(--accent-primary1) 40%, rgba(255,255,255,0.6));
  --glass-card-accent-hover:  color-mix(in srgb, var(--accent-primary1) 18%, rgba(255,255,255,0.92));
}

html { font-size: 14px; overflow-x: hidden; }
body {
  font-family: var(--font);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  --bg-accent-glow: var(--accent-primary1, rgba(0,227,255,1));
  --bg-a1-x: 10%; --bg-a1-y: 90%;
  --bg-a2-x: 90%; --bg-a2-y: 15%;
  background:
    radial-gradient(ellipse 60% 50% at var(--bg-a1-x) var(--bg-a1-y), var(--color-neutral-100) 0%, transparent 70%),
    radial-gradient(ellipse 50% 60% at var(--bg-a2-x) var(--bg-a2-y), color-mix(in srgb, var(--bg-accent-glow) 21%, transparent) 0%, transparent 70%),
    linear-gradient(135deg, var(--color-neutral-100) 0%, var(--color-neutral-100) 40%, var(--color-neutral-100) 100%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
}

/* === Sidebar Rail === */
.sidebar-rail {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 56px;
  z-index: 150;
  background: var(--header-bg);
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  border-right: 1px solid var(--border-outer);
  box-shadow: inset -1px 0 0 0 var(--border), 4px 0 20px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (hover: hover) {
  .sidebar-rail:not(.sidebar-pinned-closed):hover { width: 200px; }
  .sidebar-rail:not(.sidebar-pinned-closed):hover .sidebar-logo-text { opacity: 1; }
  .sidebar-rail:not(.sidebar-pinned-closed):hover .sidebar-label { opacity: 1; }
  .sidebar-rail:not(.sidebar-pinned-closed):hover .sidebar-projects-list { opacity: 1; max-height: 400px; }
}

.sidebar-top {
  display: flex;
  align-items: center;
  gap: var(--space-10);
  padding: var(--space-16) var(--space-14);
  white-space: nowrap;
  flex-shrink: 0;
  height: 98px;
  background: none;
  border: none;
  width: 100%;
  cursor: default;
  text-align: left;
  font-family: var(--font);
}
.settings-open .sidebar-top { cursor: pointer; }
.settings-open .sidebar-top:hover .sidebar-logo-icon { opacity: 0.8; }

.primary-nav {
  display: none;
}
.mobile-logo {
  display: none;
}

.sidebar-logo-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: var(--on-accent-primary1);
  font-family: var(--font);
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.sidebar-logo-text {
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  color: var(--text);
  opacity: 0;
  transition: opacity 0.2s ease 0.05s;
  white-space: nowrap;
}


/* === Sidebar Projects === */
.sidebar-projects {
  padding: 0 var(--space-10);
  overflow: hidden;
}

.sidebar-projects-header {
  display: flex;
  align-items: center;
  gap: var(--space-10);
  padding: var(--space-8) var(--space-6) var(--space-6) var(--space-8);
  white-space: nowrap;
}

.sidebar-projects-icon {
  flex-shrink: 0;
  color: var(--text-secondary);
}

.sidebar-projects-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  flex: 1;
}

.sidebar-projects-add {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: var(--radius-md);
  background: none;
  color: var(--content-primary);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
  padding: 0;
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
}

.sidebar-projects-add:hover {
  color: var(--on-accent-primary1);
  background: var(--accent);
}

.sidebar-projects-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--outline-muted);
  padding-top: var(--space-6);
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.2s ease 0.05s, max-height 0.25s ease;
}

.sidebar-project-item {
  position: relative;
  display: flex;
  align-items: center;
  padding: var(--space-6) var(--space-8);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  border-radius: var(--radius-md);
}
.sidebar-project-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-project-opts {
  display: flex;
  flex-shrink: 0;
  width: 26px;
  height: 18px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: var(--text-base);
  line-height: 1;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin-left: var(--space-4);
  transition: color 0.15s ease;
}
.sidebar-project-opts:hover { color: var(--text); }

@keyframes popover-in {
  from { opacity: 0; transform: scale(0.96) translateY(-4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.sidebar-project-menu {
  display: none;
  position: fixed;
  z-index: 1001;
  background: var(--surface);
  backdrop-filter: blur(var(--blur)) saturate(1.2);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.2);
  border: 1px solid var(--border-outer);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.06);
  padding: var(--space-4);
  min-width: 200px;
  flex-direction: column;
}
.sidebar-project-menu.open {
  display: flex;
  animation: popover-in 0.14s cubic-bezier(0.2, 0, 0, 1);
}
.sidebar-project-menu-item {
  display: flex;
  align-items: center;
  padding: var(--space-8) var(--space-12);
  font-family: var(--font);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--text);
  background: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
.sidebar-project-menu-item:hover { background: var(--surface-raised); }
.sidebar-project-menu-item--danger { color: var(--danger-text); }
.sidebar-project-menu-item--danger:hover { background: var(--danger-bg); }

.sidebar-project-item:hover {
  background: var(--surface-raised);
}

.sidebar-project-item.active {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-radius: var(--radius-md);
  font-weight: var(--weight-semibold);
}

[data-theme="dark"] .sidebar-project-item.active {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: var(--space-2);
  flex: 1;
  padding-bottom: var(--space-16);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  padding: var(--space-10) var(--space-16) var(--space-10) 19px;
  background: none;
  border: none;
  border-radius: 0;
  font-family: var(--font);
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.sidebar-item:hover {
  background: var(--surface-raised);
  color: var(--text);
}

.sidebar-item svg {
  flex-shrink: 0;
}

.sidebar-label {
  opacity: 0;
  transition: opacity 0.2s ease 0.05s;
}


.sidebar-bottom {
  padding: var(--space-8) 0;
  margin-top: auto;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  white-space: nowrap;
}

.sidebar-bottom #sidebar-last-synced {
  padding: 0 var(--space-16);
}

.sidebar-toggle-btn {
  margin-top: var(--space-4);
}

@media (min-width: 1025px) {
  .sidebar-toggle-btn { display: none; }
}

.icon-eye-closed { display: none; }
.sidebar-rail.sidebar-expanded .icon-eye-open { display: none; }
.sidebar-rail.sidebar-expanded .icon-eye-closed { display: block; }

.sidebar-rail.sidebar-expanded,
.sidebar-rail.sidebar-popover-open {
  width: 200px;
}

.sidebar-rail.sidebar-expanded .sidebar-label,
.sidebar-rail.sidebar-popover-open .sidebar-label {
  opacity: 1;
}

.sidebar-rail.sidebar-expanded .sidebar-logo-text,
.sidebar-rail.sidebar-popover-open .sidebar-logo-text {
  opacity: 1;
}

.sidebar-rail.sidebar-expanded .sidebar-projects-list,
.sidebar-rail.sidebar-popover-open .sidebar-projects-list {
  opacity: 1;
  max-height: 400px;
}

.sidebar-item.refreshing .refresh-icon {
  animation: spin 0.8s linear infinite;
}

/* === Header === */
.app-header {
  background: var(--header-bg);
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  border-bottom: 1px solid var(--border-outer);
  box-shadow: inset 0 -1px 0 0 var(--border), 0 4px 20px rgba(0,0,0,0.04);
  padding: 0 var(--space-24);
  min-height: 98px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  margin-left: 56px;
}

/* === Dark Theme === */
[data-theme="dark"] {
  /* Dark surface defaults - theme-customizer overrides these with accent-tinted values */
  --dark-surface: var(--color-neutral-1100, #202020);
  --dark-card: var(--color-neutral-1000, #313131);
  --dark-card-hover: var(--color-neutral-900, #434343);
  --dark-surface-deep: var(--color-neutral-1200, #101010);
  --dark-surface-deepest: var(--color-neutral-1300, #030303);
  --dark-border: var(--color-neutral-1000, #313131);
  /* tokens.css handles semantic overrides; only non-token vars here */
  --shadow-card: 0 2px 8px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.2);
  --shadow-hover: 0 8px 32px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.3);
  --shadow-glass: inset 0 1px 0 0 var(--highlight), 0 1px 3px rgba(0,0,0,0.3);
  /* Glass surfaces - dark */
  --glass-dialog: rgba(22,24,34,0.88);
  --glass-nav: rgba(22,24,34,0.88);
  --glass-overlay: rgba(12,12,22,0.88);
  --glass-card: rgba(22,24,34,0.92);
  --glass-border: rgba(255,255,255,0.12);
  --glass-border-strong: rgba(255,255,255,0.15);
  --glass-border-subtle: rgba(255,255,255,0.08);
  --glass-highlight: rgba(255,255,255,0.08);
  /* Home prompt accent card - dark overrides */
  --glass-card-accent:        color-mix(in srgb, var(--accent-primary1) 12%, rgba(22,24,34,0.92));
  --glass-card-accent-border: color-mix(in srgb, var(--accent-primary1) 45%, rgba(255,255,255,0.12));
  --glass-card-accent-hover:  color-mix(in srgb, var(--accent-primary1) 20%, rgba(30,33,45,0.95));
  --glass-shadow: 0 8px 32px rgba(0,0,0,0.3);
  --glass-shadow-inset: inset 0 1px 0 rgba(255,255,255,0.08);
  /* Form inputs - dark */
  --input-bg: rgba(22,24,34,0.93);
  --input-bg-hover: rgba(30,33,45,0.96);
  --input-border: rgba(255,255,255,0.15);
  --input-shadow: inset 0 1px 2px rgba(0,0,0,0.25);
  /* Today marker - dark */
  --today-text: #FC8181;
  --today-bg: #3B1A1A;
  --today-border: #9B2C2C;
  --today-line: #E53E3E;
  /* Neutral interaction states - dark */
  --hover-overlay: rgba(255,255,255,0.08);
  --active-overlay: rgba(255,255,255,0.12);
  /* Icons - dark */
  --icon-primary: var(--content-primary);
  /* Auth/landing page surface */
  --surface-landing: var(--dark-surface-deepest, #0f1117);
}

[data-theme="dark"] .sidebar-rail {
  box-shadow: inset -1px 0 0 0 var(--border), 4px 0 20px rgba(0,0,0,0.3);
}

[data-theme="dark"] body {
  background:
    radial-gradient(ellipse 60% 50% at var(--bg-a1-x) var(--bg-a1-y), var(--color-neutral-900) 0%, transparent 70%),
    radial-gradient(ellipse 50% 60% at var(--bg-a2-x) var(--bg-a2-y), color-mix(in srgb, var(--bg-accent-glow) 21%, transparent) 0%, transparent 70%),
    linear-gradient(135deg, var(--dark-surface-deep) 0%, var(--dark-surface) 40%, var(--dark-surface-deepest) 100%);
  background-attachment: fixed;
}

[data-theme="dark"] .modal-overlay {
  background: color-mix(in srgb, var(--dark-surface-deepest) 50%, transparent);
}
[data-theme="dark"] .onboarding-overlay {
  background: color-mix(in srgb, var(--dark-surface-deepest) 50%, transparent);
}
[data-theme="dark"] .modal-dialog {
  background: color-mix(in srgb, var(--dark-surface) 85%, transparent);
  border-color: var(--glass-border-strong);
}
[data-theme="dark"] .modal-field span,
[data-theme="dark"] .modal-field label { color: var(--content-secondary); }
[data-theme="dark"] .modal-field input,
[data-theme="dark"] .modal-field select,
[data-theme="dark"] .modal-field textarea {
  background-color: var(--input-bg);
  border-color: var(--input-border);
  box-shadow: var(--input-shadow);
}
[data-theme="dark"] .modal-field input:hover,
[data-theme="dark"] .modal-field select:hover,
[data-theme="dark"] .modal-field textarea:hover { background-color: var(--input-bg-hover); }
[data-theme="dark"] .kanban-column { background: color-mix(in srgb, var(--dark-surface-deep) 5%, transparent); }
[data-theme="dark"] .kanban-column::after { background: linear-gradient(to top, color-mix(in srgb, var(--dark-surface-deep) 40%, transparent), transparent); }
[data-theme="dark"] .kanban-card { background: color-mix(in srgb, var(--dark-surface) 92%, transparent); }
[data-theme="dark"] .kanban-card:hover { background: color-mix(in srgb, var(--dark-card) 95%, transparent); }
[data-theme="dark"] .planner-container { background: color-mix(in srgb, var(--dark-surface-deep) 30%, transparent); }
[data-theme="dark"] .todolist-container::after { background: linear-gradient(to top, color-mix(in srgb, var(--dark-surface-deep) 40%, transparent), transparent); }
[data-theme="dark"] .kanban-cards.drag-over { background: color-mix(in srgb, var(--accent) 8%, transparent); }
[data-theme="dark"] .kanban-card-placeholder { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
[data-theme="dark"] .today-marker-header span { background: var(--today-bg); color: var(--today-text); border-color: var(--today-border); }

/* === Theme Pill Toggle === */
.mobile-theme-item { cursor: pointer; }

/* ─── Sidebar theme group ───────────────────────────────────────────────────── */
.sidebar-theme-group {
  display: flex;
  flex-direction: column;
}

/* Mode icon: show only the active one, centred like all sidebar icons */
.theme-mode-icon {
  display: none;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  color: var(--content-secondary);
  flex-shrink: 0;
}
.sidebar-theme-group[data-mode="light"] .theme-mode-icon-light { display: flex; }
.sidebar-theme-group[data-mode="dark"] .theme-mode-icon-dark { display: flex; }
.sidebar-theme-group[data-mode="system"] .theme-mode-icon-auto { display: flex; }

/* Sub-panel - hidden by default, shown when open AND sidebar expanded */
.sidebar-theme-sub {
  display: none;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-10) var(--space-8);
  overflow: hidden;
}

.sidebar-theme-group.open .sidebar-theme-sub {
  display: none;
}

.sidebar-rail:hover .sidebar-theme-group.open .sidebar-theme-sub,
.sidebar-rail.sidebar-expanded .sidebar-theme-group.open .sidebar-theme-sub {
  display: flex;
}

.sidebar-sub-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--content-tertiary);
  padding: var(--space-2) var(--space-4) 0;
}

.sidebar-sub-row {
  display: flex;
  gap: var(--space-2);
}

.sidebar-mode-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4) 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: none;
  color: var(--content-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.sidebar-mode-btn:hover {
  background: var(--surface-raised);
}

.sidebar-mode-btn.active {
  background: var(--accent);
  color: var(--on-accent-primary1);
  border-color: var(--accent);
}

.sidebar-surface-btn {
  flex: 1;
  padding: var(--space-4) 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: none;
  font-family: var(--font);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--content-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.sidebar-surface-btn:hover {
  background: var(--surface-raised);
}

.sidebar-surface-btn.active {
  background: var(--accent);
  color: var(--on-accent-primary1);
  border-color: var(--accent);
}

.theme-pill {
  position: relative;
  width: 40px;
  height: 22px;
  background: rgba(0,0,0,0.08);
  border-radius: 11px;
  flex-shrink: 0;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              height 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              background 0.25s ease,
              border-radius 0.25s ease;
}
[data-theme="dark"] .theme-pill {
  background: rgba(255,255,255,0.12);
}

/* Collapsed sidebar: pill becomes a circle */
.sidebar-rail:not(:hover):not(.sidebar-expanded):not(.sidebar-popover-open) .theme-pill,
.sidebar-rail.sidebar-pinned-closed .theme-pill {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: transparent;
}

.theme-pill-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-primary1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15), 0 0 0 0.5px rgba(0,0,0,0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
[data-theme="dark"] .theme-pill-thumb {
  transform: translateX(18px);
}
/* Collapsed: thumb always at origin regardless of theme */
.sidebar-rail:not(:hover):not(.sidebar-expanded):not(.sidebar-popover-open) .theme-pill-thumb,
.sidebar-rail.sidebar-pinned-closed .theme-pill-thumb {
  transform: translateX(0);
}

.theme-pill-icon {
  position: absolute;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
/* Light mode: sun visible, moon hidden */
.theme-pill .icon-sun { opacity: 1; color: var(--on-accent-primary1); transform: scale(1); }
.theme-pill .icon-moon { opacity: 0; transform: scale(0.5); }
/* Dark mode: moon visible, sun hidden */
[data-theme="dark"] .theme-pill .icon-sun { opacity: 0; transform: scale(0.5); }
[data-theme="dark"] .theme-pill .icon-moon { opacity: 1; color: var(--on-accent-primary1); transform: scale(1); }

/* Focus ring */
.toggle-input:focus-visible ~ .theme-pill {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Large variant (mobile menu) */
.theme-pill-lg {
  width: 52px;
  height: 28px;
  border-radius: var(--radius-lg);
}
.theme-pill-lg .theme-pill-thumb {
  width: 24px;
  height: 24px;
}
[data-theme="dark"] .theme-pill-lg .theme-pill-thumb {
  transform: translateX(24px);
}

.summary {
  font-size: var(--text-base);
  color: var(--text-secondary);
  font-weight: var(--weight-medium);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  width: 100%;
}

.toolbar-left {
  display: flex;
  gap: var(--space-12);
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  flex-shrink: 0;
  margin-left: auto;
}

/* Search + filter grouped as one connected pill */
.search-filter-group {
  display: flex;
  align-items: stretch;
  background: var(--surface-raised);
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  border: 1px solid var(--glass-border-strong);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 0 var(--glass-highlight), 0 1px 3px rgba(0,0,0,0.06);
  overflow: visible;
}
[data-theme="dark"] .search-filter-group {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.1);
  box-shadow: inset 0 1px 0 0 var(--glass-highlight), 0 1px 3px rgba(0,0,0,0.3);
}

/* === View Toggle === */
.view-toggle {
  display: flex;
  background: none;
  border: none;
  padding: 0;
  gap: var(--space-4);
  flex-shrink: 0;
}

.view-btn {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-8) var(--space-16);
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  font-family: var(--font);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.view-btn.active {
  background: var(--accent);
  color: var(--on-accent-primary1);
  border: 1px solid color-mix(in srgb, var(--shadow-accent) 10%, transparent);
  box-shadow: inset 0 1px 0 0 rgba(255,255,255,0.2), 0 2px 8px color-mix(in srgb, var(--shadow-accent) 40%, transparent);
}

.view-btn:hover:not(.active) { color: var(--text); }
[data-theme="dark"] .view-btn:not(.active) { color: var(--content-primary); }
[data-theme="dark"] .view-btn:not(.active):active { color: var(--content-tertiary); }
[data-theme="dark"] .view-btn:not(.active):hover { color: var(--content-inverse, #fff); }
[data-theme="dark"] .view-btn.active { color: var(--on-accent-primary1); }

.view-btn svg { flex-shrink: 0; }

/* === Toolbar Search (inside .search-filter-group - no own bg/border) === */
.toolbar-search {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  padding: 0 var(--space-14);
  flex-shrink: 0;
  min-width: 210px;
}
.toolbar-search svg {
  color: var(--text-secondary);
  flex-shrink: 0;
}
.toolbar-search input {
  border: none;
  background: transparent;
  font-family: var(--font);
  font-size: var(--text-md);
  color: var(--text);
  padding: var(--space-10) 0;
  width: 100%;
  outline: none;
}
.toolbar-search input::placeholder { color: var(--text-secondary); }
.toolbar-search input::-webkit-search-cancel-button { cursor: pointer; }

/* === Desktop Filter Button + Popover === */
.desktop-filter-wrap {
  display: flex;
  align-items: stretch;
}
/* Divider between search and filter btn */
.desktop-filter-wrap::before {
  content: '';
  display: block;
  width: 1px;
  background: var(--border-outer);
  align-self: stretch;
  margin: var(--space-8) 0;
}
.desktop-filter-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
  border-radius: 0 var(--radius) var(--radius) 0;
  transition: color 0.15s ease, background 0.15s ease;
}
.desktop-filter-btn:hover { color: var(--text); background: var(--hover-overlay); }
.desktop-filter-btn.active { color: var(--accent-text); background: color-mix(in srgb, var(--accent) 10%, transparent); }
[data-theme="dark"] .desktop-filter-btn.active { color: var(--accent-text); }
.hide-done-btn {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  margin-left: var(--space-8);
  padding: var(--space-8) var(--space-10);
  border: none;
  border-left: 1px solid var(--border-outer);
  border-radius: 0;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.hide-done-btn:hover { color: var(--text); }
.hide-done-btn.active { color: var(--accent-text); }
/* Icon reflects the action a click will take, not the current state:
   "Hide done" (inactive) shows the slashed eye, "Show done" (active)
   shows the open eye - matching the show/hide-password convention. */
.hide-done-eye { display: none; }
.hide-done-btn.active .hide-done-eye-slash { display: none; }
.hide-done-btn.active .hide-done-eye { display: block; }
.desktop-filter-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent-primary1);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.desktop-filter-badge.hidden { display: none; }

.desktop-filter-popover {
  position: fixed;
  z-index: 1200;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(calc(var(--blur) * 3)) saturate(1.6);
  -webkit-backdrop-filter: blur(calc(var(--blur) * 3)) saturate(1.6);
  border: 1px solid rgba(255,255,255,0.6);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-glass), 0 20px 60px rgba(0,0,0,0.15);
  padding: var(--space-24);
  min-width: 560px;
}
.desktop-filter-popover.hidden { display: none; }
[data-theme="dark"] .desktop-filter-popover {
  background: color-mix(in srgb, var(--dark-surface) 85%, transparent);
  border-color: rgba(255,255,255,0.15);
}
.filter-popover-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-20);
}
.filter-popover-grid .filter-group {
  flex-direction: column;
  align-items: stretch;
  flex: unset;
}
.filter-popover-grid .filter-group label {
  font-size: var(--text-xs);
  margin-bottom: var(--space-6);
}
.filter-popover-grid select {
  border: 1px solid var(--border);
  box-shadow: var(--shadow-glass);
  background-color: var(--surface);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  padding: var(--space-10) var(--space-32) var(--space-10) var(--space-14);
  width: 100%;
}

/* Legacy .filters wrapper - no longer used in DOM but keep for mobile compat */
.filters { display: none; }

select {
  font-family: var(--font);
  font-size: var(--text-md);
  padding: var(--space-10) var(--space-40) var(--space-10) var(--space-14);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='2' stroke='%236B7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='m19.5 8.25-7.5 7.5-7.5-7.5'/%3E%3C/svg%3E") no-repeat right 14px center;
  background-size: 12px 12px;
  appearance: none;
  cursor: pointer;
  color: var(--text);
  box-shadow: var(--shadow-glass);
  transition: all 0.2s ease;
}

select:hover {
  background-color: var(--surface-raised);
}

select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.filter-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--space-4);
  flex: 0.8;
  min-width: 0;
}

.filter-group label {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

.filters select {
  border: none;
  box-shadow: none;
  background-color: transparent;
  background-position: right 7px center;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  padding: var(--space-4) 22px var(--space-4) var(--space-6);
}

.filters select:hover {
  background-color: var(--surface-raised);
}

/* === Header Actions (mobile only) === */
.mobile-menu-btn { display: none; }
.mobile-menu-overlay { display: none; }
.mobile-search-btn { display: none; }
.mobile-search-overlay { display: none; }
.mobile-filter-btn { display: none; }
.mobile-filter-overlay { display: none; }
.mobile-toolbar-icons { display: none; }

/* === Sync Controls === */
.sync-controls {
  position: relative;
  display: flex;
  align-items: center;
}

.last-synced {
  position: absolute;
  top: 100%;
  right: 0;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: var(--weight-medium);
  margin-top: var(--space-2);
  white-space: nowrap;
}

.refresh-btn {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  padding: var(--space-6) var(--space-14);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-family: var(--font);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-glass);
}

.refresh-btn:hover {
  background: var(--accent-primary1);
  color: var(--on-accent-primary1);
  border-color: var(--accent-primary1);
}

.refresh-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.refresh-btn svg { flex-shrink: 0; }

.refresh-btn.refreshing .refresh-icon {
  animation: spin 0.8s linear infinite;
}

/* === Loading & Error === */
.loading {
  display: flex;
  flex: 1;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* === Skeleton Loader === */
@keyframes skeleton-pulse {
  0%, 100% { background-color: rgba(0,0,0,0.07); }
  50% { background-color: rgba(0,0,0,0.12); }
}
[data-theme="dark"] .skeleton-pulse {
  animation-name: skeleton-pulse-dark;
}
@keyframes skeleton-pulse-dark {
  0%, 100% { background-color: rgba(255,255,255,0.05); }
  50% { background-color: rgba(255,255,255,0.10); }
}
.skeleton-pulse {
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}
.skeleton {
  flex: 1;
  padding: var(--space-20) var(--space-24);
  margin-left: 56px;
}
.skeleton-kanban {
  display: flex;
  gap: var(--space-16);
  height: 100%;
}
.skeleton-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-10);
}
.skeleton-col-header {
  height: 40px;
  border-radius: var(--radius-md);
}
.skeleton-card {
  height: 72px;
  border-radius: var(--radius-lg);
}
.skeleton-planner {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}
.skeleton-header {
  height: 36px;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-8);
}
.skeleton-row {
  display: flex;
  align-items: center;
  gap: var(--space-16);
  height: 36px;
}
.skeleton-label {
  width: 200px;
  height: 16px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
}
.skeleton-bar {
  height: 24px;
  border-radius: var(--radius-sm);
}
.skeleton-todolist {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}
.skeleton-todolist .skeleton-card {
  height: 80px;
}
@media (max-width: 768px) {
  .skeleton { margin-left: 0; padding: var(--space-12) var(--space-16); }
  .skeleton-kanban { flex-direction: column; }
}

/* === Notification Component === */
.notification {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: calc(100vh - 80px);
  margin-left: 56px;
  padding: var(--space-20);
  font-family: var(--font);
  font-size: var(--text-base);
}
.notification-inner {
  display: flex;
  align-items: flex-start;
  gap: var(--space-14);
  padding: var(--space-20);
  border-radius: var(--radius-md);
  max-width: 600px;
}
.notification svg {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
}
.notification-text {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.notification-text strong {
  font-weight: var(--weight-semibold);
  font-size: var(--text-md);
}
.notification-text span {
  font-weight: var(--weight-normal);
  font-size: var(--text-base);
  color: var(--content-secondary);
}
@media (max-width: 768px) {
  .notification { margin-left: 0; font-size: var(--text-base); }
  .notification-inner { padding: var(--space-16); gap: 12px; }
  .notification svg { width: 24px; height: 24px; }
  .notification-text strong { font-size: var(--text-base); }
  .notification-text span { font-size: var(--text-base); }
}
.notification-error .notification-inner {
  background: var(--danger-bg);
  color: var(--danger-text);
}
.notification-warning .notification-inner {
  background: var(--warning-bg);
  color: var(--warning-text);
}
.notification-success .notification-inner {
  background: var(--success-bg);
  color: var(--success-text);
}
.notification-info .notification-inner {
  background: var(--info-bg);
  color: var(--info-text);
}
[data-theme="dark"] .notification-text span { color: var(--content-secondary); }

.hidden { display: none !important; }

/* === Main === */
main { padding: var(--space-20) var(--space-24) var(--space-12); flex: 1; min-height: 0; display: flex; flex-direction: column; margin-left: 56px; overflow: hidden; transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1); }
main.settings-open { overflow: hidden; padding: 0; }

@media (hover: hover) {
  body:has(.sidebar-rail:not(.sidebar-pinned-closed):hover) main {
    margin-left: 200px;
  }
}

/* === Kanban Board === */
.kanban-board {
  display: flex;
  gap: var(--space-16);
  padding-bottom: 0;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}

.kanban-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(var(--blur)) saturate(1.15);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.15);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-glass), 0 4px 16px rgba(0,0,0,0.03);
  position: relative;
}
.kanban-column::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 40px;
  background: linear-gradient(to top, rgba(0,0,0,0.0375), transparent);
  mix-blend-mode: multiply;
  pointer-events: none;
  border-radius: 0 0 var(--radius) var(--radius);
  z-index: 1;
}

.kanban-column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-14) var(--space-16);
  border-bottom: 1px solid var(--border-outer);
  box-shadow: inset 0 -1px 0 0 var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface-raised);
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  border-radius: var(--radius) var(--radius) 0 0;
}

.column-title {
  font-weight: var(--weight-bold);
  font-size: var(--text-lg);
  color: var(--text);
}

.kanban-column-header.status-colored {
  border-bottom: none;
  box-shadow: none;
  border-radius: var(--radius-md);
  margin: var(--space-6) var(--space-6) 0;
  padding: var(--space-12) var(--space-14);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.kanban-column-header.status-colored .column-title {
  color: inherit;
}

.column-color-btn {
  background: none;
  border: none;
  color: inherit;
  opacity: 0.55;
  cursor: pointer;
  font-size: var(--text-md);
  padding: var(--space-2) var(--space-6);
  border-radius: var(--radius-sm);
  line-height: 1;
  transition: opacity 0.15s, background 0.15s;
  flex-shrink: 0;
}
.column-color-btn:hover { opacity: 1; background: rgba(255,255,255,0.15); }

/* Kanban column ··· popover menu */
.kanban-col-menu-wrap {
  position: relative;
}
.kanban-col-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 100;
  background: var(--glass-dialog);
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  border: 1px solid var(--border-outer);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12), inset 0 1px 0 var(--glass-border);
  padding: var(--space-4);
  min-width: 160px;
  flex-direction: column;
}
.kanban-col-menu.open { display: flex; }
[data-theme="dark"] .kanban-col-menu {
  box-shadow: 0 8px 32px rgba(0,0,0,0.3), inset 0 1px 0 var(--glass-highlight);
}
.kanban-col-menu-item {
  display: flex;
  align-items: center;
  padding: var(--space-8) var(--space-12);
  font-family: var(--font);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--text);
  background: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  transition: background 0.15s ease;
}
.kanban-col-menu-item:hover { background: var(--surface-raised); }

.column-color-popover {
  position: fixed;
  z-index: 9999;
  background: var(--surface-raised);
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-12);
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  min-width: 200px;
}

.kanban-cards {
  padding: var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  min-height: 60px;
  flex: 1;
  overflow-y: auto;
  transition: background 0.15s ease;
}

.kanban-cards.drag-over {
  background: color-mix(in srgb, var(--shadow-accent) 8%, transparent);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* === Card === */
.kanban-card {
  background: color-mix(in srgb, var(--color-primary1-100) 18%, rgba(255,255,255,0.55));
  backdrop-filter: blur(calc(var(--blur) / 2)) saturate(1.2);
  -webkit-backdrop-filter: blur(calc(var(--blur) / 2)) saturate(1.2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-12) var(--space-14);
  box-shadow: var(--shadow-glass), var(--shadow-card);
  transition: all 0.2s ease;
  cursor: grab;
  user-select: none;
  touch-action: manipulation;
}

.kanban-card:hover {
  box-shadow: var(--shadow-glass), var(--shadow-hover);
  transform: translateY(-2px);
  background: color-mix(in srgb, var(--color-primary1-100) 15%, white);
}

.kanban-card:active {
  cursor: grabbing;
  background: color-mix(in srgb, var(--color-primary1-100) 20%, white);
}

.kanban-card.dragging {
  opacity: 0.4;
  transform: rotate(2deg);
}

/* === Drag Placeholder === */
.kanban-card-placeholder {
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--shadow-accent) 10%, transparent);
  min-height: 60px;
  margin: var(--space-4) 0;
}

/* === Card Expand === */
.kanban-card .card-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kanban-card.expanded .card-title {
  -webkit-line-clamp: unset;
  overflow: visible;
}

.category-badge {
  display: inline-block;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  padding: var(--space-2) var(--space-10);
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0;
  box-shadow: inset 0 1px 0 0 rgba(255,255,255,0.25);
}
/* Dark mode: darken pastel backgrounds, lighten text for contrast */
[data-theme="dark"] .category-badge {
  box-shadow: none;
}
[data-theme="dark"] {
  --category-cleaning-bg: #004d57;
  --category-cleaning-text: #77ebff;
  --category-packing-bg: #4a1a6b;
  --category-packing-text: #E8D5F5;
  --category-organising-bg: #0a4a2e;
  --category-organising-text: #C7F9E5;
  --category-painting-bg: #6b3410;
  --category-painting-text: #FFE0C2;
  --category-basic-repairs-bg: #5c3a0a;
  --category-basic-repairs-text: #FFF3C4;
  --category-trade-quote-bg: #6b1a1a;
  --category-trade-quote-text: #FFD6D6;
  --category-buy-new-bg: #1a4a2e;
  --category-buy-new-text: #D4EDDA;
  --category-selling-bg: #5c1a52;
  --category-selling-text: #FDE2FF;
  --category-in-progress-bg: #1e2566;
  --category-in-progress-text: #D6DFFF;
  --category-we-have-these-bg: #313131;
  --category-we-have-these-text: #d7d7d7;
}

.card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.trade-quote-badge {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  padding: var(--space-2) var(--space-8);
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--category-trade-quote-bg);
  color: var(--category-trade-quote-text);
  box-shadow: inset 0 1px 0 0 rgba(255,255,255,0.25);
}
.cost-badge {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  padding: var(--space-2) var(--space-8);
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,0.06);
  color: var(--content-secondary);
}
[data-theme="dark"] .cost-badge {
  background: rgba(255,255,255,0.1);
}

.modal-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-12) 0 var(--space-4);
  font-size: var(--text-base);
  color: var(--content-primary);
  cursor: pointer;
}

.modal-toggle-row .toggle-track {
  margin-left: var(--space-12);
}
.modal-toggle-row--inline {
  flex: 0 0 auto;
  align-self: flex-end;
  gap: var(--space-8);
  white-space: nowrap;
  height: 44px;
  padding: 0;
}

.card-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--text);
  margin-bottom: var(--space-6);
  line-height: 1.3;
}

.card-meta {
  margin-bottom: var(--space-8);
}

.card-room {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: var(--weight-medium);
  margin-bottom: var(--space-4);
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-dates {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: var(--weight-medium);
}

.card-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: #fff;
  flex-shrink: 0;
}

.card-avatar, .bar-avatar {
  box-shadow: inset 0 0 0 1.5px rgba(0,0,0,0.15);
}
[data-theme="dark"] .card-avatar,
[data-theme="dark"] .bar-avatar {
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.2);
}

.card-deps {
  margin-top: var(--space-8);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  padding-top: var(--space-8);
  border-top: 1px solid var(--border);
}

/* === Planner / Timeline === */
.planner-container {
  position: relative;
  border-radius: 0;
  background: rgba(255,255,255,0.5);
  margin: calc(-1 * var(--space-20)) calc(-1 * var(--space-24)) calc(-1 * var(--space-12));
  padding: 0;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Full-width sticky toolbar above the two-column split */
.planner-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  padding: var(--space-6) var(--space-12) var(--space-6) 46px;
  background: var(--planner-tint);
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  flex-shrink: 0;
  z-index: 12;
  position: relative;
}
[data-theme="dark"] .planner-toolbar { background: var(--planner-tint-dark); }
.planner-toolbar::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: rgba(0,0,0,0.06);
  mix-blend-mode: multiply;
}
[data-theme="dark"] .planner-toolbar::after,
[data-theme="dark"] .planner-label-col::after,
[data-theme="dark"] .planner-label::before,
[data-theme="dark"] .planner-timeline-header::after,
[data-theme="dark"] .planner-row::after {
  background: rgba(255,255,255,0.06);
  mix-blend-mode: screen;
}
[data-theme="dark"] .planner-label::after {
  background: linear-gradient(to right, transparent, var(--planner-tint-dark));
}

/* Scroll area: both axes */
.planner-scroll {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

.planner-wrapper {
  display: flex;
  min-height: 100%;
}

/* LEFT: sticky to left edge, scrolls vertically with content */
.planner-left {
  flex-shrink: 0;
  width: 220px;
  display: flex;
  flex-direction: column;
  background: var(--planner-tint);
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  border-right: 1px solid var(--border);
  box-shadow: 4px 0 12px -2px rgba(0,0,0,0.06);
  position: sticky;
  left: 0;
  z-index: 10;
}
[data-theme="dark"] .planner-left {
  background: var(--planner-tint-dark);
  box-shadow: 4px 0 12px -2px rgba(0,0,0,0.2);
}
[data-theme="dark"] .planner-label { color: var(--color-neutral-200); }
[data-theme="dark"] .planner-toolbar-label { color: var(--color-neutral-200); }
[data-theme="dark"] .view-size-btn { color: var(--color-neutral-300); }
[data-theme="dark"] .view-size-btn.active { color: var(--color-neutral-100); }
[data-theme="dark"] .month-header { color: var(--color-neutral-200); }
[data-theme="dark"] .planner-group-header { color: var(--color-neutral-100); }

/* "Month" header - sticky to top */
.planner-label-col {
  display: flex;
  align-items: center;
  padding-left: 46px;
  height: 38px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 11;
  background: var(--planner-tint);
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
}
[data-theme="dark"] .planner-label-col { background: var(--planner-tint-dark); }
.planner-label-col::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: rgba(0,0,0,0.06);
  mix-blend-mode: multiply;
}

.planner-group-left { display: flex; flex-direction: column; }

.planner-group-header {
  font-weight: var(--weight-bold);
  font-size: var(--text-base);
  padding: var(--space-10) var(--space-12) var(--space-6) 46px;
  color: var(--text);
}

.planner-label {
  padding: var(--space-4) var(--space-12) var(--space-4) 46px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  min-height: 36px;
  display: flex;
  align-items: center;
  position: relative;
}
.planner-label::before {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: rgba(0,0,0,0.06);
  mix-blend-mode: multiply;
}
.planner-label::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 24px;
  background: linear-gradient(to right, transparent, var(--planner-tint));
  pointer-events: none;
}

/* RIGHT: expands, horizontal overflow handled by .planner-scroll */
.planner-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
  z-index: 0;
}

.planner-wrapper[data-view-size="medium"] .planner-right { min-width: 1100px; }
.planner-wrapper[data-view-size="large"] .planner-right { min-width: 1600px; }

/* Month timeline header - outside scroll, full viewport width */
.planner-timeline-header {
  display: flex;
  overflow: hidden;
  height: 38px;
  flex-shrink: 0;
  z-index: 9;
  position: sticky;
  top: 0;
  background: var(--planner-tint);
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
}
[data-theme="dark"] .planner-timeline-header { background: var(--planner-tint-dark); }
.planner-timeline-header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: rgba(0,0,0,0.06);
  mix-blend-mode: multiply;
}

/* Left stub in timeline header - aligns with .planner-left width */
.planner-timeline-month-col {
  width: 220px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding-left: 46px;
  border-right: 1px solid var(--border);
}
[data-theme="dark"] .planner-timeline-month-col {
  border-right-color: rgba(255,255,255,0.08);
}

/* Scrolling label strip - synced via translateX in JS */
.planner-timeline-labels {
  flex: 1;
  position: relative;
  overflow: hidden;
  will-change: transform;
}
.planner-container[data-view-size="medium"] .planner-timeline-labels { min-width: 1100px; }
.planner-container[data-view-size="large"] .planner-timeline-labels { min-width: 1600px; }

.planner-toolbar-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Filter-grid version of view size (mobile only) */
#view-size-wrap { display: none !important; }
.view-size-filter { display: flex; gap: var(--space-4); }
.view-size-filter .view-size-btn { flex: 1; justify-content: center; }

.planner-view-size { display: flex; gap: var(--space-4); }
.view-size-btn {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  font-family: var(--font);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  padding: var(--space-4) var(--space-10);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.view-size-btn:hover { background: rgba(0,0,0,0.05); }
.view-size-btn.active { background: rgba(0,0,0,0.08); color: var(--text); border-color: var(--border); }
[data-theme="dark"] .view-size-btn:hover { background: var(--hover-overlay); }
[data-theme="dark"] .view-size-btn.active { background: rgba(255,255,255,0.12); }

.month-header {
  position: absolute;
  top: 0;
  height: 100%;
  display: flex;
  align-items: center;
  padding-left: var(--space-8);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text);
  white-space: nowrap;
}

/* === Today Marker === */
.today-marker-header {
  position: absolute;
  top: 0;
  height: 100%;
  display: flex;
  align-items: flex-end;
  z-index: 5;
  transform: translateX(-50%);
}
.today-marker-header span {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--today-text);
  background: var(--today-bg);
  padding: 1px var(--space-6);
  border-radius: var(--radius-sm);
  border: 1px solid var(--today-border);
  margin-bottom: var(--space-2);
}

.planner-body {
  position: relative;
  flex: 1;
}

.today-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--today-line);
  z-index: 4;
  opacity: 0.6;
  pointer-events: none;
}

.planner-group-right { display: flex; flex-direction: column; }

.planner-group-header-spacer {
  padding: var(--space-10) var(--space-12) var(--space-6);
  font-size: var(--text-base);
  visibility: hidden;
  pointer-events: none;
}
.planner-group-header-spacer::before {
  content: '\00A0';
}

.planner-row {
  display: flex;
  align-items: center;
  min-height: 36px;
  position: relative;
}
.planner-row::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: rgba(0,0,0,0.06);
  mix-blend-mode: multiply;
}

.planner-bar-container {
  flex: 1;
  position: relative;
  height: 28px;
}

.planner-bar {
  position: absolute;
  top: 2px;
  height: 24px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  overflow: visible;
  white-space: nowrap;
  cursor: grab;
  transition: opacity 0.15s, box-shadow 0.15s;
}
.planner-bar:hover { opacity: 0.85; }
.planner-bar:active { cursor: grabbing; }
.planner-bar--done { opacity: 0.3; }
.planner-bar--done .bar-label { text-decoration: line-through; }

/* Undated / endless bars - span full timeline width, dashed stroke signals
   "open-ended until you add dates". Clicking opens the edit modal. */
/* Undated bar: dashed stripe, no position set here so both contexts work.
   .planner-bar-container sets position:absolute for the timeline; the
   footer override below resets to relative. No !important needed. */
.planner-bar--undated {
  left: 0;
  width: 100%;
  background: repeating-linear-gradient(
    90deg,
    rgba(0,0,0,0.03) 0px, rgba(0,0,0,0.03) 8px,
    transparent 8px, transparent 16px
  );
  border: 1.5px dashed rgba(0,0,0,0.22);
  border-left: 1.5px dashed rgba(0,0,0,0.22);
  color: var(--text-secondary);
  cursor: pointer;
  opacity: 0.75;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.planner-bar--undated:hover { opacity: 1; }
[data-theme="dark"] .planner-bar--undated {
  background: repeating-linear-gradient(
    90deg,
    rgba(255,255,255,0.04) 0px, rgba(255,255,255,0.04) 8px,
    transparent 8px, transparent 16px
  );
  border-color: rgba(255,255,255,0.20);
}
.planner-bar-undated-tag {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  padding: 1px var(--space-6);
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,0.06);
  color: var(--text-tertiary, var(--content-tertiary));
  flex-shrink: 0;
  margin-left: auto;
  white-space: nowrap;
}
[data-theme="dark"] .planner-bar-undated-tag { background: rgba(255,255,255,0.08); }
.planner-label--undated { opacity: 0.55; }

/* === Undated footer - collapsible sticky panel at planner bottom ===
   Always visible as the collapsed header. User opens it to see/click
   undated tasks. State is toggled in-memory via aria-expanded.
   Sits as flex-shrink:0 at the base of .planner-container (flex-column). */
.planner-undated-footer {
  flex-shrink: 0;
  border-top: 1px solid rgba(0,0,0,0.08);
  background: var(--planner-tint);
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  position: relative;
  z-index: 11;
}
[data-theme="dark"] .planner-undated-footer {
  background: var(--planner-tint-dark);
  border-top-color: rgba(255,255,255,0.06);
}

.planner-undated-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-10);
  width: 100%;
  padding: var(--space-10) var(--space-16) var(--space-10) 46px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  text-align: left;
  transition: background 0.12s;
}
.planner-undated-toggle:hover { background: rgba(0,0,0,0.03); }
[data-theme="dark"] .planner-undated-toggle:hover { background: rgba(255,255,255,0.04); }

.put-count {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--text);
}
.put-hint {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  flex: 1;
}
.put-chevron {
  flex-shrink: 0;
  color: var(--text-secondary);
  transition: transform 0.2s ease;
}
.planner-undated-toggle.is-open .put-chevron { transform: rotate(180deg); }

.planner-undated-list {
  padding: var(--space-8) var(--space-16) var(--space-12) 46px;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  max-height: 220px;
  overflow-y: auto;
}
.planner-undated-list.hidden { display: none; }

.planner-undated-row {
  cursor: pointer;
}
/* Undated rows in footer: same dashed style, but constrained width (not full-timeline) */
.planner-undated-row .planner-bar--undated {
  position: relative;
  left: auto;
  width: 100%;
  display: flex;
  align-items: center;
  border-radius: var(--radius-md);
}
.planner-undated-row:hover .planner-bar--undated { opacity: 1; }

/* Inline empty-state when no scheduled tasks */
.planner-empty-timeline {
  padding: var(--space-24) var(--space-16);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-style: italic;
  min-height: 48px;
}

/* Drag resize handles. Positioned entirely OUTSIDE the bar so they never
   overlap the bar body - the bar body is always "move", the tabs are always
   "resize". Lets narrow bars stay resizable: the user grabs the adjacent tab. */
.planner-bar-handle {
  position: absolute;
  top: 0;
  width: 12px;
  height: 100%;
  cursor: ew-resize;
  z-index: 2;
}
.planner-bar-handle--left { left: -12px; }
.planner-bar-handle--right { right: -12px; }
/* Subtle hover hint so users see where the handle tabs are */
.planner-bar:hover .planner-bar-handle {
  background: linear-gradient(to right, transparent, rgba(0,0,0,0.08));
  border-radius: 2px;
}
.planner-bar:hover .planner-bar-handle--left {
  background: linear-gradient(to left, transparent, rgba(0,0,0,0.08));
}

/* Bar being dragged */
.planner-bar.dragging {
  opacity: 0.7;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  z-index: 10;
  cursor: grabbing;
}

/* Ghost preview during drag */
.planner-bar-ghost {
  position: absolute;
  top: 2px;
  height: 24px;
  border-radius: var(--radius-sm);
  opacity: 0.3;
  pointer-events: none;
  z-index: 5;
}

.bar-label { overflow: hidden; text-overflow: ellipsis; flex: 1; }

.bar-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: #fff;
  flex-shrink: 0;
  margin-left: var(--space-4);
}

/* View size variants */
.planner-wrapper[data-view-size="medium"] .month-header { font-size: var(--text-base); }
.planner-wrapper[data-view-size="medium"] .planner-group-header { font-size: var(--text-md); padding: var(--space-12) var(--space-14) var(--space-8) 46px; }
.planner-wrapper[data-view-size="medium"] .planner-group-header-spacer { font-size: var(--text-md); padding: var(--space-12) var(--space-14) var(--space-8); }
.planner-wrapper[data-view-size="medium"] .planner-row { min-height: 43px; }
.planner-wrapper[data-view-size="medium"] .planner-label { font-size: var(--text-base); min-height: 43px; }
.planner-wrapper[data-view-size="medium"] .planner-bar { height: 29px; font-size: var(--text-base); }
.planner-wrapper[data-view-size="medium"] .planner-bar-ghost { height: 29px; }
.planner-wrapper[data-view-size="medium"] .planner-bar-container { height: 34px; }
.planner-wrapper[data-view-size="medium"] .bar-avatar { width: 22px; height: 22px; font-size: var(--text-xs); }

.planner-wrapper[data-view-size="large"] .month-header { font-size: var(--text-lg); }
.planner-wrapper[data-view-size="large"] .planner-group-header { font-size: var(--text-lg); padding: var(--space-12) 15px var(--space-8) 46px; }
.planner-wrapper[data-view-size="large"] .planner-group-header-spacer { font-size: var(--text-lg); padding: var(--space-12) 15px var(--space-8); }
.planner-wrapper[data-view-size="large"] .planner-row { min-height: 48px; }
.planner-wrapper[data-view-size="large"] .planner-label { font-size: var(--text-lg); min-height: 48px; }
.planner-wrapper[data-view-size="large"] .planner-bar { height: 32px; font-size: var(--text-base); }
.planner-wrapper[data-view-size="large"] .planner-bar-ghost { height: 32px; }
.planner-wrapper[data-view-size="large"] .planner-bar-container { height: 37px; }
.planner-wrapper[data-view-size="large"] .bar-avatar { width: 24px; height: 24px; font-size: var(--text-sm); }

/* === Unscheduled === */
.unscheduled-section {
  margin-top: var(--space-24);
  padding: var(--space-16);
  background: var(--surface);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-glass);
}

.unscheduled-section h3 {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-10);
  color: var(--text-secondary);
}

.unscheduled-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
}

.unscheduled-chip {
  font-size: var(--text-sm);
  background: var(--bg);
  padding: var(--space-4) var(--space-10);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text);
}

.unscheduled-chip small { color: var(--text-secondary); }

/* === Empty State === */
.empty-state {
  text-align: center;
  padding: 60px var(--space-20);
  color: var(--text-secondary);
  font-size: var(--text-md);
}

/* === Modal === */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(215,215,215,0.5);
  backdrop-filter: blur(calc(var(--blur) * 1.2)) saturate(1.4);
  -webkit-backdrop-filter: blur(calc(var(--blur) * 1.2)) saturate(1.4);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
}

/* Compact single-field dialogs (e.g. new project name) */
.modal-dialog--sm {
  max-width: 400px;
  padding: var(--space-28) var(--space-32);
}

.modal-dialog {
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(calc(var(--blur) * 3)) saturate(1.6);
  -webkit-backdrop-filter: blur(calc(var(--blur) * 3)) saturate(1.6);
  border: 1px solid rgba(255,255,255,0.6);
  border-radius: var(--radius-xl);
  padding: var(--space-32) 36px;
  width: 90%;
  max-width: 1040px;
  box-shadow: var(--shadow-glass), 0 20px 60px rgba(0, 0, 0, 0.15);
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.modal-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-8);
  margin-bottom: var(--space-18);
  position: relative;
}

.modal-more-wrap {
  position: relative;
  flex-shrink: 0;
}

.modal-more-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: none;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.modal-more-btn:hover {
  background: var(--accent);
  color: var(--on-accent-primary1);
}

.modal-more-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: rgba(255,255,255,0.85);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 24px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.7);
  padding: var(--space-4);
  min-width: 180px;
  z-index: 20;
}
.modal-more-menu.hidden { display: none; }

.modal-more-item {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  padding: var(--space-12) var(--space-16);
  border: none;
  background: none;
  width: 100%;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font);
  font-size: var(--text-md);
  color: var(--text);
  text-align: left;
  transition: background 0.12s;
}
.modal-more-item:hover {
  background: var(--surface-raised);
}
.modal-more-item.danger { color: var(--text); }
.modal-more-item.danger:hover {
  background: rgba(192,57,43,0.08);
  color: var(--danger-text);
}
[data-theme="dark"] .modal-more-menu {
  background: var(--glass-dialog);
  box-shadow: 0 4px 24px rgba(0,0,0,0.4), inset 0 1px 0 var(--glass-highlight);
}
[data-theme="dark"] .modal-delete-confirm {
  background: var(--glass-dialog);
}

.modal-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--text);
  margin: 0;
}

/* Multi-member picker in modal */
.modal-members-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-6);
  min-height: 44px;
  margin-left: calc(-1 * var(--space-4));
}
.modal-members-list {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.modal-member-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  background: transparent;
  color: inherit;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s, opacity 0.15s, background 0.15s;
  padding: 0;
  box-shadow: inset 0 0 0 1.5px rgba(0,0,0,0.15);
}
.modal-member-avatar:hover {
  border-color: var(--accent);
  opacity: 0.85;
}
[data-theme="dark"] .modal-member-avatar {
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.2);
}
.modal-member-add {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  transition: border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}
.modal-member-add:hover {
  border-color: var(--accent);
  color: var(--accent-text);
}
.modal-member-dropdown {
  position: absolute;
  top: 100%;
  right: -4px;
  left: -4px;
  margin-top: var(--space-8);
  background: var(--surface-header);
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  border: 1px solid var(--outline-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glass), 0 12px 32px rgba(0,0,0,0.12);
  padding: var(--space-8);
  z-index: 100;
  display: flex;
  flex-direction: column;
}
.modal-member-option {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  padding: var(--space-12);
  min-height: 48px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: var(--text-md);
  color: var(--content-primary);
  width: 100%;
  text-align: left;
  transition: background 0.12s;
}
.modal-member-option:hover {
  background: var(--surface-highlight);
}
.modal-member-option-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1.5px var(--outline-muted);
}

/* ─── Invite section ─── */
.modal-member-divider {
  height: 1px;
  background: var(--outline-muted);
  margin: var(--space-8) var(--space-12);
}
.modal-member-invite-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--content-secondary);
  flex-shrink: 0;
}

/* Email form - input with embedded circular send button */
.modal-member-invite-form {
  display: flex;
  align-items: center;
  position: relative;
}
.modal-member-invite-input {
  width: 100%;
  min-width: 0;
  padding: var(--space-10) 52px var(--space-10) var(--space-16);
  height: 44px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--outline-muted);
  background: var(--surface-base);
  font-size: var(--text-md);
  font-family: var(--font);
  color: var(--content-primary);
  outline: none;
  box-shadow: var(--shadow-glass);
}
.modal-member-invite-input::placeholder {
  color: var(--content-secondary);
}
.modal-member-invite-input:focus {
  border-color: var(--accent);
  box-shadow: var(--shadow-glass), 0 0 0 2px rgba(0, 227, 255, 0.2);
}
.modal-member-invite-send {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: var(--on-accent-primary1, #000);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  transition: transform 0.15s, opacity 0.15s;
}
.modal-member-invite-send:hover {
  transform: translateY(-50%) scale(1.06);
}
.modal-member-invite-send:disabled {
  opacity: 0.35;
  cursor: default;
  transform: translateY(-50%);
}
.modal-member-invite-msg {
  padding: var(--space-8) var(--space-16);
  font-size: var(--text-base);
  border-radius: var(--radius-md);
  margin: var(--space-4) var(--space-8);
}
.modal-member-invite-msg--ok {
  background: var(--success-bg);
  color: var(--success-text);
}
.modal-member-invite-msg--err {
  background: var(--danger-bg);
  color: var(--danger-text);
}


.modal-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
}

/* ─── Two-panel layout (desktop) ─── */
.modal-layout {
  display: flex;
  gap: var(--space-32);
}
.modal-layout-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
}
.modal-layout-side {
  flex: 0 0 340px;
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
}
/* Side panel: match Room select height so rows align cross-column */
.modal-members-wrap {
  min-height: 44px;
  display: flex;
  align-items: center;
}
.modal-members-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-8);
}
.modal-member-avatar--inactive {
  background: transparent !important;
  color: var(--text-secondary) !important;
  border: 2px dashed var(--border);
  opacity: 0.45;
}
.modal-member-avatar--inactive:hover {
  opacity: 0.8;
  border-color: var(--accent);
  border-style: solid;
}
.modal-members-divider {
  width: 1px;
  align-self: stretch;
  background: var(--outline-muted);
  margin: var(--space-2) var(--space-2);
}

@media (max-width: 768px) {
  .modal-layout {
    flex-direction: column;
    gap: var(--space-16);
  }
  .modal-layout-side {
    flex: none;
    border-top: 1px solid var(--outline-muted);
    padding-top: var(--space-16);
  }
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.modal-field > input,
.modal-field > select,
.modal-field > .room-field-wrap,
.modal-field > .category-field-wrap,
.modal-field > .date-picker-wrap {
  margin-left: calc(-1 * var(--space-4));
}

.modal-field span,
.modal-field label {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--content-secondary);
}

.modal-field input {
  font-family: var(--font);
  font-size: var(--text-base);
  min-height: 44px;
  padding: var(--space-10) var(--space-14);
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  background: var(--input-bg);
  color: var(--text);
  box-shadow: var(--input-shadow);
  transition: all 0.2s ease;
}

.modal-field input:hover,
.modal-field textarea:hover {
  background: var(--input-bg-hover);
}

.modal-field textarea {
  font-family: var(--font);
  font-size: var(--text-base);
  padding: var(--space-10) var(--space-14);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  background: var(--input-bg);
  color: var(--text);
  box-shadow: var(--input-shadow);
  transition: all 0.2s ease;
  resize: vertical;
  min-height: 70px;
  width: 100%;
  box-sizing: border-box;
  margin-left: calc(-1 * var(--space-4));
}

.modal-field select {
  font-family: var(--font);
  font-size: var(--text-base);
  min-height: 44px;
  padding: var(--space-10) var(--space-40) var(--space-10) var(--space-14);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  background: var(--input-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7'%3E%3Cpath d='M0 0l6 7 6-7z' fill='%236B7280'/%3E%3C/svg%3E") no-repeat right 14px center;
  appearance: none;
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--input-shadow);
  transition: all 0.2s ease;
}

.modal-field select:hover {
  background-color: var(--input-bg-hover);
}

.modal-field input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: var(--bg);
}

.modal-field input:focus,
.modal-field select:focus,
.modal-field textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.modal-row {
  display: flex;
  gap: var(--space-12);
}

.modal-row .modal-field {
  flex: 1;
}

/* Extra details collapsible - Trade, Cost, Contact, Notes */
.modal-extra-toggle {
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--space-6);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--content-secondary);
  cursor: pointer;
  padding: var(--space-4) 0;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.modal-extra-toggle::-webkit-details-marker { display: none; }
.modal-extra-chevron {
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.modal-extra-details[open] .modal-extra-chevron {
  transform: rotate(180deg);
}
.modal-extra-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
  padding-top: var(--space-12);
}
[data-theme="dark"] .modal-extra-toggle { color: var(--content-secondary); }

/* Task name in header - standard field styling, flex to fill */
.modal-field--task-header {
  flex: 1;
  min-width: 0;
}

/* Assigned row - members + invite button inline */
.modal-assigned-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
}
.modal-assigned-row .modal-members-wrap { flex: 1; }

/* Invite trigger - labelled button, right-aligned in assigned row */
.modal-invite-trigger {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  height: 44px;
  padding: 0 var(--space-14);
  border: 1px solid var(--outline-default);
  border-radius: var(--radius-full);
  background: var(--surface-base);
  color: var(--accent-text);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  font-family: inherit;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.modal-invite-trigger:hover { background: var(--surface-raised); }
.modal-invite-trigger.hidden { display: none; }

/* Invite overlay - focused email input */
.modal-invite-overlay {
  position: absolute;
  inset: 0;
  background: var(--glass-dialog, rgba(255,255,255,0.95));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-24);
  border-radius: inherit;
}
.modal-invite-overlay.hidden { display: none; }
.modal-invite-overlay-content {
  width: 100%;
  max-width: 400px;
}
.modal-invite-overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-16);
  font-weight: var(--weight-semibold);
  font-size: var(--text-md);
  color: var(--content-primary);
}
.modal-invite-overlay-close {
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  font-size: var(--text-xl);
  color: var(--content-primary);
  cursor: pointer;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-invite-overlay-close:hover { background: var(--surface-highlight); }

/* Toggle field - label above, toggle below (matches column rhythm) */
.modal-field--toggle {
  flex: 0 0 auto;
  cursor: pointer;
}
.modal-toggle-wrap {
  display: flex;
  align-items: center;
  height: 44px;
}

/* Single tappable date range field */
.modal-date-range-btn {
  display: block;
  width: 100%;
  padding: var(--space-10) var(--space-12);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.93);
  color: var(--content-primary);
  font-size: var(--text-base);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.06);
  transition: border-color 0.15s;
  margin-left: calc(-1 * var(--space-4));
}
.modal-date-range-btn:hover {
  border-color: var(--accent-text);
}
.modal-date-range-btn.empty {
  color: var(--content-tertiary);
}
[data-theme="dark"] .modal-date-range-btn {
  background: rgba(22,24,34,0.93);
  border-color: rgba(255,255,255,0.15);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.25);
}
.modal-field--dates {
  flex: 2 1 0;
}
.modal-field--deps {
  flex: 1 1 0;
  min-width: 100px;
}

.modal-dialog-desc {
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin: var(--space-4) 0 var(--space-16);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--space-10);
  margin-top: var(--space-6);
}
.modal-actions-left {
  display: flex;
  gap: var(--space-6);
}
.modal-actions-right {
  display: flex;
  gap: var(--space-10);
}

.modal-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: none;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.modal-icon-btn:hover {
  background: var(--accent);
  color: var(--on-accent-primary1);
}

.modal-delete-confirm {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.85);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-32) var(--space-24);
  gap: var(--space-12);
  z-index: 10;
}
.modal-delete-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  margin: 0;
  color: var(--text);
}
.modal-delete-body {
  font-size: var(--text-base);
  color: var(--text-secondary);
  text-align: center;
  margin: 0;
}
.modal-delete-actions {
  display: flex;
  gap: var(--space-10);
  margin-top: var(--space-8);
}
.modal-delete-confirm-btn {
  background: var(--danger-solid);
  color: var(--content-inverse);
  border-color: var(--danger-hover);
  min-width: 96px;
  min-height: 44px;
  padding: var(--space-10) 22px;
  border-radius: var(--radius-lg);
  font-family: var(--font);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  border: 1px solid;
  transition: background 0.15s;
}
.modal-delete-confirm-btn:hover { background: var(--danger-hover); }

.modal-btn {
  font-family: var(--font);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  min-width: 96px;
  min-height: 44px;
  padding: var(--space-10) 22px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  touch-action: manipulation;
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.modal-cancel {
  background: var(--surface);
  color: var(--text);
  border-color: rgba(0,0,0,0.35);
  box-shadow: var(--shadow-glass);
}
[data-theme="dark"] .modal-cancel {
  border-color: rgba(255,255,255,0.4);
}

.modal-cancel:hover {
  background: var(--surface-raised);
}

.modal-save {
  background: var(--accent);
  color: var(--on-accent-primary1);
  border-color: color-mix(in srgb, var(--shadow-accent) 10%, transparent);
  box-shadow: inset 0 1px 0 0 rgba(255,255,255,0.2), 0 2px 8px color-mix(in srgb, var(--shadow-accent) 20%, transparent);
}

.modal-save:hover {
  box-shadow: inset 0 1px 0 0 rgba(255,255,255,0.25), 0 4px 16px color-mix(in srgb, var(--shadow-accent-hover) 22%, transparent);
}

/* === Restore Backup Modal === */
.restore-dialog {
  max-width: 540px;
  width: 100%;
}
.restore-body {
  overflow-y: auto;
  max-height: 60vh;
  padding: var(--space-4) 0 var(--space-8);
}
.restore-section {
  margin-bottom: var(--space-16);
}
.restore-section:last-child { margin-bottom: 0; }
.restore-section-title {
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin: 0 0 var(--space-4);
}
.restore-section-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0 0 var(--space-10);
}
.restore-project-card {
  display: block;
  background: rgba(255,255,255,0.5);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: var(--radius-lg);
  padding: var(--space-14) var(--space-16);
  margin-bottom: var(--space-10);
  transition: background 0.15s, border-color 0.15s;
}
.restore-conflict-card {
  border-color: rgba(200,120,0,0.25);
}
[data-theme="dark"] .restore-project-card {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.1);
}
[data-theme="dark"] .restore-conflict-card {
  border-color: rgba(255,180,60,0.25);
}
.restore-project-card .restore-project-name {
  margin-bottom: var(--space-4);
}
.restore-project-name {
  font-weight: var(--weight-semibold);
  font-size: var(--text-base);
  color: var(--text);
}
.restore-card-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-12);
  margin-top: var(--space-10);
  padding-left: 0;
}
.restore-col-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
}
.restore-col-backup .restore-col-label {
  color: var(--accent-text, var(--accent));
}
.restore-stat {
  display: block;
  font-size: var(--text-base);
  color: var(--text);
  line-height: 1.4;
}
.restore-stat-date {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}
.restore-project-row {
  display: flex;
  align-items: center;
  gap: var(--space-10);
  padding: var(--space-10) var(--space-16);
  border-radius: var(--radius-md);
}
.restore-project-row .restore-stat {
  margin-left: auto;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* === Dependency Search Dropdown === */
.dep-search-wrap {
  position: relative;
}
.dep-search-wrap::after {
  content: '';
  position: absolute;
  top: 22px;
  right: 14px;
  width: 12px;
  height: 7px;
  transform: translateY(-50%);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7'%3E%3Cpath d='M0 0l6 7 6-7z' fill='%236B7280'/%3E%3C/svg%3E") no-repeat center;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.2s ease;
}
.dep-search-wrap:has(.dep-search-input:focus)::after {
  opacity: 0;
}

.modal-field .dep-search-input {
  width: 100%;
  font-family: var(--font);
  font-size: var(--text-base);
  padding: var(--space-10) var(--space-40) var(--space-10) var(--space-14);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  background-color: var(--input-bg);
  color: var(--text);
  box-shadow: var(--input-shadow);
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.modal-field .dep-search-input:hover {
  background-color: var(--input-bg-hover);
}

.modal-field .dep-search-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}
[data-theme="dark"] .modal-field .dep-search-input {
  background-color: var(--input-bg);
  border-color: var(--input-border);
  box-shadow: var(--input-shadow);
}
[data-theme="dark"] .modal-field .dep-search-input:hover {
  background-color: var(--input-bg-hover);
}

.dep-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: rgba(238,238,238,0.85);
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-top: var(--space-4);
  max-height: 180px;
  overflow-y: auto;
  z-index: 10;
  box-shadow: var(--shadow-glass), var(--shadow-hover);
}
[data-theme="dark"] .dep-dropdown {
  background: color-mix(in srgb, var(--dark-surface) 85%, transparent);
}

.dep-option {
  padding: var(--space-8) var(--space-12);
  font-size: var(--text-base);
  cursor: pointer;
  color: var(--text);
}

.dep-option:hover {
  background: var(--bg);
}

.dep-selected {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  margin-top: var(--space-6);
}
.dep-selected:empty {
  display: none;
  margin: 0;
}

.dep-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-8);
  font-size: var(--text-sm);
  color: var(--text);
}

.dep-chip-remove {
  background: none;
  border: none;
  cursor: pointer;
  font-size: var(--text-md);
  line-height: 1;
  color: var(--text-secondary);
  padding: 0 var(--space-2);
}

.dep-chip-remove:hover {
  color: var(--danger-text);
}

/* === FAB === */
.header-add-btn {
  display: none;
  align-items: center;
  gap: 0;
  background: transparent;
  color: var(--text);
  border: none;
  border-radius: var(--radius-md);
  padding: var(--space-8) var(--space-10);
  cursor: pointer;
  touch-action: manipulation;
  flex-shrink: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: padding 0.2s ease, gap 0.2s ease, background 0.15s, color 0.15s, box-shadow 0.15s;
}
.header-add-btn:hover {
  gap: var(--space-6);
  padding: var(--space-8) var(--space-14);
  background: var(--accent);
  color: var(--on-accent-primary1);
  border: 1px solid color-mix(in srgb, var(--shadow-accent) 10%, transparent);
  box-shadow: inset 0 1px 0 0 rgba(255,255,255,0.2), 0 2px 8px color-mix(in srgb, var(--shadow-accent) 40%, transparent);
}
.header-add-btn:active { transform: scale(0.96); }
.header-add-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  letter-spacing: 0.07em;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-width 0.2s ease, opacity 0.15s ease;
}
.header-add-btn:hover .header-add-label {
  max-width: 80px;
  opacity: 1;
}

.fab-add {
  position: fixed;
  bottom: 28px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--content-primary);
  color: var(--content-inverse);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.12);
  transition: transform 0.15s, box-shadow 0.15s;
  z-index: 100;
}
.fab-add:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.16);
}
.fab-add:active { transform: scale(0.96); }
/* FAB visible on all screen sizes */
/* Hide FAB when settings is open */
main.settings-open ~ .fab-add,
body:has(#settings-view:not(.hidden)) .fab-add { display: none; }

/* === Toast === */
#toast-root {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  pointer-events: none;
}

.toast {
  padding: var(--space-12) var(--space-20);
  border-radius: var(--radius-lg);
  font-family: var(--font);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  pointer-events: auto;
  animation: toast-in 0.3s ease;
  max-width: 320px;
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  border: 1px solid rgba(255,255,255,0.15);
}

.toast.success {
  background: color-mix(in srgb, var(--success-solid) 85%, transparent);
  color: var(--content-inverse);
  box-shadow: inset 0 1px 0 0 rgba(255,255,255,0.15), 0 4px 16px rgba(39,103,73,0.3);
}

.toast.error {
  background: color-mix(in srgb, var(--danger-solid) 85%, transparent);
  color: var(--content-inverse);
  box-shadow: inset 0 1px 0 0 rgba(255,255,255,0.15), 0 4px 16px rgba(197,48,48,0.3);
}
.toast.warning {
  background: color-mix(in srgb, var(--warning-solid) 90%, transparent);
  color: var(--content-inverse);
  box-shadow: inset 0 1px 0 0 rgba(255,255,255,0.15), 0 4px 16px rgba(146,100,12,0.3);
}

.toast.toast-with-action {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  max-width: 420px;
  padding-right: var(--space-8);
}
.toast .toast-msg {
  flex: 1;
  min-width: 0;
}
.toast .toast-action-btn {
  flex-shrink: 0;
  background: rgba(255,255,255,0.18);
  color: inherit;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--radius-md);
  padding: var(--space-6) var(--space-12);
  font-family: var(--font);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  min-height: 32px;
}
.toast .toast-action-btn:hover {
  background: rgba(255,255,255,0.28);
}

.trash-item-reason {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  background: var(--hover-overlay);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: var(--space-6) var(--space-10);
  margin-top: var(--space-6);
  white-space: pre-wrap;
  word-break: break-word;
}
.trash-item-reason strong {
  color: var(--text);
  font-weight: var(--weight-semibold);
}

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

/* === Room Management === */
.room-field-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.category-field-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.room-field-wrap select,
.room-field-wrap input,
.category-field-wrap select,
.category-field-wrap input {
  flex: 1;
  min-width: 0;
}

.room-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: auto;
  border: none;
  border-radius: 0;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s ease;
  padding: 0;
}
.room-action-btn svg {
  flex-shrink: 0;
}

.room-action-btn:hover {
  color: var(--accent-text);
}

.room-action-btn.danger:hover {
  color: var(--danger-text);
  border-color: var(--danger-border);
}

.room-inline-input {
  display: flex;
  gap: var(--space-6);
  align-items: center;
}

.room-inline-input input {
  flex: 1;
  font-family: var(--font);
  font-size: var(--text-base);
  padding: var(--space-10) var(--space-14);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.65);
  color: var(--text);
  box-shadow: var(--input-shadow);
}

[data-theme="dark"] .room-inline-input input {
  background: color-mix(in srgb, var(--dark-surface) 93%, transparent);
  border-color: var(--input-border);
  box-shadow: var(--input-shadow);
}

.room-confirm-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: var(--on-accent-primary1);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}

.room-cancel-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}

/* === To-do List === */
.todolist-container {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  border-radius: 0;
  margin: calc(-1 * var(--space-20)) calc(-1 * var(--space-24)) calc(-1 * var(--space-12));
  padding: 0 10% var(--space-12);
  gap: var(--space-6);
  position: relative;
}
.todolist-container::after {
  content: '';
  position: sticky;
  bottom: -12px;
  display: block;
  height: 40px;
  margin: 0 calc(-1 * var(--space-24));
  background: linear-gradient(to top, rgba(0,0,0,0.0375), transparent);
  mix-blend-mode: multiply;
  pointer-events: none;
  flex-shrink: 0;
}

.todo-month-header {
  position: sticky;
  top: 0;
  z-index: 2;
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-primary1-900);
  padding: var(--space-10) var(--space-48);
  margin: 0 calc(-10% / 0.8) var(--space-4);
  background: linear-gradient(135deg, rgba(206,247,255,0.55) 0%, rgba(119,235,255,0.35) 100%);
  backdrop-filter: blur(calc(var(--blur) * 0.8)) saturate(1.4);
  -webkit-backdrop-filter: blur(calc(var(--blur) * 0.8)) saturate(1.4);
  border-top: 1px solid rgba(255,255,255,0.5);
  border-bottom: 1px solid rgba(0,168,188,0.12);
  box-shadow: inset 0 1px 0 0 rgba(255,255,255,0.45), 0 1px 3px rgba(0,0,0,0.04);
}
[data-theme="dark"] .todo-month-header {
  color: var(--color-primary1-200);
  background: linear-gradient(135deg, rgba(0,77,87,0.45) 0%, rgba(0,37,44,0.55) 100%);
  border-top-color: rgba(119,235,255,0.12);
  border-bottom-color: rgba(0,0,0,0.2);
  box-shadow: inset 0 1px 0 0 rgba(119,235,255,0.08), 0 1px 3px rgba(0,0,0,0.15);
}
.todo-month-header:first-child {
  margin-top: 0;
}

.todo-item {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  gap: var(--space-4) var(--space-12);
  padding: var(--space-12) var(--space-14);
  background: var(--surface-raised);
  backdrop-filter: blur(calc(var(--blur) / 2)) saturate(1.2);
  -webkit-backdrop-filter: blur(calc(var(--blur) / 2)) saturate(1.2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-glass), var(--shadow-card);
  cursor: pointer;
  transition: all 0.2s ease;
}

.todo-item:hover {
  box-shadow: var(--shadow-glass), var(--shadow-hover);
  background: color-mix(in srgb, var(--color-primary1-100) 12%, white);
}

.todo-item.todo-done .todo-col-meta,
.todo-item.todo-done .todo-col-main {
  opacity: 0.5;
}

.todo-item.todo-done .todo-task-name {
  text-decoration: line-through;
}

.todo-checkbox {
  grid-row: 1 / -1;
  align-self: center;
  width: 22px;
  height: 22px;
  padding: var(--space-4);
  border-radius: 50%;
  border: 2px solid var(--text-secondary);
  box-sizing: content-box;
  cursor: pointer;
  margin: var(--space-6);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}

.todo-checkbox.checked {
  background: var(--success-text);
  border-color: var(--success-text);
}

.todo-checkbox.checked::after {
  content: '';
  display: block;
  width: 8px;
  height: 14px;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) translateY(-1px);
}

.todo-col-meta {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
  flex-shrink: 0;
}

.todo-col-main {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

.todo-task-name {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  color: var(--text);
}

.todo-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
}

.todo-room {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: var(--weight-medium);
}

.todo-dates {
  font-size: var(--text-md);
  color: var(--text-secondary);
  font-weight: var(--weight-medium);
}

[data-theme="dark"] .todo-item { background: color-mix(in srgb, var(--dark-surface) 92%, transparent); }
[data-theme="dark"] .todo-item:hover { background: color-mix(in srgb, var(--dark-card) 95%, transparent); }

/* === Date Picker === */
.date-picker-wrap {
  position: relative;
}
.date-display {
  width: 100%;
  font-family: var(--font);
  font-size: var(--text-base);
  min-height: 44px;
  padding: var(--space-10) var(--space-40) var(--space-10) var(--space-14);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  background: var(--input-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%236B7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='1' y='2' width='12' height='11' rx='1.5'/%3E%3Cpath d='M1 5.5h12M4.5 1v2M9.5 1v2'/%3E%3C/svg%3E") no-repeat right 14px center;
  box-shadow: var(--input-shadow);
  text-align: left;
  cursor: pointer;
  color: var(--text);
  transition: all 0.2s ease;
}
.date-display:hover {
  background-color: var(--input-bg-hover);
}
.date-display.empty {
  color: var(--text-secondary);
}
.date-native {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
[data-theme="dark"] .date-display {
  background-color: var(--input-bg);
  border-color: var(--input-border);
  box-shadow: var(--input-shadow);
}
[data-theme="dark"] .date-display:hover {
  background-color: var(--input-bg-hover);
}

/* === Responsive === */
@media (max-width: 768px), (orientation: landscape) and (max-height: 500px) {
  /* Mobile type - 1.2x base font scales all rem tokens proportionally */
  html { font-size: 16.8px; }

  .sidebar-rail { display: none; }

  /* Primary nav - logo bar, hides on scroll */
  .primary-nav {
    display: flex;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    padding: 0 var(--space-16);
    z-index: 1000;
    background: var(--header-bg);
    backdrop-filter: blur(var(--blur)) saturate(1.4);
    -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
    border-bottom: none;
    box-shadow: 0 1px 0 0 rgba(0,0,0,0.06);
    transition: transform 0.3s ease;
  }
  .primary-nav.header-hidden {
    transform: translateY(-100%);
  }
  .mobile-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--accent);
    color: var(--on-accent-primary1);
    font-family: var(--font);
    font-size: var(--text-lg);
    font-weight: var(--weight-bold);
    line-height: 1;
    flex-shrink: 0;
  }

  /* Secondary nav - view toggle + filters, always visible */
  .app-header {
    padding: var(--space-12) var(--space-16);
    min-height: auto;
    margin-left: 0;
    position: fixed;
    top: 80px;
    left: 0;
    right: 0;
    z-index: 100;
    transition: top 0.3s ease;
    border-bottom: none;
    box-shadow: 0 1px 0 0 rgba(0,0,0,0.1), 0 4px 16px rgba(0,0,0,0.06);
  }
  [data-theme="dark"] .app-header {
    box-shadow: 0 1px 0 0 rgba(255,255,255,0.08), 0 4px 16px rgba(0,0,0,0.25);
  }
  .app-header.secondary-raised {
    top: 0;
  }
  main { margin-left: 0; }
  .toolbar { gap: 0; }
  .toolbar-right { gap: 0; }
  .toolbar-search { display: none; }
  .desktop-filter-btn { display: none; }
  .desktop-filter-wrap { display: none; }
  .header-add-btn { display: none; }

  /* Mobile toolbar right = only mobile icon buttons */
  .mobile-toolbar-icons {
    display: flex;
    align-items: center;
    flex-shrink: 0;
  }
  .mobile-search-btn,
  .mobile-filter-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  /* Icon-only on mobile - stays put next to the To-do tab without
     competing with it for the row's flex space. */
  .hide-done-btn {
    flex-shrink: 0;
    margin-left: 0;
    padding: var(--space-8);
    border-left: none;
  }
  .hide-done-btn .hide-done-label { display: none; }

  /* Full-screen search overlay */
  .mobile-search-overlay {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(calc(var(--blur) * 1.4)) saturate(1.8);
    -webkit-backdrop-filter: blur(calc(var(--blur) * 1.4)) saturate(1.8);
    padding-top: calc(env(safe-area-inset-top, 0px) + var(--space-16));
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
  }
  [data-theme="dark"] .mobile-search-overlay {
    background: var(--glass-overlay);
  }
  .mobile-search-overlay.open {
    opacity: 1;
    pointer-events: all;
  }
  .mobile-search-header {
    display: flex;
    align-items: center;
    gap: var(--space-12);
    padding: 0 var(--space-16) var(--space-14);
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-outer);
  }
  .mobile-search-input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--space-10);
    background: var(--surface-raised);
    border: 1.5px solid var(--border-outer);
    border-radius: var(--radius-lg);
    padding: var(--space-12) var(--space-16);
  }
  .mobile-search-input-wrap svg { color: var(--text-secondary); flex-shrink: 0; }
  .mobile-search-input-wrap:focus-within {
    border-color: var(--accent);
  }
  #mobile-search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: var(--font);
    font-size: var(--text-md);
    color: var(--text);
    outline: none;
    min-width: 0;
  }
  #mobile-search-input::placeholder { color: var(--text-secondary); }
  #mobile-search-input::-webkit-search-cancel-button { display: none; }
  .mobile-search-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: var(--text-secondary);
    color: var(--surface-base);
    cursor: pointer;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  [data-theme="dark"] .mobile-search-clear { color: var(--dark-surface); }
  .mobile-search-clear.hidden { display: none; }
  .mobile-search-close {
    font-family: var(--font);
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    color: var(--accent-text);
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-8) var(--space-4);
    white-space: nowrap;
    flex-shrink: 0;
  }
  .mobile-search-count {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    padding: var(--space-10) var(--space-20) var(--space-4);
  }
  .mobile-search-results {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-8) 0 env(safe-area-inset-bottom, var(--space-16));
  }
  .mobile-search-btn.active,
  .mobile-filter-btn.active { color: var(--accent-text); }
  .mobile-search-result-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    padding: var(--space-14) var(--space-20);
    background: none;
    border: none;
    border-bottom: 1px solid var(--border-outer);
    cursor: pointer;
    text-align: left;
    gap: var(--space-2);
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-search-result-row:active { background: var(--surface-raised); }
  .msr-title {
    font-family: var(--font);
    font-size: var(--text-base);
    font-weight: var(--weight-medium);
    color: var(--text);
    line-height: 1.3;
  }
  .msr-meta {
    font-family: var(--font);
    font-size: var(--text-sm);
    color: var(--text-secondary);
  }
  .mobile-search-empty {
    padding: var(--space-32) var(--space-20);
    font-family: var(--font);
    font-size: var(--text-base);
    color: var(--text-secondary);
    text-align: center;
  }

  /* Mobile filter button - badge positioning only (size inherited from shared rule) */
  .mobile-filter-btn { position: relative; }
  .mobile-filter-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 16px;
    height: 16px;
    border-radius: var(--radius-md);
    background: var(--accent);
    color: var(--on-accent-primary1);
    font-family: var(--font);
    font-size: var(--text-xs);
    font-weight: var(--weight-bold);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 var(--space-2);
    pointer-events: none;
  }
  .mobile-filter-badge.hidden { display: none; }

  /* Mobile filter overlay */
  .mobile-filter-overlay {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(calc(var(--blur) * 1.4)) saturate(1.8);
    -webkit-backdrop-filter: blur(calc(var(--blur) * 1.4)) saturate(1.8);
    padding-top: calc(env(safe-area-inset-top, 0px) + var(--space-16));
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
  }
  [data-theme="dark"] .mobile-filter-overlay {
    background: var(--glass-overlay);
  }
  .mobile-filter-overlay.open {
    opacity: 1;
    pointer-events: all;
  }
  .mobile-filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-20) var(--space-16);
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-outer);
  }
  .mobile-filter-title {
    font-family: var(--font);
    font-size: var(--text-lg);
    font-weight: var(--weight-bold);
    color: var(--text);
  }
  .mobile-filter-done {
    font-family: var(--font);
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    color: var(--on-accent-primary1);
    background: var(--accent);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    padding: var(--space-8) var(--space-18);
  }
  .mobile-filter-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-12) var(--space-20);
    display: flex;
    flex-direction: column;
    gap: var(--space-12);
  }
  .mobile-filter-row {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
  }
  .mobile-filter-label {
    font-family: var(--font);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
  }
  .mobile-filter-select {
    font-family: var(--font);
    font-size: var(--text-md);
    color: var(--text);
    background: var(--surface);
    border: 1.5px solid var(--border-outer);
    border-radius: var(--radius-lg);
    padding: var(--space-12) var(--space-16);
    width: 100%;
    cursor: pointer;
    appearance: auto;
    -webkit-appearance: auto;
  }
  .mobile-filter-select:focus {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
    border-color: var(--accent);
  }
  [data-theme="dark"] .mobile-filter-select {
    background: var(--surface-raised);
  }
  .mobile-filter-footer {
    padding: var(--space-12) var(--space-20) calc(env(safe-area-inset-bottom, 0px) + var(--space-16));
    flex-shrink: 0;
  }
  .mobile-filter-clear {
    font-family: var(--font);
    font-size: var(--text-base);
    font-weight: var(--weight-medium);
    color: var(--text);
    background: var(--surface);
    border: 1.5px solid rgba(0,0,0,0.35);
    border-radius: var(--radius-lg);
    padding: var(--space-12) var(--space-20);
    width: 100%;
    cursor: pointer;
    box-shadow: var(--shadow-glass);
  }
  [data-theme="dark"] .mobile-filter-clear { border-color: rgba(255,255,255,0.4); }
  .mobile-filter-clear:active { background: var(--surface-raised); }


  /* padding-top = primary-nav(80) + app-header(~64) + gap(24). JS refines this
     after measuring real heights; this value ensures correct first paint before
     DOMContentLoaded fires and before Google Fonts resolves. */
  main { padding: 168px var(--space-24) var(--space-12) var(--space-16); }
  html, body { max-width: 100vw; }
  body { height: auto !important; overflow-y: auto !important; overflow-x: hidden !important; }
  main { flex: none; overflow: visible; max-width: 100vw; }
  .kanban-board { flex-direction: column; overflow: visible; }
  .kanban-card { overflow: hidden; }
  .kanban-column {
    min-width: 0; width: 100%; max-width: 100%; flex: none; max-height: none; overflow: visible;
    border: none; border-radius: 0; box-shadow: none;
    background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .kanban-column::after { display: none; }
  .kanban-column-header { position: static; box-shadow: none; }
  .planner-container { margin: calc(-1 * var(--space-12)) calc(-1 * var(--space-24)) calc(-1 * var(--space-12)) calc(-1 * var(--space-16)); }
  .planner-container::after { display: none; }
  .todolist-container { margin: -12px -24px -12px -16px; padding: var(--space-12) var(--space-16) var(--space-12); }
  .todolist-container::after { display: none; }
  .planner-label-col, .planner-label { width: 200px; }
  .planner-toolbar { display: none; }
  .modal-overlay.open {
    align-items: stretch;
  }
  .modal-dialog {
    width: 100%;
    max-width: 100%;
    max-height: 100%;
    height: 100%;
    border-radius: 0;
    border: none;
    background: rgba(255,255,255,0.425);
    padding: env(safe-area-inset-top, var(--space-20)) var(--space-20) 0 var(--space-24);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
  }
  .modal-form {
    flex: 1;
    min-height: 0;
  }
  /* Actions always visible at bottom - content scrolls above them */
  .modal-actions {
    position: sticky;
    bottom: 0;
    background: var(--surface-base);
    border-top: 1px solid var(--border);
    padding: var(--space-12) 0 env(safe-area-inset-bottom, var(--space-16));
    margin-top: var(--space-8);
  }
  [data-theme="dark"] .modal-actions { background: var(--dark-surface); }
  .restore-body {
    max-height: none;
    flex: 1;
    overflow-y: auto;
  }

  /* Hamburger button - icon only, top right of primary-nav */
  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    gap: var(--space-4);
    background: none;
    border: none;
    padding: var(--space-12) var(--space-8) var(--space-8);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .hamburger-label { display: none; }
  .hamburger-icon {
    width: 34px;
    height: 24px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
  .hamburger-icon span {
    display: block;
    height: 2.5px;
    width: 100%;
    border-radius: var(--radius-sm);
    background: var(--icon-primary);
    transition: transform 0.25s ease, opacity 0.2s ease;
    transform-origin: center;
  }
  /* Hamburger → X morph */
  .mobile-menu-btn.open .hamburger-icon span:nth-child(1) {
    transform: translateY(10.5px) rotate(45deg);
  }
  .mobile-menu-btn.open .hamburger-icon span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
  }
  .mobile-menu-btn.open .hamburger-icon span:nth-child(3) {
    transform: translateY(-10.5px) rotate(-45deg);
  }

  /* Fullscreen menu overlay */
  .mobile-menu-overlay {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 999;
    background: var(--glass-overlay);
    backdrop-filter: blur(calc(var(--blur) * 1.4)) saturate(1.8);
    -webkit-backdrop-filter: blur(calc(var(--blur) * 1.4)) saturate(1.8);
    align-items: flex-start;
    justify-content: center;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
  }
  .mobile-menu-overlay.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
  .mobile-menu-nav {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 15vh var(--space-16) var(--space-24);
    align-items: stretch;
    gap: var(--space-8);
    align-self: flex-start;
    transform: scale(0.92);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
  }
  .mobile-menu-overlay.open .mobile-menu-nav {
    transform: scale(1);
    opacity: 1;
  }
  .mobile-menu-item {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    gap: var(--space-16);
    background: rgba(255,255,255,0.72);
    backdrop-filter: blur(var(--blur)) saturate(1.4);
    -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
    border: 1px solid rgba(255,255,255,0.9);
    border-radius: var(--radius);
    padding: var(--space-20) var(--space-24);
    min-width: unset;
    font-family: var(--font);
    font-size: var(--text-xl);
    font-weight: var(--weight-semibold);
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06), 0 1px 0 rgba(255,255,255,0.8) inset;
  }
  .mobile-menu-item:active {
    background: rgba(255,255,255,0.9);
  }
  [data-theme="dark"] .mobile-menu-item {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.12);
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
  }
  .mobile-logout-item { color: var(--danger-text); }
  .mobile-logout-item svg { stroke: var(--danger-text); }
  .mobile-menu-projects {
    background: rgba(255,255,255,0.72);
    backdrop-filter: blur(var(--blur)) saturate(1.4);
    -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
    border: 1px solid rgba(255,255,255,0.9);
    border-radius: var(--radius);
    padding: var(--space-20) var(--space-24);
    box-shadow: 0 2px 12px rgba(0,0,0,0.06), 0 1px 0 rgba(255,255,255,0.8) inset;
    overflow: hidden;
  }
  [data-theme="dark"] .mobile-menu-projects {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.12);
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
  }
  .mobile-menu-projects-header {
    display: flex;
    align-items: center;
    gap: var(--space-12);
    font-size: var(--text-md);
    font-weight: var(--weight-semibold);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: var(--space-12);
  }
  .mobile-menu-projects-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
  }
  .mobile-menu-project-item {
    padding: var(--space-14) 0;
    font-family: var(--font);
    font-size: var(--text-xl);
    font-weight: var(--weight-semibold);
    color: var(--text);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: color 0.15s ease;
    display: flex;
    align-items: center;
    gap: var(--space-12);
  }
  .mobile-menu-project-item:active { color: var(--accent-text); }
  .mobile-menu-project-item.active { color: var(--accent-text); }

  /* Project items rendered by makeItem() inside mobile menu */
  .mobile-menu-projects-list .sidebar-project-item {
    font-size: var(--text-xl);
    font-weight: var(--weight-semibold);
    padding: var(--space-14) var(--space-16);
    margin: 0 calc(-1 * var(--space-16));
    background: none;
    border-radius: 0;
    color: var(--text);
  }
  .mobile-menu-projects-list .sidebar-project-item.active {
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    border-radius: var(--radius-md);
    color: var(--text);
  }
  [data-theme="dark"] .mobile-menu-projects-list .sidebar-project-item.active {
    background: color-mix(in srgb, var(--accent) 15%, transparent);
  }
  .mobile-menu-projects-list .sidebar-project-item:hover {
    background: none;
  }
  /* + import button and ... opts button 2x larger on mobile menu */
  .mobile-menu-projects-header .mobile-import-btn,
  .mobile-menu-projects-header .sidebar-projects-add {
    width: 44px;
    height: 44px;
    font-size: var(--text-2xl);
  }
  .mobile-menu-projects-header .mobile-import-btn svg,
  .mobile-menu-projects-header .sidebar-projects-add svg {
    width: 24px;
    height: 24px;
  }
  .mobile-menu-projects-list .sidebar-project-opts {
    width: 44px;
    height: 36px;
    font-size: var(--text-xl);
  }

  /* Theme footer - slides up from bottom of overlay */
  .mobile-menu-theme-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: var(--space-10);
    padding: var(--space-16) var(--space-20) calc(var(--space-16) + env(safe-area-inset-bottom));
    background: rgba(255,255,255,0.96);
    backdrop-filter: blur(var(--blur));
    border-top: 1px solid rgba(0,0,0,0.08);
    transform: translateY(100%);
    transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1);
    pointer-events: none;
  }
  .mobile-menu-theme-footer.visible {
    transform: translateY(0);
    pointer-events: auto;
  }
  [data-theme="dark"] .mobile-menu-theme-footer {
    background: rgba(20,20,32,0.96);
    border-top-color: rgba(255,255,255,0.08);
  }
  .mobile-theme-footer-btn {
    flex: 1;
    padding: var(--space-14);
    border-radius: var(--radius-lg);
    font-size: var(--text-md);
    font-weight: var(--weight-semibold);
    font-family: var(--font);
    cursor: pointer;
    border: none;
    transition: opacity 0.15s ease;
  }
  .mobile-theme-footer-btn:active { opacity: 0.7; }
  .mobile-theme-cancel {
    background: var(--bg-secondary);
    color: var(--text-secondary);
  }
  .mobile-theme-save {
    background: var(--accent);
    color: var(--on-accent-primary1);
  }

  /* View toggle: full-width, flush with header edges */
  .view-toggle { align-self: stretch; flex: 1; padding: 0; gap: 4px; }
  .view-btn {
    flex: 1 1 0;
    justify-content: center;
    padding: var(--space-10) var(--space-4);
    font-size: var(--text-lg);
    gap: var(--space-4);
    white-space: nowrap;
  }
  .view-btn svg { width: 18px; height: 18px; }

  /* Filters: 2-column grid */
  .filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-8);
    width: 100%;
  }
  .filter-group { width: 100%; }
  .filter-group select { width: 100%; }
  #view-size-wrap:not(.hidden) { display: flex !important; }

  /* WCAG AA - minimum legible text in menus (16px) */
  .sidebar-project-menu-item {
    font-size: var(--text-md);
    padding: var(--space-12) var(--space-16);
  }
  .context-menu-item {
    font-size: var(--text-md);
    padding: var(--space-12) var(--space-16);
  }
  .context-menu { min-width: 200px; }
}

/* === Color Picker === */
/* === HSL Color Picker Modal === */
.cp-dialog {
  max-width: 340px;
  width: 100%;
}
.cp-body {
  padding: 0 var(--space-20) var(--space-4);
}
.cp-top-row {
  display: flex;
  align-items: center;
  gap: var(--space-14);
  margin-bottom: var(--space-20);
}
.cp-preview {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.2);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.cp-hex-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.cp-hex-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.cp-hex-input {
  font-family: var(--font);
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  padding: var(--space-8) var(--space-12);
  border-radius: var(--radius-md);
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  box-shadow: var(--input-shadow);
  outline: none;
  width: 100%;
  box-sizing: border-box;
}
.cp-sliders {
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
}
.cp-row {
  display: flex;
  align-items: center;
  gap: var(--space-10);
}
.cp-lbl {
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--text-secondary);
  width: 12px;
  flex-shrink: 0;
  letter-spacing: 0.03em;
}
.cp-track {
  flex: 1;
  height: 14px;
  border-radius: var(--radius-md);
  position: relative;
  overflow: visible;
}
.hue-track {
  background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
}
.cp-range {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  inset: -3px 0;
  width: 100%;
  height: 20px;
  background: transparent;
  cursor: pointer;
  outline: none;
  border: none;
  margin: 0;
  padding: 0;
}
.cp-range::-webkit-slider-runnable-track {
  background: transparent;
  height: 14px;
  border-radius: var(--radius-md);
}
.cp-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(0,0,0,0.18);
  box-shadow: 0 1px 4px rgba(0,0,0,0.28);
  margin-top: calc(-1 * var(--space-2));
  cursor: pointer;
}
.cp-range::-moz-range-track {
  background: transparent;
  height: 14px;
  border-radius: var(--radius-md);
}
.cp-range::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(0,0,0,0.18);
  box-shadow: 0 1px 4px rgba(0,0,0,0.28);
  cursor: pointer;
}
.cp-val {
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  width: 30px;
  text-align: right;
  flex-shrink: 0;
}
.cp-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-8);
  padding: var(--space-16) var(--space-20) var(--space-20);
}

@media (max-width: 768px) {
  #cp-overlay {
    align-items: flex-end;
  }
  .cp-dialog {
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    background: var(--glass-dialog);
    backdrop-filter: blur(calc(var(--blur) * 1.2)) saturate(1.8);
    -webkit-backdrop-filter: blur(calc(var(--blur) * 1.2)) saturate(1.8);
  }
  .cp-preview {
    width: 52px;
    height: 52px;
  }
  .cp-range::-webkit-slider-thumb {
    width: 28px;
    height: 28px;
    margin-top: calc(-1 * var(--space-6));
  }
  .cp-range::-moz-range-thumb {
    width: 28px;
    height: 28px;
  }
  .cp-footer {
    padding-bottom: var(--space-24);
  }
  .cp-footer .modal-btn {
    padding: var(--space-12) var(--space-20);
    font-size: var(--text-md);
  }
}

/* === Settings Page View === */
.settings-view {
  max-width: 100%;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100%;
  box-sizing: border-box;
  scrollbar-width: thin;
}
.settings-view::-webkit-scrollbar { width: 6px; }
.settings-view::-webkit-scrollbar-track { background: transparent; }
.settings-view::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: var(--radius-sm); }
[data-theme="dark"] .settings-view::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); }
.settings-page-header {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  padding: 0 max(var(--space-24), calc((100% - 720px) / 2 + var(--space-24)));
  min-height: 64px;
  position: sticky;
  top: 0;
  z-index: 140;
  background: var(--header-bg);
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
}

/* ─── Settings tabs ─────────────────────────────────────────────────────────── */
.settings-tabs {
  display: flex;
  gap: 0;
  padding: 0 max(var(--space-24), calc((100% - 720px) / 2 + var(--space-24)));
  position: sticky;
  top: 64px;
  z-index: 139;
  background: var(--header-bg);
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  border-bottom: 1px solid var(--border-outer);
  box-shadow: inset 0 -1px 0 0 var(--border), 0 4px 20px rgba(0,0,0,0.04);
}

.settings-tab {
  padding: var(--space-10) var(--space-16);
  border: none;
  background: none;
  font-family: var(--font);
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  color: var(--content-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.settings-tab:first-child {
  padding-left: 0;
}

.settings-tab:hover {
  color: var(--content-primary);
}

.settings-tab.active {
  color: var(--accent-text);
  border-bottom-color: var(--accent-text);
}

.settings-tab-panel {
  display: none;
}

.settings-tab-panel.active {
  display: block;
}
.settings-view > :not(.settings-page-header):not(.trash-page-header):not(.settings-tabs) {
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-24);
  padding-right: var(--space-24);
}
.settings-page-title {
  flex: 1;
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  margin: 0;
  color: var(--text);
}
.settings-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
}
.settings-back-btn:hover {
  background: var(--surface-raised);
}
.settings-done-btn {
  padding: var(--space-6) var(--space-16);
  border: none;
  border-radius: var(--radius-md);
  background: var(--accent, #00a8bf);
  color: var(--on-accent-primary1);
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: opacity 0.15s;
}
.settings-done-btn:hover {
  opacity: 0.85;
}
.settings-card {
  padding: 0 0 var(--space-20);
  margin-bottom: 0;
  border-bottom: 1px solid var(--border-outer);
}
.settings-card:last-child {
  border-bottom: none;
}
.settings-card-title {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  margin: 0 0 var(--space-4);
  color: var(--text);
}
.settings-card-desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin: 0 0 var(--space-16);
}
.settings-account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-12);
}
.settings-account-row .settings-card-desc { margin: 0; }
.settings-card-divider {
  border: none;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  margin: var(--space-16) 0;
}

[data-theme="dark"] .settings-card-divider {
  border-top-color: rgba(255, 255, 255, 0.08);
}

.settings-card-actions {
  padding-top: var(--space-12);
}
.settings-backup-actions {
  border-top: 1px solid rgba(0,0,0,0.08);
  margin-top: var(--space-12);
  display: flex;
  gap: var(--space-8);
  flex-wrap: wrap;
}
[data-theme="dark"] .settings-backup-actions {
  border-color: rgba(255,255,255,0.1);
}
.settings-page-content {
  padding-top: var(--space-16);
}
.settings-card + .settings-card {
  padding-top: var(--space-20);
}
.settings-subsection {
  margin-top: var(--space-12);
  padding-top: var(--space-12);
  border-top: 1px solid rgba(0,0,0,0.06);
}
[data-theme="dark"] .settings-subsection {
  border-top-color: rgba(255,255,255,0.08);
}
.settings-link-btn {
  background: none;
  border: none;
  color: var(--accent-text);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  padding: 0;
}
.settings-link-btn:hover {
  text-decoration: underline;
}
.settings-inline-form {
  margin-top: var(--space-12);
  max-width: 400px;
}
/* Compact controls inside settings forms - lower visual weight than modal CTAs */
.settings-inline-form .modal-field input {
  font-size: var(--text-base);
  min-height: 38px;
  padding: var(--space-8) var(--space-12);
  border-radius: var(--radius-md);
}
.settings-inline-form .modal-field label {
  font-size: var(--text-sm);
}
.settings-inline-form .modal-btn,
#settings-account .settings-card-actions .modal-btn {
  font-size: var(--text-base);
  min-height: 36px;
  min-width: auto;
  padding: var(--space-6) var(--space-16);
  border-radius: var(--radius-md);
}
.settings-inline-form .settings-card-actions {
  display: flex;
  gap: var(--space-8);
  padding-top: var(--space-10);
}
.settings-msg {
  font-size: var(--text-sm);
  margin: var(--space-8) 0;
  line-height: 1.4;
}
.settings-msg.success {
  color: var(--success-text);
}
.settings-msg.error {
  color: var(--danger-text);
}
/* Password strength indicator */
.password-strength {
  margin-top: var(--space-8);
}
.password-strength-bar {
  height: 6px;
  background: rgba(0,0,0,0.08);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: var(--space-8);
}
[data-theme="dark"] .password-strength-bar {
  background: rgba(255,255,255,0.1);
}
.password-strength-fill {
  height: 100%;
  width: 0;
  border-radius: var(--radius-sm);
  transition: width 0.3s ease, background-color 0.3s ease;
}
.password-strength-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-base);
  margin-bottom: var(--space-8);
}
.password-strength-label {
  font-weight: var(--weight-semibold);
}
.password-strength-guidance {
  background: var(--surface);
  backdrop-filter: blur(var(--blur)) saturate(1.3);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-glass);
  border-radius: var(--radius-md);
  padding: var(--space-12) var(--space-16);
}
.password-strength-guidance p {
  margin: 0;
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: 1.5;
}
.password-strength-guidance p + p {
  margin-top: var(--space-4);
}
.settings-version {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  opacity: 0.5;
  margin-top: var(--space-8);
  padding-bottom: var(--space-16);
}

/* Settings slider labels */
.settings-slider-label {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  font-size: var(--text-sm);
  color: var(--text);
  margin-bottom: var(--space-14);
}
.settings-slider-label span span {
  font-variant-numeric: tabular-nums;
  opacity: 0.6;
  margin-left: var(--space-4);
}
.settings-slider-label input[type="range"] {
  width: 100%;
  accent-color: var(--accent, #00a8bf);
}

/* Settings toggle labels */
.settings-toggle-label {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  font-size: var(--text-sm);
  color: var(--text);
  margin-bottom: var(--space-10);
  cursor: pointer;
}
.settings-toggle-label input[type="checkbox"] {
  accent-color: var(--accent, #00a8bf);
}

.settings-bgfx-controls {
  margin-bottom: var(--space-4);
}

/* Toggle switch */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--text);
  cursor: pointer;
}
.toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-track {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--outline-muted, rgba(0,0,0,0.15));
  border-radius: var(--radius-lg);
  transition: background 0.2s ease;
  flex-shrink: 0;
}
.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 0.2s ease;
}
.toggle-input:checked + .toggle-track {
  background: var(--accent);
}
.toggle-input:checked + .toggle-track .toggle-thumb {
  transform: translateX(20px);
}
.toggle-input:focus-visible + .toggle-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.settings-toggle-pair {
  display: flex;
  gap: var(--space-24);
}

.settings-toggle-pair .toggle-row {
  flex: 1;
}

.settings-field-hint {
  font-size: var(--text-sm);
  color: var(--content-secondary);
  margin: var(--space-2) 0 var(--space-8);
  line-height: 1.4;
}

.settings-swatch-group {
  padding: var(--space-16);
  margin-bottom: var(--space-16);
  background: var(--surface-base);
  border-radius: var(--radius);
}
.settings-separator {
  height: 1px;
  background: var(--border);
  margin: var(--space-12) 0;
}
.settings-user-swatches-wrap {
  padding-top: 0;
}
.swatch-removable {
  position: relative;
}
@keyframes swatch-jiggle {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(2deg); }
}
.swatch-removable.jiggling .onboarding-swatch {
  animation: swatch-jiggle 0.25s ease-in-out infinite;
}
.swatch-remove-confirm {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-raised);
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-8) var(--space-14);
  white-space: nowrap;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 10;
}

/* === Onboarding === */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  background: rgba(215,215,215,0.5);
  backdrop-filter: blur(calc(var(--blur) * 1.2)) saturate(1.4);
  -webkit-backdrop-filter: blur(calc(var(--blur) * 1.2)) saturate(1.4);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.onboarding-dialog {
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(calc(var(--blur) * 3)) saturate(1.6);
  -webkit-backdrop-filter: blur(calc(var(--blur) * 3)) saturate(1.6);
  border: 1px solid rgba(255,255,255,0.6);
  border-radius: var(--radius-xl);
  padding: var(--space-24) var(--space-32);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-glass), 0 20px 60px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .onboarding-dialog {
  background: color-mix(in srgb, var(--dark-surface) 88%, transparent);
  border-color: rgba(255,255,255,0.15);
}

.onboarding-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--text);
  margin-bottom: var(--space-8);
}

.onboarding-body {
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin-bottom: var(--space-18);
  line-height: 1.5;
}

.onboarding-swatches {
  display: flex;
  gap: var(--space-10);
  flex-wrap: wrap;
  margin-bottom: var(--space-8);
}
.onboarding-swatch {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.onboarding-swatch:hover {
  transform: scale(1.1);
}
.onboarding-swatch.active {
  border-color: var(--text);
  transform: scale(1.12);
}
.onboarding-swatch-plus {
  background: var(--surface-raised);
  border: 3px dashed rgba(0,0,0,0.2);
  color: var(--text-secondary);
}
[data-theme="dark"] .onboarding-swatch-plus {
  border-color: var(--border);
}
.onboarding-swatch-plus.active {
  border-style: solid;
}
.onboarding-custom-row {
  align-items: center;
  gap: var(--space-12);
  margin-bottom: var(--space-4);
}
.onboarding-color-input {
  width: 52px;
  height: 44px;
  border: none;
  border-radius: var(--radius-md);
  padding: var(--space-2);
  cursor: pointer;
  background: transparent;
}
.onboarding-custom-actions {
  display: flex;
  gap: var(--space-8);
}
.onboarding-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-10);
  margin-top: var(--space-16);
}

/* === Onboarding 3-step flow === */
.ob-mascot-wrap { display: flex; justify-content: center; margin-bottom: var(--space-16); }
.ob-mascot { width: 72px; height: 72px; object-fit: contain; flex-shrink: 0; }

.ob-hero {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  margin-bottom: var(--space-20);
}

.ob-hero .ob-title { margin-bottom: var(--space-4); }
.ob-hero .ob-intro { margin-bottom: 0; }

.ob-title { font-size: var(--text-xl); font-weight: var(--weight-bold); margin-bottom: var(--space-6); color: var(--text); }
.ob-intro { font-size: var(--text-base); color: var(--text-secondary); margin-bottom: var(--space-20); line-height: 1.5; }

.ob-dots { display: flex; justify-content: flex-start; gap: 8px; margin: 0 0 var(--space-16); }
.ob-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); transition: background 0.2s; }
.ob-dot.active { background: var(--shadow-accent); }

.ob-swatches { margin-bottom: var(--space-4); }

.ob-template-list { display: flex; flex-direction: column; gap: var(--space-8); }
.ob-template-item {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  padding: var(--space-12) var(--space-14);
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 1.5px solid transparent;
  background: var(--surface-base);
  transition: border-color 0.15s, background 0.15s;
  text-align: left;
  font-family: var(--font);
}
.ob-template-item:hover { background: var(--surface-raised); }
.ob-template-item.selected { border-color: var(--accent-primary1); background: var(--surface-raised); }
.ob-template-icon { font-size: var(--text-xl); flex-shrink: 0; }
.ob-template-label { font-size: var(--text-base); font-weight: var(--weight-medium); color: var(--text); }

.ob-pane-title { font-size: var(--text-base); font-weight: var(--weight-semibold); color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: var(--space-12); }

.ob-drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-24) var(--space-16);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  color: var(--text-secondary);
  font-size: var(--text-base);
}
.ob-drop-zone:hover,
.ob-drop-zone.dragover { border-color: var(--accent-primary1); background: var(--surface-base); }
.ob-drop-zone svg { display: block; margin: 0 auto var(--space-8); opacity: 0.5; }
.ob-file-name { font-size: var(--text-sm); margin-top: var(--space-8); color: var(--text-secondary); }

.ob-import-actions { display: flex; gap: 8px; margin-top: var(--space-12); }
.ob-import-label { font-size: var(--text-sm); color: var(--text-secondary); margin: 0 0 var(--space-8); }

.ob-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-10);
  margin-top: var(--space-24);
}

.ob-footer .ob-dots {
  flex: 1;
  justify-content: center;
  margin: 0;
}

.ob-footer-right {
  display: flex;
  gap: var(--space-8);
}

.ob-error { font-size: var(--text-sm); color: var(--danger-text); margin-top: var(--space-8); }

.ob-map-grid { display: flex; flex-direction: column; gap: var(--space-14); margin-bottom: var(--space-16); }
.ob-map-field select { border-color: var(--input-border); }
.ob-map-field select.ob-map-chosen { border-color: var(--accent-primary1); }
.ob-map-hint { font-size: var(--text-xs); color: var(--text-secondary); margin-top: var(--space-2); }

.ob-map-preview-label { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: var(--space-8); }
.ob-map-preview { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-md); }
.ob-map-preview-table { width: 100%; border-collapse: collapse; font-size: var(--text-xs); white-space: nowrap; }
.ob-map-preview-table th,
.ob-map-preview-table td { padding: var(--space-6) var(--space-10); text-align: left; border-bottom: 1px solid var(--border); }
.ob-map-preview-table th { color: var(--text-secondary); font-weight: var(--weight-semibold); }
.ob-map-preview-table tr:last-child td { border-bottom: none; }

@media (min-width: 768px) {
  .ob-map-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-14) var(--space-20); }
  .ob-two-pane { display: flex; gap: var(--space-20); }
  .ob-pane { flex: 1; }
  .ob-pane-left { border-right: 1px solid var(--border); padding-right: var(--space-20); }
}
.onboarding-dialog.ob-wide { max-width: 680px; }

/* ─── Onboarding design pickers ─────────────────────────────────────────────── */
.ob-section-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--content-secondary);
  margin-bottom: var(--space-8);
}

.ob-design-row {
  display: flex;
  gap: var(--space-24);
  margin-top: var(--space-16);
}

.ob-design-group {
  flex: 1;
}

.ob-segmented {
  display: flex;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-base);
}

.ob-seg-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-8) var(--space-12);
  border: none;
  background: none;
  font-family: var(--font);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--content-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.ob-seg-btn:not(:last-child) {
  border-right: 1px solid var(--border);
}

.ob-seg-btn:hover {
  background: var(--surface-raised);
}

.ob-seg-btn.active {
  background: var(--accent);
  color: var(--on-accent-primary1);
}

.ob-seg-icon {
  display: flex;
  align-items: center;
  line-height: 1;
}

/* ─── Flat surface mode ─────────────────────────────────────────────────────── */
/* One token override kills all blur - every blur(var(--blur)) resolves to 0 */

/* Light flat: fully opaque surfaces, no glass effects */
[data-surface="flat"] {
  --blur: 0px;
  /* Opaque surfaces - no transparency */
  --surface-base: var(--color-neutral-100);
  --surface-raised: #f5f5f5;
  --surface-header: #f0f0f0;
  --surface-highlight: #ebebeb;
  /* Glass tokens → opaque equivalents */
  --glass-dialog: #f7f7f7;
  --glass-nav: #f5f5f5;
  --glass-overlay: #f8f8f8;
  --glass-card: #fafafa;
  /* Kill glass decorative borders and highlights */
  --glass-border: transparent;
  --glass-border-strong: transparent;
  --glass-border-subtle: transparent;
  --glass-highlight: transparent;
  --glass-shadow: 0 1px 3px rgba(0,0,0,0.08);
  --glass-shadow-inset: none;
  --shadow-glass: 0 1px 3px rgba(0,0,0,0.06);
}

/* Dark flat: fully opaque dark surfaces from neutral ramp */
[data-surface="flat"][data-theme="dark"] {
  --blur: 0px;
  --surface-base: var(--color-neutral-1100, #202020);
  --surface-raised: var(--color-neutral-1000, #313131);
  --surface-header: var(--color-neutral-1200, #101010);
  --surface-highlight: var(--color-neutral-900, #434343);
  --surface-canvas: var(--color-neutral-1200, #101010);
  --glass-dialog: var(--color-neutral-1100, #202020);
  --glass-nav: var(--color-neutral-1100, #202020);
  --glass-overlay: var(--color-neutral-1200, #101010);
  --glass-card: var(--color-neutral-1000, #313131);
  --glass-border: transparent;
  --glass-border-strong: transparent;
  --glass-border-subtle: transparent;
  --glass-highlight: transparent;
  --glass-shadow: 0 1px 3px rgba(0,0,0,0.3);
  --glass-shadow-inset: none;
  --shadow-glass: 0 1px 3px rgba(0,0,0,0.2);
}

/* Flat mode: kill glass effects on sticky/header elements */
[data-surface="flat"] .app-header,
[data-surface="flat"] .primary-nav,
[data-surface="flat"] .todo-month-header,
[data-surface="flat"] .kanban-col-header,
[data-surface="flat"] .sidebar-rail,
[data-surface="flat"] .modal-dialog,
[data-surface="flat"] .qp-chat-panel {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-color: rgba(0,0,0,0.06);
  box-shadow: none;
}
[data-surface="flat"] .todo-month-header {
  background: var(--color-primary1-100);
  border-top: none;
}
[data-surface="flat"][data-theme="dark"] .todo-month-header {
  background: var(--color-primary1-1100);
  border-top: none;
}

/* Flat mode: clean solid canvas, no accent gradient sprites */
[data-surface="flat"] body {
  background: var(--color-neutral-100) !important;
}

[data-surface="flat"][data-theme="dark"] body {
  background: var(--color-neutral-1200, #101010) !important;
}

/* === Desktop overrides === */
@media (min-width: 1025px) {
  .todo-checkbox {
    width: 15px;
    height: 15px;
    padding: var(--space-2);
    margin: var(--space-4);
  }
  .todo-checkbox.checked::after {
    width: 5px;
    height: 10px;
    border-width: 0 2px 2px 0;
  }
}

/* === Mobile Import Button === */
.mobile-menu-projects-header { position: relative; }
.mobile-import-btn {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.mobile-import-btn:hover {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent-text);
}
.mobile-menu-project-item {
  position: relative;
  display: flex;
  align-items: center;
}
.mobile-menu-project-item .sidebar-project-label {
  flex: 1;
}
.mobile-menu-project-item .sidebar-project-opts {
  display: flex;
}

/* === Trash View === */
.trash-search-group { width: 100%; margin-bottom: var(--space-20); }
.trash-search-group .toolbar-search { flex: 1; min-width: 0; }
.trash-list { display: flex; flex-direction: column; gap: var(--space-8); }
.trash-item {
  background: var(--surface-raised);
  backdrop-filter: blur(var(--blur)) saturate(1.2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-14) var(--space-16);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.trash-item-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--text);
}
.trash-item-meta {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}
.trash-item-actions {
  display: flex;
  gap: var(--space-8);
  margin-top: var(--space-8);
  flex-wrap: wrap;
}
.trash-restore-btn {
  font-size: var(--text-base);
  padding: var(--space-6) var(--space-14);
  min-height: unset;
  min-width: unset;
}
.trash-delete-btn {
  font-size: var(--text-base);
  padding: var(--space-6) var(--space-14);
  min-height: unset;
  min-width: unset;
  color: var(--text-secondary);
}
.trash-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-48) var(--space-20) var(--space-32);
  gap: var(--space-12);
}
.trash-empty-animal { width: 200px; height: 200px; object-fit: contain; margin-bottom: var(--space-8); }
.trash-empty-title { font-size: var(--text-2xl); font-weight: var(--weight-bold); color: var(--text); margin: 0; }
.trash-empty-body { font-size: var(--text-lg); color: var(--text-secondary); margin: 0; max-width: 360px; line-height: 1.6; text-wrap: balance; }
.trash-intro {
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin: 0 0 var(--space-16);
  line-height: 1.5;
}
.trash-section-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-top: var(--space-16);
  margin-bottom: var(--space-4);
}
.trash-project {
  background: var(--surface-raised);
  backdrop-filter: blur(var(--blur)) saturate(1.2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.trash-project-header {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  width: 100%;
  padding: var(--space-14) var(--space-16);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  font: inherit;
}
.trash-project-header:hover { background: var(--surface-hover); }
.trash-project-name {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  flex: 1;
  min-width: 0;
}
.trash-project-meta {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}
@media (min-width: 741px) {
  .trash-project-meta { white-space: nowrap; }
}
@media (max-width: 740px) {
  .trash-project-header { flex-wrap: wrap; }
  .trash-project-meta { flex-basis: 100%; padding-left: 0; }
}
.trash-project-chevron {
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.trash-project-header[aria-expanded="true"] .trash-project-chevron {
  transform: rotate(180deg);
}
.trash-project-tasks {
  padding: 0 var(--space-16) var(--space-14);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
.trash-item--nested {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  padding: var(--space-10) var(--space-12);
}
.trash-restore-project-btn,
.trash-delete-project-btn {
  font-size: var(--text-base);
  padding: var(--space-6) var(--space-14);
  min-height: unset;
  min-width: unset;
}
.trash-delete-project-btn { color: var(--text-secondary); }
/* Discard button (unsaved changes confirm) - neutral, not red */
.modal-discard-btn {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-outer, rgba(180,185,200,0.35));
  min-width: 96px;
  min-height: 44px;
  padding: var(--space-10) 22px;
  border-radius: var(--radius-lg);
  font-family: var(--font);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  transition: background 0.15s;
}
.modal-discard-btn:hover { background: var(--surface-raised); }

/* === Import Modal === */
dialog.import-modal {
  border: none;
  padding: 0;
  border-radius: var(--radius-xl);
  background: transparent;
  width: min(480px, 92vw);
  max-height: 90vh;
  overflow: visible;
  /* Explicit centering - browser UA sheets are inconsistent for <dialog> */
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
}
dialog.import-modal::backdrop {
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(calc(var(--blur) * 0.2));
}
[data-theme="dark"] dialog.import-modal::backdrop {
  background: rgba(0,0,0,0.65);
}
.import-modal-inner {
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(calc(var(--blur) * 3)) saturate(1.6);
  border: 1px solid var(--border-outer);
  border-radius: var(--radius-xl);
  padding: var(--space-24) var(--space-24) var(--space-24);
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
  box-shadow: var(--shadow-glass), 0 20px 60px rgba(0,0,0,0.18);
}
[data-theme="dark"] .import-modal-inner {
  background: color-mix(in srgb, var(--dark-surface) 88%, transparent);
  border-color: rgba(255,255,255,0.12);
}
.import-modal-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--text);
  margin: 0;
}
.import-dropzone {
  border: 2px dashed var(--border-outer);
  border-radius: var(--radius-lg);
  padding: var(--space-24) var(--space-20);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-8);
  color: var(--text-secondary);
}
.import-dropzone:hover,
.import-dropzone.drag-over {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  color: var(--text);
}
.import-dropzone svg { color: var(--text-secondary); }
.import-dropzone-label {
  font-size: var(--text-base);
  color: var(--text);
}
.import-browse-link {
  color: var(--accent-text);
  text-decoration: underline;
  cursor: pointer;
}
.import-dropzone-hint {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}
.import-divider {
  display: flex;
  align-items: center;
  gap: var(--space-10);
  color: var(--text-secondary);
  font-size: var(--text-sm);
}
.import-divider::before,
.import-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-outer);
}
.import-url-input,
.import-text-input {
  width: 100%;
  padding: var(--space-10) var(--space-14);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-outer);
  background: var(--surface-raised);
  color: var(--text);
  font-size: var(--text-base);
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}
.import-url-input:focus,
.import-text-input:focus {
  border-color: var(--accent);
}
.import-fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-10);
}
.import-error {
  padding: var(--space-10) var(--space-14);
  border-radius: var(--radius-md);
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger-text);
  font-size: var(--text-base);
  white-space: pre-line;
  line-height: 1.5;
}
.import-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-16);
  padding: var(--space-20) 0;
}
.import-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-outer);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.import-progress-msg {
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--text);
  text-align: center;
  line-height: 1.4;
}
.import-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-10);
  margin-top: var(--space-4);
}
.import-actions .modal-btn { min-width: 88px; }

@media (max-width: 768px) {
  dialog.import-modal { width: 95vw; }
  .import-modal-inner { padding: 22px var(--space-20) var(--space-20); }
}

/* === Filter Chips Bar === */
.filter-chips-bar {
  display: none;
  align-items: center;
  gap: var(--space-8);
  padding: var(--space-8) var(--space-24);
  margin-left: 56px;
  flex-wrap: wrap;
}
.filter-chips-bar.has-chips {
  display: flex;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-6);
  height: 30px;
  padding: 0 var(--space-10) 0 var(--space-12);
  border-radius: var(--radius-xl);
  background: var(--surface-raised);
  backdrop-filter: blur(calc(var(--blur) * 0.6)) saturate(1.3);
  -webkit-backdrop-filter: blur(calc(var(--blur) * 0.6)) saturate(1.3);
  border: 1px solid var(--outline-default);
  box-shadow: var(--shadow-glass);
  font-family: var(--font);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--content-primary);
  white-space: nowrap;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.filter-chip:hover {
  box-shadow: var(--shadow-hover);
}
.filter-chip-label {
  color: var(--content-secondary);
  font-weight: var(--weight-normal);
}
.filter-chip--search {
  gap: var(--space-4);
  font-style: italic;
}
.filter-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--content-secondary);
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s ease, background 0.15s ease;
}
.filter-chip-remove:hover {
  color: var(--content-primary);
  background: rgba(0,0,0,0.06);
}
[data-theme="dark"] .filter-chip-remove:hover {
  background: rgba(255,255,255,0.1);
}
.filter-chips-clear {
  border: none;
  background: none;
  font-family: var(--font);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--accent-primary1);
  cursor: pointer;
  padding: var(--space-4) var(--space-8);
  border-radius: var(--radius-md);
  transition: opacity 0.15s ease;
  white-space: nowrap;
}
.filter-chips-clear:hover {
  opacity: 0.75;
}

@media (max-width: 768px) {
  .filter-chips-bar {
    margin-left: 0;
    padding: var(--space-8) var(--space-16);
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .filter-chips-bar::-webkit-scrollbar {
    display: none;
  }
}

/* === Context Menu === */
.context-menu {
  position: fixed;
  z-index: 10000;
  min-width: 160px;
  padding: var(--space-6);
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(calc(var(--blur) * 0.8)) saturate(180%);
  -webkit-backdrop-filter: blur(calc(var(--blur) * 0.8)) saturate(180%);
  border: 1px solid var(--outline-default);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
  transition: opacity 120ms ease-out, transform 120ms ease-out;
}
.context-menu--visible {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}
.context-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-10);
  width: 100%;
  padding: var(--space-10) var(--space-14);
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  font: inherit;
  font-size: var(--text-base);
  color: var(--content-primary, #1a1a1a);
  cursor: pointer;
  text-align: left;
}
.context-menu-item:hover,
.context-menu-item:focus-visible {
  background: var(--surface-highlight);
}
.context-menu-item--destructive:hover,
.context-menu-item--destructive:focus-visible {
  color: var(--danger-text);
}
.context-menu-item svg {
  flex-shrink: 0;
}

/* Touch targets for long-press - prevent text selection / iOS callout
   from firing during the long-press that opens the context menu */
.kanban-card,
.todo-item,
.planner-bar {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.kanban-card,
.todo-item {
  touch-action: manipulation;
}
.planner-bar {
  touch-action: none;
}

[data-theme="dark"] .context-menu {
  background: rgba(22,28,36,0.9);
  border-color: rgba(255,255,255,0.12);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
[data-theme="dark"] .context-menu-item {
  color: var(--content-primary, #e8e8e8);
}
[data-theme="dark"] .context-menu-item--destructive:hover,
[data-theme="dark"] .context-menu-item--destructive:focus-visible {
  color: var(--danger-text);
}

/* === Date Range Picker === */
.date-range-picker {
  position: fixed;
  z-index: 3000;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(calc(var(--blur) * 3)) saturate(1.6);
  -webkit-backdrop-filter: blur(calc(var(--blur) * 3)) saturate(1.6);
  border: 1px solid rgba(255,255,255,0.6);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-glass), 0 20px 60px rgba(0,0,0,0.15);
  padding: var(--space-24);
  width: 580px;
  max-width: calc(100vw - 32px);
  font-family: var(--font);
}
[data-theme="dark"] .date-range-picker {
  background: color-mix(in srgb, var(--dark-surface) 90%, transparent);
  border-color: rgba(255,255,255,0.15);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.drp-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  margin-bottom: var(--space-16);
}
.drp-month-label {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--text);
}
.drp-month-sep {
  color: var(--text-secondary);
  font-size: var(--text-base);
}
.drp-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}
.drp-nav:hover {
  background: rgba(0,0,0,0.06);
  color: var(--text);
}
[data-theme="dark"] .drp-nav:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}
.drp-prev { margin-right: auto; }
.drp-next { margin-left: auto; }

.drp-months {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-24);
}

.drp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--space-2);
}
.drp-day-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  text-align: center;
  padding: var(--space-4) 0 var(--space-8);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.drp-day {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: 0 auto;
  border: none;
  border-radius: 50%;
  background: transparent;
  font-family: var(--font);
  font-size: var(--text-base);
  color: var(--text);
  cursor: pointer;
  transition: all 0.12s ease;
  position: relative;
}
.drp-day:hover {
  background: rgba(0,0,0,0.06);
}
[data-theme="dark"] .drp-day:hover {
  background: rgba(255,255,255,0.08);
}

.drp-day--outside {
  color: var(--text-secondary);
  opacity: 0.4;
}
.drp-day--today::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.drp-day--selected {
  background: var(--accent) !important;
  color: var(--accent-text) !important;
  opacity: 1;
}
.drp-day--in-range {
  background: color-mix(in srgb, var(--accent) 15%, transparent) !important;
  border-radius: var(--radius-sm);
  opacity: 1;
}
[data-theme="dark"] .drp-day--in-range {
  background: color-mix(in srgb, var(--accent) 20%, transparent) !important;
}

.drp-selection-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: var(--space-16);
  padding: var(--space-10) 0;
  border-top: 1px solid var(--border);
}
.drp-sel-label {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  font-size: var(--text-base);
  color: var(--text-secondary);
}
.drp-sel-part {
  padding: var(--space-6) var(--space-14);
  border-radius: var(--radius-md);
  background: rgba(0,0,0,0.04);
  font-size: var(--text-xl);
}
[data-theme="dark"] .drp-sel-part {
  background: rgba(255,255,255,0.06);
}
.drp-sel-active {
  color: var(--text);
  font-weight: var(--weight-medium);
}
.drp-sel-arrow {
  color: var(--text-secondary);
}

.drp-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-12);
  gap: var(--space-8);
}
.drp-actions-right {
  display: flex;
  gap: var(--space-8);
}
.drp-btn {
  font-family: var(--font);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  min-height: 44px;
  padding: var(--space-10) 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s ease;
}
.drp-clear {
  background: transparent;
  color: var(--text-secondary);
  border: none;
}
.drp-clear:hover {
  color: var(--text);
  background: rgba(0,0,0,0.04);
}
.drp-cancel {
  background: var(--surface);
  color: var(--text);
  border-color: rgba(0,0,0,0.35);
  box-shadow: var(--shadow-glass);
}
.drp-cancel:hover {
  background: var(--surface-raised);
}
.drp-save {
  background: var(--accent);
  color: var(--on-accent-primary1);
  border-color: color-mix(in srgb, var(--shadow-accent) 10%, transparent);
  box-shadow: inset 0 1px 0 0 rgba(255,255,255,0.2), 0 2px 8px color-mix(in srgb, var(--shadow-accent) 40%, transparent);
}
.drp-save:hover {
  box-shadow: inset 0 1px 0 0 rgba(255,255,255,0.25), 0 4px 16px color-mix(in srgb, var(--shadow-accent-hover) 45%, transparent);
}
[data-theme="dark"] .drp-clear:hover {
  background: rgba(255,255,255,0.06);
}
[data-theme="dark"] .drp-cancel {
  border-color: rgba(255,255,255,0.4);
}
[data-theme="dark"] .drp-cancel:hover {
  background: var(--surface-raised);
}

/* Mobile: date range picker as bottom sheet */
.date-range-picker.drp-mobile {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  top: auto;
  width: 100%;
  max-width: 100%;
  border-radius: 20px 20px 0 0;
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.date-range-picker.drp-mobile .drp-months {
  grid-template-columns: 1fr;
  gap: var(--space-16);
}
.date-range-picker.drp-mobile .drp-day {
  width: 40px;
  height: 40px;
  font-size: var(--text-base);
}

/* Filter date inputs in popover */
.filter-popover-grid input[type="date"] {
  font-family: var(--font);
  font-size: var(--text-base);
  min-height: 44px;
  padding: var(--space-10) var(--space-14);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background-color: var(--surface);
  box-shadow: var(--shadow-glass);
  color: var(--text);
  width: 100%;
  cursor: pointer;
  transition: all 0.2s ease;
}
.filter-popover-grid input[type="date"]:hover {
  background-color: var(--surface-raised);
}
.filter-popover-grid input[type="date"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

/* Mobile filter date inputs */
@media (max-width: 768px), (orientation: landscape) and (max-height: 500px) {
  .mobile-filter-date {
    font-family: var(--font);
    font-size: var(--text-md);
    min-height: 44px;
    padding: var(--space-10) var(--space-14);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text);
    width: 100%;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
  }
  .mobile-filter-date:focus {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
  }
  [data-theme="dark"] .mobile-filter-date {
    background: color-mix(in srgb, var(--dark-surface) 90%, transparent);
    border-color: rgba(255,255,255,0.15);
  }
}

/* === Avatar Stacks === */
.card-avatar-stack,
.bar-avatar-stack {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
}
.card-avatar-stack .card-avatar {
  margin-left: calc(-1 * var(--space-8));
  border: 2px solid var(--surface-base, #fff);
}
.card-avatar-stack .card-avatar:last-child {
  margin-left: 0;
}
.bar-avatar-stack {
  margin-left: var(--space-4);
  flex-shrink: 0;
}
.bar-avatar-stack .bar-avatar {
  margin-left: calc(-1 * var(--space-6));
  border: 2px solid var(--surface-base, #fff);
}
.bar-avatar-stack .bar-avatar:last-child {
  margin-left: 0;
}
[data-theme="dark"] .card-avatar-stack .card-avatar,
[data-theme="dark"] .bar-avatar-stack .bar-avatar {
  border-color: var(--dark-surface, #1a1a2e);
}
.avatar-overflow {
  background: var(--text-secondary, #6b7280) !important;
  color: #fff !important;
  font-size: var(--text-xs) !important;
  font-weight: var(--weight-bold);
}

/* === Sidebar Account Button === */
.sidebar-account-btn {
  margin-top: auto;
  padding-top: var(--space-12);
  border-top: 1px solid rgba(0,0,0,0.06);
}
.sidebar-account-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar-account-avatar svg { width: 18px; height: 18px; color: #fff; }
.sidebar-account-avatar:not(.has-initials) { background: none; }
.sidebar-account-avatar:not(.has-initials) svg { color: var(--text-secondary); }
.sidebar-account-avatar.has-initials { width: 22px; height: 22px; font-size: var(--text-xs); margin: calc(-1 * var(--space-2)) 0 calc(-1 * var(--space-2)) calc(-1 * var(--space-2)); }
.sidebar-account-avatar.has-initials svg { display: none; }
[data-theme="dark"] .sidebar-account-btn { border-top-color: rgba(255,255,255,0.06); }
.sidebar-account-avatar.sandbox { background: var(--warning-solid); font-size: var(--text-sm); }

/* Digest badge */
.digest-badge {
  position: absolute;
  top: 4px;
  right: 8px;
  min-width: 18px;
  height: 18px;
  border-radius: var(--radius-md);
  background: var(--danger-solid);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-4);
  line-height: 1;
}
.sidebar-digest-btn { position: relative; }

/* Digest panel */
.digest-panel {
  position: fixed;
  left: var(--sidebar-w, 56px);
  bottom: 0;
  width: 500px;
  max-height: 75vh;
  background: var(--glass-card);
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  border: 1px solid var(--input-border);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.12);
  z-index: 250;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
[data-theme="dark"] .digest-panel {
  border-color: var(--outline-default);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.4);
}
.digest-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-20) var(--space-24);
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.digest-header h3 {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--content-primary);
  margin: 0;
}
.digest-close {
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  font-size: var(--text-2xl);
  color: var(--content-primary);
  cursor: pointer;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}
.digest-close:hover { background: var(--surface-secondary); }
[data-theme="dark"] .digest-header { border-bottom-color: rgba(255,255,255,0.06); }
.digest-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-12);
}
.digest-empty {
  padding: var(--space-48) var(--space-24);
  text-align: center;
  color: var(--text-secondary);
  font-size: var(--text-md);
}
.digest-item {
  padding: var(--space-14) var(--space-18);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-6);
}
.digest-item:hover { background: var(--surface-secondary); }
.digest-item-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--space-4);
}
.digest-item-header strong {
  font-size: var(--text-base);
  color: var(--content-primary);
}
.digest-item-ago {
  font-size: var(--text-base);
  color: var(--text-secondary);
}
.digest-item-task {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  color: var(--content-primary);
  margin-bottom: var(--space-2);
}
.digest-item-detail {
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: 1.4;
}

@media (max-width: 768px) {
  .digest-panel {
    left: 0;
    right: 0;
    width: auto;
    max-height: 60vh;
  }
}

/* Account popover */
.sidebar-account-wrap { position: relative; margin-top: auto; }
.sidebar-account-popover {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 8px;
  min-width: 200px;
  background: var(--glass-card);
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 24px rgba(0,0,0,0.18), 0 1px 4px rgba(0,0,0,0.08);
  border: 1px solid var(--input-border);
  padding: var(--space-6);
  z-index: 300;
}
[data-theme="dark"] .sidebar-account-popover {
  border-color: var(--glass-border);
  box-shadow: 0 4px 24px rgba(0,0,0,0.4), 0 1px 4px rgba(0,0,0,0.2);
}
.sidebar-account-popover-email {
  padding: var(--space-8) var(--space-10) var(--space-6);
  font-size: var(--text-sm);
  color: var(--content-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  margin-bottom: var(--space-4);
}
[data-theme="dark"] .sidebar-account-popover-email {
  color: var(--content-tertiary);
  border-bottom-color: var(--outline-default);
}
.sidebar-account-popover-item {
  display: block;
  width: 100%;
  padding: var(--space-8) var(--space-10);
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  color: var(--content-primary);
  background: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background 0.15s;
}
.sidebar-account-popover-item:hover { background: var(--surface-raised); }
.sidebar-account-popover-logout { color: var(--danger-text); }
.sidebar-account-popover-logout:hover { background: var(--danger-bg); }
[data-theme="dark"] .sidebar-account-popover-item:hover { background: var(--hover-overlay); }

/* Sandbox badge */
body.sandbox-mode::after {
  content: 'SANDBOX';
  position: fixed;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-2) var(--space-10);
  background: var(--warning-solid);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: 0.05em;
  border-radius: var(--radius-sm);
  z-index: 9999;
  pointer-events: none;
}

/* Mobile account item */
.mobile-account-item {
  padding-bottom: var(--space-12) !important;
  margin-bottom: var(--space-4);
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.mobile-account-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent, #2cb5a0);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  flex-shrink: 0;
  overflow: hidden;
}
.mobile-account-avatar svg { color: #fff; filter: drop-shadow(0 0 1px rgba(0,0,0,0.15)); }
.mobile-account-avatar:not(.has-initials) { background: var(--accent); }
.mobile-account-avatar.has-initials svg { display: none; }
[data-theme="dark"] .mobile-account-item { border-bottom-color: rgba(255,255,255,0.06); }

/* === Auth Overlay === */
/* ── Auth overlay / Landing page ──────────────────────────────────────────── */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  overflow-y: auto;
  background: var(--surface-landing);
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.auth-overlay.hidden { display: none; }

/* Auth gate - hide app shell when user must log in */
body.auth-gate .sidebar-rail,
body.auth-gate .primary-nav,
body.auth-gate .app-header,
body.auth-gate main,
body.auth-gate .fab-add,
body.auth-gate #mobile-menu-overlay { display: none; }

/* Landing page - asymmetric two-panel, generous negative space */
.landing-page {
  display: grid;
  grid-template-columns: auto auto;
  gap: var(--space-24);
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding-left: 5vw;
  padding-right: 5vw;
  background:
    radial-gradient(ellipse 50% 50% at 72% 50%, color-mix(in srgb, var(--accent-primary1, rgba(0,227,255,1)) 8%, transparent) 0%, transparent 100%),
    var(--surface-landing);
}

/* Second panel - the animated picture. Decorative, so it follows the form. */
.landing-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-48) var(--space-24);
}

.landing-copy {
  text-align: center;
}

/* === Login hero ===
   The app's own components (board card, checklist row, timeline bar) drawn as
   a picture. Decorative: aria-hidden and inert in the markup, no pointer events.
   One loop, --hero-loop long: the ticket moves from In Progress to Done, then
   the same task is ticked on the checklist, then the next one.
   Drawn at 524 x 372 and scaled with zoom to suit the width. */
@property --hero-on {
  syntax: '<number>';
  inherits: true;
  initial-value: 0;
}
.hero-stage {
  --hero-loop: 14s;
  /* Height of one board card: fixed parts plus three lines of text. Measured
     at 112px with a 14px root size and 125px with 16.8px. */
  --hero-card-h: calc(48px + 4.7rem);
  position: relative;
  flex-shrink: 0;
  width: 524px;
  height: 372px;
  pointer-events: none;
}

/* Timeline, behind everything, moving slowly to the left */
.hero-timeline {
  position: absolute;
  inset: 0;
  overflow: hidden;
  /* Fades out at both sides and at the bottom */
  -webkit-mask-image: linear-gradient(to right, transparent, black 14%, black 86%, transparent), linear-gradient(to bottom, black 78%, transparent);
  mask-image: linear-gradient(to right, transparent, black 14%, black 86%, transparent), linear-gradient(to bottom, black 78%, transparent);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}
.hero-timeline-track {
  display: flex;
  width: max-content;
  animation: hero-timeline-scroll 90s linear infinite;
}
.hero-timeline-half {
  flex-shrink: 0;
  width: 1000px;
}
.hero-timeline-months {
  position: relative;
  height: var(--space-32);
}
@keyframes hero-timeline-scroll {
  to { transform: translateX(-50%); }
}

/* Board: two columns, one ticket that changes column */
.hero-board {
  position: absolute;
  top: 36px;
  left: 0;
  display: flex;
  align-items: flex-start;
  gap: var(--space-12);
  width: 372px;
  animation: hero-float 9s ease-in-out infinite alternate;
}
/* The desktop column, at every width. The app's own phone rules flatten it. */
.hero-board .hero-col {
  flex: 1;
  width: auto;
  overflow: visible;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-glass);
  /* Solid, so timeline labels do not show through an empty column */
  background: var(--surface-landing);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.hero-col--from { z-index: 2; }
.hero-col-cards {
  position: relative;
  min-height: calc(var(--hero-card-h) + var(--space-8));
  padding: var(--space-8) var(--space-8) 0;
}
.hero-col-cards > .kanban-card {
  box-sizing: border-box;
  height: var(--hero-card-h);
  margin-bottom: var(--space-8);
}
/* Opens in Done as the ticket arrives, so the card already there moves down */
.hero-slot { height: 0; animation: hero-slot-open var(--hero-loop) ease-in-out infinite; }
.hero-col-cards > .hero-ticket {
  position: absolute;
  top: var(--space-8);
  left: var(--space-8);
  right: var(--space-8);
  margin-bottom: 0;
  animation: hero-ticket-move var(--hero-loop) cubic-bezier(0.45, 0, 0.2, 1) infinite;
}
/* The ticket travels its own width plus the column padding and the gap */
@keyframes hero-ticket-move {
  0%, 10% { transform: none; opacity: 1; box-shadow: var(--shadow-glass), var(--shadow-card); }
  14% { transform: translate(0, -6px) rotate(2deg) scale(1.03); box-shadow: var(--shadow-glass), var(--shadow-hover); }
  26% { transform: translate(calc(100% + 28px), -6px) rotate(2deg) scale(1.03); box-shadow: var(--shadow-glass), var(--shadow-hover); }
  30%, 86% { transform: translate(calc(100% + 28px), 0); opacity: 1; box-shadow: var(--shadow-glass), var(--shadow-card); }
  90% { transform: translate(calc(100% + 28px), 0); opacity: 0; }
  91% { transform: none; opacity: 0; }
  96%, 100% { transform: none; opacity: 1; }
}
@keyframes hero-slot-open {
  0%, 15% { height: 0; }
  26%, 88% { height: calc(var(--hero-card-h) + var(--space-8)); }
  94%, 100% { height: 0; }
}

/* Checklist in a rounded shape, the phone view, drawn at 70% */
.hero-phone {
  zoom: 0.7;
  position: absolute;
  top: 171px;
  right: 0;
  width: 252px;
  height: 344px;
  padding: 0 var(--space-12);
  overflow: hidden;
  border-radius: 36px;
  background: var(--glass-card);
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  border: 1px solid var(--glass-border-subtle);
  box-shadow: var(--glass-shadow), var(--glass-shadow-inset);
  animation: hero-float 9s ease-in-out -4.5s infinite alternate;
}
.hero-phone .todo-month-header {
  position: static;
  margin: 0 calc(-1 * var(--space-12)) var(--space-10);
  padding: var(--space-18) var(--space-24) var(--space-10);
}
.hero-todo {
  margin-bottom: var(--space-8);
  padding: var(--space-10);
  gap: var(--space-4) var(--space-6);
}
.hero-todo--1 { animation: hero-check-1 var(--hero-loop) linear infinite; }
.hero-todo--2 { animation: hero-check-2 var(--hero-loop) linear infinite; }
/* The phone size of the checkbox, at every width */
.hero-todo .todo-checkbox {
  width: 22px;
  height: 22px;
  padding: var(--space-4);
  margin: var(--space-4);
  background: color-mix(in srgb, var(--success-text) calc(var(--hero-on) * 100%), transparent);
  border-color: color-mix(in srgb, var(--success-text) calc(var(--hero-on) * 100%), var(--text-secondary));
  transform: scale(calc(1 + 0.6 * var(--hero-on) * (1 - var(--hero-on))));
}
/* Same tick as .todo-checkbox.checked::after */
.hero-todo .todo-checkbox::after {
  content: '';
  display: block;
  width: 8px;
  height: 14px;
  border: solid var(--status-done-text);
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) translateY(-1px);
  opacity: var(--hero-on);
}
.hero-todo .todo-col-meta,
.hero-todo .todo-col-main {
  opacity: calc(1 - 0.5 * var(--hero-on));
}
.hero-todo .todo-task-name {
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, currentColor calc(var(--hero-on) * 100%), transparent);
}
@keyframes hero-check-1 {
  0%, 36% { --hero-on: 0; }
  39%, 88% { --hero-on: 1; }
  92%, 100% { --hero-on: 0; }
}
@keyframes hero-check-2 {
  0%, 52% { --hero-on: 0; }
  55%, 88% { --hero-on: 1; }
  92%, 100% { --hero-on: 0; }
}

@keyframes hero-float {
  from { transform: translateY(-4px); }
  to { transform: translateY(4px); }
}

@media (prefers-reduced-motion: reduce) {
  .hero-stage *,
  .hero-stage *::after { animation: none !important; }
}

/* Scale the hero to the room beside the form */
@media (min-width: 1400px) { .hero-stage { zoom: 1.25; } }
@media (max-width: 1239px) { .hero-stage { zoom: 0.8; } }
@media (max-width: 1099px) { .hero-stage { zoom: 0.6; } }
@media (max-width: 960px) {
  .landing-page { grid-template-columns: auto; align-content: center; gap: 0; }
  .landing-auth { padding-bottom: var(--space-24); }
  .landing-hero { padding-top: 0; padding-bottom: var(--space-24); }
  .hero-stage { zoom: 0.8; }
}

.landing-headline {
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  font-weight: var(--weight-extrabold);
  line-height: 1.1;
  color: var(--text);
  letter-spacing: -0.03em;
  margin-bottom: var(--space-12);
}

.landing-tagline {
  font-size: clamp(0.92rem, 1.2vw, 1.05rem);
  color: var(--text-secondary, #6b7280);
  font-weight: var(--weight-normal);
  letter-spacing: 0.01em;
}

/* First panel - mascot and name, then the form */
.landing-auth {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-24);
  padding: var(--space-32) var(--space-48);
}
.landing-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-12);
}

/* === Mascot ===
   The login mascot: an inline SVG that stacks the layers in images/mascot.
   One --mascot-loop, which starts and ends on the side eye so he is looking
   at you when the page opens. Between, he bites the banana, chews, and
   scratches his head. Lengths are in the 1024 unit artwork. */
@property --mascot-chew { syntax: '<number>'; inherits: true; initial-value: 0; }
@property --mascot-scratch { syntax: '<number>'; inherits: true; initial-value: 0; }
@property --mascot-wag { syntax: '<number>'; inherits: true; initial-value: 0; }
.mascot {
  --mascot-loop: 24s;
  display: block;
  flex-shrink: 0;
  width: 168px;
  height: auto;
  overflow: visible;
  /* --mascot-wag swings all the time. The other two say when it shows. */
  animation:
    mascot-chew-on var(--mascot-loop) linear infinite,
    mascot-scratch-on var(--mascot-loop) linear infinite,
    mascot-wag 0.22s ease-in-out infinite alternate;
}
.mascot * { transform-box: view-box; }
.mascot-pupil { animation: mascot-look var(--mascot-loop) ease-in-out infinite; }
.mascot-lid {
  transform-origin: 0 339px;
  transform: scaleY(0);
  animation: mascot-blink var(--mascot-loop) ease-in-out infinite;
}
/* Turns at the wrist */
.mascot-hand {
  transform-origin: 590px 672px;
  animation: mascot-bite var(--mascot-loop) ease-in-out infinite;
}
.mascot-tip { animation: mascot-bitten var(--mascot-loop) linear infinite; }
/* The far hand lets go of the banana to scratch */
.mascot-fingers { animation: mascot-let-go var(--mascot-loop) linear infinite; }
.mascot-mouth {
  transform-origin: 574px 446px;
  transform: translateY(calc(var(--mascot-chew) * var(--mascot-wag) * 3px)) scaleX(calc(1 - var(--mascot-chew) * (var(--mascot-wag) + 1) * 0.05));
}
/* The far arm waits folded behind the head. Shoulder, then elbow. */
.mascot-arm {
  transform-origin: 585px 440px;
  transform: rotate(-83deg);
  animation: mascot-arm-up var(--mascot-loop) ease-in-out infinite;
}
.mascot-arm-scratch {
  transform-origin: 585px 440px;
  transform: rotate(calc(var(--mascot-scratch) * var(--mascot-wag) * 3deg));
}
.mascot-forearm {
  transform-origin: 765px 265px;
  transform: rotate(-74deg);
  animation: mascot-forearm-up var(--mascot-loop) ease-in-out infinite;
}
/* The hand comes up behind the head, then is swapped for this copy in front
   of it while it is clear of the head, and comes down on top */
.mascot-paw-front {
  opacity: 0;
  animation:
    mascot-arm-up var(--mascot-loop) ease-in-out infinite,
    mascot-paw-over var(--mascot-loop) step-end infinite;
}
.mascot-mouth-open {
  transform-origin: 574px 446px;
  transform: scaleY(0);
  animation: mascot-mouth-open var(--mascot-loop) ease-in-out infinite;
}
.mascot-tongue {
  transform-origin: 537px 451px;
  transform: scaleY(0);
  animation: mascot-tongue var(--mascot-loop) ease-in-out infinite;
}
@keyframes mascot-wag { from { --mascot-wag: -1; } to { --mascot-wag: 1; } }
@keyframes mascot-look {
  0%, 12.5% { transform: translate(-12px, 0); }
  15%, 23.33% { transform: none; }
  25%, 32.5% { transform: translate(7px, 0); }
  35%, 88.33% { transform: none; }
  90%, 100% { transform: translate(-12px, 0); }
}
@keyframes mascot-blink {
  0%, 6% { transform: scaleY(0); }
  6.5% { transform: scaleY(1); }
  7.17%, 19.5% { transform: scaleY(0); }
  20% { transform: scaleY(1); }
  20.67%, 52% { transform: scaleY(0); }
  52.5% { transform: scaleY(1); }
  53.17%, 54.5% { transform: scaleY(0); }
  55% { transform: scaleY(1); }
  55.67%, 79.92% { transform: scaleY(0); }
  80.42% { transform: scaleY(1); }
  81.08%, 94.5% { transform: scaleY(0); }
  95% { transform: scaleY(1); }
  95.67%, 100% { transform: scaleY(0); }
}
@keyframes mascot-bite {
  0%, 28.33% { transform: none; }
  30.83%, 32.17% { transform: rotate(-33deg); }
  35%, 100% { transform: none; }
}
/* The top of the banana goes as it reaches the mouth and is back for the next loop */
@keyframes mascot-bitten {
  0%, 30.17% { opacity: 1; }
  30.83%, 81.67% { opacity: 0; }
  86.67%, 100% { opacity: 1; }
}
@keyframes mascot-paw-over {
  0% { opacity: 0; }
  62.17% { opacity: 1; }
  73% { opacity: 0; }
}
@keyframes mascot-mouth-open {
  0%, 29.17% { transform: scaleY(0); }
  30.33%, 30.83% { transform: scaleY(1); }
  31.33%, 100% { transform: scaleY(0); }
}
@keyframes mascot-tongue {
  0%, 63.67% { transform: scaleY(0); }
  64.67%, 71% { transform: scaleY(1); }
  72%, 100% { transform: scaleY(0); }
}
@keyframes mascot-let-go {
  0%, 58% { opacity: 1; }
  59%, 75.33% { opacity: 0; }
  76.33%, 100% { opacity: 1; }
}
@keyframes mascot-chew-on {
  0%, 30.67% { --mascot-chew: 0; }
  31.33%, 46.67% { --mascot-chew: 1; }
  48.33%, 100% { --mascot-chew: 0; }
}
@keyframes mascot-arm-up {
  0%, 58.33% { transform: rotate(-83deg); }
  61.67%, 73% { transform: none; }
  76.33%, 100% { transform: rotate(-83deg); }
}
@keyframes mascot-forearm-up {
  0%, 59.17% { transform: rotate(-74deg); }
  62%, 62.5% { transform: rotate(30deg); }
  63.67%, 71.67% { transform: none; }
  72.67%, 73.17% { transform: rotate(30deg); }
  75.67%, 100% { transform: rotate(-74deg); }
}
@keyframes mascot-scratch-on {
  0%, 63.83% { --mascot-scratch: 0; }
  64.67%, 70.67% { --mascot-scratch: 1; }
  71.5%, 100% { --mascot-scratch: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .mascot,
  .mascot * { animation: none !important; }
}

.auth-free {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-secondary, #6b7280);
  margin-top: var(--space-16);
  margin-bottom: 0;
}

/* Auth card */
.auth-card {
  position: relative;
  width: min(380px, 92vw);
  padding: 2rem 2rem 1.5rem;
  border-radius: var(--radius-xl);
  background: var(--glass-card);
  backdrop-filter: blur(calc(var(--blur) * 1.2)) saturate(1.4);
  -webkit-backdrop-filter: blur(calc(var(--blur) * 1.2)) saturate(1.4);
  box-shadow: var(--glass-shadow), var(--glass-shadow-inset);
  border: 1px solid var(--glass-border-subtle);
}

.auth-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: var(--text-2xl);
  cursor: pointer;
  color: var(--text-secondary, #6b7280);
  line-height: 1;
  padding: var(--space-4);
}

.auth-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--text);
  margin-bottom: var(--space-6);
}

.auth-subtitle {
  display: none;
}

.auth-form { display: flex; flex-direction: column; gap: var(--space-14); }

.auth-field label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary, #6b7280);
  margin-bottom: var(--space-4);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.auth-field input {
  width: 100%;
  padding: var(--space-10) var(--space-12);
  border-radius: var(--radius-md);
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  box-shadow: var(--input-shadow);
  font-size: var(--text-base);
  font-family: var(--font);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  margin-left: calc(-1 * var(--space-4));
  outline: none;
  -webkit-appearance: none;
}

.auth-field input:hover {
  background-color: var(--input-bg-hover);
}

.auth-field input:focus {
  border-color: var(--accent, #2cb5a0);
  box-shadow: 0 0 0 3px rgba(44,181,160,0.15), inset 0 1px 2px rgba(0,0,0,0.06);
}
.auth-field input:-webkit-autofill,
.auth-field input:-webkit-autofill:hover,
.auth-field input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0px 1000px var(--input-bg) inset;
  transition: background-color 5000s ease-in-out 0s;
}

.auth-error {
  padding: var(--space-8) var(--space-12);
  border-radius: var(--radius-md);
  background: var(--danger-bg);
  color: var(--danger-text);
  font-size: var(--text-base);
  border: 1px solid var(--danger-border);
}
.auth-error.hidden { display: none; }

.auth-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  margin-top: var(--space-6);
}
.auth-actions .modal-btn { width: 100%; text-align: center; }

.auth-skip {
  display: block;
  width: 100%;
  margin-top: var(--space-4);
  padding: var(--space-8);
  background: none;
  border: none;
  color: var(--text-secondary, #6b7280);
  font-size: var(--text-base);
  font-family: var(--font);
  cursor: pointer;
  touch-action: manipulation;
  text-align: center;
}
.auth-skip:hover { color: var(--text-secondary); }

/* Landing entrance animation */
@keyframes landing-slide-in {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
.landing-hero,
.landing-auth {
  opacity: 0;
}
.landing-animate .landing-auth {
  animation: landing-slide-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.landing-animate .landing-hero {
  animation: landing-slide-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.5s forwards;
}

/* Landing mobile - one column: mascot beside the name, the form, then the picture */
@media (max-width: 740px) {
  .landing-page {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--space-16);
    padding: var(--space-16);
  }
  .landing-auth {
    padding: 0;
    gap: var(--space-16);
    align-items: stretch;
    justify-content: flex-start;
  }
  .landing-brand { flex-direction: row; }
  .landing-copy { text-align: left; }
  .landing-headline { margin-bottom: var(--space-2); }
  .mascot { width: 64px; }
  .landing-hero { padding: 0; }
  .hero-stage { zoom: 0.7; }
  /* Typing: the keyboard takes half the screen, so the form moves to the top */
  .landing-page:has(input:focus) { justify-content: flex-start; }
  .landing-page:has(input:focus) .landing-hero,
  .landing-page:has(input:focus) .landing-tagline { display: none; }
  .landing-page:has(input:focus) .landing-headline { margin-bottom: 0; }
  .landing-page:has(input:focus) .mascot { width: 40px; }
  .auth-card {
    width: 100%;
    max-width: none;
    padding: var(--space-20) var(--space-16) var(--space-16);
  }
}
@media (max-width: 479px) { .hero-stage { zoom: 0.5; } }

/* Auth dark mode - surface-landing token auto-switches; only non-token overrides here */
[data-theme="dark"] .landing-page {
  background:
    radial-gradient(ellipse 50% 50% at 72% 50%, color-mix(in srgb, var(--accent-primary1, rgba(0,227,255,1)) 6%, transparent) 0%, transparent 100%),
    var(--surface-landing);
}
/* Auth card + input dark overrides eliminated - tokens auto-switch */

/* === People / Invite Settings === */

.people-body { margin-top: var(--space-8); }
.people-loading, .people-error, .people-no-results {
  font-size: var(--text-sm); color: var(--text-muted); padding: var(--space-12) 0;
}
.people-error { color: var(--danger-text); }

/* Invite form */
.people-invite-form { margin-bottom: var(--space-16); }
.people-invite-row {
  display: flex; gap: var(--space-8); align-items: center;
}
.people-invite-input-wrap { flex: 1; }
.people-invite-input {
  width: 100%; box-sizing: border-box;
  font-family: var(--font); font-size: var(--text-base);
  padding: var(--space-10) var(--space-14); border-radius: var(--radius-md);
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  box-shadow: var(--input-shadow);
  margin-left: calc(-1 * var(--space-4));
  height: 42px;
}
.people-invite-input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}
.people-invite-role {
  font-family: var(--font); font-size: var(--text-base);
  padding: var(--space-10) var(--space-10); border-radius: var(--radius-md); min-width: 90px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  cursor: pointer;
  height: 42px; box-sizing: border-box;
}
.people-invite-btn {
  min-width: auto; padding: var(--space-10) var(--space-18); font-size: var(--text-base);
  height: 42px; box-sizing: border-box;
}
.people-invite-msg {
  font-size: var(--text-sm); margin-top: 8px; padding: var(--space-8) var(--space-12);
  border-radius: var(--radius-md);
}
.people-invite-msg--error {
  color: var(--danger-text);
  background: var(--danger-bg);
}

/* Search */
.people-search-wrap {
  display: flex; align-items: center; gap: 8px; margin-bottom: var(--space-12);
}
.people-search-input {
  flex: 1; font-family: var(--font); font-size: var(--text-base);
  padding: var(--space-8) var(--space-12); border-radius: var(--radius-md);
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(255,255,255,0.8);
  margin-left: calc(-1 * var(--space-4));
}
.people-search-input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}
[data-theme="dark"] .people-search-input {
  background: var(--glass-dialog);
  border-color: var(--glass-border);
  color: var(--text);
}

/* Empty state */
.people-empty { text-align: center; padding: var(--space-24) var(--space-16); }
.people-empty-title { font-size: var(--text-md); font-weight: var(--weight-semibold); color: var(--text); margin: 0 0 var(--space-4); }
.people-empty-desc { font-size: var(--text-sm); color: var(--text-muted); margin: 0; }

/* Avatar grid (Trello-style) */
.people-group { margin-bottom: var(--space-16); }
.people-avatar-grid {
  display: flex; flex-wrap: wrap; gap: var(--space-12);
}
.people-avatar-card {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-4);
  position: relative; cursor: default;
}
.people-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-md); font-weight: var(--weight-semibold); flex-shrink: 0;
  background: var(--accent); color: var(--on-accent-primary1);
}
.people-avatar-name {
  font-size: var(--text-xs); color: var(--text-muted); width: 72px;
  text-align: center; word-wrap: break-word; line-height: 1.3;
}
.people-avatar-card { align-items: center; vertical-align: top; }
.people-avatar-grid { align-items: start; }
.people-avatar-name mark { background: color-mix(in srgb, var(--accent) 25%, transparent); border-radius: var(--radius-sm); }
.people-edit-access-btn {
  font-family: var(--font); font-size: var(--text-xs); font-weight: var(--weight-medium);
  padding: var(--space-2) var(--space-8); border-radius: var(--radius-sm); border: 1px solid transparent;
  background: transparent; color: var(--text-muted); cursor: pointer;
  opacity: 0; transition: opacity 0.15s, background 0.15s;
}
.people-avatar-card:hover .people-edit-access-btn { opacity: 1; }
.people-edit-access-btn:hover { background: var(--surface-secondary); }
.people-edit-access-btn.active { opacity: 1; background: var(--surface-secondary); border-color: var(--border-subtle); }
.people-access-panel {
  display: flex; flex-direction: column; gap: var(--space-6);
  padding: var(--space-8); background: var(--surface-secondary); border-radius: var(--radius-md);
  width: 100%;
}
.people-role-select {
  font-family: var(--font); font-size: var(--text-xs); padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-sm); border: 1px solid var(--border-subtle);
  background: var(--surface-raised); color: var(--content-primary);
  cursor: pointer; width: 100%;
}
.people-remove-btn {
  font-family: var(--font); font-size: var(--text-xs); font-weight: var(--weight-medium);
  padding: var(--space-2) var(--space-6); border-radius: var(--radius-sm); border: none;
  background: transparent; color: var(--danger-text); cursor: pointer;
  text-align: left;
}
.people-remove-btn:hover { background: var(--danger-bg); }

/* Pending invite table */
.people-table { display: flex; flex-direction: column; gap: var(--space-2); }
.people-row {
  display: flex; align-items: center; gap: var(--space-10);
  padding: var(--space-10) var(--space-12); border-radius: var(--radius-md);
  transition: background 0.15s ease;
}
.people-row:hover { background: rgba(0,0,0,0.03); }
[data-theme="dark"] .people-row:hover { background: rgba(255,255,255,0.04); }

/* Pending rows */
.people-row--pending { opacity: 0.8; }
.people-row--stale { border-left: 2px solid var(--warning-solid); padding-left: var(--space-10); }

/* Pending avatar */
.people-avatar--pending {
  background: rgba(0,0,0,0.06); color: var(--text-muted);
}
[data-theme="dark"] .people-avatar--pending {
  background: rgba(255,255,255,0.08);
}

/* Info */
.people-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.people-name { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people-email { font-size: var(--text-sm); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people-invite-date { font-size: var(--text-xs); }
.people-date--stale { color: var(--warning-solid); font-weight: var(--weight-medium); }

/* Role pills - WCAG AA safe */
.people-role {
  display: inline-block; font-size: var(--text-xs); font-weight: var(--weight-semibold); text-transform: uppercase; letter-spacing: 0.04em;
  padding: var(--space-2) var(--space-10); border-radius: var(--radius-xl); white-space: nowrap; flex-shrink: 0;
}
.people-role--owner { background: var(--content-secondary); color: var(--content-inverse); }
.people-role--admin { background: var(--accent); color: var(--on-accent-primary1); }
.people-role--member { background: rgba(0,0,0,0.08); color: var(--content-primary); }
.people-role--viewer { background: transparent; border: 1px solid var(--content-tertiary); color: var(--content-secondary); }
[data-theme="dark"] .people-role--member { background: rgba(255,255,255,0.12); }

/* Invite row actions */
.people-invite-actions { display: flex; align-items: center; gap: var(--space-6); flex-shrink: 0; }
.people-resend-btn {
  font-family: var(--font); font-size: var(--text-sm); font-weight: var(--weight-medium);
  padding: var(--space-4) var(--space-10); border-radius: var(--radius-md);
  border: 1px solid rgba(0,0,0,0.1); background: transparent;
  color: var(--accent-text); cursor: pointer;
  transition: all 0.15s ease;
}
.people-resend-btn:hover { background: var(--hover-overlay); }
[data-theme="dark"] .people-resend-btn { border-color: rgba(255,255,255,0.15); }
.people-remove-invite-btn {
  font-family: var(--font); font-size: var(--text-sm); font-weight: var(--weight-medium);
  padding: var(--space-4) var(--space-10); border-radius: var(--radius-md);
  border: 1px solid rgba(0,0,0,0.1); background: transparent;
  color: var(--text-muted); cursor: pointer;
  transition: all 0.15s ease;
}
.people-remove-invite-btn:hover { color: var(--danger-text); border-color: currentColor; }
[data-theme="dark"] .people-remove-invite-btn { border-color: rgba(255,255,255,0.15); }

/* Inline revoke confirmation (avatar cards) */
.people-confirm-revoke {
  display: flex; align-items: center; gap: var(--space-4);
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  padding: var(--space-4) var(--space-8); margin-top: 4px;
  background: var(--surface-raised, rgba(255,255,255,0.9)); border: 1px solid var(--border-outer);
  border-radius: var(--radius-md); box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  font-size: var(--text-xs); color: var(--text); white-space: nowrap;
  opacity: 0; overflow: hidden;
  transition: opacity 0.15s ease;
  z-index: 10;
}
[data-theme="dark"] .people-confirm-revoke {
  background: var(--dark-card, rgba(30,33,45,0.95));
}
.people-confirm-visible { opacity: 1; }
.people-confirm-yes {
  font-family: var(--font); font-size: var(--text-xs); font-weight: var(--weight-semibold);
  padding: var(--space-2) var(--space-8); border-radius: var(--radius-sm); border: none;
  background: var(--danger-solid); color: var(--content-inverse); cursor: pointer;
}
.people-confirm-yes:hover { background: var(--danger-hover); }
.people-confirm-no {
  font-family: var(--font); font-size: var(--text-xs);
  padding: var(--space-2) var(--space-8); border-radius: var(--radius-sm); border: 1px solid rgba(0,0,0,0.1);
  background: transparent; color: var(--text); cursor: pointer;
}

/* Section label */
.people-section-label {
  font-size: var(--text-sm); font-weight: var(--weight-semibold); text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); margin: 8px 0 8px; padding: 0;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .people-invite-row { flex-wrap: wrap; }
  .people-invite-input-wrap { flex: 1 1 100%; }
  .people-invite-role { flex: 1; }
  .people-invite-btn { flex: 0 0 auto; }
  .people-row { padding: var(--space-8) var(--space-8); gap: 8px; }
  .people-invite-actions { gap: var(--space-4); }
  .people-edit-access-btn { opacity: 1; }
}

/* ═══════════════════════════════════════════════════
   HOME PROMPT  (v0.4.0)
   CSS values ported verbatim from qp-ux-proposal.html (the validated mockup).
   Class names prefixed to avoid collisions; values are identical.
   Tokens --glass-card-accent / --glass-card-accent-border / --glass-card-accent-hover
   are now defined in :root and [data-theme="dark"] above.
═══════════════════════════════════════════════════ */
.home-prompt-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.28);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: hp-fade-in 0.2s ease forwards;
}
[data-theme="dark"] .home-prompt-overlay {
  background: color-mix(in srgb, var(--dark-surface-deepest, #030303) 50%, transparent);
}
.home-prompt-overlay--out { animation: hp-fade-out 0.15s ease forwards; }
@keyframes hp-fade-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes hp-fade-out { from { opacity: 1; } to { opacity: 0; } }

/* Dialog - opaque enough to block colour bleed from the kanban board behind it.
   The mockup used neutral gray ghosts so rgba(255,255,255,0.88) looked clean there.
   In the real app the saturated kanban bleeds through at that opacity. */
.home-prompt-dialog {
  background: rgba(255,255,255,0.97);
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: var(--radius-xl);
  padding: var(--space-28) var(--space-32) var(--space-24);
  width: min(700px, calc(100vw - var(--space-32)));
  box-shadow: var(--glass-shadow), var(--glass-shadow-inset), 0 20px 60px rgba(0,0,0,0.15);
}
[data-theme="dark"] .home-prompt-dialog {
  background: color-mix(in srgb, var(--dark-surface) 97%, transparent);
  border-color: rgba(255,255,255,0.12);
  box-shadow: var(--glass-shadow), 0 20px 60px rgba(0,0,0,0.4);
}

/* Greeting - from mockup .home-greeting */
.home-prompt-greeting {
  display: flex;
  align-items: center;
  gap: var(--space-10);
  margin-bottom: var(--space-4);
}
.home-prompt-greeting svg { color: var(--shadow-accent); flex-shrink: 0; }
.home-prompt-title { font-size: var(--text-xl); font-weight: var(--weight-bold); color: var(--text); }
.home-prompt-sub { font-size: var(--text-base); color: var(--text-secondary); margin-bottom: var(--space-20); }

/* 3-column card grid - from mockup .home-cards */
.home-prompt-cards {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-10);
  margin-bottom: var(--space-16);
}
@media (max-width: 520px) { .home-prompt-cards { grid-template-columns: 1fr; } }

/* Base card - exact values from mockup .home-card */
.home-prompt-card {
  background: var(--glass-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-16);
  display: flex;
  flex-direction: column;
  gap: var(--space-10);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow-glass), var(--shadow-card);
  text-align: left;
  width: 100%;
  font-family: var(--font);
}
.home-prompt-card:hover {
  background: var(--surface-raised);
  box-shadow: var(--shadow-glass), var(--shadow-hover);
}
.home-prompt-card.active {
  border-color: var(--accent-primary1);
  background: var(--surface-raised);
}
[data-theme="dark"] .home-prompt-card {
  background: var(--glass-card);
}
[data-theme="dark"] .home-prompt-card:hover {
  background: color-mix(in srgb, var(--glass-card) 90%, var(--glass-border));
}

/* Primary card - accent-tinted surface, same border-radius as siblings */
.home-prompt-card--primary {
  background: color-mix(in srgb, var(--accent-primary1) 12%, var(--surface-base));
  border-color: color-mix(in srgb, var(--accent-primary1) 35%, transparent);
}
.home-prompt-card--primary:hover {
  background: color-mix(in srgb, var(--accent-primary1) 18%, var(--surface-raised));
  border-color: color-mix(in srgb, var(--accent-primary1) 50%, transparent);
}
[data-theme="dark"] .home-prompt-card--primary {
  background: color-mix(in srgb, var(--accent-primary1) 14%, rgba(22,24,34,0.92));
  border-color: color-mix(in srgb, var(--accent-primary1) 40%, rgba(255,255,255,0.12));
}

/* Card icon - from mockup .hc-icon */
.hp-card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--accent) 15%, rgba(255,255,255,0.4));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--shadow-accent);
  flex-shrink: 0;
}
[data-theme="dark"] .hp-card-icon {
  background: color-mix(in srgb, var(--accent) 18%, rgba(22,24,34,0.8));
  color: var(--accent-text);
}
.home-prompt-card--primary .hp-card-icon {
  background: color-mix(in srgb, var(--accent) 28%, rgba(255,255,255,0.5));
}
[data-theme="dark"] .home-prompt-card--primary .hp-card-icon {
  background: color-mix(in srgb, var(--accent) 28%, rgba(22,24,34,0.8));
}
.hp-card-icon svg { display: block; }

/* Card text - from mockup .hc-title / .hc-desc / .hc-cta */
.hp-card-label { font-size: var(--text-md); font-weight: var(--weight-bold); color: var(--text); }
.hp-card-desc  { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.5; }
.hp-card-cta {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--shadow-accent);
}
.hp-file-input { display: none; }

/* Expandable input area - from mockup .home-input-area */
.hp-tell-area {
  background: var(--surface-base);
  border: 1px solid var(--border-outer);
  border-radius: var(--radius-lg);
  padding: var(--space-12) var(--space-14);
  margin-bottom: var(--space-12);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.04);
}
[data-theme="dark"] .hp-tell-area {
  background: rgba(22,24,34,0.6);
  border-color: var(--glass-border);
}
.hp-tell-area.hidden { display: none; }

/* Textarea - from mockup .home-input-area textarea */
.hp-textarea {
  width: 100%;
  min-height: 80px;
  resize: none;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font);
  font-size: var(--text-base);
  color: var(--text);
  line-height: 1.6;
}
.hp-textarea::placeholder { color: var(--text-tertiary, var(--content-tertiary)); }

/* Action row - from mockup .home-input-row */
.hp-tell-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-10);
  border-top: 1px solid var(--border-outer);
  margin-top: var(--space-4);
}

/* Mic button - from mockup .mic-btn */
.hp-mic-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-outer);
  background: var(--surface-raised);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s;
  flex-shrink: 0;
}
.hp-mic-btn:hover:not(:disabled) { color: var(--shadow-accent); border-color: var(--shadow-accent); }
.hp-mic-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.hp-mic-btn.recording {
  background: rgba(220,38,38,0.1);
  border-color: #dc2626;
  color: #dc2626;
  animation: hp-mic-pulse 1s ease-in-out infinite;
}
@keyframes hp-mic-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(220,38,38,0.3); }
  50%      { box-shadow: 0 0 0 6px rgba(220,38,38,0); }
}

/* Add / submit button - mirrors .modal-save */
.hp-add-btn {
  font-family: var(--font);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  min-height: 44px;
  padding: var(--space-10) 22px;
  border-radius: var(--radius-lg);
  border: none;
  background: var(--accent);
  color: var(--on-accent-primary1);
  cursor: pointer;
  transition: opacity 0.15s;
}
.hp-add-btn:hover { opacity: 0.88; }

/* Status banners */
.hp-confirm {
  display: block;
  margin-bottom: var(--space-12);
  padding: var(--space-10) var(--space-14);
  background: color-mix(in srgb, var(--accent) 10%, rgba(255,255,255,0.6));
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: var(--radius-lg);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--shadow-accent);
}
.hp-error {
  display: block;
  margin-top: var(--space-8);
  padding: var(--space-8) var(--space-12);
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--danger-text);
}
.hp-confirm.hidden, .hp-error.hidden { display: none; }

