:root,
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f7f9;
  --background: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #fbfcfd;
  --surface-muted: #f8fafc;
  --surface-raised: #ffffff;
  --surface-hover: #eef6f4;
  --surface-active: #eefaf7;
  --ink: #18202c;
  --heading: #334155;
  --muted: #64748b;
  --muted-strong: #475569;
  --muted-soft: #7c8da3;
  --line: #d7dde5;
  --border: #d7dde5;
  --border-subtle: #dfe6ee;
  --input-bg: #ffffff;
  --input-border: #d7dde5;
  --input-text: #18202c;
  --table-bg: #ffffff;
  --table-head-bg: #eef2f6;
  --table-hover-bg: #f3faf8;
  --dropdown-bg: #ffffff;
  --dropdown-hover-bg: #eef6f4;
  --modal-bg: #ffffff;
  --modal-backdrop: rgba(15, 23, 42, 0.38);
  --accent: #1f7668;
  --accent-strong: #126b5f;
  --accent-soft: #eefaf7;
  --accent-border: #b7dfd6;
  --success: #1f7668;
  --success-bg: #eefaf7;
  --success-border: #b7dfd6;
  --warn: #b7791f;
  --warn-bg: #fff8e7;
  --warn-border: #f0c36f;
  --bad: #b42318;
  --bad-bg: #fff5f4;
  --bad-border: #e4a8a2;
  --info: #1d4f8f;
  --info-bg: #eef6ff;
  --info-border: #bfd7f5;
  --on-accent: #ffffff;
  --shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-dropdown: 0 12px 32px rgba(15, 23, 42, 0.14);
  --shadow-modal: 0 24px 70px rgba(15, 23, 42, 0.24);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111827;
  --background: #111827;
  --surface: #182230;
  --surface-soft: #1f2a3a;
  --surface-muted: #243246;
  --surface-raised: #202c3d;
  --surface-hover: #23384a;
  --surface-active: #173f3a;
  --ink: #e5edf6;
  --heading: #f1f5f9;
  --muted: #a8b4c6;
  --muted-strong: #c8d2df;
  --muted-soft: #8d9aae;
  --line: #354255;
  --border: #354255;
  --border-subtle: #2f3d50;
  --input-bg: #121c29;
  --input-border: #3b4a5f;
  --input-text: #edf4fb;
  --table-bg: #182230;
  --table-head-bg: #223044;
  --table-hover-bg: #203647;
  --dropdown-bg: #202c3d;
  --dropdown-hover-bg: #263b4f;
  --modal-bg: #182230;
  --modal-backdrop: rgba(5, 10, 18, 0.68);
  --accent: #53c7b5;
  --accent-strong: #7bd8c8;
  --accent-soft: #123d38;
  --accent-border: #2b7b70;
  --success: #62d39c;
  --success-bg: #143d31;
  --success-border: #28785c;
  --warn: #f2b35f;
  --warn-bg: #3c2d18;
  --warn-border: #8a642a;
  --bad: #ff8a80;
  --bad-bg: #432329;
  --bad-border: #8d454d;
  --info: #93c5fd;
  --info-bg: #173454;
  --info-border: #315c86;
  --on-accent: #08201c;
  --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.26);
  --shadow-dropdown: 0 16px 36px rgba(0, 0, 0, 0.34);
  --shadow-modal: 0 28px 80px rgba(0, 0, 0, 0.44);
}

body {
  background: var(--bg);
  color: var(--ink);
}

header,
.app-header {
  background: var(--surface);
  border-color: var(--line);
}

.app-brand,
.brand,
h1,
h2,
h3,
.page-title {
  color: var(--ink);
}

.breadcrumbs,
.breadcrumbs__current,
.breadcrumbs__separator,
.muted,
.helptext,
.filter-count {
  color: var(--muted);
}

.breadcrumbs__link,
.app-tab,
.app-user-menu summary,
nav a,
nav button,
.button,
.tabs a,
.module-tabs a,
.pagination__link,
.pagination__status,
.action-menu summary,
.user-menu summary {
  border-color: var(--line);
  background: var(--surface);
  color: var(--heading);
}

.breadcrumbs__link:hover,
.app-tab:hover,
.app-user-menu summary:hover,
nav a:hover,
nav button:hover,
.button:hover,
.tabs a:hover,
.module-tabs a:hover,
.pagination__link:hover {
  border-color: var(--accent-border);
  background: var(--surface-hover);
  color: var(--accent);
}

.app-tab.is-active,
.module-tabs a.active,
.tabs a.active {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent);
}

.app-tab--mail-unread span,
.app-tab--task-unread span,
.app-tab--ksef-unseen span {
  color: var(--bad);
  font-weight: 750;
}

.app-tab--mail-unread .app-icon,
.app-tab--task-unread .app-icon,
.app-tab--ksef-unseen .app-icon {
  color: var(--bad);
}

.app-tab--mail-unread:not(.is-active),
.app-tab--task-unread:not(.is-active),
.app-tab--ksef-unseen:not(.is-active) {
  border-color: color-mix(in srgb, var(--bad-border) 72%, var(--line));
}

.app-tab--mail-unread:hover,
.app-tab--task-unread:hover,
.app-tab--ksef-unseen:hover {
  border-color: var(--bad-border);
}

button {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

input,
select,
textarea {
  border-color: var(--input-border);
  background: var(--input-bg);
  color: var(--input-text);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted-soft);
}

.dropdown,
.app-user-menu .dropdown,
.autocomplete-list {
  border-color: var(--line);
  background: var(--dropdown-bg);
  box-shadow: var(--shadow-dropdown);
}

.dropdown a,
.dropdown button,
.app-user-menu .dropdown a,
.app-user-menu .dropdown button,
.autocomplete-option {
  background: transparent;
  color: var(--ink);
}

.dropdown a:hover,
.dropdown button:hover,
.app-user-menu .dropdown a:hover,
.app-user-menu .dropdown button:hover,
.autocomplete-option:hover {
  background: var(--dropdown-hover-bg);
  color: var(--accent);
}

.theme-menu {
  display: grid;
  gap: 7px;
  margin: 5px 0 7px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
}

.theme-menu__label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  line-height: 1;
  text-transform: uppercase;
}

.app-user-menu .dropdown {
  min-width: 238px;
}

.theme-menu__options {
  display: grid;
  grid-template-columns: minmax(78px, 1.35fr) minmax(50px, .9fr) minmax(56px, .9fr);
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-muted);
}

.app-user-menu .dropdown .theme-menu__option,
.theme-menu__option {
  justify-content: center;
  min-height: 28px;
  padding: 0 5px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
}

.app-user-menu .dropdown .theme-menu__option:hover,
.theme-menu__option:hover {
  background: var(--surface-hover);
  color: var(--accent);
}

.app-user-menu .dropdown .theme-menu__option.is-active,
.theme-menu__option.is-active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 4px rgba(15, 23, 42, .12);
}

:root[data-theme="dark"] .app-user-menu .dropdown .theme-menu__option.is-active,
:root[data-theme="dark"] .theme-menu__option.is-active {
  background: var(--accent-soft);
  box-shadow: none;
}

form,
table,
.messages li,
.detail-item,
.panel,
.form-section,
.project-form .form-section,
.filters,
.stock-attention,
.stock-attention__section,
.stock-attention__item,
.movement-summary,
.material-stock-card,
.material-action-card,
.material-section-card,
.fleet-card,
.equipment-photo-card,
.status-panel,
.work-status-card,
.client-status-card,
.project-section-card,
.project-missing-items-card,
.project-meta-card,
.status-quick-panel,
.app-modal__dialog,
.movement-modal__dialog,
.progress-dialog,
.project-mail-address-dialog,
.ksef-invoice-lines {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.filters,
.stock-attention,
.return-stock-intro,
.return-mode-panel,
.material-empty-state,
.empty-state,
.project-missing-items-text,
.project-missing-items-empty,
.client-status-core-item,
.client-status-metric,
.stage-card,
.status-publication-grid > div,
.status-publication-state,
.project-document-preview__header,
.project-document-preview__canvas,
.project-document-preview__message,
.ksef-invoice-modal__hero,
.ksef-invoice-modal__details,
.ksef-invoice-modal__note,
.ksef-status-select,
.ksef-paid-toggle,
.employee-contract-switch,
.return-mode-choice {
  border-color: var(--border-subtle);
  background: var(--surface-soft);
  color: var(--ink);
}

.detail-grid .detail-item.is-primary,
.material-stock-card,
.work-status-card,
.status-quick-panel,
.work-status-tile-now,
.project-work-panel,
.project-meta-card.is-alert,
.status-publication-state--current {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

table,
.stock-table,
.material-section-card table,
.project-section-card table,
.ksef-invoice-lines table {
  border-color: var(--line);
  background: var(--table-bg);
}

th,
td,
.ksef-invoice-lines th,
.ksef-invoice-lines td {
  border-color: var(--line);
}

th,
.material-section-card th,
.project-section-card th,
.ksef-invoice-lines th {
  background: var(--table-head-bg);
  color: var(--heading);
}

td,
.material-section-card td,
.project-section-card td {
  background: var(--table-bg);
  color: var(--ink);
}

.stock-table tbody tr:hover td,
.status-document-row:hover {
  background: var(--table-hover-bg);
}

.app-modal,
.movement-modal,
.progress-modal,
.project-mail-address-modal {
  background: var(--modal-backdrop);
}

.app-modal__dialog,
.movement-modal__dialog,
.progress-dialog,
.project-mail-address-dialog {
  background: var(--modal-bg);
  box-shadow: var(--shadow-modal);
}

.app-modal__head,
.movement-modal__head,
.project-mail-address-dialog__head {
  border-color: var(--line);
}

.app-modal__close,
.app-modal .button,
.movement-modal__close,
.movement-modal .button,
.modal-cancel,
.modal-secondary,
.material-history-action,
.status-document-action,
.quantity-stepper__buttons button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--heading);
}

.app-modal__close:hover,
.app-modal .button:hover,
.movement-modal__close:hover,
.movement-modal .button:hover,
.modal-cancel:hover,
.modal-secondary:hover,
.material-history-action:hover,
.status-document-action:hover,
.quantity-stepper__buttons button:hover {
  border-color: var(--accent-border);
  background: var(--surface-hover);
  color: var(--accent);
}

.badge,
.status-badge,
.priority-badge,
.reservation-badge,
.reservation-chip,
.fleet-deadline,
.ksef-status-badge,
.ksef-paid-badge,
.ksef-lines-badge,
.movement-line-role,
.project-material-settled,
.stock-attention__count {
  border-color: var(--line);
  background: var(--surface-muted);
  color: var(--muted-strong);
}

.badge.ok,
.status-badge.ok,
.fleet-deadline.ok,
.ksef-lines-badge--ok,
.ksef-status-badge--checked,
.ksef-status-badge--booked,
.ksef-paid-badge--yes,
.ksef-paid-form.is-paid .ksef-paid-toggle,
.ksef-invoice-modal__message--ok {
  border-color: var(--success-border);
  background: var(--success-bg);
  color: var(--success);
}

.badge.warn,
.status-badge.warn,
.fleet-deadline.warn,
.reservation-badge,
.reservation-chip,
.stock-reservation-alert,
.return-stock-warning,
.status-warning-list,
.status-publication-state--stale,
.status-publication-state--never {
  border-color: var(--warn-border);
  background: var(--warn-bg);
  color: var(--warn);
}

.badge.bad,
.status-badge.empty,
.fleet-deadline.expired,
.ksef-lines-badge--error,
.ksef-invoice-modal__message--error,
.app-modal-error,
.return-stock-errors {
  border-color: var(--bad-border);
  background: var(--bad-bg);
  color: var(--bad);
}

.status-badge.info {
  border-color: var(--info-border);
  background: var(--info-bg);
  color: var(--info);
}

.stock-attention h2,
.stock-attention__section-head h3,
.stock-attention__item strong,
.stock-filter-link,
.movement-summary,
.return-stock-form label,
.return-stock-intro,
.material-last-summary,
.material-filter-link,
.material-project-link,
.fleet-card-detail strong,
.fleet-notes-grid p,
.fleet-row-actions a,
.project-form .form-section h2,
.project-form label,
.progress-field label,
.project-missing-items-text,
.client-status-core-item strong,
.client-status-meta-row strong,
.client-status-metric strong,
.project-ksef-summary strong,
.project-ksef-counterparty strong,
.ksef-invoice-modal__hero h3,
.ksef-invoice-modal__details-head h4,
.ksef-invoice-modal__amounts strong,
.ksef-invoice-modal__grid dd,
.app-modal__head h2 {
  color: var(--heading);
}

.filters label,
.stock-attention__eyebrow,
.stock-attention__section-head > div > span,
.stock-attention__item span:last-child,
.stock-attention__tag,
.return-stock-summary dt,
.return-mode-choice__item small,
.return-stock-limit,
.fleet-card-detail small,
.fleet-card-deadline small,
.material-summary-total span,
.material-section-total,
.project-missing-items-meta,
.project-usable-section-list li,
.project-material-returned,
.ksef-invoice-modal__eyebrow,
.ksef-invoice-modal__hero p,
.ksef-invoice-modal__amounts > div > span,
.ksef-invoice-modal__grid dt,
.ksef-invoice-modal__grid small,
.ksef-invoice-modal__note,
.ksef-invoice-lines__head p,
.ksef-paid-toggle .toggle-field__label,
.ksef-money__cents,
.ksef-money__currency {
  color: var(--muted);
}

.return-stock-summary div,
.work-status-tile,
.project-meta-card,
.project-ksef-summary div,
.ksef-invoice-modal__amounts,
.ksef-invoice-modal__amounts div,
.ksef-invoice-modal__grid div,
.employee-compensation-facts div {
  border-color: var(--border-subtle);
  background: var(--surface);
}

.return-mode-choice__item,
.employee-contract-switch__option span {
  color: var(--muted);
}

.return-mode-choice__item input[type="radio"]:checked + span,
.employee-contract-switch__input:checked + span,
.return-mode-choice__item:has(input:checked) {
  background: var(--surface);
  color: var(--accent);
}

.switch-track,
.toggle-switch__track {
  border-color: var(--line);
  background: var(--surface-muted);
}

.switch-track::after,
.toggle-switch__track::after {
  background: var(--surface);
}

