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

:root {
  --bg: #0b0f17;
  --panel: #111827;
  --panel2: #0f172a;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --border: rgba(255, 255, 255, 0.08);
  --accent: #60a5fa;
  --danger: #ef4444;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --radius: 14px;
  --project-name-color: #EFBF04;
}

[data-theme="light"] {
  --bg: #f7f7f4;
  --panel: #ede8e0;
  --panel2: #e5dfd5;
  --text: #111827;
  --muted: #6b7280;
  --border: rgba(0, 0, 0, 0.12);
  --accent: #3b82f6;
  --danger: #dc2626;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  --project-name-color: #111827;

  /* 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;
  --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);
  }

  /* 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 */
  .col__head--backlog .col__title,
  .col__head--not_started .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, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.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: 32px 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 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  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: 56px;
  width: auto;
  object-fit: contain;
}

.landing__intro {
  font-size: 21px;
  line-height: 1.4;
  color: var(--text);
  margin: 4px 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: 12px 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: 14px 28px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 17px;
  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: 14px;
  padding: 0 18px;
}

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

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

.landing__badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 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: 12px;
  margin-bottom: 10px;
}

.landing__card-title {
  font-weight: 800;
  font-size: 16px;
  margin-bottom: 6px;
}

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

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

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

  .landing__logo {
    height: 40px;
  }

  .landing__intro {
    font-size: 16px;
    line-height: 1.3;
  }

  .landing__preview {
    margin: 10px 0;
    max-width: 100%;
    max-height: 35vh;
  }

  .landing__content {
    gap: 12px;
  }

  .btn--cta {
    width: 100%;
    padding: 12px 24px;
    font-size: 15px;
  }

  .landing__note {
    font-size: 12px;
  }

  .landing__highlights {
    gap: 12px;
  }
}

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

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 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: 32px;
  height: 32px;
  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: 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

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

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

.brand-text {
  height: 24px;
  width: auto;
  object-fit: contain;
}

.spacer {
  flex: 1;
}

.container {
  padding: 16px;
  max-width: 1600px;
  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: 16px;
}

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.panel__title {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

.view-toggle {
  display: flex;
  gap: 4px;
}

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

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

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

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

.textarea {
  resize: vertical;
}

.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: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  overflow: hidden;
}

.password-row .input {
  flex: 1;
  min-width: 0;
  width: auto;
  padding: 10px 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: 44px;
  width: 44px;
  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 .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: 12px;
    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: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: auto;
    min-width: 0;
    padding: 4px;
    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: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

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

.btn {
  background: rgba(96, 165, 250, 0.18);
  border: 1px solid rgba(96, 165, 250, 0.35);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 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--small {
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 13px;
}

.hamburger {
  font-size: 18px;
  line-height: 1;
  display: inline-block;
}

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

.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 */
}

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

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

.dialog__form {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 0 0 auto;
}

.dialog__header {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}

.dialog__header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* 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: 2px;
  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: 11px;
}

.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: 11px;
  }
}

.dialog__title {
  font-weight: 900;
  font-size: 16px;
}

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

.dialog__footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  flex-wrap: wrap;
}

