:root[data-theme="light"] {
  color-scheme: light;
  --acs-page: #eef2f7;
  --acs-surface: #ffffff;
  --acs-surface-2: #f8fafc;
  --acs-surface-3: #eef2f7;
  --acs-border: #cbd5e1;
  --acs-border-soft: #dbe4ef;
  --acs-text: #172033;
  --acs-muted: #64748b;
  --acs-accent: #2468c9;
  --acs-accent-soft: #dcecff;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --acs-page: #080f1c;
  --acs-surface: #101827;
  --acs-surface-2: #162132;
  --acs-surface-3: #1d2939;
  --acs-border: #344258;
  --acs-border-soft: #263449;
  --acs-text: #e7edf6;
  --acs-muted: #9aa9bd;
  --acs-accent: #4b8fe2;
  --acs-accent-soft: #183a66;
}

.technicianLoginCard {
  position: relative;
}

.themeSwitcher {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  width: 100%;
  margin-top: 7px;
}

.themeSwitcherLabel {
  color: var(--acs-muted);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.themeSwitcherOptions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--acs-border-soft);
  border-radius: 6px;
  background: var(--acs-surface-3);
}

.themeOption {
  width: auto !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 5px 6px !important;
  border: 0 !important;
  border-radius: 4px !important;
  background: transparent !important;
  color: var(--acs-muted) !important;
  font-size: 8px !important;
  line-height: 1 !important;
  box-shadow: none !important;
}

.themeOption.active {
  background: var(--acs-surface) !important;
  color: var(--acs-text) !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .18) !important;
}

.themeOption:focus-visible {
  outline: 2px solid var(--acs-accent) !important;
  outline-offset: 1px;
}

.loginThemeSwitcher {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 142px;
  margin: 0;
}