:root[data-theme="dark"] img,
:root[data-theme="dark"] iframe,
:root[data-theme="dark"] canvas,
:root[data-theme="dark"] svg {
  color-scheme: light;
}

:root[data-theme="dark"] .app-brand__logo,
:root[data-theme="dark"] .brand-logo {
  filter: none;
}

.app-brand__logo--dark {
  display: none;
  width: 198px;
  height: auto;
  max-height: 34px;
  object-fit: contain;
}

:root[data-theme="dark"] .app-brand__logo--light {
  display: none;
}

:root[data-theme="dark"] .app-brand__logo--dark {
  display: block;
}

:root[data-theme="dark"] .app-brand__logo:not(.app-brand__logo--light):not(.app-brand__logo--dark) {
  content: url("volussi_logo_dark.png");
  width: 198px;
  height: auto;
  max-height: 34px;
  object-fit: contain;
}

/* Dark theme audit fixes: mailbox and worktime */
:root[data-theme="dark"] .mailbox-compose-form label,
:root[data-theme="dark"] .mailbox-search-form label,
:root[data-theme="dark"] .mailbox-reply-templates__head span,
:root[data-theme="dark"] .mailbox-template-edit-form label,
:root[data-theme="dark"] .mailbox-linked-projects > span:first-child,
:root[data-theme="dark"] .mailbox-message-attachments__title,
:root[data-theme="dark"] .employee-worktime-calendar-filter label,
:root[data-theme="dark"] .employee-worktime-time-grid label,
:root[data-theme="dark"] .employee-worktime-time-preview span,
:root[data-theme="dark"] .employee-worktime-bulk-section h3,
:root[data-theme="dark"] .employee-compensation-current__head span,
:root[data-theme="dark"] .employee-compensation-facts span,
:root[data-theme="dark"] .employee-compensation-mode-card label,
:root[data-theme="dark"] .settings-account-list dt,
:root[data-theme="dark"] .toggle-field__label,
:root[data-theme="dark"] .telegram-settings-grid label,
:root[data-theme="dark"] .telegram-rule-grid label {
  color: var(--muted-strong);
}

:root[data-theme="dark"] .mailbox-sidebar,
:root[data-theme="dark"] .mailbox-thread-panel,
:root[data-theme="dark"] .mailbox-info-panel,
:root[data-theme="dark"] .mailbox-reply-panel,
:root[data-theme="dark"] .mailbox-search-form,
:root[data-theme="dark"] .mailbox-rich-editor,
:root[data-theme="dark"] .mailbox-reply-templates,
:root[data-theme="dark"] .mailbox-template-list-item,
:root[data-theme="dark"] .mailbox-create-modal,
:root[data-theme="dark"] .mailbox-settings-card,
:root[data-theme="dark"] .mailbox-settings-empty,
:root[data-theme="dark"] .mailbox-settings-accordion,
:root[data-theme="dark"] .mailbox-settings-tech-grid > div,
:root[data-theme="dark"] .mailbox-access-details,
:root[data-theme="dark"] .mailbox-thread-action-popover,
:root[data-theme="dark"] .mailbox-linked-projects,
:root[data-theme="dark"] .mailbox-message-card,
:root[data-theme="dark"] .mailbox-conversation-message,
:root[data-theme="dark"] .mailbox-message-summary,
:root[data-theme="dark"] .mailbox-message-meta-grid > div,
:root[data-theme="dark"] .mailbox-message-attachments,
:root[data-theme="dark"] .mailbox-attachment-row,
:root[data-theme="dark"] .mailbox-attachment-preview__header,
:root[data-theme="dark"] .mailbox-attachment-preview__canvas,
:root[data-theme="dark"] .employee-worktime-panel,
:root[data-theme="dark"] .employee-worktime-bulk-section,
:root[data-theme="dark"] .employee-compensation-current,
:root[data-theme="dark"] .employee-compensation-facts div,
:root[data-theme="dark"] .employee-compensation-mode-card,
:root[data-theme="dark"] .employee-compensation-field-group,
:root[data-theme="dark"] .settings-panel,
:root[data-theme="dark"] .settings-location-card,
:root[data-theme="dark"] .settings-account-panel,
:root[data-theme="dark"] .settings-admin-card,
:root[data-theme="dark"] .telegram-settings-card,
:root[data-theme="dark"] .telegram-log-card {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

:root[data-theme="dark"] .mailbox-rich-editor__toolbar,
:root[data-theme="dark"] .mailbox-empty-note,
:root[data-theme="dark"] .mailbox-reply-panel form,
:root[data-theme="dark"] .mailbox-quoted-body,
:root[data-theme="dark"] .mailbox-full-body,
:root[data-theme="dark"] .mailbox-message-attachment-note,
:root[data-theme="dark"] .mailbox-attachment-preview__message,
:root[data-theme="dark"] .employee-worktime-search-field input[type="search"],
:root[data-theme="dark"] .employee-worktime-time-presets .table-action-button,
:root[data-theme="dark"] .employee-worktime-time-preview,
:root[data-theme="dark"] .employee-compensation-field-group--quiet,
:root[data-theme="dark"] .settings-section-head,
:root[data-theme="dark"] .settings-account-list div,
:root[data-theme="dark"] .settings-location-service,
:root[data-theme="dark"] .toggle-field {
  border-color: var(--border-subtle);
  background: var(--surface-soft);
  color: var(--ink);
}

:root[data-theme="dark"] .mailbox-rich-editor__toolbar button,
:root[data-theme="dark"] .mailbox-rich-editor__toolbar select,
:root[data-theme="dark"] .mailbox-attachment-field__button,
:root[data-theme="dark"] .mailbox-message-details summary,
:root[data-theme="dark"] .mailbox-quoted-details summary,
:root[data-theme="dark"] .mailbox-full-details summary,
:root[data-theme="dark"] .mailbox-attachment-open,
:root[data-theme="dark"] .mailbox-thread-row-delete,
:root[data-theme="dark"] .employee-worktime-clear-button,
:root[data-theme="dark"] .employee-worktime-set-button,
:root[data-theme="dark"] .employee-worktime-time-presets .table-action-button,
:root[data-theme="dark"] .settings-order-button {
  border-color: var(--line);
  background: var(--surface-raised);
  color: var(--heading) !important;
}

:root[data-theme="dark"] .mailbox-rich-editor__toolbar button:hover,
:root[data-theme="dark"] .mailbox-rich-editor__toolbar select:hover,
:root[data-theme="dark"] .mailbox-attachment-field__button:hover,
:root[data-theme="dark"] .mailbox-template-list-item:hover,
:root[data-theme="dark"] .mailbox-sidebar-item:hover,
:root[data-theme="dark"] .mailbox-folder-item:hover,
:root[data-theme="dark"] .mailbox-message-details summary:hover,
:root[data-theme="dark"] .mailbox-quoted-details summary:hover,
:root[data-theme="dark"] .mailbox-full-details summary:hover,
:root[data-theme="dark"] .employee-worktime-month-day:hover,
:root[data-theme="dark"] .employee-worktime-clear-button:hover,
:root[data-theme="dark"] .employee-worktime-set-button:hover,
:root[data-theme="dark"] .employee-worktime-time-presets .table-action-button:hover,
:root[data-theme="dark"] .settings-order-button:hover:not(:disabled) {
  border-color: var(--accent-border);
  background: var(--surface-hover);
  color: var(--accent) !important;
}

:root[data-theme="dark"] .mailbox-rich-editor__surface,
:root[data-theme="dark"] .mailbox-message-body,
:root[data-theme="dark"] .mailbox-message-html,
:root[data-theme="dark"] .mailbox-message-html p,
:root[data-theme="dark"] .mailbox-message-html div,
:root[data-theme="dark"] .mailbox-message-html li,
:root[data-theme="dark"] .mailbox-message-html td,
:root[data-theme="dark"] .mailbox-delete-modal__text,
:root[data-theme="dark"] .mailbox-template-list-item,
:root[data-theme="dark"] .mailbox-create-modal__head h2,
:root[data-theme="dark"] .mailbox-settings-card__titleline h3,
:root[data-theme="dark"] .mailbox-settings-tech-grid strong,
:root[data-theme="dark"] .mailbox-access-details summary,
:root[data-theme="dark"] .employee-worktime-calendar__head strong,
:root[data-theme="dark"] .employee-worktime-result,
:root[data-theme="dark"] .employee-worktime-hours-range,
:root[data-theme="dark"] .employee-worktime-bulk-section li,
:root[data-theme="dark"] .employee-compensation-current__head strong,
:root[data-theme="dark"] .employee-compensation-facts strong,
:root[data-theme="dark"] .employee-compensation-history-head h3,
:root[data-theme="dark"] .employee-compensation-field-group h3 {
  color: var(--heading);
}

:root[data-theme="dark"] .mailbox-attachment-field,
:root[data-theme="dark"] .mailbox-attachment-field__names,
:root[data-theme="dark"] .mailbox-compose-note,
:root[data-theme="dark"] .mailbox-reply-templates__head small,
:root[data-theme="dark"] .mailbox-template-list-item span,
:root[data-theme="dark"] .mailbox-draft-status,
:root[data-theme="dark"] .mailbox-create-modal__head p,
:root[data-theme="dark"] .mailbox-settings-card__meta,
:root[data-theme="dark"] .mailbox-settings-note,
:root[data-theme="dark"] .mailbox-settings-tech-grid span,
:root[data-theme="dark"] .mailbox-settings-tech-grid code,
:root[data-theme="dark"] .mailbox-thread-sender-cell,
:root[data-theme="dark"] .mailbox-thread-count,
:root[data-theme="dark"] .mailbox-thread-mailbox-cell,
:root[data-theme="dark"] .mailbox-thread-date-cell,
:root[data-theme="dark"] .mailbox-message-summary-line,
:root[data-theme="dark"] .mailbox-message-direction,
:root[data-theme="dark"] .mailbox-message-date-inline,
:root[data-theme="dark"] .mailbox-message-date,
:root[data-theme="dark"] .mailbox-message-preview,
:root[data-theme="dark"] .mailbox-message-meta-grid span,
:root[data-theme="dark"] .mailbox-message-meta-grid small,
:root[data-theme="dark"] .mailbox-safe-note,
:root[data-theme="dark"] .mailbox-message-safe-note,
:root[data-theme="dark"] .mailbox-attachment-meta,
:root[data-theme="dark"] .mailbox-attachment-unavailable,
:root[data-theme="dark"] .employee-worktime-rule,
:root[data-theme="dark"] .employee-worktime-calendar-filter label,
:root[data-theme="dark"] .employee-worktime-month__weekdays span,
:root[data-theme="dark"] .employee-worktime-month-day__number,
:root[data-theme="dark"] .employee-worktime-month-day small,
:root[data-theme="dark"] .employee-worktime-membership-note,
:root[data-theme="dark"] .employee-worktime-bulk-standard,
:root[data-theme="dark"] .employee-worktime-bulk-summary,
:root[data-theme="dark"] .employee-worktime-bulk-section li span,
:root[data-theme="dark"] .employee-worktime-time-modal__meta,
:root[data-theme="dark"] .employee-worktime-time-note,
:root[data-theme="dark"] .employee-worktime-hours-range--empty,
:root[data-theme="dark"] .employee-compensation-confidential,
:root[data-theme="dark"] .employee-compensation-current__head small,
:root[data-theme="dark"] .employee-compensation-history-head span,
:root[data-theme="dark"] .employee-compensation-rates,
:root[data-theme="dark"] .employee-compensation-guided-fields .muted,
:root[data-theme="dark"] .settings-account-list dd,
:root[data-theme="dark"] .settings-location-meta,
:root[data-theme="dark"] .settings-usage-total,
:root[data-theme="dark"] .settings-usage-total.is-empty,
:root[data-theme="dark"] .telegram-token-state,
:root[data-theme="dark"] .toggle-field__hint {
  color: var(--muted);
}

:root[data-theme="dark"] .mailbox-sidebar-item,
:root[data-theme="dark"] .mailbox-folder-item {
  border-color: transparent;
  background: transparent;
  color: var(--ink);
}

:root[data-theme="dark"] .mailbox-sidebar-item--active,
:root[data-theme="dark"] .mailbox-folder-item--active,
:root[data-theme="dark"] .mailbox-thread-row--active,
:root[data-theme="dark"] .mailbox-thread-action-details[open] > summary,
:root[data-theme="dark"] .mailbox-template-button.is-used,
:root[data-theme="dark"] .mailbox-send-confirmation,
:root[data-theme="dark"] .mailbox-project-badge,
:root[data-theme="dark"] .mailbox-project-chip,
:root[data-theme="dark"] .employee-worktime-approve-button,
:root[data-theme="dark"] .employee-worktime-approved-label,
:root[data-theme="dark"] .employee-worktime-bulk-section.is-standard,
:root[data-theme="dark"] .employee-compensation-current,
:root[data-theme="dark"] .employee-compensation-mode-hint {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent);
}

:root[data-theme="dark"] .mailbox-project-badge:hover,
:root[data-theme="dark"] .mailbox-project-chip:hover,
:root[data-theme="dark"] .mailbox-project-chip button:hover,
:root[data-theme="dark"] .employee-worktime-approve-button:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 72%, var(--surface-hover));
  color: var(--accent-strong);
}

:root[data-theme="dark"] .mailbox-project-badge--city,
:root[data-theme="dark"] .mailbox-settings-card__meta span,
:root[data-theme="dark"] .mailbox-access-chip,
:root[data-theme="dark"] .mailbox-message-attachment-chip,
:root[data-theme="dark"] .mailbox-message-attachment-pill,
:root[data-theme="dark"] .mailbox-message-attachment-more,
:root[data-theme="dark"] .mailbox-attachment-indicator {
  border-color: var(--line);
  background: var(--surface-muted);
  color: var(--muted-strong);
}

:root[data-theme="dark"] .mailbox-access-chip small,
:root[data-theme="dark"] .mailbox-message-attachment-pill__icon,
:root[data-theme="dark"] .mailbox-message-attachment-pill__meta {
  color: var(--muted);
}

