:root {
  --font-sans: "Avenir Next", "Segoe UI Variable", "Segoe UI", sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --bg: #f2ede6;
  --bg-elevated: #fbf7f1;
  --surface: rgba(255, 252, 247, 0.82);
  --surface-strong: rgba(255, 253, 250, 0.96);
  --surface-muted: #f5ede3;
  --panel: rgba(255, 252, 247, 0.94);
  --text: #1d2630;
  --text-soft: #51606f;
  --text-subtle: #7c8792;
  --border: rgba(29, 38, 48, 0.1);
  --border-strong: rgba(29, 38, 48, 0.18);
  --accent: #0f766e;
  --accent-strong: #0b5752;
  --accent-soft: rgba(15, 118, 110, 0.12);
  --accent-warm: #c3722c;
  --accent-warm-soft: rgba(195, 114, 44, 0.14);
  --success: #2f855a;
  --success-soft: rgba(47, 133, 90, 0.14);
  --danger: #bb4d3e;
  --danger-soft: rgba(187, 77, 62, 0.14);
  --focus: rgba(15, 118, 110, 0.22);
  --shadow-sm: 0 6px 18px rgba(23, 31, 41, 0.06);
  --shadow-md: 0 12px 28px rgba(23, 31, 41, 0.1);
  --shadow-lg: 0 18px 42px rgba(23, 31, 41, 0.14);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --page-max: 1440px;
  --page-max-narrow: 1120px;
  --column-width: 300px;
  --column-collapsed-width: 3.25rem;
  --column-collapsed-height: 745px;
}

[data-theme="dark"] {
  --bg: #11161d;
  --bg-elevated: #161c25;
  --surface: rgba(24, 31, 40, 0.82);
  --surface-strong: rgba(28, 35, 46, 0.96);
  --surface-muted: #1d2530;
  --panel: rgba(18, 24, 32, 0.96);
  --text: #edf2f7;
  --text-soft: #c2c9d1;
  --text-subtle: #8b97a5;
  --border: rgba(237, 242, 247, 0.09);
  --border-strong: rgba(237, 242, 247, 0.18);
  --accent: #38b2ac;
  --accent-strong: #8fe4de;
  --accent-soft: rgba(56, 178, 172, 0.16);
  --accent-warm: #f2a65a;
  --accent-warm-soft: rgba(242, 166, 90, 0.16);
  --success: #68d391;
  --success-soft: rgba(104, 211, 145, 0.16);
  --danger: #fc8181;
  --danger-soft: rgba(252, 129, 129, 0.16);
  --focus: rgba(56, 178, 172, 0.24);
  --shadow-sm: 0 8px 18px rgba(0, 0, 0, 0.18);
  --shadow-md: 0 12px 28px rgba(0, 0, 0, 0.24);
  --shadow-lg: 0 18px 42px rgba(0, 0, 0, 0.34);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

html[data-theme="dark"] {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  position: relative;
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.5;
  background:
    radial-gradient(circle at top left, rgba(242, 166, 90, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.16), transparent 32%),
    linear-gradient(180deg, var(--bg-elevated), var(--bg));
}

body.panel-open,
body.confirm-modal-open {
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.26), transparent 80%);
  opacity: 0.22;
}

img {
  max-width: 100%;
  display: block;
}

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

p,
ul,
ol,
figure {
  margin: 0;
}

main {
  position: relative;
  z-index: 1;
  padding: 1.1rem 1rem 2rem;
}

button,
input,
select,
textarea {
  font: inherit;
  color: var(--text);
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    background-color 150ms ease,
    color 150ms ease,
    transform 150ms ease,
    opacity 150ms ease;
}

input,
select,
textarea {
  width: 100%;
  min-height: 2.55rem;
  padding: 0.64rem 0.78rem;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

textarea {
  min-height: 6.5rem;
  resize: vertical;
}

button {
  min-height: 2.4rem;
  padding: 0.58rem 0.82rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

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

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--focus);
}

code,
pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

code {
  display: inline-block;
  max-width: 100%;
  padding: 0.16rem 0.44rem;
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 0.83em;
}

pre {
  overflow-x: auto;
  padding: 0.85rem 0.95rem;
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  border: 1px solid var(--border);
}

pre code {
  padding: 0;
  background: transparent;
  border: 0;
  color: inherit;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 0;
}

.surface-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(22px);
}

.surface-card {
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.page-shell {
  max-width: var(--page-max);
  margin: 0 auto;
  display: grid;
  gap: 1rem;
}

.page-board .page-shell {
  padding-bottom: 5rem;
}

.page-shell > * {
  min-width: 0;
}

.page-shell--narrow {
  max-width: var(--page-max-narrow);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-subtle);
}

.page-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding: clamp(0.95rem, 2vw, 1.4rem);
  overflow: hidden;
}

.page-hero--board,
.page-hero--settings,
.page-hero--auth {
  position: relative;
}

.page-hero--board::after,
.page-hero--settings::after,
.page-hero--auth::after {
  content: "";
  position: absolute;
  inset: auto -4rem -5rem auto;
  width: 18rem;
  height: 18rem;
  border-radius: 999px;
  background: radial-gradient(circle, var(--accent-soft), transparent 68%);
  pointer-events: none;
}

