/* ========================================================
   Verçoza Transportes - Estilos Personalizados e Identidade Visual
   Cores Oficiais extraídas do site vercoza.com.br e logomarca
   ======================================================== */

:root {
  --vercoza-navy: #0b132b;
  --vercoza-navy-light: #1c2541;
  --vercoza-blue: #42b3e5;
  --vercoza-blue-hover: #3598c4;
  --vercoza-blue-dark: #0284c7;
  --vercoza-orange: #ea580c;
  --vercoza-amber: #f59e0b;
  --vercoza-slate: #0f172a;
  --vercoza-slate-card: #1e293b;
  --vercoza-border: #334155;
  --vercoza-light-bg: #f8fafc;
}

/* Tipografia e Base */
html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #0f172a;
  background-color: var(--vercoza-light-bg);
  overflow-x: hidden;
}

h1, h2, h3, h4, .font-heading {
  font-family: 'Montserrat', 'Inter', sans-serif;
  letter-spacing: -0.02em;
}

/* Barra de rolagem personalizada industrial */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--app-surface-secondary, #0b132b);
}
::-webkit-scrollbar-thumb {
  background: var(--app-border-strong, #334155);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #42b3e5;
}

/* Gradientes e Fundos Industriais */
.bg-vercoza-navy {
  background-color: var(--vercoza-navy);
}

.bg-vercoza-navy-light {
  background-color: var(--vercoza-navy-light);
}

.bg-vercoza-blue {
  background-color: var(--vercoza-blue);
}

.text-vercoza-blue {
  color: var(--vercoza-blue);
}

.border-vercoza-blue {
  border-color: var(--vercoza-blue);
}

.bg-vercoza-orange {
  background-color: var(--vercoza-orange);
}

.text-vercoza-orange {
  color: var(--vercoza-orange);
}

.industrial-grid {
  background-image: radial-gradient(rgba(66, 179, 229, 0.12) 1px, transparent 1px);
  background-size: 28px 28px;
}

.hero-overlay {
  background: linear-gradient(135deg, rgba(11, 19, 43, 0.94) 0%, rgba(15, 23, 42, 0.88) 50%, rgba(2, 132, 199, 0.75) 100%);
}

.hero-slider-overlay {
  background: linear-gradient(to right, rgba(11, 19, 43, 0.95) 0%, rgba(11, 19, 43, 0.75) 55%, rgba(11, 19, 43, 0.4) 100%);
}

/* Faixa de Sinalização de Segurança (Safety Stripes) */
.safety-stripe-bar {
  height: 6px;
  background: repeating-linear-gradient(
    -45deg,
    #f59e0b,
    #f59e0b 14px,
    #0b132b 14px,
    #0b132b 28px
  );
}

.safety-stripe-subtle {
  background: repeating-linear-gradient(
    -45deg,
    rgba(245, 158, 11, 0.15),
    rgba(245, 158, 11, 0.15) 10px,
    transparent 10px,
    transparent 20px
  );
}

/* Botão Flutuante de WhatsApp */
.whatsapp-float {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 999;
  box-shadow: 0 10px 25px -5px rgba(37, 211, 102, 0.5);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.whatsapp-float:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 20px 30px -5px rgba(37, 211, 102, 0.6);
}

.pulse-ring {
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 9999px;
  border: 2px solid #25d366;
  animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
  pointer-events: none;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 0; }
  100% { transform: scale(1.2); opacity: 0; }
}

/* Transições suaves */
.card-hover {
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.card-hover:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 30px -10px rgba(11, 19, 43, 0.2);
  border-color: var(--vercoza-blue);
}

/* Efeito de zoom de imagem */
.img-zoom-container {
  overflow: hidden;
}

.img-zoom-container img {
  transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

.img-zoom-container:hover img {
  transform: scale(1.08);
}

/* Modal Lightbox & Renderização de Alta Definição */
.lightbox-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background-color: rgba(11, 19, 43, 0.96);
  backdrop-filter: blur(10px);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.lightbox-modal.active {
  display: flex;
}

.lightbox-image-render {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  object-fit: contain;
}

/* Responsividade Mobile (< 768px) */
@media (max-width: 767.98px) {
  .top-info-bar {
    display: none !important;
  }
}


/* ============================================================================
   SISTEMA CENTRALIZADO DE TEMAS SEMÂNTICOS (LIGHT MODE & DARK MODE)
   Arquitetura baseada em:
   - Bootstrap 5.3 Color Modes (data-theme no <html>)
   - shadcn/ui Theming (pares semânticos background/foreground, card, muted, border, input)
   - daisyUI Themes (hierarquia de superfícies surface / surface-secondary / card)
   ============================================================================ */

/* ===================================================
   1. TOKENS SEMÂNTICOS — TEMA ESCURO (DARK MODE)
   =================================================== */
:root,
html[data-theme="dark"],
html.dark,
body.dark-theme {
  --app-background: #0a1128;
  --app-foreground: #f8fafc;
  --app-surface: #1c2541;
  --app-surface-secondary: #111827;
  --app-card: #1c2541;
  --app-card-foreground: #f8fafc;
  --app-muted: #151e36;
  --app-muted-foreground: #94a3b8;
  --app-border: #1e293b;
  --app-border-strong: #334155;
  --app-input: #0f172a;
  --app-input-border: #334155;
  --app-input-foreground: #f8fafc;
  --app-primary: #0284c7;
  --app-primary-foreground: #ffffff;
  --app-secondary: #1e293b;
  --app-secondary-foreground: #e2e8f0;
  --app-success: #10b981;
  --app-warning: #f59e0b;
  --app-danger: #ef4444;
  --app-info: #38b6ff;
  --app-overlay: rgba(2, 6, 23, 0.78);
  --app-shadow: 0 10px 25px -5px rgba(2, 6, 23, 0.55);
  --app-sidebar: #0b132b;
  --app-sidebar-foreground: #e2e8f0;
  --app-table-header: #111827;
  --app-table-stripe: #172039;
  --app-table-hover: #232d4d;
  --app-modal-background: #1c2541;
  --app-modal-foreground: #f8fafc;
  --app-focus-ring: rgba(56, 182, 255, 0.35);

  /* Aliases retrocompatíveis (--theme-* e --bg-*) */
  --theme-bg: var(--app-background);
  --theme-sidebar: var(--app-sidebar);
  --theme-card: var(--app-card);
  --theme-card-sub: var(--app-surface-secondary);
  --theme-border: var(--app-border);
  --theme-border-strong: var(--app-border-strong);
  --theme-text-main: var(--app-foreground);
  --theme-text-muted: var(--app-muted-foreground);
  --theme-input-bg: var(--app-input);
  --theme-input-border: var(--app-input-border);
  --theme-input-text: var(--app-input-foreground);
  --theme-table-stripe: var(--app-table-stripe);
  --theme-hover: var(--app-table-hover);

  --bg-main: var(--app-background);
  --bg-sidebar: var(--app-sidebar);
  --bg-card: var(--app-card);
  --bg-card-secondary: var(--app-surface-secondary);
  --bg-hover: var(--app-table-hover);
  --text-primary: var(--app-foreground);
  --text-secondary: var(--app-muted-foreground);
  --border-color: var(--app-border);
  --input-bg: var(--app-input);
  --input-border: var(--app-input-border);
  --input-text: var(--app-input-foreground);
  --table-stripe: var(--app-table-stripe);
}

/* ===================================================
   2. TOKENS SEMÂNTICOS — TEMA CLARO (LIGHT MODE)
   =================================================== */
html[data-theme="light"],
html.light,
html.theme-light,
body.light-theme {
  --app-background: #f8fafc;
  --app-foreground: #0f172a;
  --app-surface: #ffffff;
  --app-surface-secondary: #f1f5f9;
  --app-card: #ffffff;
  --app-card-foreground: #0f172a;
  --app-muted: #f1f5f9;
  --app-muted-foreground: #475569;
  --app-border: #e2e8f0;
  --app-border-strong: #cbd5e1;
  --app-input: #ffffff;
  --app-input-border: #cbd5e1;
  --app-input-foreground: #0f172a;
  --app-primary: #0284c7;
  --app-primary-foreground: #ffffff;
  --app-secondary: #f1f5f9;
  --app-secondary-foreground: #1e293b;
  --app-success: #059669;
  --app-warning: #d97706;
  --app-danger: #dc2626;
  --app-info: #0284c7;
  --app-overlay: rgba(2, 6, 23, 0.78);
  --app-shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --app-sidebar: #ffffff;
  --app-sidebar-foreground: #334155;
  --app-table-header: #f1f5f9;
  --app-table-stripe: #f8fafc;
  --app-table-hover: #f1f5f9;
  --app-modal-background: #ffffff;
  --app-modal-foreground: #0f172a;
  --app-focus-ring: rgba(2, 132, 199, 0.28);

  /* Aliases retrocompatíveis (--theme-* e --bg-*) */
  --theme-bg: var(--app-background);
  --theme-sidebar: var(--app-sidebar);
  --theme-card: var(--app-card);
  --theme-card-sub: var(--app-surface-secondary);
  --theme-border: var(--app-border);
  --theme-border-strong: var(--app-border-strong);
  --theme-text-main: var(--app-foreground);
  --theme-text-muted: var(--app-muted-foreground);
  --theme-input-bg: var(--app-input);
  --theme-input-border: var(--app-input-border);
  --theme-input-text: var(--app-input-foreground);
  --theme-table-stripe: var(--app-table-stripe);
  --theme-hover: var(--app-table-hover);

  --bg-main: var(--app-background);
  --bg-sidebar: var(--app-sidebar);
  --bg-card: var(--app-card);
  --bg-card-secondary: var(--app-surface-secondary);
  --bg-hover: var(--app-table-hover);
  --text-primary: var(--app-foreground);
  --text-secondary: var(--app-muted-foreground);
  --border-color: var(--app-border);
  --input-bg: var(--app-input);
  --input-border: var(--app-input-border);
  --input-text: var(--app-input-foreground);
  --table-stripe: var(--app-table-stripe);
}

/* ===================================================
   3. CLASSES SEMÂNTICAS REUTILIZÁVEIS DE COMPONENTES
   =================================================== */
.app-bg {
  background-color: var(--app-background) !important;
  color: var(--app-foreground) !important;
}

.app-surface {
  background-color: var(--app-surface) !important;
  color: var(--app-card-foreground) !important;
  border-color: var(--app-border) !important;
}

.app-surface-secondary {
  background-color: var(--app-surface-secondary) !important;
  color: var(--app-foreground) !important;
  border-color: var(--app-border) !important;
}

.app-card {
  background-color: var(--app-card) !important;
  color: var(--app-card-foreground) !important;
  border: 1px solid var(--app-border) !important;
  box-shadow: var(--app-shadow);
}

.app-muted {
  background-color: var(--app-muted) !important;
  color: var(--app-muted-foreground) !important;
}

.app-input {
  background-color: var(--app-input) !important;
  color: var(--app-input-foreground) !important;
  border: 1px solid var(--app-input-border) !important;
}

.app-input:focus {
  border-color: var(--app-primary) !important;
  box-shadow: 0 0 0 3px var(--app-focus-ring) !important;
  outline: none !important;
}

/* ===================================================
   4. ESTRUTURA BASE DO SISTEMA (BODY, MAIN, HEADER, FOOTER, SIDEBAR)
   =================================================== */
body.admin-body,
body.dfe-body,
body.login-body,
body.admin-body main,
body.dfe-body main,
body.admin-body aside,
body.dfe-body aside,
body.admin-body header,
body.dfe-body header,
body.admin-body footer,
body.dfe-body footer {
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

body.admin-body,
body.dfe-body,
body.login-body {
  background-color: var(--app-background) !important;
  color: var(--app-foreground) !important;
}

body.admin-body main,
body.dfe-body main {
  background-color: var(--app-background) !important;
  color: var(--app-foreground) !important;
}

body.admin-body main > header,
body.dfe-body main > header {
  background-color: var(--app-surface) !important;
  border-bottom: 1px solid var(--app-border) !important;
  color: var(--app-foreground) !important;
}

body.admin-body footer,
body.dfe-body footer,
body.login-body footer {
  background-color: var(--app-surface) !important;
  border-top: 1px solid var(--app-border) !important;
  color: var(--app-muted-foreground) !important;
}

/* Sidebars (#admin-sidebar & #dfe-sidebar) e Topbars Mobile */
body.admin-body aside#admin-sidebar,
body.dfe-body aside#dfe-sidebar {
  background-color: var(--app-sidebar) !important;
  border-right: 1px solid var(--app-border) !important;
  color: var(--app-sidebar-foreground) !important;
}

/* Ajustes da Sidebar e Topbar Mobile no Modo Claro */
html[data-theme="light"] body.admin-body > div.lg\:hidden,
html[data-theme="light"] body.dfe-body > div.lg\:hidden {
  background-color: var(--app-surface) !important;
  color: var(--app-foreground) !important;
  border-bottom: 1px solid var(--app-border) !important;
}

html[data-theme="light"] body.admin-body > div.lg\:hidden span.text-white,
html[data-theme="light"] body.dfe-body > div.lg\:hidden span.text-white,
html[data-theme="light"] body.admin-body > div.lg\:hidden button,
html[data-theme="light"] body.dfe-body > div.lg\:hidden button {
  color: var(--app-foreground) !important;
}

html[data-theme="light"] aside#admin-sidebar > div,
html[data-theme="light"] aside#dfe-sidebar > div {
  background-color: var(--app-surface-secondary) !important;
  border-color: var(--app-border) !important;
}