:root[data-theme="dark"] .mailbox-thread-table,
:root[data-theme="dark"] .mailbox-message-html table,
:root[data-theme="dark"] .employee-worktime-table,
:root[data-theme="dark"] .employee-worktime-history-table,
:root[data-theme="dark"] .employee-compensation-table,
:root[data-theme="dark"] .settings-location-table {
  border-color: var(--line);
  background: var(--table-bg);
}

:root[data-theme="dark"] .mailbox-thread-table th,
:root[data-theme="dark"] .mailbox-message-html th,
:root[data-theme="dark"] .employee-worktime-table th,
:root[data-theme="dark"] .employee-worktime-history-table th,
:root[data-theme="dark"] .employee-compensation-table th,
:root[data-theme="dark"] .settings-location-table th {
  border-color: var(--line);
  background: var(--table-head-bg);
  color: var(--heading);
}

:root[data-theme="dark"] .mailbox-thread-table td,
:root[data-theme="dark"] .mailbox-message-html td,
:root[data-theme="dark"] .employee-worktime-table td,
:root[data-theme="dark"] .employee-worktime-history-table td,
:root[data-theme="dark"] .employee-compensation-table td,
:root[data-theme="dark"] .settings-location-table td {
  border-color: var(--line);
  background: inherit;
  color: var(--ink);
}

:root[data-theme="dark"] .mailbox-thread-table tbody tr:not(.mailbox-thread-row--unread),
:root[data-theme="dark"] .mailbox-thread-row,
:root[data-theme="dark"] .employee-worktime-table tbody tr {
  background: var(--table-bg);
  color: var(--ink);
}

:root[data-theme="dark"] .mailbox-thread-table tbody tr.mailbox-thread-row:hover,
:root[data-theme="dark"] .mailbox-thread-row:hover,
:root[data-theme="dark"] .employee-worktime-table tbody tr:hover td {
  background: var(--table-hover-bg);
}

:root[data-theme="dark"] .mailbox-thread-row--unread,
:root[data-theme="dark"] .mailbox-thread-table tbody tr.mailbox-thread-row--unread,
:root[data-theme="dark"] .mailbox-thread-table tbody tr.mailbox-thread-row--unread td {
  background: color-mix(in srgb, var(--info-bg) 52%, var(--table-bg));
  color: var(--heading);
}

:root[data-theme="dark"] .mailbox-thread-table tbody tr.mailbox-thread-row--active,
:root[data-theme="dark"] .mailbox-thread-table tbody tr.mailbox-thread-row--active td {
  background: var(--accent-soft);
}

:root[data-theme="dark"] .mailbox-thread-subject,
:root[data-theme="dark"] .mailbox-thread-row--unread .mailbox-thread-sender,
:root[data-theme="dark"] .mailbox-thread-row--unread .mailbox-thread-count,
:root[data-theme="dark"] .mailbox-thread-row--unread .mailbox-thread-date-cell,
:root[data-theme="dark"] .mailbox-message-sender,
:root[data-theme="dark"] .mailbox-attachment-name {
  color: var(--heading);
}

:root[data-theme="dark"] .mailbox-search-row input[type="search"],
:root[data-theme="dark"] .mailbox-compose-form input,
:root[data-theme="dark"] .mailbox-compose-form select,
:root[data-theme="dark"] .mailbox-compose-form textarea,
:root[data-theme="dark"] .mailbox-template-edit-form input,
:root[data-theme="dark"] .mailbox-template-edit-form textarea,
:root[data-theme="dark"] .employee-worktime-calendar-filter select,
:root[data-theme="dark"] .employee-worktime-table input,
:root[data-theme="dark"] .employee-worktime-table select,
:root[data-theme="dark"] .employee-worktime-time-grid input[type="time"],
:root[data-theme="dark"] .employee-compensation-mode-card select {
  border-color: var(--input-border);
  background-color: var(--input-bg);
  color: var(--input-text);
}

:root[data-theme="dark"] .mailbox-search-row input[type="search"]:focus,
:root[data-theme="dark"] .employee-worktime-calendar-filter select:focus,
:root[data-theme="dark"] .employee-worktime-table input:focus,
:root[data-theme="dark"] .employee-worktime-table select:focus,
:root[data-theme="dark"] .employee-worktime-time-grid input[type="time"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(83, 199, 181, .14);
  outline: none;
}

:root[data-theme="dark"] .mailbox-message-html h1,
:root[data-theme="dark"] .mailbox-message-html h2,
:root[data-theme="dark"] .mailbox-message-html h3,
:root[data-theme="dark"] .mailbox-message-html h4,
:root[data-theme="dark"] .mailbox-message-meta-grid strong {
  color: var(--heading);
}

:root[data-theme="dark"] .mailbox-message-html a {
  color: var(--accent-strong);
}

:root[data-theme="dark"] .mailbox-message-avatar,
:root[data-theme="dark"] .mailbox-attachment-icon {
  border-color: var(--line);
  background: var(--surface-muted);
  color: var(--muted-strong);
}

:root[data-theme="dark"] .mailbox-delete-button,
:root[data-theme="dark"] .mailbox-thread-row-delete:hover,
:root[data-theme="dark"] .mailbox-attachment-preview__message--error {
  border-color: var(--bad-border);
  background: var(--bad-bg);
  color: var(--bad) !important;
}

:root[data-theme="dark"] .mailbox-delete-modal__subject {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--heading);
}

:root[data-theme="dark"] .employee-worktime-month__legend {
  color: var(--muted);
}

:root[data-theme="dark"] .employee-worktime-month__legend .is-ok,
:root[data-theme="dark"] .employee-worktime-month-day.is-ok,
:root[data-theme="dark"] .employee-worktime-table tr.is-approved,
:root[data-theme="dark"] .employee-worktime-table tr.is-standard-hours,
:root[data-theme="dark"] .employee-worktime-table tr.is-approved td,
:root[data-theme="dark"] .employee-worktime-table tr.is-standard-hours td,
:root[data-theme="dark"] .employee-worktime-bulk-section.is-approved {
  border-color: var(--success-border);
  background: color-mix(in srgb, var(--success-bg) 78%, var(--surface));
  color: var(--success);
}

:root[data-theme="dark"] .employee-worktime-month__legend .is-warning,
:root[data-theme="dark"] .employee-worktime-month-day.is-warning,
:root[data-theme="dark"] .employee-worktime-table tr.is-under-hours,
:root[data-theme="dark"] .employee-worktime-table tr.is-under-hours td,
:root[data-theme="dark"] .employee-worktime-approved-label.is-under-hours,
:root[data-theme="dark"] .employee-worktime-bulk-warning,
:root[data-theme="dark"] .employee-worktime-bulk-section.is-attention {
  border-color: var(--warn-border);
  background: color-mix(in srgb, var(--warn-bg) 82%, var(--surface));
  color: var(--warn);
}

:root[data-theme="dark"] .employee-worktime-month__legend .is-danger,
:root[data-theme="dark"] .employee-worktime-month-day.is-danger,
:root[data-theme="dark"] .employee-worktime-table tr.is-overtime,
:root[data-theme="dark"] .employee-worktime-table tr.is-overtime td,
:root[data-theme="dark"] .employee-worktime-approved-label.is-overtime {
  border-color: var(--bad-border);
  background: color-mix(in srgb, var(--bad-bg) 82%, var(--surface));
  color: var(--bad);
}

:root[data-theme="dark"] .employee-worktime-month__legend .is-weekend,
:root[data-theme="dark"] .employee-worktime-month-day.is-weekend,
:root[data-theme="dark"] .employee-worktime-month-day.is-empty,
:root[data-theme="dark"] .employee-worktime-bulk-section.is-skipped {
  border-color: var(--border-subtle);
  background: var(--surface-soft);
  color: var(--muted);
}

:root[data-theme="dark"] .employee-worktime-month__legend .is-holiday,
:root[data-theme="dark"] .employee-worktime-month-day.is-holiday {
  border-color: #8b5c78;
  background: #39283a;
  color: #f0a8cc;
}

:root[data-theme="dark"] .employee-worktime-month-day strong,
:root[data-theme="dark"] .employee-worktime-month-day.is-ok strong,
:root[data-theme="dark"] .employee-worktime-month-day.is-ok small,
:root[data-theme="dark"] .employee-worktime-month-day.is-warning strong,
:root[data-theme="dark"] .employee-worktime-month-day.is-warning small,
:root[data-theme="dark"] .employee-worktime-month-day.is-danger strong,
:root[data-theme="dark"] .employee-worktime-month-day.is-danger small,
:root[data-theme="dark"] .employee-worktime-month-day.is-holiday strong,
:root[data-theme="dark"] .employee-worktime-month-day.is-holiday small {
  color: currentColor;
}

:root[data-theme="dark"] .employee-worktime-month-day.is-today {
  border-color: var(--info-border);
  box-shadow: 0 0 0 2px rgba(147, 197, 253, .24), inset 0 0 0 1px rgba(147, 197, 253, .22);
}

:root[data-theme="dark"] .employee-worktime-month-day.is-selected,
:root[data-theme="dark"] .employee-worktime-month-day.is-today.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
  box-shadow: 0 0 0 2px rgba(83, 199, 181, .24), inset 0 0 0 1px rgba(83, 199, 181, .2);
}

:root[data-theme="dark"] .employee-worktime-month-day.is-selected .employee-worktime-month-day__number,
:root[data-theme="dark"] .employee-worktime-month-day.is-selected strong,
:root[data-theme="dark"] .employee-worktime-month-day.is-selected small {
  color: var(--accent-strong);
}

:root[data-theme="dark"] .employee-worktime-table tr.is-approved input,
:root[data-theme="dark"] .employee-worktime-table tr.is-approved select,
:root[data-theme="dark"] .employee-worktime-table tr.is-under-hours input,
:root[data-theme="dark"] .employee-worktime-table tr.is-under-hours select,
:root[data-theme="dark"] .employee-worktime-table tr.is-overtime input,
:root[data-theme="dark"] .employee-worktime-table tr.is-overtime select,
:root[data-theme="dark"] .employee-worktime-table tr.is-approved.is-editable-approved input,
:root[data-theme="dark"] .employee-worktime-table tr.is-approved.is-editable-approved select {
  border-color: var(--input-border);
  background: var(--input-bg);
  color: var(--input-text);
}

:root[data-theme="dark"] .employee-worktime-locked-label,
:root[data-theme="dark"] .employee-worktime-table .employee-position-stack > span:first-child,
:root[data-theme="dark"] .employee-worktime-bulk-section .employee-worktime-bulk-empty {
  color: var(--muted-soft);
}

:root[data-theme="dark"] .employee-worktime-time-preview strong,
:root[data-theme="dark"] .employee-worktime-bulk-standard strong,
:root[data-theme="dark"] .employee-worktime-modal-eyebrow {
  color: var(--accent-strong);
}

:root[data-theme="dark"] .employee-worktime-set-button:disabled,
:root[data-theme="dark"] .employee-worktime-bulk-actions .material-action-button:disabled {
  border-color: var(--border-subtle);
  background: var(--surface-muted);
  color: var(--muted-soft);
  box-shadow: none;
}

:root[data-theme="dark"] .employee-worktime-ajax-status {
  border-color: var(--success-border);
  background: color-mix(in srgb, var(--success-bg) 88%, var(--surface));
  color: var(--success);
  box-shadow: var(--shadow-dropdown);
}

:root[data-theme="dark"] .employee-worktime-ajax-status.is-error {
  border-color: var(--bad-border);
  background: color-mix(in srgb, var(--bad-bg) 88%, var(--surface));
  color: var(--bad);
}

/* Dark theme audit fixes: mailbox nested text */
:root[data-theme="dark"] .mailbox-sidebar-item strong,
:root[data-theme="dark"] .mailbox-reply-summary__text strong,
:root[data-theme="dark"] .mailbox-thread-table .mailbox-thread-subject,
:root[data-theme="dark"] .mailbox-thread-table .mailbox-thread-subject:visited,
:root[data-theme="dark"] .mailbox-thread-table .mailbox-thread-subject:hover,
:root[data-theme="dark"] .mailbox-project-chip__link,
:root[data-theme="dark"] .mailbox-project-chip__link:hover {
  color: var(--heading) !important;
}

:root[data-theme="dark"] .mailbox-sidebar-item small,
:root[data-theme="dark"] .mailbox-reply-summary__text small,
:root[data-theme="dark"] .mailbox-sidebar-item small + small {
  color: var(--muted) !important;
}

:root[data-theme="dark"] .mailbox-project-chip button {
  color: var(--accent-strong) !important;
}

/* Dark theme audit fixes: reported module details */
:root[data-theme="dark"] .mailbox-workspace .mailbox-sidebar,
:root[data-theme="dark"] .mailbox-workspace .mailbox-thread-panel,
:root[data-theme="dark"] .access-debug-panel details,
:root[data-theme="dark"] .access-debug-panel__meta div,
:root[data-theme="dark"] .access-debug-panel__scroll,
:root[data-theme="dark"] .project-mail-thread,
:root[data-theme="dark"] .project-mail-more,
:root[data-theme="dark"] .project-mail-address-chip,
:root[data-theme="dark"] .project-mail-address-menu form,
:root[data-theme="dark"] .project-mail-address-dialog,
:root[data-theme="dark"] .project-ksef-summary div,
:root[data-theme="dark"] .ksef-command-card,
:root[data-theme="dark"] .ksef-accordion,
:root[data-theme="dark"] .ksef-inner-help,
:root[data-theme="dark"] .ksef-panel,
:root[data-theme="dark"] .ksef-metric,
:root[data-theme="dark"] .ksef-config-grid div,
:root[data-theme="dark"] .ksef-technical-status div,
:root[data-theme="dark"] .ksef-diagnostics-table-wrap,
:root[data-theme="dark"] .ksef-invoice-modal__hero,
:root[data-theme="dark"] .ksef-invoice-modal__details,
:root[data-theme="dark"] .ksef-invoice-modal__amounts,
:root[data-theme="dark"] .ksef-invoice-modal__amounts div,
:root[data-theme="dark"] .ksef-invoice-modal__grid div,
:root[data-theme="dark"] .ksef-invoice-modal__note,
:root[data-theme="dark"] .ksef-invoice-lines,
:root[data-theme="dark"] .ksef-invoice-lines__table-wrap,
:root[data-theme="dark"] .employee-fact-panel,
:root[data-theme="dark"] .employee-fact-line,
:root[data-theme="dark"] .employee-attention-item,
:root[data-theme="dark"] .employee-deadline-card,
:root[data-theme="dark"] .employee-rank-preview,
:root[data-theme="dark"] .user-employee-summary__item,
:root[data-theme="dark"] .permission-module,
:root[data-theme="dark"] .role-choice-list div,
:root[data-theme="dark"] .role-card,
:root[data-theme="dark"] .document-side-panel,
:root[data-theme="dark"] .document-dropzone,
:root[data-theme="dark"] .document-dropzone__icon,
:root[data-theme="dark"] .document-dropzone__file,
:root[data-theme="dark"] .warehouse-document-preview__summary,
:root[data-theme="dark"] .warehouse-document-preview__meta div,
:root[data-theme="dark"] .warehouse-document-preview__comment,
:root[data-theme="dark"] .dashboard-alert,
:root[data-theme="dark"] .dashboard-deadline,
:root[data-theme="dark"] .company-card,
:root[data-theme="dark"] .company-card__details div {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
  box-shadow: none;
}