.loginThemeSwitcher .themeSwitcherLabel {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* O tema claro inclui o chat, que antes permanecia sempre escuro. */
:root[data-theme="light"] .sidebarChat {
  border-color: #cbd5e1 !important;
  background: #ffffff !important;
  color: #172033 !important;
}

:root[data-theme="light"] .chatHeader,
:root[data-theme="light"] .chatComposer {
  border-color: #dbe4ef !important;
  background: #f8fafc !important;
}

:root[data-theme="light"] .chatHeader strong { color: #172033 !important; }
:root[data-theme="light"] .chatHeader div > span,
:root[data-theme="light"] .chatSessionSwitcherHead,
:root[data-theme="light"] .chatSessionsEmpty,
:root[data-theme="light"] .chatSessionIdentity small { color: #64748b !important; }
:root[data-theme="light"] .chatSessionSwitcher {
  border-color: #dbe4ef !important;
  background: #f1f5f9 !important;
}
:root[data-theme="light"] .chatSessionTabs { scrollbar-color: #94a3b8 #f1f5f9 !important; }
:root[data-theme="light"] .chatSessionTab {
  border-color: #d5deea !important;
  background: #ffffff !important;
  color: #273244 !important;
}
:root[data-theme="light"] .chatSessionTab:hover { background: #eef5ff !important; }
:root[data-theme="light"] .chatSessionTab.active {
  border-color: #3b82f6 !important;
  background: #dbeafe !important;
  color: #1e3a5f !important;
}
:root[data-theme="light"] .chatMessages {
  background: #f8fafc !important;
  scrollbar-color: #94a3b8 #f8fafc !important;
}
:root[data-theme="light"] .chatEmpty {
  border-color: #cbd5e1 !important;
  color: #64748b !important;
}
:root[data-theme="light"] .chatMessage {
  border: 0 !important;
  background: transparent !important;
  color: #172033 !important;
  box-shadow: none !important;
}
:root[data-theme="light"] .chatMessageTime { color: #7b8798 !important; }
:root[data-theme="light"] .chatMessage.mine .chatMessageSender { color: #dc2626 !important; }
:root[data-theme="light"] .chatMessage.theirs .chatMessageSender { color: #2563eb !important; }
:root[data-theme="light"] .chatComposer textarea {
  border-color: #cbd5e1 !important;
  background: #ffffff !important;
  color: #172033 !important;
}
:root[data-theme="light"] .chatComposer textarea::placeholder { color: #7b8798 !important; }

/* Tema escuro do console. A imagem remota continua sobre fundo neutro escuro nos dois temas. */
:root[data-theme="dark"],
:root[data-theme="dark"] body,
:root[data-theme="dark"] .layout,
:root[data-theme="dark"] .content,
:root[data-theme="dark"] .acsMainSplit.acsSplitActive {
  background: var(--acs-page) !important;
  color: var(--acs-text) !important;
}

:root[data-theme="dark"] .sidebar {
  border-color: var(--acs-border) !important;
  background: #0d1625 !important;
  color: var(--acs-text) !important;
}
:root[data-theme="dark"] .sidebar h2,
:root[data-theme="dark"] .technicianIdentityText strong { color: var(--acs-text) !important; }
:root[data-theme="dark"] .sidebar label,
:root[data-theme="dark"] .technicianIdentityText span { color: var(--acs-muted) !important; }
:root[data-theme="dark"] .help {
  background: #162132 !important;
  color: #9aa9bd !important;
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea {
  border-color: var(--acs-border) !important;
  background: #0d1625 !important;
  color: var(--acs-text) !important;
}
:root[data-theme="dark"] input::placeholder,
:root[data-theme="dark"] textarea::placeholder { color: #718198 !important; }

:root[data-theme="dark"] .queueCard,
:root[data-theme="dark"] .queueCardHeader,
:root[data-theme="dark"] .sessionToolbar,
:root[data-theme="dark"] .emptyState,
:root[data-theme="dark"] .sessionCard,
:root[data-theme="dark"] .acsMainSplit.acsSplitActive .acsQueuePane {
  border-color: var(--acs-border) !important;
  background: var(--acs-surface) !important;
  color: var(--acs-text) !important;
  box-shadow: none !important;
}
:root[data-theme="dark"] .queueCardHeader { border-bottom-color: var(--acs-border) !important; }
:root[data-theme="dark"] .contentHeader h1,
:root[data-theme="dark"] .sessionTop h3 { color: var(--acs-text) !important; }
:root[data-theme="dark"] .contentHeader p,
:root[data-theme="dark"] .company,
:root[data-theme="dark"] .remoteMeta { color: var(--acs-muted) !important; }
:root[data-theme="dark"] .sessionFilter,
:root[data-theme="dark"] .status,
:root[data-theme="dark"] .actionWait {
  border-color: var(--acs-border) !important;
  background: var(--acs-surface-3) !important;
  color: #cbd5e1 !important;
}
:root[data-theme="dark"] .sessionFilter.active {
  border-color: var(--acs-accent) !important;
  background: var(--acs-accent-soft) !important;
  color: #dbeafe !important;
}
:root[data-theme="dark"] .count { background: #183a66 !important; color: #bfdbfe !important; }
:root[data-theme="dark"] .grid div,
:root[data-theme="dark"] .problem {
  background: #162132 !important;
  color: #d4deea !important;
}
:root[data-theme="dark"] .grid span { color: #8fa0b5 !important; }
:root[data-theme="dark"] .sessionTableWrap { border-color: var(--acs-border) !important; }
:root[data-theme="dark"] .sessionTable tbody tr,
:root[data-theme="dark"] .sessionTable tbody tr:nth-child(even) {
  background: #101827 !important;
  color: #dce4ef !important;
}
:root[data-theme="dark"] .sessionTable tbody tr:nth-child(even) { background: #142033 !important; }
:root[data-theme="dark"] .sessionTable tbody tr:hover { background: #1c3554 !important; }
:root[data-theme="dark"] .sessionTable tbody tr.selectedSessionRow {
  background: #183a66 !important;
  box-shadow: inset 3px 0 #60a5fa !important;
}
:root[data-theme="dark"] .cnpjCell { color: #aebcd0 !important; }
:root[data-theme="dark"] .actionChat,
:root[data-theme="dark"] .actionClose {
  background: #101827 !important;
}
:root[data-theme="dark"] .actionTransfer {
  border-color: #46566c !important;
  background: #263449 !important;
  color: #d5deea !important;
}
:root[data-theme="dark"] .queueResizeHandle { background: #172235 !important; }
:root[data-theme="dark"] .queueResizeHandle::before { background: #516176 !important; }
:root[data-theme="dark"] .queueResizeGrip {
  background: #718198 !important;
  box-shadow: 0 0 0 4px #172235 !important;
}
:root[data-theme="dark"] .remoteHelp {
  border-color: #2b3748 !important;
  background: #111b2b !important;
  color: #9aa9bd !important;
}

:root[data-theme="dark"] .supportBrowserTab.active {
  border-color: #4b6079 !important;
  background: #18283d !important;
  color: #edf3fa !important;
}
:root[data-theme="dark"] .supportBrowserTab.active .supportTabLabel small { color: #aab7c8 !important; }

/* Gerenciador de arquivos no tema escuro. */
:root[data-theme="dark"] .fileManagerPanel,
:root[data-theme="dark"] .acsMainSplit.acsSplitActive #remoteWorkspace #fileManagerPanel,
:root[data-theme="dark"] .dualFilePanes { background: #0b1320 !important; }
:root[data-theme="dark"] .dualFileManagerHeader,
:root[data-theme="dark"] .filePaneTitle,
:root[data-theme="dark"] .filePaneNav,
:root[data-theme="dark"] .fileManagerFoot {
  border-color: var(--acs-border) !important;
  background: #162132 !important;
}
:root[data-theme="dark"] .dualFileManagerHeader strong,
:root[data-theme="dark"] .filePaneTitle strong { color: var(--acs-text) !important; }
:root[data-theme="dark"] .dualFileManagerHeader div > span,
:root[data-theme="dark"] .dualFileManagerLegend,
:root[data-theme="dark"] .filePaneTitle div > span,
:root[data-theme="dark"] .fileProgressText { color: var(--acs-muted) !important; }
:root[data-theme="dark"] .filePane,
:root[data-theme="dark"] .filePaneTableWrap {
  border-color: var(--acs-border) !important;
  background: #0f1928 !important;
}
:root[data-theme="dark"] .filePaneNav button,
:root[data-theme="dark"] .filePanePath,
:root[data-theme="dark"] .filePaneTitle button,
:root[data-theme="dark"] .transferArrow {
  border-color: #46566c !important;
  background: #1a2739 !important;
  color: #dce4ef !important;
}
:root[data-theme="dark"] .filePaneNav button:hover:not(:disabled),
:root[data-theme="dark"] .transferArrow:hover:not(:disabled) { background: #243650 !important; }
:root[data-theme="dark"] .filePaneTable thead th {
  border-color: #3b4a5f !important;
  background: #1d2939 !important;
  color: #dce4ef !important;
}
:root[data-theme="dark"] .filePaneTable tbody td {
  border-color: #223047 !important;
  color: #d0dae7 !important;
}
:root[data-theme="dark"] .filePaneTable tbody tr:hover { background: #1c3554 !important; }
:root[data-theme="dark"] .filePaneTable tbody tr.selected {
  background: #183a66 !important;
  outline-color: #4b8fe2 !important;
}
:root[data-theme="dark"] .fileTransferRail {
  border-color: var(--acs-border) !important;
  background: #111b2b !important;
}
:root[data-theme="dark"] .fileProgress { background: #29384d !important; }

/* Login, recuperação de senha e formulários do Movidesk. */
:root[data-theme="dark"] .technicianLoginGate {
  background: linear-gradient(145deg, #070d18 0%, #101827 52%, #0b1422 100%) !important;
}
:root[data-theme="dark"] .technicianLoginCard,
:root[data-theme="dark"] .passwordRecoveryCard,
:root[data-theme="dark"] .movideskTicketDialog,
:root[data-theme="dark"] .movideskTicketDialogHeader {
  border-color: var(--acs-border) !important;
  background: var(--acs-surface) !important;
  color: var(--acs-text) !important;
}
:root[data-theme="dark"] .loginBrandText h1,
:root[data-theme="dark"] .passwordRecoveryHeader h2,
:root[data-theme="dark"] .movideskTicketDialogHeader h2 { color: var(--acs-text) !important; }
:root[data-theme="dark"] .loginBrandText p,
:root[data-theme="dark"] .passwordRecoveryHeader p,
:root[data-theme="dark"] .passwordRecoveryHint,
:root[data-theme="dark"] .movideskTicketCustomer { color: var(--acs-muted) !important; }
:root[data-theme="dark"] .technicianLoginForm label,
:root[data-theme="dark"] .passwordRecoveryForm label,
:root[data-theme="dark"] .movideskTicketField label,
:root[data-theme="dark"] .movideskTicketField > span { color: #d7e0eb !important; }
:root[data-theme="dark"] .technicianLoginForm input,
:root[data-theme="dark"] .passwordRecoveryForm input,
:root[data-theme="dark"] .legacyAccessGrid input,
:root[data-theme="dark"] .movideskTicketField input,
:root[data-theme="dark"] .movideskTicketField select,
:root[data-theme="dark"] .movideskTicketField textarea {
  border-color: var(--acs-border) !important;
  background: #0d1625 !important;
  color: var(--acs-text) !important;
}
:root[data-theme="dark"] .legacyAccess { border-color: var(--acs-border) !important; }
:root[data-theme="dark"] .legacyAccess summary,
:root[data-theme="dark"] .legacyAccessGrid label { color: var(--acs-muted) !important; }
:root[data-theme="dark"] .passwordRecoveryClose,
:root[data-theme="dark"] .movideskTicketClose,
:root[data-theme="dark"] .movideskTicketField input[readonly],
:root[data-theme="dark"] .movideskTicketState {
  background: var(--acs-surface-3) !important;
  color: #cbd5e1 !important;
}
:root[data-theme="dark"] .movideskPendingEmpty {
  border-color: var(--acs-border) !important;
  background: var(--acs-surface-2) !important;
  color: var(--acs-muted) !important;
}
:root[data-theme="dark"] .movideskPendingItem {
  border-color: #a16207 !important;
  background: #2d2412 !important;
}
:root[data-theme="dark"] .movideskPendingItem strong { color: #fde68a !important; }
:root[data-theme="dark"] .movideskPendingMeta { color: #facc15 !important; }
:root[data-theme="dark"] .movideskPendingReason { color: #cbd5e1 !important; }
:root[data-theme="dark"] .movideskPendingShortcut,
:root[data-theme="dark"] .movideskPendingButton {
  border-color: #a16207 !important;
  background: #2d2412 !important;
  color: #fde68a !important;
}

@media (max-width: 520px) {
  .loginThemeSwitcher {
    position: static;
    width: 100%;
    margin: 0 0 14px;
  }
}