html[data-theme="light"] aside#admin-sidebar h1,
html[data-theme="light"] aside#dfe-sidebar h1,
html[data-theme="light"] aside#admin-sidebar .text-white:not(.bg-vercoza-blue *),
html[data-theme="light"] aside#dfe-sidebar .text-white:not(.bg-vercoza-blue *) {
  color: var(--app-foreground) !important;
}

html[data-theme="light"] aside#admin-sidebar nav a:not(.bg-vercoza-blue):not(.sidebar-dfe-btn),
html[data-theme="light"] aside#dfe-sidebar nav a:not(.bg-vercoza-blue) {
  color: var(--app-sidebar-foreground) !important;
}

html[data-theme="light"] aside#admin-sidebar nav a:not(.bg-vercoza-blue):not(.sidebar-dfe-btn):hover,
html[data-theme="light"] aside#dfe-sidebar nav a:not(.bg-vercoza-blue):hover {
  background-color: var(--app-surface-secondary) !important;
  color: var(--app-primary) !important;
}

html[data-theme="light"] aside#admin-sidebar nav a.bg-vercoza-blue,
html[data-theme="light"] aside#dfe-sidebar nav a.bg-vercoza-blue {
  background-color: var(--app-primary) !important;
  color: #ffffff !important;
}

html[data-theme="light"] aside#admin-sidebar nav a.bg-vercoza-blue span,
html[data-theme="light"] aside#admin-sidebar nav a.bg-vercoza-blue i,
html[data-theme="light"] aside#dfe-sidebar nav a.bg-vercoza-blue span,
html[data-theme="light"] aside#dfe-sidebar nav a.bg-vercoza-blue i {
  color: #ffffff !important;
}

/* ===================================================
   5. SISTEMA GLOBAL E DEFINITIVO DE MODAIS E BACKDROPS
   =================================================== */
body.vercoza-modal-open {
  overflow: hidden !important;
}