:root[data-theme="dark"] .mailbox-workspace .mailbox-sidebar,
:root[data-theme="dark"] .mailbox-workspace .mailbox-thread-panel,
:root[data-theme="dark"] .access-debug-panel details,
:root[data-theme="dark"] .ksef-command-card,
:root[data-theme="dark"] .ksef-accordion,
:root[data-theme="dark"] .ksef-panel,
:root[data-theme="dark"] .employee-fact-panel,
:root[data-theme="dark"] .document-side-panel,
:root[data-theme="dark"] .project-mail-card.panel {
  background: var(--surface);
}

:root[data-theme="dark"] .document-side-panel,
:root[data-theme="dark"] .document-side-panel--quiet {
  border-color: var(--border-subtle);
  background: color-mix(in srgb, var(--surface) 78%, var(--surface-soft));
  opacity: .82;
}

:root[data-theme="dark"] .document-side-panel h2,
:root[data-theme="dark"] .document-side-panel--quiet h2 {
  color: var(--muted);
}

:root[data-theme="dark"] .document-side-panel--quiet h2 span {
  background: var(--surface-soft);
  color: var(--muted);
}

:root[data-theme="dark"] .document-side-panel a,
:root[data-theme="dark"] .document-side-panel--quiet a {
  border-top-color: var(--border-subtle);
  color: var(--ink);
}

:root[data-theme="dark"] .mailbox-conversation-message[open] .mailbox-message-summary,
:root[data-theme="dark"] .mailbox-conversation-message:not([open]) .mailbox-message-summary,
:root[data-theme="dark"] .project-mail-thread--featured,
:root[data-theme="dark"] .project-mail-more summary,
:root[data-theme="dark"] .project-mail-address-dialog__head,
:root[data-theme="dark"] .ksef-accordion > summary,
:root[data-theme="dark"] .ksef-inner-help > summary,
:root[data-theme="dark"] .ksef-empty,
:root[data-theme="dark"] .ksef-invoice-lines__empty,
:root[data-theme="dark"] .document-dropzone__selection,
:root[data-theme="dark"] .employee-empty-state,
:root[data-theme="dark"] .role-card--muted,
:root[data-theme="dark"] .dashboard-empty {
  border-color: var(--border-subtle);
  background: var(--surface-soft);
  color: var(--ink);
}

:root[data-theme="dark"] .mailbox-message-summary:hover,
:root[data-theme="dark"] .project-mail-thread:hover,
:root[data-theme="dark"] .project-mail-address-menu summary:hover,
:root[data-theme="dark"] .ksef-accordion > summary:hover,
:root[data-theme="dark"] .ksef-accordion > summary:focus,
:root[data-theme="dark"] .ksef-inner-help > summary:hover,
:root[data-theme="dark"] .ksef-inner-help > summary:focus,
:root[data-theme="dark"] .ksef-quick-filter:hover,
:root[data-theme="dark"] .document-dropzone:hover,
:root[data-theme="dark"] .document-dropzone-field.is-dragging .document-dropzone,
:root[data-theme="dark"] .is-document-dropzone-dragging .document-dropzone,
:root[data-theme="dark"] .employee-attention-item:hover,
:root[data-theme="dark"] .role-card:hover,
:root[data-theme="dark"] .role-card.is-selected,
:root[data-theme="dark"] .dashboard-alert:hover,
:root[data-theme="dark"] .dashboard-deadline:hover,
:root[data-theme="dark"] .dashboard-task-alert:hover {
  border-color: var(--accent-border);
  background: var(--surface-hover);
  color: var(--accent);
  box-shadow: none;
}

:root[data-theme="dark"] .blocked-line,
:root[data-theme="dark"] .work-blocked-line,
:root[data-theme="dark"] .app-modal-error,
:root[data-theme="dark"] .project-document-preview__message--error,
:root[data-theme="dark"] .document-dropzone__clear:hover,
:root[data-theme="dark"] .danger-zone,
:root[data-theme="dark"] .ksef-alert--error,
:root[data-theme="dark"] .ksef-invoice-modal__message--error,
:root[data-theme="dark"] .ksef-lines-badge--error,
:root[data-theme="dark"] .ksef-paid-checkbox-ui,
:root[data-theme="dark"] .ksef-project-form.is-error select,
:root[data-theme="dark"] .ksef-status-form.is-error select,
:root[data-theme="dark"] .ksef-paid-form.is-error .ksef-paid-checkbox-ui,
:root[data-theme="dark"] .employee-fact-line--urgent,
:root[data-theme="dark"] .employee-fact-line--empty,
:root[data-theme="dark"] .employee-attention-item--urgent,
:root[data-theme="dark"] .employee-attention-item--empty,
:root[data-theme="dark"] .employee-deadline-card--urgent,
:root[data-theme="dark"] .user-employee-badge--missing,
:root[data-theme="dark"] .priority-urgent,
:root[data-theme="dark"] .status-document-action--delete,
:root[data-theme="dark"] .status-attention-item.is-error {
  border-color: var(--bad-border);
  background: color-mix(in srgb, var(--bad-bg) 82%, var(--surface));
  color: var(--bad);
}

:root[data-theme="dark"] .project-check,
:root[data-theme="dark"] .project-check.is-attention,
:root[data-theme="dark"] .priority-high,
:root[data-theme="dark"] .status-attention-item,
:root[data-theme="dark"] .status-attention-icon,
:root[data-theme="dark"] .ksef-command-card--warn,
:root[data-theme="dark"] .ksef-command-card--warn > summary,
:root[data-theme="dark"] .ksef-command-card--warn > summary:hover,
:root[data-theme="dark"] .ksef-command-card--warn > summary:focus,
:root[data-theme="dark"] .ksef-alert--warn,
:root[data-theme="dark"] .employee-fact-line--warn,
:root[data-theme="dark"] .employee-attention-item--warn,
:root[data-theme="dark"] .employee-deadline-card--warn,
:root[data-theme="dark"] .document-dropzone__message,
:root[data-theme="dark"] .dashboard-panel--warn .dashboard-panel__icon,
:root[data-theme="dark"] .user-role-badge--technical {
  border-color: var(--warn-border);
  background: color-mix(in srgb, var(--warn-bg) 82%, var(--surface));
  color: var(--warn);
}

:root[data-theme="dark"] .priority-low,
:root[data-theme="dark"] .status-attention-empty,
:root[data-theme="dark"] .client-link-details[open] summary,
:root[data-theme="dark"] .copy-link-button,
:root[data-theme="dark"] .project-ksef-summary div.is-primary,
:root[data-theme="dark"] .ksef-quick-filter.is-active,
:root[data-theme="dark"] .ksef-project-select--assigned,
:root[data-theme="dark"] .ksef-status-select--checked,
:root[data-theme="dark"] .ksef-status-badge--checked,
:root[data-theme="dark"] .ksef-status-select--booked,
:root[data-theme="dark"] .ksef-status-badge--booked,
:root[data-theme="dark"] .ksef-paid-badge--yes,
:root[data-theme="dark"] .ksef-lines-badge--ok,
:root[data-theme="dark"] .ksef-invoice-modal__message--ok,
:root[data-theme="dark"] .ksef-invoice-modal__amounts .is-primary,
:root[data-theme="dark"] .ksef-paid-form.is-paid .ksef-paid-toggle,
:root[data-theme="dark"] .employee-fact-line--ok,
:root[data-theme="dark"] .employee-deadline-card--ok,
:root[data-theme="dark"] .user-chip--soft,
:root[data-theme="dark"] .user-role-badge,
:root[data-theme="dark"] .user-employee-badge,
:root[data-theme="dark"] .user-employee-summary__item.is-primary,
:root[data-theme="dark"] .permission-module li.is-allowed span,
:root[data-theme="dark"] .document-dropzone-field.has-file .document-dropzone__file,
:root[data-theme="dark"] .dashboard-panel--ok .dashboard-panel__icon,
:root[data-theme="dark"] .company-card__edit:hover {
  border-color: var(--success-border);
  background: color-mix(in srgb, var(--success-bg) 78%, var(--surface));
  color: var(--success);
}


:root[data-theme="dark"] .employee-leave-balance-card {
  background: var(--surface);
}

:root[data-theme="dark"] .employee-leave-balance-grid > div,
:root[data-theme="dark"] .employee-leave-guidance,
:root[data-theme="dark"] .employee-leave-details,
:root[data-theme="dark"] .employee-absence-workday-preview {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--ink);
}

:root[data-theme="dark"] .employee-leave-balance-grid span,
:root[data-theme="dark"] .employee-leave-balance-note,
:root[data-theme="dark"] .employee-leave-guidance span,
:root[data-theme="dark"] .employee-leave-details summary small,
:root[data-theme="dark"] .employee-absence-workday-preview span,
:root[data-theme="dark"] .employee-absence-workday-preview small {
  color: var(--muted-strong);
}

:root[data-theme="dark"] .employee-leave-balance-grid strong,
:root[data-theme="dark"] .employee-leave-guidance strong,
:root[data-theme="dark"] .employee-leave-details summary {
  color: var(--ink);
}

:root[data-theme="dark"] .employee-absence-workday-preview strong {
  color: var(--success);
}

:root[data-theme="dark"] .employee-absence-workday-preview.is-error {
  border-color: rgba(248, 113, 113, .55);
  background: rgba(127, 29, 29, .18);
}

:root[data-theme="dark"] .employee-absence-workday-preview.is-error strong {
  color: #fecaca;
}

:root[data-theme="dark"] .employee-leave-details .employee-light-table {
  border-color: var(--line);
}

:root[data-theme="dark"] .priority-normal,
:root[data-theme="dark"] .project-mail-status-pill,
:root[data-theme="dark"] .ksef-quick-filter,
:root[data-theme="dark"] .ksef-project-select,
:root[data-theme="dark"] .ksef-project-select--empty,
:root[data-theme="dark"] .ksef-status-select,
:root[data-theme="dark"] .ksef-status-select--new,
:root[data-theme="dark"] .ksef-status-badge,
:root[data-theme="dark"] .ksef-status-badge--new,
:root[data-theme="dark"] .ksef-status-select--ignored,
:root[data-theme="dark"] .ksef-status-badge--ignored,
:root[data-theme="dark"] .ksef-invoice-type-badge,
:root[data-theme="dark"] .ksef-lines-badge--missing,
:root[data-theme="dark"] .ksef-paid-badge--no,
:root[data-theme="dark"] .ksef-paid-toggle,
:root[data-theme="dark"] .ksef-invoice-lines__status,
:root[data-theme="dark"] .document-dropzone__clear,
:root[data-theme="dark"] .tab-count,
:root[data-theme="dark"] .user-chip,
:root[data-theme="dark"] .user-row-actions a,
:root[data-theme="dark"] .permission-module li span,
:root[data-theme="dark"] .employee-deadline-card--empty,
:root[data-theme="dark"] .employee-deadline-card--empty em {
  border-color: var(--line);
  background: var(--surface-muted);
  color: var(--muted-strong);
}

:root[data-theme="dark"] .employee-fact-line--absence,
:root[data-theme="dark"] .employee-fact-line--hours,
:root[data-theme="dark"] .employee-attention-item--info,
:root[data-theme="dark"] .employee-deadline-card--absence,
:root[data-theme="dark"] .status-badge.info,
:root[data-theme="dark"] .ksef-alert,
:root[data-theme="dark"] .dashboard-panel--urgent .dashboard-panel__icon {
  border-color: var(--info-border);
  background: color-mix(in srgb, var(--info-bg) 76%, var(--surface));
  color: var(--info);
}

:root[data-theme="dark"] .access-debug-panel,
:root[data-theme="dark"] .access-debug-panel summary,
:root[data-theme="dark"] .access-debug-panel h2,
:root[data-theme="dark"] .access-debug-panel__meta strong,
:root[data-theme="dark"] .access-debug-table td,
:root[data-theme="dark"] .project-mail-thread strong,
:root[data-theme="dark"] .project-mail-message-preview strong,
:root[data-theme="dark"] .project-mail-addresses-line > strong,
:root[data-theme="dark"] .project-ksef-summary strong,
:root[data-theme="dark"] .project-ksef-counterparty strong,
:root[data-theme="dark"] .ksef-command-title h1,
:root[data-theme="dark"] .ksef-metric strong,
:root[data-theme="dark"] .ksef-alert strong,
:root[data-theme="dark"] .ksef-accordion > summary,
:root[data-theme="dark"] .ksef-accordion__title strong,
:root[data-theme="dark"] .ksef-config-grid dd,
:root[data-theme="dark"] .ksef-config-form-head h2,
:root[data-theme="dark"] .ksef-inner-help > summary,
:root[data-theme="dark"] .ksef-steps,
:root[data-theme="dark"] .ksef-list-head h2,
:root[data-theme="dark"] .ksef-counterparty-name,
:root[data-theme="dark"] .ksef-empty strong,
:root[data-theme="dark"] .ksef-invoice-modal__hero h3,
:root[data-theme="dark"] .ksef-invoice-modal__details-head h4,
:root[data-theme="dark"] .ksef-invoice-modal__amounts strong,
:root[data-theme="dark"] .ksef-invoice-modal__grid dd,
:root[data-theme="dark"] .ksef-invoice-lines__head h4,
:root[data-theme="dark"] .ksef-money__main,
:root[data-theme="dark"] .ksef-technical-status strong,
:root[data-theme="dark"] .ksef-diagnostics-grid h3,
:root[data-theme="dark"] .employee-fact-line strong,
:root[data-theme="dark"] .employee-attention-item strong,
:root[data-theme="dark"] .employee-deadline-card strong,
:root[data-theme="dark"] .employee-fact-panel__details strong,
:root[data-theme="dark"] .user-employee-summary strong,
:root[data-theme="dark"] .permission-module h3,
:root[data-theme="dark"] .permission-module li.is-allowed,
:root[data-theme="dark"] .role-choice-list label,
:root[data-theme="dark"] .role-card strong,
:root[data-theme="dark"] .document-dropzone__title,
:root[data-theme="dark"] .warehouse-document-preview__title strong,
:root[data-theme="dark"] .warehouse-document-preview__meta dd,
:root[data-theme="dark"] .dashboard-panel__count strong,
:root[data-theme="dark"] .dashboard-alert strong,
:root[data-theme="dark"] .dashboard-deadline strong,
:root[data-theme="dark"] .company-card__head h2,
:root[data-theme="dark"] .company-card__details dd {
  color: var(--heading);
}