/* 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: 2px;
  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;
}

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

/* 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);
  }

  .dialog__form {
    padding: 12px;
  }

  .dialog__footer {
    gap: 3px;
    flex-wrap: nowrap;
    overflow: hidden;
  }

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

  .dialog__footer .btn--small {
    padding: 6px 4px;
    font-size: 10px;
    min-width: 40px;
  }


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

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

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

  .list__item .btn--small {
    font-size: 11px;
    padding: 5px 8px;
  }

  .project-grid__name {
    font-size: 12px;
  }

  .project-grid__actions .btn {
    font-size: 10px;
    padding: 5px 6px;
  }

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

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

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

.settings-section {
  margin-bottom: 24px;
}

.settings-section__title {
  font-weight: 800;
  font-size: 16px;
  margin-bottom: 6px;
}

.settings-section__description {
  margin-bottom: 16px;
  font-size: 13px;
}

.settings-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

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

.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: 8px;
}

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

.settings-tag-name {
  font-weight: 500;
  font-size: 13px;
  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: 4px;
  flex-shrink: 0;
}

.settings-color-picker {
  width: 24px;
  height: 24px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  background: var(--bg);
  padding: 1px;
  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: 5px;
}

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

.settings-tag-item .settings-color-clear {
  padding: 4px 6px;
}

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

.settings-kv {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

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

.users-table td {
  padding: 12px;
  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: 8px;
  align-items: center;
}

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

.theme-selector {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  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: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.settings-backup-section {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.settings-backup-export,
.settings-backup-import {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-backup-preview {
  font-size: 13px;
  line-height: 1.6;
}

.settings-backup-confirmation {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  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: 6px;
  font-size: 13px;
  color: var(--danger);
}

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

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

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

input[type="radio"][name="importMode"] {
  margin-right: 8px;
  cursor: pointer;
}

label:has(input[type="radio"][name="importMode"]) {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 4px 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: 8px;
}

.tags-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.tags-add-btn {
  display: none;
  white-space: nowrap;
  padding: 8px 12px;
  height: 38px;
}

.tags-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 32px;
  padding: 4px;
  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: 4px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  font-size: 13px;
  line-height: 1.4;
}

.tag-chip-remove {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0;
  margin: 0;
  width: 16px;
  height: 16px;
  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: 12px;
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 999px;
}

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

  .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: 8px;
}

.list__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  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: 12px 12px 12px 12px;
  margin-bottom: 32px;
}
.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: 8px;
  padding: 4px 12px 4px 4px;
  font-size: 15px;
  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-img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

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

.dashboard-project-group .list {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.dashboard-todo__status {
  margin-bottom: 4px;
}

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

.dashboard-todo__title-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  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: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  border: 1px solid rgba(96, 165, 250, 0.5);
  background: rgba(96, 165, 250, 0.18);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  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: 48px;
}

.dashboard-stats {
  display: none;
}

.dashboard-stats__item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dashboard-stats__label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.dashboard-stats__value {
  font-size: 24px;
  font-weight: 700;
  color: var(--fg);
}

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

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

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

  .dashboard-stats {
    display: block;
    flex-shrink: 0;
    width: 200px;
    padding: 16px;
    background: var(--panel2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }
}

.status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  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;
}

.project-image-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

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

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

.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: 48px;
  background: var(--panel);
}

.project-grid__content {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

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

.project-grid__actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

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

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

.board {
  display: grid;
  grid-template-columns: repeat(5, 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: 12px;
}

.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;
}

.col * {
  border-color: inherit;
}

.col__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 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 {
  background: #10B981;
}

.col__head--in_progress .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: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 200px;
  border: none;
  background: transparent;
}

.col__load-more {
  flex-shrink: 0;
  padding: 6px 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: 8px;
  margin-bottom: 12px;
  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: 10px 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  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: 16px;
    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 {
    gap: 8px;
    padding: 8px 10px;
    flex-wrap: wrap;
    min-width: 0;
    align-items: center;
  }

  .topbar .brand {
    flex-shrink: 1;
    min-width: 0;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.875rem;
    gap: 4px;
  }

  /* 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: 24px;
    width: auto;
  }

  .topbar .brand-text {
    max-width: 70px;
    height: 18px;
    object-fit: contain;
    flex-shrink: 1;
  }

  /* First row: back button, project image, brand, spacer, settings, members button, avatar */
  .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 .spacer {
    flex: 1;
    min-width: 0;
  }

  /* Second row: search, rename (if exists), New Todo, Delete Project */
  .topbar .search-input-wrapper {
    order: 2;
    flex: 1;
    min-width: 120px;
    max-width: none;
    margin-right: 16px;
    margin-top: 8px;
  }

  .topbar #renameProjectBtn {
    order: 2;
    margin-top: 8px;
    margin-right: 16px;
  }

  .topbar #newTodoBtn {
    order: 2;
    margin-top: 8px;
    margin-right: 4px;
  }

  .topbar #deleteProjectBtn {
    order: 2;
    margin-top: 8px;
  }

  .search-input {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    font-size: 0.85rem;
    padding: 0.4rem 0.6rem;
    padding-right: 1.75rem;
  }

  .search-clear {
    right: 0.5rem;
    font-size: 0.9rem;
    width: 18px;
    height: 18px;
    padding: 0;
  }

  .topbar .btn {
    padding: 8px 12px;
    font-size: 0.85rem;
    white-space: nowrap;
    flex-shrink: 0;
    border-radius: 8px;
    font-weight: 500;
  }

  .topbar .btn#newTodoBtn {
    margin-right: 4px;
    position: relative;
    color: transparent;
  }

  .topbar .btn#newTodoBtn::after {
    content: "New";
    font-size: 0.85rem;
    font-weight: 500;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    white-space: nowrap;
    color: var(--text);
  }

  .topbar .btn#deleteProjectBtn {
    /* Already has order: 2, will appear in second row */
  }

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

  .topbar #renameProjectBtn {
    margin-right: 8px;
  }

  .topbar .hamburger {
    font-size: 1rem;
    line-height: 1;
  }

  .user-avatar {
    width: 32px;
    height: 32px;
    font-size: 12px;
    margin-left: 8px;
  }

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

  .project-image-topbar-btn {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
  }

  .project-image-topbar,
  .project-image-topbar-placeholder {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
  }

  .project-image-topbar-placeholder {
    font-size: 16px;
  }

  /* 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: 8px;
    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: 4px;
    margin-bottom: 0;
    margin-top: 0;
    border-bottom: none;
    border-right: 1px solid var(--border);
    padding-right: 8px;
    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: 8px 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: 12px;
    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 */
  }

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

  /* Apply status-based background colors to mobile tabs */
  .mobile-tab[data-tab="BACKLOG"] {
    background: #9CA3AF;
    color: #ffffff;
    border-radius: 8px 0 0 8px;
  }

  .mobile-tab[data-tab="NOT_STARTED"] {
    background: #F59E0B;
    color: #ffffff;
    border-radius: 8px 0 0 8px;
  }

  .mobile-tab[data-tab="IN_PROGRESS"] {
    background: #10B981;
    color: #ffffff;
    border-radius: 8px 0 0 8px;
  }

  .mobile-tab[data-tab="TESTING"] {
    background: #3B82F6;
    color: #ffffff;
    border-radius: 8px 0 0 8px;
  }

  .mobile-tab[data-tab="DONE"] {
    background: #EF4444;
    color: #ffffff;
    border-radius: 8px 0 0 8px;
  }

  .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: 8px 0 0 8px;
    transition: background 0.15s, opacity 0.15s;
    opacity: 0;
    min-height: 0;
  }

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

  .mobile-board-wrapper.dragging #tab_drop_BACKLOG {
    pointer-events: auto;
    opacity: 0.3;
    background: #9CA3AF;
  }

  .mobile-board-wrapper.dragging #tab_drop_NOT_STARTED {
    pointer-events: auto;
    opacity: 0.3;
    background: #F59E0B;
  }

  .mobile-board-wrapper.dragging #tab_drop_IN_PROGRESS {
    pointer-events: auto;
    opacity: 0.3;
    background: #10B981;
  }

  .mobile-board-wrapper.dragging #tab_drop_TESTING {
    pointer-events: auto;
    opacity: 0.3;
    background: #3B82F6;
  }

  .mobile-board-wrapper.dragging #tab_drop_DONE {
    pointer-events: auto;
    opacity: 0.3;
    background: #EF4444;
  }

  /* When Sortable hovers a card over a specific tab drop zone, glow with the lane's color */
  #tab_drop_BACKLOG.sortable-drag-over,
  #tab_drop_BACKLOG:has(.card--ghost-tab) {
    opacity: 1 !important;
    background: #9CA3AF !important;
    box-shadow: 0 0 16px 6px rgba(156, 163, 175, 0.85);
  }

  #tab_drop_NOT_STARTED.sortable-drag-over,
  #tab_drop_NOT_STARTED:has(.card--ghost-tab) {
    opacity: 1 !important;
    background: #F59E0B !important;
    box-shadow: 0 0 16px 6px rgba(245, 158, 11, 0.85);
  }

  #tab_drop_IN_PROGRESS.sortable-drag-over,
  #tab_drop_IN_PROGRESS:has(.card--ghost-tab) {
    opacity: 1 !important;
    background: #10B981 !important;
    box-shadow: 0 0 16px 6px rgba(16, 185, 129, 0.85);
  }

  #tab_drop_TESTING.sortable-drag-over,
  #tab_drop_TESTING:has(.card--ghost-tab) {
    opacity: 1 !important;
    background: #3B82F6 !important;
    box-shadow: 0 0 16px 6px rgba(59, 130, 246, 0.85);
  }

  #tab_drop_DONE.sortable-drag-over,
  #tab_drop_DONE:has(.card--ghost-tab) {
    opacity: 1 !important;
    background: #EF4444 !important;
    box-shadow: 0 0 16px 6px rgba(239, 68, 68, 0.85);
  }

  /* 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;
  }

  /* 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: 32px;
    padding: 2px 8px 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: 13px;
    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: horizontal scrolling without scrollbars */
  .settings-tabs {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    margin-bottom: 16px;
  }

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

  .settings-tab {
    flex-shrink: 0;
  }

  /* 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: 12px;
  padding: 10px 10px;
  cursor: pointer;
  position: relative;
}

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

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

.card--in_progress {
  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--testing:hover {
  border-color: #3B82F6;
}

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

.card:focus {
  outline: none;
}

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

.card__title-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

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

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

.card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.card__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  position: relative;
}

.card__points {
  position: absolute;
  bottom: 6px;
  right: 8px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  border: 1px solid rgba(96, 165, 250, 0.5);
  background: rgba(96, 165, 250, 0.18);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  pointer-events: none;
}


.card__drag-handle {
  display: none;
  flex-shrink: 0;
  width: 28px;
  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: 8px;
  padding: 4px;
}

.card__drag-handle:active {
  cursor: grabbing;
  opacity: 0.9;
}

/* Show drag handle only in mobile view */
@media (max-width: 767px) {
  .card {
    flex-direction: row;
    align-items: stretch;
    min-height: 96px;
    /* Increased to accommodate 2-line title + tags without pushing down */
  }

  .card__content {
    align-items: flex-start;
    /* Align content to the left */
    justify-content: flex-start;
    padding-right: 4px;
    /* Add some spacing between content and drag handle */
  }

  .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: 9px;
  }

  .card__drag-handle {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 8px;
  }

  .card__points {
    bottom: 6px;
    right: 15px;
  }

}