/* 5.1. OVERLAY EXTERNO (BACKDROP): Sempre escuro semitransparente em ambos os temas */
.vercoza-modal-backdrop,
body.admin-body div.fixed.inset-0[id*="modal"]:not(#service-modal),
body.dfe-body div.fixed.inset-0[id*="modal"]:not(#service-modal),
html[data-theme="light"] .vercoza-modal-backdrop,
html[data-theme="dark"] .vercoza-modal-backdrop,
html[data-theme="light"] body.admin-body div.fixed.inset-0[id*="modal"]:not(#service-modal),
html[data-theme="dark"] body.admin-body div.fixed.inset-0[id*="modal"]:not(#service-modal),
html[data-theme="light"] body.dfe-body div.fixed.inset-0[id*="modal"]:not(#service-modal),
html[data-theme="dark"] body.dfe-body div.fixed.inset-0[id*="modal"]:not(#service-modal) {
  background-color: var(--app-overlay, rgba(2, 6, 23, 0.78)) !important;
  background-image: none !important;
  backdrop-filter: blur(6px) !important;
  -webkit-backdrop-filter: blur(6px) !important;
}

/* 5.2. CAIXA INTERNA DO MODAL (DIALOG): Respeita o tema ativo */
.vercoza-modal-backdrop > .vercoza-modal-dialog,
.vercoza-modal-backdrop > div,
body.admin-body div.fixed.inset-0[id*="modal"]:not(#service-modal) > div,
body.dfe-body div.fixed.inset-0[id*="modal"]:not(#service-modal) > div {
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  border-radius: 1rem;
  background-color: var(--app-modal-background) !important;
  color: var(--app-modal-foreground) !important;
}

html[data-theme="dark"] .vercoza-modal-backdrop > .vercoza-modal-dialog,
html[data-theme="dark"] .vercoza-modal-backdrop > div,
html[data-theme="dark"] body.admin-body div.fixed.inset-0[id*="modal"]:not(#service-modal) > div,
html[data-theme="dark"] body.dfe-body div.fixed.inset-0[id*="modal"]:not(#service-modal) > div {
  background-color: var(--app-modal-background) !important;
  color: var(--app-modal-foreground) !important;
  border: 1px solid var(--app-border-strong) !important;
  box-shadow: 0 25px 50px -12px rgba(2, 6, 23, 0.85) !important;
}

html[data-theme="light"] .vercoza-modal-backdrop > .vercoza-modal-dialog,
html[data-theme="light"] .vercoza-modal-backdrop > div,
html[data-theme="light"] body.admin-body div.fixed.inset-0[id*="modal"]:not(#service-modal) > div,
html[data-theme="light"] body.dfe-body div.fixed.inset-0[id*="modal"]:not(#service-modal) > div {
  background-color: var(--app-modal-background) !important;
  color: var(--app-modal-foreground) !important;
  border: 1px solid var(--app-border-strong) !important;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.28) !important;
}

/* ===================================================
   6. NORMALIZAÇÃO DE SUPERFÍCIES, CARDS E CONTAINERS POR TEMA
   (Seletores exatos de classe — sem falsos positivos em modificadores!)
   =================================================== */

/* 6.1. TEMA ESCURO: Adapta superfícies claras codificadas sem variante dark: */
html[data-theme="dark"] :is(body.admin-body, body.dfe-body) :is(
  .bg-white,
  .bg-white\/95,
  .bg-white\/90,
  .bg-white\/80
):not(.vercoza-modal-backdrop):not(img):not(#qrcode):not(.keep-white) {
  background-color: var(--app-card) !important;
  color: var(--app-card-foreground);
}

html[data-theme="dark"] :is(body.admin-body, body.dfe-body) :is(
  .bg-slate-50,
  .bg-slate-50\/90,
  .bg-slate-50\/80,
  .bg-slate-50\/70,
  .bg-slate-50\/60,
  .bg-slate-50\/50,
  .bg-slate-50\/40,
  .bg-slate-50\/30,
  .bg-slate-100,
  .bg-slate-100\/80,
  .bg-slate-100\/60,
  .bg-gray-50,
  .bg-gray-100
):not(body):not(main):not(.vercoza-modal-backdrop):not(.keep-white) {
  background-color: var(--app-surface-secondary) !important;
}

/* Cabeçalhos/rodapés internos de modais no Tema Escuro */
html[data-theme="dark"] .vercoza-modal-dialog :is(
  .bg-slate-900,
  .bg-slate-900\/90,
  .bg-slate-900\/80,
  .bg-slate-900\/60,
  .bg-slate-900\/50,
  .bg-slate-900\/40,
  .bg-slate-950\/50,
  .bg-slate-950\/60,
  .bg-slate-800\/50,
  .bg-slate-800\/40,
  .bg-slate-800\/30,
  .bg-slate-50,
  .bg-slate-100
):not(input):not(select):not(textarea):not(button) {
  background-color: #1e293b !important;
  border-color: #334155 !important;
}

/* Bordas e divisores claros adaptados ao Tema Escuro */
html[data-theme="dark"] :is(body.admin-body, body.dfe-body) :is(
  .border-slate-100,
  .border-slate-200,
  .border-slate-200\/80,
  .border-slate-200\/60,
  .border-gray-100,
  .border-gray-200
) {
  border-color: var(--app-border) !important;
}

html[data-theme="dark"] :is(body.admin-body, body.dfe-body) :is(
  .border-slate-300,
  .border-gray-300
) {
  border-color: var(--app-border-strong) !important;
}

html[data-theme="dark"] :is(body.admin-body, body.dfe-body) :is(
  .divide-slate-100 > * + *,
  .divide-slate-200 > * + *,
  .divide-gray-200 > * + *
) {
  border-color: var(--app-border) !important;
}

/* 6.2. TEMA CLARO: Adapta superfícies escuras codificadas sem variante light */
html[data-theme="light"] :is(body.admin-body, body.dfe-body) :is(
  div, section, article, header, footer, nav, ul, li, form, fieldset
):is(
  .bg-slate-950,
  .bg-slate-950\/95,
  .bg-slate-950\/90,
  .bg-slate-950\/80,
  .bg-slate-950\/70,
  .bg-slate-950\/60,
  .bg-slate-950\/50,
  .bg-slate-950\/40,
  .bg-slate-950\/30,
  .bg-slate-900,
  .bg-slate-900\/95,
  .bg-slate-900\/90,
  .bg-slate-900\/80,
  .bg-slate-900\/70,
  .bg-slate-900\/60,
  .bg-slate-900\/50,
  .bg-slate-900\/40,
  .bg-slate-900\/30,
  .bg-vercoza-navy,
  .bg-vercoza-navylight,
  .bg-vercoza-navylight\/90,
  .bg-vercoza-navylight\/95
):not(.vercoza-modal-backdrop):not(.vercoza-modal-dialog):not(.safety-stripe-bar):not(.homologation-stripe):not(aside):not(aside *) {
  background-color: var(--app-card) !important;
  color: var(--app-card-foreground) !important;
  border-color: var(--app-border) !important;
  box-shadow: var(--app-shadow);
}

html[data-theme="light"] :is(body.admin-body, body.dfe-body) :is(
  div, section, article, aside, header, footer, nav, ul, li, span, code, pre
):is(
  .bg-slate-800,
  .bg-slate-800\/90,
  .bg-slate-800\/80,
  .bg-slate-800\/70,
  .bg-slate-800\/60,
  .bg-slate-800\/50,
  .bg-slate-800\/40,
  .bg-slate-800\/30,
  .bg-slate-800\/20,
  .bg-slate-950\/40,
  .bg-slate-950\/50
):not(.vercoza-modal-backdrop):not(.vercoza-modal-dialog) {
  background-color: var(--app-surface-secondary) !important;
  color: var(--app-foreground) !important;
  border-color: var(--app-border-strong) !important;
}

/* Subcontainers dentro de modais no Tema Claro */
html[data-theme="light"] .vercoza-modal-dialog :is(
  .bg-slate-950,
  .bg-slate-950\/90,
  .bg-slate-950\/80,
  .bg-slate-950\/70,
  .bg-slate-950\/60,
  .bg-slate-950\/50,
  .bg-slate-950\/40,
  .bg-slate-950\/30,
  .bg-slate-900,
  .bg-slate-900\/90,
  .bg-slate-900\/80,
  .bg-slate-900\/70,
  .bg-slate-900\/60,
  .bg-slate-900\/50,
  .bg-slate-900\/40,
  .bg-slate-900\/30,
  .bg-slate-800,
  .bg-slate-800\/90,
  .bg-slate-800\/80,
  .bg-slate-800\/70,
  .bg-slate-800\/60,
  .bg-slate-800\/50,
  .bg-slate-800\/40,
  .bg-slate-800\/30
):not(input):not(select):not(textarea):not(button) {
  background-color: var(--app-surface-secondary) !important;
  color: var(--app-foreground) !important;
  border-color: var(--app-border) !important;
}

/* Gradientes escuros de containers adaptados ao Tema Claro */
html[data-theme="light"] :is(body.admin-body, body.dfe-body) :is(div, section, a):is(
  .from-slate-900,
  .from-slate-950,
  .via-slate-900,
  .to-slate-900,
  .to-slate-950
):not(.vercoza-modal-backdrop) {
  background-image: none !important;
  background-color: var(--app-surface-secondary) !important;
  border-color: var(--app-border-strong) !important;
  color: var(--app-foreground) !important;
}

/* Banners da área restrita precisam manter texto legível sobre a superfície branca. */
html[data-theme="light"] :is(body.admin-body, body.dfe-body) div:is(.welcome-hero-banner, .top-page-banner).text-white {
  background-image: none !important;
  background-color: #ffffff !important;
  border-color: var(--app-border) !important;
  color: var(--app-foreground) !important;
  box-shadow: var(--app-shadow) !important;
}

html[data-theme="light"] :is(body.admin-body, body.dfe-body) div:is(.welcome-hero-banner, .top-page-banner).text-white :is(p, .text-slate-200, .text-slate-300, .text-gray-200, .text-gray-300) {
  color: var(--app-muted-foreground) !important;
}

/* Bordas e divisores escuros adaptados ao Tema Claro */
html[data-theme="light"] :is(body.admin-body, body.dfe-body) :is(
  .border-slate-800,
  .border-slate-800\/80,
  .border-slate-800\/60,
  .border-slate-800\/50,
  .border-slate-700,
  .border-slate-700\/80,
  .border-slate-700\/60,
  .border-slate-700\/50,
  .border-slate-600
) {
  border-color: var(--app-border) !important;
}

html[data-theme="light"] :is(body.admin-body, body.dfe-body) :is(
  .divide-slate-800 > * + *,
  .divide-slate-800\/80 > * + *,
  .divide-slate-800\/60 > * + *,
  .divide-slate-800\/50 > * + *,
  .divide-slate-700 > * + *
) {
  border-color: var(--app-border) !important;
}

/* ===================================================
   7. TIPOGRAFIA E HIERARQUIA DE TEXTO POR TEMA
   =================================================== */

/* Preservar texto escuro em botões e badges âmbar/amarelo no Tema Escuro */
/* Só fundos sólidos: variantes translúcidas (bg-amber-500/20) e de hover ficam sobre o fundo escuro */
html[data-theme="dark"] :is(.bg-amber-400, .bg-amber-500, .bg-yellow-400, .bg-yellow-500),
html[data-theme="dark"] :is(.bg-amber-400, .bg-amber-500, .bg-yellow-400, .bg-yellow-500) :is(span, p, a, div, i, strong, b) {
  color: #020617 !important;
}

/* 7.1. TEMA ESCURO: Textos escuros codificados sem variante dark: */
html[data-theme="dark"] :is(body.admin-body, body.dfe-body) :is(
  .text-slate-950,
  .text-slate-900,
  .text-slate-800,
  .text-slate-700,
  .text-gray-900,
  .text-gray-800,
  .text-gray-700
):not([class*="bg-amber-"]):not([class*="bg-amber-"] *):not([class*="bg-yellow-"]):not([class*="bg-yellow-"] *):not(.keep-white *):not(.keep-white) {
  color: var(--app-foreground) !important;
}

html[data-theme="dark"] :is(body.admin-body, body.dfe-body) :is(
  .text-slate-600,
  .text-slate-500,
  .text-gray-600,
  .text-gray-500
):not([class*="bg-amber-"]):not([class*="bg-amber-"] *) {
  color: var(--app-muted-foreground) !important;
}

/* 7.2. TEMA CLARO: Textos claros codificados sem variante light */
html[data-theme="light"] :is(body.admin-body, body.dfe-body) :is(
  .text-slate-100,
  .text-slate-200,
  .text-slate-300,
  .text-gray-100,
  .text-gray-200,
  .text-gray-300
):not(aside):not(aside *):not(.keep-white):not(.keep-white *) {
  color: var(--app-foreground) !important;
}

html[data-theme="light"] :is(body.admin-body, body.dfe-body) :is(
  .text-slate-400,
  .text-slate-500
) {
  color: var(--app-muted-foreground) !important;
}

/* Textos .text-white em títulos/parágrafos/células (fora de botões e badges coloridos) no Tema Claro */
html[data-theme="light"] :is(body.admin-body, body.dfe-body) :is(
  h1, h2, h3, h4, h5, h6, p, span, div, td, th, label, strong, b, li, dt, dd
).text-white:not([class*="bg-"]):not(.badge):not(aside):not(aside *):not(button):not(button *):not(a):not(a *) {
  color: var(--app-foreground) !important;
}

/* Ajuste de contraste de cores neon (400/300) sobre fundos claros no Tema Claro */
html[data-theme="light"] :is(body.admin-body, body.dfe-body) :is(
  .text-cyan-400,
  .text-cyan-300,
  .text-sky-400,
  .text-sky-300,
  .text-vercoza-cyan,
  .text-vercoza-blue
):not(button):not(.bg-vercoza-blue *):not(.bg-cyan-600 *):not(aside):not(aside *) {
  color: #0369a1 !important;
}

html[data-theme="light"] :is(body.admin-body, body.dfe-body) :is(
  .text-emerald-400,
  .text-emerald-300,
  .text-emerald-200
):not(button):not(.bg-emerald-600 *):not(aside):not(aside *) {
  color: #047857 !important;
}

html[data-theme="light"] :is(body.admin-body, body.dfe-body) :is(
  .text-amber-400,
  .text-amber-300,
  .text-amber-200,
  .text-amber-100,
  .text-yellow-400,
  .text-yellow-300,
  .text-yellow-200
):not(button):not(.bg-amber-600 *):not(.bg-slate-950):not(.theme-toggle-btn i):not(aside):not(aside *) {
  color: #92400e !important;
}

/* Painel de Conferência Pré-Emissão CT-e no Light Mode */
html[data-theme="light"] #sefaz-conferencia-box {
  background-color: #fffbeb !important;
  border-color: #fde68a !important;
}
html[data-theme="light"] #sefaz-conferencia-box span,
html[data-theme="light"] #sefaz-conferencia-box li,
html[data-theme="light"] #sefaz-conferencia-box div {
  color: #78350f !important;
}
html[data-theme="light"] #sefaz-conferencia-box a {
  color: #0369a1 !important;
  text-decoration: underline !important;
}

html[data-theme="light"] :is(body.admin-body, body.dfe-body) :is(
  .text-rose-400,
  .text-rose-300
):not(button):not(.bg-rose-600 *):not(aside):not(aside *) {
  color: #be123c !important;
}

html[data-theme="light"] :is(body.admin-body, body.dfe-body) :is(
  .text-indigo-400,
  .text-indigo-300
):not(button):not(.bg-indigo-600 *):not(aside):not(aside *) {
  color: #4338ca !important;
}

html[data-theme="light"] :is(body.admin-body, body.dfe-body) :is(
  .text-purple-400,
  .text-purple-300
):not(button):not(.bg-purple-600 *):not(aside):not(aside *) {
  color: #6d28d9 !important;
}

/* ===================================================
   8. BOTÕES, LINKS DE AÇÃO E CONTROLES DE NAVEGAÇÃO
   =================================================== */

/* 8.1. Botões seletores de tema (.theme-toggle-btn) e botões secundários neutros */
.theme-toggle-btn {
  background-color: var(--app-surface-secondary) !important;
  color: var(--app-foreground) !important;
  border-color: var(--app-border-strong) !important;
}

.theme-toggle-btn span {
  color: var(--app-foreground) !important;
}

html[data-theme="light"] :is(body.admin-body, body.dfe-body) :is(button, a):is(
  .bg-slate-950,
  .bg-slate-900,
  .bg-slate-800,
  .bg-slate-800\/90,
  .bg-slate-800\/80,
  .bg-slate-800\/60,
  .bg-slate-700
):not(.text-white):not(.btn-keep-dark):not(.bg-vercoza-blue):not(.bg-emerald-600):not(.bg-sky-600):not(.bg-blue-600):not(.bg-amber-600):not(.bg-rose-600):not(.bg-violet-600):not(.btn-faturas-action) {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

html[data-theme="light"] :is(body.admin-body, body.dfe-body) :is(button, a):is(
  .bg-slate-950,
  .bg-slate-900,
  .bg-slate-800,
  .bg-slate-800\/90,
  .bg-slate-800\/80,
  .bg-slate-800\/60,
  .bg-slate-700
):not(.text-white):not(.btn-keep-dark):not(.bg-vercoza-blue):not(.bg-emerald-600):not(.bg-sky-600):not(.bg-blue-600):not(.bg-amber-600):not(.bg-rose-600):not(.bg-violet-600):not(.btn-faturas-action):hover {
  background-color: #f1f5f9 !important;
  border-color: #94a3b8 !important;
  color: #0f172a !important;
}

html[data-theme="light"] :is(body.admin-body, body.dfe-body) :is(button, a):is(
  .bg-slate-950,
  .bg-slate-900,
  .bg-slate-800,
  .bg-slate-800\/90,
  .bg-slate-800\/80,
  .bg-slate-800\/60,
  .bg-slate-700
):not(.text-white):not(.btn-keep-dark):not(.bg-vercoza-blue) :is(span, strong, p) {
  color: #0f172a !important;
}

/* Abas de navegação (Tabs) no Tema Claro */
html[data-theme="light"] :is(body.admin-body, body.dfe-body) a.border-b-2.border-vercoza-cyan {
  border-color: #0284c7 !important;
  color: #0369a1 !important;
  background-color: #f0f9ff !important;
}
html[data-theme="light"] :is(body.admin-body, body.dfe-body) a.border-b-2.border-transparent {
  color: #475569 !important;
}
html[data-theme="light"] :is(body.admin-body, body.dfe-body) a.border-b-2.border-transparent:hover {
  color: #0f172a !important;
  background-color: #f8fafc !important;
}

/* 8.2. Botões escuros de ação (.bg-slate-900.text-white / .bg-slate-800.text-white) */
html[data-theme="light"] :is(body.admin-body, body.dfe-body) :is(button, a):is(.bg-slate-900, .bg-slate-800).text-white {
  background-color: #0f172a !important;
  color: #ffffff !important;
  border-color: #1e293b !important;
}

html[data-theme="dark"] :is(body.admin-body, body.dfe-body) :is(button, a):is(.bg-slate-900, .bg-slate-800).text-white {
  background-color: #1e293b !important;
  color: #ffffff !important;
  border: 1px solid #475569 !important;
}

/* 8.3. Preservação estrita de texto branco em botões, badges e banners sólidos coloridos */
:is(body.admin-body, body.dfe-body) :is(
  .bg-vercoza-blue,
  .bg-vercoza-bluedark,
  .bg-vercoza-orange,
  .bg-blue-600,
  .bg-blue-700,
  .bg-sky-600,
  .bg-cyan-600,
  .bg-cyan-500,
  .bg-emerald-600,
  .bg-emerald-700,
  .bg-emerald-500,
  .bg-teal-600,
  .bg-teal-500,
  .bg-green-600,
  .bg-rose-600,
  .bg-rose-700,
  .bg-rose-500,
  .bg-red-600,
  .bg-red-700,
  .bg-amber-600,
  .bg-orange-600,
  .bg-orange-500,
  .bg-indigo-600,
  .bg-indigo-500,
  .bg-purple-600,
  .bg-purple-700,
  .bg-violet-600,
  .bg-violet-500,
  .btn-faturas-action,
  .from-cyan-600,
  .from-emerald-600,
  .from-amber-600,
  .from-indigo-600,
  .from-rose-600,
  .from-purple-600,
  .from-blue-600
),
:is(body.admin-body, body.dfe-body) :is(
  .bg-vercoza-blue,
  .bg-vercoza-bluedark,
  .bg-vercoza-orange,
  .bg-blue-600,
  .bg-blue-700,
  .bg-sky-600,
  .bg-cyan-600,
  .bg-cyan-500,
  .bg-emerald-600,
  .bg-emerald-700,
  .bg-emerald-500,
  .bg-teal-600,
  .bg-teal-500,
  .bg-green-600,
  .bg-rose-600,
  .bg-rose-700,
  .bg-rose-500,
  .bg-red-600,
  .bg-red-700,
  .bg-amber-600,
  .bg-orange-600,
  .bg-orange-500,
  .bg-indigo-600,
  .bg-indigo-500,
  .bg-purple-600,
  .bg-purple-700,
  .bg-violet-600,
  .bg-violet-500,
  .btn-faturas-action,
  .from-cyan-600,
  .from-emerald-600,
  .from-amber-600,
  .from-indigo-600,
  .from-rose-600,
  .from-purple-600,
  .from-blue-600
) :is(span, i, strong, p, div),
:is(body.admin-body, body.dfe-body) :is(button, a):is(.bg-slate-900, .bg-slate-800).text-white :is(span, i, strong) {
  color: #ffffff !important;
}

/* Botão de Ação: Faturas Comerciais e variantes violet */
.bg-violet-600,
.btn-faturas-action {
  background-color: #7c3aed !important;
  color: #ffffff !important;
}
.hover\:bg-violet-500:hover,
.btn-faturas-action:hover {
  background-color: #6d28d9 !important;
  color: #ffffff !important;
}
:is(body.admin-body, body.dfe-body) .btn-faturas-action :is(span, i) {
  color: #ffffff !important;
}

/* Badges internos com bg-white/20 ou bg-white/25 dentro de botões ativos */
:is(body.admin-body, body.dfe-body) :is(.bg-white\/10, .bg-white\/20, .bg-white\/25) {
  background-color: rgba(255, 255, 255, 0.22) !important;
  color: #ffffff !important;
}

/* ===================================================
   9. ALERTAS, BADGES E INDICADORES DE STATUS SEMÂNTICOS
   =================================================== */

/* 9.1. TEMA ESCURO: Converte alertas e badges pastéis claros para superfícies escuras semânticas */
/* Emerald / Green (Sucesso) */
html[data-theme="dark"] :is(body.admin-body, body.dfe-body) :is(
  .bg-emerald-50,
  .bg-emerald-50\/50,
  .bg-emerald-100,
  .bg-green-50,
  .bg-green-100,
  .app-alert-success,
  .app-badge-success
) {
  background-color: rgba(6, 78, 59, 0.45) !important;
  border-color: rgba(16, 185, 129, 0.4) !important;
  color: #6ee7b7 !important;
}

html[data-theme="dark"] :is(body.admin-body, body.dfe-body) :is(
  .bg-emerald-50,
  .bg-emerald-100,
  .bg-green-50,
  .bg-green-100,
  .app-alert-success,
  .app-badge-success
) :is(.text-emerald-900, .text-emerald-800, .text-emerald-700, .text-emerald-600, .text-green-800, .text-green-700, span, p, strong, div) {
  color: #6ee7b7 !important;
}

html[data-theme="dark"] :is(body.admin-body, body.dfe-body) :is(
  .text-emerald-800,
  .text-emerald-700,
  .text-green-800,
  .text-green-700
) {
  color: #6ee7b7 !important;
}

/* Rose / Red (Erro / Perigo) */
html[data-theme="dark"] :is(body.admin-body, body.dfe-body) :is(
  .bg-rose-50,
  .bg-rose-50\/50,
  .bg-rose-100,
  .bg-red-50,
  .bg-red-100,
  .app-alert-danger,
  .app-badge-danger
) {
  background-color: rgba(136, 19, 55, 0.45) !important;
  border-color: rgba(244, 63, 94, 0.4) !important;
  color: #fda4af !important;
}

html[data-theme="dark"] :is(body.admin-body, body.dfe-body) :is(
  .bg-rose-50,
  .bg-rose-100,
  .bg-red-50,
  .bg-red-100,
  .app-alert-danger,
  .app-badge-danger
) :is(.text-rose-900, .text-rose-800, .text-rose-700, .text-rose-600, .text-red-800, .text-red-700, .text-red-600, span, p, strong, div) {
  color: #fda4af !important;
}

html[data-theme="dark"] :is(body.admin-body, body.dfe-body) :is(
  .text-rose-800,
  .text-rose-700,
  .text-red-800,
  .text-red-700
) {
  color: #fda4af !important;
}

/* Amber / Orange (Aviso / Atenção) */
html[data-theme="dark"] :is(body.admin-body, body.dfe-body) :is(
  .bg-amber-50,
  .bg-amber-50\/60,
  .bg-amber-50\/50,
  .bg-amber-50\/40,
  .bg-amber-50\/30,
  .bg-amber-100,
  .bg-orange-50,
  .bg-orange-100,
  .app-alert-warning,
  .app-badge-warning
) {
  background-color: rgba(120, 53, 15, 0.45) !important;
  border-color: rgba(245, 158, 11, 0.4) !important;
  color: #fcd34d !important;
}

html[data-theme="dark"] :is(body.admin-body, body.dfe-body) :is(
  .bg-amber-50,
  .bg-amber-50\/50,
  .bg-amber-50\/40,
  .bg-amber-50\/30,
  .bg-amber-100,
  .bg-orange-50,
  .bg-orange-100,
  .app-alert-warning,
  .app-badge-warning
) :is(.text-amber-900, .text-amber-800, .text-amber-700, .text-amber-600, .text-orange-800, .text-orange-700, .text-orange-600, span, p, strong, div) {
  color: #fcd34d !important;
}

html[data-theme="dark"] :is(body.admin-body, body.dfe-body) :is(
  .text-amber-900,
  .text-amber-800,
  .text-amber-700,
  .text-orange-800,
  .text-orange-700
) {
  color: #fcd34d !important;
}

/* Blue / Cyan / Sky (Informação) */
html[data-theme="dark"] :is(body.admin-body, body.dfe-body) :is(
  .bg-blue-50,
  .bg-blue-50\/50,
  .bg-blue-100,
  .bg-cyan-50,
  .bg-cyan-100,
  .bg-sky-50,
  .bg-sky-100,
  .app-alert-info,
  .app-badge-info
) {
  background-color: rgba(12, 74, 110, 0.45) !important;
  border-color: rgba(56, 182, 255, 0.4) !important;
  color: #7dd3fc !important;
}

html[data-theme="dark"] :is(body.admin-body, body.dfe-body) :is(
  .bg-blue-50,
  .bg-blue-50\/50,
  .bg-blue-100,
  .bg-cyan-50,
  .bg-cyan-100,
  .bg-sky-50,
  .bg-sky-100,
  .app-alert-info,
  .app-badge-info
) :is(.text-blue-900, .text-blue-800, .text-blue-700, .text-blue-600, .text-cyan-800, .text-cyan-700, span, p, strong, div) {
  color: #7dd3fc !important;
}

html[data-theme="dark"] :is(body.admin-body, body.dfe-body) :is(
  .text-blue-900,
  .text-blue-800,
  .text-blue-700
) {
  color: #7dd3fc !important;
}

/* Indigo / Purple */
html[data-theme="dark"] :is(body.admin-body, body.dfe-body) :is(
  .bg-indigo-50,
  .bg-indigo-100,
  .bg-purple-50,
  .bg-purple-100
) {
  background-color: rgba(49, 46, 129, 0.45) !important;
  border-color: rgba(129, 140, 248, 0.4) !important;
  color: #c4b5fd !important;
}

html[data-theme="dark"] :is(body.admin-body, body.dfe-body) :is(
  .bg-indigo-50,
  .bg-indigo-100,
  .bg-purple-50,
  .bg-purple-100
) :is(.text-indigo-900, .text-indigo-800, .text-indigo-700, .text-purple-900, .text-purple-800, .text-purple-700, .text-purple-600, span, p, strong, div) {
  color: #c4b5fd !important;
}

/* 9.2. TEMA CLARO: Converte alertas e badges escuros (*-950/*, *-900/*, *-500/10..20) para pastéis de alto contraste */
/* Emerald / Green (Sucesso) */
html[data-theme="light"] :is(body.admin-body, body.dfe-body) :is(
  .bg-emerald-950,
  .bg-emerald-950\/70,
  .bg-emerald-950\/60,
  .bg-emerald-950\/50,
  .bg-emerald-950\/40,
  .bg-emerald-950\/30,
  .bg-emerald-950\/20,
  .bg-emerald-900\/50,
  .bg-emerald-900\/40,
  .bg-emerald-900\/30,
  .bg-emerald-900\/20,
  .bg-emerald-500\/20,
  .bg-emerald-500\/15,
  .bg-emerald-500\/10,
  .app-alert-success,
  .app-badge-success
) {
  background-color: #ecfdf5 !important;
  border-color: #6ee7b7 !important;
  color: #065f46 !important;
}

html[data-theme="light"] :is(body.admin-body, body.dfe-body) :is(
  .bg-emerald-950,
  .bg-emerald-950\/70,
  .bg-emerald-950\/60,
  .bg-emerald-950\/50,
  .bg-emerald-950\/40,
  .bg-emerald-950\/30,
  .bg-emerald-950\/20,
  .bg-emerald-900\/50,
  .bg-emerald-900\/40,
  .bg-emerald-900\/30,
  .bg-emerald-900\/20,
  .bg-emerald-500\/20,
  .bg-emerald-500\/15,
  .bg-emerald-500\/10,
  .app-alert-success,
  .app-badge-success
) :is(.text-emerald-100, .text-emerald-200, .text-emerald-300, .text-emerald-400, span, p, strong, div) {
  color: #065f46 !important;
}

/* Rose / Red (Erro / Perigo) */
html[data-theme="light"] :is(body.admin-body, body.dfe-body) :is(
  .bg-rose-950,
  .bg-rose-950\/70,
  .bg-rose-950\/60,
  .bg-rose-950\/50,
  .bg-rose-950\/40,
  .bg-rose-950\/30,
  .bg-rose-950\/20,
  .bg-rose-900\/60,
  .bg-rose-900\/50,
  .bg-rose-900\/40,
  .bg-rose-900\/30,
  .bg-rose-900\/20,
  .bg-rose-500\/20,
  .bg-rose-500\/15,
  .bg-rose-500\/10,
  .app-alert-danger,
  .app-badge-danger
) {
  background-color: #fff1f2 !important;
  border-color: #fda4af !important;
  color: #9f1239 !important;
}

html[data-theme="light"] :is(body.admin-body, body.dfe-body) :is(
  .bg-rose-950,
  .bg-rose-950\/70,
  .bg-rose-950\/60,
  .bg-rose-950\/50,
  .bg-rose-950\/40,
  .bg-rose-950\/30,
  .bg-rose-950\/20,
  .bg-rose-900\/60,
  .bg-rose-900\/50,
  .bg-rose-900\/40,
  .bg-rose-900\/30,
  .bg-rose-900\/20,
  .bg-rose-500\/20,
  .bg-rose-500\/15,
  .bg-rose-500\/10,
  .app-alert-danger,
  .app-badge-danger
) :is(.text-rose-100, .text-rose-200, .text-rose-300, .text-rose-400, span, p, strong, div) {
  color: #9f1239 !important;
}

/* Amber / Orange (Aviso / Homologação) */
html[data-theme="light"] :is(body.admin-body, body.dfe-body) :is(
  .bg-amber-950,
  .bg-amber-950\/70,
  .bg-amber-950\/60,
  .bg-amber-950\/50,
  .bg-amber-950\/40,
  .bg-amber-950\/30,
  .bg-amber-950\/20,
  .bg-amber-900\/50,
  .bg-amber-900\/40,
  .bg-amber-900\/30,
  .bg-amber-900\/20,
  .bg-amber-500\/20,
  .bg-amber-500\/15,
  .bg-amber-500\/10,
  .app-alert-warning,
  .app-badge-warning
) {
  background-color: #fffbeb !important;
  border-color: #fcd34d !important;
  color: #92400e !important;
}

html[data-theme="light"] :is(body.admin-body, body.dfe-body) :is(
  .bg-amber-950,
  .bg-amber-950\/70,
  .bg-amber-950\/60,
  .bg-amber-950\/50,
  .bg-amber-950\/40,
  .bg-amber-950\/30,
  .bg-amber-950\/20,
  .bg-amber-900\/50,
  .bg-amber-900\/40,
  .bg-amber-900\/30,
  .bg-amber-900\/20,
  .bg-amber-500\/20,
  .bg-amber-500\/15,
  .bg-amber-500\/10,
  .app-alert-warning,
  .app-badge-warning
) :is(.text-amber-100, .text-amber-200, .text-amber-300, .text-amber-400, span, p, strong, div) {
  color: #92400e !important;
}

/* Cyan / Sky / Blue (Informação / Fiscal) */
html[data-theme="light"] :is(body.admin-body, body.dfe-body) :is(
  .bg-cyan-950,
  .bg-cyan-950\/70,
  .bg-cyan-950\/60,
  .bg-cyan-950\/50,
  .bg-cyan-950\/40,
  .bg-cyan-950\/30,
  .bg-cyan-950\/20,
  .bg-cyan-900\/50,
  .bg-cyan-900\/40,
  .bg-cyan-900\/30,
  .bg-cyan-900\/20,
  .bg-cyan-500\/20,
  .bg-cyan-500\/15,
  .bg-cyan-500\/10,
  .bg-sky-500\/20,
  .bg-sky-500\/15,
  .bg-sky-500\/10,
  .bg-blue-950,
  .bg-blue-950\/60,
  .bg-blue-950\/50,
  .bg-blue-950\/40,
  .bg-blue-950\/30,
  .bg-blue-500\/20,
  .bg-blue-500\/15,
  .bg-blue-500\/10,
  .app-alert-info,
  .app-badge-info
) {
  background-color: #f0f9ff !important;
  border-color: #7dd3fc !important;
  color: #075985 !important;
}

html[data-theme="light"] :is(body.admin-body, body.dfe-body) :is(
  .bg-cyan-950,
  .bg-cyan-950\/70,
  .bg-cyan-950\/60,
  .bg-cyan-950\/50,
  .bg-cyan-950\/40,
  .bg-cyan-950\/30,
  .bg-cyan-950\/20,
  .bg-cyan-900\/50,
  .bg-cyan-900\/40,
  .bg-cyan-900\/30,
  .bg-cyan-900\/20,
  .bg-cyan-500\/20,
  .bg-cyan-500\/15,
  .bg-cyan-500\/10,
  .bg-sky-500\/20,
  .bg-sky-500\/15,
  .bg-sky-500\/10,
  .bg-blue-950,
  .bg-blue-950\/60,
  .bg-blue-950\/50,
  .bg-blue-950\/40,
  .bg-blue-950\/30,
  .bg-blue-500\/20,
  .bg-blue-500\/15,
  .bg-blue-500\/10,
  .app-alert-info,
  .app-badge-info
) :is(.text-cyan-100, .text-cyan-200, .text-cyan-300, .text-cyan-400, .text-sky-300, .text-sky-400, .text-blue-200, .text-blue-300, .text-blue-400, span, p, strong, div) {
  color: #075985 !important;
}

/* Indigo / Purple */
html[data-theme="light"] :is(body.admin-body, body.dfe-body) :is(
  .bg-indigo-950,
  .bg-indigo-950\/70,
  .bg-indigo-950\/60,
  .bg-indigo-950\/50,
  .bg-indigo-950\/40,
  .bg-indigo-950\/30,
  .bg-indigo-950\/20,
  .bg-indigo-900\/50,
  .bg-indigo-900\/40,
  .bg-indigo-900\/30,
  .bg-indigo-900\/20,
  .bg-indigo-500\/20,
  .bg-indigo-500\/15,
  .bg-indigo-500\/10,
  .bg-purple-950,
  .bg-purple-950\/60,
  .bg-purple-950\/50,
  .bg-purple-950\/40,
  .bg-purple-950\/30,
  .bg-purple-500\/20,
  .bg-purple-500\/15,
  .bg-purple-500\/10
) {
  background-color: #eef2ff !important;
  border-color: #a5b4fc !important;
  color: #3730a3 !important;
}

html[data-theme="light"] :is(body.admin-body, body.dfe-body) :is(
  .bg-indigo-950,
  .bg-indigo-950\/70,
  .bg-indigo-950\/60,
  .bg-indigo-950\/50,
  .bg-indigo-950\/40,
  .bg-indigo-950\/30,
  .bg-indigo-950\/20,
  .bg-indigo-900\/50,
  .bg-indigo-900\/40,
  .bg-indigo-900\/30,
  .bg-indigo-900\/20,
  .bg-indigo-500\/20,
  .bg-indigo-500\/15,
  .bg-indigo-500\/10,
  .bg-purple-950,
  .bg-purple-950\/60,
  .bg-purple-950\/50,
  .bg-purple-950\/40,
  .bg-purple-950\/30,
  .bg-purple-500\/20,
  .bg-purple-500\/15,
  .bg-purple-500\/10
) :is(.text-indigo-100, .text-indigo-200, .text-indigo-300, .text-indigo-400, .text-purple-200, .text-purple-300, .text-purple-400, span, p, strong, div) {
  color: #3730a3 !important;
}

/* ===================================================
   10. TABELAS, LISTAGENS E DADOS (PADRONIZAÇÃO GLOBAL)
   =================================================== */
:is(body.admin-body, body.dfe-body) table {
  border-collapse: collapse;
  color: var(--app-card-foreground);
}

:is(body.admin-body, body.dfe-body) table thead,
:is(body.admin-body, body.dfe-body) table thead tr,
:is(body.admin-body, body.dfe-body) table thead th {
  background-color: var(--app-table-header) !important;
  color: var(--app-muted-foreground) !important;
  border-bottom: 1px solid var(--app-border-strong) !important;
}

:is(body.admin-body, body.dfe-body) table tbody {
  background-color: var(--app-card) !important;
}

:is(body.admin-body, body.dfe-body) table tbody tr {
  background-color: var(--app-card) !important;
  color: var(--app-card-foreground) !important;
  border-bottom: 1px solid var(--app-border) !important;
  transition: background-color 0.15s ease;
}

:is(body.admin-body, body.dfe-body) table tbody tr:nth-child(even) {
  background-color: var(--app-table-stripe) !important;
}

:is(body.admin-body, body.dfe-body) table tbody tr:hover {
  background-color: var(--app-table-hover) !important;
}

:is(body.admin-body, body.dfe-body) table tfoot,
:is(body.admin-body, body.dfe-body) table tfoot tr,
:is(body.admin-body, body.dfe-body) table tfoot td,
:is(body.admin-body, body.dfe-body) table tfoot th {
  background-color: var(--app-table-header) !important;
  color: var(--app-foreground) !important;
  border-top: 1px solid var(--app-border-strong) !important;
}

/* ===================================================
   11. FORMULÁRIOS E CAMPOS DE ENTRADA (INPUTS, SELECTS, TEXTAREAS, SWITCHES)
   =================================================== */
:is(body.admin-body, body.dfe-body) input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="hidden"]),
:is(body.admin-body, body.dfe-body) select,
:is(body.admin-body, body.dfe-body) textarea {
  background-color: var(--app-input) !important;
  color: var(--app-input-foreground) !important;
  border-color: var(--app-input-border) !important;
}

:is(body.admin-body, body.dfe-body) input::placeholder,
:is(body.admin-body, body.dfe-body) textarea::placeholder {
  color: var(--app-muted-foreground) !important;
  opacity: 0.75;
}

:is(body.admin-body, body.dfe-body) input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus,
:is(body.admin-body, body.dfe-body) select:focus,
:is(body.admin-body, body.dfe-body) textarea:focus {
  border-color: var(--app-primary) !important;
  box-shadow: 0 0 0 3px var(--app-focus-ring) !important;
  outline: none !important;
}

:is(body.admin-body, body.dfe-body) input:disabled,
:is(body.admin-body, body.dfe-body) select:disabled,
:is(body.admin-body, body.dfe-body) textarea:disabled,
:is(body.admin-body, body.dfe-body) input[readonly],
:is(body.admin-body, body.dfe-body) textarea[readonly] {
  background-color: var(--app-surface-secondary) !important;
  color: var(--app-muted-foreground) !important;
  opacity: 0.8;
}

:is(body.admin-body, body.dfe-body) select option {
  background-color: var(--app-card);
  color: var(--app-foreground);
}

:is(body.admin-body, body.dfe-body) input[type="checkbox"],
:is(body.admin-body, body.dfe-body) input[type="radio"] {
  accent-color: var(--app-primary);
}

/* Toggle Switches (input.peer + div.peer) em ambos os temas */
html[data-theme="dark"] :is(body.admin-body, body.dfe-body) input.peer + div {
  background-color: #334155 !important;
}

html[data-theme="light"] :is(body.admin-body, body.dfe-body) input.peer + div {
  background-color: #cbd5e1 !important;
}

:is(body.admin-body, body.dfe-body) input.peer:checked + div.peer-checked\:bg-emerald-600 {
  background-color: #059669 !important;
}

:is(body.admin-body, body.dfe-body) input.peer:checked + div.peer-checked\:bg-vercoza-blue {
  background-color: #0284c7 !important;
}

:is(body.admin-body, body.dfe-body) input.peer + div::after {
  background-color: #ffffff !important;
}

/* ===================================================
   12. PROTEÇÃO DE IMPRESSÃO (@media print)
   Garante relatórios fiscais / operacionais limpos em fundo branco
   independentemente do tema ativo na tela
   =================================================== */
@media print {
  html,
  body,
  body.admin-body,
  body.dfe-body,
  body.admin-body main,
  body.dfe-body main {
    background-color: #ffffff !important;
    color: #0f172a !important;
  }

  aside#admin-sidebar,
  aside#dfe-sidebar,
  body.admin-body > header,
  body.dfe-body > header,
  body.admin-body main > header,
  body.dfe-body main > header,
  body.admin-body footer,
  body.dfe-body footer,
  .print\:hidden {
    display: none !important;
  }
}

/* ========================================================
   12. MODAL DE ESPECIFICAÇÕES TÉCNICAS (SITE PÚBLICO)
   Visual limpo, elegante, moderno e alto contraste
   ======================================================== */
#service-modal {
  background-color: rgba(15, 23, 42, 0.8) !important;
  backdrop-filter: blur(4px) !important;
}

#service-modal .service-modal-box,
#service-modal > div {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
}

#service-modal h3,
#service-modal #srv-modal-title {
  color: #0f172a !important;
}