:root[data-theme="dark"] .access-debug-panel__meta span,
:root[data-theme="dark"] .project-mail-section-head p,
:root[data-theme="dark"] .project-mail-thread small,
:root[data-theme="dark"] .project-mail-thread__meta,
:root[data-theme="dark"] .project-mail-thread__snippet,
:root[data-theme="dark"] .project-mail-addresses-line,
:root[data-theme="dark"] .project-mail-address-chip small,
:root[data-theme="dark"] .project-mail-address-dialog__head p,
:root[data-theme="dark"] .project-ksef-summary span,
:root[data-theme="dark"] .project-ksef-counterparty small,
:root[data-theme="dark"] .project-ksef-invoice-number,
:root[data-theme="dark"] .project-ksef-number,
:root[data-theme="dark"] .ksef-metric span,
:root[data-theme="dark"] .ksef-accordion__title small,
:root[data-theme="dark"] .ksef-config-grid dt,
:root[data-theme="dark"] .ksef-config-form-head p,
:root[data-theme="dark"] .ksef-card-note,
:root[data-theme="dark"] .ksef-config-form label,
:root[data-theme="dark"] .ksef-config-form small,
:root[data-theme="dark"] .ksef-list-head p,
:root[data-theme="dark"] .ksef-issue-date,
:root[data-theme="dark"] .ksef-invoice-number,
:root[data-theme="dark"] .ksef-empty span,
:root[data-theme="dark"] .ksef-invoice-modal__eyebrow,
:root[data-theme="dark"] .ksef-invoice-modal__hero p,
:root[data-theme="dark"] .ksef-invoice-modal__amounts > div > span,
:root[data-theme="dark"] .ksef-invoice-modal__grid dt,
:root[data-theme="dark"] .ksef-invoice-modal__grid small,
:root[data-theme="dark"] .ksef-invoice-modal__note,
:root[data-theme="dark"] .ksef-invoice-lines__head p,
:root[data-theme="dark"] .ksef-money__cents,
:root[data-theme="dark"] .ksef-money__currency,
:root[data-theme="dark"] .ksef-money-inline,
:root[data-theme="dark"] .ksef-money-inline__currency,
:root[data-theme="dark"] .ksef-technical-status span,
:root[data-theme="dark"] .ksef-technical-status small,
:root[data-theme="dark"] .employee-fact-panel__identity p,
:root[data-theme="dark"] .employee-fact-line span,
:root[data-theme="dark"] .employee-fact-line small,
:root[data-theme="dark"] .employee-attention-item span,
:root[data-theme="dark"] .employee-deadline-card span,
:root[data-theme="dark"] .employee-deadline-card small,
:root[data-theme="dark"] .employee-fact-panel__details span,
:root[data-theme="dark"] .user-employee-summary span,
:root[data-theme="dark"] .user-employee-summary em,
:root[data-theme="dark"] .permission-module li,
:root[data-theme="dark"] .role-card small,
:root[data-theme="dark"] .role-card em,
:root[data-theme="dark"] .document-side-panel span,
:root[data-theme="dark"] .document-dropzone__hint,
:root[data-theme="dark"] .warehouse-document-preview__title span,
:root[data-theme="dark"] .warehouse-document-preview__total span,
:root[data-theme="dark"] .warehouse-document-preview__meta dt,
:root[data-theme="dark"] .warehouse-document-preview__comment,
:root[data-theme="dark"] .warehouse-document-preview__lines-head span,
:root[data-theme="dark"] .dashboard-panel__count span,
:root[data-theme="dark"] .dashboard-alert small,
:root[data-theme="dark"] .dashboard-deadline small,
:root[data-theme="dark"] .company-card__address,
:root[data-theme="dark"] .company-card__details dt {
  color: var(--muted);
}

:root[data-theme="dark"] .access-debug-table,
:root[data-theme="dark"] .access-debug-table th,
:root[data-theme="dark"] .access-debug-table td,
:root[data-theme="dark"] .ksef-table,
:root[data-theme="dark"] .ksef-invoice-lines table,
:root[data-theme="dark"] .ksef-invoice-lines th,
:root[data-theme="dark"] .ksef-invoice-lines td,
:root[data-theme="dark"] .ksef-diagnostics-table,
:root[data-theme="dark"] .ksef-diagnostics-table th,
:root[data-theme="dark"] .ksef-diagnostics-table td,
:root[data-theme="dark"] .employee-light-table,
:root[data-theme="dark"] .employee-light-table th,
:root[data-theme="dark"] .employee-light-table td,
:root[data-theme="dark"] .warehouse-document-preview__table,
:root[data-theme="dark"] .warehouse-document-preview__table th,
:root[data-theme="dark"] .warehouse-document-preview__table td {
  border-color: var(--line);
}

:root[data-theme="dark"] .access-debug-table,
:root[data-theme="dark"] .ksef-invoice-lines table,
:root[data-theme="dark"] .ksef-diagnostics-table,
:root[data-theme="dark"] .employee-light-table,
:root[data-theme="dark"] .warehouse-document-preview__table {
  background: var(--table-bg);
}

:root[data-theme="dark"] .access-debug-table th,
:root[data-theme="dark"] .ksef-invoice-lines th,
:root[data-theme="dark"] .ksef-diagnostics-table th,
:root[data-theme="dark"] .employee-light-table th,
:root[data-theme="dark"] .warehouse-document-preview__table th {
  background: var(--table-head-bg);
  color: var(--heading);
}

:root[data-theme="dark"] .access-debug-table td,
:root[data-theme="dark"] .ksef-invoice-lines td,
:root[data-theme="dark"] .ksef-diagnostics-table td,
:root[data-theme="dark"] .employee-light-table td,
:root[data-theme="dark"] .warehouse-document-preview__table td {
  background: var(--table-bg);
  color: var(--ink);
}

:root[data-theme="dark"] .access-debug-badge--yes {
  background: var(--success-bg);
  color: var(--success);
}

:root[data-theme="dark"] .access-debug-badge--no {
  background: var(--bad-bg);
  color: var(--bad);
}

:root[data-theme="dark"] .client-link-details summary,
:root[data-theme="dark"] .client-link-details summary::after,
:root[data-theme="dark"] .ksef-accordion__chevron,
:root[data-theme="dark"] .project-mail-address-menu summary,
:root[data-theme="dark"] .company-card__edit {
  border-color: var(--line);
  background: var(--surface-raised);
  color: var(--heading);
}

:root[data-theme="dark"] .client-link-details summary:hover,
:root[data-theme="dark"] .copy-link-button:hover,
:root[data-theme="dark"] .company-card__edit:hover,
:root[data-theme="dark"] .user-row-actions a:hover {
  border-color: var(--accent-border);
  background: var(--surface-hover);
  color: var(--accent);
}

:root[data-theme="dark"] .project-mail-address-link,
:root[data-theme="dark"] .project-mail-thread__actions span,
:root[data-theme="dark"] .project-mail-more summary,
:root[data-theme="dark"] .project-ksef-counterparty-link:hover strong,
:root[data-theme="dark"] .ksef-counterparty-link:hover .ksef-counterparty-name,
:root[data-theme="dark"] .ksef-clear-token,
:root[data-theme="dark"] .ksef-invoice-modal__download,
:root[data-theme="dark"] .warehouse-document-preview__total strong,
:root[data-theme="dark"] .document-side-panel a:hover {
  color: var(--accent-strong) !important;
}

:root[data-theme="dark"] .ksef-invoice-modal__download,
:root[data-theme="dark"] .publish-button,
:root[data-theme="dark"] .ksef-hero-action {
  border-color: var(--accent-border) !important;
  background: var(--accent) !important;
  color: var(--on-accent) !important;
}

:root[data-theme="dark"] .ksef-hero-action:disabled,
:root[data-theme="dark"] .ksef-invoice-modal__download:disabled {
  border-color: var(--border-subtle) !important;
  background: var(--surface-muted) !important;
  color: var(--muted-soft) !important;
}

/* Dark theme audit fixes: neutral project link button */
:root[data-theme="dark"] .copy-link-button {
  border-color: var(--line);
  background: var(--surface-raised);
  color: var(--heading);
}

:root[data-theme="dark"] .copy-link-button:hover {
  border-color: var(--accent-border);
  background: var(--surface-hover);
  color: var(--accent);
}

/* Dark theme audit fixes: reported nested labels */
:root[data-theme="dark"] .access-debug-panel summary strong {
  color: var(--accent-strong);
}

:root[data-theme="dark"] .status-attention-copy > span,
:root[data-theme="dark"] .status-attention-copy strong {
  color: var(--warn);
}

:root[data-theme="dark"] .employee-deadline-card--ok em,
:root[data-theme="dark"] .employee-deadline-card--absence em {
  border-color: var(--success-border);
  background: var(--success-bg);
  color: var(--success);
}

:root[data-theme="dark"] .employee-deadline-card--warn em {
  border-color: var(--warn-border);
  background: var(--warn-bg);
  color: var(--warn);
}

:root[data-theme="dark"] .employee-deadline-card--urgent em {
  border-color: var(--bad-border);
  background: var(--bad-bg);
  color: var(--bad);
}

/* Dark theme audit fixes: employee edit controls */
:root[data-theme="dark"] .employee-admin-actions {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

:root[data-theme="dark"] .employee-admin-actions summary {
  border-radius: 7px;
  background: var(--surface-raised);
  color: var(--heading);
}

:root[data-theme="dark"] .employee-admin-actions summary:hover,
:root[data-theme="dark"] .employee-admin-actions[open] summary {
  background: var(--surface-hover);
  color: var(--accent);
}

:root[data-theme="dark"] .employee-admin-actions__body {
  border-top: 1px solid var(--line);
  background: var(--surface);
}

:root[data-theme="dark"] .toggle-field {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--ink);
}

:root[data-theme="dark"] .toggle-field__label {
  color: var(--heading);
}

:root[data-theme="dark"] .toggle-field__hint {
  color: var(--muted);
}

:root[data-theme="dark"] .toggle-field:has(input[type="checkbox"]:checked),
:root[data-theme="dark"] .employee-active-toggle-field:has(input[type="checkbox"]:checked),
:root[data-theme="dark"] .employee-worktime-toggle-field:has(input[type="checkbox"]:checked) {
  border-color: var(--success-border);
  background: color-mix(in srgb, var(--success-bg) 68%, var(--surface));
}

:root[data-theme="dark"] .toggle-field-danger {
  border-color: var(--bad-border);
  background: color-mix(in srgb, var(--bad-bg) 82%, var(--surface));
  color: var(--bad);
}

:root[data-theme="dark"] .toggle-field-danger .toggle-field__label,
:root[data-theme="dark"] .toggle-field-danger .toggle-field__hint {
  color: var(--bad);
}

:root[data-theme="dark"] .employee-contract-switch {
  border-color: var(--line);
  background: var(--surface-soft);
}

:root[data-theme="dark"] .employee-contract-switch__option span {
  color: var(--muted-strong);
}

:root[data-theme="dark"] .employee-contract-switch__input:checked + span {
  background: var(--surface-raised);
  color: var(--accent-strong);
  box-shadow: none;
}

:root[data-theme="dark"] .employee-contract-switch__input:focus-visible + span,
:root[data-theme="dark"] .toggle-field:has(input[type="checkbox"]:focus-visible) {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 2px;
}