.page-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 3.2vw, 3.1rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.page-subtitle {
  margin-top: 0.55rem;
  max-width: 54ch;
  color: var(--text-soft);
  font-size: 0.95rem;
}

.hero-copy {
  max-width: 60ch;
}

.hero-actions,
.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.hero-aside {
  display: grid;
  justify-items: end;
  gap: 0.55rem;
}

.stat-pill {
  min-width: 6.75rem;
  padding: 0.55rem 0.7rem;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.stat-value {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  line-height: 1;
  letter-spacing: -0.03em;
}

.stat-label {
  display: block;
  margin-top: 0.15rem;
  color: var(--text-subtle);
  font-size: 0.74rem;
}

.btn-primary,
.button-link.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #f7fbfb;
  border-color: transparent;
}

.btn-secondary,
.button-link.btn-secondary {
  background: var(--surface-strong);
  color: var(--text);
}

.btn-ghost,
.button-link.btn-ghost {
  background: transparent;
  box-shadow: none;
  color: var(--text-soft);
}

.btn-danger {
  color: var(--danger);
  background: var(--surface-strong);
}

.btn-small,
.button-link.btn-small {
  min-height: 2rem;
  padding: 0.42rem 0.65rem;
  border-radius: 10px;
  font-size: 0.82rem;
}

.btn-icon {
  width: 2.2rem;
  min-width: 2.2rem;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.4rem;
  padding: 0.58rem 0.82rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    background-color 150ms ease,
    color 150ms ease,
    transform 150ms ease;
}

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

.field-label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-soft);
}

.field-help {
  color: var(--text-subtle);
  font-size: 0.86rem;
}

.field-help--danger {
  color: var(--danger);
}

.pill,
.status-pill,
.meta-pill,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1;
}

.pill,
.badge {
  padding: 0.34rem 0.56rem;
  background: var(--surface-strong);
  color: var(--text-soft);
}

.badge--done {
  background: var(--success-soft);
  border-color: rgba(47, 133, 90, 0.24);
  color: var(--success);
}

.pill--error {
  background: rgba(187, 77, 62, 0.12);
  border-color: rgba(187, 77, 62, 0.24);
  color: var(--danger);
}

.badge--attention {
  background: var(--accent-warm-soft);
  border-color: rgba(195, 114, 44, 0.24);
  color: var(--accent-warm);
}

.muted {
  color: var(--text-subtle);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  padding: 0.7rem 1rem 0;
}

.nav-bar {
  max-width: var(--page-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 252, 247, 0.78);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(18px);
}

[data-theme="dark"] .nav-bar {
  background: rgba(16, 22, 30, 0.82);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  order: 1;
}

.brand-mark {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0.25rem;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.18), rgba(242, 166, 90, 0.28));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  border-radius: 8px;
}

.brand-copy {
  display: grid;
  gap: 0.1rem;
}

.brand-name {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
}

.brand-tag {
  color: var(--text-subtle);
  font-size: 0.62rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  order: 2;
}

.nav-spacer {
  flex: 1;
  order: 3;
}

.nav-collapsible-wrap {
  display: contents;
}

.nav-collapsible-menu {
  display: contents;
}

.nav-menu-toggle {
  display: none;
}

.nav-link {
  padding: 0.48rem 0.7rem;
  border-radius: 12px;
  color: var(--text-soft);
  font-weight: 700;
  font-size: 0.9rem;
}

.nav-link:hover,
.nav-link.is-active {
  background: var(--surface-strong);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border);
}

.user-menu {
  position: relative;
  order: 5;
  display: flex;
  align-items: center;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.22rem 0.5rem 0.22rem 0.22rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-strong);
}

.user-menu-toggle {
  font: inherit;
  color: inherit;
  appearance: none;
  cursor: pointer;
}

.user-menu-caret {
  color: var(--text-subtle);
  font-size: 0.7rem;
}

.user-chip img,
.user-chip .avatar-fallback {
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 999px;
  object-fit: cover;
  background: linear-gradient(135deg, var(--accent-soft), var(--accent-warm-soft));
}

.avatar-fallback {
  display: inline-grid;
  place-items: center;
  font-weight: 700;
  color: var(--accent-strong);
}

.user-name {
  font-size: 0.82rem;
  color: var(--text-soft);
}

.user-menu-popover {
  display: none;
  position: absolute;
  top: calc(100% + 0.6rem);
  right: 0;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 12rem;
  max-width: min(90vw, 16rem);
  padding: 0.45rem;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(22px);
  z-index: 45;
}

.user-menu-popover.open {
  display: flex;
}

.user-menu-link {
  display: block;
  width: 100%;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  color: var(--text-soft);
  font-weight: 700;
  font-size: 0.88rem;
  text-align: left;
  background: none;
  border: none;
  font-family: inherit;
  cursor: pointer;
}

.user-menu-link:hover,
.user-menu-link.is-active {
  background: var(--surface-strong);
  color: var(--text);
}