.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: 10px;
  margin-bottom: 12px;
}

.filters__label {
  color: var(--muted);
  font-weight: 600;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}

.chip--active {
  border-color: rgba(96, 165, 250, 0.65);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.12);
}

.chip__count {
  color: var(--muted);
  margin-left: 6px;
}

.chips-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.chips-viewport {
  min-width: 0;
}

.chips-nav {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.chips-nav.is-visible {
  display: flex;
}

.chips-nav__prev,
.chips-nav__next {
  padding: 4px 12px;
  font-size: 14px;
  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) {

  /* 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: 44px;
  }

  /* 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: 4px;
    background: transparent;
  }

  .chips-nav__prev,
  .chips-nav__next {
    padding: 6px 8px;
    font-size: 13px;
  }
}

.search-input-wrapper {
  position: relative;
  display: inline-block;
  margin-right: 0.5rem;
}

.search-input {
  padding: 0.5rem 0.75rem;
  padding-right: 2rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.9rem;
  width: 200px;
  min-width: 120px;
  max-width: 200px;
  background: var(--panel);
  color: var(--text);
  flex-shrink: 1;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
}

.search-clear {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.25rem;
  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);
}

.no-results {
  text-align: center;
  padding: 2rem;
  color: var(--muted);
  font-style: italic;
}

/* ============================================
   BURNDOWN CHART
   ============================================ */

.charts-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 16px;
}

.burndown-chart {
  padding: 16px;
  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: 12px;
}

.burndown-chart__title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
}

