/**
 * PEGASUS — tema escuro (Bootstrap 5.3 data-bs-theme="dark" + ajustes customizados).
 */

/* Botão alternar tema */
.pegasus-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: 50%;
  border: 1px solid transparent;
  line-height: 1;
}

.pegasus-theme-toggle .bi {
  font-size: 1.05rem;
}

[data-bs-theme="light"] .pegasus-theme-icon-light,
[data-bs-theme="dark"] .pegasus-theme-icon-dark {
  display: none;
}

.pegasus-theme-toggle-wrap--login {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1050;
}

[data-bs-theme="dark"] .pegasus-theme-toggle {
  color: #f8f9fa;
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
}

[data-bs-theme="light"] .topbar .pegasus-theme-toggle {
  color: var(--pegasus-topbar-icon, #4570B4);
  border-color: rgba(69, 112, 180, 0.25);
  background: rgba(69, 112, 180, 0.08);
}

[data-bs-theme="dark"] .topbar .pegasus-theme-toggle {
  color: #e9ecef;
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
}

[data-bs-theme="light"] .pegasus-theme-toggle-wrap--login .pegasus-theme-toggle {
  color: #4570B4;
  border-color: rgba(69, 112, 180, 0.3);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 2px 8px rgba(30, 58, 95, 0.12);
}

/* Variáveis da topbar / Modo TV no escuro (menu lateral mantém cores da empresa) */
:root {
  --pegasus-tv-bg: #eef1f5;
  --pegasus-tv-bar-bg: #ffffff;
  --pegasus-tv-chip-bg: #ffffff;
  --pegasus-tv-chip-border: #dee2e6;
  --pegasus-tv-chip-text: #495057;
  --pegasus-tv-chip-nome: #212529;
  --aigle-tv-bg: #eef1f5;
  --aigle-tv-bar-bg: #ffffff;
  --aigle-tv-chip-bg: #ffffff;
  --aigle-tv-chip-border: #dee2e6;
  --aigle-tv-chip-text: #495057;
  --aigle-tv-chip-nome: #212529;
}

[data-bs-theme="dark"] {
  --pegasus-topbar-bg: #1e2125;
  --pegasus-topbar-text: #e9ecef;
  --pegasus-topbar-border: #343a40;
  --pegasus-topbar-icon: #9ec5f0;
  --aigle-topbar-bg: #1e2125;
  --aigle-topbar-text: #e9ecef;
  --aigle-topbar-border: #343a40;
  --aigle-topbar-icon: #9ec5f0;
  --pegasus-tv-bg: #121416;
  --pegasus-tv-bar-bg: #1e2125;
  --pegasus-tv-chip-bg: #2b3035;
  --pegasus-tv-chip-border: #495057;
  --pegasus-tv-chip-text: #ced4da;
  --pegasus-tv-chip-nome: #e9ecef;
  --aigle-tv-bg: #121416;
  --aigle-tv-bar-bg: #1e2125;
  --aigle-tv-chip-bg: #2b3035;
  --aigle-tv-chip-border: #495057;
  --aigle-tv-chip-text: #ced4da;
  --aigle-tv-chip-nome: #e9ecef;
  color-scheme: dark;
}

[data-bs-theme="dark"] .main {
  background-color: #121416 !important;
}

[data-bs-theme="dark"] body.pegasus-modo-tv,
[data-bs-theme="dark"] body.pegasus-modo-tv .wrapper,
[data-bs-theme="dark"] body.pegasus-modo-tv .main,
[data-bs-theme="dark"] body.pegasus-modo-tv .content,
[data-bs-theme="dark"] body.pegasus-modo-tv .pegasus-tv-screen,
[data-bs-theme="dark"] #pegasus-tv-screen:fullscreen,
[data-bs-theme="dark"] #pegasus-tv-screen:-webkit-full-screen,
[data-bs-theme="dark"] #pegasus-tv-screen:-moz-full-screen,
[data-bs-theme="dark"] #pegasus-tv-screen:-ms-fullscreen,
[data-bs-theme="dark"] body.aigle-modo-tv,
[data-bs-theme="dark"] body.aigle-modo-tv .wrapper,
[data-bs-theme="dark"] body.aigle-modo-tv .main,
[data-bs-theme="dark"] body.aigle-modo-tv .content,
[data-bs-theme="dark"] body.aigle-modo-tv .aigle-tv-screen,
[data-bs-theme="dark"] #aigle-tv-screen:fullscreen,
[data-bs-theme="dark"] #aigle-tv-screen:-webkit-full-screen,
[data-bs-theme="dark"] #aigle-tv-screen:-moz-full-screen,
[data-bs-theme="dark"] #aigle-tv-screen:-ms-fullscreen {
  background-color: var(--aigle-tv-bg, var(--pegasus-tv-bg, #121416)) !important;
  background: var(--aigle-tv-bg, var(--pegasus-tv-bg, #121416)) !important;
}

[data-bs-theme="dark"] body.pegasus-modo-tv .pegasus-tv-bar,
[data-bs-theme="dark"] body.aigle-modo-tv .aigle-tv-bar {
  background-color: var(--aigle-tv-bar-bg, var(--pegasus-tv-bar-bg, #1e2125)) !important;
}

[data-bs-theme="dark"] body.pegasus-modo-tv .card,
[data-bs-theme="dark"] body.pegasus-modo-tv .card-kpi,
[data-bs-theme="dark"] body.aigle-modo-tv .card,
[data-bs-theme="dark"] body.aigle-modo-tv .card-kpi {
  background: #1e2125 !important;
  border-color: #343a40 !important;
  box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.35) !important;
  color: #e9ecef;
}

[data-bs-theme="dark"] .content .card {
  background: #1e2125;
  border-color: #343a40 !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25) !important;
}

[data-bs-theme="dark"] .content h4,
[data-bs-theme="dark"] .content h5 {
  color: #e9ecef;
}

[data-bs-theme="dark"] .content .form-label {
  color: #ced4da;
}

[data-bs-theme="dark"] .content .form-control,
[data-bs-theme="dark"] .content .form-select {
  background-color: #2b3035;
  border-color: #495057;
  color: #f8f9fa;
}

[data-bs-theme="dark"] .content .form-control:hover,
[data-bs-theme="dark"] .content .form-select:hover {
  border-color: #6c757d;
}

[data-bs-theme="dark"] .content .form-control:focus,
[data-bs-theme="dark"] .content .form-select:focus {
  background-color: #2b3035;
  border-color: #6ea8fe;
  box-shadow: 0 0 0 0.22rem rgba(110, 168, 254, 0.2);
  color: #f8f9fa;
}

[data-bs-theme="dark"] .content .form-control::placeholder {
  color: #868e96;
}

[data-bs-theme="dark"] .content input[type="file"].form-control {
  background-color: #212529;
}

[data-bs-theme="dark"] .content .form-check-label {
  color: #ced4da;
}

[data-bs-theme="dark"] .content .form-check-input {
  border-color: #6c757d;
  background-color: #2b3035;
}

[data-bs-theme="dark"] .pegasus-form-section {
  background: #252a30;
  border-color: #3d444b;
}

[data-bs-theme="dark"] .pegasus-form-section-title {
  color: #9ec5f0;
  border-bottom-color: rgba(158, 197, 240, 0.35);
}

[data-bs-theme="dark"] .content .card-filtro {
  background: #252a30;
  border-color: #3d444b !important;
}

[data-bs-theme="dark"] .content .table {
  --bs-table-bg: transparent;
  --bs-table-color: #e9ecef;
  --bs-table-border-color: #373b3e;
  --bs-table-striped-bg: rgba(255, 255, 255, 0.04);
  --bs-table-striped-color: #e9ecef;
  --bs-table-hover-bg: #2b3035;
  --bs-table-hover-color: #e9ecef;
  --bs-table-active-bg: #343a40;
  --bs-table-active-color: #e9ecef;
}

[data-bs-theme="dark"] .table {
  --bs-table-bg: transparent;
  --bs-table-color: #e9ecef;
  --bs-table-border-color: #373b3e;
  --bs-table-hover-bg: #2b3035;
  --bs-table-hover-color: #e9ecef;
}

[data-bs-theme="dark"] .table > :not(caption) > * > * {
  background-color: var(--bs-table-bg);
  color: var(--bs-table-color);
  border-bottom-color: var(--bs-table-border-color);
  box-shadow: inset 0 0 0 9999px var(--bs-table-bg-state, var(--bs-table-bg));
}

[data-bs-theme="dark"] .content .table thead th,
[data-bs-theme="dark"] .table thead th {
  background-color: #2b3035 !important;
  color: #e9ecef !important;
  border-bottom-color: #495057 !important;
}

[data-bs-theme="dark"] .table-light {
  --bs-table-bg: #2b3035;
  --bs-table-color: #e9ecef;
  --bs-table-border-color: #495057;
}

[data-bs-theme="dark"] .table-light > :not(caption) > * > * {
  --bs-table-bg-state: #2b3035;
  --bs-table-color-state: #e9ecef;
  color: #e9ecef !important;
}

[data-bs-theme="dark"] tr.table-secondary > *,
[data-bs-theme="dark"] .table-secondary > :not(caption) > * > * {
  --bs-table-bg: #343a40;
  --bs-table-bg-state: #343a40;
  --bs-table-color: #ced4da;
  --bs-table-color-state: #ced4da;
  color: #ced4da !important;
}

[data-bs-theme="dark"] .table-hover > tbody > tr:hover > * {
  --bs-table-bg-state: #2b3035;
  --bs-table-color-state: #e9ecef;
  color: #e9ecef !important;
}

[data-bs-theme="dark"] .content .table-hover tbody tr:hover {
  background-color: transparent;
}

[data-bs-theme="dark"] code {
  color: #f5b8d1;
}

[data-bs-theme="dark"] pre,
[data-bs-theme="dark"] pre.bg-light {
  background-color: #1a1d21 !important;
  color: #e9ecef !important;
  border: 1px solid #495057;
}

[data-bs-theme="dark"] .border {
  border-color: #495057 !important;
}

[data-bs-theme="dark"] .bg-light .text-muted,
[data-bs-theme="dark"] .border.rounded .text-muted {
  color: #adb5bd !important;
}

[data-bs-theme="dark"] .form-check-input {
  background-color: #2b3035;
  border-color: #6c757d;
}

[data-bs-theme="dark"] .form-check-input:checked {
  background-color: #4570B4;
  border-color: #4570B4;
}

[data-bs-theme="dark"] .dropdown-menu {
  background-color: #2b3035;
  border-color: #495057;
  color: #e9ecef;
}

[data-bs-theme="dark"] .dropdown-item {
  color: #e9ecef;
}

[data-bs-theme="dark"] .dropdown-item:hover,
[data-bs-theme="dark"] .dropdown-item:focus {
  background-color: #343a40;
  color: #fff;
}

[data-bs-theme="dark"] .modal-content {
  background-color: #1e2125;
  border-color: #495057;
  color: #e9ecef;
}

[data-bs-theme="dark"] .list-group-item {
  background-color: #1e2125;
  border-color: #495057;
  color: #e9ecef;
}

[data-bs-theme="dark"] .pegasus-sort-link:hover {
  color: #9ec5f0;
}

[data-bs-theme="dark"] table.pegasus-grid-js thead th[data-sort]:hover {
  background-color: #2b3035;
}

[data-bs-theme="dark"] .pegasus-grid-footer {
  border-top-color: #373b3e;
}

[data-bs-theme="dark"] .footer {
  background-color: #1a1d21;
  color: #adb5bd;
  border-top-color: #343a40 !important;
}

[data-bs-theme="dark"] .topbar-user-toggle:hover,
[data-bs-theme="dark"] .topbar-user-toggle:focus,
[data-bs-theme="dark"] .topbar-user-toggle.show {
  background: rgba(255, 255, 255, 0.08);
}

[data-bs-theme="dark"] .welcome-message h5,
[data-bs-theme="dark"] .user-info span {
  color: #e9ecef;
}

[data-bs-theme="dark"] .sidebar-minimizer {
  background-color: #2b3035;
  box-shadow: 2px 0 6px rgba(0, 0, 0, 0.4);
}

[data-bs-theme="dark"] .sidebar-minimizer .arrow-icon {
  color: #9ec5f0;
}

[data-bs-theme="dark"] .pegasus-apresentacao-banner {
  background: linear-gradient(90deg, #3d3418 0%, #4a3f1a 100%);
  border-bottom-color: #5c4f1f;
  color: #ffe8a1;
}

[data-bs-theme="dark"] .pegasus-apresentacao-banner .text-muted {
  color: #e6d9a8 !important;
}

[data-bs-theme="dark"] .pegasus-dash-filtros-card .card-header {
  background-color: #252a30 !important;
  border-bottom-color: #373b3e;
  color: #e9ecef;
}

[data-bs-theme="dark"] .pegasus-dash-filtros-resumo {
  color: #adb5bd !important;
}

/* Bootstrap utilitários que forçam fundo claro */
[data-bs-theme="dark"] .bg-white {
  background-color: #252a30 !important;
  color: #e9ecef;
}

[data-bs-theme="dark"] .bg-light {
  background-color: #2b3035 !important;
  color: #e9ecef;
}

[data-bs-theme="dark"] .text-bg-light {
  background-color: #343a40 !important;
  color: #e9ecef !important;
}

[data-bs-theme="dark"] .card-header {
  background-color: #252a30;
  border-bottom-color: #373b3e;
  color: #e9ecef;
}

/* Topbar — reforço (ignora cor clara salva na empresa) */
[data-bs-theme="dark"] .topbar {
  --aigle-topbar-bg: #1e2125;
  --aigle-topbar-text: #e9ecef;
  --aigle-topbar-border: #343a40;
  --aigle-topbar-icon: #9ec5f0;
  background-color: #1e2125 !important;
  background: #1e2125 !important;
  border-bottom-color: #343a40 !important;
  color: #e9ecef !important;
}

[data-bs-theme="dark"] .topbar .text-dark,
[data-bs-theme="dark"] .topbar-left .fw-semibold,
[data-bs-theme="dark"] .topbar-user-nome,
[data-bs-theme="dark"] .topbar-user-toggle {
  color: var(--aigle-topbar-text, #e9ecef) !important;
}

/* Seletor múltiplo de lojas */
[data-bs-theme="dark"] .pegasus-lojas-multi-toggle {
  background-color: #2b3035 !important;
  border-color: #495057 !important;
  color: #f8f9fa !important;
}

[data-bs-theme="dark"] .pegasus-lojas-multi-chevron {
  color: #adb5bd;
}

[data-bs-theme="dark"] .pegasus-lojas-multi-panel {
  background: #2b3035 !important;
  border-color: #495057 !important;
  box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.45);
}

[data-bs-theme="dark"] .pegasus-lojas-multi-toolbar {
  background: #252a30 !important;
  border-bottom-color: #495057 !important;
}

[data-bs-theme="dark"] .pegasus-lojas-multi-toolbar .form-control {
  background-color: #1e2125;
  border-color: #495057;
  color: #f8f9fa;
}

[data-bs-theme="dark"] .pegasus-lojas-multi-item {
  color: #e9ecef;
}

[data-bs-theme="dark"] .pegasus-lojas-multi-item:hover,
[data-bs-theme="dark"] .pegasus-lojas-multi-item:focus-within {
  background: #343a40 !important;
}

[data-bs-theme="dark"] .pegasus-lojas-multi-limpar {
  color: #9ec5f0 !important;
}

[data-bs-theme="dark"] .pegasus-lojas-multi-vazio {
  color: #868e96 !important;
}

[data-bs-theme="dark"] .config-tema-preview {
  background: #2b3035 !important;
  border-color: #495057 !important;
}

[data-bs-theme="dark"] .dropdown-header .text-dark {
  color: #f8f9fa !important;
}

/* Login / recuperar senha / erro público */
[data-bs-theme="dark"] body.login-page {
  background-color: #0f1216;
  background-image: linear-gradient(160deg, #0f1216 0%, #1a2332 50%, #0f1216 100%);
}

[data-bs-theme="dark"] body.login-page .login-card,
[data-bs-theme="dark"] body.login-page .pegasus-erro-card {
  background: #1e2125;
  border-color: #343a40;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.2),
    0 8px 24px rgba(0, 0, 0, 0.35);
}

[data-bs-theme="dark"] .login-empresa-nome {
  color: #e9ecef;
}

[data-bs-theme="dark"] .login-brand-title {
  color: #9ec5f0;
}

[data-bs-theme="dark"] .rec-steps li {
  color: #6c757d;
}

[data-bs-theme="dark"] .rec-steps li::before {
  background: #495057;
  color: #adb5bd;
}

[data-bs-theme="dark"] .rec-steps li.active {
  color: #9ec5f0;
}

[data-bs-theme="dark"] .rec-steps li.active::before {
  background: #4570B4;
  color: #fff;
}

[data-bs-theme="dark"] .rec-steps li.done {
  color: #75b798;
}

[data-bs-theme="dark"] .rec-steps li.done::before {
  background: #198754;
}

[data-bs-theme="dark"] .pegasus-erro-wrap .pegasus-erro-card.border {
  border-color: #343a40 !important;
}

/* ===== Portal do cliente (dashboard, OS, cadastro) ===== */
[data-bs-theme="dark"] .dash-pill,
[data-bs-theme="dark"] .dash-os-box,
[data-bs-theme="dark"] .os-stat,
[data-bs-theme="dark"] .os-card,
[data-bs-theme="dark"] .ficha-card,
[data-bs-theme="dark"] .ficha-doc-item,
[data-bs-theme="dark"] .doc-card {
  background: #1e2125;
  border-color: #3d4349;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
  color: #e9ecef;
}

[data-bs-theme="dark"] .dash-pill h4,
[data-bs-theme="dark"] .dash-os-box .fw-bold,
[data-bs-theme="dark"] .os-stat .num,
[data-bs-theme="dark"] .ficha-valor,
[data-bs-theme="dark"] .content h3.fw-bold {
  color: #f8f9fa;
}

[data-bs-theme="dark"] .dash-pill .text-muted,
[data-bs-theme="dark"] .dash-os-box .text-muted,
[data-bs-theme="dark"] .ficha-label,
[data-bs-theme="dark"] .content .text-muted {
  color: #adb5bd !important;
}

[data-bs-theme="dark"] .dash-os-valor,
[data-bs-theme="dark"] .os-valor,
[data-bs-theme="dark"] .os-box-valor .valor {
  color: #9ec5f0;
}

[data-bs-theme="dark"] .os-box-valor {
  background: linear-gradient(135deg, #1a2744 0%, #1e2125 100%);
  border-color: #5a8fd4;
}

[data-bs-theme="dark"] .os-box-aceitar {
  background: #2a2418;
  border-color: #c9a227;
  color: #f8f9fa;
}

[data-bs-theme="dark"] .os-assinatura-wrap {
  background: #2b3035;
  border-color: #495057;
}

[data-bs-theme="dark"] .os-assinatura-preview {
  background: #fff;
  border-color: #495057;
}

[data-bs-theme="dark"] .content .table > :not(caption) > * > * {
  background-color: transparent;
  color: #dee2e6;
  border-color: #343a40;
}

[data-bs-theme="dark"] .content .table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.04);
}

[data-bs-theme="dark"] .content .border.rounded-3 {
  background: #1e2125;
  border-color: #3d4349 !important;
  color: #adb5bd;
}

[data-bs-theme="dark"] .dash-card-resumo .btn-light,
[data-bs-theme="dark"] .dash-os-header .btn-light {
  background: rgba(255, 255, 255, 0.95);
  color: #212529;
  border-color: transparent;
}

[data-bs-theme="dark"] .os-timeline {
  border-left-color: #495057;
}

[data-bs-theme="dark"] .cad-hero .badge.bg-light {
  background: rgba(255, 255, 255, 0.92) !important;
  color: #212529 !important;
}