#service-modal p,
#service-modal #srv-modal-desc {
  color: #334155 !important;
}

#service-modal h4,
#service-modal h4 span {
  color: #475569 !important;
}

#service-modal #srv-modal-features li {
  background-color: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  color: #1e293b !important;
}

#service-modal #srv-modal-features li span {
  color: #1e293b !important;
}

#service-modal #srv-modal-quote-btn {
  background-color: #0284c7 !important;
  color: #ffffff !important;
}

#service-modal #srv-modal-quote-btn:hover {
  background-color: #0369a1 !important;
}

#service-modal #service-modal-close {
  background-color: rgba(15, 23, 42, 0.75) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

#service-modal #service-modal-close:hover {
  background-color: #0f172a !important;
}

/* ========================================================
   13. CARD DE PRÉVIA DE CONTATO (ADMIN/CONTATO.PHP)
   Dark Mode corporativo e Light Mode de alto contraste
   ======================================================== */
/* Modo Escuro (Padrão) */
.contact-preview-card,
html[data-theme="dark"] .contact-preview-card,
body.dark-theme .contact-preview-card,
body.admin-body:not(.light-theme) .contact-preview-card {
  background: linear-gradient(145deg, #0b132b 0%, #1c2541 100%) !important;
  border: 1px solid #334155 !important;
  color: #f8fafc !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3) !important;
}

.contact-preview-card .contact-header,
.contact-preview-card .contact-footer,
html[data-theme="dark"] .contact-preview-card .contact-header,
html[data-theme="dark"] .contact-preview-card .contact-footer,
body.dark-theme .contact-preview-card .contact-header,
body.dark-theme .contact-preview-card .contact-footer,
body.admin-body:not(.light-theme) .contact-preview-card .contact-header,
body.admin-body:not(.light-theme) .contact-preview-card .contact-footer {
  border-color: #334155 !important;
}

.contact-preview-card .contact-label,
html[data-theme="dark"] .contact-preview-card .contact-label,
body.dark-theme .contact-preview-card .contact-label,
body.admin-body:not(.light-theme) .contact-preview-card .contact-label {
  color: #94a3b8 !important;
}

.contact-preview-card .contact-value,
html[data-theme="dark"] .contact-preview-card .contact-value,
body.dark-theme .contact-preview-card .contact-value,
body.admin-body:not(.light-theme) .contact-preview-card .contact-value {
  color: #ffffff !important;
}

.contact-preview-card .contact-sub,
html[data-theme="dark"] .contact-preview-card .contact-sub,
body.dark-theme .contact-preview-card .contact-sub,
body.admin-body:not(.light-theme) .contact-preview-card .contact-sub {
  color: #cbd5e1 !important;
}

/* Modo Claro */
html[data-theme="light"] .contact-preview-card,
body.light-theme .contact-preview-card {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  color: #0f172a !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.03) !important;
}

html[data-theme="light"] .contact-preview-card .contact-header,
html[data-theme="light"] .contact-preview-card .contact-footer,
body.light-theme .contact-preview-card .contact-header,
body.light-theme .contact-preview-card .contact-footer {
  border-color: #e2e8f0 !important;
}

html[data-theme="light"] .contact-preview-card .contact-label,
body.light-theme .contact-preview-card .contact-label {
  color: #475569 !important;
}

html[data-theme="light"] .contact-preview-card .contact-value,
body.light-theme .contact-preview-card .contact-value {
  color: #0f172a !important;
}

html[data-theme="light"] .contact-preview-card .contact-sub,
body.light-theme .contact-preview-card .contact-sub {
  color: #64748b !important;
}

/* Accessibility: visible keyboard focus and reduced-motion preference. */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid #0284c7;
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.quote-honeypot { position: absolute !important; left: -10000px !important; width: 1px !important; height: 1px !important; overflow: hidden !important; }

/* ========================================================
   MASCOTE OFICIAL VERÇOZA - ESTILOS E WIDGET FLUTUANTE
   ======================================================== */
.mascot-float-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.mascot-speech-bubble {
  background: #ffffff;
  color: #0f172a;
  padding: 10px 14px;
  border-radius: 18px 18px 4px 18px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.25);
  border: 1px solid #cbd5e1;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  max-width: 220px;
  position: relative;
  transition: all 0.3s ease;
  animation: floatBounce 4s ease-in-out infinite;
}

