/* Shared semantic surface tokens. Load after legacy shell/calendar/Settings CSS. */
:root[data-theme="light"] {
  color-scheme:light; --bg:#f7f7fa; --sidebar:#f0edf5; --panel:#eeebf2; --card:#fff;
  --field:#fff; --text:#24212c; --muted:#625d6c; --line:#d3cedc;
  --blue:#7040c0; --blue-hover:#5d30a7; --red:#aa263f; --green:#317126;
  --theme-hover:#e9e4f1; --theme-selected:#e6dcf4; --theme-on-accent:#fff;
  --theme-link:#6536ad; --theme-input-border:#a69daf; --theme-danger-bg:#fae9ed;
  --theme-danger-border:#c77585; --theme-shadow:0 12px 36px #24123724;
  --theme-warning:#7c560c; --theme-warning-bg:#fff0cb;
}
:root[data-theme="dark"] {
  color-scheme:dark; --bg:#171717; --sidebar:#121212; --panel:#1e1c22; --card:#29262e;
  --field:#242127; --text:#efeeeb; --muted:#b1aabb; --line:#48434f;
  --blue:#b99aef; --blue-hover:#ceafff; --red:#f2a2ad; --green:#9cd18c;
  --theme-hover:#353039; --theme-selected:#3c2e50; --theme-on-accent:#241237;
  --theme-link:#c6a7f6; --theme-input-border:#756b81; --theme-danger-bg:#3b232b;
  --theme-danger-border:#a36674; --theme-shadow:0 12px 36px #0008;
  --theme-warning:#f4d58a; --theme-warning-bg:#493a1e;
}
html[data-theme] {color:var(--text);background:var(--bg);scrollbar-color:var(--theme-input-border) var(--bg)}
html[data-theme] ::selection {background:var(--blue);color:var(--theme-on-accent)}
html[data-theme] ::-webkit-scrollbar-thumb {background:var(--theme-input-border)}
html[data-theme] :is(button,a,input,select,textarea):focus-visible {outline-color:var(--blue)}
html[data-theme] a {color:var(--theme-link)}
html[data-theme] :is(input,select,textarea) {background:var(--field);color:var(--text);border-color:var(--theme-input-border);caret-color:var(--text)}
html[data-theme] :is(input,textarea)::placeholder {color:var(--muted);opacity:1}
html[data-theme] .erp-settings-root :is(input,textarea)::placeholder,
html[data-theme] .erp-daily-root :is(input,textarea)::placeholder {color:var(--muted-foreground);opacity:1}
html[data-theme=light] .complete-circle:not(.is-done) {border-color:var(--theme-link)}
html[data-theme] .field .title-input {background:var(--field);color:var(--text)}
html[data-theme] input[type=file]::file-selector-button {background:var(--panel);color:var(--text)}
html[data-theme] :is(.brand-bar,.sidebar) {background:var(--sidebar);border-color:var(--line)}
html[data-theme] :is(.workspace-initials,.project-initials) {background:var(--panel);border-color:var(--line);color:var(--text)}
html[data-theme] .brand-mark {background:var(--blue);color:var(--theme-on-accent)}
html[data-theme] .brand {color:var(--text)}
html[data-theme] :is(.draft-label,.nav-row,.subnav button,.task-tabs button,.column-add,.column-count,.count,.row-project,.card-meta,.form-note,.tiny-meta,.meeting-date,.meeting-project,.column-drag-handle,.search svg,.quick-weekday,.quick-no-results,.quick-day.off,.quick-sticker-add,.task-tabs svg,.initial-loader) {color:var(--muted)}
html[data-theme] :is(.nav-row:hover,.profile-button:hover,.task-row:hover,.meeting-line:hover,.column-add:hover,.icon-button:hover,.column-drag-handle:hover) {background:var(--theme-hover);color:var(--text)}
html[data-theme] :is(.nav-row.selected,.nav-children .nav-row.selected,.icon-button.active) {background:var(--theme-selected);color:var(--text)}
html[data-theme] :is(.topbar,.page-body,.board-canvas,.subnav,.toolbar,.task-tabs,.list-actions,.project-subnav>.project-board-add) {background:var(--bg);border-color:var(--line)}
html[data-theme] :is(.search,.task-group-head,.board-column) {background:var(--panel);border-color:var(--line)}
html[data-theme] .search input {background:transparent;border:0}
html[data-theme] :is(.task-card,.comment,.member-chip,.checkbox-label:hover) {background:var(--card);border-color:var(--line)}
html[data-theme] :is(.task-card:hover,.quick-day:hover,.quick-member:hover,.sticker-menu-item:hover,.quick-trigger:hover,.quick-sticker-add:hover,.quick-sticker-add[aria-expanded=true]) {background:var(--theme-hover);color:var(--text);border-color:var(--theme-input-border)}
html[data-theme] :is(.task-title,.quick-day,.project-overview-description h3,.project-overview-team h3,.project-resource-label,.field>label) {color:var(--text)}
html[data-theme] :is(.task-card.completed .task-title,.task-row.completed .row-title) {color:var(--muted);text-decoration-color:var(--muted)}
html[data-theme] :is(.view-switch,.column-count,.task-group-head .count,.data-table th,.pill,.pill.private,.inline-notice,.page-index button.selected) {background:var(--panel);color:var(--muted)}
html[data-theme] .view-switch button {color:var(--muted)}
html[data-theme] :is(.view-switch button.selected,.task-stack.drag-over) {background:var(--theme-selected);color:var(--blue)}
html[data-theme] .progress-track {background:var(--line)}
html[data-theme] .progress-fill {background:var(--blue)}
html[data-theme] .completed .progress-fill {background:var(--green)}
html[data-theme] .column-create .btn {background:var(--panel)}
html[data-theme] .row-link:hover {background:var(--theme-hover)}
html[data-theme] :is(.task-row,.meeting-line,.knowledge-row,.project-resources,.detail-section,.nav-bottom) {border-color:var(--line)}
html[data-theme] :is(.task-done,.quick-assignees.empty,.date-badge.empty) {color:var(--muted);border-color:var(--theme-input-border)}
html[data-theme] .btn {background:var(--card);border-color:var(--theme-input-border);color:var(--text)}
html[data-theme] .btn:hover {background:var(--theme-hover)}
html[data-theme] .btn.quiet {background:transparent;border-color:transparent}
html[data-theme] :is(.btn.primary,.quick-day.selected) {background:var(--blue);border-color:var(--blue);color:var(--theme-on-accent)}
html[data-theme] .btn.primary:hover {background:var(--blue-hover)}
html[data-theme] :is(.btn.danger,.form-error) {background:var(--theme-danger-bg);color:var(--red);border-color:var(--theme-danger-border)}
html[data-theme] :is(.dialog,.dialog-head,.dialog-body,.task-popover,.toast) {background:var(--card);color:var(--text);border-color:var(--line)}
html[data-theme] :is(.dialog,.task-popover,.toast) {box-shadow:var(--theme-shadow)}
html[data-theme] :is(.subnav button.selected,.task-tabs button.selected,.sticker-menu-item[aria-pressed=true],.quick-recurrence) {background:var(--theme-selected);color:var(--text);border-color:var(--blue)}
html[data-theme] :is(.sticker-menu-item svg,.quick-choice-mark) {color:var(--blue)}
html[data-theme] .quick-day.today {box-shadow:inset 0 0 0 1px var(--blue)}
html[data-theme] .date-badge {background:var(--panel);color:var(--muted)}
html[data-theme] .date-badge.overdue {background:var(--theme-danger-bg);color:var(--red)}
html[data-theme] .date-badge.today {background:var(--theme-warning-bg);color:var(--theme-warning)}
html[data-theme] .date-badge.empty {background:transparent}
html[data-theme] .toast.error {background:var(--theme-danger-bg);color:var(--red);border-color:var(--theme-danger-border)}
html[data-theme] .login-page {background:var(--bg)}
html[data-theme] .login-box {background:var(--card);border-color:var(--line)}
html[data-theme] .login-box p {color:var(--muted)}
/* More specific than the inherited hardcoded !important calendar shell. */
html[data-theme] :is(.erp-calendar,.calendar-layout,.calendar-toolbar,.calendar-sidebar,.calendar-grid) {background:var(--bg)!important;color:var(--text)}
html[data-theme] :is(.calendar-sidebar,.calendar-toolbar) {border-color:var(--line)!important}
/* Calendar also consumes these tokens directly in its independently owned CSS. */
html[data-theme] :is(.erp-calendar-toolbar,.erp-calendar-filters,.erp-week-header,.erp-week-hours,.erp-week-day,.google-connection,.google-preview-section,.google-info) {background:var(--panel);color:var(--text);border-color:var(--line)}
html[data-theme] :is(.erp-calendar-zone,.erp-calendar-filter small,.erp-calendar-note,.erp-google-status,.erp-week-tz,.erp-week-day-heading>span,.erp-week-hours span,.erp-agenda-empty) {color:var(--muted)}
html[data-theme] :is(.erp-time-slot,.erp-calendar-loading,.erp-week-header,.erp-week-day-heading,.erp-week-day,.erp-agenda-day,.erp-calendar-grant,.erp-google-status) {border-color:var(--line)}
html[data-theme] .erp-time-slot::after {background:var(--line)}
html[data-theme] :is(.erp-time-slot:hover,.erp-week-day.today) {background:var(--theme-selected)}
html[data-theme] .erp-week-day-heading.today>strong {background:var(--blue);color:var(--theme-on-accent)}
html[data-theme] .erp-week-day-heading.today>span {color:var(--blue)}
html[data-theme] .erp-calendar-dialog fieldset>legend {color:var(--muted)}
html[data-theme] .erp-calendar-loading {color:var(--muted)}
html[data-theme] .erp-calendar-view {border-color:var(--theme-input-border)}
html[data-theme] .erp-calendar-view button {color:var(--muted)}
html[data-theme] .erp-calendar-view button.selected {background:var(--theme-selected);color:var(--text)}
html[data-theme] :is(.google-status-title,.google-preview-account) {color:var(--text)}
html[data-theme] :is(.google-status-email,.google-callback-notice,.google-revocation-notice,.google-preview-note,.google-preview-controls>label,.google-preview-status,.google-event-time,.google-event-description) {color:var(--muted)}
html[data-theme] .google-readonly {background:var(--theme-selected);color:var(--text)}
html[data-theme] .google-inline-error {color:var(--red)}
/* Never override scoped shadcn form/anchor colors with legacy text tokens. */
html[data-theme] .erp-settings-root :is(input,select,textarea) {color:var(--foreground);background:var(--background);border-color:var(--input)}
html[data-theme] .erp-settings-root a {color:var(--foreground)}
html[data-theme] .erp-settings-root :focus-visible {outline-color:var(--ring)}
/* Legacy --muted is text; shadcn --muted is a surface inside Settings. */
html[data-theme] .erp-settings-root :is(.google-status-email,.google-callback-notice,.google-revocation-notice,.google-preview-note,.google-preview-controls>label,.google-preview-status,.google-event-time,.google-event-description,.erp-calendar-note) {color:var(--muted-foreground)}