:root[data-theme="dark"] .module-tabs a.active,
:root[data-theme="dark"] .module-tabs a.active:hover {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

:root[data-theme="dark"] .module-tabs a.active .tab-count {
  background: color-mix(in srgb, var(--accent-soft) 70%, var(--surface));
  color: var(--accent-strong);
}

/* Dark theme audit fixes: compact employee form labels */
:root[data-theme="dark"] .compact-form label,
:root[data-theme="dark"] .employee-form label,
:root[data-theme="dark"] .employee-contract-switch__option {
  color: var(--muted-strong);
}

:root[data-theme="dark"] .compact-form .form-section h2,
:root[data-theme="dark"] .employee-form .form-section h2 {
  color: var(--heading);
}

/* Dark theme audit fixes: steel construction editor */
:root[data-theme="dark"] {
  --steel-canvas-bg: #101824;
  --steel-canvas-grid: #263448;
  --steel-canvas-grid-strong: #52637a;
  --steel-svg-halo: #101824;
  --steel-profile-fill: #235f58;
  --steel-profile-stroke: #7bd8c8;
}

:root[data-theme="dark"] .steel-editor-shell,
:root[data-theme="dark"] .steel-editor,
:root[data-theme="dark"] .steel-production-view,
:root[data-theme="dark"] .steel-dimensions-view,
:root[data-theme="dark"] .steel-3d-view {
  color: var(--ink);
}

:root[data-theme="dark"] .steel-editor-topbar,
:root[data-theme="dark"] .steel-workspace-tabs,
:root[data-theme="dark"] .steel-workbench,
:root[data-theme="dark"] .steel-sidebar-section,
:root[data-theme="dark"] .steel-sidebar-switcher,
:root[data-theme="dark"] .steel-3d-side,
:root[data-theme="dark"] .steel-production-head {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}

:root[data-theme="dark"] .steel-editor-topbar h2,
:root[data-theme="dark"] .steel-panel-head h2,
:root[data-theme="dark"] .steel-title-edit input,
:root[data-theme="dark"] .steel-context-form__title,
:root[data-theme="dark"] .steel-dimensions-list__head strong,
:root[data-theme="dark"] .steel-module-card strong,
:root[data-theme="dark"] .steel-module-card-text strong,
:root[data-theme="dark"] .steel-profile-row strong,
:root[data-theme="dark"] .steel-profile-add > strong,
:root[data-theme="dark"] .steel-model-list dd,
:root[data-theme="dark"] .steel-3d-context-menu__head strong,
:root[data-theme="dark"] .steel-3d-context-menu__module strong,
:root[data-theme="dark"] .steel-3d-side-head h2,
:root[data-theme="dark"] .steel-3d-chip-stats dd,
:root[data-theme="dark"] .steel-3d-sheet-head h3,
:root[data-theme="dark"] .steel-3d-sheet-surface strong,
:root[data-theme="dark"] .steel-3d-sheet-order-head strong,
:root[data-theme="dark"] .steel-3d-sheet-order-row strong,
:root[data-theme="dark"] .steel-3d-sheet-placement-text strong,
:root[data-theme="dark"] .steel-3d-instance strong,
:root[data-theme="dark"] .steel-3d-selected-panel h2 {
  color: var(--heading);
}

:root[data-theme="dark"] .steel-workspace-switcher > span,
:root[data-theme="dark"] .steel-panel-note,
:root[data-theme="dark"] .steel-form-grid label,
:root[data-theme="dark"] .steel-module-name-field,
:root[data-theme="dark"] .steel-module-card > span:last-child,
:root[data-theme="dark"] .steel-module-card-text span,
:root[data-theme="dark"] .steel-module-project-choice span,
:root[data-theme="dark"] .steel-profile-row span,
:root[data-theme="dark"] .steel-model-list dt,
:root[data-theme="dark"] .steel-profile-library summary::after,
:root[data-theme="dark"] .steel-dimensions-list__head,
:root[data-theme="dark"] .steel-dimensions-list__empty,
:root[data-theme="dark"] .steel-dimensions-list__number,
:root[data-theme="dark"] .steel-3d-context-menu__field,
:root[data-theme="dark"] .steel-3d-context-menu__module span,
:root[data-theme="dark"] .steel-3d-empty,
:root[data-theme="dark"] .steel-3d-chip-stats dt,
:root[data-theme="dark"] .steel-3d-side .steel-panel-note,
:root[data-theme="dark"] .steel-3d-sheet-surface span,
:root[data-theme="dark"] .steel-3d-sheet-placements-head,
:root[data-theme="dark"] .steel-3d-sheet-order-row span,
:root[data-theme="dark"] .steel-3d-sheet-order small,
:root[data-theme="dark"] .steel-3d-sheet-placements-note,
:root[data-theme="dark"] .steel-3d-sheet-placement-empty,
:root[data-theme="dark"] .steel-3d-sheet-placement-text small,
:root[data-theme="dark"] .steel-3d-instance span,
:root[data-theme="dark"] .steel-3d-selected-meta,
:root[data-theme="dark"] .steel-production-generated,
:root[data-theme="dark"] .steel-garage-wall-wizard summary strong,
:root[data-theme="dark"] .steel-garage-wall-grid label {
  color: var(--muted);
}

:root[data-theme="dark"] .steel-workspace-tab,
:root[data-theme="dark"] .steel-sidebar-tab,
:root[data-theme="dark"] .steel-tool-button,
:root[data-theme="dark"] .steel-title-edit-button,
:root[data-theme="dark"] .steel-context-form__button,
:root[data-theme="dark"] .steel-context-length-step,
:root[data-theme="dark"] .steel-context-choice,
:root[data-theme="dark"] .steel-start-choice,
:root[data-theme="dark"] .steel-move-step,
:root[data-theme="dark"] .steel-frame-type,
:root[data-theme="dark"] .steel-production-download,
:root[data-theme="dark"] .steel-3d-context-menu__action,
:root[data-theme="dark"] .steel-3d-context-menu__module,
:root[data-theme="dark"] .steel-3d-context-menu__back,
:root[data-theme="dark"] .steel-3d-panel-tab,
:root[data-theme="dark"] .steel-3d-sheet-order-actions button,
:root[data-theme="dark"] .steel-3d-sheet-placement-visibility {
  border-color: var(--line);
  background: var(--surface-raised);
  color: var(--heading);
  box-shadow: none;
}

:root[data-theme="dark"] .steel-workspace-tab:hover,
:root[data-theme="dark"] .steel-workspace-tab.is-active,
:root[data-theme="dark"] .steel-sidebar-tab:hover,
:root[data-theme="dark"] .steel-sidebar-tab.is-active,
:root[data-theme="dark"] .steel-tool-button:hover,
:root[data-theme="dark"] .steel-tool-button.is-active,
:root[data-theme="dark"] .steel-title-edit-button:hover,
:root[data-theme="dark"] .steel-context-form__button:hover,
:root[data-theme="dark"] .steel-context-form__button:focus,
:root[data-theme="dark"] .steel-context-choice:hover,
:root[data-theme="dark"] .steel-context-choice:focus,
:root[data-theme="dark"] .steel-context-choice.is-selected,
:root[data-theme="dark"] .steel-frame-type.is-active,
:root[data-theme="dark"] .steel-frame-type:hover,
:root[data-theme="dark"] .steel-production-download:hover,
:root[data-theme="dark"] .steel-production-download:focus,
:root[data-theme="dark"] .steel-3d-context-menu__action:hover,
:root[data-theme="dark"] .steel-3d-context-menu__module:hover,
:root[data-theme="dark"] .steel-3d-context-menu__back:hover,
:root[data-theme="dark"] .steel-3d-panel-tab:hover,
:root[data-theme="dark"] .steel-3d-panel-tab:focus,
:root[data-theme="dark"] .steel-3d-panel-tab.is-active,
:root[data-theme="dark"] .steel-3d-instance:hover,
:root[data-theme="dark"] .steel-3d-instance.is-active {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent-strong);
  box-shadow: none;
}

:root[data-theme="dark"] .steel-context-form__button.is-primary,
:root[data-theme="dark"] .steel-module-card-freeze {
  border-color: var(--accent-border);
  background: var(--accent);
  color: var(--on-accent);
}

:root[data-theme="dark"] .steel-tool-button:disabled,
:root[data-theme="dark"] .steel-production-download:disabled {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--muted);
}

:root[data-theme="dark"] .steel-tool-button--danger:hover,
:root[data-theme="dark"] .steel-context-menu__item.is-danger:hover,
:root[data-theme="dark"] .steel-context-menu__item.is-danger:focus,
:root[data-theme="dark"] .steel-module-project-delete,
:root[data-theme="dark"] .steel-module-delete,
:root[data-theme="dark"] .steel-dimensions-list__delete,
:root[data-theme="dark"] .steel-3d-sheet-placement-delete,
:root[data-theme="dark"] .steel-3d-scene-actions .steel-tool-button--danger.is-confirming {
  border-color: var(--bad-border);
  background: var(--bad-bg);
  color: var(--bad);
}

:root[data-theme="dark"] .steel-context-length-step.is-plus,
:root[data-theme="dark"] .steel-move-step.is-plus,
:root[data-theme="dark"] .steel-module-project-row.is-active .steel-module-project-choice,
:root[data-theme="dark"] .steel-3d-sheet-placement-row.is-active .steel-3d-sheet-placement-select,
:root[data-theme="dark"] .steel-3d-sheet-badge {
  border-color: var(--success-border);
  background: var(--success-bg);
  color: var(--success);
}

:root[data-theme="dark"] .steel-context-length-step.is-minus,
:root[data-theme="dark"] .steel-move-step.is-minus {
  border-color: var(--bad-border);
  background: var(--bad-bg);
  color: var(--bad);
}

:root[data-theme="dark"] .steel-title-edit input,
:root[data-theme="dark"] .steel-context-form__field input,
:root[data-theme="dark"] .steel-context-form__field select,
:root[data-theme="dark"] .steel-move-dialog input,
:root[data-theme="dark"] .steel-form-grid input,
:root[data-theme="dark"] .steel-form-grid select,
:root[data-theme="dark"] .steel-module-name-field input,
:root[data-theme="dark"] .steel-module-name-field select,
:root[data-theme="dark"] .steel-module-move-select,
:root[data-theme="dark"] .steel-detail-input,
:root[data-theme="dark"] .steel-selected-length-control input,
:root[data-theme="dark"] .steel-3d-context-menu__field input,
:root[data-theme="dark"] .steel-3d-context-menu__field select,
:root[data-theme="dark"] .steel-3d-module-field select,
:root[data-theme="dark"] .steel-3d-scene-field input,
:root[data-theme="dark"] .steel-3d-scene-field select,
:root[data-theme="dark"] .steel-3d-sheet-order-preview,
:root[data-theme="dark"] .steel-garage-wall-grid input,
:root[data-theme="dark"] .steel-garage-wall-grid select {
  border-color: var(--input-border);
  background: var(--input-bg);
  color: var(--input-text);
  box-shadow: none;
}

:root[data-theme="dark"] .steel-title-edit input:focus,
:root[data-theme="dark"] .steel-context-form__field input:focus,
:root[data-theme="dark"] .steel-context-form__field select:focus,
:root[data-theme="dark"] .steel-move-dialog input:focus,
:root[data-theme="dark"] .steel-detail-input:focus,
:root[data-theme="dark"] .steel-selected-length-control input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
  outline: none;
}

:root[data-theme="dark"] .steel-zoom-controls,
:root[data-theme="dark"] .steel-model-stats span,
:root[data-theme="dark"] .steel-context-form__cuts,
:root[data-theme="dark"] .steel-context-preview,
:root[data-theme="dark"] .steel-context-form__origin,
:root[data-theme="dark"] .steel-history-item,
:root[data-theme="dark"] .steel-dimensions-list,
:root[data-theme="dark"] .steel-module-project-create,
:root[data-theme="dark"] .steel-module-save-box,
:root[data-theme="dark"] .steel-module-empty,
:root[data-theme="dark"] .steel-module-card,
:root[data-theme="dark"] .steel-module-preview,
:root[data-theme="dark"] .steel-profile-library,
:root[data-theme="dark"] .steel-profile-row,
:root[data-theme="dark"] .steel-model-list div,
:root[data-theme="dark"] .steel-profile-dimension-note,
:root[data-theme="dark"] .steel-garage-wall-wizard,
:root[data-theme="dark"] .steel-cutting-list-panel,
:root[data-theme="dark"] .steel-production-card-panel,
:root[data-theme="dark"] .steel-production-card-row,
:root[data-theme="dark"] .steel-3d-context-menu,
:root[data-theme="dark"] .steel-3d-context-menu__empty,
:root[data-theme="dark"] .steel-3d-chip-stats div,
:root[data-theme="dark"] .steel-3d-panel-tabs,
:root[data-theme="dark"] .steel-3d-sheet-panel,
:root[data-theme="dark"] .steel-3d-sheet-surface,
:root[data-theme="dark"] .steel-3d-sheet-order,
:root[data-theme="dark"] .steel-3d-sheet-order-row,
:root[data-theme="dark"] .steel-3d-sheet-order-empty,
:root[data-theme="dark"] .steel-3d-sheet-placement-select,
:root[data-theme="dark"] .steel-3d-compact-details,
:root[data-theme="dark"] .steel-3d-instance,
:root[data-theme="dark"] .steel-3d-selected-panel,
:root[data-theme="dark"] .steel-move-dialog {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--ink);
  box-shadow: none;
}

:root[data-theme="dark"] .steel-history-empty {
  border-color: var(--line);
  background: var(--surface);
  color: var(--muted);
}

:root[data-theme="dark"] .steel-canvas-shell,
:root[data-theme="dark"] .steel-3d-canvas-shell {
  border-color: var(--line);
  background: var(--steel-canvas-bg);
}

:root[data-theme="dark"] .steel-preview {
  background: var(--steel-canvas-bg);
}

:root[data-theme="dark"] .steel-canvas-label,
:root[data-theme="dark"] .steel-dimensions-note,
:root[data-theme="dark"] .steel-3d-gizmo-label {
  border-color: var(--line);
  background: color-mix(in srgb, var(--surface-raised) 92%, transparent);
  color: var(--heading);
  box-shadow: var(--shadow-dropdown);
}

:root[data-theme="dark"] .steel-context-menu__item {
  color: var(--heading);
}

:root[data-theme="dark"] .steel-context-menu__item:hover,
:root[data-theme="dark"] .steel-context-menu__item:focus {
  background: var(--surface-hover);
  color: var(--accent-strong);
}

:root[data-theme="dark"] .steel-panel-head--subsection,
:root[data-theme="dark"] .steel-profile-add,
:root[data-theme="dark"] .steel-selected-length-control,
:root[data-theme="dark"] .steel-3d-side-head,
:root[data-theme="dark"] .steel-3d-compact-details[open] summary {
  border-color: var(--line);
}

:root[data-theme="dark"] .steel-bom-table-wrap,
:root[data-theme="dark"] .steel-cutting-list-table {
  border-color: var(--line);
  background: var(--table-bg);
}

:root[data-theme="dark"] .steel-bom-table th,
:root[data-theme="dark"] .steel-cutting-list-table th {
  background: var(--table-head-bg);
  color: var(--muted-strong);
}

:root[data-theme="dark"] .steel-bom-table td,
:root[data-theme="dark"] .steel-cutting-list-table td {
  border-color: var(--line);
  background: var(--table-bg);
  color: var(--ink);
}

:root[data-theme="dark"] .steel-production-warning-banner {
  border-color: var(--warn-border);
  background: var(--warn-bg);
  color: var(--warn);
}

:root[data-theme="dark"] .steel-a4-pages {
  background: transparent;
}

:root[data-theme="dark"] .steel-a4-page {
  border-color: var(--line);
  box-shadow: var(--shadow-soft);
}

:root[data-theme="dark"] .steel-module-preview-svg line,
:root[data-theme="dark"] .steel-module-preview-svg path,
:root[data-theme="dark"] .steel-context-preview__profile {
  stroke: var(--accent-strong);
}