html[data-theme="dark"] .mascot-speech-bubble,
body.dark-theme .mascot-speech-bubble {
  background: #1e293b;
  color: #f8fafc;
  border-color: #334155;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

@keyframes floatBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.mascot-avatar-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 9999px;
  background: linear-gradient(135deg, #25d366, #128c7e);
  box-shadow: 0 10px 25px -5px rgba(37, 211, 102, 0.5);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 3px solid #ffffff;
}

.mascot-avatar-btn:hover {
  transform: translateY(-4px) scale(1.06);
  box-shadow: 0 20px 30px -5px rgba(37, 211, 102, 0.65);
}

.mascot-avatar-btn img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.mascot-badge-online {
  position: absolute;
  bottom: 0px;
  right: 0px;
  width: 20px;
  height: 20px;
  background: #22c55e;
  border: 2px solid #ffffff;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

@media (max-width: 640px) {
  .mascot-float-widget {
    bottom: 16px;
    right: 16px;
    gap: 6px;
  }
  .mascot-avatar-btn {
    width: 56px;
    height: 56px;
  }
  .mascot-avatar-btn img {
    width: 42px;
    height: 42px;
  }
}

/* ========================================================
   REFINAMENTO DE UX & CONVERSÃO: SEÇÃO CONTATO E COTAÇÃO
   ======================================================== */

/* Botão CTA WhatsApp com elevação suave e brilho */
.btn-cta-whatsapp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff !important;
  font-weight: 800;
  border-radius: 1rem;
  box-shadow: 0 10px 25px -5px rgba(16, 185, 129, 0.4), 0 8px 10px -6px rgba(16, 185, 129, 0.3);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  text-decoration: none !important;
}

.btn-cta-whatsapp:hover {
  transform: translateY(-2px) scale(1.01);
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  box-shadow: 0 16px 32px -5px rgba(16, 185, 129, 0.55), 0 10px 15px -5px rgba(16, 185, 129, 0.4);
}

.btn-cta-whatsapp:active {
  transform: translateY(0) scale(0.99);
}

/* Botão CTA Cotação com elevação e brilho azul Verçoza */
.btn-cta-quote {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #42b3e5 0%, #0284c7 100%);
  color: #ffffff !important;
  font-weight: 800;
  border-radius: 1rem;
  box-shadow: 0 10px 25px -5px rgba(66, 179, 229, 0.4), 0 8px 10px -6px rgba(2, 132, 199, 0.3);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
  text-decoration: none !important;
}

.btn-cta-quote:hover {
  transform: translateY(-2px) scale(1.01);
  background: linear-gradient(135deg, #60c5f1 0%, #0369a1 100%);
  box-shadow: 0 16px 32px -5px rgba(66, 179, 229, 0.55), 0 10px 15px -5px rgba(2, 132, 199, 0.4);
}

.btn-cta-quote:active {
  transform: translateY(0) scale(0.99);
}

/* Card Hero de WhatsApp em destaque (Modo Escuro) */
.whatsapp-hero-card {
  position: relative;
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.12) 0%, rgba(11, 19, 43, 0.95) 55%, rgba(15, 23, 42, 0.98) 100%);
  border: 1.5px solid rgba(16, 185, 129, 0.35);
  border-radius: 1.5rem;
  box-shadow: 0 20px 35px -10px rgba(0, 0, 0, 0.5), 0 0 25px -5px rgba(16, 185, 129, 0.15);
  overflow: hidden;
  transition: all 0.3s ease;
}

