@font-face {
  font-family: "Kalam";
  src: url("/fonts/kalam.ttf") format("truetype");
}

/* ============================================
   CSS VARIABLES
   ============================================ */

:root {
  /* Density: ~1.125 makes 100% zoom feel like ~125%. Body stays 1rem; components scale. */
  --ui-scale: 1.125;
  /* Scaled radius. NOT scaled: shadows, 1px borders, media queries, layout widths (max-width etc). */
  --radius: calc(14px * var(--ui-scale));
  /* Spacing tokens: density-aware padding, margin, gap */
  --s-1: calc(1px * var(--ui-scale));
  --s-2: calc(2px * var(--ui-scale));
  --s-3: calc(3px * var(--ui-scale));
  --s-4: calc(4px * var(--ui-scale));
  --s-5: calc(5px * var(--ui-scale));
  --s-6: calc(6px * var(--ui-scale));
  --s-8: calc(8px * var(--ui-scale));
  --s-10: calc(10px * var(--ui-scale));
  --s-12: calc(12px * var(--ui-scale));
  --s-14: calc(14px * var(--ui-scale));
  --s-16: calc(16px * var(--ui-scale));
  --s-18: calc(18px * var(--ui-scale));
  --s-20: calc(20px * var(--ui-scale));
  --s-24: calc(24px * var(--ui-scale));
  --s-28: calc(28px * var(--ui-scale));
  --s-32: calc(32px * var(--ui-scale));
  --s-36: calc(36px * var(--ui-scale));
  --s-38: calc(38px * var(--ui-scale));
  --s-40: calc(40px * var(--ui-scale));
  --s-56: calc(56px * var(--ui-scale));
  /* Font tokens: calc(base-rem * scale); body remains 1rem */
  --fs-9: calc(0.5625rem * var(--ui-scale));
  --fs-10: calc(0.625rem * var(--ui-scale));
  --fs-11: calc(0.6875rem * var(--ui-scale));
  --fs-12: calc(0.75rem * var(--ui-scale));
  --fs-13: calc(0.8125rem * var(--ui-scale));
  --fs-14: calc(0.875rem * var(--ui-scale));
  --fs-15: calc(0.9375rem * var(--ui-scale));
  --fs-16: calc(1rem * var(--ui-scale));
  --fs-17: calc(1.0625rem * var(--ui-scale));
  --fs-18: calc(1.125rem * var(--ui-scale));
  --fs-20: calc(1.25rem * var(--ui-scale));
  --fs-21: calc(1.3125rem * var(--ui-scale));
  --fs-24: calc(1.5rem * var(--ui-scale));
  --fs-48: calc(3rem * var(--ui-scale));
  /* Scaled radii (999px pill shape left unscaled) */
  --radius-6: calc(6px * var(--ui-scale));
  --radius-8: calc(8px * var(--ui-scale));
  --radius-10: calc(10px * var(--ui-scale));
  --radius-12: calc(12px * var(--ui-scale));
  --radius-5: calc(5px * var(--ui-scale));

  --bg: #0b0f17;
  --panel: #111827;
  --panel2: #0f172a;
  --list-item-bg: #0f172a;
  --dashboard-stats-bg: #151d2e;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --border: rgba(255, 255, 255, 0.08);
  --accent: #60a5fa;
  --success: #22c55e;
  --danger: #ef4444;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --project-name-color: #EFBF04;
  --voice-command-icon-filter: invert(1);

  /* Sprint chip inversion (dark mode: light bg + dark text) */
  --chip-sprint-bg: #f5f5f5;
  --chip-sprint-text: #0b0f17;

  /* Hint to browser: use dark native form controls (e.g. date picker) to match app theme */
  color-scheme: dark;
}

/* Mobile: clamp to 1 so current behavior preserved; overrides density hooks */
@media (max-width: 767px) {
  :root,
  [data-density="comfortable"],
  [data-density="compact"] {
    --ui-scale: 1;
  }
}

/* ==========================================================================
   Capacitor server-selection bootstrap
   Scoped so the normal web/PWA and product auth shells remain unchanged.
   ========================================================================== */
#scrumboy-mobile-bootstrap {
  background: var(--bg);
  height: auto;
  inset: auto;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  position: relative;
  -webkit-overflow-scrolling: touch;
}

#scrumboy-mobile-bootstrap .mobile-bootstrap__container {
  background: var(--bg);
  display: flex;
  flex: none;
  flex-direction: column;
  justify-content: center;
  margin: 0 auto;
  max-width: 432px;
  min-height: 100dvh;
  overflow: visible;
  padding:
    max(var(--s-24), env(safe-area-inset-top))
    max(var(--s-16), env(safe-area-inset-right))
    max(var(--s-24), env(safe-area-inset-bottom))
    max(var(--s-16), env(safe-area-inset-left));
  width: 100%;
}

#scrumboy-mobile-bootstrap .mobile-bootstrap__brand {
  margin-bottom: var(--s-16);
}

#scrumboy-mobile-bootstrap .brand-text {
  height: var(--s-24);
}

#scrumboy-mobile-bootstrap .mobile-bootstrap__panel {
  width: 100%;
}

#scrumboy-mobile-bootstrap .mobile-bootstrap__helper {
  line-height: 1.5;
  margin: calc(-1 * var(--s-6)) 0 var(--s-16);
}

#scrumboy-mobile-bootstrap .mobile-bootstrap__field {
  display: flex;
  flex-direction: column;
}

#scrumboy-mobile-bootstrap .mobile-bootstrap__field .input {
  min-height: 44px;
}

#scrumboy-mobile-bootstrap .mobile-bootstrap__http-warning {
  color: color-mix(in srgb, var(--danger) 78%, var(--muted));
  font-size: var(--fs-12);
  line-height: 1.4;
  margin: var(--s-6) 0 0;
}

#scrumboy-mobile-bootstrap .mobile-bootstrap__status {
  line-height: 1.4;
  margin: 0;
  min-height: 2.8em;
}

#scrumboy-mobile-bootstrap .mobile-bootstrap__status--error {
  color: var(--danger);
}

#scrumboy-mobile-bootstrap .mobile-bootstrap__action {
  min-height: 44px;
  width: 100%;
}

#scrumboy-mobile-bootstrap .mobile-bootstrap__privacy {
  margin: 0;
  text-align: center;
}

#scrumboy-mobile-bootstrap .mobile-bootstrap__origin {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: var(--radius-12);
  line-height: 1.45;
  margin: 0 0 var(--s-12);
  overflow-wrap: anywhere;
  padding: var(--s-10) 12px;
  user-select: text;
  -webkit-user-select: text;
}

@media (max-width: 620px) {
  #scrumboy-mobile-bootstrap:focus-within .mobile-bootstrap__container {
    justify-content: flex-start;
    min-height: 140dvh;
  }
}

@media (max-height: 640px) {
  #scrumboy-mobile-bootstrap .mobile-bootstrap__container {
    justify-content: flex-start;
  }
}

/* Density hooks: no UI yet; override --ui-scale only */
[data-density="comfortable"] {
  --ui-scale: 1.2;
}
[data-density="compact"] {
  --ui-scale: 1;
}

[data-theme="light"] {
  /* Hint to browser: use light native form controls (e.g. date picker) to match app theme */
  color-scheme: light;

  --bg: #f7f7f4;
  --panel: #ede8e0;
  --panel2: #e5dfd5;
  --text: #111827;
  --muted: #6b7280;
  --border: rgba(0, 0, 0, 0.12);
  --accent: #3b82f6;
  --success: #16a34a;
  --danger: #dc2626;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  --project-name-color: #111827;
  --voice-command-icon-filter: invert(0);

  /* Sprint chip inversion (light mode: dark bg + light text) */
  --chip-sprint-bg: #111827;
  --chip-sprint-text: #e5e7eb;

  /* Button styles - customize these (keep as-is for rename/delete/create buttons) */
  --btn-bg: rgba(59, 130, 246, 0.1);
  --btn-border: rgba(59, 130, 246, 0.3);
  --btn-hover-border: rgba(59, 130, 246, 0.5);
  --btn-danger-bg: rgba(220, 38, 38, 0.1);
  --btn-danger-border: rgba(220, 38, 38, 0.3);
  --btn-danger-hover-border: rgba(220, 38, 38, 0.5);

  /* Input styles - customize these */
  --input-bg: #ffffff;
  --input-focus-border: rgba(59, 130, 246, 0.65);
  --input-focus-shadow: rgba(59, 130, 246, 0.15);

  /* Panel/Card/List styles - subtle beige palette for contrast */
  --panel-bg: #faf9f6;
  --card-bg: #f5f3ef;
  --list-item-bg: #f5f3ef;
  --dashboard-stats-bg: #ebe7e0;
  --list-item-hover-bg: #f0ede8;
  --card-hover-bg: #f0ede8;
  --project-grid-item-bg: #f5f3ef;
  --project-grid-item-hover-bg: #f0ede8;

  /* Landing page styles - customize these */
  --landing-card-bg: #ffffff;
  --landing-badge-bg: rgba(59, 130, 246, 0.12);
  --landing-badge-border: rgba(59, 130, 246, 0.35);
  --landing-badge-text: #1e40af;
  --landing-text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);

  /* Topbar - customize these */
  --topbar-bg: var(--bg);
  --topbar-border: var(--border);

  /* Style overrides - customize these directly */

  /* Buttons */
  /* .btn {
    background: var(--btn-bg);
    border-color: var(--btn-border);
  }
  .btn:hover {
    border-color: var(--btn-hover-border);
  }
  .btn--danger {
    background: var(--btn-danger-bg);
    border-color: var(--btn-danger-border);
  }
  .btn--danger:hover {
    border-color: var(--btn-danger-hover-border);
  } */

  /* Inputs */
  /* .input,
  .textarea,
  .select {
    background: var(--input-bg);
  }
  .input:focus,
  .textarea:focus,
  .select:focus {
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 4px var(--input-focus-shadow);
  } */

  /* Panels - subtle beige for contrast */
  .panel {
    background: var(--panel-bg);
  }

  /* Cards - subtle beige for contrast */
  .card {
    background: var(--card-bg);
  }

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

  /* List items - subtle beige for contrast */
  .list__item {
    background: var(--list-item-bg);
  }

  .list__item:hover {
    background: var(--list-item-hover-bg);
  }

  /* Dashboard stats items - same coloring as list items (section-card styled in base for both themes) */
  .dashboard-stats__item {
    background: var(--list-item-bg);
    border: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius-12);
    padding: var(--s-12) var(--s-10);
    margin-bottom: var(--s-8);
  }

  .dashboard-stats__item:last-child {
    margin-bottom: 0;
  }

  .dashboard-stats__item:hover {
    background: var(--list-item-hover-bg);
  }

  .dashboard-stats__wip-link:hover {
    background: var(--list-item-hover-bg);
  }

  /* Sprint section tab tints in light mode: current = green, other = yellow, unscheduled = red */
  .dashboard-project-group__section[data-sprint-section="active"] .dashboard-project-group__tab--sprint {
    background: rgba(34, 197, 94, 0.14);
    color: #15803d;
    border: 1px solid rgba(34, 197, 94, 0.4);
  }

  .dashboard-project-group__section[data-sprint-section="sprint"] .dashboard-project-group__tab--sprint {
    background: rgba(234, 179, 8, 0.14);
    color: #a16207;
    border: 1px solid rgba(234, 179, 8, 0.4);
  }

  .dashboard-project-group__section[data-sprint-section="unscheduled"] .dashboard-project-group__tab--sprint {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.35);
  }

  /* Dashboard ASSIGNED Current = green; WIP In progress = green, Testing = blue (light mode) */
  .dashboard-stats__value--current {
    color: #15803d;
  }

  .dashboard-stats__wip-in-progress {
    color: #15803d;
  }

  .dashboard-stats__wip-testing {
    color: #1d4ed8;
  }

  .dashboard-stats__value--total {
    color: #7c3aed;
  }

  /* Dashboard stats panel: lighter than default panel2, still darker than the stats cards (list-item-bg) */
  .dashboard-stats {
    background: #ebe7e0;
  }

  /* Project grid items - subtle beige for contrast */
  .project-grid__item {
    background: var(--project-grid-item-bg);
  }

  .project-grid__item:hover {
    background: var(--project-grid-item-hover-bg);
  }

  /* Column headers - white text on colored backgrounds (doing = In Progress, keys from API) */
  .col__head--backlog .col__title,
  .col__head--not_started .col__title,
  .col__head--doing .col__title,
  .col__head--in_progress .col__title,
  .col__head--testing .col__title,
  .col__head--done .col__title {
    color: #ffffff;
  }

  /* Column backgrounds - very light tint of header colors */
  .col[data-column="BACKLOG"] {
    background: #f5f5f7;
  }

  .col[data-column="NOT_STARTED"] {
    background: #fffbeb;
  }

  .col[data-column="IN_PROGRESS"] {
    background: #f0fdf4;
  }

  .col[data-column="TESTING"] {
    background: #eff6ff;
  }

  .col[data-column="DONE"] {
    background: #fef2f2;
  }

  /* Landing page */
  /* .landing__card {
    background: var(--landing-card-bg);
  }
  .landing__badge {
    background: var(--landing-badge-bg);
    border-color: var(--landing-badge-border);
    color: var(--landing-badge-text);
  }
  .landing__intro,
  .landing__note,
  .landing__card-text {
    text-shadow: var(--landing-text-shadow);
  } */

  /* Topbar */
  /* .topbar {
    background: var(--topbar-bg);
    border-bottom-color: var(--topbar-border);
  } */
}

/* ============================================
   BASE & RESET STYLES
   ============================================ */

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  transition: background-color 0.2s ease, color 0.2s ease;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Tahoma, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* App shell wallpaper (fixed stack behind #app; toggled via html[data-wallpaper-active]) */
.wallpaper-shell {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  display: none;
}

.wallpaper-shell.wallpaper-shell--visible {
  display: block;
}

.wallpaper-shell__image {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.wallpaper-shell__overlay {
  position: absolute;
  inset: 0;
  /* Dark theme: scrim over image for readability */
  background: rgba(11, 15, 23, 0.78);
}

[data-theme="light"] .wallpaper-shell__overlay {
  background: rgba(247, 247, 244, 0.82);
}

html[data-wallpaper-active] #app {
  position: relative;
  z-index: 1;
}

/* Let gutters show wallpaper; panels/cards keep solid surfaces */
html[data-wallpaper-active] .container {
  background: transparent;
}

html[data-wallpaper-active] .topbar {
  background: color-mix(in srgb, var(--topbar-bg) 86%, transparent);
}

/* Light mode + photo wallpaper: paler topbar mix reads as solid white — let more of the image show through. */
html[data-wallpaper-active][data-theme="light"][data-wallpaper-source="image"] .topbar {
  background: color-mix(in srgb, var(--bg) 36%, transparent);
}

/* Settings: match the rest of the shell when a wallpaper is active (native dialog backdrop is a separate layer). */
html[data-wallpaper-active] #settingsDialog.dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}
html[data-wallpaper-active][data-theme="light"] #settingsDialog.dialog::backdrop {
  background: rgba(247, 247, 244, 0.65);
}
html[data-wallpaper-active] #settingsDialog.dialog {
  background: color-mix(in srgb, var(--bg) 96%, transparent);
}
@media (min-width: 768px) {
  html[data-wallpaper-active] #settingsDialog.dialog {
    backdrop-filter: blur(8px);
  }
}

.page {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

/* ============================================
   LANDING PAGE
   ============================================ */

.landing-body {
  background:
    radial-gradient(800px 800px at 15% 20%, rgba(96, 165, 250, 0.14), transparent 60%),
    radial-gradient(620px 620px at 85% 0%, rgba(16, 185, 129, 0.12), transparent 55%),
    var(--bg);
  overflow: hidden;
  height: 100vh;
}

.landing {
  height: 100vh;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: var(--s-32) 0;
}

.landing__halo {
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 999px;
  filter: blur(120px);
  opacity: 0.75;
  z-index: 0;
}

.landing__halo--left {
  top: -140px;
  left: -120px;
  background: rgba(96, 165, 250, 0.35);
}

.landing__halo--right {
  bottom: -180px;
  right: -120px;
  background: rgba(16, 185, 129, 0.28);
}

.landing__content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 960px;
  padding: 0 var(--s-18);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-16);
  text-align: center;
  max-height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  /* Firefox */
  -ms-overflow-style: none;
  /* IE and Edge */
}

.landing__content::-webkit-scrollbar {
  display: none;
  /* Chrome, Safari, Opera */
}

.landing__logo {
  height: var(--s-56);
  width: auto;
  object-fit: contain;
}

.landing__intro {
  font-size: var(--fs-21);
  line-height: 1.4;
  color: var(--text);
  margin: var(--s-4) 0;
  max-width: 760px;
}

.landing__intro a {
  color: #2596be;
  text-decoration: none;
  font-weight: 500;
}

.landing__preview {
  width: 100%;
  max-width: 800px;
  max-height: 40vh;
  height: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: var(--s-12) 0;
  object-fit: contain;
}

@media (orientation: landscape) {
  .landing__preview {
    box-shadow: none;
  }
}

.btn--cta {
  background: linear-gradient(135deg, #fbbf24 0%, #d4a017 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #000000 !important;
  font-weight: 800;
  padding: var(--s-14) 28px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-10);
  font-size: var(--fs-17);
  letter-spacing: 0.2px;
  box-shadow: 0 18px 48px rgba(96, 165, 250, 0.25), 0 12px 28px rgba(20, 184, 166, 0.16);
  min-width: 260px;
  width: min(420px, 100%);
  transition: transform 120ms ease, box-shadow 160ms ease, filter 160ms ease;
  text-decoration: none;
}

.btn--cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 22px 52px rgba(96, 165, 250, 0.32), 0 14px 32px rgba(20, 184, 166, 0.2);
  filter: brightness(1.03);
}

.btn--cta:active {
  transform: translateY(0);
}

.landing__note {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-14);
  padding: 0 var(--s-18);
}

.landing__highlights {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--s-14);
  margin-top: var(--s-8);
}

.landing__card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--s-16);
  text-align: left;
  box-shadow: var(--shadow);
}

.landing__badge {
  display: inline-flex;
  align-items: center;
  padding: var(--s-6) 10px;
  border-radius: 999px;
  border: 1px solid rgba(96, 165, 250, 0.35);
  background: rgba(96, 165, 250, 0.12);
  color: #dbeafe;
  font-weight: 700;
  font-size: var(--fs-12);
  margin-bottom: var(--s-10);
}

.landing__card-title {
  font-weight: 800;
  font-size: var(--fs-16);
  margin-bottom: var(--s-6);
}

.landing__card-text {
  color: var(--muted);
  line-height: 1.5;
  font-size: var(--fs-14);
}

.landing__intro,
.landing__note,
.landing__card-text {
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}

@media (max-width: 720px) {
  .landing {
    padding: var(--s-20) 0;
  }

  .landing__logo {
    height: var(--s-40);
  }

  .landing__intro {
    font-size: var(--fs-16);
    line-height: 1.3;
  }

  .landing__preview {
    margin: var(--s-10) 0;
    max-width: 100%;
    max-height: 35vh;
  }

  .landing__content {
    gap: var(--s-12);
  }

  .btn--cta {
    width: 100%;
    padding: var(--s-12) 24px;
    font-size: var(--fs-15);
  }

  .landing__note {
    font-size: var(--fs-12);
  }

  .landing__highlights {
    gap: var(--s-12);
  }
}