:root[data-theme="dark"] .steel-context-preview__profile {
  fill: var(--steel-profile-fill);
}

:root[data-theme="dark"] .steel-context-preview__axis {
  stroke: var(--muted);
}

:root[data-theme="dark"] .steel-context-choice__tube {
  fill: var(--surface);
  stroke: var(--muted);
}

:root[data-theme="dark"] .steel-grid-line {
  stroke: var(--steel-canvas-grid);
}

:root[data-theme="dark"] .steel-axis-line {
  stroke: var(--steel-canvas-grid-strong);
}

:root[data-theme="dark"] .steel-member-body {
  fill: var(--steel-profile-fill);
  stroke: var(--steel-profile-stroke);
}

:root[data-theme="dark"] .steel-member-body:hover,
:root[data-theme="dark"] .steel-member-body.is-selected {
  fill: #8a642a;
  stroke: var(--warn);
}

:root[data-theme="dark"] .steel-cut-edge {
  stroke: #b7eee4;
}

:root[data-theme="dark"] .steel-cut-edge--blue.is-selected,
:root[data-theme="dark"] .steel-parallel-distance-line,
:root[data-theme="dark"] .steel-parallel-distance-arrow,
:root[data-theme="dark"] .steel-measure-line,
:root[data-theme="dark"] .steel-measure-arrow,
:root[data-theme="dark"] .steel-measure-edge-selected,
:root[data-theme="dark"] .steel-dimension-line,
:root[data-theme="dark"] .steel-dimension-angle-arc,
:root[data-theme="dark"] .steel-dimension-arrow {
  stroke: var(--info);
}

:root[data-theme="dark"] .steel-dimension-extension,
:root[data-theme="dark"] .steel-dimension-angle-side {
  stroke: var(--info-border);
}

:root[data-theme="dark"] .steel-cut-edge--red.is-selected,
:root[data-theme="dark"] .steel-axis-snap-hint.is-preview,
:root[data-theme="dark"] .steel-axis-snap-arrow.is-preview,
:root[data-theme="dark"] .steel-axis-snap-hint.is-active,
:root[data-theme="dark"] .steel-axis-snap-arrow.is-active,
:root[data-theme="dark"] .steel-wall-snap-hint.is-preview,
:root[data-theme="dark"] .steel-wall-snap-connector.is-preview,
:root[data-theme="dark"] .steel-wall-snap-hint.is-active,
:root[data-theme="dark"] .steel-wall-snap-connector.is-active {
  stroke: var(--bad);
}

:root[data-theme="dark"] .steel-node,
:root[data-theme="dark"] .steel-endpoint-handle,
:root[data-theme="dark"] .steel-move-control__circle,
:root[data-theme="dark"] .steel-measure-point,
:root[data-theme="dark"] .steel-measure-handle,
:root[data-theme="dark"] .steel-edge-point {
  fill: var(--surface-raised);
  stroke: var(--accent-strong);
}

:root[data-theme="dark"] .steel-endpoint-handle-stem,
:root[data-theme="dark"] .steel-move-control__icon {
  stroke: var(--warn);
}

:root[data-theme="dark"] .steel-move-control:hover .steel-move-control__circle,
:root[data-theme="dark"] .steel-endpoint-handle:hover,
:root[data-theme="dark"] .steel-endpoint-handle.is-selected,
:root[data-theme="dark"] .steel-measure-handle:hover {
  fill: var(--warn-bg);
  stroke: var(--warn);
}

:root[data-theme="dark"] .steel-member-label,
:root[data-theme="dark"] .steel-dimensions-member-number,
:root[data-theme="dark"] .steel-dimensions-member-length {
  fill: var(--heading);
  stroke: var(--steel-svg-halo);
}

:root[data-theme="dark"] .steel-cut-label,
:root[data-theme="dark"] .steel-angle-label {
  fill: var(--warn);
  stroke: var(--steel-svg-halo);
}

:root[data-theme="dark"] .steel-cut-label--blue,
:root[data-theme="dark"] .steel-parallel-distance-label,
:root[data-theme="dark"] .steel-measure-label,
:root[data-theme="dark"] .steel-dimension-label {
  fill: var(--info);
  stroke: var(--steel-svg-halo);
}

:root[data-theme="dark"] .steel-cut-label--red,
:root[data-theme="dark"] .steel-dimension-label.is-selected {
  fill: var(--bad);
  stroke: var(--steel-svg-halo);
}

:root[data-theme="dark"] .steel-dimensions-profile {
  fill: color-mix(in srgb, var(--accent-soft) 78%, var(--surface));
  stroke: var(--accent-strong);
}

/* Dark theme audit fixes: steel construction editor details */
:root[data-theme="dark"] .steel-zoom-label,
:root[data-theme="dark"] .steel-profile-library summary,
:root[data-theme="dark"] .steel-3d-compact-details summary,
:root[data-theme="dark"] .steel-dimensions-list__value,
:root[data-theme="dark"] .steel-3d-sheet-order-head,
:root[data-theme="dark"] .steel-3d-sheet-layout dd,
:root[data-theme="dark"] .steel-3d-sheet-spec dd,
:root[data-theme="dark"] .steel-3d-sheet-production-list dd {
  color: var(--heading);
}

:root[data-theme="dark"] .steel-context-form__field,
:root[data-theme="dark"] .steel-move-dialog label,
:root[data-theme="dark"] .steel-selected-length-control label,
:root[data-theme="dark"] .steel-3d-sheet-order-head span,
:root[data-theme="dark"] .steel-3d-sheet-layout dt,
:root[data-theme="dark"] .steel-3d-sheet-spec dt,
:root[data-theme="dark"] .steel-3d-sheet-production-list dt {
  color: var(--muted);
}

:root[data-theme="dark"] .steel-dimensions-list__select {
  border-color: var(--line);
  background: var(--surface-raised);
  color: var(--heading);
}

:root[data-theme="dark"] .steel-dimensions-list__row.is-selected .steel-dimensions-list__select {
  border-color: var(--info-border);
  background: var(--info-bg);
  color: var(--info);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--info) 18%, transparent);
}

:root[data-theme="dark"] .steel-dimensions-list__row.is-selected .steel-dimensions-list__number,
:root[data-theme="dark"] .steel-dimensions-list__row.is-selected .steel-dimensions-list__value,
:root[data-theme="dark"] .steel-3d-sheet-placements-head strong,
:root[data-theme="dark"] .steel-3d-sheet-layout dd {
  color: var(--info);
}

:root[data-theme="dark"] .steel-3d-sheet-placements-head strong {
  border-color: var(--info-border);
  background: var(--info-bg);
}

:root[data-theme="dark"] .steel-cut-pair-label--blue {
  color: var(--info);
}

:root[data-theme="dark"] .steel-cut-pair-label--red {
  color: var(--bad);
}

/* Dark theme audit fixes: steel 2D context menu */
:root[data-theme="dark"] .steel-context-menu {
  border-color: var(--line);
  background: var(--dropdown-bg);
  color: var(--ink);
  box-shadow: var(--shadow-dropdown);
}

/* Dark theme audit fixes: steel construction screenshot hot spots */
:root[data-theme="dark"] .steel-context-menu.is-form {
  border-color: var(--line);
  background: var(--modal-bg);
  color: var(--ink);
  box-shadow: var(--shadow-modal);
}

:root[data-theme="dark"] .steel-context-form[data-steel-start-form],
:root[data-theme="dark"] .steel-context-form[data-steel-context-frame-form] {
  color: var(--ink);
}

:root[data-theme="dark"] .steel-context-form[data-steel-start-form] .steel-context-form__title,
:root[data-theme="dark"] .steel-context-form[data-steel-context-frame-form] .steel-context-form__title {
  color: var(--heading);
}

:root[data-theme="dark"] .steel-context-form[data-steel-start-form] .steel-context-form__origin,
:root[data-theme="dark"] .steel-context-form[data-steel-context-frame-form] .steel-context-form__origin {
  border-color: var(--line);
  background: var(--surface-raised);
  color: var(--muted-strong);
}

:root[data-theme="dark"] .steel-context-form__button.steel-start-choice,
:root[data-theme="dark"] .steel-frame-type-grid--context .steel-frame-type {
  border-color: var(--line);
  background: var(--surface-raised);
  color: var(--heading);
}