.user-menu-link--danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.user-menu-logout-form {
  display: block;
  width: 100%;
}

.user-menu-divider {
  height: 1px;
  margin: 0.35rem 0.1rem;
  background: var(--border);
}

.flash-stack {
  margin-top: 1.25rem;
}

.flash-message {
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.nav-filter-slot {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  order: 4;
}

/* The slot stays in the page so a move can fill it. contents keeps an empty
   slot from taking a flex gap, and lets the button join the row when present. */
#archive-done-slot {
  display: contents;
}

.board-task-search {
  width: 11rem;
  min-width: 0;
  min-height: 2rem;
  padding: 0.42rem 0.65rem;
  border-radius: 10px;
  font-size: 0.82rem;
}

.filter-bar-trigger-container {
  position: relative;
}

.filter-bar-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.filter-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.3rem;
  height: 1.3rem;
  padding: 0 0.32rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 700;
}

.filter-hidden-hint {
  margin-left: 0.5rem;
  color: var(--text-subtle);
  font-size: 0.78rem;
  white-space: nowrap;
}

.filter-bar-popover {
  display: none;
  position: absolute;
  top: calc(100% + 0.6rem);
  right: 0;
  flex-direction: column;
  gap: 0.65rem;
  min-width: 18rem;
  max-width: min(90vw, 22rem);
  max-height: calc(100vh - 5rem);
  overflow-y: auto;
  padding: 0.7rem;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(22px);
  z-index: 45;
}

.filter-bar-popover.open {
  display: flex;
}

.filter-bar-popover .filter-form {
  flex-direction: column;
  align-items: stretch;
}

.filter-bar-popover .filter-group {
  min-width: 100%;
}

.filter-bar-popover .board-filter-actions {
  margin-left: 0;
  justify-content: space-between;
}

.filter-group {
  min-width: min(100%, 13rem);
}

.filter-form {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.65rem;
}

.filter-active {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.filter-pill {
  min-height: auto;
  padding: 0.4rem 0.62rem;
  border-radius: 999px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  box-shadow: none;
  color: var(--text-soft);
  font-size: 0.8rem;
}

.filter-pill:hover {
  transform: none;
  box-shadow: none;
}

.filter-pill--solid {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg-elevated);
}

.filter-pill--danger {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--bg-elevated);
}

.board-filter-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-left: auto;
}

.save-filter-modal {
  width: min(24rem, calc(100vw - 1.5rem));
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
}

.save-filter-modal::backdrop {
  background: rgba(11, 16, 21, 0.42);
  backdrop-filter: blur(6px);
}

.save-filter-modal-card {
  display: grid;
  gap: 0.75rem;
  padding: 1.2rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius-lg) + 2px);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(24px);
}

.save-filter-modal-copy {
  display: grid;
  gap: 0.55rem;
}

.save-filter-modal-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.4rem;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.save-filter-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 0.3rem;
}

.board-columns {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 0.85rem;
  overflow-x: auto;
  padding: 0.1rem 0.05rem 0.6rem;
  min-width: 0;
}

.board-fab {
  position: fixed;
  right: 1.2rem;
  bottom: calc(1.2rem + env(safe-area-inset-bottom));
  z-index: 35;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 3.35rem;
  padding: 0.65rem 1rem 0.65rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(11, 87, 82, 0.18);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.22), transparent 62%),
    linear-gradient(135deg, var(--accent), #169b91);
  color: #fffaf2;
  box-shadow: 0 20px 34px rgba(11, 87, 82, 0.24);
}

.board-fab:hover {
  border-color: rgba(11, 87, 82, 0.28);
  box-shadow: 0 24px 40px rgba(11, 87, 82, 0.28);
}

[data-theme="dark"] .board-fab {
  border-color: rgba(143, 228, 222, 0.18);
  box-shadow: 0 20px 34px rgba(0, 0, 0, 0.34);
}

.board-fab-mark {
  width: 1.95rem;
  height: 1.95rem;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.18);
  font-size: 1.4rem;
  line-height: 1;
}

.board-fab-label {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.board-column {
  position: relative;
  flex: 1 1 var(--column-width);
  min-width: var(--column-width);
  padding: 0.8rem;
  min-height: 12rem;
  background: linear-gradient(180deg, rgba(255, 253, 250, 0.92), rgba(255, 251, 247, 0.8));
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  transition: flex-basis 0.22s ease, min-width 0.22s ease, max-width 0.22s ease;
}

[data-theme="dark"] .board-column {
  background: linear-gradient(180deg, rgba(27, 34, 45, 0.94), rgba(23, 30, 39, 0.84));
}

.board-column::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 16px;
  border-radius: 16px 16px 0 0;
  background: linear-gradient(90deg, var(--column-accent, var(--accent)), transparent 82%);
}

/* Narrow/mobile screens (the board is a single stacked column here, see the
   640px breakpoint below) keep the simpler height-collapse treatment: the
   column-collapsed-strip below is desktop-only. */
.board-column.is-collapsed {
  min-height: 0;
}

.board-column.is-collapsed .column-header {
  margin-bottom: 0;
}