/* ============================================
   LAYOUT COMPONENTS
   ============================================ */

.topbar {
  display: flex;
  align-items: center;
  gap: var(--s-10);
  padding: var(--s-14) 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.topbar::-webkit-scrollbar {
  display: none;
}


.project-image-topbar-btn {
  width: var(--s-32);
  height: var(--s-32);
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: var(--radius);
  overflow: hidden;
}

.project-image-topbar {
  width: 100%;
  height: 100%;
  border-radius: var(--radius);
  object-fit: cover;
}

.project-image-topbar-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-20);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--s-8);
  font-weight: 700;
  letter-spacing: 0.2px;
  min-width: 0;
  flex-shrink: 1;
}

.brand-logo {
  height: var(--s-32);
  width: auto;
  object-fit: contain;
  border-radius: 4px;
}

.brand-text {
  height: var(--s-24);
  width: auto;
  object-fit: contain;
}

.spacer {
  flex: 1;
}

.container {
  padding: var(--s-16);
  /* No max-width: expands fluidly on large viewports. Inner layout (board grid, lists) controls density. */
  width: 100%;
  margin: 0 auto;
  /* Use theme background so container is not white in light mode when body is white for PWA splash */
  background: var(--bg);
}

/* ============================================
   PANEL & VIEW COMPONENTS
   ============================================ */

.panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--s-16);
}

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s-16);
}

.panel__title {
  font-size: var(--fs-18);
  font-weight: 700;
  margin: 0;
}

.panel__header--dashboard {
  flex-wrap: wrap;
  gap: var(--s-8);
}

.dashboard-sort {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  max-width: min(100%, 320px);
}

.dashboard-sort__label {
  font-size: var(--fs-12);
  font-weight: 600;
  color: var(--muted);
  align-self: flex-start;
}

.dashboard-sort__select {
  min-width: 200px;
  max-width: 100%;
  font-size: var(--fs-14);
  border-radius: var(--radius-8);
  padding: 6px 10px;
}

.dashboard-sort__hint {
  font-size: 12px;
  line-height: 1.35;
  margin: 0 0 var(--s-12) 0;
  max-width: 48rem;
}

@media (max-width: 767px) {
  .panel__header--dashboard {
    flex-wrap: nowrap;
    align-items: center;
    gap: var(--s-10);
  }

  .panel__header--dashboard .panel__title {
    flex: 1 1 auto;
    min-width: 0;
  }

  .dashboard-sort {
    flex-direction: row;
    align-items: center;
    gap: 6px;
    max-width: none;
    flex: 0 0 auto;
  }

  .dashboard-sort__label {
    align-self: center;
    white-space: nowrap;
  }

  .dashboard-sort__select {
    min-width: 0;
    width: auto;
    max-width: min(148px, 46vw);
    font-size: var(--fs-12);
    padding: 4px 8px;
  }
}

.view-toggle {
  display: flex;
  gap: var(--s-4);
}

.view-toggle-btn {
  padding: var(--s-6) 10px;
  min-width: auto;
}

.view-toggle-btn--active {
  background: var(--panel);
  border-color: var(--accent);
}

.row {
  display: flex;
  gap: var(--s-10);
  align-items: center;
  margin-bottom: var(--s-12);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--s-10);
}

/* ============================================
   FORM ELEMENTS
   ============================================ */

.input,
.textarea,
.select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-12);
  padding: var(--s-10) 12px;
  outline: none;
}

.textarea {
  resize: vertical;
}

.todo-notes-editor {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.todo-notes-editor:focus-within {
  border-color: rgba(96, 165, 250, 0.65);
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.15);
}

.todo-notes-field .field__label-row {
  align-items: center;
}

.todo-notes-tabs {
  align-items: center;
  display: flex;
  flex-shrink: 0;
  gap: var(--s-6);
  margin-left: auto;
}

.todo-notes-tabs[hidden] {
  display: none;
}

.todo-notes-tab {
  appearance: none;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  color: color-mix(in srgb, var(--muted) 42%, transparent);
  cursor: pointer;
  font-size: var(--fs-10);
  font-weight: 600;
  line-height: 1.2;
  padding: 0;
  transition: color 0.15s ease;
}

.todo-notes-tab:hover {
  color: color-mix(in srgb, var(--muted) 58%, transparent);
}

.todo-notes-tab.is-active {
  color: color-mix(in srgb, var(--text) 50%, transparent);
}

.todo-notes-tab.is-active:hover {
  color: color-mix(in srgb, var(--text) 62%, transparent);
}

.todo-notes-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.todo-notes-field .todo-notes-input.todo-notes-input--drop-target {
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}

.todo-notes-field .todo-notes-input {
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.todo-notes-field .todo-notes-input:focus {
  border-color: transparent;
  box-shadow: none;
}

/* Visual notes editor: Markdown source with Scrumboy images shown inline (CodeMirror). */
.todo-notes-visual[hidden] {
  display: none;
}

#todoBodyEditor .cm-editor,
.public-todo__notes--surface .cm-editor {
  background: var(--bg);
  color: var(--text);
  max-height: min(60vh, calc(40rem * var(--ui-scale)));
  min-height: calc(8.75rem * var(--ui-scale));
}

#todoBodyEditor .cm-editor.cm-focused {
  outline: none;
}

#todoBodyEditor .cm-scroller,
.public-todo__notes--surface .cm-scroller {
  font-family: inherit;
  line-height: 1.5;
  overflow: auto;
}

#todoBodyEditor .cm-content,
.public-todo__notes--surface .cm-content {
  caret-color: var(--text);
  min-height: calc(8.75rem * var(--ui-scale));
  padding: var(--s-10) 12px;
}

#todoBodyEditor .cm-line,
.public-todo__notes--surface .cm-line {
  padding: 0;
}

#todoBodyEditor .cm-editor.todo-notes-visual__editor--drop-target {
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}

/*
 * The wrapper shrinks to the rendered image, so its outline and corner handles are the image's
 * bounds. The 320px default cap is on the wrapper: a percentage max-width on the image itself is
 * ignored when the wrapper sizes to its content, which made the wrapper as wide as the image's
 * natural width (up to the whole line) while the image showed at 320px.
 */
#todoBodyEditor .todo-notes-image--editor,
.public-todo__notes--surface .todo-notes-image--editor {
  display: inline-block;
  margin: var(--s-6) 0;
  max-width: min(320px, 100%);
  position: relative;
  vertical-align: top;
}

#todoBodyEditor .todo-notes-image--editor.todo-notes-image--sized,
.public-todo__notes--surface .todo-notes-image--editor.todo-notes-image--sized {
  max-width: 100%;
}

#todoBodyEditor .todo-notes-image--editor .todo-notes-image__img,
.public-todo__notes--surface .todo-notes-image--editor .todo-notes-image__img {
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  display: block;
  height: auto;
  max-height: 240px;
  max-width: 100%;
  width: auto;
}

#todoBodyEditor .todo-notes-image--editor.todo-notes-image--sized .todo-notes-image__img,
.public-todo__notes--surface .todo-notes-image--editor.todo-notes-image--sized .todo-notes-image__img {
  max-height: none;
}

#todoBodyEditor .todo-notes-image--editor.todo-notes-image--loading,
.public-todo__notes--surface .todo-notes-image--editor.todo-notes-image--loading {
  background: var(--panel2);
  border-radius: 4px;
  min-height: 48px;
  min-width: 64px;
}

#todoBodyEditor .todo-notes-image--editor.todo-notes-image--unavailable,
#todoBodyEditor .todo-notes-image--editor.todo-notes-image--uploading,
.public-todo__notes--surface .todo-notes-image--editor.todo-notes-image--unavailable,
.public-todo__notes--surface .todo-notes-image--editor.todo-notes-image--uploading {
  border: 1px dashed var(--border);
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--fs-12);
  padding: var(--s-6) var(--s-10);
}

#todoBodyEditor .todo-notes-image--editor.is-selected {
  border-radius: 5px;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#todoBodyEditor .has-selected-image .cm-content ::selection {
  background: transparent;
}

/*
 * Resize handle: one square grip centred on the image's bottom-right corner (bottom-left in
 * right-to-left text), a 24px hit area for touch, with a diagonal cursor: resizing keeps the
 * proportions, so both edges move together.
 */
#todoBodyEditor .todo-notes-image__handle {
  bottom: -12px;
  cursor: nwse-resize;
  display: none;
  height: 24px;
  inset-inline-end: -12px;
  position: absolute;
  touch-action: none;
  width: 24px;
}

[dir="rtl"] #todoBodyEditor .todo-notes-image__handle {
  cursor: nesw-resize;
}

#todoBodyEditor .todo-notes-image__handle::after {
  background: var(--accent);
  border: 2px solid var(--bg);
  border-radius: 2px;
  box-shadow: 0 0 0 1px var(--accent);
  content: "";
  height: 10px;
  left: 7px;
  position: absolute;
  top: 7px;
  width: 10px;
}

#todoBodyEditor .cm-editor:not(.is-readonly) .todo-notes-image--editor.is-selected:not(.todo-notes-image--unavailable) .todo-notes-image__handle {
  display: block;
}

.todo-notes-status {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

#todoDialog .todo-markdown-preview,
#publicTodoDialog .todo-markdown-preview {
  background: var(--panel2);
  color: var(--text);
  line-height: 1.6;
  min-height: calc(8.75rem * var(--ui-scale));
  overflow: auto;
  padding: var(--s-10) 12px;
}

#todoDialog .todo-markdown-preview--empty::before,
#publicTodoDialog .todo-markdown-preview--empty::before {
  color: var(--muted);
  content: "Nothing to preview yet.";
}

#todoDialog .todo-markdown-preview > :first-child,
#publicTodoDialog .todo-markdown-preview > :first-child {
  margin-top: 0;
}

#todoDialog .todo-markdown-preview > :last-child,
#publicTodoDialog .todo-markdown-preview > :last-child {
  margin-bottom: 0;
}

#todoDialog .todo-markdown-preview h1,
#publicTodoDialog .todo-markdown-preview h1,
#todoDialog .todo-markdown-preview h2,
#publicTodoDialog .todo-markdown-preview h2,
#todoDialog .todo-markdown-preview h3,
#publicTodoDialog .todo-markdown-preview h3,
#todoDialog .todo-markdown-preview h4,
#publicTodoDialog .todo-markdown-preview h4,
#todoDialog .todo-markdown-preview h5,
#publicTodoDialog .todo-markdown-preview h5,
#todoDialog .todo-markdown-preview h6,
#publicTodoDialog .todo-markdown-preview h6 {
  color: var(--text);
  line-height: 1.25;
  margin: var(--s-14) 0 var(--s-8);
}

#todoDialog .todo-markdown-preview h1,
#publicTodoDialog .todo-markdown-preview h1 {
  font-size: var(--fs-21);
}

#todoDialog .todo-markdown-preview h2,
#publicTodoDialog .todo-markdown-preview h2 {
  font-size: var(--fs-18);
}

#todoDialog .todo-markdown-preview h3,
#publicTodoDialog .todo-markdown-preview h3 {
  font-size: var(--fs-16);
}

#todoDialog .todo-markdown-preview p,
#publicTodoDialog .todo-markdown-preview p,
#todoDialog .todo-markdown-preview ul,
#publicTodoDialog .todo-markdown-preview ul,
#todoDialog .todo-markdown-preview ol,
#publicTodoDialog .todo-markdown-preview ol,
#todoDialog .todo-markdown-preview blockquote,
#publicTodoDialog .todo-markdown-preview blockquote,
#todoDialog .todo-markdown-preview pre,
#publicTodoDialog .todo-markdown-preview pre {
  margin: 0 0 var(--s-10);
}

#todoDialog .todo-markdown-preview ul,
#publicTodoDialog .todo-markdown-preview ul,
#todoDialog .todo-markdown-preview ol,
#publicTodoDialog .todo-markdown-preview ol {
  padding-left: calc(1.35rem * var(--ui-scale));
}

#todoDialog .todo-markdown-preview li + li,
#publicTodoDialog .todo-markdown-preview li + li {
  margin-top: var(--s-4);
}

#todoDialog .todo-markdown-preview blockquote,
#publicTodoDialog .todo-markdown-preview blockquote {
  border-left: 3px solid rgba(96, 165, 250, 0.55);
  color: rgba(229, 231, 235, 0.92);
  margin-left: 0;
  padding-left: var(--s-12);
}

#todoDialog .todo-markdown-preview code,
#publicTodoDialog .todo-markdown-preview code {
  background: rgba(15, 23, 42, 0.95);
  border-radius: var(--radius-8);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: var(--fs-13);
  padding: 0.15em 0.4em;
}

#todoDialog .todo-markdown-preview pre,
#publicTodoDialog .todo-markdown-preview pre {
  background: rgba(2, 6, 23, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: var(--radius-10);
  overflow-x: auto;
  padding: var(--s-10);
}

#todoDialog .todo-markdown-preview pre code,
#publicTodoDialog .todo-markdown-preview pre code {
  background: transparent;
  border-radius: 0;
  display: block;
  padding: 0;
}

#todoDialog .todo-markdown-preview .todo-mermaid-host,
#publicTodoDialog .todo-markdown-preview .todo-mermaid-host {
  margin: 0 0 var(--s-10);
}

/* Inline note images (Scrumboy-managed assets only; created after sanitization). */
#todoDialog .todo-markdown-preview .todo-notes-image,
#publicTodoDialog .todo-markdown-preview .todo-notes-image {
  display: block;
  margin: var(--s-6) 0;
  max-width: 100%;
}

#todoDialog .todo-markdown-preview .todo-notes-image__img,
#publicTodoDialog .todo-markdown-preview .todo-notes-image__img {
  border: 1px solid var(--border);
  border-radius: 4px;
  display: block;
  height: auto;
  max-height: 240px;
  max-width: min(320px, 100%);
  width: auto;
}

/* A stored width (![alt|480](...)) sets the width; the container still caps it. */
#todoDialog .todo-markdown-preview .todo-notes-image--sized .todo-notes-image__img,
#publicTodoDialog .todo-markdown-preview .todo-notes-image--sized .todo-notes-image__img {
  max-height: none;
  max-width: 100%;
}

#todoDialog .todo-markdown-preview .todo-notes-image--loading,
#publicTodoDialog .todo-markdown-preview .todo-notes-image--loading {
  min-height: 48px;
}

#todoDialog .todo-markdown-preview .todo-notes-image--unavailable,
#publicTodoDialog .todo-markdown-preview .todo-notes-image--unavailable {
  border: 1px dashed var(--border);
  border-radius: 4px;
  color: var(--muted);
  font-size: var(--fs-12);
  padding: var(--s-6) var(--s-10);
}

#todoDialog .todo-markdown-preview .todo-mermaid-status,
#publicTodoDialog .todo-markdown-preview .todo-mermaid-status {
  color: var(--muted);
  font-size: var(--fs-12);
  margin: 0 0 var(--s-6);
}

#todoDialog .todo-markdown-preview .todo-mermaid-status--error,
#publicTodoDialog .todo-markdown-preview .todo-mermaid-status--error {
  color: #ffb4b4;
}

#todoDialog .todo-markdown-preview .todo-mermaid-status--warning,
#publicTodoDialog .todo-markdown-preview .todo-mermaid-status--warning {
  color: #f5c46b;
}

#todoDialog .todo-markdown-preview .todo-mermaid-canvas,
#publicTodoDialog .todo-markdown-preview .todo-mermaid-canvas {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: var(--radius-10);
  color: var(--text);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: var(--fs-13);
  overflow-x: auto;
  padding: var(--s-10);
  white-space: pre-wrap;
}

#todoDialog .todo-markdown-preview .todo-mermaid-host--ready .todo-mermaid-canvas,
#publicTodoDialog .todo-markdown-preview .todo-mermaid-host--ready .todo-mermaid-canvas {
  background: transparent;
  border: 0;
  font-family: inherit;
  font-size: inherit;
  overflow: visible;
  padding: 0;
  white-space: normal;
}

#todoDialog .todo-markdown-preview .todo-mermaid-host--ready .todo-mermaid-canvas > svg,
#publicTodoDialog .todo-markdown-preview .todo-mermaid-host--ready .todo-mermaid-canvas > svg,
#todoDialog .todo-markdown-preview .todo-mermaid-host--ready .todo-mermaid-canvas > iframe,
#publicTodoDialog .todo-markdown-preview .todo-mermaid-host--ready .todo-mermaid-canvas > iframe {
  background: transparent;
  border: 0;
  display: block;
  margin: 0 auto;
  max-width: 100%;
}

#todoDialog .todo-markdown-preview a,
#publicTodoDialog .todo-markdown-preview a {
  color: #8cc4ff;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.15em;
}

#todoDialog .todo-markdown-preview hr,
#publicTodoDialog .todo-markdown-preview hr {
  border: 0;
  border-top: 1px solid rgba(148, 163, 184, 0.28);
  margin: var(--s-14) 0;
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: rgba(96, 165, 250, 0.65);
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.15);
}

/* Password row: one horizontal field (input + toggle). Button adjacent on mobile so Android Chrome shows it. */
.password-row {
  display: flex;
  align-items: stretch;
  width: 100%;
  gap: 0;
  border-radius: var(--radius-12);
  border: 1px solid var(--border);
  background: var(--bg);
  overflow: hidden;
}

.password-row .input {
  flex: 1;
  min-width: 0;
  width: auto;
  padding: var(--s-10) 12px;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.password-row .input:focus {
  box-shadow: none;
  border: none;
  outline: none;
  border-color: transparent;
}

.password-row:focus-within {
  border-color: rgba(96, 165, 250, 0.65);
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.15);
}

.password-toggle {
  flex-shrink: 0;
  min-width: calc(44px * var(--ui-scale));
  width: calc(44px * var(--ui-scale));
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: none;
  border-left: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  transition: none;
  opacity: 1 !important;
  -webkit-tap-highlight-color: transparent;
}

.password-toggle:hover,
.password-toggle:focus,
.password-toggle:active {
  outline: none;
  color: var(--muted);
  opacity: 1 !important;
  background: var(--bg);
}

/* Auth page: password row and toggle use same dark background as email field (all viewports). */
.page--auth .topbar {
  overflow: visible;
  z-index: 20;
}

.page--auth .topbar .auth-locale-select {
  width: auto;
  min-width: 150px;
  max-width: min(42vw, 220px);
  flex: 0 0 auto;
}

.locale-picker {
  position: relative;
  display: inline-block;
}

.locale-picker__button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  cursor: pointer;
}

.locale-picker__flag {
  display: block;
  width: auto;
  height: 16px;
  flex: 0 0 auto;
  object-fit: contain;
  border-radius: 1px;
}

.locale-picker__label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.locale-picker__list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 40;
  min-width: 100%;
  max-height: min(60dvh, 320px);
  margin: 0;
  padding: 4px 0;
  list-style: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

#settingsDialog .locale-picker__list {
  max-height: min(45dvh, 320px);
}

@media (max-width: 620px), (max-height: 640px) {
  .locale-picker__list {
    max-height: 280px;
  }

  #settingsDialog .locale-picker__list {
    max-height: 260px;
  }
}

