.crm-theme-control {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 5px;
  padding: 7px 8px 10px;
  border-bottom: 1px solid #e6eaf0;
}
.crm-theme-control > span {
  color: #6c7582;
  font-size: 11px;
  font-weight: 750;
}
.crm-theme-control > div {
  display: grid;
  grid-template-columns: repeat(3, 30px);
  gap: 3px;
  padding: 2px;
  border: 1px solid #dce2e8;
  border-radius: 6px;
  background: #f4f6f8;
}
.crm-user-menu .crm-theme-control button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
}
.crm-user-menu .crm-theme-control button.active {
  background: #fff;
  box-shadow: 0 1px 4px rgb(24 33 43 / 14%);
}
.crm-theme-control img { width: 15px; height: 15px; }

html[data-theme="dark"] {
  --crm-filter-surface: #171e26;
  --crm-table-header-surface: #222b35;
  --brand-accent: #20c1b1;
  --brand-accent-hover: #39cebf;
  --brand-accent-strong: #70ddd3;
  --brand-accent-soft: #173934;
  --brand-accent-soft-strong: #1c4942;
  --dark-page: #0f141a;
  --dark-surface: #171d24;
  --dark-elevated: #1d252e;
  --dark-soft: #222b35;
  --dark-border: #34404d;
  --dark-text: #e6edf3;
  --dark-muted: #9aa7b5;
  --dark-link: #70ddd3;
  --crm-detail-label-color: var(--dark-muted);
  --crm-detail-value-color: var(--dark-text);
  --deadline-overdue-border: rgb(137 61 76 / 66%);
  --deadline-overdue-bg: rgb(137 61 76 / 18%);
  --deadline-overdue-text: rgb(230 171 181 / 86%);
  --deadline-today-border: rgb(139 108 39 / 70%);
  --deadline-today-bg: rgb(139 108 39 / 18%);
  --deadline-today-text: rgb(225 200 137 / 88%);
  --deadline-future-border: rgb(145 155 170 / 42%);
  --deadline-future-bg: rgb(145 155 170 / 8%);
  --deadline-future-text: var(--dark-muted);
  background: var(--dark-page);
  color: var(--dark-text);
}
html[data-theme="dark"] body,
html[data-theme="dark"] body.crm-mode,
html[data-theme="dark"] .auth-page {
  background: var(--dark-page);
  color: var(--dark-text);
}
html[data-theme="dark"] :is(h1, h2, h3, h4, strong, b, legend) { color: var(--dark-text); }
html[data-theme="dark"] :is(a, .link-button) { color: var(--dark-link); }
html[data-theme="dark"] :is(p, small, dt, .muted) { border-color: var(--dark-border); }
html[data-theme="dark"] hr { border-color: var(--dark-border); }

html[data-theme="dark"] :is(input, select, textarea) {
  border-color: var(--dark-border);
  background: #111820;
  color: var(--dark-text);
}
html[data-theme="dark"] :is(input, textarea)::placeholder { color: #778594; }
html[data-theme="dark"] :is(input, select, textarea):focus {
  border-color: #4abfb4;
  box-shadow: 0 0 0 2px rgb(32 193 177 / 16%);
}
html[data-theme="dark"] input:-webkit-autofill,
html[data-theme="dark"] input:-webkit-autofill:hover,
html[data-theme="dark"] input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--dark-text);
  box-shadow: 0 0 0 1000px #111820 inset;
}