.whatsapp-hero-card:hover {
  border-color: rgba(16, 185, 129, 0.6);
  box-shadow: 0 25px 40px -10px rgba(0, 0, 0, 0.6), 0 0 35px 0 rgba(16, 185, 129, 0.25);
}

/* Card Hero WhatsApp no Modo Claro (contato.php) */
.whatsapp-hero-card-light {
  position: relative;
  background: linear-gradient(145deg, #f0fdf4 0%, #ffffff 50%, #f8fafc 100%);
  border: 1.5px solid rgba(16, 185, 129, 0.4);
  border-radius: 1.5rem;
  box-shadow: 0 15px 30px -10px rgba(16, 185, 129, 0.15), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  transition: all 0.3s ease;
}

.whatsapp-hero-card-light:hover {
  border-color: rgba(16, 185, 129, 0.65);
  box-shadow: 0 20px 35px -10px rgba(16, 185, 129, 0.25);
}

/* Caixa uniforme de ícones corporativos Verçoza */
.contact-icon-vercoza {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  transition: all 0.25s ease;
}

/* Modo escuro (index.php) */
.contact-icon-vercoza-dark {
  background: rgba(66, 179, 229, 0.12);
  color: #42b3e5;
  border: 1px solid rgba(66, 179, 229, 0.25);
}
.contact-item-hover:hover .contact-icon-vercoza-dark {
  background: #42b3e5;
  color: #0b132b;
  transform: scale(1.06);
}

/* Modo claro (contato.php) */
.contact-icon-vercoza-light {
  background: #f0f9ff;
  color: #0284c7;
  border: 1px solid #bae6fd;
}
.contact-item-hover:hover .contact-icon-vercoza-light {
  background: #0284c7;
  color: #ffffff;
  transform: scale(1.06);
}

/* Container do Google Maps */
.google-maps-frame {
  width: 100%;
  height: 100%;
  border: 0;
  filter: contrast(102%) brightness(98%);
  transition: opacity 0.3s ease;
}

.map-card-wrapper {
  position: relative;
  border-radius: 1.25rem;
  overflow: hidden;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.map-card-wrapper:hover {
  box-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.3);
}

html[data-theme="light"] :is(body.admin-body, body.dfe-body) div:is(.welcome-hero-banner, .top-page-banner).text-white p.text-slate-300 { color: #475569 !important; }

@media print {
  @page {
    size: A4 landscape;
  }
}


/* ========================================================
   OTIMIZAÇÕES PROGRESSIVE WEB APP (PWA) & MOBILE WEB APP
   ======================================================== */
:root {
  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* Previne zoom acidental por duplo clique e melhora responsividade ao toque */
html, body {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Ajustes quando executado como App Instalado (Standalone) */
body.pwa-standalone {
  user-select: none;
  -webkit-user-select: none;
}
body.pwa-standalone input,
body.pwa-standalone textarea,
body.pwa-standalone [contenteditable="true"] {
  user-select: text;
  -webkit-user-select: text;
}

/* Barra de Navegação Inferior para Smartphones (Estilo App Nativo) */
.pwa-bottom-bar {
  display: none;
}

@media (max-width: 1023px) {
  .pwa-bottom-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 40;
    height: calc(3.85rem + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(11, 19, 43, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(51, 65, 85, 0.7);
    align-items: center;
    justify-content: space-around;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.35);
  }

  /* Compensa a barra inferior no conteúdo principal para não cobrir botões */
  main {
    padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px)) !important;
  }

  .pwa-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 0.65rem;
    font-weight: 600;
    text-decoration: none;
    flex: 1;
    height: 100%;
    transition: color 0.15s ease, transform 0.15s ease;
  }

  .pwa-nav-item i {
    font-size: 1.15rem;
    margin-bottom: 0.2rem;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .pwa-nav-item.active,
  .pwa-nav-item:active {
    color: #38b6ff;
  }

  .pwa-nav-item.active i {
    transform: scale(1.15);
    color: #38b6ff;
  }

  /* Botão de Destaque Central (Novo BDE / Câmera) */
  .pwa-nav-fab {
    position: relative;
    top: -0.65rem;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 9999px;
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff !important;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.6), 0 0 0 4px #0b132b;
    border: none;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
    flex: 0 0 auto;
    margin: 0 0.25rem;
  }

  .pwa-nav-fab i {
    font-size: 1.35rem;
    margin-bottom: 0;
  }

  .pwa-nav-fab:active {
    transform: scale(0.92);
  }
}

/* Banner de Instalação Mobile Flutuante */
.pwa-install-banner {
  animation: pwaSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pwaSlideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Indicador de rolagem suave em tabelas mobile */
@media (max-width: 768px) {
  .overflow-x-auto {
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
  }
}


/* ============================================================================
   REFINAMENTO GLOBAL DE CONTRASTE & LEGIBILIDADE (TEMA CLARO - LIGHT MODE)
   Garante conformidade WCAG AA em todas as telas, cards, tabelas, modais e formulários
   ============================================================================ */

/* Placeholders de alta legibilidade no Tema Claro */
html[data-theme="light"] :is(body.admin-body, body.dfe-body) input::placeholder,
html[data-theme="light"] :is(body.admin-body, body.dfe-body) textarea::placeholder {
  color: #64748b !important;
  opacity: 1 !important;
}

/* Inputs, selects e textareas: fundo branco com borda e texto nítidos */
html[data-theme="light"] :is(body.admin-body, body.dfe-body) input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="submit"]):not([type="button"]):not([type="hidden"]),
html[data-theme="light"] :is(body.admin-body, body.dfe-body) select,
html[data-theme="light"] :is(body.admin-body, body.dfe-body) textarea {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}

