/* Shared appearance layer. Screen-only tokens leave labels and reports printable. */
[data-theme-toggle]{min-height:44px;white-space:nowrap}
.auth-theme-toggle{margin-left:auto;position:relative;z-index:1}
@media screen {
html[data-theme="dark"]{
  color-scheme:dark;
  --night:#061321;--forest:#126b92;--forest-2:#1681a8;--mint:#68dbd0;
  --paper:#061321;--white:#0e2237;--ink:#e1edf7;--muted:#a2b7ca;
  --line:#29435b;--amber:#f1c16d;--blue:#17364b;
  --surface:#0e2237;--raised:#152e46;--accent:#68dbd0;
}
html[data-theme="dark"] body{background:var(--paper);color:var(--ink)}
html[data-theme="dark"] :is(nav,dialog,.card,.login-card,.auth-panel,.passkey-device,
.work-card,.work-record,.command-panel,.command-clock,.communication-card,
.item-card,.dashboard-list-item,.daily-task-card,.person-row,.timeline-item,
.four-day,.four-day-code,.life-item-card,.person-card,.discussion-item,.daily-life-entry,.daily-life-section,
.finance-account-card,.finance-stat,.finance-event,.finance-purchase,.finance-book,
.clinic-record,.clinic-preview,.search-result,.reminder-card,.agenda-calendar-day){
  background:var(--surface);color:var(--ink);border-color:var(--line);
}
html[data-theme="dark"] :is(input,select,textarea){background:#091b2d;color:var(--ink);border-color:#42617c}
html[data-theme="dark"] :is(input,textarea)::placeholder{color:#8ea7be;opacity:1}
html[data-theme="dark"] :is(input,select,textarea):focus{border-color:#68dbd0;box-shadow:0 0 0 3px #68dbd026}
html[data-theme="dark"] :focus-visible{outline:2px solid #68dbd0;outline-offset:3px}
html[data-theme="dark"] a{color:#80caff}
html[data-theme="dark"] :is(button,a.button-link){color:#f3faff}
html[data-theme="dark"] :is(.secondary,.icon-button){background:var(--raised)!important;color:#d8edff!important}
html[data-theme="dark"] :is(.secondary,.icon-button):hover{background:#22465f!important}
html[data-theme="dark"] :is(.text-button,.brand-button){background:transparent;color:var(--accent)}
html[data-theme="dark"] :is(.eyebrow,.finance-eyebrow){color:var(--accent)}
html[data-theme="dark"] :is(.hint,.sub,.workspace-head p,.work-card small,.command-item small,
.finance-table small,.finance-table td:first-child>span,.finance-event small,.clinic-subtle,
.agenda-item small,.four-day>small,.life-card-meta,.life-card-conclusion,
.dashboard-item-meta,.item-card-location,.agenda-expanded>summary,.daily-life-summary,.life-item-card small,.discussion-item small){color:var(--muted)}
html[data-theme="dark"] :is(.auth-art,.daily-save-bar){background:#0a1b2c;border-color:var(--line)}
html[data-theme="dark"] :is(.brand-mark,.mini-mark){background:#68dbd0;color:#061321}
html[data-theme="dark"] :is(.nav-tabs,.passkey-login,.passkey-account,.setup-result,.setup-note,
.work-toolbar,.work-context-bar,.work-flow-intro,.work-help,.work-quick-bar,.work-person-detail,
.command-summary,.command-edit,.command-reason,.command-gates span,.profile-leave-row,
.resource-command,.resource-script,.communication-banner,.daily-date-card,.daily-metric,
.life-stat,.life-detail-facts>div,.checklist-parent,.agenda-legend span,.finance-empty,
.finance-preview,.finance-card-metrics,.finance-entry-form,.finance-entry-filter,.clinic-toolbar,
.clinic-selected,.clinic-note,.clinic-disclosure-summary,.life-disclosure-summary,
.dashboard-detail-group>summary,.case-checklist-inline,.case-checklist-row,.case-checklist-badge){
  background:var(--raised);color:var(--ink);border-color:var(--line)
}
html[data-theme="dark"] .command-reason{color:var(--accent)!important}
html[data-theme="dark"] :is(.nav-tab,.work-view-tabs button,.finance-tabs button,.travel-day-tabs button){
  background:var(--raised);color:#b9d2e8
}
html[data-theme="dark"] :is(.nav-tab.active,.work-view-tabs button.is-active,
.work-view-tabs button[aria-selected="true"],.finance-tabs button.active,.travel-day-tabs button.active){
  background:#126b92;color:#fff;box-shadow:inset 0 -2px #68dbd0
}
html[data-theme="dark"] :is(.dashboard-stat,.life-stat,.work-stat,.daily-metric-card,
.agenda-item,.four-day-column,.four-day-item,.agenda-calendar,.dashboard-panel-icon){
  background:var(--surface);color:var(--ink);border-color:var(--line)
}
html[data-theme="dark"] :is(.dashboard-stat strong,.dashboard-stat span,.dashboard-stat small,
.life-stat strong,.work-stat strong,.daily-metric-card strong){color:inherit}
html[data-theme="dark"] :is(th,.finance-table th){background:var(--raised);color:#c4dcef}
html[data-theme="dark"] :is(td,th,.finance-table-wrap,.quote-table-wrap){border-color:var(--line)}
html[data-theme="dark"] :is(dialog)::backdrop{background:#020914b8}
html[data-theme="dark"] :is(.activation-code,.life-detail-facts strong){color:var(--ink)}
html[data-theme="dark"] .four-day.is-today{background:#10383f;border-color:#49bdb3}
html[data-theme="dark"] :is(.item-card,.dashboard-list-item,.agenda-item):hover{background:#1b3c55;color:var(--ink)}
html[data-theme="dark"] :is(.four-day-code,.four-day-more){color:#9ed6fa}
html[data-theme="dark"] :is(.dashboard-stat.warning,.dashboard-panel.warning){border-color:#c2a15c}
html[data-theme="dark"] :is(.dashboard-stat.danger,.dashboard-panel.danger){border-color:#d88291}
/* Semantic colors remain distinguishable for deadlines, overdue work and finances. */
html[data-theme="dark"] .work-card[data-member-age="yellow"]{background:#332e1c;border-color:#d9bd58}
html[data-theme="dark"] .work-card[data-member-age="orange"]{background:#38281e;border-color:#d99a60}
html[data-theme="dark"] .work-card[data-member-age="red"]{background:#352332;border-color:#cd8b8b}
html[data-theme="dark"] .work-card[data-member-age="purple"]{background:#2b2441;border-color:#b195c8}
html[data-theme="dark"] .work-card[data-member-age]{color:var(--ink)}
html[data-theme="dark"] .work-card[data-member-age] small{color:#c4d4e3}
html[data-theme="dark"] .work-card[data-deadline="purple"]{border-color:#b990ef}
html[data-theme="dark"] .work-card[data-deadline="red"]{border-color:#f0828e}
html[data-theme="dark"] .work-card[data-deadline="orange"]{border-color:#efa263}
html[data-theme="dark"] .work-card[data-deadline="yellow"]{border-color:#e0c36e}
html[data-theme="dark"] .work-card[data-deadline="green"]{border-color:#65c9a1}
html[data-theme="dark"] :is(.finance-negative,.error,.clinic-error,.work-overdue){color:#ff9da9!important}
html[data-theme="dark"] .finance-surplus{color:#68dbd0!important}
html[data-theme="dark"] .finance-notice{background:#332e1c;color:#f1d499}
html[data-theme="dark"] .command-clock.is-working{background:#10383f;border-color:#49bdb3}
/* Component-specific fixes for feature styles that still hard-code light surfaces. */
html[data-theme="dark"] .nav-tabs .nav-tab{
  background:var(--raised);color:#c4dcef;border-color:#42617c;border-bottom-color:#29435b;box-shadow:none
}
html[data-theme="dark"] .nav-tabs .nav-tab:hover{background:#1b3c55;color:#f3faff;border-color:#5a86a4}
html[data-theme="dark"] .nav-tabs .nav-tab.active,
html[data-theme="dark"] .nav-tabs .nav-tab.active:hover{
  background:#126b92;color:#fff;border-color:#1681a8;border-bottom-color:#68dbd0;
  box-shadow:inset 0 -2px #68dbd0
}

/* Work center grouped navigation, including 常用檢視. */
html[data-theme="dark"] #workViewTabs[data-grouped]{background:#0a1b2c;border-color:var(--line)}
html[data-theme="dark"] #workViewTabs[data-grouped] .work-nav-group{
  background:var(--surface);color:var(--ink);border-color:var(--line)
}
html[data-theme="dark"] #workViewTabs[data-grouped] .work-nav-group h2,
html[data-theme="dark"] #workViewTabs[data-grouped] .work-nav-group summary{color:#c4dcef}
html[data-theme="dark"] #workViewTabs[data-grouped] .work-nav-group.has-selection{
  background:#10383f;border-color:#49bdb3
}
html[data-theme="dark"] #workViewTabs[data-grouped] .work-nav-buttons button{
  background:var(--raised);color:#c4dcef;border-color:#29435b;box-shadow:none
}
html[data-theme="dark"] #workViewTabs[data-grouped] .work-nav-buttons button:is(.is-active,[aria-pressed="true"]){
  background:#126b92;color:#fff;border-color:#68dbd0;box-shadow:inset 0 -2px #68dbd0
}

/* Quick center. */
html[data-theme="dark"] .shortcut-panel{
  background:var(--surface);color:var(--ink);border-color:var(--line);box-shadow:0 14px 44px #020914a6
}
html[data-theme="dark"] .shortcut-head strong{color:var(--ink)}
html[data-theme="dark"] :is(.shortcut-head small,.shortcut-group h2,.shortcut-copy small){color:var(--muted)}
html[data-theme="dark"] :is(.shortcut-group+.shortcut-group,.shortcut-jira){border-color:var(--line)}
html[data-theme="dark"] .shortcut-close{background:var(--raised);color:#d8edff}
html[data-theme="dark"] :is(.shortcut-item,.shortcut-primary-grid .shortcut-item){
  background:#10283f;color:#d8edff;border-color:#29435b
}
html[data-theme="dark"] :is(.shortcut-item,.shortcut-primary-grid .shortcut-item):is(:hover,:focus-visible){
  background:#173e59;color:#f3faff;border-color:#4a7695
}
html[data-theme="dark"] .shortcut-icon{background:#163c50;color:var(--accent)}
html[data-theme="dark"] .shortcut-jira>summary{color:#b9d2e8}
html[data-theme="dark"] .shortcut-jira .jira-preview-item{background:var(--raised);color:var(--ink);border-color:var(--line)}

/* Search and other common raised surfaces discovered in the dark-mode audit. */
html[data-theme="dark"] .unified-search{background:var(--surface);color:var(--ink)}
html[data-theme="dark"] .search-domains button{background:var(--raised);color:#c4dcef}
html[data-theme="dark"] .search-domains [aria-pressed="true"]{background:#126b92;color:#fff}
html[data-theme="dark"] .search-source{border-color:var(--line)}
html[data-theme="dark"] .search-hit{background:var(--raised);color:var(--ink)}
html[data-theme="dark"] .search-hit small{color:var(--muted)}
html[data-theme="dark"] :is(.work-person-detail>details,.work-progress-form,.work-output-preview,.work-roles span){
  background:var(--raised);color:var(--ink);border-color:var(--line)
}
html[data-theme="dark"] .work-person-picker{border-color:var(--line)}
html[data-theme="dark"] .work-external-link{background:var(--raised);color:#9ed6fa;border-color:#42617c}
html[data-theme="dark"] .work-external-link:hover{background:#1b3c55;border-color:#5a86a4}
html[data-theme="dark"] .work-card[data-on-leave="true"]{background:#332e1c;border-color:#c2a15c;color:var(--ink)}

html[data-theme="dark"] :is(.photo-source,.relation-link,.relation-picker-results,.advanced-info,.advanced-fields,
.security-stepup,.person-family-section,.relationship-reminders>section,.person-reminder,
.daily-checks label,.activity-home-grid>section,.activity-card,.travel-day-facts>div,
.shopping-card,.shopping-source,#shoppingFiling,.education-home-grid>section,.education-card,.education-record-form){
  background:var(--raised);color:var(--ink);border-color:var(--line)
}
html[data-theme="dark"] :is(.photo-source,.relation-link,.person-reminder,.activity-card,.shopping-card,.education-card){color:#bfe6ff}
html[data-theme="dark"] :is(.advanced-info summary,.advanced-fields summary){color:var(--accent)}
html[data-theme="dark"] :is(.travel-budget,.travel-budget>div){border-color:var(--line)}
html[data-theme="dark"] :is(.travel-budget-head,.travel-budget-total){background:var(--raised)}
html[data-theme="dark"] .person-row>span{background:#163c50;color:var(--accent)}
html[data-theme="dark"] .dashboard-panel.warning .dashboard-panel-icon{background:#332e1c;color:#f1d499}
html[data-theme="dark"] .dashboard-panel.danger .dashboard-panel-icon{background:#35232a;color:#ffb3bc}
html[data-theme="dark"] .dashboard-panel.stock .dashboard-panel-icon{background:#162b47;color:#a8ccff}
html[data-theme="dark"] .life-stat.danger{background:#35232a;color:#ffb3bc;border-color:#8a4350}
html[data-theme="dark"] .life-stat.warning{background:#332e1c;color:#f1d499;border-color:#8d7436}
html[data-theme="dark"] .life-stat.wait{background:#162b47;color:#a8ccff;border-color:#47678d}
html[data-theme="dark"] .life-stat.talk{background:#2b2441;color:#d1b8f1;border-color:#6f5a91}
}
@media print{[data-theme-toggle]{display:none!important}}

@media(max-width:430px){.nav-user{flex-wrap:wrap}.nav-user [data-theme-toggle]{padding:8px;font-size:.8rem}.auth-theme-toggle{padding:8px;font-size:.8rem}}