/* Two classes to reliably beat the shared ".col-drag-handle { display:
   inline-grid }" utility rule below, which the strip also carries so it can
   act as the collapsed column's drag handle. */
.column-collapsed-strip.col-drag-handle {
  display: none;
}

@media (min-width: 641px) {
  .board-column.is-collapsed {
    /* Becomes the flex container for the strip below, instead of the usual
       block layout -- the strip fills it with flex-grow (a percentage height
       on the strip won't reliably resolve here, since this section's own
       height comes from a specified height, not stretch). Fixed (not
       stretched to match a tall sibling column) so the whole collapsed
       column, plus the header above it, fits on screen without scrolling. */
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 0 var(--column-collapsed-width);
    min-width: var(--column-collapsed-width);
    max-width: var(--column-collapsed-width);
    align-self: flex-start;
    height: var(--column-collapsed-height);
    padding: 0.6rem 0;
    overflow: hidden;
  }

  .board-column.is-collapsed::before {
    inset: 0 auto 0 0;
    width: 5px;
    height: auto;
    border-radius: 16px 0 0 16px;
    background: var(--column-accent, var(--accent));
  }

  .board-column.is-collapsed .column-header--collapsed {
    display: none;
  }

  .board-column.is-collapsed .column-collapsed-strip {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
  }
}

.column-collapsed-strip {
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0 0 0.5rem;
  background: none;
  border: none;
  cursor: grab;
}

.column-collapsed-strip:active {
  cursor: grabbing;
}

.column-collapsed-expand {
  flex-shrink: 0;
}

.column-collapsed-label {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: -0.01em;
}

/* Collapse/expand is animated via the View Transitions API (see hx-swap
   "transition:true" on the lane-hide/expand triggers and the per-lane
   view-transition-name set inline in _columns.html) -- browsers without
   support just apply the swap instantly, no fallback needed here. */
::view-transition-group(*) {
  animation-duration: 0.22s;
  animation-timing-function: ease;
}

.column-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
  margin-top: 0.5rem;
  min-width: 0;
}

.column-header-main {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  min-width: 0;
}

.column-kicker {
  margin: 0 0 0.18rem;
  color: var(--text-subtle);
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.column-title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.column-subtitle {
  margin-top: 0.22rem;
  color: var(--text-subtle);
  font-size: 0.78rem;
}

.column-header-tools {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.column-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.8rem;
  padding: 0.24rem 0.46rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
}

.status-drag-handle {
  width: 1.9rem;
  height: 1.9rem;
  min-height: 1.9rem;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  background: var(--surface-strong);
  color: var(--text-subtle);
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
}

.status-drag-handle:active {
  cursor: grabbing;
}

.status-row.status-dragging {
  opacity: 0.5;
}

.status-row.status-drag-over {
  border-top-color: var(--accent);
}

.col-drag-handle,
.col-actions-btn {
  width: 1.9rem;
  height: 1.9rem;
  min-height: 1.9rem;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  background: var(--surface-strong);
  color: var(--text-subtle);
  box-shadow: none;
}

.col-drag-handle {
  cursor: grab;
  user-select: none;
}

.col-drag-handle:active {
  cursor: grabbing;
}

.task-list {
  min-height: 4rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.task-empty {
  padding: 0.75rem;
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  color: var(--text-subtle);
  text-align: center;
  font-size: 0.9rem;
}

.task-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.75rem;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-strong);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.task-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--card-accent, var(--accent));
}

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

.task-card[data-status="backlog"] {
  --card-accent: #4f78ff;
}

.task-card[data-status="todo"] {
  --card-accent: var(--accent);
}

.task-card[data-status="in_progress"] {
  --card-accent: var(--accent-warm);
}

.task-card[data-status="done"] {
  --card-accent: var(--success);
}

.task-card--today {
  --card-accent: var(--accent-warm);
}

.task-card--overdue {
  --card-accent: var(--danger);
  border-color: rgba(187, 77, 62, 0.22);
  box-shadow: 0 10px 22px rgba(187, 77, 62, 0.08);
}

.task-card--complete {
  opacity: 0.84;
}

.task-card--editing {
  padding: 0.85rem;
}

.task-card--editing .form-grid--two {
  grid-template-columns: 1fr;
}

.task-card-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: flex-start;
  gap: 0.55rem;
  min-width: 0;
}

.task-card-heading {
  display: grid;
  gap: 0.28rem;
  min-width: 0;
  width: auto;
  max-width: 100%;
}

.task-card-id {
  display: inline-flex;
  width: fit-content;
  padding: 0.18rem 0.38rem;
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  color: var(--text-subtle);
  font-size: 0.68rem;
  font-weight: 700;
}