.locale-picker__option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
}

.locale-picker__option:hover,
.locale-picker__option--highlight {
  background: var(--surface-hover, rgba(255, 255, 255, 0.06));
}

.locale-picker__option[aria-selected="true"] {
  font-weight: 600;
}

.page--auth .password-row {
  background: var(--bg);
}

.page--auth .password-row .input {
  background: var(--bg);
}

.page--auth .password-toggle {
  background: var(--bg);
}

.page--auth .password-toggle:hover,
.page--auth .password-toggle:focus,
.page--auth .password-toggle:active {
  background: var(--bg);
}

.password-toggle__icon {
  transition: none;
  opacity: 1 !important;
  display: block;
}

/* Desktop: overlay button inside input (single rounded field). */
@media (pointer: fine) and (min-width: 769px) {
  .password-row {
    position: relative;
    overflow: visible;
  }

  .password-row .input {
    padding-right: 2.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-12);
    background: var(--bg);
  }

  .password-row .input:focus {
    border-color: rgba(96, 165, 250, 0.65);
    box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.15);
  }

  .password-row:focus-within {
    border: none;
    box-shadow: none;
  }

  .password-toggle {
    position: absolute;
    right: var(--s-8);
    top: 50%;
    transform: translateY(-50%);
    width: auto;
    min-width: 0;
    padding: var(--s-4);
    border: none;
    border-left: none;
    background: transparent;
  }

  .password-toggle:hover,
  .password-toggle:focus,
  .password-toggle:active {
    outline: none;
    color: var(--muted);
    opacity: 1 !important;
    background: transparent;
  }

  .page--auth .password-toggle,
  .page--auth .password-toggle:hover,
  .page--auth .password-toggle:focus,
  .page--auth .password-toggle:active {
    background: transparent;
  }
}

.field__label {
  color: var(--muted);
  font-size: var(--fs-12);
  font-weight: 700;
  margin-bottom: var(--s-6);
}

.field__label-row {
  align-items: center;
  display: flex;
  gap: var(--s-8);
  justify-content: space-between;
  margin-bottom: var(--s-6);
}

.field__label-row .field__label {
  margin-bottom: 0;
}

.field__label[title],
.chip[title],
#searchInput[title],
.card__points[title],
.card__priority[title] {
  cursor: help;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  background: rgba(96, 165, 250, 0.18);
  border: 1px solid rgba(96, 165, 250, 0.35);
  color: var(--text);
  border-radius: var(--radius-12);
  padding: var(--s-10) 12px;
  cursor: pointer;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
}


.btn:hover:not(:disabled) {
  border-color: rgba(96, 165, 250, 0.55);
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  background: rgba(96, 165, 250, 0.1);
  border-color: rgba(96, 165, 250, 0.2);
  color: var(--muted);
}

.btn--ghost {
  background: transparent;
  border-color: var(--border);
}

.btn--ghost:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.15);
}

.btn--ghost:disabled,
.btn--ghost[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  color: var(--muted);
}

.btn--danger {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.32);
}

.btn--danger:hover:not(:disabled) {
  border-color: rgba(239, 68, 68, 0.55);
}

.btn--danger:disabled,
.btn--danger[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.2);
  color: var(--muted);
}

.btn--success {
  background: color-mix(in srgb, var(--success) 12%, transparent);
  border-color: color-mix(in srgb, var(--success) 32%, transparent);
}

.btn--success:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--success) 55%, transparent);
}

.btn--success:disabled,
.btn--success[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  background: color-mix(in srgb, var(--success) 8%, transparent);
  border-color: color-mix(in srgb, var(--success) 20%, transparent);
  color: var(--muted);
}

.btn--sso {
  display: block;
  width: 100%;
  text-align: center;
  padding: 10px 16px;
  text-decoration: none;
  background: rgba(96, 165, 250, 0.22);
  border: 1px solid rgba(96, 165, 250, 0.4);
  font-weight: 500;
}
.btn--sso:hover {
  background: rgba(96, 165, 250, 0.32);
  border-color: rgba(96, 165, 250, 0.6);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--muted);
  font-size: var(--fs-13);
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.page--auth .auth-actions {
  flex-wrap: wrap;
}

.btn--small {
  padding: var(--s-6) 10px;
  border-radius: var(--radius-10);
  font-size: var(--fs-13);
}

.hamburger {
  font-size: var(--fs-18);
  line-height: 1;
  display: inline-block;
}

.user-avatar {
  width: var(--s-36);
  height: var(--s-36);
  border: none;
  margin: 0;
  padding: 0;
  font: inherit;
  border-radius: 50%;
  background: var(--accent, #3B82F6);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-14);
  font-weight: 600;
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.2s ease;
  overflow: hidden;
}

.user-avatar__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.user-avatar__initials {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.user-avatar:hover {
  opacity: 0.8;
}

.user-avatar:focus {
  outline: 2px solid var(--accent, #3B82F6);
  outline-offset: 2px;
}

/* ============================================
   DIALOGS / MODALS
   ============================================ */

.dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  width: min(720px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  height: max-content;
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow);
  margin: 0;
  /* Dialog will dynamically resize to fit content while staying centered */
  /* height: max-content ensures it adapts to content size */
}

/* Settings modal: wide enough to fit all tabs on one line, no horizontal scrollbar */
/* Content has fixed max height so modal doesn't grow; user scrolls inside modal to see all (e.g. both charts) */
#settingsDialog .dialog__content {
  max-height: 60vh;
  overflow-y: auto;
}

/* Charts tab: hide scrollbar until user scrolls, then hide again after scrolling stops */
#settingsDialog .dialog__content.settings-content--charts {
  scrollbar-width: none;
}
#settingsDialog .dialog__content.settings-content--charts::-webkit-scrollbar {
  width: 0;
  height: 0;
}
#settingsDialog .dialog__content.settings-content--charts.scrollbar-visible {
  scrollbar-width: auto;
}
#settingsDialog .dialog__content.settings-content--charts.scrollbar-visible::-webkit-scrollbar {
  width: 8px;
  height: 0;
}
#settingsDialog .dialog__content.settings-content--charts.scrollbar-visible::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
#settingsDialog .dialog__content.settings-content--charts.scrollbar-visible::-webkit-scrollbar-track {
  background: transparent;
}
@media (min-width: 768px) {
  #settingsDialog.dialog {
    width: min(960px, calc(100vw - 48px));
  }
  #settingsDialog .dialog__content {
    overflow-x: hidden;
    min-width: 0;
  }
  /* Desktop only: Profile tab has no vertical scrollbar */
  #settingsDialog .dialog__content.settings-content--profile {
    scrollbar-width: none;
  }
  #settingsDialog .dialog__content.settings-content--profile::-webkit-scrollbar {
    width: 0;
    height: 0;
  }
}

/* RTL mobile: explicitly viewport-center the Settings shell to avoid off-screen horizontal drift. */
@media (max-width: 767px) {
  [dir="rtl"] #settingsDialog.dialog {
    left: 0;
    right: 0;
    margin-left: auto;
    margin-right: auto;
    transform: translateY(-50%);
    width: min(720px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    box-sizing: border-box;
  }
}

@media (max-width: 620px) {
  [dir="rtl"] #settingsDialog.dialog {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
  }
}

.dialog[open] {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.dialog::backdrop {
  background: rgba(0, 0, 0, 0.75);
}

.dialog__form {
  padding: var(--s-14);
  display: flex;
  flex-direction: column;
  gap: var(--s-12);
  flex: 0 0 auto;
}

.dialog__header {
  display: flex;
  align-items: center;
  gap: var(--s-10);
  justify-content: space-between;
}

.dialog__header-right {
  display: flex;
  align-items: center;
  gap: var(--s-8);
  min-width: 0;
}

#todoDialog .dialog__header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
}

#todoDialog .dialog__title {
  grid-column: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#todoDialog .dialog__header-right {
  grid-column: 3;
  justify-self: end;
  max-width: 100%;
}

.todo-dialog-overdue {
  color: var(--danger);
  font-size: var(--fs-13);
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

#todoDialog .todo-dialog-overdue {
  grid-column: 2;
  justify-self: center;
}

.todo-dialog-overdue[hidden] {
  display: none;
}

.voice-command-trigger,
#newTodoBtn,
#deleteProjectBtn,
#wallBtn,
#archiveBtn,
#manageMembersBtn {
  white-space: nowrap;
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.voice-command-trigger svg,
.voice-command-trigger img,
#newTodoBtn img,
#deleteProjectBtn img,
#wallBtn img,
#archiveBtn img,
#manageMembersBtn img {
  width: 20px;
  height: 20px;
  max-width: 20px;
  max-height: 20px;
  fill: currentColor;
  flex: 0 0 auto;
}

.voice-command-trigger img,
#newTodoBtn img,
#deleteProjectBtn img,
#wallBtn img,
#archiveBtn img,
#manageMembersBtn img {
  display: block;
  filter: var(--voice-command-icon-filter);
  object-fit: contain;
}

.voice-command-dialog.dialog {
  width: min(560px, calc(100vw - 32px));
}

.voice-agent {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 1400;
  width: min(340px, calc(100vw - 32px));
  display: grid;
  gap: var(--s-10);
  padding: 12px;
  color: var(--text);
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius-12);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.voice-agent__topline,
.voice-agent__identity,
.voice-agent__controls,
.voice-agent__confirmation-actions {
  display: flex;
  align-items: center;
}

.voice-agent__topline {
  justify-content: space-between;
  gap: var(--s-10);
}

.voice-agent__identity,
.voice-agent__controls,
.voice-agent__confirmation-actions {
  gap: var(--s-8);
}

.voice-agent__identity {
  min-width: 0;
  font-size: var(--fs-13);
  font-weight: 700;
}

.voice-agent__icon-button {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 20px;
}

.voice-agent__icon-button:hover,
.voice-agent__icon-button:focus-visible {
  color: var(--text);
  background: var(--panel2);
}

.voice-agent__wave {
  width: 38px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 999px;
  color: var(--accent);
}

.voice-agent__wave span {
  width: 3px;
  height: 5px;
  border-radius: 999px;
  background: currentColor;
  transform-origin: center;
}

.voice-agent[data-activity="listening"] {
  border-color: color-mix(in srgb, var(--accent) 70%, var(--border));
  box-shadow: var(--shadow), 0 0 24px color-mix(in srgb, var(--accent) 38%, transparent);
}

.voice-agent[data-activity="listening"] .voice-agent__wave span {
  animation: voice-agent-listening 0.7s ease-in-out infinite alternate;
}

.voice-agent[data-activity="listening"] .voice-agent__wave span:nth-child(2),
.voice-agent[data-activity="listening"] .voice-agent__wave span:nth-child(4) {
  animation-delay: -0.35s;
}

.voice-agent[data-activity="listening"] .voice-agent__wave span:nth-child(3) {
  animation-delay: -0.55s;
}

.voice-agent[data-activity="processing"] .voice-agent__wave {
  animation: voice-agent-processing 0.85s ease-in-out infinite;
}

.voice-agent[data-state="question"] .voice-agent__wave,
.voice-agent[data-state="confirmation"] .voice-agent__wave {
  color: #f59e0b;
}

.voice-agent[data-state="success"] .voice-agent__wave {
  color: #22c55e;
}

.voice-agent[data-state="error"] .voice-agent__wave {
  color: var(--danger);
}

.voice-agent__status {
  min-height: 20px;
  color: var(--muted);
  font-size: var(--fs-13);
  line-height: 1.4;
}

.voice-agent__activity {
  min-height: 20px;
  color: var(--accent);
  font-size: var(--fs-13);
  line-height: 1.4;
}

.voice-agent__activity[hidden] {
  display: none;
}

.voice-agent__confirmation {
  display: grid;
  gap: var(--s-10);
  padding: var(--s-10);
  border: 1px solid var(--border);
  border-radius: var(--radius-8);
  background: var(--panel2);
}

.voice-agent__confirmation[hidden],
.voice-agent__controls [hidden],
.voice-agent__continue[hidden] {
  display: none;
}

.voice-agent__summary {
  overflow-wrap: anywhere;
  line-height: 1.4;
}

.voice-agent__confirmation-actions {
  justify-content: flex-end;
}

.voice-agent__controls {
  flex-wrap: wrap;
}

.voice-agent__continue {
  margin-top: 0;
}

@keyframes voice-agent-listening {
  from { transform: scaleY(1); }
  to { transform: scaleY(3.6); }
}

@keyframes voice-agent-processing {
  0%, 100% { transform: translateX(-3px); opacity: 0.55; }
  50% { transform: translateX(3px); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .voice-agent[data-activity="listening"] .voice-agent__wave span,
  .voice-agent[data-activity="processing"] .voice-agent__wave {
    animation: none;
  }

  .voice-agent[data-activity="listening"] .voice-agent__wave span:nth-child(2),
  .voice-agent[data-activity="listening"] .voice-agent__wave span:nth-child(4) {
    transform: scaleY(2.2);
  }
}

.voice-command {
  gap: var(--s-14);
}

.voice-command__tabs {
  display: inline-flex;
  align-self: flex-start;
  border: 1px solid var(--border);
  border-radius: var(--radius-8);
  overflow: hidden;
}

.voice-command__tab {
  min-height: 36px;
  padding: var(--s-8) 14px;
  border: 0;
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
}

.voice-command__tab:last-child {
  border-right: 0;
}

.voice-command__tab--active {
  background: rgba(96, 165, 250, 0.18);
  color: var(--text);
}

.voice-command__speech,
.voice-command__review {
  display: flex;
  align-items: center;
  gap: var(--s-10);
  flex-wrap: wrap;
}

.voice-command__state {
  color: var(--muted);
  font-size: var(--fs-13);
}

.voice-command__transcript {
  min-height: 96px;
  resize: vertical;
  line-height: 1.45;
}

.voice-command__confirmation-policy {
  margin-top: calc(var(--s-8) * -1);
}

.voice-command__switch {
  display: inline-flex;
  align-items: center;
  gap: var(--s-10);
  color: var(--text);
  cursor: pointer;
  font-size: var(--fs-13);
}

.voice-command__switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.voice-command__switch-track {
  width: 42px;
  height: 24px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel2);
  display: inline-flex;
  align-items: center;
  padding: 2px;
  transition: background 0.15s ease, border-color 0.15s ease;
  flex: 0 0 auto;
}

.voice-command__switch-thumb {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--muted);
  transition: transform 0.15s ease, background 0.15s ease;
}

.voice-command__switch input:checked + .voice-command__switch-track {
  background: rgba(96, 165, 250, 0.18);
  border-color: var(--accent);
}

.voice-command__switch input:checked + .voice-command__switch-track .voice-command__switch-thumb {
  transform: translateX(18px);
  background: var(--accent);
}

.voice-command__switch input:focus-visible + .voice-command__switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.voice-command__status {
  min-height: 20px;
  color: var(--muted);
  font-size: var(--fs-13);
}

.voice-command__interpretation,
.voice-command__interpretation-proposal {
  border: 1px solid var(--border);
  border-radius: var(--radius-8);
  background: rgba(96, 165, 250, 0.08);
  padding: var(--s-10) 12px;
}

.voice-command__interpretation-disclosure {
  margin: 0 0 var(--s-8);
  color: var(--muted);
  font-size: var(--fs-13);
  line-height: 1.45;
}

.voice-command__interpretation-actions {
  display: flex;
  gap: var(--s-8);
  flex-wrap: wrap;
  margin-top: var(--s-8);
}

.voice-command__interpretation-proposal dl {
  display: grid;
  gap: var(--s-10);
  margin: 0;
}

.voice-command__interpretation-proposal dl > div {
  display: grid;
  gap: var(--s-2);
}

.voice-command__interpretation-proposal dt {
  color: var(--muted);
  font-size: var(--fs-12);
  font-weight: 700;
}

.voice-command__interpretation-proposal dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.voice-command__summary {
  border: 1px solid var(--border);
  border-radius: var(--radius-8);
  background: rgba(255, 255, 255, 0.03);
  padding: var(--s-10) 12px;
  line-height: 1.45;
}

.voice-command__semantic-interaction {
  border: 1px solid var(--border);
  border-radius: var(--radius-8);
  background: rgba(96, 165, 250, 0.08);
  padding: var(--s-10) 12px;
  line-height: 1.45;
}

.voice-command__disambiguation {
  border: 1px solid var(--border);
  border-radius: var(--radius-8);
  background: rgba(255, 255, 255, 0.03);
  padding: var(--s-10) 12px;
  line-height: 1.45;
}

.voice-command__disambiguation-title {
  font-weight: 700;
  margin-bottom: var(--s-8);
}

.voice-command__candidate-list {
  display: grid;
  gap: var(--s-6);
}

.voice-command__candidate {
  width: 100%;
  min-height: 36px;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius-8);
  background: var(--panel2);
  color: var(--text);
  padding: var(--s-8) 10px;
  cursor: pointer;
}

.voice-command__candidate:hover,
.voice-command__candidate:focus-visible {
  border-color: var(--accent);
}

.voice-command__summary[hidden],
.voice-command__semantic-interaction[hidden],
.voice-command__disambiguation[hidden],
.voice-command__interpretation[hidden],
.voice-command__interpretation-proposal[hidden],
.voice-command__speech[hidden],
.voice-command__confirmation-policy[hidden] {
  display: none;
}

/* Edit Todo modal: Updated datetime in header, left of close button. */
/* Hide when no datetime (e.g. New Todo before save); show after todo is saved. */
.todo-dialog-updated[aria-hidden="true"] {
  display: none;
}
.todo-dialog-updated {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

/* Scoped under .dialog for specificity to beat the .muted utility class */
.dialog .todo-dialog-updated {
  font-size: var(--fs-11);
}

.todo-dialog-updated::before {
  content: "Updated:";
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .todo-dialog-updated {
    max-width: 200px;
  }
  /* Match Created datetime size to Updated on desktop only */
  .dialog .todo-dialog-dates {
    font-size: var(--fs-11);
  }
}

.dialog__title {
  font-weight: 900;
  font-size: var(--fs-16);
}

.dialog__content {
  padding: var(--s-16) 0;
  flex: 0 0 auto;
  /* Content grows naturally to fit tab content - no min-height constraint */
}

.dialog__footer {
  display: flex;
  align-items: center;
  gap: var(--s-10);
  margin-top: var(--s-4);
  flex-wrap: wrap;
}

#todoDialog .dialog__footer #saveTodoBtn {
  margin-inline-start: auto;
}

