/* Tema global SIGEC: carregado depois dos estilos das páginas. */
html[data-theme="light"] {
  color-scheme: light;
  --admin-bg: #f3f6fb;
  --admin-sidebar: #ffffff;
  --admin-sidebar-2: #f8faff;
  --admin-primary: #ff6814;
  --admin-primary-hover: #e9540a;
  --admin-text: #17243a;
  --admin-muted: #697a94;
  --admin-border: #dfe6f0;
  --admin-white: #ffffff;
  --theme-surface: #ffffff;
  --theme-surface-muted: #f7f9fc;
  --theme-text: #17243a;
  --theme-muted: #697a94;
  --theme-border: #dfe6f0;
  --theme-hover: #f1f5fa;
  --theme-selection-bg: #bfdbfe;
  --theme-selection-text: #17243a;
  background: var(--admin-bg);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --admin-bg: #0b1420;
  --admin-sidebar: #07111d;
  --admin-sidebar-2: #0a1827;
  --admin-primary: #ff741f;
  --admin-primary-hover: #ff8a3d;
  --admin-text: #edf3fb;
  --admin-muted: #9aaac0;
  --admin-border: #26374a;
  --admin-white: #111e2c;
  --theme-surface: #111e2c;
  --theme-surface-muted: #0d1926;
  --theme-text: #edf3fb;
  --theme-muted: #9aaac0;
  --theme-border: #26374a;
  --theme-hover: #1a2a3b;
  --theme-selection-bg: #2563eb;
  --theme-selection-text: #ffffff;
  background: var(--admin-bg);
}

html[data-theme] body { background: var(--admin-bg); color: var(--admin-text); }

::selection,
::-moz-selection {
  color: var(--theme-selection-text);
  background: var(--theme-selection-bg);
}

