/* Light mode retains the original palette. Dark overrides share surface tokens. */
.theme-toggle {
  min-width: 34px;
}
.password-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 440px;
  max-width: 100%;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --teal: #4b556b;
  --ink: #e5e7eb;
  --muted: #a7acb6;
  --border: #3b404a;
  --canvas: #15171c;
  --surface: #1d2026;
  --surface-raised: #272b33;
  --surface-hover: #333843;
  --accent: #bbc5d8;
  --hint: #a3a9b4;
}

:root[data-theme="dark"]
  :is(
    .topbar,
    .board-tile,
    .template-card,
    .admin-table-wrapper,
    .modal,
    .modal-header,
    .password-card
  ) {
  background: var(--surface);
  border-color: var(--border);
}
:root[data-theme="dark"]
  :is(.sidebar, .lane, .ticket-side-fields, .permission-help, .admin-table th) {
  background: #191c22;
  border-color: var(--border);
}
:root[data-theme="dark"]
  :is(.button, .ticket, .comment .markdown-content, .search-box, .art-card) {
  color: var(--ink);
  background: var(--surface-raised);
  border-color: var(--border);
}
:root[data-theme="dark"]
  :is(
    .button:hover,
    .ticket:hover,
    .icon-button:hover,
    .nav-item:hover,
    .sidebar-board:hover,
    .sidebar-board.selected
  ) {
  background: var(--surface-hover);
  border-color: #69717f;
  color: var(--ink);
}
:root[data-theme="dark"] :is(.button.primary, .brand-mark) {
  color: #fff;
  background: var(--teal);
  border-color: #626d83;
}
:root[data-theme="dark"] .button.primary:hover {
  background: #59647c;
  border-color: #78849b;
}
:root[data-theme="dark"] .button.danger {
  background: #92464e;
  border-color: #ad6168;
  color: #fff;
}
:root[data-theme="dark"] .button.danger-ghost {
  background: #33282d;
  border-color: #715259;
  color: #e3aeb2;
}
:root[data-theme="dark"] .button.danger-ghost:hover {
  background: #483139;
}
:root[data-theme="dark"]
  :is(
    .ticket h3,
    .field > label,
    .field-label,
    .permission-help strong,
    .creator-info strong,
    .activity-item strong,
    .art-list strong,
    .art-caption h2
  ) {
  color: var(--ink);
}
:root[data-theme="dark"]
  :is(
    .eyebrow,
    .workspace-name,
    .workspace-summary small,
    .quiet-badge,
    .nav-item,
    .sidebar-board,
    .sidebar-heading,
    .sidebar-empty,
    .sidebar-tip p,
    .sidebar-tip .icon,
    .icon-button,
    .tab,
    .board-tile-info > div,
    .new-board-tile small,
    .empty-boards p,
    .template-count,
    .template-card > p,
    .template-card > span,
    .dashboard-footer,
    .lane-count,
    .column-grip,
    .card-meta > div > span,
    .add-card,
    .no-matches,
    .form-hint,
    .field-hint,
    .checkbox-field,
    .member-row small,
    .permission-help p,
    .danger-zone p,
    .ticket-context,
    .creator-info,
    .ticket-lower h3 .icon,
    .comment-heading time,
    .activity-item p,
    .activity-item time,
    .readonly-note,
    .ticket-move summary,
    .admin-table th,
    .table-user small,
    .admin-role,
    .admin-footnote,
    .auth-note,
    .auth-footer,
    .art-caption .eyebrow,
    .art-list small,
    .art-bottom
  ) {
  color: var(--hint);
}
:root[data-theme="dark"] :is(.tab.active, .empty-boards h3, .art-done) {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
:root[data-theme="dark"]
  :is(
    .avatar,
    .workspace-avatar,
    .nav-count,
    .tab span,
    .estimate,
    .role-badge.neutral,
    .label-check span,
    .count-pill,
    .art-avatar
  ) {
  background: #3a404d;
  color: #d8deea;
  border-color: #525b6c;
}
:root[data-theme="dark"] :is(.account-button:hover, .nav-item.active) {
  background: #343b4b;
  color: #d6deee;
}
:root[data-theme="dark"] .new-board-tile {
  background: #1c1f25;
  color: var(--accent);
  border-color: #4a515d;
}
:root[data-theme="dark"] .new-board-tile:hover {
  background: #282d36;
  border-color: #7d879a;
}
:root[data-theme="dark"] .new-board-tile > span {
  background: #353c4a;
  color: #c3ccdc;
}
:root[data-theme="dark"]
  :is(
    .template-section,
    .member-row,
    .danger-zone,
    .list-move-actions,
    .creator-info,
    .ticket-lower,
    .admin-table td
  ) {
  border-color: var(--border);
}
:root[data-theme="dark"] .template-illustration {
  background: #292e36;
}
:root[data-theme="dark"] .template-1 {
  background: #2b303b;
}
:root[data-theme="dark"] .template-2 {
  background: #35302e;
}
:root[data-theme="dark"] .template-3 {
  background: #312e3a;
}
:root[data-theme="dark"] .template-illustration .mini-list {
  background: #49505c;
}
:root[data-theme="dark"] .template-1 .mini-list {
  background: #485466;
}
:root[data-theme="dark"] .template-2 .mini-list {
  background: #62564f;
}
:root[data-theme="dark"] .template-3 .mini-list {
  background: #575163;
}
:root[data-theme="dark"] .mini-list span {
  background: #d9dde599;
}

/* Neutral board surfaces use selected colors only as small identity accents. */
:root[data-theme="dark"] .board-workspace {
  background: linear-gradient(145deg, #1b1e24, #121418);
}
:root[data-theme="dark"] .board-tile-cover {
  background: linear-gradient(145deg, #2d323d, #20242d);
  border-top: 3px solid var(--board-color);
}
:root[data-theme="dark"] .button.board-button {
  background: #2b303a;
  border: 1px solid #505969;
  color: #dce1eb;
}
:root[data-theme="dark"] .button.board-button:hover {
  background: #3a414f;
}
:root[data-theme="dark"] .ticket:hover {
  border-color: #8590a6;
}
:root[data-theme="dark"] .priority-chip.priority-urgent {
  color: #e5b1b5;
}
:root[data-theme="dark"] .add-card:hover {
  background: var(--surface-hover);
  color: var(--ink);
}
:root[data-theme="dark"] .drop-target {
  box-shadow: inset 0 0 0 3px #9ba7be;
}
:root[data-theme="dark"] .modal::backdrop {
  background: #080a10b8;
}
:root[data-theme="dark"] :is(input, select, textarea) {
  color: var(--ink);
  background: #1a1d23;
  border-color: #454c59;
}
:root[data-theme="dark"] :is(input, select, textarea):focus {
  border-color: #9aa7bf;
  box-shadow: 0 0 0 3px #9aa7bf30;
}
:root[data-theme="dark"] :is(input, select, textarea):disabled {
  background: #2b2f37;
  color: #bbc1cc;
}
:root[data-theme="dark"] :is(input, textarea)::placeholder {
  color: #9da5b3;
}
:root[data-theme="dark"] :is(#board-search, #ticket-search) {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}
:root[data-theme="dark"] .form-error,
:root[data-theme="dark"] .danger-zone h3 {
  color: #e3aeb2;
}
:root[data-theme="dark"] .color-choices input:checked + span {
  box-shadow:
    0 0 0 2px var(--surface),
    0 0 0 4px #99a5bc;
}
:root[data-theme="dark"] .activity-dot {
  background: #98a4bc;
}
:root[data-theme="dark"] .status-badge {
  background: #35414c;
  color: #c4d0df;
}
:root[data-theme="dark"] .status-badge.pending {
  background: #413a30;
  color: #d8c6a1;
}
:root[data-theme="dark"] .auth-art {
  background: #252a33;
}
:root[data-theme="dark"] .art-orbit {
  border-color: #939eb430;
}
:root[data-theme="dark"] .art-sun {
  background: #3d4656;
  box-shadow: 0 0 70px #a4b0c710;
}
:root[data-theme="dark"] .art-board {
  background: #343c4b;
  border-color: #586276;
}
:root[data-theme="dark"] .art-list {
  background: #232830;
}
:root[data-theme="dark"] .art-card {
  box-shadow: 0 1px 0 #525b6c;
}
:root[data-theme="dark"] .art-lines {
  border-color: #667187;
}
:root[data-theme="dark"] .password-page {
  background:
    radial-gradient(ellipse at top, #2c3340, transparent 65%), var(--canvas);
}

:root[data-theme="dark"] :focus-visible {
  outline-color: #9aa7bf;
}
:root[data-theme="dark"] :is(.brand-dot, .initial-loading) {
  color: var(--accent);
}
:root[data-theme="dark"] .priority-chip.priority-low i {
  background: #9ca5b5;
}
:root[data-theme="dark"] .create-preview {
  background: linear-gradient(145deg, #2d323d, #20242d);
  border-top: 3px solid var(--board-color);
}
:root[data-theme="dark"] .art-board {
  box-shadow: 0 25px 45px #00000030;
}
:root[data-theme="dark"] .art-label {
  background: #909bb1;
}
:root[data-theme="dark"] .art-label.coral {
  background: #b09688;
}
:root[data-theme="dark"] .toast {
  background: #343e50;
}
:root[data-theme="dark"] .toast-error {
  background: #70464e;
}

@media (max-width: 1000px) {
  .password-header .theme-toggle span {
    display: none;
  }
  .password-header .theme-toggle {
    padding: 7px;
  }
}
