/* Warm daylight and deep charcoal share layout, typography, and interactions. */
.theme-control { display: inline-flex; align-items: stretch; min-height: 39px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: #786d5d; flex-shrink: 0; }
.theme-control .icon { width: 16px; height: 16px; }
#theme-cycle { display: inline-flex; align-items: center; gap: 7px; padding: 7px 9px; border: 0; border-radius: 5px 0 0 5px; background: transparent; color: inherit; font-size: 11px; cursor: pointer; }
#theme-label { min-width: 53px; text-align: left; }
#theme-symbol { display: flex; }
.theme-menu { position: relative; display: flex; align-items: center; justify-content: center; width: 28px; border-left: 1px solid var(--line); border-radius: 0 5px 5px 0; }
.theme-menu > .icon { width: 11px; pointer-events: none; }
.theme-menu select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
#theme-cycle:hover, .theme-menu:hover { background: color-mix(in srgb, currentColor 10%, transparent); }
#theme-cycle:focus-visible, .theme-menu:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-control option { background: var(--paper); color: var(--ink); }
:root { --sans: 'Studio Sans', Arial, sans-serif; }
:root.theme-transition, :root.theme-transition * {
  transition: background-color .45s ease, color .45s ease, border-color .45s ease, box-shadow .45s ease !important;
}
:root.theme-transition body { animation: theme-soft-fade .45s ease; }
@keyframes theme-soft-fade { 0%,100% { opacity: 1; } 40% { opacity: .82; } }
:root[data-theme=dark] {
  color-scheme: dark;
  --canvas: #292c2e;
  --sidebar: #2d3032;
  --paper: #333638;
  --ink: #eeeae1;
  --muted: #b5b5ab;
  --line: #4a4e4e;
  --accent: #e0a58e;
  --accent-hover: #f0bca4;
  --sage: #a2b79b;
  --sage-bg: #3b463d;
  --clay: #d49b87;
  --danger: #f0a48f;
  --dark-raised: #3c4041;
  --dark-input: #2b2f31;
  --dark-soft: #b8b6ac;
  --dark-sage: #c0d0b3;
  --dark-clay: #dec0d2;
  --dark-blue: #bed2dd;
  --dark-gold: #ddc899;
  background: var(--canvas);
  color: var(--ink);
  scrollbar-color: #727975 #2d3133;
}
:root[data-theme=dark] body { background: var(--canvas); }
:root[data-theme=dark] :is(.topbar, .business-card, .task-card, .completed, .project-card, .calendar, .activity-panel, .settings-card, .table-scroll, dialog, .editor-section) { background: var(--paper); border-color: var(--line); }
:root[data-theme=dark] :is(.secondary:hover, .icon-button:hover, .nav-item:hover, .member-option:hover, .view-toggle button:hover) { background: var(--dark-raised); border-color: #68706c; color: var(--ink); }
:root[data-theme=dark] .primary { background: #d6a08a; color: #272c2c; border-color: #d6a08a; box-shadow: none; }
:root[data-theme=dark] .primary:hover { background: #e5b199; border-color: #e5b199; }
:root[data-theme=dark] .danger { background: #51403b; border-color: #856453; color: #f1b29b; }
:root[data-theme=dark] .danger:hover { background: #61463d; }
:root[data-theme=dark] :is(.icon-button, .nav-item, .nav-business > .nav-item, .brand-nav .icon, .brand-row > .icon, .column-heading h3, .view-toggle button) { color: #c7c8bb; }
:root[data-theme=dark] :is(.nav-item.selected, .view-toggle .selected, .sort-button.active) { background: #51423c; color: #efb79d; border-color: #826351; }
:root[data-theme=dark] :is(.nav-count, .heading-count, #history-count:not(:empty)) { background: #454946; color: #d0c8b9; }
:root[data-theme=dark] :is(.primary-nav, .brand-nav, .brand-row, .card-controls, td, .sorting-controls, .history-controls, .history-compose, .editor-dialog .effort-details, .history-diff dl > div + div) { border-color: var(--line); }
:root[data-theme=dark] :is(.wordmark-sub, .nav-section-label, .quiet-note, .quiet-note span, .profile-button small, .searchbox, .searchbox kbd, .eyebrow, .page-heading p, .date-tag, .breadcrumb-current, .breadcrumb-separator, .metrics > div > span, .business-title small, .task-brand, .task-project, .task-date, .task-progress > span, .card-controls select, .card-controls > span, .column-heading h3 > span, .filter-tabs button, .owner-filter, .add-task, .page-footer, td small, .project-card > span, .calendar-note, .activity-row p span, .activity-row small, .settings-card p, .settings-card dt, .archive-row small, .muted, .dialog-intro, .archive-button, .sort-context, .sort-summary, .sort-arrow, .editor-intro, .editor-section-heading p, .editor-dialog .field small, .history-result-count, .history-explanation, .history-event-meta time, .change-label, .history-transition > .icon) { color: var(--dark-soft); }
:root[data-theme=dark] :is(.searchbox input::placeholder, .field input::placeholder, .field textarea::placeholder, .subtask-add input::placeholder) { color: #a5a99e; opacity: 1; }
:root[data-theme=dark] :is(.sync, .history-live-controls, #comment-feedback) { color: #bad0ad; }
:root[data-theme=dark] :is(.sync.offline, .history-live-label.offline) { color: #e0b78c; }
:root[data-theme=dark] .metrics blockquote { color: #d4a68f; }
:root[data-theme=dark] .progress { background: #4b504b; }
:root[data-theme=dark] :is(.board-column, .view-toggle, th, .weekday, .editor-tabs) { background: #303436; border-color: var(--line); }
:root[data-theme=dark] :is(th, .weekday) { color: #c6c4b8; }
:root[data-theme=dark] .board-column.drag-over { background: #3e4b3d; }
:root[data-theme=dark] .task-card { background: #3a3e3f; box-shadow: 0 2px 4px #20242620; }
:root[data-theme=dark] .task-card:hover { border-color: #858376; box-shadow: 0 3px 12px #1f25252b; }
:root[data-theme=dark] :is(.completed .task-open h3, .empty-column) { color: #b9c0ac; }
:root[data-theme=dark] :is(.sage, .avatar, .history-symbol, .priority-label.low) { background: #435247; color: #d0dfc5; }
:root[data-theme=dark] :is(.clay, .history-comment .history-symbol) { background: #58454e; color: #edc4d5; }
:root[data-theme=dark] :is(.ochre, .priority-label) { background: #504b3b; color: #e6d09f; }
:root[data-theme=dark] :is(.slate, .history-status .history-symbol) { background: #40525a; color: #c3dae5; }
:root[data-theme=dark] :is(.terracotta, .priority-label.high) { background: #59453b; color: #efb99e; }
:root[data-theme=dark] .neutral { background: #4a4d49; color: #d3cebf; }
:root[data-theme=dark] :is(.status-select, .calendar-task, .history-transition .status) { background: #464942; color: #dad6c7; border-color: #666d5e; }
:root[data-theme=dark] :is(.status-select.in_progress, .calendar-task.in_progress, .history-transition .status.in_progress) { background: #3c4d55; color: #c2dae5; border-color: #647e89; }
:root[data-theme=dark] :is(.status-select.blocked, .calendar-task.blocked, .history-transition .status.blocked) { background: #584239; color: #f3b59b; border-color: #8f6755; }
:root[data-theme=dark] :is(.status-select.done, .calendar-task.done, .history-transition .status.done) { background: #414f3d; color: #c4d9b0; border-color: #738567; }
:root[data-theme=dark] .calendar-day.outside { background: #2d3032; }
:root[data-theme=dark] :is(.day-number, .calendar-day.outside .day-number) { color: #b8baad; }
:root[data-theme=dark] .day-number:hover { background: #525048; }
:root[data-theme=dark] .today .day-number { color: #282d2c; background: var(--accent); }
:root[data-theme=dark] .settings-icon { background: #4a473d; color: var(--dark-gold); }
:root[data-theme=dark] :is(.notice, .notice.warning) { background: #494235; border-color: #7c6d51; color: #e1d0aa; }
:root[data-theme=dark] .notice.error { background: #543e36; border-color: #906752; color: #f2b79e; }
:root[data-theme=dark] dialog { box-shadow: 0 30px 100px #15191b70; }
:root[data-theme=dark] dialog::backdrop { background: #1f2425a8; }
:root[data-theme=dark] :is(.dialog-footer, .editor-dialog .dialog-footer) { background: #303435; border-color: var(--line); box-shadow: 0 -5px 18px #20242518; }
:root[data-theme=dark] .dialog-heading { border-color: var(--line); }
:root[data-theme=dark] :is(.field > span:first-child, .editor-dialog .field > span:first-child, .history-event-meta strong) { color: #d0d2c5; }
:root[data-theme=dark] :is(.field input, .field select, .field textarea, .subtask-add input, .editor-dialog .field input, .editor-dialog .field select, .editor-dialog .field textarea) { background: var(--dark-input); color: var(--ink); border-color: #636960; }
:root[data-theme=dark] :is(select option, .owner-filter option, .card-controls option) { color: var(--ink); background: #333638; }
:root[data-theme=dark] :is(.field select:disabled, .editor-dialog .field select:disabled) { background: #383c3d; color: #aaaFA5; }
:root[data-theme=dark] :is(.select-wrap > .icon, .task-date .icon) { color: #c6ad93; }
:root[data-theme=dark] .editor-dialog .dialog-heading { background: linear-gradient(115deg,#493c36,#333739 75%); border-color: #605045; }
:root[data-theme=dark] .editor-dialog .eyebrow { color: #e5b99a; }
:root[data-theme=dark] .editor-dialog .dialog-heading > .icon-button { background: #3d4142; border-color: #6a6961; }
:root[data-theme=dark] .editor-section { --section-ink: #e6b29a; --section-tint: #443a36; --section-line: #6c5548; --section-symbol: #5b463b; }
:root[data-theme=dark] .tone-ochre { --section-ink: #e1cb98; --section-tint: #403e33; --section-line: #676147; --section-symbol: #534c34; }
:root[data-theme=dark] .tone-slate { --section-ink: #bbd0dc; --section-tint: #354248; --section-line: #526972; --section-symbol: #405863; }
:root[data-theme=dark] .tone-sage { --section-ink: #c0d3b2; --section-tint: #394238; --section-line: #56694c; --section-symbol: #485a3f; }
:root[data-theme=dark] .tone-clay { --section-ink: #dfbfd0; --section-tint: #433b43; --section-line: #6c5869; --section-symbol: #594459; }
:root[data-theme=dark] .section-meta { background: #2d3331; }
:root[data-theme=dark] .editor-tabs button { color: #c6c6b8; }
:root[data-theme=dark] .editor-tabs button[aria-selected=true] { background: #50433c; color: #efb99f; box-shadow: none; }
:root[data-theme=dark] :is(.editor-dialog .subtask-row, .editor-dialog .subtask-add input, .notes-empty, .history-empty, .history-diff) { background: #343d34; border-color: #53604b; color: #c2ceb5; }
:root[data-theme=dark] .editor-dialog .subtask-row.is-complete { background: #3d4a39; border-color: #657857; }
:root[data-theme=dark] .editor-dialog .subtask-title { color: var(--ink); }
:root[data-theme=dark] .editor-dialog .done-text { color: #a8b89e; }
:root[data-theme=dark] :is(.custom-check, .check-circle) { background: #303830; border-color: #849077; }
:root[data-theme=dark] .subtask-row input[type=checkbox]:checked + .custom-check { background: #a2b79b; border-color: #a2b79b; color: #293229; }
:root[data-theme=dark] #subtask-progress .progress { background: #4a5546; }
:root[data-theme=dark] .editor-dialog .subtask-add .icon-button { background: #495a40; color: #d3e0c4; border-color: #6b7c5e; }
:root[data-theme=dark] :is(.editor-dialog .effort-details, .editor-dialog .effort-details p, .history-diff summary) { color: #c0cdb4; }
:root[data-theme=dark] .history-event:not(:last-child)::before { background: #596354; }
:root[data-theme=dark] :is(.history-note, .editor-dialog .status-explanation) { background: #39474e; border-color: #5e7581; color: #d0dbe0; }
:root[data-theme=dark] :is(.history-note.blocker-note, .editor-dialog .status-explanation) { background: #4b3d35; border-color: #80624d; }
:root[data-theme=dark] :is(.history-note strong, .editor-dialog .status-explanation > span:first-child) { color: #ecc0a4; }
:root[data-theme=dark] :is(p.history-comment, .editor-dialog .comment) { background: #453b45; border-color: #705969; color: #e3cedb; }
:root[data-theme=dark] .comment p { color: #dfd0d8; }
:root[data-theme=dark] .comment small { color: #b7a9b1; }
:root[data-theme=dark] main:not(.page-overview) .page-heading { background: linear-gradient(120deg,#3b453b,#303637 85%); border-color: #52634c; }
:root[data-theme=dark] main.page-brands .page-heading { background: linear-gradient(120deg,#493d36,#343739 85%); border-color: #725b4b; }
:root[data-theme=dark] main.page-projects .page-heading { background: linear-gradient(120deg,#36464c,#323739 85%); border-color: #536b77; }
:root[data-theme=dark] main:not(.page-overview) .page-heading p { color: var(--dark-soft); }
:root[data-theme=dark] :is(.page-category, .page-category .section-symbol) { color: #c2d2b0; }
:root[data-theme=dark] .page-category .section-symbol { background: #4a5b3e; }
:root[data-theme=dark] .page-brands .page-category { color: #e8b49a; }
:root[data-theme=dark] .page-brands .page-category .section-symbol { color: #e8b49a; background: #604838; }
:root[data-theme=dark] .page-projects .page-category { color: #c1d6e1; }
:root[data-theme=dark] .page-projects .page-category .section-symbol { color: #c1d6e1; background: #405a65; }
:root[data-theme=dark] main:not(.page-overview) .project-card { background: #363f36; border-color: #55634e; }
:root[data-theme=dark] main:not(.page-overview) .project-card > .icon { color: #c0d0af; }
:root[data-theme=dark] main:not(.page-overview) .settings-card:nth-child(2) { background: #3e3b35; border-color: #665e4d; }
:root[data-theme=dark] :is(.sort-button, .theme-control) { background: #353a3b; border-color: #555d59; color: #c5c8bb; }
:root[data-theme=dark] .sort-button:hover { background: #454940; border-color: #808274; }
:root[data-theme=dark] .sort-button.active { background: #51423c; border-color: #826351; color: #efb79d; }
:root[data-theme=dark] :is(.sort-button.active .sort-arrow, .sortable-table th .sort-button.active) { color: #efb79d; }
:root[data-theme=dark] .sortable-table th .sort-button { background: transparent; border-color: transparent; }
:root[data-theme=dark] .filter-tabs button.selected { color: var(--accent); }
:root[data-theme=dark] #toast { background: #455340; color: #e8f0df; border-color: #849377; box-shadow: 0 10px 35px #20262550; }
@media(max-width:1050px) { .topbar-actions { gap: 10px; } }
@media(max-width:480px) {
  .theme-control { min-height: 34px; }
  #theme-cycle { padding: 6px; gap: 4px; font-size: 10px; }
  #theme-label { min-width: 48px; }
  .theme-menu { width: 26px; }
  .theme-control .icon { width: 13px; }
  .topbar-actions { gap: 6px; }
}
@media(prefers-reduced-motion:reduce) {
 :root.theme-transition, :root.theme-transition * { transition: none !important; }
 :root.theme-transition body { animation: none; }
}