/* Menu do usuário e seletor Claro / Escuro / Automático. */
.profile-menu-panel { color: var(--theme-text); background: var(--theme-surface); border-color: var(--theme-border); }
.profile-menu-heading { border-bottom: 0; }
.profile-menu-heading strong { color: var(--theme-text); }
.profile-menu-heading small, .profile-theme-toggle small { color: var(--theme-muted); }
.profile-theme { padding: 2px 0 8px; }
.profile-theme-toggle { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 8px; border: 0; border-radius: 8px; color: var(--theme-text); background: transparent; cursor: pointer; text-align: left; }
.profile-theme-toggle:hover, .profile-theme-options button:hover { background: var(--theme-hover); }
.profile-theme-toggle > span { display: flex; align-items: center; gap: 11px; }
.profile-theme-toggle > span > i { width: 20px; color: var(--admin-primary); text-align: center; }
.profile-theme-toggle > span > span { display: flex; flex-direction: column; gap: 3px; }
.profile-theme-toggle strong { font-size: .84rem; }
.profile-theme-toggle small { font-size: .72rem; }
.profile-theme-chevron { color: var(--theme-muted); transition: transform .16s ease; }
.profile-theme-toggle[aria-expanded="true"] .profile-theme-chevron { transform: rotate(180deg); }
.profile-theme-options { display: grid; gap: 3px; padding: 4px 0 2px 28px; }
.profile-theme-options[hidden] { display: none !important; }
.profile-theme-options button { min-height: 35px; display: flex; align-items: center; gap: 9px; padding: 7px 9px; border: 0; border-radius: 7px; color: var(--theme-text); background: transparent; cursor: pointer; font: inherit; font-size: .78rem; text-align: left; }
.profile-theme-options button > i:first-child { width: 16px; color: var(--theme-muted); }
.profile-theme-options button[aria-pressed="true"] { color: var(--admin-primary); font-weight: 700; }
.profile-theme-options button [data-theme-check] { margin-left: auto; color: #16a34a; }
.profile-menu-divider { height: 1px; margin: 0; background: var(--theme-border); }
.profile-menu-panel form { padding-top: 8px; border-top: 0; }
.profile-menu-logout { color: #dc2626; }
.profile-menu-logout:hover { background: color-mix(in srgb, #dc2626 10%, var(--theme-surface)); }

/* Marca e navegação lateral: faixa alaranjada inferior presente nos mockups. */
.admin-sidebar { isolation: isolate; overflow: hidden; color: var(--theme-text); background: linear-gradient(180deg, var(--admin-sidebar) 0%, var(--admin-sidebar-2) 100%); border-right: 1px solid var(--theme-border); }
.admin-sidebar::before { content: none; }
.admin-sidebar::after { content: ""; position: absolute; z-index: 0; inset: auto 0 0; height: 145px; background-repeat: no-repeat; background-position: center bottom; background-size: 100% 100%; pointer-events: none; }
html[data-theme="light"] .admin-sidebar::after { background-image: url("../img/sidebar-claro.png"); }
html[data-theme="dark"] .admin-sidebar::after { background-image: url("../img/sidebar-escuro.png"); }
.sidebar-brand, .sidebar-nav, .admin-sidebar > form { position: relative; z-index: 1; }
.admin-sidebar .sidebar-brand { border-color: var(--theme-border); }
html[data-theme="light"] .admin-sidebar .nav-section-title { color: #64748b; }
html[data-theme="light"] .admin-sidebar .nav-item { color: #34445e; }
html[data-theme="light"] .admin-sidebar .nav-item i { color: #63748d; }
html[data-theme="light"] .admin-sidebar .nav-item:hover { color: #17243a; background: #f1f5f9; }
html[data-theme="light"] .admin-sidebar .nav-item.active { color: #fff; background: linear-gradient(90deg, #ff6814, #f55a12); box-shadow: inset 3px 0 0 #ff8a43, 0 5px 14px #ff681433; }
html[data-theme="light"] .admin-sidebar .nav-item.active i { color: #fff; }
html[data-theme="light"] .admin-sidebar form { border-color: var(--theme-border); }
html[data-theme="light"] .admin-sidebar .sidebar-logout { color: #34445e; }
html[data-theme="light"] .admin-sidebar .sidebar-logout:hover { color: #b42318; background: #fff1f0; }
html[data-theme="light"] .admin-sidebar .sidebar-nav::-webkit-scrollbar-thumb { background: #cbd5e1; }
html[data-theme="light"] .admin-sidebar .sidebar-nav { scrollbar-color: #cbd5e1 transparent; }
html[data-theme="dark"] .admin-sidebar .nav-section-title { color: #9aaac0; }
html[data-theme="dark"] .admin-sidebar .nav-item { color: #d6e0ec; }
html[data-theme="dark"] .admin-sidebar .nav-item i { color: #a6b5c8; }
html[data-theme="dark"] .admin-sidebar .nav-item:hover { color: #fff; background: rgba(255,255,255,.08); }
html[data-theme="dark"] .admin-sidebar .nav-item.active { color: #fff; background: linear-gradient(90deg, #ff6814, #f55a12); box-shadow: inset 3px 0 0 #ff9b5e, 0 5px 14px #ff681433; }
html[data-theme="dark"] .admin-sidebar .nav-item.active i { color: #fff; }
html[data-theme="dark"] .admin-sidebar .nav-item.disabled small { color: #ffd0a1; background: rgba(255, 116, 31, .16); }
html[data-theme="dark"] .admin-sidebar form { border-color: rgba(255,255,255,.12); }
html[data-theme="dark"] .admin-sidebar .sidebar-logout { color: #d6e0ec; }
html[data-theme="dark"] .admin-sidebar .sidebar-logout:hover { color: #fecaca; background: rgba(220,38,38,.16); }
html[data-theme="dark"] .admin-sidebar .sidebar-logout:disabled { color: #a6b5c8; background: rgba(255,255,255,.04); border-color: transparent; opacity: 1; cursor: not-allowed; }
html[data-theme="dark"] .admin-sidebar .sidebar-logout:disabled:hover { color: #a6b5c8; background: rgba(255,255,255,.04); }
html[data-theme="dark"] .admin-sidebar .sidebar-nav::-webkit-scrollbar-thumb { background: #3a4b60; }
html[data-theme="dark"] .admin-sidebar .sidebar-nav { scrollbar-color: #3a4b60 transparent; }

.admin-header { border-color: var(--theme-border); }
html[data-theme="light"] .admin-header { background: rgba(255, 255, 255, .96); }
html[data-theme="dark"] .admin-header { background: linear-gradient(90deg, #07111d 0%, #0a2032 100%); }
.admin-header .header-left, .admin-header .header-breadcrumb, .admin-header .header-breadcrumb strong { color: var(--theme-text); }
.admin-header .header-breadcrumb span { color: var(--theme-muted); }
.admin-header .header-breadcrumb span:last-child { color: var(--theme-text); }
.admin-header .user-info strong { color: var(--theme-text); }
.admin-header .user-info small { color: var(--theme-muted); }
.admin-header .profile-menu-toggle > .bi-chevron-down, .admin-header .header-user > .bi-chevron-down { color: var(--theme-muted); }
.admin-header .notification-button { color: var(--theme-muted); }
.admin-header .notification-button:hover { color: var(--theme-text); background: var(--theme-hover); }
.admin-header .notification-button span { border-color: var(--theme-surface); }
html[data-theme="dark"] .reports-notice.is-success { color: #bbf7d0; background: #102b20; border-color: #205b38; }
html[data-theme="dark"] .reports-notice.is-error { color: #fecaca; background: #321b22; border-color: #6b2b37; }
.sidebar-toggle { border-color: var(--theme-border); color: var(--theme-text); background: var(--theme-surface); }

/* Componentes compartilhados pelas telas administrativas. */
.admin-main, .admin-content { color: var(--theme-text); }
.page-heading h1, .panel-header h2, .empty-state h3 { color: var(--theme-text); }
.page-heading p, .panel-header p, .current-time, .empty-state p { color: var(--theme-muted); }
.content-panel, .stat-card, .dashboard-kpi, .dashboard-panel, .agents-online-panel, .reports-stat, .reports-filter-panel, .reports-table-panel, .datetime-panel, .agent-session-card, .info-panel { color: var(--theme-text); border-color: var(--theme-border); background: var(--theme-surface); }
html[data-theme="dark"] .agents-kpi { color: var(--theme-text); border-color: var(--theme-border); background: var(--theme-surface); }
html[data-theme="dark"] .agents-kpi small { color: var(--theme-muted); }
.agent-live-value { min-height:25px; display:inline-flex; align-items:center; gap:6px; padding:4px 8px; border:1px solid var(--theme-border); border-radius:999px; color:var(--theme-text); background:var(--theme-surface-muted); font-size:.69rem; font-weight:650; line-height:1.1; font-variant-numeric:tabular-nums; white-space:nowrap; }
.agent-live-value.is-in_call { color:#1d4ed8; border-color:#bfdbfe; background:#eff6ff; }
.agent-live-value.is-in_call i { color:#3b82f6; }
.agent-live-value.is-ringing { color:#854d0e; border-color:#fde68a; background:#fef3c7; }
.agent-live-value.is-ringing i { color:#eab308; }
html[data-theme="dark"] .agent-live-value.is-in_call { color:#93c5fd; border-color:#28507b; background:#142b43; }
html[data-theme="dark"] .agent-live-value.is-in_call i { color:#60a5fa; }
html[data-theme="dark"] .agent-live-value.is-ringing { color:#fcd34d; border-color:#705819; background:#352b13; }
html[data-theme="dark"] .agent-live-value.is-ringing i { color:#facc15; }
.panel-header, .datetime-panel-header { border-color: var(--theme-border); }
.stat-card strong, .dashboard-kpi strong, .dashboard-panel-heading h2, .agents-list-heading h2, .agent-detail-headcopy h2, .agent-detail-subtitle { color: var(--theme-text); }
.stat-card span, .dashboard-kpi span, .agents-list-heading h2 small { color: var(--theme-muted); }
.icon-button, .dashboard-clock, .dashboard-queue-filter, .average-row, .dashboard-queue-filter select { border-color: var(--theme-border); color: var(--theme-text); background: var(--theme-surface); }
.dashboard-queue-filter select { background: transparent; }
.reports-table th, .dashboard-table th, .agents-management-table th { color: var(--theme-muted); border-color: var(--theme-border); background: var(--theme-surface-muted); }
.reports-table td, .dashboard-table td, .agents-management-table td { color: var(--theme-text); border-color: var(--theme-border); }
.reports-table td small, .reports-table .mono, .reports-table-footer, .reports-period-line, .reports-breadcrumb, .reports-source-note, .reports-footnote { color: var(--theme-muted); }
.reports-table-footer { border-color: var(--theme-border); }
.reports-table-footer strong { color: var(--theme-text); }
.reports-table tbody tr:hover, .agents-management-table tbody tr:hover, .agents-management-table tbody tr.is-selected { background: var(--theme-hover); }
html[data-theme="dark"] .reports-tabs button { color: var(--theme-muted); }
html[data-theme="dark"] .reports-tabs button:hover,
html[data-theme="dark"] .reports-tabs button.active { color: #ff8a43; }
html[data-theme="dark"] .reports-stat strong,
html[data-theme="dark"] .reports-period-line strong,
html[data-theme="dark"] .reports-datetime strong { color: var(--theme-text); }
html[data-theme="dark"] .reports-stat div span,
html[data-theme="dark"] .reports-datetime small { color: var(--theme-muted); }
.dashboard-lower-grid .dashboard-panel-heading, .agents-list-heading, .agents-list-footer { border-color: var(--theme-border); }
.dashboard-panel-heading h2 small, .dashboard-panel-note, .dashboard-legend, .dashboard-updated { color: var(--theme-muted); }
.dashboard-clock b { border-color: var(--theme-border); }
.hourly-chart text { fill: var(--theme-muted); }
.hourly-chart .grid-line { stroke: var(--theme-border); }
.dashboard-lower-grid .dashboard-panel-heading { border-color: var(--theme-border); }
.dashboard-table td strong, .dashboard-table td:first-child strong, .dashboard-table td .agent-name, .dashboard-table .agent-remote, .dashboard-table .agent-attending, .dashboard-table .agent-duration { color: var(--theme-text); }
.dashboard-table .agent-live-value.is-in_call { color:#1d4ed8; }
.dashboard-table .agent-live-value.is-ringing { color:#854d0e; }
html[data-theme="dark"] .dashboard-table .agent-live-value.is-in_call { color:#93c5fd; }
html[data-theme="dark"] .dashboard-table .agent-live-value.is-ringing { color:#fcd34d; }
.dashboard-table td small { color: var(--theme-muted); }
.outcome-donut:before { background: var(--theme-surface); }
.outcome-donut > div, .outcome-legend span, .outcome-legend strong, .average-row > span { color: var(--theme-text); }
.average-row small, .average-row > i { color: var(--theme-muted); }
html[data-theme="dark"] .average-row > i,
html[data-theme="dark"] .average-row strong { color: #75aaff; }
.agent-list-filter > span { color: var(--theme-text); background: var(--theme-hover); }
.agent-list-filter select, .agents-search, .agents-filter-select, .agents-search input, .agents-filter-select select { color: var(--theme-text); border-color: var(--theme-border); background-color: var(--theme-surface); }
.agents-search input { background: transparent; }
.agent-cell strong, .agent-detail-line, .agent-detail-line strong, .agent-detail-headcopy p, .agent-detail-empty strong { color: var(--theme-text); }
.agent-detail-header, .agent-detail-state { border-color: var(--theme-border); }
.agent-detail-detail, .agent-detail-line > span i, .agent-detail-close, .agents-detail-empty { color: var(--theme-muted); }
.agents-list-footer, .agents-list-footer select, .agents-list-footer button { color: var(--theme-muted); border-color: var(--theme-border); background: var(--theme-surface); }
.agent-actions-toggle, .agent-actions-menu, .agent-detail-actions button, .agent-detail-actions a, .agent-pause-option span { color: var(--theme-text); border-color: var(--theme-border); background: var(--theme-surface); }
.agent-actions-menu button { color: var(--theme-text); }
.agent-actions-menu button:hover, .agent-pause-option span:hover { background: var(--theme-hover); }
.agent-actions-divider, .agent-detail-reasons { border-color: var(--theme-border); background: var(--theme-surface-muted); }
.agents-search input { background: transparent !important; }
.dashboard-queue-filter select { background: transparent !important; }
.dashboard-warning, .agents-online-warning { background: #fff7ed; }
.agent-topbar { background: linear-gradient(110deg, #07111d, #0a2032); }
html[data-theme="dark"] .agent-main-content { color: var(--theme-text); }
html[data-theme="dark"] .agent-main-content h1, html[data-theme="dark"] .agent-main-content h2 { color: var(--theme-text); }
html[data-theme="dark"] .agent-session-card p, html[data-theme="dark"] .agent-session-card label { color: var(--theme-muted); }
html[data-theme="dark"] .agent-form-footer { border-color: var(--theme-border); }

/* Formulários e elementos nativos acompanham a preferência do sistema. */
html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
html[data-theme="dark"] select, html[data-theme="dark"] textarea {
  color: var(--theme-text);
  border-color: var(--theme-border);
  background-color: var(--theme-surface);
}
html[data-theme="dark"] input::placeholder, html[data-theme="dark"] textarea::placeholder { color: #8293aa; }
html[data-theme="dark"] select option { color: var(--theme-text); background: var(--theme-surface); }
html[data-theme="dark"] .btn-light, html[data-theme="dark"] .button-secondary { color: var(--theme-text); border-color: var(--theme-border); background: var(--theme-hover); }
html[data-theme="dark"] .table-wrapper, html[data-theme="dark"] .table-wrapper table { color: var(--theme-text); }
html[data-theme="dark"] .users-table th, html[data-theme="dark"] .pjsip-table th { color: var(--theme-muted); background: var(--theme-surface-muted); }
html[data-theme="dark"] .users-table td, html[data-theme="dark"] .pjsip-table td { color: var(--theme-text); border-color: var(--theme-border); }
html[data-theme="dark"] .users-table tbody tr:hover { background: var(--theme-hover); }
html[data-theme="dark"] .table-user strong,
html[data-theme="dark"] .users-legend strong,
html[data-theme="dark"] .users-legend b { color: var(--theme-text); }
html[data-theme="dark"] .users-legend { color: var(--theme-muted); border-color: var(--theme-border); background: var(--theme-surface); }
html[data-theme="dark"] .users-legend > div + div { border-color: var(--theme-border); }
html[data-theme="dark"] .table-footer { color: var(--theme-muted); border-color: var(--theme-border); }
html[data-theme="dark"] .table-footer strong { color: var(--theme-text); }
html[data-theme="dark"] .list-sort-button:hover { color: var(--admin-primary); }
html[data-theme="dark"] .pagination button { color: var(--theme-muted); border-color: var(--theme-border); background: var(--theme-surface); }
html[data-theme="dark"] .pagination button.active { color: #fff; border-color: var(--admin-primary); background: var(--admin-primary); }

/* Forms and secondary controls shared by the configuration screens. */
html[data-theme="dark"] .form-section-card,
html[data-theme="dark"] .form-section-card .form-checkbox,
html[data-theme="dark"] .extension-permission-card,
html[data-theme="dark"] .ura-builder-item,
html[data-theme="dark"] .calendar-day span,
html[data-theme="dark"] .calendar-repeat-option {
  color: var(--theme-text);
  border-color: var(--theme-border);
  background: var(--theme-surface-muted);
}
html[data-theme="dark"] .system-status-grid { border-color: var(--theme-border); background: var(--theme-border); }
html[data-theme="dark"] .system-status-item,
html[data-theme="dark"] .datetime-config-card { color: var(--theme-text); background: var(--theme-surface); }
html[data-theme="dark"] .system-status-item > span:first-child,
html[data-theme="dark"] .datetime-config-card .system-subsection-header p,
html[data-theme="dark"] .datetime-config-footnote { color: var(--theme-muted); }
html[data-theme="dark"] .system-status-item > strong,
html[data-theme="dark"] .datetime-config-card .system-subsection-header h3 { color: var(--theme-text); }
html[data-theme="dark"] .datetime-config-card { border-color: var(--theme-border); }
html[data-theme="dark"] .datetime-server-row input { color: var(--theme-text); border-color: var(--theme-border); background: var(--theme-surface-muted); }
html[data-theme="dark"] .datetime-server-row.has-error input { border-color:#f87171; box-shadow:0 0 0 2px rgba(248,113,113,.14); }
html[data-theme="dark"] .datetime-input-error { color:#fca5a5; }
html[data-theme="dark"] .datetime-form-actions .button-primary:disabled,
html[data-theme="dark"] .datetime-form-actions .button-primary:disabled:hover { color:#94a3b8; border-color:#334155; background:#1d2938; }
html[data-theme="dark"] .datetime-form-actions .button-secondary { color: var(--theme-text); border-color: var(--theme-border); background: var(--theme-hover); }
html[data-theme="dark"] .datetime-config-footnote code,
html[data-theme="dark"] .datetime-config-card code { color: #b9d4f5; }
html[data-theme="dark"] .system-alert-danger { color: #fecaca; border-color: #6b2b37; background: #321b22; }
html[data-theme="dark"] .system-alert-warning { color: #fde68a; border-color: #705819; background: #352b13; }
html[data-theme="dark"] .info-panel strong { color: var(--theme-text); }
html[data-theme="dark"] .info-panel p { color: #c2cede; }
html[data-theme="dark"] .info-panel-icon { color: #8bb8ff; background: #1a2d46; }
html[data-theme="dark"] .pjsip-alert.info { color: #bfdbfe; border-color: #264e78; background: #13283d; }
html[data-theme="dark"] .pjsip-alert.success { color: #bbf7d0; border-color: #205b38; background: #102b20; }
html[data-theme="dark"] .pjsip-alert.error { color: #fecaca; border-color: #6b2b37; background: #321b22; }
html[data-theme="dark"] .email-overview-card,
html[data-theme="dark"] .email-config-panel,
html[data-theme="dark"] .email-help-card,
html[data-theme="dark"] .email-sender-section { color: var(--theme-text); border-color: var(--theme-border); background: var(--theme-surface); }
html[data-theme="dark"] .email-overview-card small,
html[data-theme="dark"] .email-panel-heading p,
html[data-theme="dark"] .email-subpanel header p,
html[data-theme="dark"] .email-help-card header p,
html[data-theme="dark"] .email-sender-section header p,
html[data-theme="dark"] .email-test-note { color: var(--theme-muted); }
html[data-theme="dark"] .email-overview-card strong,
html[data-theme="dark"] .email-panel-heading h2,
html[data-theme="dark"] .email-section-label,
html[data-theme="dark"] .email-method-option strong,
html[data-theme="dark"] .email-subpanel h3,
html[data-theme="dark"] .email-help-card h2,
html[data-theme="dark"] .email-sender-section h3,
html[data-theme="dark"] .email-help-card article strong,
html[data-theme="dark"] .email-enable-toggle strong,
html[data-theme="dark"] .email-method-help strong { color: var(--theme-text); }
html[data-theme="dark"] .email-method-option,
html[data-theme="dark"] .email-subpanel,
html[data-theme="dark"] .email-method-help,
html[data-theme="dark"] .email-enable-toggle { color: var(--theme-text); border-color: var(--theme-border); background: var(--theme-surface-muted); }
html[data-theme="dark"] .email-method-option:has(input:checked),
html[data-theme="dark"] .email-method-help.is-orange { border-color: #87512f; background: #241b17; }
html[data-theme="dark"] .email-method-option small,
html[data-theme="dark"] .email-method-help p,
html[data-theme="dark"] .email-tips li { color: #c2cede; }
html[data-theme="dark"] .email-subpanel .form-group label { color: var(--theme-text); }
html[data-theme="dark"] .email-subpanel .form-group input,
html[data-theme="dark"] .email-subpanel .form-group select,
html[data-theme="dark"] .email-subpanel .form-group textarea { color: var(--theme-text); border-color: var(--theme-border); background: #091521; }
html[data-theme="dark"] .email-subpanel .form-group input::placeholder,
html[data-theme="dark"] .email-subpanel .form-group small,
html[data-theme="dark"] .email-enable-toggle small { color: var(--theme-muted); }
html[data-theme="dark"] .email-test-panel { background: linear-gradient(160deg, var(--theme-surface-muted), #241b17); }
html[data-theme="dark"] .email-password-input button { color: var(--theme-muted); }
html[data-theme="dark"] .email-status-pill.is-active { color: #bbf7d0 !important; background: #102b20; }
html[data-theme="dark"] .email-status-pill.is-inactive { color: #fecaca !important; background: #321b22; }
html[data-theme="dark"] .form-section-heading h3,
html[data-theme="dark"] .ura-builder-heading strong,
html[data-theme="dark"] .extension-permission-copy strong,
html[data-theme="dark"] .codec-list-panel > label,
html[data-theme="dark"] .form-group label { color: var(--theme-text); }
html[data-theme="dark"] .form-section-heading p,
html[data-theme="dark"] .form-section-help,
html[data-theme="dark"] .form-group small,
html[data-theme="dark"] .field-help,
html[data-theme="dark"] .password-requirements,
html[data-theme="dark"] .ura-builder-heading small,
html[data-theme="dark"] .extension-permission-copy small,
html[data-theme="dark"] .codec-list-panel > label small { color: var(--theme-muted); }
html[data-theme="dark"] .extension-dial-code { color: var(--theme-muted); }
html[data-theme="dark"] .extension-dial-code input {
  color: var(--theme-text);
  border-color: var(--theme-border);
  background: var(--theme-surface);
}
html[data-theme="dark"] .form-divider { background: var(--theme-border); }
html[data-theme="dark"] .form-group input,
html[data-theme="dark"] .form-group select,
html[data-theme="dark"] .codec-list-panel select,
html[data-theme="dark"] .calendar-entry,
html[data-theme="dark"] .ura-builder-item input,
html[data-theme="dark"] .ura-builder-item select,
html[data-theme="dark"] .extension-outbound-fields input,
html[data-theme="dark"] .extension-outbound-fields select {
  color: var(--theme-text);
  border-color: var(--theme-border);
  background-color: var(--theme-surface);
}
html[data-theme="dark"] .form-group input.readonly-field { color: var(--theme-muted); background: var(--theme-hover); }
html[data-theme="dark"] .calendar-day input:checked + span,
html[data-theme="dark"] .calendar-day:has(input:checked) span { color: #ff9b5e; border-color: #a94c17; background: #382519; }
html[data-theme="dark"] .ura-auto-routes { color: #c5d8f2; border-color: #2c4564; background: #13253a; }
html[data-theme="dark"] .extension-outbound-fields { border-color: #87512f; background: #241b17; }
html[data-theme="dark"] .extension-outbound-fields .form-group label { color: #ffc18f; }
html[data-theme="dark"] .extension-permission-icon { background: #382719; }
html[data-theme="dark"] .pjsip-footnote code,
html[data-theme="dark"] .pjsip-panel .panel-header code { color: #cbd8e8; }

/* Cartões de opções e gravação de ramais/filas. */
html[data-theme="dark"] .queue-feature-card,
html[data-theme="dark"] .queue-record-control,
html[data-theme="dark"] .queue-calendar-selection,
html[data-theme="dark"] .queue-calendar-choice,
html[data-theme="dark"] .codec-option,
html[data-theme="dark"] .codec-check {
  color: var(--theme-text);
  border-color: var(--theme-border);
  background: var(--theme-surface);
}
html[data-theme="dark"] .queue-feature-title label,
html[data-theme="dark"] .queue-record-copy strong,
html[data-theme="dark"] .queue-calendar-copy strong,
html[data-theme="dark"] .codec-option strong { color: var(--theme-text); }
html[data-theme="dark"] .queue-feature-title p,
html[data-theme="dark"] .queue-record-copy small,
html[data-theme="dark"] .queue-calendar-copy small,
html[data-theme="dark"] .queue-calendar-target label,
html[data-theme="dark"] .queue-calendar-empty,
html[data-theme="dark"] .queue-feature-help,
html[data-theme="dark"] .codec-option small { color: var(--theme-muted); }
html[data-theme="dark"] .queue-calendar-choice:hover { background: var(--theme-hover); }
html[data-theme="dark"] .queue-calendar-choice.is-selected,
html[data-theme="dark"] .codec-option:has(input:checked) { border-color: #a94c17; background: #2c2019; }
html[data-theme="dark"] .queue-calendar-target select { color: var(--theme-text); border-color: var(--theme-border); background: var(--theme-surface-muted); }
html[data-theme="dark"] .queue-record-notice { color: #c5d8f2; border-color: #2c4564; background: #13253a; }
html[data-theme="dark"] .queue-selected-count { color: #ffad7b; border-color: #704425; background: #302116; }
html[data-theme="dark"] .queue-audio-sequence,
html[data-theme="dark"] .queue-audio-item { color: var(--theme-text); border-color: var(--theme-border); background: var(--theme-surface); }
html[data-theme="dark"] .queue-audio-number { background: #244a78; }

/* Uploads de música e áudios de URA. */
html[data-theme="dark"] .moh-upload-group > label:first-child { color: var(--theme-text); }
html[data-theme="dark"] .moh-upload-dropzone {
  color: #dbe7f5;
  border-color: #a65b2a;
  background: linear-gradient(135deg, #211a17, #172231 72%);
}
html[data-theme="dark"] .moh-upload-dropzone:hover,
html[data-theme="dark"] .moh-upload-dropzone.is-dragover { background: #302217; }
html[data-theme="dark"] .moh-upload-dropzone strong { color: #f2f6fc; }
html[data-theme="dark"] .moh-upload-secondary,
html[data-theme="dark"] .moh-upload-dropzone > small,
html[data-theme="dark"] .moh-selected-heading,
html[data-theme="dark"] .moh-file-list-heading > span { color: var(--theme-muted); }
html[data-theme="dark"] .moh-file-list-heading h4 { color: var(--theme-text); }
html[data-theme="dark"] .moh-file-item,
html[data-theme="dark"] .moh-empty-files { color: var(--theme-text); border-color: var(--theme-border); background: var(--theme-surface-muted); }
html[data-theme="dark"] .moh-file-name { color: var(--theme-text); }
html[data-theme="dark"] .moh-file-icon,
html[data-theme="dark"] .moh-file-type { color: #a9caff; background: #1b2c43; }
html[data-theme="dark"] .moh-file-item.is-marked-for-removal { color: #fecaca; border-color: #7f3038; background: #311c25; }
html[data-theme="dark"] .moh-file-item.is-marked-for-removal .moh-file-name { color: #fecaca; }
html[data-theme="dark"] .moh-empty-files { color: var(--theme-muted); }

/* Regras de roteamento: formulário e grupos expansíveis do tronco. */
html[data-theme="dark"] .routing-destination-options legend { color: var(--theme-text); }
html[data-theme="dark"] .routing-destination-choice,
html[data-theme="dark"] .routing-trunk-group { color: var(--theme-text); border-color: var(--theme-border); background: var(--theme-surface); }
html[data-theme="dark"] .routing-destination-choice strong,
html[data-theme="dark"] .routing-trunk-title strong,
html[data-theme="dark"] .routing-empty-trunk strong { color: var(--theme-text); }
html[data-theme="dark"] .routing-destination-choice small,
html[data-theme="dark"] .routing-trunk-title small,
html[data-theme="dark"] .routing-table .table-user small,
html[data-theme="dark"] .routing-empty-trunk { color: var(--theme-muted); }
html[data-theme="dark"] .routing-destination-choice:has(input:checked) { border-color: #a94c17; background: #2c2019; }
html[data-theme="dark"] .routing-destination-choice-icon { background: #382719; }
html[data-theme="dark"] .routing-trunk-chevron,
html[data-theme="dark"] .routing-rule-count { color: #c4d2e4; background: #1b2a3b; }
html[data-theme="dark"] .routing-trunk-details[open] .routing-trunk-chevron { color: #ff9b5e; background: #382719; }
html[data-theme="dark"] .routing-rule-count.has-rules { color: #8ee0ae; background: #153525; }
html[data-theme="dark"] .routing-empty-trunk { border-color: #3a4c62; background: var(--theme-surface-muted); }
html[data-theme="dark"] .routing-table code,
html[data-theme="dark"] .routing-legend code,
html[data-theme="dark"] .routing-form code { color: #c1d7f4; background: #1b2c43; }
html[data-theme="dark"] .routing-direct-destination-note { color: #c5d8f2; border-color: #2c4564; background: #13253a; }

/* Sobre o SIGEC / licenciamento. */
html[data-theme="dark"] .license-card { color: var(--theme-text); border-color: var(--theme-border); background: var(--theme-surface); }
html[data-theme="dark"] .license-title h2,
html[data-theme="dark"] .license-blocked-secondary-content h2 { color: var(--theme-text); }
html[data-theme="dark"] .license-title > i { color: #8db5ff; }
html[data-theme="dark"] .license-title p,
html[data-theme="dark"] .license-info-item span,
html[data-theme="dark"] .license-blocked-secondary-content > p { color: var(--theme-muted); }
html[data-theme="dark"] .license-info-item { border-color: var(--theme-border); background: var(--theme-surface-muted); }
html[data-theme="dark"] .license-info-item strong { color: #dbe7f5; }
html[data-theme="dark"] .license-info-item.is-expired strong,
html[data-theme="dark"] .license-expired-date,
html[data-theme="dark"] .license-blocked-expiry strong { color:#fecaca; }
html[data-theme="dark"] .license-expired-date { border-color:#7f3038; background:#3b2028; }
html[data-theme="dark"] .license-blocked-expiry span { color:#fecaca; }
html[data-theme="dark"] .license-divider { background: var(--theme-border); }
html[data-theme="dark"] .license-table th { color: var(--theme-muted); border-color: var(--theme-border); }
html[data-theme="dark"] .license-table td { color: var(--theme-text); border-color: var(--theme-border); }
html[data-theme="dark"] .license-blocked-message { border-color: #7f3038; background: #311c25; }
html[data-theme="dark"] .license-blocked-content p { color: #f3dfe2; }
html[data-theme="dark"] .license-blocked-divider { background: #7f3038; }
html[data-theme="dark"] .license-file-input { color:var(--theme-text); border-color:var(--theme-border); background:var(--theme-surface-muted); }
html[data-theme="dark"] .license-file-input::file-selector-button { color:#bfdbfe; background:#1b3554; }
html[data-theme="dark"] .license-import-form small { color:var(--theme-muted); }
html[data-theme="dark"] .license-notice { color:#c7dcf8; border-color:#2b4a70; background:#13263b; }
html[data-theme="dark"] .license-notice.error { color:#fecaca; border-color:#7f3038; background:#311c25; }
html[data-theme="dark"] .license-notice.success { color:#bbf7d0; border-color:#1c573c; background:#102b21; }
html[data-theme="dark"] .license-import-warning-icon { color:#fdba74; background:#392718; }
html[data-theme="dark"] .license-expiry-icon { color:#fdba74; background:#392718; }
html[data-theme="dark"] .agent-session-card, html[data-theme="dark"] .agent-session-card h1, html[data-theme="dark"] .agent-session-card h2 { color: var(--theme-text); }
html[data-theme="dark"] .sigec-modal { color: var(--theme-text); background: var(--theme-surface); }
html[data-theme="dark"] .sigec-modal-overlay { background: rgba(2, 8, 16, .76); }
html[data-theme="dark"] .sigec-modal-content h3,
html[data-theme="dark"] .sigec-modal-content p strong { color: var(--theme-text); }
html[data-theme="dark"] .sigec-modal-content p,
html[data-theme="dark"] .sigec-modal-content small { color: var(--theme-muted); }
html[data-theme="dark"] .sigec-modal-icon { color: #fda4af; background: #3b1f27; }
html[data-theme="dark"] .sigec-modal-actions .button-secondary { color: var(--theme-text); border-color: var(--theme-border); background: var(--theme-hover); }
html[data-theme="dark"] .agent-pause-modal-icon,
html[data-theme="dark"] .agent-paused-logout-icon { color: #fdba74; background: #392718; }
html[data-theme="dark"] .agent-pause-option span { color: var(--theme-text); border-color: var(--theme-border); background: var(--theme-surface-muted); }
html[data-theme="dark"] .agent-pause-option.is-selected span { color: #fff1e6; border-color: #ff9c56; background: #392718; }
html[data-theme="dark"] .agent-pause-empty { color: var(--theme-muted); }

/* Diálogos nativos usados pelas configurações (filas, URA, ramais e sistema). */
html[data-theme="dark"] .trunk-info-modal {
  color: var(--theme-text);
  border-color: var(--theme-border);
  background: var(--theme-surface);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .58);
}
html[data-theme="dark"] .trunk-info-modal::backdrop { background: rgba(1, 7, 14, .76); }
html[data-theme="dark"] .trunk-info-modal-header h2,
html[data-theme="dark"] .trunk-info-content h3 { color: var(--theme-text); }
html[data-theme="dark"] .trunk-info-close { color: var(--theme-muted); }
html[data-theme="dark"] .trunk-info-close:hover { color: var(--theme-text); background: var(--theme-hover); }
html[data-theme="dark"] .trunk-info-content {
  color: var(--theme-text);
  border-color: var(--theme-border);
  background: linear-gradient(135deg, #201b18, var(--theme-surface-muted) 72%);
}
html[data-theme="dark"] .trunk-info-icon { color: #ff9b5e; background: #382719; }
html[data-theme="dark"] .trunk-info-content p,
html[data-theme="dark"] .trunk-info-content ul { color: #c5d2e2; }
html[data-theme="dark"] .trunk-info-content li::marker { color: #ff9b5e; }
html[data-theme="dark"] .login-panel, html[data-theme="dark"] .login-card { color: var(--theme-text); background: var(--theme-surface); }

/* Página Data e Hora: cartões e estados legíveis no tema escuro. */
html[data-theme="dark"] .datetime-page-breadcrumb { color: var(--theme-muted); }
html[data-theme="dark"] .datetime-overview-title h1,
html[data-theme="dark"] .datetime-status-value,
html[data-theme="dark"] .datetime-card-heading h2,
html[data-theme="dark"] .datetime-clock-value,
html[data-theme="dark"] .datetime-clock-meta strong,
html[data-theme="dark"] .datetime-rtc-values strong,
html[data-theme="dark"] .datetime-metrics-list dd,
html[data-theme="dark"] .ntp-sources-table td strong,
html[data-theme="dark"] .datetime-unavailable-content > strong { color: var(--theme-text); }
html[data-theme="dark"] .datetime-overview-title p,
html[data-theme="dark"] .datetime-status-card > div > span,
html[data-theme="dark"] .datetime-clock-date,
html[data-theme="dark"] .datetime-clock-meta small,
html[data-theme="dark"] .datetime-rtc-values small,
html[data-theme="dark"] .datetime-card-heading p,
html[data-theme="dark"] .datetime-unavailable-content > p { color: var(--theme-muted); }
html[data-theme="dark"] .datetime-status-card,
html[data-theme="dark"] .datetime-info-card { color: var(--theme-text); border-color: var(--theme-border); background: var(--theme-surface); box-shadow: 0 3px 12px rgba(0,0,0,.12); }
html[data-theme="dark"] .datetime-heading-icon,
html[data-theme="dark"] .datetime-section-icon,
html[data-theme="dark"] .datetime-form-icon,
html[data-theme="dark"] .datetime-meta-icon { color: #fb923c; background: #35261c; }
html[data-theme="dark"] .datetime-status-icon.is-red { color: #f87171; background: #3b2027; }
html[data-theme="dark"] .datetime-status-icon.is-green { color: #4ade80; background: #163526; }
html[data-theme="dark"] .datetime-status-icon.is-slate { color: #aab8cb; background: #202d3d; }
html[data-theme="dark"] .datetime-status-icon.is-blue { color: #60a5fa; background: #192f4a; }
html[data-theme="dark"] .datetime-status-icon.is-orange { color: #fb923c; background: #35261c; }
html[data-theme="dark"] .datetime-sync-pill.is-ok { color: #86efac; border-color: #205b38; background: #102b20; }
html[data-theme="dark"] .datetime-status-cards .datetime-state.is-ok { color: #86efac; }
html[data-theme="dark"] .datetime-sync-pill.is-pending { color: #fcd34d; border-color: #705819; background: #352b13; }
html[data-theme="dark"] .datetime-install-alert { color: #fecaca; border-color: #6b2b37; background: #321b22; }
html[data-theme="dark"] .datetime-install-icon { color: #fca5a5; background: #49242c; }
html[data-theme="dark"] .datetime-clock-icon { color: #fb923c; background: #35261c; }
html[data-theme="dark"] .datetime-clock-meta,
html[data-theme="dark"] .datetime-metrics-list > div,
html[data-theme="dark"] .ntp-sources-table th,
html[data-theme="dark"] .ntp-sources-table td { border-color: var(--theme-border); }
html[data-theme="dark"] .datetime-result-banner.is-ok { color: #86efac; background: #102b20; }
html[data-theme="dark"] .datetime-result-banner.is-pending { color: #fcd34d; background: #352b13; }
html[data-theme="dark"] .datetime-result-banner.is-error { color: #fecaca; background: #321b22; }
html[data-theme="dark"] .datetime-metrics-list dt,
html[data-theme="dark"] .ntp-sources-table td { color: #c2cede; }
html[data-theme="dark"] .datetime-metrics-list dt i,
html[data-theme="dark"] .datetime-empty-sources i { color: #91a2bb; }
html[data-theme="dark"] .datetime-sources-card .datetime-source-count,
html[data-theme="dark"] .ntp-sources-table th,
html[data-theme="dark"] .datetime-source-state.is-muted { color: #c2cede; background: var(--theme-surface-muted); }
html[data-theme="dark"] .ntp-sources-table td { background: var(--theme-surface); }
html[data-theme="dark"] .datetime-source-state.is-primary { color: #86efac; background: #163526; }
html[data-theme="dark"] .datetime-source-state.is-combined { color: #93c5fd; background: #192f4a; }
html[data-theme="dark"] .datetime-source-state.is-warning { color: #fcd34d; background: #352b13; }
html[data-theme="dark"] .datetime-source-state.is-error { color: #fecaca; background: #49242c; }
html[data-theme="dark"] .datetime-empty-sources { color: var(--theme-muted); }
html[data-theme="dark"] .datetime-unavailable-content > span > i:last-child { background: var(--theme-surface); }
html[data-theme="dark"] .datetime-section-copy h2 { color: var(--theme-text); }
html[data-theme="dark"] .datetime-note { border-color: var(--theme-border); background: var(--theme-surface); }

@media (max-width: 900px) {
  .admin-sidebar { box-shadow: 12px 0 32px rgba(4, 18, 32, .22); }
  .profile-menu-panel { max-height: min(80vh, 560px); overflow-y: auto; }
}

@media (max-width: 520px) {
  .profile-menu-panel { right: -4px; width: min(300px, calc(100vw - 20px)); }
  .profile-theme-options button { min-height: 40px; }
}

@media print {
  html[data-theme] { color-scheme: light; }
  html[data-theme] body { color: #111827 !important; background: #fff !important; }
}