/* Edit Todo modal: Created datetime, centered between Bottom and Save. */
/* Hide when no datetime (e.g. New Todo before save); show after todo is saved. */
.todo-dialog-dates[aria-hidden="true"] {
  display: none;
}
.todo-dialog-dates {
  display: flex;
  gap: var(--s-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
  justify-content: center;
  align-items: center;
}

.todo-dialog-dates::before {
  content: "Created:";
  flex-shrink: 0;
}

.todo-dialog-createdby {
  overflow: hidden;
  text-overflow: ellipsis;
}

.todo-dialog-createdby:empty {
  display: none;
}

/* Scoped under .dialog for specificity to beat the .muted utility class (mobile only) */
@media (max-width: 767px) {
  .dialog .todo-dialog-dates {
    font-size: var(--fs-9);
  }
}

/* Share story button: visible only on mobile in Edit Todo modal */
.todo-share-btn {
  display: none;
}

@media (max-width: 620px) {
  .dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }

  /* Todo modal: header + footer fixed; fields scroll (same idea as Settings .dialog__content). */
  /* Center without transform so Android Chrome can scroll #todoTitle to the caret. */
  #todoDialog.dialog {
    top: 0;
    right: 8px;
    bottom: 0;
    left: 8px;
    width: auto;
    margin: auto;
    transform: none;
    min-height: 0;
    overflow: hidden;
  }

  #todoDialog #todoTitle {
    touch-action: manipulation;
    padding-inline-end: 1.25rem;
  }

  #todoDialog .dialog__form {
    flex: 1 1 auto;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
  }

  #todoDialog .dialog__header {
    flex-shrink: 0;
  }

  #todoDialog .todo-dialog__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior-y: contain;
  }

  #todoDialog .dialog__footer {
    flex-shrink: 0;
  }

  .dialog__form {
    padding: var(--s-12);
  }

  .dialog__footer {
    gap: var(--s-3);
    flex-wrap: nowrap;
    overflow: hidden;
  }

  .dialog__footer .btn {
    font-size: var(--fs-11);
    padding: var(--s-6) 6px;
    white-space: nowrap;
    flex: 0 0 auto;
  }

  #todoDialog .dialog__footer #deleteTodoBtn,
  #todoDialog .dialog__footer #saveTodoBtn {
    font-size: var(--fs-14);
    font-weight: 700;
    padding: var(--s-10) 14px;
    min-height: 44px;
    flex-shrink: 0;
  }

  .dialog__footer .btn--small {
    padding: var(--s-6) 4px;
    font-size: var(--fs-10);
    min-width: var(--s-40);
  }


  .dialog__footer .spacer {
    flex: 0 1 8px;
    min-width: var(--s-4);
  }

  .todo-share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: var(--s-40);
    margin-left: auto;
  }

  /* Reduce font sizes for project buttons in mobile view */
  .list__item .btn {
    font-size: var(--fs-13);
    padding: var(--s-8) 10px;
  }

  .list__item .btn--small {
    font-size: var(--fs-11);
    padding: var(--s-5) var(--s-8);
  }

  .project-grid__name {
    font-size: var(--fs-12);
  }

  .project-grid__actions .btn {
    font-size: var(--fs-10);
    padding: var(--s-5) var(--s-6);
  }

  /* Increase project image icon sizes in mobile view */
  .project-image-btn {
    width: var(--s-56);
    height: var(--s-56);
  }

  .project-grid__image-btn {
    min-height: 120px;
  }
}

/* ============================================
   SETTINGS MODAL
   ============================================ */

.settings-section {
  margin-bottom: var(--s-24);
}

.settings-agenda-name-row {
  display: flex;
  align-items: flex-start;
  gap: var(--s-12);
}

.settings-agenda-name-field {
  display: flex;
  flex-direction: column;
  flex: 0 0 67%;
  min-width: 0;
}

.settings-agenda-color-field {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 1 0;
  min-width: 0;
}

.settings-agenda-color-field .field__label {
  text-align: center;
}

.settings-section__title {
  font-weight: 800;
  font-size: var(--fs-16);
  margin-bottom: var(--s-6);
}

.settings-section__description {
  margin-bottom: var(--s-16);
  font-size: var(--fs-13);
}

.voice-speech-speed {
  margin: 12px 0 0 24px;
}

.voice-speech-speed__heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.voice-speech-speed__heading output {
  font-weight: 700;
  white-space: nowrap;
}

.voice-speech-speed__slider {
  width: 100%;
  margin-top: 12px;
}

.voice-speech-speed__ticks {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.voice-speech-speed__ticks span {
  text-align: center;
}

.voice-speech-speed__ticks span:first-child {
  text-align: left;
}

.voice-speech-speed__ticks span:last-child {
  text-align: right;
}

.settings-push-vapid-notice {
  margin: 0 0 var(--s-16) 0;
  padding: var(--s-10) var(--s-12);
  font-size: var(--fs-13);
  line-height: 1.45;
  border-radius: var(--radius-8);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
}

.settings-section--push-pwa-disabled {
  opacity: 0.48;
  pointer-events: none;
  user-select: none;
}

/* Desktop: one nowrap row (board + personal tabs via display:contents).
   --settings-tabs-scale is set by settings-tabs-fit.ts so labels always fit. */
.settings-tabs-nav {
  --settings-tabs-scale: 1;
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: calc(var(--s-8) * var(--settings-tabs-scale));
  margin-bottom: var(--s-20);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.settings-tabs {
  display: contents;
}

.settings-tab {
  padding: calc(var(--s-8) * var(--settings-tabs-scale)) calc(16px * var(--settings-tabs-scale));
  background: transparent;
  border: none;
  color: var(--muted);
  font-weight: 600;
  font-size: calc(var(--fs-14) * var(--settings-tabs-scale));
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -8px;
  transition: color 0.2s, border-color 0.2s;
  white-space: nowrap;
  flex: 0 0 auto;
}

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

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

.settings-tab-content {
  /* Content determines height naturally */
}

.settings-tags-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-8);
}

.settings-tag-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-6);
  padding: var(--s-6) 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  min-width: 0;
}

.settings-tag-name {
  font-weight: 500;
  font-size: var(--fs-13);
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-tag-color-controls {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  flex-shrink: 0;
}

.settings-color-picker {
  width: var(--s-24);
  height: var(--s-24);
  border: 1px solid var(--border);
  border-radius: var(--radius-6);
  cursor: pointer;
  background: var(--bg);
  padding: var(--s-1);
  flex-shrink: 0;
}

.settings-color-picker::-webkit-color-swatch-wrapper {
  padding: 0;
}

.settings-color-picker::-webkit-color-swatch {
  border: 1px solid var(--border);
  border-radius: var(--radius-5);
}

.settings-tag-item .btn--small {
  padding: var(--s-4) 8px;
  font-size: var(--fs-11);
  min-width: auto;
}

.settings-tag-item .settings-color-clear {
  padding: var(--s-4) 6px;
}

.settings-tag-item .settings-tag-delete {
  padding: var(--s-4) 6px;
  min-width: var(--s-24);
  width: var(--s-24);
  height: var(--s-24);
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings-kv {
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
  margin-top: var(--s-10);
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--s-12);
}

.users-table th {
  text-align: left;
  padding: var(--s-8) 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: var(--fs-13);
  color: var(--muted);
}

.users-table td {
  padding: var(--s-12);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.users-table tbody tr:last-child td {
  border-bottom: none;
}

.users-table__actions {
  display: flex;
  gap: var(--s-8);
  align-items: center;
}

.settings-kv__row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: var(--s-12);
  align-items: center;
}

.theme-selector {
  display: flex;
  flex-direction: column;
  gap: var(--s-12);
}

.theme-option {
  display: flex;
  align-items: center;
  gap: var(--s-12);
  padding: var(--s-12);
  border: 1px solid var(--border);
  border-radius: var(--radius-12);
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}

.theme-option:hover {
  border-color: var(--accent);
  background: var(--panel);
}

.theme-option input[type="radio"] {
  margin: 0;
  cursor: pointer;
}

.theme-option label {
  flex: 1;
  cursor: pointer;
  font-weight: 500;
}

.theme-option__description {
  font-size: var(--fs-12);
  color: var(--muted);
  margin-top: var(--s-2);
}

.theme-selector--inline {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-8);
}

.theme-option.theme-option--inline {
  padding: var(--s-8) var(--s-12);
  flex-direction: row;
  gap: var(--s-8);
}

.theme-option--inline .theme-option__description {
  display: none;
}

.keybinding-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-8);
  margin-top: var(--s-12);
  max-width: 100%;
}

@media (min-width: 560px) {
  .keybinding-list {
    grid-template-columns: 1fr 1fr;
    column-gap: var(--s-24);
    row-gap: var(--s-8);
  }
}

.keybinding-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-12);
  min-width: 0;
}

.keybinding-row__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: var(--fs-14);
}

.keybinding-capture.keybinding-capture--listening {
  outline: 2px solid var(--accent, #6366f1);
  outline-offset: 2px;
}

.keybinding-capture.keybinding-capture--error {
  outline: 2px solid var(--danger, #dc2626);
  outline-offset: 2px;
}

.settings-section--keybindings {
  margin-top: var(--s-24);
}

.settings-backup-section {
  display: flex;
  flex-direction: column;
  gap: var(--s-32);
}

.settings-backup-export,
.settings-backup-import {
  display: flex;
  flex-direction: column;
  gap: var(--s-12);
}

.settings-backup-delete {
  display: flex;
  flex-direction: column;
  gap: var(--s-12);
  margin-top: var(--s-8);
  padding-top: var(--s-24);
  border-top: 1px solid var(--danger);
}

.settings-backup-delete__danger {
  font-size: var(--fs-13);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--danger);
}

.settings-backup-preview {
  font-size: var(--fs-13);
  line-height: 1.6;
}

.settings-backup-confirmation {
  padding: var(--s-8) 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-8);
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-14);
  transition: border-color 0.2s;
}

.settings-backup-confirmation:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

.settings-backup-confirmation:invalid {
  border-color: var(--danger);
}

.field-error {
  margin-top: var(--s-6);
  font-size: var(--fs-13);
  color: var(--danger);
}

.settings-backup-warnings {
  font-size: var(--fs-13);
  line-height: 1.6;
  color: var(--muted);
}

#backupFileInput {
  padding: var(--s-8);
  border: 1px solid var(--border);
  border-radius: var(--radius-8);
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-14);
  cursor: pointer;
}

#backupFileInput:hover {
  border-color: var(--accent);
}

input[type="radio"][name="importMode"] {
  margin-right: var(--s-8);
  cursor: pointer;
}

label:has(input[type="radio"][name="importMode"]) {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: var(--s-4) 0;
}

label:has(input[type="radio"][name="importMode"]:disabled) {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 768px) {
  .settings-tags-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .settings-tags-list {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   TAGS & CHIPS
   ============================================ */

.tag-autocomplete-suggestion {
  color: var(--muted);
  opacity: 0.6;
  pointer-events: none;
  user-select: none;
  z-index: 1000;
  line-height: 1.5;
}

/* Mobile: no Tab key; allow tap on suggestion to accept (same as Tab on desktop) */
@media (max-width: 768px) {
  .tag-autocomplete-suggestion {
    pointer-events: auto;
    cursor: pointer;
  }
}

.tags-input-container {
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
}

.tags-input-row {
  display: flex;
  align-items: center;
  gap: var(--s-8);
}

.tags-input-row .tags-input {
  flex: 1;
  min-width: 0;
}

.tags-add-btn {
  display: none;
  white-space: nowrap;
  padding: var(--s-8) 12px;
  height: var(--s-38);
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.tags-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-6);
  min-height: var(--s-32);
  padding: var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.tags-input {
  margin-top: 0;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-4) 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-6);
  background: var(--panel);
  font-size: var(--fs-13);
  line-height: 1.4;
}

.tag-chip-remove {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: var(--fs-18);
  line-height: 1;
  padding: 0;
  margin: 0;
  width: var(--s-16);
  height: var(--s-16);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.tag-chip-remove:hover {
  opacity: 1;
}

/* Link chip button: inherit chip look so it’s not default white/black in dark mode */
.tag-chip-link {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}

.tag {
  font-size: var(--fs-12);
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--bg);
  padding: var(--s-2) var(--s-8);
  border-radius: 999px;
}

@media (min-width: 768px) {
  .tags-input-container {
    flex-direction: row;
    align-items: flex-start;
    gap: var(--s-12);
  }

  .tags-input {
    flex: 0 0 200px;
    min-width: 150px;
  }

  .tags-chips {
    flex: 1;
    min-width: 0;
  }
}

@media (max-width: 767px) {
  .tags-add-btn {
    display: inline-flex;
  }
}

/* ============================================
   LIST & PROJECT VIEWS
   ============================================ */

.list {
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
}

.list__item {
  display: flex;
  align-items: center;
  gap: var(--s-10);
  padding: var(--s-10);
  border: 1px solid var(--border);
  border-radius: var(--radius-12);
  background: var(--bg);
  cursor: pointer;
  transition: background-color 0.2s;
}

.list__item:hover {
  background: var(--panel);
}

.list__item--clickable {
  cursor: pointer;
}

.list__item--clickable:hover {
  background: var(--panel);
}

.list__item-name {
  color: var(--project-name-color);
  font-weight: 500;
  flex: 1;
}

/* Dashboard status pills – same colors as board lane headers */
/* Dashboard: project groups with tab */
.dashboard-project-group {
  position: relative;
  border: none;
  border-radius: var(--radius);
  padding: var(--s-12) 12px 12px 12px;
  margin-bottom: var(--s-32);
}
.dashboard-project-group:last-child {
  margin-bottom: 0;
}

.dashboard-project-group__tab {
  position: absolute;
  top: 0;
  left: 12px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: var(--s-8);
  padding: var(--s-4) 12px 4px 4px;
  font-size: var(--fs-15);
  font-weight: 600;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-bottom-color: transparent;
  border-radius: var(--radius) var(--radius) 0 0;
  white-space: nowrap;
  max-width: 280px;
  overflow: hidden;
}

.dashboard-project-group__tab--sprint {
  left: 50%;
  right: auto;
  transform: translateY(-50%) translateX(-50%);
  max-width: none;
  font-size: var(--fs-13);
  font-weight: 500;
  color: var(--fg-muted);
}

.dashboard-project-group__section {
  margin-top: var(--s-12);
}

.dashboard-project-group__section:first-of-type {
  margin-top: var(--s-8);
}

.dashboard-project-group__section .dashboard-project-group__tab--sprint {
  position: static;
  left: auto;
  right: auto;
  transform: none;
  width: fit-content;
  display: block;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  margin-left: var(--s-12);
}

/* Sprint section tab tints: current = green, other sprints = yellow, unscheduled = red (dark mode) */
.dashboard-project-group__section[data-sprint-section="active"] .dashboard-project-group__tab--sprint {
  background: rgba(34, 197, 94, 0.2);
  color: rgba(134, 239, 172, 0.95);
  border: 1px solid rgba(34, 197, 94, 0.35);
}

.dashboard-project-group__section[data-sprint-section="sprint"] .dashboard-project-group__tab--sprint {
  background: rgba(234, 179, 8, 0.2);
  color: rgba(253, 224, 71, 0.95);
  border: 1px solid rgba(234, 179, 8, 0.35);
}

.dashboard-project-group__section[data-sprint-section="unscheduled"] .dashboard-project-group__tab--sprint {
  background: rgba(239, 68, 68, 0.2);
  color: rgba(252, 165, 165, 0.95);
  border: 1px solid rgba(239, 68, 68, 0.35);
}

@media (max-width: 767px) {
  .dashboard-project-group__section .dashboard-project-group__tab--sprint {
    font-size: var(--fs-11);
    padding: 0.15rem 0.35rem;
    border-radius: 3px;
    margin-left: auto;
    margin-right: auto;
  }
}

.dashboard-project-group__tab-img {
  width: var(--s-28);
  height: var(--s-28);
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.dashboard-project-group__tab-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-project-group__tab-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s-8);
  min-width: 0;
}