html[data-theme="light"] :is(body.admin-body, body.dfe-body) input:focus,
html[data-theme="light"] :is(body.admin-body, body.dfe-body) select:focus,
html[data-theme="light"] :is(body.admin-body, body.dfe-body) textarea:focus {
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.22) !important;
}

/* Caixas de gradiente escuro e caixas informativas adaptadas ao Tema Claro */
html[data-theme="light"] :is(body.admin-body, body.dfe-body) :is(
  .from-blue-900\/30,
  .to-indigo-950\/40,
  .bg-blue-900\/30,
  .bg-indigo-950\/40
):not(.vercoza-modal-backdrop) {
  background-image: none !important;
  background-color: #f0f9ff !important;
  border-color: #bae6fd !important;
  color: #0c4a6e !important;
}

html[data-theme="light"] :is(body.admin-body, body.dfe-body) :is(
  .from-blue-900\/30,
  .to-indigo-950\/40
):not(.vercoza-modal-backdrop) :is(h1, h2, h3, h4, strong, b) {
  color: #0369a1 !important;
}

html[data-theme="light"] :is(body.admin-body, body.dfe-body) :is(
  .from-blue-900\/30,
  .to-indigo-950\/40
):not(.vercoza-modal-backdrop) :is(p, span, div):not(.badge) {
  color: #0c4a6e !important;
}