html[data-theme="dark"] :is(.crm-global-header, .topbar) {
  border-color: var(--dark-border);
  background: #121820;
}
html[data-theme="dark"] :is(.crm-global-row, .crm-section-row) { border-color: var(--dark-border); }
html[data-theme="dark"] :is(.crm-section-row, .crm-subnav) { background: #121820; }
html[data-theme="dark"] .crm-workspace { background: var(--dark-page); }
html[data-theme="dark"] .crm-brand { color: var(--dark-text); }
html[data-theme="dark"] .crm-brand strong span { color: #dcecff; }
html[data-theme="dark"] .crm-brand-logo-light,
html[data-theme="dark"] .auth-brand-light { display: none; }
html[data-theme="dark"] .crm-brand-symbol .crm-brand-logo-dark {
  display: block;
  width: 64px;
  height: 64px;
  top: -12px;
  left: -12px;
}
html[data-theme="dark"] .auth-brand-dark { display: block; }
html[data-theme="dark"] .crm-global-nav a { color: #a6b2c0; }
html[data-theme="dark"] .crm-global-nav a.active {
  color: #fff;
  text-decoration-color: var(--brand-accent);
}
html[data-theme="dark"] .crm-subnav a { color: #9aa7b5; }
html[data-theme="dark"] .crm-subnav a.active { border-color: transparent; color: #fff; }
html[data-theme="dark"] .crm-user-avatar { border-color: #121820; background: #2b3946; }
html[data-theme="dark"] .crm-user-copy small,
html[data-theme="dark"] .crm-user-chevron { color: var(--dark-muted); }
html[data-theme="dark"] :is(.crm-user-menu, .crm-action-menu > div) {
  border-color: var(--dark-border);
  background: var(--dark-elevated);
  box-shadow: 0 14px 34px rgb(0 0 0 / 36%);
}
html[data-theme="dark"] :is(.crm-user-menu a, .crm-user-menu button, .crm-action-menu > div a) { color: var(--dark-text); }
html[data-theme="dark"] :is(.crm-user-menu a, .crm-user-menu button, .crm-action-menu > div a):hover { background: #29343f; }
html[data-theme="dark"] .crm-theme-control { border-color: var(--dark-border); }
html[data-theme="dark"] .crm-theme-control > span { color: var(--dark-muted); }
html[data-theme="dark"] .crm-theme-control > div { border-color: var(--dark-border); background: #121920; }
html[data-theme="dark"] .crm-user-menu .crm-theme-control button.active { background: #34414d; box-shadow: 0 1px 5px rgb(0 0 0 / 45%); }
html[data-theme="dark"] .crm-theme-control img { filter: brightness(0) invert(1); }

html[data-theme="dark"] body :is(
  .crm-search-field,
  .crm-select-field,
  .crm-mine-filter,
  .crm-more-filters,
  .crm-employee-profile-metrics article,
  .crm-employee-profile-form,
  .crm-employee-profile-grid > article,
  .queue-view-tabs,
  .queue-list,
  .queue-list-heading,
  .assigned-base-filter-section,
  .operations-summary,
  .source-health-row,
  .operation-action,
  .analytics-detail-footer,
  .analytics-sales-date-range,
  .analytics-sales-presets
) {
  border-color: var(--dark-border);
  background: var(--dark-surface);
  color: var(--dark-text);
}
html[data-theme="dark"] body.crm-mode .crm-employee-metrics article {
  border-color: var(--dark-border);
  background: var(--dark-surface);
  color: var(--dark-text);
}
html[data-theme="dark"] body :is(.crm-search-field, .crm-select-field, .crm-mine-filter, .crm-more-filters) {
  border-color: var(--dark-border);
  background: var(--dark-surface);
}
html[data-theme="dark"] body :is(.crm-mine-filter, .crm-more-filters, .crm-select-field > span) { color: var(--dark-muted); }
html[data-theme="dark"] body .queue-view-tabs a + a,
html[data-theme="dark"] body .operations-summary article {
  border-color: var(--dark-border);
}
html[data-theme="dark"] body .queue-view-tabs a { color: var(--dark-muted); }
html[data-theme="dark"] body .queue-view-tabs a strong { color: var(--dark-text); }
html[data-theme="dark"] body .queue-view-tabs a.active { background: var(--brand-accent-soft); color: var(--brand-accent-strong); }
html[data-theme="dark"] body .manual-company-modes { border-color: var(--dark-border); background: var(--dark-surface); }
html[data-theme="dark"] body .manual-company-mode { color: var(--dark-muted); }
html[data-theme="dark"] body .manual-company-mode.active { background: var(--brand-accent-soft); color: var(--brand-accent-strong); }
html[data-theme="dark"] body .queue-list-heading { background: var(--dark-elevated); }
html[data-theme="dark"] body :is(.queue-company-row, .assigned-base-company-row, .source-health-row) { border-color: var(--dark-border); }

html[data-theme="dark"] body :is(.crm-table td, .crm-table th, .statistics-work-table th, .statistics-work-table td) {
  border-color: var(--dark-border);
}
html[data-theme="dark"] body.crm-mode .crm-table td { border-bottom-color: var(--dark-border); }
html[data-theme="dark"] body .bpm-reference-table .bpm-table-row + .bpm-table-row > td { border-top: 1px solid var(--dark-border); }
html[data-theme="dark"] body .bpm-reference-table .crm-entity-link { color: var(--dark-text); }
html[data-theme="dark"] body .bpm-reference-table .crm-entity-link:hover,
html[data-theme="dark"] body .bpm-reference-table .crm-entity-link:focus-visible { color: var(--brand-accent-strong); }
html[data-theme="dark"] body .statistics-work-table tbody tr[data-employee]:nth-of-type(4n+3) { background: #141b22; }
html[data-theme="dark"] body :is(.crm-table tbody tr, .statistics-work-table tbody tr[data-employee]):hover { background: #29343f; }

html[data-theme="dark"] .task-step-copy .task-status-label { color: #b8c3cf; }
html[data-theme="dark"] .task-step-copy .task-action-label { color: #9aa7b5; }

html[data-theme="dark"] :is(
  .task-step-date.overdue,
  .task-step-meta time.overdue,
  .crm-overdue-date,
  .activity-step-tab.activity-date-overdue time,
  .activities-page[data-view-mode="compact"] .activity-company-compact-step.activity-date-overdue time,
  .bpm-overdue-label
) { color: var(--brand-accent-strong) !important; }
html[data-theme="dark"] .activity-summary-row.activity-date-overdue time {
  border-left-color: var(--brand-accent);
  background: var(--brand-accent-soft);
  color: var(--brand-accent-strong);
}
html[data-theme="dark"] .activities-page[data-view-mode="compact"] .activity-company-compact-step.activity-date-overdue {
  border-left-color: var(--brand-accent);
}

html[data-theme="dark"] .crm-action-icon,
html[data-theme="dark"] :is(.crm-action-icon.email, .crm-action-icon.messenger, .crm-action-icon.in_person, .crm-action-icon.video_meeting, .crm-action-icon.meeting, .crm-next-step-missing) {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}
html[data-theme="dark"] .crm-action-icon img { filter: brightness(0) invert(1); opacity: .72; }
html[data-theme="dark"] .crm-next-step-missing img {
  filter: invert(65%) sepia(18%) saturate(660%) hue-rotate(304deg) brightness(101%) contrast(98%);
}

html[data-theme="dark"] :is(
  .panel,
  .company-header,
  .dashboard-hero,
  .metric-grid article,
  .test-subnav,
  .employee-filter,
  .inn-search,
  .auth-panel,
  .access-card,
  .activity-card,
  .planner-card,
  .planner-cell,
  .planner-no-step,
  .kanban-column,
  .kanban-card,
  .kanban-hover-card,
  .statistics-summary,
  .statistics-filter-menu,
  .statistics-help,
  .work-funnel-panel,
  .work-funnel-detail-dialog,
  .crm-filter-panel,
  .crm-table-wrap,
  .crm-reference-table-wrap,
  .crm-compact-section,
  .crm-reference-context,
  .crm-reference-client-card,
  .crm-reference-events,
  .crm-commercial-records,
  .crm-reference-communication,
  .crm-company-create-section,
  .crm-reference-add-contact > form,
  .crm-side-panel,
  .crm-deal-head,
  .crm-deal-context,
  .crm-deal-activity-column,
  .deal-task-card,
  .deal-task-dialog,
  .activity-history-event,
  .company-subsection,
  .company-edit-panel,
  .company-inline-form,
  .girbo-control,
  .source-monitor,
  .project-clone-control > form,
  .project-settings-tabs,
  .project-dictionary-row,
  .analytics-kpis,
  .analytics-panel,
  .bpm-dialog,
  .bpm-work-block,
  .communication-report,
  .communication-report-preview
) {
  border-color: var(--dark-border);
  background: var(--dark-surface);
  color: var(--dark-text);
  box-shadow: none;
}

html[data-theme="dark"] :is(
  .secondary,
  .button,
  .kebab-button,
  .crm-icon-button,
  .panel-inline-action,
  .contact-inline-icon,
  .task-icon,
  .task-history-edit-toggle,
  .task-history-inline-button,
  .task-history-delete,
  .statistics-info,
  .statistics-help-close,
  .statistics-breakdown-toggle,
  .statistics-records-progress button,
  .work-funnel-detail-dialog footer button,
  .work-funnel-detail-dialog footer a,
  .girbo-icon,
  .crm-bulk-toolbar button
) {
  border-color: var(--dark-border);
  background: var(--dark-elevated);
  color: var(--dark-text);
}
html[data-theme="dark"] :is(
  .secondary,
  .button,
  .kebab-button,
  .crm-icon-button,
  .panel-inline-action,
  .contact-inline-icon,
  .task-icon,
  .task-history-edit-toggle,
  .task-history-inline-button,
  .statistics-info,
  .statistics-help-close,
  .statistics-breakdown-toggle
):hover { background: #29343f; }
html[data-theme="dark"] :is(.crm-icon-button, .panel-inline-action, .contact-inline-icon, .task-icon, .statistics-info, .statistics-help-close, .statistics-breakdown-toggle) img {
  filter: brightness(0) invert(1);
  opacity: .82;
}
html[data-theme="dark"] .contact-delete-icon {
  border-color: var(--dark-border);
  background: transparent;
}
html[data-theme="dark"] .contact-delete-icon:hover { background: var(--dark-hover); }
html[data-theme="dark"] .contact-delete-icon.confirm {
  border-color: #76505a;
  background: #35262d;
}
html[data-theme="dark"] .contact-delete-icon img { filter: brightness(0) invert(1); }
html[data-theme="dark"] .contact-delete-confirm small { color: var(--dark-muted); }
html[data-theme="dark"] .extra-contact-grid > span,
html[data-theme="dark"] .extra-contact-row > * { border-bottom-color: var(--dark-border); }

html[data-theme="dark"] :is(
  .filter-panel,
  .statistics-filterbar,
  .analytics-filterbar,
  .activities-filterbar,
  .work-funnel-filterbar,
  .crm-filterbar,
  .crm-bulk-toolbar,
  .planner-toolbar,
  .kanban-toolbar,
  .company-edit-grid,
  .deal-task-card > summary,
  .crm-deal-reference .crm-pipeline-step,
  .crm-reference-tabs,
  .crm-section-head,
  .crm-table thead,
  .crm-mode .crm-table th,
  .table-header,
  .statistics-work-table thead th
) {
  border-color: var(--dark-border);
  background: var(--dark-soft);
  color: var(--dark-text);
}
html[data-theme="dark"] :is(.statistics-work-table tbody tr:nth-child(even), .table-row:nth-child(even)) { background: #141b22; }
html[data-theme="dark"] .statistics-work-table tfoot { background: #17312d; }
html[data-theme="dark"] .statistics-page .statistics-work-table .statistics-breakdown > td { background: #1b242d; }
html[data-theme="dark"] :is(table, th, td, .table-row, .crm-table-row, .crm-data-list > div, .crm-reference-person-section, .crm-reference-collapsible) {
  border-color: var(--dark-border);
}
html[data-theme="dark"] :is(th, dt, .table-header, .statistics-work-table thead th, .statistics-breakdown-items dt) { color: var(--dark-muted); }
html[data-theme="dark"] :is(td, dd, .statistics-work-table tbody th, .statistics-work-table a) { color: var(--dark-text); }

html[data-theme="dark"] :is(.statistics-multi-filter summary, .statistics-period input, .work-funnel-segmented span) {
  border-color: var(--dark-border);
  background: #111820;
  color: #c4ced8;
}
html[data-theme="dark"] .work-funnel-segmented input:checked + span {
  border-color: #3ebbad;
  background: #173934;
  color: #8ae6dc;
  box-shadow: inset 0 0 0 1px #3ebbad;
}
html[data-theme="dark"] .statistics-filter-menu label:hover { background: #29343f; }

html[data-theme="dark"] :is(
  .activities-filterbar summary,
  .activities-filter-reset,
  .activities-company-search-control button,
  .activities-multiselect > div,
  .kanban-filter summary,
  .kanban-period-nav,
  .analytics-employee-filter summary,
  .analytics-employee-filter > div,
  .analytics-tabs,
  .activities-view-switcher,
  .activities-sort-control,
  .activities-view-control
) {
  border-color: var(--dark-border);
  background: var(--dark-elevated);
  color: var(--dark-text);
}
html[data-theme="dark"] .activities-extra-filter > summary { background: transparent; }
html[data-theme="dark"] .activities-extra-filter > summary i {
  border-color: var(--dark-muted);
  background: var(--dark-soft);
  box-shadow: 0 0 0 8px var(--dark-soft);
}
html[data-theme="dark"] :is(.activities-filter-reset, .kanban-period-nav) img { filter: brightness(0) invert(1); }
html[data-theme="dark"] .kanban-filter .is-active summary { border-color: #4abfb4; background: var(--brand-accent-soft); }

html[data-theme="dark"] .work-funnel-stage { border-color: #40505e; color: #e8eef5; }
html[data-theme="dark"] .work-funnel-stage.stage-processed { background: #29333d; }
html[data-theme="dark"] .work-funnel-stage.stage-calls { background: #20384a; }
html[data-theme="dark"] .work-funnel-stage.stage-interest { background: #1e3c51; }
html[data-theme="dark"] .work-funnel-stage.stage-agreement { background: #4a3b20; }
html[data-theme="dark"] .work-funnel-stage.stage-pilot { background: #392e49; }
html[data-theme="dark"] .work-funnel-stage.stage-partner,
html[data-theme="dark"] .work-funnel-stage.stage-won { background: #1f4435; }
html[data-theme="dark"] .work-funnel-stage.stage-closed { background: #2a333c; }
html[data-theme="dark"] .work-funnel-stage.stage-lost { background: #4a292f; }
html[data-theme="dark"] .work-funnel-activity-overview button { border-color: var(--dark-border); background: #1c2630; color: var(--dark-text); }
html[data-theme="dark"] .work-funnel-activity-overview button:hover { background: #25323e; }
html[data-theme="dark"] .work-funnel-action-grid button:nth-child(1) { background: #20384a; }
html[data-theme="dark"] .work-funnel-action-grid button:nth-child(2) { background: #293c27; }
html[data-theme="dark"] .work-funnel-action-grid button:nth-child(3) { background: #4a3b20; }
html[data-theme="dark"] .work-funnel-action-grid button:nth-child(4) { background: #392e49; }

html[data-theme="dark"] :is(.crm-reference-client-card header, .crm-reference-company-summary, .crm-reference-person-grid, .crm-reference-additional-data dl) { border-color: var(--dark-border); }
html[data-theme="dark"] :is(.crm-reference-company-summary dt, .crm-reference-person-grid dt) { color: var(--dark-muted); }
html[data-theme="dark"] :is(.crm-reference-company-summary dd, .crm-reference-person-grid dd) { color: var(--dark-text); }
html[data-theme="dark"] .contact-primary-badge { background: #293946; color: #c5d5e4; }
html[data-theme="dark"] .crm-reference-company-tags > span:not(.muted) { background: #28333e; color: #c1ccd7; }
html[data-theme="dark"] :is(.crm-product-picker label span, .crm-product-picker.readonly > span, .crm-sales-channel) {
  border-color: var(--dark-border);
  background: var(--dark-elevated);
  color: #bec9d4;
}
html[data-theme="dark"] .crm-product-picker input:checked + span { border-color: #3ebbad; background: #173934; color: #8ae6dc; }

html[data-theme="dark"] :is(.company-inline-form, .deal-task-dialog, .task-history-edit-form) :is(input, select, textarea),
html[data-theme="dark"] :is(.task-title-input, .task-history-inline-select) {
  border-color: var(--dark-border);
  background: #111820;
  color: var(--dark-text);
}
html[data-theme="dark"] :is(.company-narrative-text, .communication-report, .communication-report-preview) { color: #c8d3dd; }
html[data-theme="dark"] :is(.task-tooltip, .crm-company-bigdata-results) {
  border-color: var(--dark-border);
  background: #222c36;
  color: var(--dark-text);
  box-shadow: 0 8px 24px rgb(0 0 0 / 30%);
}

html[data-theme="dark"] :is(.access-card.access-date-overdue, .activity-card.activity-date-overdue, .table-row.activity-date-overdue) { border-color: #66404a; background: #382329; }
html[data-theme="dark"] :is(.access-card.access-date-today, .access-draft-card, .activity-card.activity-date-today, .table-row.activity-date-today) { border-color: #635535; background: #352f21; }
html[data-theme="dark"] :is(.access-card.access-date-future, .activity-card.activity-date-future, .table-row.activity-date-future) { border-color: var(--dark-border); background: var(--dark-surface); }
html[data-theme="dark"] :is(.message, .crm-warning, .crm-company-bigdata-existing) { border-color: #66552f; background: #342d1e; color: #f2d68f; }
html[data-theme="dark"] :is(.message.error, .field-error, .crm-error) { border-color: #6c3e49; background: #3b2228; color: #ffadb8; }
html[data-theme="dark"] :is(.message.success, .crm-success) { border-color: #35664f; background: #1c392d; color: #98e5ba; }

html[data-theme="dark"] .auth-panel { box-shadow: 0 22px 70px rgb(0 0 0 / 28%); }
html[data-theme="dark"] .auth-panel .primary { color: #071715; }
html[data-theme="dark"] :is(.project-admin-list > a, .project-dictionary-row) { border-color: var(--dark-border); background: var(--dark-surface); color: var(--dark-text); }
html[data-theme="dark"] .project-admin-list > a:hover { background: #222c36; }
html[data-theme="dark"] .project-dictionary-row.is-disabled { background: #1b222a; }

html[data-theme="dark"] :is(.planner-row-heading, .planner-column-heading, .kanban-column > header) {
  border-color: var(--dark-border);
  background: var(--dark-elevated);
  color: var(--dark-text);
}
html[data-theme="dark"] :is(.planner-cell.overdue, .planner-column-heading.overdue) { border-color: var(--deadline-overdue-border); background: var(--deadline-overdue-bg); color: var(--deadline-overdue-text); }
html[data-theme="dark"] :is(.planner-cell.today, .planner-column-heading.today) { border-color: var(--deadline-today-border); background: var(--deadline-today-bg); color: var(--deadline-today-text); }
html[data-theme="dark"] :is(.planner-cell.future, .planner-column-heading.future) { border-color: var(--deadline-future-border); background: var(--deadline-future-bg); color: var(--deadline-future-text); }
html[data-theme="dark"] .planner-cell.overdue .planner-card { border-left-color: var(--deadline-overdue-border); }
html[data-theme="dark"] .planner-cell.today .planner-card { border-left-color: var(--deadline-today-border); }
html[data-theme="dark"] .planner-cell.future .planner-card { border-left-color: var(--deadline-future-border); }
html[data-theme="dark"] :is(.planner-card p, .planner-card header span, .planner-card footer, .kanban-hover-card p, .kanban-hover-card time) { color: var(--dark-muted); }
html[data-theme="dark"] :is(.calendar-scale,.calendar-time-head,.calendar-time-axis,.calendar-navigator,.calendar-year-grid>section,.calendar-weekend-strip,.calendar-outside-row) { border-color: var(--dark-border); background: var(--dark-elevated); }
html[data-theme="dark"] :is(.calendar-scale a,.calendar-navigation strong,.calendar-time-head > *,.calendar-time-axis span) { color: var(--dark-muted); }
html[data-theme="dark"] :is(.calendar-scale a.active,.calendar-navigation a,.calendar-navigation button) { border-color: var(--dark-border); background: var(--dark-surface); color: var(--dark-text); box-shadow: none; }
html[data-theme="dark"] :is(.calendar-time-scroll,.calendar-month-day,.event-card-dialog) { border-color: var(--dark-border); background: var(--dark-surface); color: var(--dark-text); }
html[data-theme="dark"] :is(.calendar-month-weekdays,.calendar-month-grid,.calendar-month-day,.calendar-time-head > *,.calendar-time-axis,.calendar-day-track) { border-color: var(--dark-border); }
html[data-theme="dark"] .calendar-month-day.is-other-month { background: var(--dark-page); }
html[data-theme="dark"] .calendar-day-track { background: repeating-linear-gradient(to bottom,var(--dark-surface) 0,var(--dark-surface) 59px,var(--dark-border) 59px,var(--dark-border) 60px); }
html[data-theme="dark"] .calendar-day-track.is-today { background: repeating-linear-gradient(to bottom,#142825 0,#142825 59px,#29423e 59px,#29423e 60px); }
html[data-theme="dark"] .calendar-event { border-color: var(--dark-border); background: var(--dark-elevated); color: var(--dark-text); }
html[data-theme="dark"] .calendar-event.overdue { border-left-color: var(--deadline-overdue-border); background: var(--deadline-overdue-bg); }
html[data-theme="dark"] .calendar-event.today { border-left-color: var(--deadline-today-border); background: var(--deadline-today-bg); }
html[data-theme="dark"] .calendar-event.future { border-left-color: var(--deadline-future-border); background: var(--deadline-future-bg); }
html[data-theme="dark"] :is(.calendar-mini-grid a,.calendar-navigator>header strong,.calendar-navigator>header a,.calendar-navigator-choice-grid a,.calendar-year-grid>section>header a,.calendar-weekend-strip,.calendar-outside-row>span,.calendar-outside-row>details) { color:var(--dark-muted); }
html[data-theme="dark"] :is(.calendar-mini-grid a.active,.calendar-navigator-choice-grid a.active,.calendar-navigator-choice-grid a:hover,.calendar-event-overflow summary) { border-color:var(--dark-border); background:var(--dark-surface-2); color:var(--dark-text); }
html[data-theme="dark"] :is(.calendar-outside-row details>div,.calendar-event-overflow>div) { border-color:var(--dark-border); background:var(--dark-surface); box-shadow:0 8px 24px rgb(0 0 0 / 24%); }
html[data-theme="dark"] :is(.deadline-chip,.focus-summary,.focus-day-block,.focus-team-card) { border-color:var(--dark-border); background:var(--dark-surface); color:var(--dark-muted); }
html[data-theme="dark"] .deadline-chip.overdue { border-color:var(--deadline-overdue-border); background:var(--deadline-overdue-bg); color:var(--deadline-overdue-text); }
html[data-theme="dark"] .deadline-chip.today { border-color:var(--deadline-today-border); background:var(--deadline-today-bg); color:var(--deadline-today-text); }
html[data-theme="dark"] .deadline-chip.future { border-color:var(--deadline-future-border); background:var(--deadline-future-bg); color:var(--deadline-future-text); }
html[data-theme="dark"] .focus-scope-switch { border:0; background:transparent; }
html[data-theme="dark"] .focus-scope-switch button { border-color:#c9d1db; background:#e7ebf0; color:#344054; }
html[data-theme="dark"] .focus-scope-switch button:hover,
html[data-theme="dark"] .focus-scope-switch button:focus-visible { border-color:#b6c0cc; background:#d8dee7; color:#202936; }
html[data-theme="dark"] .focus-scope-switch button.active { border-color:#344054; background:#344054; color:#fff; box-shadow:none; }
html[data-theme="dark"] .focus-scope-switch button.active:hover,
html[data-theme="dark"] .focus-scope-switch button.active:focus-visible { border-color:#202936; background:#202936; color:#fff; }
html[data-theme="dark"] :is(.focus-summary strong,.focus-card-metrics strong,.focus-stage-line strong,.focus-team-card h2,.focus-task-row>a) { color:var(--dark-text); }
html[data-theme="dark"] :is(.focus-summary>:is(a,span),.focus-day-block>header,.focus-task-row,.focus-card-metrics) { border-color:var(--dark-border); }
html[data-theme="dark"] :is(.focus-task-row>a span,.focus-task-row>a small,.focus-team-card header small,.focus-stage-line,.focus-card-metrics>:is(a,span)) { color:var(--dark-muted); }
html[data-theme="dark"] .focus-day-block.overdue .focus-marker { background:rgb(137 61 76 / 82%); }
html[data-theme="dark"] .focus-day-block.today .focus-marker { background:rgb(139 108 39 / 82%); }
html[data-theme="dark"] .focus-task-row .focus-marker { background:var(--deadline-future-border); }
html[data-theme="dark"] :is(.focus-progress,.focus-day-queue,.focus-task-row,.focus-done,.focus-team-table,.focus-team-row,.focus-team-attention a,.page-segment-switch) { border-color:var(--dark-border); }
html[data-theme="dark"] .focus-day-queue .focus-task-row.is-next { background:transparent; }
html[data-theme="dark"] :is(.focus-task-copy,.focus-task-copy strong,.focus-team-row,.focus-team-attention a) { color:var(--dark-text); }
html[data-theme="dark"] .focus-team-row a.issue b { color:#e09aa4; }
html[data-theme="dark"] .focus-employee-chip { border-color:var(--dark-border); background:var(--dark-surface); color:var(--dark-text); }
html[data-theme="dark"] :is(.focus-task-copy span,.focus-task-copy small,.focus-day-queue time,.focus-progress span,.focus-team-attention a span) { color:var(--dark-muted); }
html[data-theme="dark"] .focus-upcoming-row { border-color:var(--dark-border); color:var(--dark-muted); }
html[data-theme="dark"] .focus-upcoming-row strong { color:var(--dark-text); }
html[data-theme="dark"] .focus-progress progress::-webkit-progress-bar { background:var(--dark-border); }
html[data-theme="dark"] .kanban-card.overdue { border-left-color:var(--deadline-overdue-border); background:var(--deadline-overdue-bg); }
html[data-theme="dark"] .kanban-card.today { border-left-color:var(--deadline-today-border); background:var(--deadline-today-bg); }
html[data-theme="dark"] .kanban-card.future { border-left-color:var(--deadline-future-border); background:var(--deadline-future-bg); }
html[data-theme="dark"] :is(.calendar-event span,.event-card-dialog dt,.event-card-dialog header p,.event-card-dialog header small,.event-card-dialog form label) { color: var(--dark-muted); }
html[data-theme="dark"] .event-card-dialog form { border-color: var(--dark-border); }
html[data-theme="dark"] :is(.event-card-dialog footer button,.event-card-dialog form button,.event-card-dialog form input) { border-color: var(--dark-border); background: var(--dark-page); color: var(--dark-text); }
html[data-theme="dark"] .calendar-subscription { border-color: var(--dark-border); }
html[data-theme="dark"] :is(.calendar-subscription input,.calendar-subscription-actions button) { border-color: var(--dark-border); background: var(--dark-page); color: var(--dark-text); }
html[data-theme="dark"] .calendar-subscription-actions button:first-child { border-color: #269f94; background: #1d7d74; color: #fff; }
html[data-theme="dark"] :is(.calendar-provider-grid article,.calendar-connection-list article) { border-color:var(--dark-border); background:var(--dark-surface); }
html[data-theme="dark"] .calendar-caldav-form { border-color:var(--dark-border); background:var(--dark-elevated); }
html[data-theme="dark"] :is(.calendar-provider-grid :is(a,button),.calendar-connection-list button,.calendar-caldav-form button,.calendar-caldav-form input) { border-color:var(--dark-border); background:var(--dark-page); color:var(--dark-text); }
html[data-theme="dark"] :is(.calendar-provider-grid p,.calendar-provider-grid>article>span,.calendar-connection-list small,.calendar-caldav-form label,.calendar-caldav-form>[role="status"]) { color:var(--dark-muted); }
html[data-theme="dark"] :is(.kanban-column > header h2, .kanban-hover-card h3, .kanban-hover-card dd) { color: var(--dark-text); }
html[data-theme="dark"] .kanban-column > header span { background: #303b47; color: #c4ced8; }
html[data-theme="dark"] :is(.kanban-card:hover, .kanban-card:focus-visible) { border-color: #617285; background: #232d37; }
html[data-theme="dark"] .kanban-column > header { border-bottom-color: var(--dark-border); box-shadow: 0 2px 6px rgb(0 0 0 / 24%); }
html[data-theme="dark"] .kanban-hover-card dl > div { border-color: var(--dark-border); }

html[data-theme="dark"] :is(.analytics-kpis article, .analytics-panel > header, .analytics-table-scroll th, .analytics-table-scroll td) { border-color: var(--dark-border); }
html[data-theme="dark"] :is(.analytics-kpis span, .analytics-kpis small, .analytics-panel > header small, .analytics-trend-panel footer) { color: var(--dark-muted); }
html[data-theme="dark"] :is(.analytics-kpis strong, .analytics-panel > header > strong) { color: var(--dark-text); }
html[data-theme="dark"] :is(.analytics-export-button, .analytics-presets a) { border-color: var(--dark-border); background: var(--dark-elevated); color: var(--dark-text); }

html[data-theme="dark"] :is(.crm-mode .crm-activity-form, .crm-mode .crm-timeline-item, .crm-mode .crm-next-step, .crm-reference-communication > section) {
  border-color: var(--dark-border);
  background: #1b242d;
  color: var(--dark-text);
}
html[data-theme="dark"] :is(.crm-mode .crm-tabs, .crm-mode .crm-timeline-item, .crm-deal-products-panel, .crm-reference-contact-list) { border-color: var(--dark-border); }
html[data-theme="dark"] .crm-deal-reference { color: var(--dark-text); }
html[data-theme="dark"] .crm-mode .crm-tabs { background: var(--dark-surface); }
html[data-theme="dark"] .crm-reference-context { background: transparent; }
html[data-theme="dark"] .crm-mode .crm-tabs.crm-reference-tabs {
  border-bottom: 1px solid var(--dark-border);
  background: transparent;
  box-shadow: none;
}
html[data-theme="dark"] :is(.crm-mode .crm-tabs button, .crm-reference-communication > section > span, .crm-reference-communication dd span) {
  background: transparent;
  color: var(--dark-muted);
}
html[data-theme="dark"] :is(.crm-mode .crm-tabs button.active, .crm-reference-communication > section p) { color: var(--dark-text); }
html[data-theme="dark"] .activity-status-model {
  border-color: var(--dark-border);
  background: var(--dark-soft);
}
html[data-theme="dark"] .activity-status-button {
  border-color: var(--dark-border);
  background: transparent;
  color: var(--dark-muted);
}
html[data-theme="dark"] .activity-status-button.is-active {
  background: var(--dark-elevated);
  color: var(--dark-text);
}
html[data-theme="dark"] .activity-status-button.is-complete { background: #1b232b; color: #bdc8d3; }
html[data-theme="dark"] .crm-deal-status-model .activity-status-button:hover { background: #29343f; color: #fff; }
html[data-theme="dark"] :is(.crm-owner-tag, .crm-data-tag, .crm-product-tag) { border-color: var(--dark-border); background: #28333e; color: #c7d2dc; }
html[data-theme="dark"] .bpm-table-row.access-date-overdue > td { background: #382329; }

html[data-theme="dark"] :is(.company-tag-badge, .crm-product-tag, .crm-sales-channel, .crm-owner-tag, .crm-data-tag, .contact-primary-badge, .access-owner-tag, .crm-reference-company-tags > span, .assigned-base-tags > span, .crm-status) {
  border-color: #46525e;
  background: #252e37;
  color: #b9c4ce;
  font-weight: 500;
}
html[data-theme="dark"] .crm-mode .crm-table.crm-company-table .crm-company-name-link,
html[data-theme="dark"] .crm-mode .crm-table.crm-holdings-table td:nth-child(2) .crm-entity-link { color: var(--brand-accent-strong); }
html[data-theme="dark"] .crm-mode .crm-table.crm-company-table .crm-holding-link,
html[data-theme="dark"] .crm-mode .crm-table.crm-holdings-table td:first-child .crm-entity-link { color: var(--dark-text); }
html[data-theme="dark"] :is(.crm-reference-person-form input, .crm-reference-person-form select) {
  border-color: var(--dark-border);
  background: #111820;
  color: var(--dark-text);
}
html[data-theme="dark"] .enrichment-control[data-state="failed"] .enrichment-fill,
html[data-theme="dark"] .girbo-control[data-result-tone="error"] .enrichment-fill { background: #222b35; }
html[data-theme="dark"] .crm-state-filter,
html[data-theme="dark"] .crm-bulk-toolbar :is(select, input) {
  border-color: var(--dark-border);
  background: #111820;
  color: var(--dark-text);
}
html[data-theme="dark"] .crm-state-filter span { border-color: var(--dark-border); color: var(--dark-muted); }
html[data-theme="dark"] .crm-state-filter input:checked + span { background: #19332f; color: #8ad9cf; box-shadow: inset 0 -2px #36b8aa; }

html[data-theme="dark"] .app-global-header .crm-section-row {
  border-color: var(--dark-border);
  background: #151c24;
}
html[data-theme="dark"] .app-global-header .crm-subnav { background: transparent; }
html[data-theme="dark"] .app-global-header .crm-subnav a { color: #9da9b6; }
html[data-theme="dark"] .app-global-header .crm-subnav a.active {
  background: color-mix(in srgb, var(--brand-accent) 16%, transparent);
  color: #86ddd4;
}
html[data-theme="dark"] .page-segment-switch {
  border-color: var(--dark-border);
  background: transparent;
}
html[data-theme="dark"] .page-segment-switch a { color: var(--dark-muted); }
html[data-theme="dark"] .page-segment-switch a.active {
  border-bottom-color: var(--brand-accent);
  background: transparent;
  color: #86ddd4;
  box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
  html[data-theme="dark"] *,
  html[data-theme="dark"] *::before,
  html[data-theme="dark"] *::after { transition-duration: .01ms !important; }
}