.dashboard-project-group__sprint-badge {
  font-size: var(--fs-13);
  font-weight: 500;
  color: var(--fg-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.dashboard-project-group .list {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
}

.dashboard-project-group .list__item {
  margin: 0;
}

.dashboard-todo__status {
  margin-bottom: var(--s-4);
}

.dashboard-todo__main {
  min-width: 0;
}

.dashboard-todo__title-row {
  display: flex;
  align-items: baseline;
  gap: var(--s-8);
  min-width: 0;
  width: 100%;
  overflow: hidden;
}

.dashboard-todo__title {
  font-weight: 600;
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-todo__points {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--s-20);
  height: var(--s-20);
  padding: 0 var(--s-6);
  border-radius: 999px;
  border: 1px solid rgba(96, 165, 250, 0.5);
  background: rgba(96, 165, 250, 0.18);
  color: var(--text);
  font-size: var(--fs-11);
  font-weight: 700;
  line-height: calc(18px * var(--ui-scale));
  flex-shrink: 0;
}

/* Dashboard: desktop two-column layout (project groups left, stats right) */
.dashboard-content {
  margin-top: 0;
}

.dashboard-project-groups-wrap {
  min-width: 0;
}

.dashboard-project-groups-wrap .dashboard-todo-groups {
  margin-top: calc(48px * var(--ui-scale));
}

/* Lazy-load: mobile uses same ▼ affordance as board lanes; desktop keeps text button */
.dashboard-load-more {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: var(--s-12);
}

.dashboard-load-more__desktop {
  display: none;
}

.dashboard-load-more__mobile {
  display: block;
  cursor: pointer;
  font-size: var(--fs-13);
  color: var(--muted);
  text-align: center;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.dashboard-load-more__mobile:active {
  opacity: 0.6;
}

.dashboard-load-more__mobile[data-loading="1"] {
  opacity: 0.5;
  pointer-events: none;
}

@media (min-width: 621px) {
  .dashboard-load-more__desktop {
    display: inline-flex;
  }

  .dashboard-load-more__mobile {
    display: none;
  }
}

.dashboard-stats {
  display: none;
}

.dashboard-stats__item {
  display: flex;
  flex-direction: column;
  gap: var(--s-6);
  padding: var(--s-12) 0;
  border-bottom: 1px solid var(--border);
}

.dashboard-stats__item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.dashboard-stats__section {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.dashboard-stats__section > .dashboard-stats__label:first-child {
  margin-bottom: var(--s-8);
  text-align: right;
  margin-right: 4px;
}

.dashboard-stats__section--spaced {
  margin-top: var(--s-16);
}

.dashboard-stats__section-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--list-item-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-12);
  padding: var(--s-12) var(--s-10);
  margin-bottom: 0;
}

.dashboard-stats__section-card .dashboard-stats__row:first-child {
  padding-top: 0;
}

.dashboard-stats__row {
  display: flex;
  flex-direction: column;
  gap: var(--s-6);
  padding: var(--s-12) 0;
  border-bottom: 1px solid var(--border);
}

.dashboard-stats__row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.dashboard-stats__row--progress-team {
  margin-top: var(--s-12);
}

.dashboard-stats__label {
  font-size: var(--fs-12);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.dashboard-stats__value {
  font-size: var(--fs-16);
  font-weight: 600;
  color: var(--fg);
  line-height: 1.4;
}

.dashboard-stats__value--num {
  font-size: var(--fs-24);
  font-weight: 700;
  line-height: 1.1;
}

.dashboard-stats__value--assigned {
  font-size: var(--fs-18);
  font-weight: 600;
}

/* ASSIGNED: Current = green. WIP: In progress = green, Testing = blue (dark mode) */
.dashboard-stats__value--current {
  color: rgba(134, 239, 172, 0.95);
}

.dashboard-stats__wip-in-progress {
  color: rgba(134, 239, 172, 0.95);
}

.dashboard-stats__wip-testing {
  color: rgba(147, 197, 253, 0.95);
}

.dashboard-stats__value--total {
  color: rgba(216, 180, 254, 0.95);
}

.dashboard-stats__progress-wrap {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.dashboard-stats__progress-bar {
  height: 100%;
  width: var(--progress, 0%);
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.2s ease;
}

.dashboard-stats__progress-label {
  font-size: var(--fs-13);
  color: var(--muted);
  line-height: 1.4;
}

.dashboard-stats__item--progress-team {
  margin-top: var(--s-12);
}

.dashboard-throughput {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 48px;
  width: 100%;
}

.dashboard-throughput__bar {
  flex: 1;
  min-width: 0;
  height: var(--bar-height, 0%);
  min-height: 2px;
  background: var(--accent);
  border-radius: 2px;
  transition: height 0.2s ease;
}

.dashboard-stats__wip-link {
  font-size: var(--fs-14);
  color: var(--fg);
  cursor: pointer;
  text-align: left;
  padding: var(--s-6) var(--s-8);
  border-radius: var(--radius);
}

.dashboard-stats__wip-link:hover {
  background: var(--panel);
}

.dashboard-stats__item--wip-warning .dashboard-stats__wip-link,
.dashboard-stats__row--wip-warning .dashboard-stats__wip-link {
  color: var(--warning, #f59e0b);
}

@media (min-width: 768px) {
  .dashboard-content {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: var(--s-32);
    margin-top: calc(48px * var(--ui-scale));
  }

  .dashboard-project-groups-wrap {
    flex: 1;
    min-width: 0;
  }

  .dashboard-project-groups-wrap .dashboard-todo-groups {
    margin-top: 0;
  }

  .dashboard-stats {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    width: 420px;
    padding: var(--s-20);
    background: var(--dashboard-stats-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }
}

.status-pill {
  display: inline-block;
  padding: var(--s-2) var(--s-8);
  border-radius: 999px;
  font-size: var(--fs-11);
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
}

.status-pill--backlog {
  background: #9CA3AF;
}

.status-pill--not_started {
  background: #F59E0B;
}

.status-pill--in_progress {
  background: #10B981;
}

.status-pill--testing {
  background: #3B82F6;
}

.status-pill--done {
  background: #EF4444;
}

/* Sprint state badges */
.status-pill--planned {
  background: #EA580C;
}

.status-pill--active {
  background: #10B981;
}

.status-pill--closed {
  background: #EF4444;
}

/* API token badges */
.status-pill--service {
  background: #6366F1;
}

.status-pill--revoked {
  background: #9CA3AF;
}

.api-tokens-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--s-12);
}

.api-tokens-table th {
  text-align: left;
  padding: var(--s-8) 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: var(--fs-13);
  color: var(--muted);
}

.api-tokens-table td {
  padding: var(--s-12);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.api-tokens-table tbody tr:last-child td {
  border-bottom: none;
}

.api-tokens-create {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--s-12);
  margin-top: var(--s-12);
}

.api-tokens-create__name {
  flex: 1 1 220px;
}

.api-tokens-create__service {
  display: flex;
  align-items: center;
  gap: var(--s-8);
  flex: 1 1 100%;
}

.settings-sprint-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--s-8) 0;
  border-bottom: 1px solid var(--border);
  gap: var(--s-12);
  min-height: 40px;
}

.settings-sprint-row:last-child {
  border-bottom: none;
}

.settings-sprint-row--editing {
  align-items: center;
}

.settings-sprint-row--editing .input {
  min-height: 32px;
}

@media (min-width: 768px) {
  .settings-sprint-row__action-placeholder {
    visibility: hidden;
    pointer-events: none;
  }
}

@media (max-width: 767px) {
  .settings-sprint-row__action-placeholder {
    display: none;
  }
  .settings-sprint-row {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--s-8);
  }
  .settings-sprint-row__actions {
    width: 100%;
  }
  .settings-sprint-row--editing .settings-sprint-edit-save-cancel {
    width: 100%;
    margin-top: var(--s-8);
  }

  .settings-create-sprint-form {
    flex-direction: column;
    align-items: stretch;
  }
  .settings-create-sprint-form__name {
    flex: none;
    width: 100%;
    min-width: 0;
  }
  .settings-create-sprint-form__dates {
    width: 100%;
    flex-wrap: wrap;
  }
  .settings-create-sprint-form__dates .field {
    flex: 1;
    min-width: 120px;
  }
  .settings-create-sprint-form__submit {
    display: flex;
    justify-content: center;
    width: 100%;
  }
}

.project-image-btn {
  width: var(--s-40);
  height: var(--s-40);
  padding: 0;
  display: block;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  flex-shrink: 0;
}

.project-image-btn .project-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: var(--radius);
  object-fit: cover;
  display: block;
}

.project-image-btn .project-image-placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-20);
  background: var(--panel);
  border: 1px solid var(--border);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--s-16);
}

.project-grid__item {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.project-grid__item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.project-grid__image-btn {
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: none;
  background: var(--panel);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.project-grid__image-btn:hover {
  opacity: 0.9;
}

.project-grid__image,
.project-grid__placeholder {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-grid__placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-48);
  background: var(--panel);
}

.project-grid__content {
  padding: var(--s-12);
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
}

.project-grid__name {
  font-weight: 500;
  text-align: left;
  padding: 0;
  background: none;
  border: none;
  color: var(--project-name-color);
  cursor: pointer;
  font-size: var(--fs-14);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-grid__name:hover {
  color: var(--accent);
}

.project-grid__actions {
  display: flex;
  gap: var(--s-6);
  flex-wrap: wrap;
}

.project-grid__actions .btn {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-12);
  padding: var(--s-6) 8px;
}

/* ============================================
   BOARD & COLUMN COMPONENTS
   ============================================ */

.board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  touch-action: manipulation;
  gap: var(--s-12);
}

@media (min-width: 1301px) {
  .board.board--wrapped {
    grid-template-columns: repeat(var(--board-wrap-cols), minmax(200px, 1fr));
  }
}

.col {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 360px;
}

/* Lane body tint from workflow color (--lane-accent on .col from board.ts); overrides plain .col background */
.col.col--lane-tint {
  background: color-mix(in srgb, var(--lane-accent) 22%, var(--bg));
}

[data-theme="light"] .col.col--lane-tint {
  background: color-mix(in srgb, var(--lane-accent) 16%, var(--bg));
}

.col * {
  border-color: inherit;
}

.col__head {
  display: flex;
  align-items: center;
  gap: var(--s-10);
  padding: var(--s-12) 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.col__head--backlog {
  background: #9CA3AF;
}

.col__head--backlog .col__count {
  color: #ffffff;
}

.col__head--not_started {
  background: #F59E0B;
}

.col__head--not_started .col__count {
  color: #ffffff;
}

.col__head--in_progress,
.col__head--doing {
  background: #10B981;
}

.col__head--in_progress .col__count,
.col__head--doing .col__count {
  color: #ffffff;
}

.col__head--testing {
  background: #3B82F6;
}

.col__head--testing .col__count {
  color: #ffffff;
}

.col__head--done {
  background: #EF4444;
}

.col__head--done .col__count {
  color: #ffffff;
}

.col__title {
  font-weight: 800;
}

.col__count {
  margin-left: auto;
  font-weight: 700;
  color: var(--muted);
}

.col__list {
  padding: var(--s-10);
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
  flex: 1;
  min-height: 200px;
  border: none;
  background: transparent;
}

.col__load-more {
  flex-shrink: 0;
  padding: var(--s-6) 10px;
  border-top: 1px solid var(--border);
  background: transparent;
  display: flex;
  justify-content: center;
}

.col__load-more--mobile {
  display: none;
}

.mobile-board-wrapper {
  display: block;
}

.mobile-tabs {
  display: flex;
  gap: var(--s-8);
  margin-bottom: var(--s-12);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.mobile-tabs::-webkit-scrollbar {
  display: none;
}

.mobile-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  padding: var(--s-10) 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: var(--fs-14);
  margin-bottom: -1px;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.mobile-tab:hover {
  color: var(--text);
}

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

@media (max-width: 1300px) {
  .board {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (max-width: 620px) {
  /* Touch devices don't use keyboard nav — kill all focus rings */
  .btn:focus,
  .btn:focus-visible {
    outline: none;
    box-shadow: none;
  }

  .page {
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
  }

  /* Projects screen: scroll the container (not the fixed .page wrapper). */
  .page--projects {
    overflow: hidden;
  }

  .container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding: var(--s-16);
    overflow: hidden;
  }

  /* Projects: allow vertical scroll inside the container on mobile. */
  .page--projects .container {
    overflow-y: scroll;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior-y: contain;
  }

  /* Dashboard: same scroll behavior as Projects on mobile. */
  .page--dashboard .container {
    overflow-y: scroll;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior-y: contain;
  }

  .topbar {
    column-gap: var(--s-6);
    row-gap: 0;
    padding: var(--s-8) 10px;
    flex-wrap: wrap;
    min-width: 0;
    align-items: center;
  }

  .topbar .brand {
    flex: 0 0 clamp(56px, 18vw, 88px);
    width: clamp(56px, 18vw, 88px);
    min-width: 0;
    max-width: clamp(56px, 18vw, 88px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--fs-14);
    gap: var(--s-4);
  }

  /* In anonymous mode, extend the project name brand width in mobile view */
  .topbar .project-image-topbar~.brand,
  .topbar .project-image-topbar-placeholder~.brand {
    max-width: 180px;
  }

  .topbar .brand-logo {
    height: var(--s-24);
    width: auto;
  }

  .topbar .brand-text {
    max-width: 70px;
    height: calc(18px * var(--ui-scale));
    object-fit: contain;
    flex-shrink: 1;
  }

  .topbar #backBtn,
  .topbar .project-image-topbar-btn,
  .topbar .project-image-topbar,
  .topbar .project-image-topbar-placeholder,
  .topbar .brand,
  .topbar .spacer,
  .topbar #settingsBtn,
  .topbar #manageMembersBtn,
  .topbar .user-avatar {
    order: 1;
  }

  .topbar::after {
    content: "";
    order: 2;
    flex: 0 0 100%;
    height: 0;
  }

  .topbar .spacer {
    flex: 1;
    min-width: 0;
  }

  /* Auth shell: keep logo left / locale picker right; ignore board topbar order shuffle. */
  .page--auth .topbar::after {
    content: none;
    display: none;
  }

  .page--auth .topbar .brand,
  .page--auth .topbar .spacer,
  .page--auth .topbar .locale-picker {
    order: 0;
  }

  .topbar .search-input-wrapper {
    order: 4;
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
    margin-right: var(--s-4);
    margin-top: var(--s-8);
  }

  .topbar #renameProjectBtn {
    order: 4;
    margin-top: var(--s-8);
    margin-right: var(--s-16);
  }

  .topbar #newTodoBtn {
    order: 5;
    margin-top: var(--s-8);
    margin-right: var(--s-4);
  }

  .topbar #voiceCommandBtn {
    order: 3;
    margin-top: var(--s-8);
  }

  .topbar #wallBtn {
    order: 3;
    margin-top: var(--s-8);
  }

  .topbar #deleteProjectBtn {
    order: 6;
    margin-top: var(--s-8);
  }

  .search-input {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    font-size: calc(0.85rem * var(--ui-scale));
    padding: calc(0.4rem * var(--ui-scale)) calc(0.6rem * var(--ui-scale));
    padding-right: 2.75rem;
  }

  .search-clear {
    right: 1.5rem;
    font-size: calc(0.9rem * var(--ui-scale));
    width: 18px;
    height: calc(18px * var(--ui-scale));
    padding: 0;
  }

  .search-filter-toggle {
    right: 0.3rem;
    width: 18px;
    height: calc(18px * var(--ui-scale));
    padding: 0;
  }

  .search-filter-panel {
    max-width: calc(100vw - 20px);
  }

  .topbar .btn {
    padding: var(--s-8) 12px;
    font-size: calc(0.85rem * var(--ui-scale));
    white-space: nowrap;
    flex-shrink: 0;
    border-radius: var(--radius-8);
    font-weight: 500;
  }

  .topbar .btn#newTodoBtn {
    margin-right: var(--s-4);
    padding-left: 0;
    padding-right: 0;
  }

  .topbar .btn#deleteProjectBtn {
    padding-left: 0;
    padding-right: 0;
  }

  .topbar .btn#manageMembersBtn {
    padding-left: 0;
    padding-right: 0;
  }

  .topbar .btn#archiveBtn {
    width: 40px;
    min-width: 40px;
    height: 40px;
    padding: 0;
  }

  .topbar .btn--ghost {
    padding: var(--s-8) 12px;
    min-width: auto;
  }

  .topbar #renameProjectBtn {
    margin-right: var(--s-8);
  }

  .topbar .hamburger {
    font-size: var(--fs-16);
    line-height: 1;
  }

  .user-avatar {
    width: var(--s-32);
    height: var(--s-32);
    font-size: var(--fs-12);
    margin-left: var(--s-8);
  }

  /* Ensure Members button appears directly before avatar in mobile */
  .topbar #manageMembersBtn {
    order: 1;
  }

  .project-image-topbar-btn {
    width: var(--s-24);
    height: var(--s-24);
    flex-shrink: 0;
  }

  .project-image-topbar,
  .project-image-topbar-placeholder {
    width: var(--s-24);
    height: var(--s-24);
    flex-shrink: 0;
  }

  .project-image-topbar-placeholder {
    font-size: var(--fs-16);
  }

  /* Hide column headers in mobile view to save vertical space */
  .board .col__head {
    display: none !important;
  }

  /* Mobile: tabs on left, board on right */
  .mobile-board-wrapper {
    display: flex;
    flex-direction: row;
    gap: var(--s-8);
    align-items: stretch;
    flex: 1;
    min-height: 0;
    /* Allow flex item to shrink below content size */
    overflow: hidden;
    /* Prevent wrapper from scrolling */
    position: relative;
  }

  .mobile-tabs {
    display: flex;
    flex-direction: column;
    gap: var(--s-4);
    margin-bottom: 0;
    margin-top: 0;
    border-bottom: none;
    border-right: 1px solid var(--border);
    padding-right: var(--s-8);
    flex-shrink: 0;
    width: auto;
    min-width: fit-content;
    align-self: stretch;
    overflow-x: visible;
    overflow-y: visible;
    position: relative;
    /* Anchor for absolutely-positioned drop zones */
    z-index: 1;
    /* Below the Sortable drag clone (z-index 9999) so dragged cards render on top */
  }

  .mobile-tab {
    padding: var(--s-8) 6px;
    border-bottom: none;
    border-right: 2px solid transparent;
    margin-bottom: 0;
    margin-right: -1px;
    width: auto;
    min-width: fit-content;
    text-align: center;
    white-space: nowrap;
    font-size: var(--fs-12);
    flex: 1 1 0;
    /* Equal distribution, allow shrinking, base size 0 */
    min-height: 0;
    /* Allow tabs to shrink below content size */
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    /* For centering */
    opacity: 0.5;
    /* Dim non-active tabs */
    /* Rounded outer edge for all lanes (custom keys are not covered by [data-tab] presets below) */
    border-radius: var(--radius-8) 0 0 8px;
  }

  .mobile-tab__text {
    writing-mode: vertical-lr;
    text-orientation: mixed;
    transform: rotate(180deg);
    display: inline-block;
    margin: 0;
    /* Remove any default margins */
  }

  .mobile-tab[data-tab="agenda"] .mobile-tab__text svg {
    width: 1em;
    height: 1em;
    display: inline-block;
    vertical-align: -0.15em;
    transform: rotate(90deg);
    transform-origin: center;
  }

  /* Default lane tab colors when workflow has no inline color: keys match store/API column_key
     (see DefaultColumn* in internal/store/types.go, defaultWorkflowColumns in workflows.go). */
  .mobile-tab[data-tab="backlog"] {
    background: #9CA3AF;
    color: #ffffff;
  }

  .mobile-tab[data-tab="not_started"] {
    background: #F59E0B;
    color: #ffffff;
  }

  .mobile-tab[data-tab="doing"] {
    background: #10B981;
    color: #ffffff;
  }

  .mobile-tab[data-tab="testing"] {
    background: #3B82F6;
    color: #ffffff;
  }

  .mobile-tab[data-tab="done"] {
    background: #EF4444;
    color: #ffffff;
  }

  .mobile-tab[data-tab="agenda"] {
    background: #6366F1;
    color: #ffffff;
  }

  .mobile-tab:hover {
    opacity: 0.7;
    /* Slightly brighter on hover, but still dimmed */
  }

  .mobile-tab--active {
    opacity: 1 !important;
    /* Full brightness for active tab */
    border-right-color: rgba(0, 0, 0, 0.4);
    border-right-width: 3px;
  }

  /* Mobile tab drop zones: invisible overlays on top of the tab buttons.
     They become active (accept drops) only while a card is being dragged. */
  #mobileTabDropZones {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    pointer-events: none;
    /* Inactive until drag starts */
    z-index: 10;
  }

  .mobile-tab-drop {
    flex: 1;
    pointer-events: none;
    border-radius: var(--radius-8) 0 0 8px;
    transition: background 0.15s, opacity 0.15s;
    opacity: 0;
    min-height: 0;
    --lane-color: #9CA3AF;
    --lane-shadow: rgba(156, 163, 175, 0.85);
  }

  /* During drag: enable drops and show a subtle per-color hint on each zone */
  .mobile-board-wrapper.dragging #mobileTabDropZones {
    pointer-events: auto;
  }

  /* Labels above the tinted drop overlays; hits pass through to .mobile-tab-drop */
  .mobile-board-wrapper.dragging .mobile-tab {
    z-index: 11;
    pointer-events: none;
  }

  .mobile-board-wrapper.dragging .mobile-tab-drop {
    pointer-events: auto;
    opacity: 0.3;
    background: var(--lane-color);
  }

  /* On hover-over during drag, glow using the tab's lane color */
  .mobile-tab-drop.sortable-drag-over,
  .mobile-tab-drop:has(.card--ghost-tab) {
    opacity: 1 !important;
    background: var(--lane-color) !important;
    box-shadow: 0 0 16px 6px var(--lane-shadow);
  }

  /* At drag start: all tabs pulse at full hover glow briefly (mobile discoverability) */
  .mobile-board-wrapper.dragging #mobileTabDropZones.mobile-tab-drops--intro-glow .mobile-tab-drop {
    opacity: 1 !important;
    background: var(--lane-color) !important;
    box-shadow: 0 0 16px 6px var(--lane-shadow);
  }

  /* Hide the card ghost placeholder inside tab drop zones */
  .card--ghost-tab {
    display: none !important;
  }

  .board {
    flex: 1;
    min-width: 0;
    /* Allow board to shrink */
    overflow: hidden;
    /* Hide overflow, let the column scroll */
    align-self: stretch;
    grid-template-columns: 1fr;
    display: flex;
    /* Override grid to allow column to fill */
  }

  .board .col {
    display: none !important;
  }

  .board .col--mobile-active {
    display: flex !important;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    min-height: 0;
    width: 100%;
    position: relative;
  }

  /* Cards scroll inside the list; col__load-more is always visible below it */
  .board .col--mobile-active .col__list {
    flex: 1;
    min-height: 0;
    overflow-y: scroll;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior-y: contain;
  }

  /* The list is a height-constrained flex column; without this, cards shrink to
     their 96px mobile min-height and tags spill over the next card. */
  .board .col--mobile-active .col__list > .card {
    flex-shrink: 0;
  }

  /* Load more: no border/background on mobile — only the button itself is visible */
  .board .col--mobile-active .col__load-more {
    max-height: 0;
    overflow: hidden;
    padding: 0;
    border-top: none;
    background: transparent;
    opacity: 0;
    touch-action: manipulation;
    transition: max-height 0.25s ease, padding 0.25s ease, opacity 0.25s ease;
  }

  .board .col--mobile-active .col__load-more.visible {
    max-height: var(--s-32);
    padding: var(--s-2) var(--s-8) 4px;
    opacity: 1;
  }

  .board .col--mobile-active .col__load-more--desktop {
    display: none;
  }

  .board .col--mobile-active .col__load-more--mobile {
    display: block;
    cursor: pointer;
    font-size: var(--fs-13);
    color: var(--muted);
    text-align: center;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
  }

  .board .col--mobile-active .col__load-more--mobile:active {
    opacity: 0.6;
  }

  /* Settings modal tabs: one wrapping grid, 3 per row — ignore board/personal split */
  .settings-tabs-nav {
    --settings-tabs-scale: 1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--s-8);
    margin-bottom: var(--s-16);
    border-bottom: none;
    padding-bottom: 0;
  }

  .settings-tabs {
    display: contents;
    overflow: visible;
  }

  .settings-tab {
    margin-bottom: 0;
    padding: var(--s-8) 8px;
    font-size: var(--fs-14);
    text-align: center;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: unset;
  }

  /* Prevent horizontal scroll on settings dialog itself */
  .dialog__content {
    overflow-x: hidden;
  }
}

