/* Themes are opt-in: no selectors apply to the original dark palette unless
   requested via html[data-theme="light"]. Dark styles in kitn.css stay untouched. */

/* Toggle works in either theme and inherits current text/surface tokens. */
.sidebar-theme { margin-top:auto; }
.sidebar-theme + .sidebar-footer { margin-top:0; }
.theme-toggle {
  display:flex; align-items:center; gap:.65rem; width:100%;
  min-height:2.35rem; padding:.45rem .55rem;
  background:transparent; border:1px solid transparent; border-radius:8px;
  color:var(--muted); font-size:.875rem; text-align:left;
}
.theme-toggle:hover { color:var(--ink); background:var(--surface-raised); }
.theme-toggle svg { flex:none; }
.theme-toggle svg[hidden] { display:none !important; }
.theme-toggle:focus-visible { outline:2px solid var(--gold); outline-offset:2px; }
.auth-theme-switch { position:fixed; top:1rem; right:1rem; width:auto; z-index:5; }

/* Near-white light palette with unchanged gold #D5B16A. */
html[data-theme="light"] {
  color-scheme:light;
  --background:#FAF9F6;
  --surface:#FFFFFF;
  --surface-raised:#F4F2ED;
  --ink:#202124;
  --muted:#666B72;
  --line:#E2E0DB;
  --gold:#D5B16A;
  --gold-ink:#866328;
  --red:#B24840;
  --green:#2F7651;
  --blue:#376B9A;
  --glass-border:rgba(31,35,39,.11);
  --glass-top:rgba(255,255,255,.82);
  --glass-bottom:rgba(255,255,255,.35);
}
html[data-theme="light"] body { background:var(--background); color:var(--ink); }
html[data-theme="light"] .sidebar {
  background:linear-gradient(160deg,#F7F6F2,#F1F0EB);
  border-right:1px solid var(--line);
}
html[data-theme="light"] .brand-icon,
html[data-theme="light"] .project-icon {
  color:var(--gold-ink); background:#FCF7EA; border-color:#DED0B0;
}
html[data-theme="light"] .main-nav [aria-current] {
  color:var(--gold-ink); background:rgba(213,177,106,.15);
  border-color:rgba(166,123,49,.27);
  box-shadow:inset 2px 0 0 #C39850;
}
html[data-theme="light"] .sidebar-projects .selected-project {
  background:#EAE7DF; box-shadow:inset 2px 0 0 #C39850; color:var(--ink);
}
html[data-theme="light"] .main-nav a:hover,
html[data-theme="light"] .sidebar-projects a:hover { background:rgba(31,35,39,.055); color:var(--ink); }
html[data-theme="light"] .icon-work { box-shadow:inset 0 -.25rem #E5E0D4; }
html[data-theme="light"] .panel,
html[data-theme="light"] .day-bar,
html[data-theme="light"] .metric,
html[data-theme="light"] .project-card,
html[data-theme="light"] .project-goals-link,
html[data-theme="light"] .goals-list,
html[data-theme="light"] .project-remaining-list,
html[data-theme="light"] .project-priority,
html[data-theme="light"] .quick-goal-form,
html[data-theme="light"] .goals-page .panel {
  background:linear-gradient(150deg,rgba(255,255,255,.97),rgba(252,251,248,.86));
  border-color:var(--line);
  box-shadow:0 3px 16px rgba(30,27,20,.035),inset 0 1px 0 rgba(255,255,255,.85);
}
html[data-theme="light"] .panel,
html[data-theme="light"] .project-card { -webkit-backdrop-filter:none; backdrop-filter:none; }
html[data-theme="light"] .focus-card {
  background:linear-gradient(110deg,rgba(213,177,106,.105),rgba(255,255,255,.98) 59%),#FFFFFF;
  border-color:rgba(166,123,49,.42);
  box-shadow:inset 0 1px 0 #fff,0 0 0 1px rgba(213,177,106,.04),0 8px 24px rgba(75,61,34,.065);
}
html[data-theme="light"] .focus-card #focus-title { color:var(--gold-ink); }
html[data-theme="light"] .task-selected {
  background:rgba(213,177,106,.13); box-shadow:inset 2px 0 0 #C39850;
}
html[data-theme="light"] .queue-clickable.task-selected:hover { background:rgba(213,177,106,.19); }
html[data-theme="light"] .queue-clickable:hover:not(.task-selected),
html[data-theme="light"] .queue-clickable:hover { background:rgba(31,35,39,.04); }
html[data-theme="light"] .badge { background:#F0EFEA; color:#5A5D63; }
html[data-theme="light"] .badge-active {
  color:var(--gold-ink); background:rgba(213,177,106,.18);
  border-color:rgba(166,123,49,.19);
}
html[data-theme="light"] .badge-ready { background:#F0EFEA; color:#60646B; }
html[data-theme="light"] .badge-done { background:#E8F4EC; color:var(--green); }
html[data-theme="light"] .badge-waiting { background:#E8F1FA; color:var(--blue); }
html[data-theme="light"] .badge-cancelled { background:#FCEFEB; color:var(--red); }
html[data-theme="light"] .primary {
  background:var(--gold); border-color:var(--gold);
  color:#241B0E; box-shadow:none;
}
html[data-theme="light"] .primary:hover { background:#E1C385; border-color:#E1C385; color:#241B0E; }
html[data-theme="light"] .outlined {
  background:rgba(255,255,255,.86); color:var(--ink); border-color:#D0CEC7;
}
html[data-theme="light"] .outlined:hover { background:#F1EFE9; border-color:#B8B6AE; }
html[data-theme="light"] .ghost { color:var(--muted); }
html[data-theme="light"] .ghost:hover { background:#F1EFE9; color:var(--ink); }
html[data-theme="light"] .destructive { color:var(--red); background:#FCEFEB; border-color:#E5B8B2; }
html[data-theme="light"] .destructive:hover { background:#F8DDD8; }
html[data-theme="light"] .trash-danger { color:var(--red); }
html[data-theme="light"] .trash-danger:hover { color:#8E302A; }
html[data-theme="light"] .trash-permanent-button:hover,
html[data-theme="light"] .trash-empty-button:hover:not(:disabled) { background:#FCEFEB; }
html[data-theme="light"] .trash-empty-button { background:#FFF8F6; border-color:#E6BCB5; }
html[data-theme="light"] input:not([type=checkbox]):not([type=hidden]),
html[data-theme="light"] select,
html[data-theme="light"] textarea {
  color:var(--ink); background:#FFFFFF; border-color:#D4D2CC;
}
html[data-theme="light"] input::placeholder,
html[data-theme="light"] textarea::placeholder { color:#85878D; }
html[data-theme="light"] .quick-create-form {
  background:var(--surface); border-color:var(--line);
}
html[data-theme="light"] .quick-create-form input[name="title"],
html[data-theme="light"] .quick-create-form textarea[name="description"] { background:transparent; border-color:transparent; }
html[data-theme="light"] .task-kind-switch { background:#F4F2ED; border-color:var(--line); }
html[data-theme="light"] .task-kind-option input:checked + span { background:#FFFFFF; color:var(--ink); box-shadow:0 1px 4px rgba(0,0,0,.08); }
html[data-theme="light"] .square-check { color:#241B0E; border-color:#888A8D; }
html[data-theme="light"] .square-check.checked { border-color:var(--gold); }
html[data-theme="light"] .task-just-completed .square-check { color:#241B0E; }
html[data-theme="light"] .goal-check-link:hover { background:#FBF4E4; }
html[data-theme="light"] .calendar td a:hover,
html[data-theme="light"] .calendar [aria-current] { background:#F9F0DA; color:var(--gold-ink); }
html[data-theme="light"] .project-more-menu {
  background:#FFFFFF; border-color:var(--line); box-shadow:0 12px 28px rgba(30,35,40,.12);
}
html[data-theme="light"] .project-unified-list {
  background:linear-gradient(160deg,#FFFFFF,#FCFBF9);
  border-color:var(--line);
}
html[data-theme="light"] .project-unified-list .project-priority,
html[data-theme="light"] .project-unified-list .project-remaining-list { background:transparent; border:0; box-shadow:none; }
html[data-theme="light"] .project-unified-list .project-list-label-focus { color:var(--gold-ink); }
html[data-theme="light"] .project-priority > .project-priority-content { color:var(--ink); }
html[data-theme="light"] .project-goals-link:hover { background:#F6F4EF; border-color:#B7B4AC; }
html[data-theme="light"] .priority-arrow:hover:not(:disabled),
html[data-theme="light"] .queue-drag-handle:hover,
html[data-theme="light"] .queue-drag-handle:focus-visible,
html[data-theme="light"] .trash-icon-button:hover,
html[data-theme="light"] .dashboard-subtasks > summary:hover {
  background:rgba(31,35,39,.055); color:var(--ink);
}
html[data-theme="light"] .queue-sortable-chosen { background:#FBF4E6; border-color:#D8C08D; }
html[data-theme="light"] .queue-sortable-ghost { background:#F3E6C9; }
html[data-theme="light"] .queue-sortable-drag { background:#FFFFFF; border-color:#D8BC85; box-shadow:0 12px 25px rgba(0,0,0,.12); }
html[data-theme="light"] .queue-is-dragging { background:#F7EFD9 !important; }
html[data-theme="light"] .dashboard-subtask-done .dashboard-subtask-check { color:#241B0E; }
html[data-theme="light"] .project-more-actions > summary:hover,
html[data-theme="light"] .project-more-actions[open] > summary { background:#F0EEE8; }
html[data-theme="light"] dialog { color:var(--ink); background:#FFFFFF; border-color:var(--line); }
@media (max-width:47rem) {
  html[data-theme="light"] .sidebar { border-bottom:1px solid var(--line); }
  .sidebar-theme { margin:0; grid-column:1; grid-row:auto; }
  .sidebar-theme .theme-toggle { width:max-content; }
}