:root[data-theme="dark"] .steel-context-form__button.steel-start-choice:hover,
:root[data-theme="dark"] .steel-context-form__button.steel-start-choice:focus,
:root[data-theme="dark"] .steel-frame-type-grid--context .steel-frame-type:hover,
:root[data-theme="dark"] .steel-frame-type-grid--context .steel-frame-type.is-active {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

:root[data-theme="dark"] .steel-start-choice__ghost,
:root[data-theme="dark"] .steel-start-choice__axis,
:root[data-theme="dark"] .steel-start-choice__shape {
  stroke: currentColor;
}

:root[data-theme="dark"] .steel-module-project-choice,
:root[data-theme="dark"] .steel-module-project-row:not(.is-active) .steel-module-project-choice {
  border-color: var(--line);
  background: var(--surface-raised);
  color: var(--heading);
}

:root[data-theme="dark"] .steel-module-project-choice:hover,
:root[data-theme="dark"] .steel-module-project-choice:focus {
  border-color: var(--accent-border);
  background: var(--surface-hover);
  color: var(--accent-strong);
}

:root[data-theme="dark"] .steel-module-project-choice strong {
  color: inherit;
}

:root[data-theme="dark"] .steel-module-project-choice span {
  color: var(--muted);
}

:root[data-theme="dark"] .steel-module-project-row.is-active .steel-module-project-choice span {
  color: var(--success);
}

:root[data-theme="dark"] .steel-3d-canvas,
:root[data-theme="dark"] .steel-3d-canvas canvas {
  background: var(--steel-canvas-bg);
}

/* Dark theme audit fixes: home dashboard cards */
:root[data-theme="dark"] .dashboard-hero,
:root[data-theme="dark"] .dashboard-installations,
:root[data-theme="dark"] .dashboard-panel,
:root[data-theme="dark"] .dashboard-deadlines,
:root[data-theme="dark"] .dashboard-task-alerts,
:root[data-theme="dark"] .dashboard-activity-card,
:root[data-theme="dark"] .dashboard-main-empty,
:root[data-theme="dark"] .company-card {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
  box-shadow: none;
}

:root[data-theme="dark"] .dashboard-hero--warn {
  border-color: var(--warn-border);
  background: linear-gradient(135deg, color-mix(in srgb, var(--warn-bg) 78%, var(--surface)) 0%, var(--surface) 88%);
}

:root[data-theme="dark"] .dashboard-hero--urgent {
  border-color: var(--bad-border);
  background: linear-gradient(135deg, color-mix(in srgb, var(--bad-bg) 78%, var(--surface)) 0%, var(--surface) 88%);
}

:root[data-theme="dark"] .dashboard-hero h2,
:root[data-theme="dark"] .dashboard-installations__head h2,
:root[data-theme="dark"] .dashboard-panel__title h2,
:root[data-theme="dark"] .dashboard-side-head h2,
:root[data-theme="dark"] .dashboard-activity-card__head h2,
:root[data-theme="dark"] .company-card__head h2,
:root[data-theme="dark"] .dashboard-panel__count strong,
:root[data-theme="dark"] .dashboard-alert strong,
:root[data-theme="dark"] .dashboard-deadline strong,
:root[data-theme="dark"] .dashboard-task-alert__body strong,
:root[data-theme="dark"] .dashboard-activity-row__body strong,
:root[data-theme="dark"] .dashboard-installations__table td strong,
:root[data-theme="dark"] .installations-table td strong,
:root[data-theme="dark"] .project-installations-table td strong,
:root[data-theme="dark"] .company-card__details dd {
  color: var(--heading);
}

:root[data-theme="dark"] .dashboard-eyebrow,
:root[data-theme="dark"] .dashboard-hero p,
:root[data-theme="dark"] .dashboard-panel__title p,
:root[data-theme="dark"] .dashboard-panel__count span,
:root[data-theme="dark"] .dashboard-alert small,
:root[data-theme="dark"] .dashboard-deadline small,
:root[data-theme="dark"] .dashboard-task-alert__body small,
:root[data-theme="dark"] .dashboard-activity-row__body small,
:root[data-theme="dark"] .dashboard-main-empty,
:root[data-theme="dark"] .dashboard-installations__table td span,
:root[data-theme="dark"] .installations-table td span,
:root[data-theme="dark"] .project-installations-table td span,
:root[data-theme="dark"] .company-card__address,
:root[data-theme="dark"] .company-card__details dt {
  color: var(--muted);
}

:root[data-theme="dark"] .dashboard-hero__metrics div,
:root[data-theme="dark"] .company-card__details div {
  border-color: var(--border-subtle);
  background: var(--surface-soft);
  color: var(--ink);
}

:root[data-theme="dark"] .dashboard-hero__metrics span {
  color: var(--heading);
}

:root[data-theme="dark"] .dashboard-hero__metrics small {
  color: var(--muted);
}

:root[data-theme="dark"] .dashboard-panel__link,
:root[data-theme="dark"] .company-card__edit {
  border-color: var(--line);
  background: var(--surface-raised);
  color: var(--heading);
}

:root[data-theme="dark"] .dashboard-panel__link:hover,
:root[data-theme="dark"] .company-card__edit:hover {
  border-color: var(--accent-border);
  background: var(--surface-hover);
  color: var(--accent-strong);
}

:root[data-theme="dark"] .dashboard-alert,
:root[data-theme="dark"] .dashboard-deadline,
:root[data-theme="dark"] .dashboard-task-alert,
:root[data-theme="dark"] .dashboard-activity-row {
  border-color: var(--border-subtle);
  background: var(--surface-soft);
  color: var(--ink);
}

:root[data-theme="dark"] .dashboard-alert:hover,
:root[data-theme="dark"] .dashboard-deadline:hover,
:root[data-theme="dark"] .dashboard-activity-row:hover {
  border-color: var(--accent-border);
  background: var(--surface-hover);
  color: var(--accent-strong);
}

:root[data-theme="dark"] .dashboard-activity-row--static:hover {
  border-color: var(--border-subtle);
  background: var(--surface-soft);
  color: var(--ink);
}

:root[data-theme="dark"] .dashboard-activity-card__title-icon,
:root[data-theme="dark"] .dashboard-activity-row__icon {
  border: 1px solid var(--accent-border);
  background: color-mix(in srgb, var(--accent-soft) 75%, var(--surface));
  color: var(--accent);
}

:root[data-theme="dark"] .dashboard-activity-row__icon--stock,
:root[data-theme="dark"] .dashboard-activity-row__icon--equipment {
  border-color: var(--success-border);
  background: color-mix(in srgb, var(--success-bg) 76%, var(--surface));
  color: var(--success);
}

:root[data-theme="dark"] .dashboard-activity-row__icon--tasks,
:root[data-theme="dark"] .dashboard-activity-row__icon--work_time {
  border-color: var(--warn-border);
  background: color-mix(in srgb, var(--warn-bg) 78%, var(--surface));
  color: var(--warn);
}


:root[data-theme="dark"] .dashboard-task-alerts__all {
  color: var(--accent);
}

:root[data-theme="dark"] .dashboard-task-alerts__all:hover {
  color: var(--accent-strong);
}

:root[data-theme="dark"] .dashboard-panel--ok .dashboard-panel__icon {
  border: 1px solid var(--success-border);
  background: color-mix(in srgb, var(--success-bg) 78%, var(--surface));
  color: var(--success);
}

:root[data-theme="dark"] .dashboard-panel--warn .dashboard-panel__icon {
  border: 1px solid var(--warn-border);
  background: color-mix(in srgb, var(--warn-bg) 82%, var(--surface));
  color: var(--warn);
}

:root[data-theme="dark"] .dashboard-panel--urgent .dashboard-panel__icon {
  border: 1px solid var(--bad-border);
  background: color-mix(in srgb, var(--bad-bg) 78%, var(--surface));
  color: var(--bad);
}

:root[data-theme="dark"] .dashboard-installations__table,
:root[data-theme="dark"] .installations-table,
:root[data-theme="dark"] .project-installations-table {
  background: var(--table-bg);
}

:root[data-theme="dark"] .dashboard-installations__table th,
:root[data-theme="dark"] .dashboard-installations__table td,
:root[data-theme="dark"] .installations-table th,
:root[data-theme="dark"] .installations-table td,
:root[data-theme="dark"] .project-installations-table th,
:root[data-theme="dark"] .project-installations-table td {
  border-color: var(--line);
}

:root[data-theme="dark"] .dashboard-installations__table th,
:root[data-theme="dark"] .installations-table th,
:root[data-theme="dark"] .project-installations-table th {
  background: var(--table-head-bg);
  color: var(--muted-strong);
}

:root[data-theme="dark"] .dashboard-installations__table td,
:root[data-theme="dark"] .installations-table td,
:root[data-theme="dark"] .project-installations-table td {
  background: var(--table-bg);
  color: var(--ink);
}

:root[data-theme="dark"] .dashboard-installations__table tbody tr:hover td,
:root[data-theme="dark"] .installations-table tbody tr:hover td,
:root[data-theme="dark"] .project-installations-table tbody tr:hover td {
  background: var(--table-hover-bg);
}

:root[data-theme="dark"] .installation-row--risk td {
  background: color-mix(in srgb, var(--warn-bg) 58%, var(--table-bg));
}

:root[data-theme="dark"] .installation-status {
  border-color: var(--line);
  background: var(--surface-muted);
  color: var(--muted-strong);
}

:root[data-theme="dark"] .installation-status--confirmed,
:root[data-theme="dark"] .installation-status--completed {
  border-color: var(--success-border);
  background: color-mix(in srgb, var(--success-bg) 76%, var(--surface));
  color: var(--success);
}

:root[data-theme="dark"] .installation-status--in_progress {
  border-color: var(--info-border);
  background: color-mix(in srgb, var(--info-bg) 76%, var(--surface));
  color: var(--info);
}

:root[data-theme="dark"] .installation-status--problem {
  border-color: var(--bad-border);
  background: color-mix(in srgb, var(--bad-bg) 76%, var(--surface));
  color: var(--bad);
}

:root[data-theme="dark"] .installation-status--postponed,
:root[data-theme="dark"] .installation-risk,
:root[data-theme="dark"] .badge.warn {
  border-color: var(--warn-border);
  background: color-mix(in srgb, var(--warn-bg) 82%, var(--surface));
  color: var(--warn);
}

:root[data-theme="dark"] .badge.ok {
  border-color: var(--success-border);
  background: color-mix(in srgb, var(--success-bg) 78%, var(--surface));
  color: var(--success);
}


/* Dark theme audit fixes: installation detail card */
:root[data-theme="dark"] .installation-detail-project-pill {
  border-color: var(--accent-border);
  background: color-mix(in srgb, var(--accent-soft) 82%, var(--surface));
  color: var(--accent-strong);
}

:root[data-theme="dark"] .installation-detail-project-pill:hover {
  border-color: var(--accent-strong);
  background: var(--surface-hover);
  color: var(--accent-strong);
}

:root[data-theme="dark"] .installation-detail-card {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
  box-shadow: none;
}

:root[data-theme="dark"] .installation-summary-grid .detail-item,
:root[data-theme="dark"] .installation-note-card {
  border-color: var(--border-subtle);
  background: var(--surface-soft);
  color: var(--ink);
}

:root[data-theme="dark"] .installation-summary-grid .detail-item strong,
:root[data-theme="dark"] .installation-note-card p,
:root[data-theme="dark"] .installation-notes-grid p,
:root[data-theme="dark"] .installation-summary-head h2,
:root[data-theme="dark"] .installation-detail-section-head h2,
:root[data-theme="dark"] .installation-checklist-item strong {
  color: var(--heading);
}

:root[data-theme="dark"] .installation-summary-grid .detail-item span,
:root[data-theme="dark"] .installation-note-card span,
:root[data-theme="dark"] .installation-notes-grid span,
:root[data-theme="dark"] .installation-checklist-item span {
  color: var(--muted);
}

:root[data-theme="dark"] .installation-note-card--risk,
:root[data-theme="dark"] .installation-checklist-item--warn {
  border-color: var(--warn-border);
  background: color-mix(in srgb, var(--warn-bg) 68%, var(--surface));
}

:root[data-theme="dark"] .installation-note-card--muted,
:root[data-theme="dark"] .installation-checklist-toggle summary {
  border-color: var(--line);
  background: var(--surface-muted);
  color: var(--muted-strong);
}

:root[data-theme="dark"] .installation-checklist-toggle summary:hover {
  border-color: var(--accent-border);
  background: var(--surface-hover);
  color: var(--accent-strong);
}

:root[data-theme="dark"] .installation-checklist-item {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--ink);
}

:root[data-theme="dark"] .installation-checklist-item--ok {
  border-color: var(--success-border);
  background: color-mix(in srgb, var(--success-bg) 70%, var(--surface));
}

:root[data-theme="dark"] .installation-checklist-item--urgent {
  border-color: var(--bad-border);
  background: color-mix(in srgb, var(--bad-bg) 70%, var(--surface));
}

:root[data-theme="dark"] .installation-control {
  border-color: var(--line);
  background: var(--surface-muted);
  color: var(--muted-strong);
}

:root[data-theme="dark"] .installation-control--ok {
  border-color: var(--success-border);
  background: color-mix(in srgb, var(--success-bg) 74%, var(--surface));
  color: var(--success);
}

:root[data-theme="dark"] .installation-control--warn {
  border-color: var(--warn-border);
  background: color-mix(in srgb, var(--warn-bg) 78%, var(--surface));
  color: var(--warn);
}

:root[data-theme="dark"] .installation-control--urgent {
  border-color: var(--bad-border);
  background: color-mix(in srgb, var(--bad-bg) 78%, var(--surface));
  color: var(--bad);
}

:root[data-theme="dark"] .installation-print-missing,
:root[data-theme="dark"] .installation-note-card .installation-print-missing,
:root[data-theme="dark"] .installation-summary-grid .installation-print-missing {
  border-color: var(--bad-border);
  background: color-mix(in srgb, var(--bad-bg) 78%, var(--surface));
  color: var(--bad);
}

:root[data-theme="dark"] .installation-notes-details {
  border-color: var(--line);
  background: var(--surface-soft);
}

:root[data-theme="dark"] .installation-notes-details summary {
  color: var(--muted-strong);
}

:root[data-theme="dark"] .installation-notes-details summary:hover {
  color: var(--accent-strong);
}


/* Dark theme audit fixes: installation list and calendar */
:root[data-theme="dark"] .installation-calendar-panel,
:root[data-theme="dark"] .installation-calendar {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
  box-shadow: none;
}

:root[data-theme="dark"] .employee-worktime-calendar__head strong,
:root[data-theme="dark"] .employee-worktime-month__weekdays span {
  color: var(--heading);
}

:root[data-theme="dark"] .installation-calendar-legend span {
  color: var(--muted);
}

:root[data-theme="dark"] .installation-calendar .employee-worktime-month-day {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--ink);
}

:root[data-theme="dark"] .installation-calendar .employee-worktime-month-day.is-outside {
  background: color-mix(in srgb, var(--surface-muted) 55%, var(--surface));
  opacity: .72;
}

:root[data-theme="dark"] .installation-calendar .employee-worktime-month-day.is-today {
  border-color: var(--info-border);
  box-shadow: inset 0 0 0 1px var(--info-border);
}

:root[data-theme="dark"] .installation-calendar .employee-worktime-month-day__number,
:root[data-theme="dark"] .installation-calendar .employee-worktime-month-day__total {
  color: var(--muted-strong);
}

:root[data-theme="dark"] .installation-calendar .employee-worktime-month-day__project {
  color: var(--accent-strong);
}

:root[data-theme="dark"] .installation-calendar .employee-worktime-month-day__status {
  color: var(--muted);
}

:root[data-theme="dark"] .installation-calendar .employee-worktime-month-day.is-ok {
  border-color: var(--success-border);
  background: color-mix(in srgb, var(--success-bg) 70%, var(--surface));
}

:root[data-theme="dark"] .installation-calendar .employee-worktime-month-day.is-warning {
  border-color: var(--warn-border);
  background: color-mix(in srgb, var(--warn-bg) 72%, var(--surface));
}

:root[data-theme="dark"] .installation-calendar .employee-worktime-month-day.is-danger {
  border-color: var(--bad-border);
  background: color-mix(in srgb, var(--bad-bg) 74%, var(--surface));
}

:root[data-theme="dark"] .installation-calendar .employee-worktime-month-day.is-ok .employee-worktime-month-day__total,
:root[data-theme="dark"] .installation-calendar .employee-worktime-month-day.is-ok .employee-worktime-month-day__project,
:root[data-theme="dark"] .installation-calendar .employee-worktime-month-day.is-ok .employee-worktime-month-day__status {
  color: var(--success);
}

:root[data-theme="dark"] .installation-calendar .employee-worktime-month-day.is-warning .employee-worktime-month-day__total,
:root[data-theme="dark"] .installation-calendar .employee-worktime-month-day.is-warning .employee-worktime-month-day__project,
:root[data-theme="dark"] .installation-calendar .employee-worktime-month-day.is-warning .employee-worktime-month-day__status {
  color: var(--warn);
}

:root[data-theme="dark"] .installation-calendar .employee-worktime-month-day.is-danger .employee-worktime-month-day__total,
:root[data-theme="dark"] .installation-calendar .employee-worktime-month-day.is-danger .employee-worktime-month-day__project,
:root[data-theme="dark"] .installation-calendar .employee-worktime-month-day.is-danger .employee-worktime-month-day__status {
  color: var(--bad);
}

:root[data-theme="dark"] .installations-table .installation-project-link,
:root[data-theme="dark"] .project-installations-table .installation-project-link,
:root[data-theme="dark"] .dashboard-installations__table .installation-project-link {
  color: var(--heading);
}

:root[data-theme="dark"] .installations-table .installation-project-link:hover,
:root[data-theme="dark"] .project-installations-table .installation-project-link:hover,
:root[data-theme="dark"] .dashboard-installations__table .installation-project-link:hover {
  color: var(--accent-strong);
}

:root[data-theme="dark"] .installation-row--risk td {
  background: color-mix(in srgb, var(--warn-bg) 46%, var(--table-bg));
  color: var(--ink);
}

:root[data-theme="dark"] .installation-row--risk .installation-project-link {
  color: var(--heading);
}

:root[data-theme="dark"] .installation-row--risk .installation-table-subline {
  color: var(--muted-strong);
}

:root[data-theme="dark"] .installation-row--risk:hover td {
  background: color-mix(in srgb, var(--warn-bg) 58%, var(--table-hover-bg));
}

:root[data-theme="dark"] .ksef-quick-filter.has-unseen,
:root[data-theme="dark"] .ksef-quick-filter.has-unseen.is-active,
:root[data-theme="dark"] .ksef-quick-filter.has-unseen:hover {
  border-color: var(--bad-border);
  background: color-mix(in srgb, var(--bad-bg) 82%, var(--surface));
  color: var(--bad);
}

:root[data-theme="dark"] .ksef-counterparty--unseen .ksef-counterparty-name {
  color: var(--bad);
}

:root[data-theme="dark"] .telegram-token-state { color: #94a3b8; }
:root[data-theme="dark"] .telegram-secret-box { border-color: #334155; background: #1f2a3a; }
:root[data-theme="dark"] .telegram-secret-label { color: #c8d2df; }
:root[data-theme="dark"] .telegram-secret-mask { color: #e5edf6; }
:root[data-theme="dark"] .telegram-secret-edit summary { color: #7bd8c8; }
:root[data-theme="dark"] .telegram-rule-head { border-top-color: #334155; }

:root[data-theme="dark"] .ksef-copy-cell:hover,
:root[data-theme="dark"] .ksef-copy-cell:focus-visible {
  background: color-mix(in srgb, var(--bad-bg) 40%, var(--table-bg));
  color: var(--bad);
  box-shadow: inset 0 0 0 1px var(--bad-border);
}

:root[data-theme="dark"] .ksef-copy-cell[data-ksef-copy-value=""]:hover,
:root[data-theme="dark"] .ksef-copy-cell[data-ksef-copy-value=""]:focus-visible {
  background: var(--table-bg);
  color: var(--ink);
  box-shadow: none;
}

:root[data-theme="dark"] .ksef-copy-cell.is-copied {
  color: var(--bad);
}