.task-title-btn {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  color: var(--text);
  text-align: left;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.task-title-btn:hover {
  color: var(--accent-strong);
  transform: none;
  box-shadow: none;
}

.task-card-notes {
  color: var(--text-soft);
  font-size: 0.86rem;
  line-height: 1.48;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.32rem;
}

.tag-pill {
  min-height: auto;
  padding: 0.26rem 0.5rem;
  background: var(--surface-muted);
  border-radius: 999px;
  border: 1px solid var(--border);
  box-shadow: none;
  color: var(--text-soft);
  font-size: 0.72rem;
  font-weight: 700;
}

.tag-pill:hover {
  transform: none;
  background: var(--accent-soft);
  color: var(--accent-strong);
  box-shadow: none;
}

.tag-pill-group {
  display: inline-flex;
  align-items: stretch;
}

.tag-pill-group .tag-pill {
  border-radius: 999px 0 0 999px;
  border-right: none;
}

.tag-pill--exclude {
  border-radius: 0 999px 999px 0 !important;
  border-left: 1px solid var(--border);
  padding-left: 0.42rem;
  padding-right: 0.42rem;
  font-weight: 400;
}

.tag-pill--exclude:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.meta-pill,
.status-pill {
  padding: 0.26rem 0.48rem;
  background: var(--accent-soft);
  border-color: rgba(15, 118, 110, 0.16);
  color: var(--accent-strong);
}

.meta-pill--warm {
  background: var(--accent-warm-soft);
  border-color: rgba(195, 114, 44, 0.16);
  color: var(--accent-warm);
}

.meta-pill--danger {
  background: var(--danger-soft);
  border-color: rgba(187, 77, 62, 0.16);
  color: var(--danger);
}

.meta-pill--success {
  background: var(--success-soft);
  border-color: rgba(47, 133, 90, 0.16);
  color: var(--success);
}

.task-card-actions {
  display: flex;
  align-items: center;
  margin-top: auto;
  justify-content: flex-end;
}

.task-action-row {
  display: flex;
  gap: 0.3rem;
  margin-left: auto;
  min-width: 0;
}

.task-panel-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(11, 16, 21, 0.28);
  backdrop-filter: blur(4px);
}

.task-panel-overlay.open {
  display: block;
}

.confirm-modal {
  width: min(30rem, calc(100vw - 1.5rem));
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
}

.confirm-modal::backdrop {
  background: rgba(11, 16, 21, 0.42);
  backdrop-filter: blur(6px);
}

.confirm-modal-card {
  display: grid;
  gap: 1.1rem;
  padding: 1.2rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius-lg) + 2px);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(24px);
}

.confirm-modal-copy {
  display: grid;
  gap: 0.55rem;
}

.confirm-modal-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.4rem;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.confirm-modal-message {
  color: var(--text-soft);
}

.confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
}

.task-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 91;
  width: min(32rem, 100vw);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--border);
  box-shadow: -12px 0 34px rgba(16, 22, 31, 0.14);
  backdrop-filter: blur(24px);
  overflow: auto;
  transform: translateX(100%);
  transition: transform 220ms ease;
}

.task-panel.open {
  transform: translateX(0);
}

.task-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.task-panel-header-copy {
  display: grid;
  gap: 0.4rem;
}

.task-panel-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.45rem;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.task-panel-subtitle {
  color: var(--text-soft);
  font-size: 0.84rem;
}

.task-panel-close {
  width: 2.2rem;
  min-width: 2.2rem;
  min-height: 2.2rem;
  padding: 0;
  border-radius: 10px;
  box-shadow: none;
}

.task-panel-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 0.9rem 1rem 1rem;
}

.task-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  padding: 0.75rem 1rem 0.9rem;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .task-panel-footer {
  background: rgba(14, 20, 28, 0.3);
}

.panel-footer-actions,
.panel-footer-secondary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.task-panel-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.task-panel-section {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.task-panel-status-select {
  width: 100%;
  min-height: 2.55rem;
}

.section-title {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-subtle);
}

.task-panel-notes {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-strong);
  padding: 0.8rem 0.9rem;
  line-height: 1.58;
}

.task-panel-notes > * + * {
  margin-top: 0.7rem;
}

.task-panel-notes p:first-child {
  margin-top: 0;
}

.task-panel-notes p:last-child {
  margin-bottom: 0;
}

.task-panel-notes ul,
.task-panel-notes ol {
  padding-left: 1.35rem;
}

.task-panel-notes li + li {
  margin-top: 0.4rem;
}

.task-panel-notes .rendered-checkbox-line {
  list-style: none;
  display: flex;
  align-items: flex-start;
  gap: 0.72rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.35), transparent 70%),
    var(--surface);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.task-panel-notes ul > .rendered-checkbox-line,
.task-panel-notes ol > .rendered-checkbox-line {
  margin-left: -1.35rem;
}

.task-panel-notes .rendered-checkbox-line--checked {
  color: var(--text-soft);
  background:
    linear-gradient(135deg, var(--accent-soft), transparent 82%),
    var(--surface);
}

.task-panel-notes .rendered-checkbox {
  position: relative;
  width: 1.12rem;
  height: 1.12rem;
  flex: 0 0 1.12rem;
  margin-top: 0.12rem;
  border-radius: 0.35rem;
  border: 1.5px solid var(--border-strong);
  background: var(--surface-strong);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 1px 2px rgba(23, 31, 41, 0.08);
}

.task-panel-notes .rendered-checkbox-line--checked .rendered-checkbox {
  border-color: var(--accent);
  background: var(--accent);
}