/* Sub-blocos informativos internos (ex: regra operacional BDE em contadores) */
html[data-theme="light"] :is(body.admin-body, body.dfe-body) div.bg-slate-900\/60 {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
  color: #1e293b !important;
}

html[data-theme="light"] :is(body.admin-body, body.dfe-body) div.bg-slate-900\/60 :is(strong, b, span, p) {
  color: #1e293b !important;
}

html[data-theme="light"] :is(body.admin-body, body.dfe-body) div.bg-slate-900\/60 code {
  background-color: #f1f5f9 !important;
  color: #0284c7 !important;
  border: 1px solid #e2e8f0 !important;
}

/* Modais no Tema Claro: Títulos, textos e rodapés de alta legibilidade */
html[data-theme="light"] .vercoza-modal-dialog,
html[data-theme="light"] body.admin-body div.fixed.inset-0[id*="modal"]:not(#service-modal) > div,
html[data-theme="light"] body.dfe-body div.fixed.inset-0[id*="modal"]:not(#service-modal) > div {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
}

html[data-theme="light"] .vercoza-modal-dialog :is(h1, h2, h3, h4, strong.text-white),
html[data-theme="light"] div.fixed.inset-0[id*="modal"] :is(h1, h2, h3, h4, .text-white):not(button):not(button *):not(.bg-vercoza-blue *):not(.bg-emerald-600 *) {
  color: #0f172a !important;
}

html[data-theme="light"] div.fixed.inset-0[id*="modal"] label {
  color: #334155 !important;
}

/* Botões de fechar modal (X) e botões secundários Cancelar dentro de modais */
html[data-theme="light"] div.fixed.inset-0[id*="modal"] button:has(.fa-xmark) {
  color: #64748b !important;
}
html[data-theme="light"] div.fixed.inset-0[id*="modal"] button:has(.fa-xmark):hover {
  color: #0f172a !important;
  background-color: #f1f5f9 !important;
}

/* Tabelas no Tema Claro: Cabeçalhos com contraste nítido */
html[data-theme="light"] :is(body.admin-body, body.dfe-body) table thead th {
  background-color: #f8fafc !important;
  color: #334155 !important;
  font-weight: 700 !important;
  border-bottom: 2px solid #e2e8f0 !important;
}

html[data-theme="light"] :is(body.admin-body, body.dfe-body) table tbody tr {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border-bottom: 1px solid #f1f5f9 !important;
}

html[data-theme="light"] :is(body.admin-body, body.dfe-body) table tbody tr:nth-child(even) {
  background-color: #f8fafc !important;
}

html[data-theme="light"] :is(body.admin-body, body.dfe-body) table tbody tr:hover {
  background-color: #f1f5f9 !important;
}

/* 10. BLOCOS PRE E DIAGNÓSTICO JSON */
html[data-theme="light"] :is(body.admin-body, body.dfe-body) pre {
  background-color: #f8fafc !important;
  color: #0f172a !important;
  border: 1px solid #e2e8f0 !important;
}

html[data-theme="dark"] :is(body.admin-body, body.dfe-body) pre {
  background-color: #090e1a !important;
  color: #f1f5f9 !important;
  border: 1px solid #1e293b !important;
}


/* ===================================================
   11. CONTRASTE MÍNIMO EM TEXTOS, SELOS E BOTÕES
   Corrige combinações medidas abaixo de 4,5:1 nas telas
   =================================================== */

/* Botões de cor sólida com texto branco, nos dois temas */
:is(body.admin-body, body.dfe-body) .bg-vercoza-blue,
html[data-theme="light"] aside#admin-sidebar nav a.bg-vercoza-blue,
html[data-theme="light"] aside#dfe-sidebar nav a.bg-vercoza-blue {
  background-color: #0369a1 !important;
  border-color: #0369a1 !important;
  color: #ffffff !important;
}
:is(body.admin-body, body.dfe-body) .bg-vercoza-blue :is(span, i) {
  color: #ffffff !important;
}
:is(body.admin-body, body.dfe-body) :is(button, a):is(.bg-emerald-500, .bg-emerald-600) {
  background-color: #047857 !important;
  color: #ffffff !important;
}
:is(body.admin-body, body.dfe-body) :is(button, a):is(.bg-emerald-500, .bg-emerald-600) :is(span, i) {
  color: #ffffff !important;
}

/* Texto dentro de faixas âmbar translúcidas no tema escuro */
html[data-theme="dark"] [class*="bg-amber-500/"],
html[data-theme="dark"] [class*="bg-amber-500/"] :is(span, p, div, strong, b, i):not(button *) {
  color: #fcd34d !important;
}
html[data-theme="dark"] [class*="bg-amber-500/"] :is(p, .text-slate-600, .text-slate-500) {
  color: #fde68a !important;
}

/* Selos translúcidos no tema claro */
html[data-theme="light"] :is([class*="bg-amber-500/"], [class*="bg-amber-900/"], [class*="bg-amber-950/"]):is(span, a) {
  background-color: #fef3c7 !important;
  color: #92400e !important;
}
html[data-theme="light"] :is([class*="bg-emerald-500/"], [class*="bg-emerald-900/"]):is(span, a) {
  background-color: #d1fae5 !important;
  color: #065f46 !important;
}
html[data-theme="light"] [class*="bg-teal-500/"]:is(span, a) {
  background-color: #ccfbf1 !important;
  color: #115e59 !important;
}
html[data-theme="light"] [class*="bg-sky-900/"]:is(span, a) {
  background-color: #e0f2fe !important;
  color: #075985 !important;
}
html[data-theme="light"] span[class*="bg-slate-900/"] {
  background-color: #e2e8f0 !important;
  color: #334155 !important;
}

/* Títulos dos grupos do menu lateral no tema claro */
html[data-theme="light"] :is(aside#admin-sidebar, aside#dfe-sidebar) [class*="uppercase"]:not([class*="bg-"]),
html[data-theme="light"] :is(aside#admin-sidebar, aside#dfe-sidebar) [class*="uppercase"]:not([class*="bg-"]) > span:not([class*="bg-"]) {
  color: #475569 !important;
}

/* Cores claras de texto sobre fundo branco no tema claro */
html[data-theme="light"] :is(body.admin-body, body.dfe-body) :is(.text-amber-500, .text-amber-600) { color: #92400e !important; }
html[data-theme="light"] :is(body.admin-body, body.dfe-body) :is(.text-emerald-500, .text-emerald-600) { color: #047857 !important; }
html[data-theme="light"] :is(body.admin-body, body.dfe-body) :is(.text-cyan-500, .text-cyan-600) { color: #0e7490 !important; }
html[data-theme="light"] :is(body.admin-body, body.dfe-body) :is(.text-teal-300, .text-teal-400) { color: #0f766e !important; }
html[data-theme="light"] :is(body.admin-body, body.dfe-body) :is(.text-blue-400, .text-sky-500, .text-sky-600, .text-vercoza-blue) { color: #0369a1 !important; }
html[data-theme="light"] :is(body.admin-body, body.dfe-body) .text-rose-500 { color: #be123c !important; }
/* Selos sobre itens ativos e botões verdes dentro de faixas âmbar */
:is(body.admin-body, body.dfe-body) .bg-vercoza-blue span[class*="bg-"] {
  background-color: rgba(255, 255, 255, 0.2) !important;
  color: #ffffff !important;
}
html[data-theme="light"] :is(body.admin-body, body.dfe-body) [class*="bg-amber-500/"] :is(button, a):is(.bg-emerald-500, .bg-emerald-600),
html[data-theme="light"] :is(body.admin-body, body.dfe-body) [class*="bg-amber-500/"] :is(button, a):is(.bg-emerald-500, .bg-emerald-600) :is(span, i) {
  color: #ffffff !important;
}
/* Botao verde de acao continua legivel dentro de linha destacada da tabela */
html[data-theme] :is(body.admin-body, body.dfe-body) tr :is(button, a):is(.bg-emerald-500, .bg-emerald-600) :is(span, i, .acao-verde-texto) {
  color: #ffffff !important;
}

/* Campo que o usuário precisa achar e editar (ex.: descrição dos itens do BM) */
:is(body.admin-body, body.dfe-body) textarea.campo-editavel-destaque,
html[data-theme="light"] :is(body.admin-body, body.dfe-body) textarea.campo-editavel-destaque {
  border-color: #f59e0b !important;
  border-width: 2px !important;
  background-color: color-mix(in srgb, #f59e0b 9%, var(--app-input)) !important;
}