@media (min-width: 621px) {
  .mobile-tabs {
    display: none;
  }
}

/* ============================================
   CARD COMPONENTS
   ============================================ */

.card {
  display: flex;
  flex-direction: column;
  text-align: left;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: var(--radius-12);
  padding: var(--s-10) 10px;
  cursor: pointer;
  position: relative;
}

.card--backlog {
  border-color: #9CA3AF;
}

.card--not_started {
  border-color: #F59E0B;
}

.card--in_progress {
  border-color: #10B981;
}

/* API column_key is `doing`; todo.status is DOING → card--doing on render */
.card--doing {
  border-color: #10B981;
}

.card--testing {
  border-color: #3B82F6;
}

.card--done {
  border-color: #EF4444;
}

.card--backlog:hover {
  border-color: #9CA3AF;
}

.card--not_started:hover {
  border-color: #F59E0B;
}

.card--in_progress:hover {
  border-color: #10B981;
}

.card--doing:hover {
  border-color: #10B981;
}

.card--testing:hover {
  border-color: #3B82F6;
}

.card--done:hover {
  border-color: #EF4444;
}

.col__head--agenda {
  background: #6366F1;
  color: #ffffff;
}

.col__head--agenda .col__title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.col__head--agenda .col__agenda-hosts {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: var(--s-8);
  flex-shrink: 0;
}

.col__agenda-host {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
  text-decoration: none;
  font-weight: 700;
  line-height: 1;
}

.col__agenda-host img,
.col__agenda-host svg {
  width: var(--s-16);
  height: var(--s-16);
  flex-shrink: 0;
}

.col__agenda-host img {
  object-fit: contain;
}

.col__agenda-host--apple img {
  filter: invert(1);
}

.col--agenda .col__list {
  gap: 0;
  display: block;
  padding: 0;
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  cursor: grab;
  scrollbar-width: none;
}

.col--agenda .col__list::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.col--agenda:hover .col__list,
.col--agenda:focus-within .col__list,
.col--agenda.is-agenda-panning .col__list {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--text) 22%, var(--bg)) transparent;
}

.col--agenda:hover .col__list::-webkit-scrollbar,
.col--agenda:focus-within .col__list::-webkit-scrollbar,
.col--agenda.is-agenda-panning .col__list::-webkit-scrollbar {
  width: 6px;
  height: 0;
}

.col--agenda:hover .col__list::-webkit-scrollbar-thumb,
.col--agenda:focus-within .col__list::-webkit-scrollbar-thumb,
.col--agenda.is-agenda-panning .col__list::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--text) 22%, var(--bg));
  border-radius: 3px;
}

.col--agenda:hover .col__list::-webkit-scrollbar-track,
.col--agenda:focus-within .col__list::-webkit-scrollbar-track,
.col--agenda.is-agenda-panning .col__list::-webkit-scrollbar-track {
  background: transparent;
}

.col--agenda.is-agenda-panning,
.col--agenda.is-agenda-panning .col__list {
  cursor: grabbing;
  user-select: none;
}

@media (min-width: 621px) {
  .col--agenda {
    max-height: calc(100dvh - 12rem);
    align-self: start;
  }
}

.col__agenda-status,
.col__agenda-empty {
  padding: var(--s-10);
}

.agenda-allday {
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
  padding: var(--s-10);
}

.agenda-day {
  --agenda-hour-height: 48px;
  --agenda-hour-gutter: 3.75rem;
  position: relative;
  height: calc(24 * var(--agenda-hour-height));
}

.agenda-hour {
  height: var(--agenda-hour-height);
  box-sizing: border-box;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
}

.agenda-hour__label {
  width: var(--agenda-hour-gutter);
  flex-shrink: 0;
  font-size: var(--fs-12);
  line-height: 1.2;
  padding: 2px 6px 0 8px;
  white-space: nowrap;
}

.agenda-day__events {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: var(--agenda-hour-gutter);
}

.agenda-now-line {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--agenda-now-min, 0) / 60 * var(--agenda-hour-height));
  height: 0;
  margin-top: -1px;
  border-top: 2px dotted color-mix(in srgb, var(--danger) 45%, transparent);
  background: none;
  pointer-events: none;
  z-index: 4;
}

.agenda-now-line--prominent {
  height: 2px;
  border-top: none;
  background: var(--danger);
}

.card--agenda {
  cursor: default;
  border-color: var(--agenda-lane-color, #6366F1);
}

.card--agenda:hover {
  border-color: var(--agenda-lane-color, #6366F1);
}

.card--agenda-timed {
  position: absolute;
  overflow: hidden;
  box-sizing: border-box;
  margin: 0;
  padding: 4px 8px;
  justify-content: flex-start;
  top: calc(var(--agenda-start-min) / 60 * var(--agenda-hour-height));
  height: max(2.75rem, calc(var(--agenda-span-min) / 60 * var(--agenda-hour-height)));
}

.card--agenda-timed:hover,
.card--agenda-timed:focus-within {
  z-index: 2;
}

@media (max-width: 767px) {
  .agenda-day {
    --agenda-hour-height: 96px;
  }
}

.card--agenda-timed .card__agenda-copy {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-width: 0;
}

.card--agenda-timed .card__agenda-meta {
  margin-top: 2px;
}

.card__agenda-meta {
  font-size: var(--fs-12);
  margin-top: var(--s-4);
  white-space: nowrap;
}

.card:focus {
  outline: none;
}

.card--highlight {
  box-shadow: 0 0 0 2px var(--accent);
  transition: box-shadow 0.2s ease;
}

.card--selected {
  box-shadow: 0 0 0 2px var(--accent);
  outline: 1px solid var(--accent);
  outline-offset: 1px;
}

.bulk-edit-bar {
  position: fixed;
  bottom: var(--s-24);
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  padding: var(--s-8) var(--s-12);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-8);
  box-shadow: var(--shadow);
  display: flex;
  gap: var(--s-8);
  max-width: calc(100vw - 24px);
}

.bulk-edit-bar__btn {
  white-space: nowrap;
}

.bulk-edit-bar {
  align-items: center;
}

.bulk-edit-bar__hint {
  color: var(--muted);
  font-size: var(--fs-13);
  white-space: nowrap;
}

.bulk-edit-bar {
  flex-wrap: wrap;
  justify-content: center;
  row-gap: var(--s-8);
}

.board-select-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: var(--s-8);
}

@media (min-width: 621px) {
  .board-select-row {
    display: none;
  }
}

.board-select-toggle__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 620px) {
  .board-select-row {
    position: fixed;
    right: max(16px, env(safe-area-inset-right, 0px));
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
    z-index: 40;
    margin-bottom: 0;
  }

  .board-select-toggle {
    width: 48px;
    height: 48px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--panel);
    box-shadow: var(--shadow);
  }

  .board-select-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }

  .board-select-toggle svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
  }
}

.bulk-edit-bar__btn,
.bulk-edit-bar__hint {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-select-toggle[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

.board--select-mode .card {
  cursor: pointer;
  position: relative;
  padding-left: 32px;
}

.board--select-mode .card::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 10px;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-radius: 4px;
  background: var(--panel);
}

.board--select-mode .card.card--selected::before {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 3px var(--panel);
}

.todo-archive-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-8);
  padding: var(--s-10) var(--s-12);
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--border));
  border-radius: var(--radius-8);
  background: color-mix(in srgb, var(--accent) 10%, var(--panel));
  font-size: var(--fs-13);
}

.todo-archive-banner[hidden] {
  display: none;
}

.todo-archive-banner strong {
  font-size: var(--fs-14);
}

#todoArchiveTimestamp {
  color: var(--muted);
}

.archive-container {
  width: min(980px, 100%);
  margin-inline: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.archive-topbar__title {
  color: var(--muted);
  font-weight: 700;
}

.archive-project-image {
  width: var(--s-32);
  height: var(--s-32);
  flex: 0 0 var(--s-32);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: var(--radius);
}

.archive-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-16);
  margin-bottom: var(--s-16);
}

.archive-heading h1,
.archive-heading p {
  margin: 0;
}

.archive-heading p {
  margin-top: var(--s-4);
}

.archive-state {
  padding: var(--s-24);
  color: var(--muted);
  text-align: center;
}

.archive-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
  padding-bottom: 84px;
}

.archive-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: var(--radius-12);
  background: var(--card-bg, var(--panel));
  overflow: hidden;
}

.archive-row:hover,
.archive-row:focus-within {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
}

.archive-row--selected {
  box-shadow: 0 0 0 2px var(--accent);
}

.archive-row__select {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  cursor: pointer;
  border-inline-end: 1px solid var(--border);
}

.archive-row__select input {
  width: 18px;
  height: 18px;
}

.archive-row__open {
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
  width: 100%;
  padding: var(--s-14) var(--s-16);
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: start;
  cursor: pointer;
}

.archive-row__open:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
}

.archive-row__title {
  display: flex;
  gap: var(--s-8);
  min-width: 0;
  font-size: var(--fs-16);
  font-weight: 750;
}

.archive-row__id {
  color: var(--muted);
  font-size: var(--fs-12);
  font-weight: 500;
}

.archive-row__meta,
.archive-row__tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-6);
  color: var(--muted);
  font-size: var(--fs-12);
}

.archive-row__badge {
  padding: 2px var(--s-6);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.archive-row__badge--done {
  border-color: color-mix(in srgb, var(--success) 55%, var(--border));
  color: var(--success);
}

.archive-row__assignee {
  display: inline-flex;
  align-items: center;
  gap: var(--s-4);
}

.archive-row__assignee .user-avatar__img,
.archive-row__assignee .user-avatar__initials {
  width: 20px;
  height: 20px;
  font-size: var(--fs-9);
}

.archive-load-more {
  display: flex;
  justify-content: center;
  padding: var(--s-12) 0 var(--s-32);
}

.archive-selection-bar {
  position: fixed;
  right: var(--s-24);
  bottom: var(--s-24);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: var(--s-12);
  padding: var(--s-8) var(--s-12);
  border: 1px solid var(--border);
  border-radius: var(--radius-8);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.archive-selection-bar[hidden] {
  display: none;
}

@media (max-width: 620px) {
  .topbar #archiveBtn {
    order: 3;
    margin-top: var(--s-8);
  }

  .archive-topbar .archive-topbar__title {
    order: 1;
    flex: 0 0 auto;
  }

  .archive-topbar .archive-project-image {
    width: var(--s-24);
    height: var(--s-24);
    flex-basis: var(--s-24);
    order: 1;
  }

  .archive-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .archive-row__open {
    padding: var(--s-12);
  }

  .archive-row__assignee span:last-child {
    display: none;
  }

  .archive-selection-bar {
    right: 8px;
    bottom: 8px;
    left: 8px;
    justify-content: space-between;
  }

  .bulk-edit-bar {
    bottom: 8px;
    left: 12px;
    transform: none;
    right: calc(16px + 48px + 12px);
    padding: var(--s-6);
  }

  .bulk-edit-bar__btn {
    min-height: 44px;
  }

  /* Narrow widths: the unloaded-stories warning takes its own row and wraps instead of
     truncating, so it stays readable on touchscreens with no hover tooltip. */
  .bulk-edit-bar__hint {
    flex-basis: 100%;
    white-space: normal;
    text-align: center;
  }

  #todoDialog .dialog__footer #archiveTodoBtn,
  #todoDialog .dialog__footer #restoreTodoBtn {
    min-height: 44px;
    font-size: var(--fs-13);
    font-weight: 700;
  }
}

.bulk-edit-dialog__hint {
  margin: 0 0 var(--s-12);
  font-size: var(--fs-14);
}

.bulk-edit-field {
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
  margin-bottom: var(--s-16);
}

.bulk-edit-field__check {
  display: flex;
  align-items: center;
  gap: var(--s-8);
  cursor: pointer;
  font-weight: 600;
  font-size: var(--fs-14);
}

.bulk-edit-field__check input {
  margin: 0;
}

.card__title-row {
  display: flex;
  align-items: baseline;
  gap: var(--s-6);
  min-width: 0;
}

.card__id-inline {
  font-size: var(--fs-10);
  font-weight: 400;
  color: var(--muted);
  opacity: 0.6;
  flex-shrink: 0;
}

.card__title {
  font-weight: 700;
  min-width: 0;
}

.card__tags {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 6px;
  row-gap: 6px;
  margin-top: var(--s-8);
  align-items: end;
}

.card__tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  grid-column: 1;
  min-width: 0;
}

/* Long unbroken tag names wrap inside the pill instead of overflowing the card. */
.board .card__tags-list .tag {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.card__badges {
  display: flex;
  align-items: center;
  gap: 6px;
  grid-column: 2;
  align-self: end;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}

/* When tags and badges share the footer, cap the badge column so badges wrap
   onto their own lines instead of squeezing tags into unreadable columns.
   The cap only binds when badges want more than their share; otherwise the
   footer renders exactly as before. */
.card__tags:has(> .card__tags-list > *):has(> .card__badges > *) {
  grid-template-columns: minmax(0, 1fr) fit-content(65%);
}

.card__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
  min-width: 0;
  position: relative;
}

.card__footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  margin-top: auto;
}

.todo-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  overflow: hidden;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.todo-avatar .user-avatar__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card__points {
  flex-shrink: 0;
  min-width: var(--s-20);
  height: var(--s-20);
  padding: 0 var(--s-6);
  border-radius: 999px;
  border: 1px solid rgba(96, 165, 250, 0.5);
  background: rgba(96, 165, 250, 0.18);
  color: var(--text);
  font-size: var(--fs-11);
  font-weight: 700;
  line-height: calc(18px * var(--ui-scale));
  text-align: center;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.card__priority {
  flex-shrink: 0;
  height: var(--s-20);
  padding: 0 var(--s-8);
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(148, 163, 184, 0.18);
  color: var(--text);
  font-size: var(--fs-11);
  font-weight: 700;
  line-height: calc(18px * var(--ui-scale));
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}


.card__due {
  flex-shrink: 0;
  height: var(--s-20);
  padding: 0 var(--s-8);
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(148, 163, 184, 0.18);
  color: var(--text);
  font-size: var(--fs-11);
  font-weight: 700;
  line-height: calc(18px * var(--ui-scale));
  white-space: nowrap;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
}

.card__field {
  flex-shrink: 1;
  min-width: 0;
  max-width: 12ch;
  height: var(--s-20);
  padding: 0 var(--s-8);
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: transparent;
  color: var(--text);
  font-size: var(--fs-11);
  font-weight: 600;
  line-height: calc(18px * var(--ui-scale));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  display: inline-block;
}

.card__due--overdue {
  border-color: rgba(239, 68, 68, 0.6);
  background: rgba(239, 68, 68, 0.16);
  color: #ef4444;
}

.card__top-actions {
  position: absolute;
  top: var(--s-6);
  right: var(--s-6);
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}

.card__overdue-warning {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--s-12);
  color: var(--danger);
  font-size: var(--fs-14);
  font-weight: 900;
  line-height: 1;
  pointer-events: auto;
}

.card__drag-handle {
  display: flex;
  flex-shrink: 0;
  width: var(--s-28);
  align-items: center;
  justify-content: center;
  color: var(--muted);
  opacity: 0.5;
  cursor: grab;
  touch-action: pan-y;
  /* Allow vertical scrolling but prevent horizontal */
  margin-left: 0;
  padding: var(--s-4);
}

.card__drag-handle:active {
  cursor: grabbing;
  opacity: 0.9;
}

@media (min-width: 768px) {
  .card__title-row {
    padding-right: calc(var(--s-28) + var(--s-20));
  }

  .card__drag-handle {
    position: static;
  }
}

/* Customize Workflow: hide "Done" label on mobile to save space; radio remains for selection */
@media (max-width: 767px) {
  .workflow-done-label-wrap .workflow-done-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}

/* Mobile cards: keep drag handle pinned to top-right regardless of tags/badges/title wrapping */
@media (max-width: 767px) {
  .card {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto 1fr;
    column-gap: var(--s-4);
    align-items: stretch;
    min-height: 96px;
  }

  .card__content {
    display: contents;
  }

  .card__title-row {
    grid-column: 1 / -1;
    grid-row: 1;
    /* Reserve room so wrapped titles do not run under the fixed drag handle. */
    padding-right: calc(var(--s-28) + var(--s-20));
  }

  .card__title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    max-height: calc(1.4em * 2);
    /* 2 lines */
  }

  .card__id-inline {
    font-size: var(--fs-9);
  }

  .card__tags {
    display: contents;
  }

  /* Tags and badges each get a full-width row: side by side, the auto-width badge column
     squeezed the tags column until tag names broke one character per line. */
  .card__tags-list {
    display: flex;
    gap: 6px;
    grid-column: 1 / -1;
    grid-row: 2;
    align-self: end;
    flex-wrap: wrap-reverse;
  }

  .card__drag-handle {
    display: flex;
    position: static;
    flex-direction: column;
    justify-content: center;
    margin-left: 0;
  }

  .card__badges {
    grid-column: 1 / -1;
    grid-row: 3;
    justify-self: start;
    justify-content: flex-start;
    align-self: end;
    flex-wrap: wrap;
    min-width: 0;
    margin-top: 6px;
  }

  /* :empty never matches here: the template leaves whitespace text inside the
     spans. :has(> *) hides containers with no actual element children. */
  .card__badges:not(:has(> *)) {
    display: none;
  }

  .card__tags-list:not(:has(> *)) {
    display: none;
  }
}