.task-panel-notes .rendered-checkbox-line--checked .rendered-checkbox::after {
  content: "";
  position: absolute;
  left: 0.32rem;
  top: 0.12rem;
  width: 0.26rem;
  height: 0.54rem;
  border: solid #fffaf2;
  border-width: 0 0.14rem 0.14rem 0;
  transform: rotate(45deg);
}

.task-panel-notes .rendered-checkbox-label {
  min-width: 0;
  flex: 1;
}

.task-panel-notes .rendered-checkbox-line--checked .rendered-checkbox-label {
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
  text-decoration-color: var(--text-subtle);
}

.panel-form,
.stack-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.form-grid {
  display: grid;
  gap: 0.9rem;
}

.form-grid--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.comment-card {
  padding: 0.7rem 0.8rem;
}

.comment-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0.55rem;
  color: var(--text-subtle);
  font-size: 0.78rem;
}

.activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
  max-height: 16rem;
  overflow-y: auto;
}

.activity-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  font-size: 0.85rem;
}

.activity-meta {
  font-size: 0.75rem;
}

.settings-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-card {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.settings-card--wide {
  grid-column: 1 / -1;
}

.card-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.3rem;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.card-subtitle {
  color: var(--text-soft);
  font-size: 0.88rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.tag-input {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  min-height: 2.55rem;
  padding: 0.35rem 0.5rem;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.tag-input:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--focus);
}

.tag-input-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.22rem 0.3rem 0.22rem 0.58rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.8rem;
  line-height: 1.2;
}

.tag-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  min-height: auto;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  color: inherit;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
}

.tag-chip-remove:hover {
  background: rgba(0, 0, 0, 0.08);
  transform: none;
  box-shadow: none;
}

.tag-input-field {
  flex: 1 1 6rem;
  min-width: 6rem;
  width: auto;
  min-height: 1.6rem;
  padding: 0.15rem 0.2rem;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.tag-input-field:focus-visible {
  outline: none;
  border: 0;
  box-shadow: none;
}

.tag-input-suggestions {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  max-height: 12rem;
  overflow-y: auto;
}

.tag-input-suggestions[hidden] {
  /* Author styles win over the UA stylesheet's [hidden]{display:none} even at
     equal specificity, so the `display: flex` above needs an explicit opt-out
     here -- otherwise setting the hidden property/attribute stops actually
     hiding anything, leaving an empty (but still visible) box. */
  display: none;
}

.tag-input-suggestion {
  width: 100%;
  min-height: auto;
  padding: 0.4rem 0.55rem;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  box-shadow: none;
  color: var(--text);
  font-size: 0.85rem;
}

.tag-input-suggestion:hover {
  background: var(--surface-muted);
  transform: none;
  box-shadow: none;
}

.checkbox-field {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0.8rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
}

.checkbox-field input {
  width: 1.05rem;
  min-height: 1.05rem;
  margin-top: 0.2rem;
  accent-color: var(--accent);
  cursor: pointer;
}

.checkbox-field:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.checkbox-group .checkbox-field {
  padding: 0.5rem 0.7rem;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.7rem;
}

.settings-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0.25rem;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.settings-subnav-link {
  flex: 1;
  min-width: max-content;
  text-align: center;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  color: var(--text-soft);
  font-weight: 700;
  font-size: 0.88rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.settings-subnav-link:hover {
  color: var(--text);
}

.settings-subnav-link.is-active {
  background: var(--surface-strong);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.status-color-input {
  width: 1.9rem;
  height: 1.9rem;
  min-height: 1.9rem;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: none;
  cursor: pointer;
  flex-shrink: 0;
}

.status-color-input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.status-color-input::-webkit-color-swatch {
  border: 1px solid var(--border);
  border-radius: 10px;
}

.status-color-input::-moz-color-swatch {
  border: 1px solid var(--border);
  border-radius: 10px;
}

.config-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}

.config-row:first-child {
  padding-top: 0;
  border-top: 0;
}

.config-main {
  flex: 1;
}

.config-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  font-weight: 700;
}

.config-description {
  margin-top: 0.35rem;
  color: var(--text-soft);
  font-size: 0.9rem;
}

.settings-empty-state {
  padding: 1rem 1.1rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
}

.settings-empty-state .field-help {
  margin: 0;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.75rem;
}

.inline-form > * {
  flex: 1 1 10rem;
}

.inline-form .checkbox-field {
  flex: 0 1 auto;
  min-width: 13rem;
}

.column-create-form {
  display: grid;
  gap: 0.75rem;
}

.settings-disclosure {
  border-top: 1px solid var(--border);
  padding-top: 0.85rem;
}

.settings-disclosure summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--accent);
  list-style: none;
}

.settings-disclosure summary::-webkit-details-marker {
  display: none;
}

.settings-disclosure .column-create-form {
  margin-top: 0.85rem;
}