.burndown-chart__current {
  font-size: 12px;
  color: var(--muted);
}

.burndown-chart__container {
  position: relative;
  width: 100%;
  height: 150px;
}

.burndown-chart__svg {
  width: 100%;
  height: 120px;
  display: block;
}

.burndown-chart__grid {
  stroke: var(--border);
  stroke-width: 0.5;
  opacity: 0.5;
}

.burndown-chart__grid-label {
  font-size: 10px;
  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__point {
  fill: var(--accent);
  stroke: var(--bg);
  stroke-width: 1;
}

.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: 20px;
  margin-top: 4px;
}

.burndown-chart__xaxis-label {
  position: absolute;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}

.burndown-chart__legend {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 11px;
}

.burndown-chart__legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.burndown-chart__legend-line {
  display: inline-block;
  width: 24px;
  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: 11px;
}

/* ============================================
   CONTEXT MENU
   ============================================ */

.context-menu {
  position: fixed;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 4px;
  z-index: 10000;
  min-width: 150px;
}

.context-menu__item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  border-radius: 6px;
  font-size: 14px;
  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: 10px 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;
}

.toast--show {
  opacity: 1;
}

.empty {
  padding: 72px 16px;
  text-align: center;
  color: var(--muted);
}

.empty__title {
  color: var(--text);
  font-weight: 800;
}

/* ============================================
   UTILITIES
   ============================================ */

.muted {
  color: var(--muted);
  font-size: 13px;
}

/* 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: 6px 10px;
  font-size: 0.75rem;
  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;
  }
}