@media (max-width: 767px) {
  .card.card--agenda-timed {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
}

.card--ghost {
  opacity: 0.55;
}

.card--drag {
  opacity: 0.85;
  z-index: 9999 !important;
  position: relative;
}

.card--fallback {
  opacity: 0.9;
  z-index: 99999 !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  max-width: 90vw;
}

/* ============================================
   FILTERS & CHIPS
   ============================================ */

.filters {
  display: flex;
  align-items: center;
  gap: var(--s-10);
  margin-bottom: var(--s-12);
}

.filters__label {
  color: var(--muted);
  font-weight: 600;
}

.filters--omni {
  width: 100%;
  min-width: 0;
}

.filters--omni .omni-bar {
  display: flex;
  align-items: center;
  gap: var(--s-8);
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  max-width: none;
}

.filters--omni .search-input-wrapper {
  flex: 0 1 250px;
  width: 250px;
  min-width: 160px;
  margin-right: 0;
}

.filters--omni .search-input {
  width: 100%;
  max-width: none;
}

.omni-pinned-tags,
.omni-candidate-viewport {
  display: flex;
  min-width: 0;
  gap: var(--s-6);
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.omni-mobile-tag-pills {
  display: none;
}

.omni-pinned-tags::-webkit-scrollbar,
.omni-candidate-viewport::-webkit-scrollbar {
  display: none;
}

.omni-pinned-tags {
  flex: 0 1 auto;
  width: auto;
  max-width: none;
}

.omni-pinned-tags:empty {
  display: none;
}

.omni-candidate-region {
  display: flex;
  align-items: center;
  flex: 1 1 0;
  gap: var(--s-6);
  min-width: 6.5rem;
  overflow: hidden;
}

.omni-candidate-region--after-pins {
  padding-inline-start: var(--s-8);
  border-inline-start: 1px solid var(--border);
}

.omni-candidate-viewport {
  flex: 1 1 auto;
}

.omni-candidate-viewport--fade-start {
  -webkit-mask-image: linear-gradient(to inline-end, transparent, #000 var(--s-16));
  mask-image: linear-gradient(to inline-end, transparent, #000 var(--s-16));
}

.omni-candidate-viewport--fade-end {
  -webkit-mask-image: linear-gradient(to inline-start, transparent, #000 var(--s-16));
  mask-image: linear-gradient(to inline-start, transparent, #000 var(--s-16));
}

.omni-candidate-viewport--fade-start.omni-candidate-viewport--fade-end {
  -webkit-mask-image: linear-gradient(
    to inline-end,
    transparent,
    #000 var(--s-16),
    #000 calc(100% - var(--s-16)),
    transparent
  );
  mask-image: linear-gradient(
    to inline-end,
    transparent,
    #000 var(--s-16),
    #000 calc(100% - var(--s-16)),
    transparent
  );
}

.omni-tag-pill {
  flex: 0 0 auto;
  min-height: calc(30px * var(--ui-scale));
  padding: var(--s-4) var(--s-10);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font-size: var(--fs-13);
  font-weight: 600;
  white-space: nowrap;
}

@media (min-width: 768px) {
  .filters--omni .omni-bar,
  .omni-candidate-viewport {
    min-height: calc(30px * var(--ui-scale));
  }
}

button.omni-tag-pill {
  cursor: pointer;
}

button.omni-tag-pill:hover,
button.omni-tag-pill:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.omni-tag-pill--browse {
  background: color-mix(in srgb, var(--panel) 72%, transparent);
  border-color: color-mix(in srgb, var(--border) 70%, transparent);
  font-weight: 500;
}

.omni-candidate-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 calc(30px * var(--ui-scale));
  width: calc(30px * var(--ui-scale));
  min-height: calc(30px * var(--ui-scale));
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: var(--fs-18);
}

.omni-candidate-chevron:hover,
.omni-candidate-chevron:focus-visible {
  color: var(--accent);
  outline: none;
}

.omni-candidate-chevron[aria-hidden="true"] {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.omni-tag-pill--applied {
  display: inline-flex;
  align-items: center;
  gap: var(--s-6);
  padding-inline-end: var(--s-10);
}

.omni-tag-pill__prefix {
  margin-inline-end: var(--s-4);
  color: var(--muted);
  font-size: 0.85em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.omni-tag-pill__clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  height: 1.2rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: var(--fs-16);
}

.omni-tag-pill__clear:hover,
.omni-tag-pill__clear:focus-visible {
  background: color-mix(in srgb, currentColor 15%, transparent);
  outline: 2px solid currentColor;
  outline-offset: 1px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-8);
}

.chips--view-tabs {
  --view-tabs-scale: 1;
  flex-wrap: nowrap;
  width: 100%;
  min-width: 0;
  margin-top: 10px;
  padding: 4px;
  box-sizing: border-box;
  gap: calc(var(--s-8) * var(--view-tabs-scale));
}

.page--projects .chips--view-tabs {
  margin-bottom: 12px;
}

.chips--view-tabs .chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: calc(var(--fs-13) * var(--view-tabs-scale));
  padding: calc(var(--s-6) * var(--view-tabs-scale)) calc(10px * var(--view-tabs-scale));
}

.chips--view-tabs .dashboard-tab__label,
.chips--view-tabs .projects-tab__label {
  white-space: nowrap;
}

.chips--view-tabs .chip__count {
  flex-shrink: 0;
}

.chip {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: var(--s-6) 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: var(--fs-13);
}

.chip--active {
  border-color: rgba(96, 165, 250, 0.8);
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.35);
}

.chip--sprint {
  background: var(--chip-sprint-bg);
  color: var(--chip-sprint-text);
  border-color: rgba(128, 128, 128, 0.5);
}
.chip--sprint:hover {
  background: color-mix(in srgb, var(--chip-sprint-bg) 90%, var(--chip-sprint-text) 10%);
}
.chip--sprint:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.chip--sprint.chip--active {
  border-color: rgba(96, 165, 250, 0.8);
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.35);
}

/* Active sprint chip: green background, white text (both light and dark mode) */
.chip--active-sprint {
  background: #10B981 !important;
  color: white !important;
  border-color: #10B981 !important;
}
.chip--active-sprint:hover {
  background: #0d9668 !important;
  color: white !important;
}
.chip--active-sprint:focus-visible {
  outline: 2px solid #10B981;
  outline-offset: 2px;
}

/* Closed sprint chip: red background, white text (both light and dark mode) */
.chip--closed-sprint {
  background: #EF4444 !important;
  color: white !important;
  border-color: #EF4444 !important;
}
.chip--closed-sprint:hover {
  background: #dc2626 !important;
  color: white !important;
}
.chip--closed-sprint:focus-visible {
  outline: 2px solid #EF4444;
  outline-offset: 2px;
}

/* Planned sprint chip: orange background, white text (both light and dark mode) */
.chip--planned-sprint {
  background: #EA580C !important;
  color: white !important;
  border-color: #EA580C !important;
}
.chip--planned-sprint:hover {
  background: #c2410c !important;
  color: white !important;
}
.chip--planned-sprint:focus-visible {
  outline: 2px solid #EA580C;
  outline-offset: 2px;
}

.chip__count {
  color: var(--muted);
  margin-left: var(--s-6);
}

.chips-wrapper {
  display: flex;
  flex-direction: column;
  gap: var(--s-6);
  min-width: 0;
  flex: 1;
}

.chips-viewport {
  min-width: 0;
}

.chips-nav {
  display: none;
  align-items: center;
  justify-content: center;
  gap: var(--s-8);
}

.chips-nav.is-visible {
  display: flex;
}

.chips-nav__prev,
.chips-nav__next {
  padding: var(--s-4) 12px;
  font-size: var(--fs-14);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
}

.chips-nav__prev:hover:not(:disabled),
.chips-nav__next:hover:not(:disabled) {
  background: var(--bg);
}

.chips-nav__prev:disabled,
.chips-nav__next:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 767px) {

  .filters--omni .omni-bar {
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .omni-pinned-tags,
  .omni-candidate-region {
    display: none;
  }

  .omni-mobile-tag-pills {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    gap: var(--s-6);
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .omni-mobile-tag-pills:empty {
    display: none;
  }

  .omni-candidate-chevron {
    display: none;
  }

  .filters--omni .search-input-wrapper {
    flex: 0 1 clamp(120px, 42vw, 250px);
    width: clamp(120px, 42vw, 250px);
    min-width: 120px;
    max-width: 250px;
    margin: 0;
  }

  .filters--omni .search-input {
    width: 100% !important;
  }

  /* JS already slices chips to 2 rows per page; no CSS clipping needed */
  .chips-wrapper {
    position: relative;
    /* Right padding reserves space for the stacked nav buttons */
    padding-right: calc(44px * var(--ui-scale));
  }

  /* Stack nav buttons vertically on the far right; takes no layout space */
  .chips-nav {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    flex-direction: column-reverse;
    /* › (next/forward) on top, ‹ (prev/back) below */
    justify-content: center;
    gap: var(--s-4);
    background: transparent;
  }

  .chips-nav__prev,
  .chips-nav__next {
    padding: var(--s-6) 8px;
    font-size: var(--fs-13);
  }
}

.search-input-wrapper {
  position: relative;
  display: inline-block;
  margin-right: 0.5rem;
}

.search-input {
  padding: calc(0.5rem * var(--ui-scale)) calc(0.75rem * var(--ui-scale));
  /* Room for both the clear (✕) button and the filter-toggle chevron on the right edge. */
  padding-right: 3.25rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: calc(0.9rem * var(--ui-scale));
  width: 200px;
  min-width: 120px;
  max-width: 200px;
  background: var(--panel);
  color: var(--text);
  flex-shrink: 1;
}

.topbar--voice-commands-off .search-input {
  width: 250px;
  max-width: 250px;
}

/* Glow when focused or when there is typed text; disappears only when empty */
.search-input:focus,
.search-input:not(:placeholder-shown) {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent), 0 0 16px 4px rgba(96, 165, 250, 0.4);
}

.search-clear {
  position: absolute;
  /* Sits to the left of the always-present filter-toggle chevron so the two never overlap. */
  right: 1.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--fs-16);
  padding: calc(0.25rem * var(--ui-scale));
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 2px;
}

.search-clear:hover {
  background: var(--border);
  color: var(--text);
}

/* Filter toggle: small chevron affix on the search input that expands the
   assignee/sort popover. Dual-purposes the search box instead of adding a
   separate control to the topbar (which already wraps on narrow/PWA widths). */
.search-filter-toggle {
  position: absolute;
  right: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: calc(0.25rem * var(--ui-scale));
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 2px;
}

.search-filter-toggle:hover,
.search-filter-toggle[aria-expanded="true"] {
  background: var(--border);
  color: var(--text);
}

/* Slow pulse/glow: the only visual indicator (besides the one-shot toast) that
   an assignee filter or non-default sort is currently narrowing the board. */
@keyframes filter-toggle-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(96, 165, 250, 0.35);
  }
  50% {
    box-shadow: 0 0 10px 4px rgba(96, 165, 250, 0.55);
  }
}

.search-filter-toggle--active {
  color: var(--accent);
  animation: filter-toggle-pulse 2.2s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .search-filter-toggle--active {
    animation: none;
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.55);
  }
}

/* `position: fixed` (not `absolute`) is required here: `.topbar` sets
   `overflow-y: hidden` for its mobile chip-wrapping layout, which would clip
   an absolutely positioned descendant to the topbar's own box. `top`/`left`
   are set inline by positionFilterPanel() in board-filters.ts, computed from
   the toggle button's viewport position, since fixed positioning can't rely
   on a `right: 0` offset from an ancestor. */
.search-filter-panel {
  position: fixed;
  z-index: 20;
  min-width: 200px;
  max-width: calc(100vw - 20px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: var(--s-8);
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
}

.search-filter-panel[hidden],
/* The toggle and clear button set display:flex, which would otherwise beat
   the user-agent [hidden] rule (the public board hides them via `hidden`). */
.search-filter-toggle[hidden],
.search-clear[hidden] {
  display: none;
}

.search-filter-panel__section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.search-filter-panel__section + .search-filter-panel__section {
  border-top: 1px solid var(--border);
  padding-top: var(--s-8);
}

.search-filter-panel__label {
  font-size: var(--fs-13);
  font-weight: 600;
  color: var(--muted);
  padding: 2px var(--s-6);
}

.search-filter-option {
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
  font-size: var(--fs-13);
  text-align: left;
  padding: var(--s-6) var(--s-8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-filter-option:hover {
  background: var(--border);
}

.search-filter-option.is-active {
  border-color: rgba(96, 165, 250, 0.8);
  color: var(--accent);
  font-weight: 600;
}

.search-filter-option--active-sprint {
  border-left-color: var(--success);
}

.search-filter-option--closed-sprint {
  opacity: 0.72;
}

.search-filter-option--planned-sprint {
  border-left-color: var(--muted);
}

.no-results {
  text-align: center;
  padding: calc(2rem * var(--ui-scale));
  color: var(--muted);
  font-style: italic;
}

/* Desktop/tablet: keep .no-results out of the auto-fit grid so empty-search
   messaging cannot steal a lane track or compress columns. Mobile (≤620px)
   keeps .no-results as a normal flex sibling of .board. */
@media (min-width: 621px) {
  .board {
    position: relative;
  }

  .board > .no-results {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    pointer-events: none;
  }
}

/* ============================================
   BURNDOWN CHART
   ============================================ */

.charts-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: var(--s-16);
}

.chart-block {
  display: block;
  min-width: 0;
}

.burndown-chart {
  padding: var(--s-16);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.burndown-chart__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--s-12);
}

.burndown-chart__title {
  font-weight: 700;
  font-size: var(--fs-14);
  color: var(--text);
}

.burndown-chart__subtitle {
  font-size: var(--fs-12);
  margin-top: var(--s-2);
}

.burndown-chart__current {
  font-size: var(--fs-12);
  color: var(--muted);
}

.burndown-chart__subtitle-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-12);
  margin-top: var(--s-4);
}

.burndown-chart__subtitle-row .burndown-chart__subtitle {
  margin: 0;
}

.burndown-chart__nav-arrow {
  flex-shrink: 0;
  padding: 2px 6px;
  min-width: 0;
  font-size: var(--fs-12);
  color: var(--text);
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: var(--radius);
}
.burndown-chart__nav-arrow:hover:not(:disabled) {
  background: var(--border);
  color: var(--text);
}
.burndown-chart__nav-arrow:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.burndown-chart__container {
  position: relative;
  width: 100%;
  min-width: 0;
  height: 300px;
}

.burndown-chart__uplot {
  width: 100%;
  min-height: 240px;
}

.burndown-chart__no-data {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  padding: 1rem;
  text-align: center;
}

.burndown-chart__footer {
  display: flex;
  gap: 16px;
  padding-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

.burndown-chart__gap-marker {
  stroke: var(--border);
  stroke-width: 0.5;
  opacity: 0.35;
}

.burndown-chart__grid {
  stroke: var(--border);
  stroke-width: 0.5;
  opacity: 0.5;
}

.burndown-chart__grid-label {
  font-size: var(--fs-10);
  fill: var(--muted);
  dominant-baseline: hanging;
  text-anchor: start;
}

.burndown-chart__area {
  fill: var(--accent);
  opacity: 0.2;
}

.burndown-chart__line {
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.burndown-chart__line--points {
  stroke: #f59e0b;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.burndown-chart__line--flat {
  stroke-dasharray: 4 3;
}

.burndown-chart__point {
  fill: var(--accent);
  stroke: var(--bg);
  stroke-width: 1;
}

.burndown-chart__point--current {
  fill: var(--accent);
  stroke: var(--bg);
  stroke-width: 1.5;
}

.burndown-chart__point--points {
  fill: #f59e0b;
  stroke: var(--bg);
  stroke-width: 1;
}

.burndown-chart__scope-line {
  stroke: var(--muted);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.6;
}

.burndown-chart__scope-point {
  fill: var(--muted);
  stroke: var(--bg);
  stroke-width: 1;
  opacity: 0.6;
}

.burndown-chart__xaxis {
  position: relative;
  height: var(--s-20);
  margin-top: var(--s-4);
}

.burndown-chart__xaxis-label {
  position: absolute;
  transform: translateX(-50%);
  font-size: var(--fs-10);
  color: var(--muted);
  white-space: nowrap;
}

.burndown-chart__legend {
  display: flex;
  gap: var(--s-16);
  margin-top: var(--s-12);
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: var(--fs-11);
}

.burndown-chart__legend-item {
  display: flex;
  align-items: center;
  gap: var(--s-6);
}

.burndown-chart__legend-line {
  display: inline-block;
  width: var(--s-24);
  height: 2px;
  flex-shrink: 0;
}

.burndown-chart__legend-line.burndown-chart__line {
  background: var(--accent);
}

.burndown-chart__legend-line.burndown-chart__line--points {
  background: #f59e0b;
}

.burndown-chart__legend-line.burndown-chart__scope-line {
  background: var(--muted);
  opacity: 0.6;
  background-image: repeating-linear-gradient(to right,
      var(--muted) 0,
      var(--muted) 2px,
      transparent 2px,
      transparent 4px);
}

.burndown-chart__legend-label {
  color: var(--text);
  font-size: var(--fs-11);
}

/* ============================================
   CONTEXT MENU
   ============================================ */

.context-menu {
  position: fixed;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--s-4);
  z-index: 10000;
  min-width: 150px;
}

.context-menu__item {
  display: block;
  width: 100%;
  padding: var(--s-8) 12px;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  border-radius: var(--radius-6);
  font-size: var(--fs-14);
  font-weight: 500;
  transition: background-color 0.2s;
}

.context-menu__item:hover {
  background: var(--panel);
}

/* ============================================
   TOAST & EMPTY STATES
   ============================================ */

.toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: var(--s-10) 14px;
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
  box-shadow: var(--shadow);
  max-width: min(720px, calc(100vw - 24px));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 2147483647;
}

.toast--show {
  opacity: 1;
}

.empty {
  padding: calc(72px * var(--ui-scale)) var(--s-16);
  text-align: center;
  color: var(--muted);
}

.empty__title {
  color: var(--text);
  font-weight: 800;
}

/* ============================================
   UTILITIES
   ============================================ */

.muted {
  color: var(--muted);
  font-size: var(--fs-13);
}

/* Reduce interruptions on mobile: no callout (Chrome search / Apple magnification), no accidental selection.
   Only apply to .board or specific views that need it; do NOT apply to body globally, or the projects
   list will not scroll on mobile. See .page--projects in the mobile media block for the override. */
.no-interruptions {
  -webkit-touch-callout: none;
  /* iOS Safari */
  -webkit-user-select: none;
  /* Safari/Chrome/Opera */
  -moz-user-select: none;
  /* Firefox */
  -ms-user-select: none;
  /* IE/Edge */
  user-select: none;
  /* Standard */
  touch-action: manipulation;
  /* pan-x pan-y pinch-zoom; disables double-tap zoom delay */
}

/* Version label on login screen (bottom right) */
.app-version {
  position: fixed;
  bottom: 0;
  right: 0;
  padding: var(--s-6) 10px;
  font-size: var(--fs-12);
  color: var(--muted);
  opacity: 0.8;
  pointer-events: none;
}