.token-shell {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.token-value {
  flex: 1;
  min-width: 0;
  padding: 0.75rem;
  border-radius: 12px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  word-break: break-all;
}

.token-hint {
  color: var(--text-soft);
  font-size: 0.92rem;
}

.auth-shell {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(22rem, 0.9fr);
  gap: 1.5rem;
  align-items: stretch;
}

.auth-splash,
.auth-card {
  padding: clamp(1rem, 2vw, 1.4rem);
}

.auth-splash {
  display: grid;
  gap: 1.25rem;
  align-content: space-between;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
}

.auth-logo {
  width: 3rem;
  height: 3rem;
  padding: 0.46rem;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.22), rgba(242, 166, 90, 0.26));
  box-shadow: var(--shadow-md);
}

.auth-heading {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(2rem, 3.8vw, 3.5rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.auth-copy {
  max-width: 44ch;
  color: var(--text-soft);
  font-size: 0.94rem;
}

.auth-feature-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.auth-feature {
  padding: 0.45rem 0.65rem;
  border-radius: 12px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  font-weight: 700;
  color: var(--text-soft);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-note {
  color: var(--text-soft);
  font-size: 0.96rem;
}

.auth-code {
  text-align: center;
  letter-spacing: 0.38em;
  font-family: var(--font-serif);
  font-size: 2rem;
}

.auth-link {
  color: var(--accent-strong);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.EasyMDEContainer {
  margin-bottom: 0.3rem;
}

[data-theme="dark"] .CodeMirror,
[data-theme="dark"] .editor-toolbar,
[data-theme="dark"] .editor-statusbar {
  background: var(--surface-strong);
  color: var(--text);
  border-color: var(--border);
}

/* Opaque background (not --surface-strong's translucent rgba) — the preview pane
   sits directly over the raw CodeMirror text and a translucent fill lets it ghost through. */
[data-theme="dark"] .editor-preview {
  background: var(--surface-muted);
  color: var(--text);
  border-color: var(--border);
}

[data-theme="dark"] .editor-toolbar button {
  color: var(--text-soft);
}

[data-theme="dark"] .editor-toolbar button:hover,
[data-theme="dark"] .editor-toolbar button.active {
  background: var(--surface-muted);
  color: var(--text);
}

[data-theme="dark"] .CodeMirror-cursor {
  border-left-color: var(--text);
}

textarea:has(+ .EasyMDEContainer) {
  display: none !important;
}

.task-card[draggable="true"] {
  cursor: grab;
}

.task-card[draggable="true"]:active {
  cursor: grabbing;
}

.task-card.dragging,
.board-column.col-dragging {
  opacity: 0.42;
}

.task-card.drop-before {
  box-shadow: inset 0 4px 0 var(--accent);
}

.task-card.drop-after {
  box-shadow: inset 0 -4px 0 var(--accent);
}

.task-list.drag-over {
  padding: 0.3rem;
  border-radius: 24px;
  outline: 2px dashed var(--border-strong);
  outline-offset: 2px;
  background: rgba(255, 255, 255, 0.18);
}

.board-column.col-drag-over {
  outline: 2px dashed var(--border-strong);
  outline-offset: 4px;
}

@media (max-width: 1100px) {
  .settings-grid,
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .page-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-aside {
    justify-items: start;
    width: 100%;
  }

  .hero-stats {
    width: 100%;
  }

  .settings-card--wide {
    grid-column: auto;
  }
}

@media (max-width: 820px) {
  .site-header {
    padding-inline: 0.9rem;
  }

  .nav-bar {
    flex-wrap: wrap;
    border-radius: 16px;
  }

  .brand {
    margin-right: auto;
  }

  .nav-filter-slot {
    order: 5;
    flex-wrap: wrap;
    flex-basis: 100%;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
  }

  .nav-filter-slot:empty {
    display: none;
  }

  .nav-collapsible-wrap {
    display: block;
    position: relative;
    order: 3;
  }

  .nav-menu-toggle {
    display: inline-flex;
    width: 2.4rem;
    padding: 0;
    justify-content: center;
  }

  .nav-menu-icon {
    font-size: 1.05rem;
    line-height: 1;
  }

  .nav-collapsible-menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.6rem);
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    min-width: 14rem;
    max-width: min(90vw, 20rem);
    max-height: calc(100vh - 5rem);
    overflow-y: auto;
    padding: 0.6rem;
    border-radius: 12px;
    background: var(--panel);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(22px);
    z-index: 45;
  }

  .nav-collapsible-menu.open {
    display: flex;
  }

  .nav-collapsible-menu .nav-links {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .nav-spacer {
    display: none;
  }

  .filter-bar-popover {
    right: auto;
    left: 0;
  }

  .user-menu {
    order: 4;
  }

  .user-name,
  .user-menu-caret {
    display: none;
  }

  .user-chip {
    padding: 0.22rem;
  }

  .board-column {
    flex-basis: min(100%, 20rem);
    min-width: min(100%, 20rem);
  }

  .inline-form {
    display: grid;
  }

  .inline-form .checkbox-field {
    min-width: 0;
  }
}

@media (max-width: 640px) {
  main {
    padding: 0.85rem 0.75rem 1.5rem;
  }

  .page-title {
    font-size: clamp(1.65rem, 9vw, 2.45rem);
  }

  .page-subtitle {
    font-size: 0.96rem;
  }

  .filter-form,
  .settings-grid,
  .token-shell,
  .form-grid--two,
  .task-card-actions,
  .task-panel-footer {
    display: grid;
  }

  .filter-group,
  .board-filter-actions {
    min-width: 0;
    margin-left: 0;
  }

  .board-columns {
    flex-direction: column;
    overflow-x: visible;
  }

  .board-column {
    flex-basis: auto;
    min-width: 0;
    width: 100%;
  }

  .page-board .page-shell {
    padding-bottom: 5.5rem;
  }

  .board-fab {
    right: 0.75rem;
    left: 0.75rem;
    bottom: calc(0.75rem + env(safe-area-inset-bottom));
    justify-content: center;
  }

  .hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stat-pill {
    min-width: 0;
  }

  .task-action-row {
    margin-left: 0;
  }

  .task-panel {
    width: 100vw;
  }

  .confirm-modal {
    width: min(100vw - 1rem, 30rem);
  }

  .confirm-modal-actions {
    display: grid;
  }

  .save-filter-modal {
    width: min(100vw - 1rem, 24rem);
  }

  .save-filter-modal-actions {
    display: grid;
  }

  .task-panel-footer {
    justify-content: stretch;
  }

  .panel-footer-actions,
  .panel-footer-secondary {
    width: 100%;
  }

  .panel-footer-actions > *,
  .panel-footer-secondary > * {
    flex: 1;
  }

  .form-grid--two {
    grid-template-columns: 1fr;
  }

  input,
  select,
  textarea {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .hero-stats {
    grid-template-columns: 1fr;
  }

  .brand-tag {
    display: none;
  }
}

/* Calendar view */

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.2rem 0 0.6rem;
}

.calendar-month-label {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.page-calendar .page-shell {
  padding-bottom: 5.5rem;
}

.calendar-layout {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 0;
}

.calendar-grid-wrap {
  min-width: 0;
}

.calendar-nodate-pane {
  width: 100%;
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.calendar-nodate-title {
  margin: 0 0 0.6rem;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-subtle);
}

.calendar-nodate-list {
  display: flex;
  flex-flow: row wrap;
  gap: 0.65rem;
  min-height: 4rem;
}

.calendar-nodate-list .task-card {
  flex: 1 1 16rem;
}

.calendar-nodate-list .task-empty {
  flex: 1 1 100%;
}

.calendar-month-grid {
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface-strong);
  box-shadow: var(--shadow-md);
}

.calendar-weekday-row,
.calendar-week-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.calendar-weekday-row {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted);
}

.calendar-weekday {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-subtle);
}

.calendar-week-row + .calendar-week-row {
  border-top: 1px solid var(--border);
}

.calendar-day-cell {
  position: relative;
  min-height: 7rem;
  padding: 0.5rem;
  min-width: 0;
}

.calendar-day-cell + .calendar-day-cell {
  border-left: 1px solid var(--border);
}

.calendar-day-cell--outside {
  background: var(--surface-muted);
  opacity: 0.6;
}

.calendar-day-cell--today {
  background: var(--accent-soft);
}

.calendar-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.calendar-day-number {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-subtle);
}