/* Login/sign-in: center the form on desktop */
@media (min-width: 768px) {
  .page--auth .container {
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* Settings → Workflow: draft actions */
.settings-workflow-footer {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

@media (max-width: 768px) {
  .settings-workflow-footer {
    justify-content: center;
  }
}

/* Settings → Priorities: draft actions */
.settings-priorities-footer {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

@media (max-width: 768px) {
  .settings-priorities-footer {
    justify-content: center;
  }
}

@media (max-width: 767px) {
  .page--auth .topbar {
    direction: ltr;
    flex-wrap: nowrap;
  }

  .page--auth .topbar .locale-picker {
    flex: 0 0 auto;
    margin-inline-start: auto;
  }

  .page--auth .topbar .auth-locale-select {
    min-width: min(148px, 45vw);
    max-width: 48vw;
  }
}


/* ==========================================================================
   Scrumbaby sticky-note wall dialog (Postbaby-parity).
   Fullscreen entered-screen; dark theme tokens scoped to #wallDialog so they
   do not leak into the rest of the Scrumboy UI. Durable projects only.
   ========================================================================== */
#wallDialog.dialog--wall-fullscreen {
  /* Scoped Postbaby dark tokens. */
  --wall-bg-page: #1a1b1a;
  --wall-bg-header: #202120;
  --wall-fg: #e6e6e1;
  --wall-fg-muted: #9a9b95;
  --wall-border: #2f302e;
  --wall-textarea-bg: #1f201e;
  --wall-textarea-border: #4a4b47;
  --wall-note-text: #111;
  --wall-note-shadow:
    0 4px 8px 0 rgba(0, 0, 0, 0.35),
    0 6px 20px 0 rgba(0, 0, 0, 0.3);
  --wall-trash-bg: rgba(255, 255, 255, 0.04);
  --wall-trash-bg-active: rgba(224, 87, 75, 0.24);
  --wall-trash-border: rgba(255, 255, 255, 0.08);

  position: fixed;
  inset: 0;
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  transform: none;
  background: var(--wall-bg-page);
  color: var(--wall-fg);
  overflow: hidden;
}
#wallDialog.dialog--wall-fullscreen::backdrop {
  background: rgba(0, 0, 0, 0.85);
}

.wall-dialog__shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  position: relative;
  background: var(--wall-bg-page);
  color: var(--wall-fg);
}
.wall-logo {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 132px;
  height: auto;
  z-index: 1;
  pointer-events: none;
  user-select: none;
  opacity: 0.92;
}
.wall-shortcuts {
  position: absolute;
  left: 10px;
  bottom: 10px;
  color: var(--wall-fg-muted);
  font-size: 12px;
  line-height: 1.35;
  opacity: 0.8;
  font-family: "Kalam", sans-serif;
  z-index: 1;
  pointer-events: none;
  user-select: none;
}
/* Floating close — glyph only (no chip); still a comfortable hit target. */
.wall-fit-btn {
  position: absolute;
  top: 10px;
  right: 54px;
  min-width: 40px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--wall-fg);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  z-index: 1600;
}
.wall-fit-btn:hover { opacity: 0.75; }
.wall-fit-btn:focus-visible {
  outline: 2px solid var(--accent, #5aa3ff);
  outline-offset: 2px;
}

.wall-mode-toggle-btn {
  position: absolute;
  top: 10px;
  right: 98px;
  min-width: 40px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--wall-fg);
  cursor: pointer;
  z-index: 1600;
  opacity: 0.72;
  transition: opacity 120ms ease;
}
.wall-mode-toggle-btn svg {
  width: 24px;
  height: 24px;
  pointer-events: none;
}
.wall-mode-toggle-btn:hover {
  opacity: 0.9;
}
.wall-mode-toggle-btn:focus-visible {
  outline: 2px solid var(--accent, #5aa3ff);
  outline-offset: 2px;
}
.wall-mode-toggle-btn[aria-pressed="true"] {
  opacity: 1;
}

.wall-close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 40px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--wall-fg);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  z-index: 1400;
  transition: color 120ms ease, opacity 120ms ease;
}
.wall-close-btn:hover {
  opacity: 0.75;
}
.wall-close-btn:focus-visible {
  outline: 2px solid var(--accent, #5aa3ff);
  outline-offset: 2px;
}

.wall-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.wall-surface {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  /* Very light graph-paper grid to aid alignment without competing with notes. */
  background-color: var(--wall-bg-page);
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 24px 24px;
  outline: none;
  touch-action: none;
  user-select: none;
  cursor: default;
}
.wall-surface--readonly { cursor: default; }
.wall-surface--space-pan { cursor: grab; }
.wall-surface--space-pan.wall-surface--panning { cursor: grabbing; }
.wall-surface--pan-mode { cursor: grab; }
.wall-surface--pan-mode.wall-surface--panning { cursor: grabbing; }

.wall-note {
  position: absolute;
  box-sizing: border-box;
  padding: 16px 20px;
  border-radius: 15px;
  box-shadow: var(--wall-note-shadow);
  background: #4CAF50;
  color: var(--wall-note-text);
  z-index: 2;
  user-select: none;
  touch-action: none;
  cursor: grab;
  overflow: hidden;
  transition: box-shadow 120ms ease, transform 120ms ease;
}
.wall-note--dragging {
  cursor: grabbing;
  z-index: 1000;
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.45),
    0 14px 40px rgba(0, 0, 0, 0.35);
  transition: none;
}
/* Selected notes pulled to a mid z-index so they float above unselected
   peers while a marquee or group drag is underway, without eclipsing the
   actively-dragged stack (1000). Outline is layout-neutral. */
.wall-note--selected {
  z-index: 3;
  outline: 2px solid var(--accent, #5aa3ff);
  outline-offset: 2px;
}
.wall-note--selected.wall-note--dragging {
  z-index: 1000;
}
/* Postbaby parity: `.grid-item` keeps the note color; only `.edit-textarea`
   uses `--textarea-bg`. Do not paint the whole note dark here. */
.wall-note--editing {
  cursor: text;
  border-radius: 10px; /* matches inner textarea; Postbaby tightens corners in edit */
}
.wall-surface--readonly .wall-note { cursor: default; }

.wall-story {
  position: absolute;
  box-sizing: border-box;
  min-height: 88px;
  z-index: 4;
  cursor: grab;
  touch-action: none;
  user-select: none;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
  transition: box-shadow 120ms ease, transform 120ms ease, outline-color 120ms ease;
}
.wall-story--dragging {
  z-index: 1000;
  cursor: grabbing;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
  transition: none;
}
.wall-story--highlight {
  outline: 3px solid var(--accent, #5aa3ff);
  outline-offset: 4px;
  animation: wall-story-pulse 700ms ease-in-out 2;
}
.wall-story--archived {
  opacity: 0.62;
  filter: saturate(0.55);
}
.wall-surface--readonly .wall-story { cursor: pointer; }
.wall-story .card__content { pointer-events: none; }
@keyframes wall-story-pulse {
  50% { transform: scale(1.025); }
}

/* Shared inner inset so display ↔ edit does not move text; breathing room
   between copy and the editor’s inset edge (same numbers on both). */
.wall-note__display,
.wall-note__editor {
  padding: 8px;
}

.wall-note__display {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: hidden;
  color: inherit;
  font: inherit;
  font-size: 16px;
  line-height: 1.4;
  pointer-events: none;
}
/* Inset ring only (no border) so layout matches `.wall-note__display`; thin
   line reads lighter next to the padded text block. */
.wall-note__editor {
  width: 100%;
  height: 100%;
  min-height: 40px;
  box-sizing: border-box;
  margin: 0;
  resize: none;
  border: none;
  border-radius: 10px;
  outline: none;
  background: var(--wall-textarea-bg);
  color: var(--wall-fg);
  font: inherit;
  font-size: 16px;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow: hidden;
  box-shadow: inset 0 0 0 0.5px var(--wall-textarea-border);
}

.wall-note__resize-handle {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  opacity: 0.5;
  background:
    linear-gradient(135deg, transparent 40%, rgba(0,0,0,0.6) 40% 50%, transparent 50% 65%, rgba(0,0,0,0.6) 65% 75%, transparent 75%);
}
.wall-note__resize-handle:hover { opacity: 0.9; }

/* Edge overlay - SVG that connects notes via Shift+drag (Postbaby parity).
   The container ignores pointer events; only `.wall-edge-hit` opts in so the
   user can right-click a connection to delete it. Visual line is painted on
   top and is non-interactive. */
.wall-edge-overlay {
  overflow: visible;
  /* Below .wall-note (z-index: 2) so connections read like Postbaby */
  z-index: 0;
}
.wall-edge-hit:hover + .wall-edge-line,
.wall-edge-group:hover .wall-edge-line {
  stroke: #d6e8ff;
  stroke-opacity: 1;
  stroke-width: 3;
}

/* Wall trash image (scrumbabytrash.png) docked bottom-right — layout matches
   Postbaby's `.trash { position: fixed; bottom: 10px; right: 10px; ... }`. */
.wall-trash {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: 100px;
  height: 100px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  opacity: 0.55;
  transition: transform 200ms ease, opacity 200ms ease, filter 200ms ease;
  z-index: 1500;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.45));
}
.wall-trash--visible { opacity: 0.85; }
.wall-trash--active {
  opacity: 1;
  transform: scale(1.2);
  filter: drop-shadow(0 6px 14px rgba(224, 87, 75, 0.55));
}

/* Note right-click context menu. Reuses `.context-menu` base styling; this
   override raises it above wall notes and the edge overlay when painted
   inside the wall `<dialog>` top-layer. */
.wall-note-context-menu,
.wall-story-context-menu {
  z-index: 1300;
}

/* Marquee selection rectangle painted on `#wallSurface` during empty-canvas
   left-drag. Pointer-events disabled so the active pointermove/up listeners
   on document continue to fire untouched. */
.wall-marquee {
  position: absolute;
  border: 1px dashed var(--accent, #5aa3ff);
  background: rgba(90, 163, 255, 0.12);
  pointer-events: none;
  z-index: 1200;
}

.wall-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  color: var(--wall-fg-muted);
  font-size: 14px;
  pointer-events: none;
}
.wall-empty .muted { color: var(--wall-fg-muted); opacity: 0.75; }

/* ============================================
   RTL LAYOUT (Arabic)
   ============================================ */

[dir="rtl"] .locale-picker__button {
  text-align: right;
}

[dir="rtl"] .locale-picker__list {
  left: auto;
  right: 0;
}

[dir="rtl"] .todo-notes-tabs {
  margin-left: 0;
  margin-right: auto;
}

[dir="rtl"] .password-toggle {
  border-left: none;
  border-right: 1px solid var(--border);
}

[dir="rtl"] .dialog__footer .spacer {
  margin-left: 0;
  margin-right: auto;
}

@media (max-width: 767px) {
  [dir="rtl"] .dialog__footer .btn--danger {
    margin-left: 0;
    margin-right: auto;
  }
}

[dir="rtl"] .voice-command__tab {
  border-right: 0;
  border-left: 1px solid var(--border);
}

[dir="rtl"] .voice-command__tab:last-child {
  border-left: 0;
}

.todo-notes-image__annotation-layer {
  overflow: hidden;
  pointer-events: none;
}

#todoDialog .todo-markdown-preview .todo-notes-image,
#publicTodoDialog .todo-markdown-preview .todo-notes-image {
  position: relative;
  width: fit-content;
}

.todo-notes-drawing {
  display: inline-block;
  max-width: 100%;
  position: relative;
  vertical-align: top;
}

.todo-notes-drawing__svg {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 4px;
  display: block;
  height: auto;
  max-width: 100%;
  width: min(320px, 100%);
}

#todoBodyEditor .todo-notes-drawing.todo-notes-image--editor {
  max-width: 100%;
}

#todoBodyEditor .todo-notes-drawing .todo-notes-drawing__svg {
  cursor: pointer;
}

.todo-notes-drawing--missing .todo-notes-drawing__svg {
  border-style: dashed;
}

.notes-ink-host {
  position: relative;
}

.notes-ink-layer {
  left: 0;
  overflow: hidden;
  pointer-events: none;
  position: absolute;
  top: 0;
  z-index: 200;
}

.notes-ink-layer--drawing {
  cursor: crosshair;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.notes-ink-layer--drawing[data-tool="eraser"] {
  cursor: cell;
}

#todoBodyEditor.todo-notes-visual--inking .cm-editor,
#todoBodyEditor.todo-notes-visual--inking .cm-scroller {
  min-height: min(60vh, calc(24rem * var(--ui-scale)));
}

#todoBodyEditor.todo-notes-visual--inking .cm-editor {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent);
}

.notes-ink-toggle {
  align-items: center;
  display: inline-flex;
  justify-content: center;
  margin-inline-start: var(--s-8);
  min-height: 32px;
  min-width: 32px;
}

.notes-ink-toggle[hidden] {
  display: none;
}

.notes-ink-toggle[aria-pressed="true"] {
  background: var(--accent);
  color: #ffffff;
}

.notes-ink-tools {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4);
  margin-bottom: var(--s-6);
}

.notes-ink-tools[hidden] {
  display: none;
}

.notes-ink-tools__btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  cursor: pointer;
  font-size: var(--fs-12);
  min-height: 32px;
  min-width: 32px;
  padding: 0 var(--s-8);
}

.notes-ink-tools__btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.notes-ink-tools__btn:disabled {
  cursor: default;
  opacity: 0.45;
}

.notes-ink-tools__swatch,
.notes-ink-tools__size {
  padding: 0;
}

.notes-ink-tools__swatch::before {
  background: var(--swatch);
  border: 1px solid var(--border);
  border-radius: 999px;
  content: "";
  display: block;
  height: 16px;
  margin: auto;
  width: 16px;
}

.notes-ink-tools__swatch[aria-pressed="true"] {
  background: transparent;
  box-shadow: 0 0 0 2px var(--accent);
}

.notes-ink-tools__size::before {
  background: currentColor;
  border-radius: 999px;
  content: "";
  display: block;
  height: var(--dot);
  margin: auto;
  width: var(--dot);
}

.notes-ink-notice {
  color: var(--muted);
  font-size: var(--fs-12);
  margin-bottom: var(--s-6);
}

.notes-ink-notice[hidden] {
  display: none;
}

.notes-ink-preview-hint {
  color: var(--muted);
  font-size: var(--fs-12);
  margin: 0 0 var(--s-6);
}

.public-todo__notes--surface {
  border: 1px solid var(--border);
  border-radius: var(--radius-12);
  overflow: hidden;
}

@media (pointer: coarse) {
  .notes-ink-toggle,
  .notes-ink-tools__btn {
    min-height: 40px;
    min-width: 40px;
  }
}

.wall-ink-layer {
  height: 0;
  left: 0;
  pointer-events: none;
  position: absolute;
  top: 0;
  transform-origin: 0 0;
  width: 0;
  will-change: transform;
  z-index: 1;
}

.wall-drawing-active {
  opacity: 0.85;
}

.wall-draw-capture {
  cursor: crosshair;
  inset: 0;
  position: absolute;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  z-index: 1200;
}

.wall-draw-capture[data-tool="eraser"] {
  cursor: cell;
}

.wall-draw-toggle-btn {
  align-items: center;
  background: transparent;
  border: none;
  color: var(--wall-fg);
  cursor: pointer;
  display: inline-flex;
  font-size: 20px;
  justify-content: center;
  min-height: 40px;
  min-width: 40px;
  opacity: 0.72;
  padding: 0;
  position: absolute;
  right: 146px;
  top: 10px;
  z-index: 1600;
}

.wall-draw-toggle-btn:hover,
.wall-draw-toggle-btn[aria-pressed="true"] {
  opacity: 1;
}

.wall-draw-toggle-btn[aria-pressed="true"] {
  border-bottom: 2px solid currentColor;
}

.wall-draw-toggle-btn:focus-visible {
  outline: 2px solid var(--wall-fg);
  outline-offset: 2px;
}

.wall-draw-palette {
  align-items: center;
  background: rgba(17, 24, 39, 0.88);
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  left: 50%;
  max-width: calc(100% - 32px);
  padding: 6px 10px;
  position: absolute;
  top: 58px;
  transform: translateX(-50%);
  z-index: 1600;
}

.wall-draw-palette[hidden] {
  display: none;
}

.wall-draw-status {
  align-items: center;
  background: #7f1d1d;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  color: #fef2f2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  left: 50%;
  max-width: min(560px, calc(100% - 32px));
  padding: 8px 12px;
  position: absolute;
  top: 110px;
  transform: translateX(-50%);
  z-index: 1601;
}

.wall-draw-status[hidden] {
  display: none;
}

.wall-draw-status__text {
  flex: 1 1 220px;
  font-size: 13px;
}

.wall-draw-status__btn {
  background: transparent;
  border: 1px solid #fef2f2;
  border-radius: 999px;
  color: #fef2f2;
  cursor: pointer;
  font-size: 13px;
  min-height: 36px;
  padding: 0 14px;
}

.wall-draw-status__retry {
  background: #fef2f2;
  color: #7f1d1d;
}

.wall-draw-toggle-btn svg,
.notes-ink-toggle svg {
  pointer-events: none;
}

.wall-draw-palette__btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  color: #f9fafb;
  cursor: pointer;
  font-size: 13px;
  min-height: 36px;
  min-width: 36px;
  padding: 0 10px;
}

.wall-draw-palette__btn[aria-pressed="true"] {
  border-color: #f9fafb;
}

.wall-draw-palette__swatch,
.wall-draw-palette__size {
  padding: 0;
}

.wall-draw-palette__swatch::before {
  background: var(--swatch);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  content: "";
  display: block;
  height: 20px;
  margin: auto;
  width: 20px;
}

.wall-draw-palette__size::before {
  background: currentColor;
  border-radius: 999px;
  content: "";
  display: block;
  height: var(--dot);
  margin: auto;
  width: var(--dot);
}

@media (max-width: 620px) {
  .wall-draw-palette {
    border-radius: 16px;
    bottom: max(12px, env(safe-area-inset-bottom));
    top: auto;
  }
}

/* ============================================
   PUBLIC READ-ONLY BOARD
   ============================================ */

.public-board-badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  padding: var(--s-2) var(--s-10);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel2);
  color: var(--muted);
  font-size: var(--fs-12);
  font-weight: 600;
  white-space: nowrap;
}

/* The public search is type="search"; drop the browser's native cancel
   button so only the app's clear button shows beside the filter chevron. */
.page--public-board #publicSearchInput::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

.public-board__filter-error {
  grid-column: 1 / -1;
  width: 100%;
}

.public-board__filter-error .btn {
  margin-top: var(--s-12);
}

.public-board__empty-lane {
  padding: var(--s-10);
  text-align: center;
}

.card--public:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.public-board__load-more-mobile {
  border: none;
  background: transparent;
  color: var(--muted);
  min-width: 44px;
  min-height: 32px;
}

.public-todo__body {
  display: flex;
  flex-direction: column;
  gap: var(--s-12);
}

.public-todo__notes--plain {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.public-todo__chips,
.public-todo__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-6);
}

@media (max-width: 620px) {
  /* Public board only: no logo, so the project name may use the row instead
     of the member board's clamped brand width; Sign in sits after the spacer. */
  .page--public-board .topbar .public-board__project-name {
    flex: 0 1 auto;
    width: auto;
    max-width: none;
  }

  .page--public-board .topbar #publicSignInBtn {
    order: 1;
  }

  /* Public board only: the view-only badge is desktop-only. Sprint/priority
     filters live in the search input's popover, which stays available. */
  .page--public-board .public-board-badge {
    display: none;
  }
}