.calendar-day-cell--today .calendar-day-number {
  color: var(--accent-strong);
}

.calendar-day-add {
  width: 1.5rem;
  height: 1.5rem;
  min-height: 1.5rem;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--text-subtle);
  box-shadow: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.calendar-day-cell:hover .calendar-day-add,
.calendar-day-add:focus-visible {
  opacity: 1;
}

.calendar-day-tasks {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-height: 1.5rem;
}

.task-card--compact {
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  padding: 0.28rem 0.4rem;
  border-radius: 8px;
  box-shadow: none;
}

.task-card--compact::before {
  display: none;
}

.task-card--compact .task-title-btn {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-card--compact.task-card--complete .task-title-btn {
  text-decoration: line-through;
  color: var(--text-subtle);
}

.task-card--compact.task-card--overdue {
  border-left: 2px solid var(--danger);
}

.cal-task-dot {
  width: 0.55rem;
  height: 0.55rem;
  min-width: 0.55rem;
  border-radius: 999px;
}

.cal-task-time {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-subtle);
  flex-shrink: 0;
}

.calendar-day-more {
  align-self: flex-start;
  padding: 0.1rem 0.4rem;
  font-size: 0.75rem;
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--accent-strong);
}

.calendar-day-more:hover {
  background: var(--surface-muted);
  transform: none;
}

.calendar-day-popover {
  display: none;
  position: absolute;
  top: calc(100% - 0.4rem);
  left: 0.3rem;
  right: 0.3rem;
  padding: 0.4rem;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 30;
  flex-direction: column;
  gap: 0.3rem;
}

.calendar-day-popover.open {
  display: flex;
}

.calendar-drop-zone.drag-over {
  padding: 0.25rem;
  border-radius: 12px;
  outline: 2px dashed var(--border-strong);
  outline-offset: 2px;
  background: rgba(255, 255, 255, 0.18);
}

@media (max-width: 640px) {
  .calendar-day-cell {
    min-height: 5rem;
  }

  .calendar-weekday {
    font-size: 0.62rem;
  }
}
