/* ========================================================
   Sinai Pest Control - Folha de Estilos Unificada & PWA 3.0
   Design System Ultra-Moderno: Mobile-First, Glassmorphism,
   Micro-interações, Alta Legibilidade e Performance PWA.
   ======================================================== */

:root {
  /* Tipografia Base */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Cores Base da Marca (Sinai Blue Palette) */
  --navy-dark: #071a2d;
  --navy: #102a43;
  --navy-light: #1c466b;
  --navy-hover: #245887;
  --accent: #0284c7;
  --accent-light: #38bdf8;
  --accent-hover: #0369a1;
  --accent-glow: rgba(2, 132, 199, 0.22);
  
  /* Badges e Estados Operacionais */
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.1);
  --success-border: rgba(16, 185, 129, 0.3);
  --success-text: #065f46;
  
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --warning-border: rgba(245, 158, 11, 0.3);
  --warning-text: #92400e;
  
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.1);
  --danger-border: rgba(239, 68, 68, 0.3);
  --danger-text: #991b1b;
  
  /* Superfícies & Layout (Modo Claro Padrão) */
  --page-bg: #f8fafc;
  --header-bg: rgba(7, 26, 45, 0.94);
  --header-border: rgba(255, 255, 255, 0.12);
  --card-bg: #ffffff;
  --surface: #ffffff;
  --card-hover-bg: #f8fafc;
  --line: #e2e8f0;
  --line-hover: #cbd5e1;
  
  /* Tipografia e Cores de Texto */
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-contrast: #ffffff;
  --black: #0f172a;
  --white: #ffffff;
  --muted: #64748b;
  
  /* Formulários */
  --input-bg: #ffffff;
  --input-border: #cbd5e1;
  --input-focus-border: #0284c7;
  --input-text: #0f172a;
  
  /* Sombras Modernas e Suaves */
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 16px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -2px rgba(15, 23, 42, 0.03);
  --shadow-lg: 0 12px 32px -4px rgba(15, 23, 42, 0.09), 0 4px 12px -2px rgba(15, 23, 42, 0.04);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --transition: all 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* ========================================================
   MODO ESCURO (DARK MODE)
   Ativado via [data-theme="dark"] na tag <html>
   ======================================================== */
[data-theme="dark"] {
  --navy-dark: #f8fafc;
  --navy: #38bdf8;
  --navy-light: #7dd3fc;
  --navy-hover: #0284c7;
  --accent: #38bdf8;
  --accent-light: #7dd3fc;
  --accent-hover: #0ea5e9;
  --accent-glow: rgba(56, 189, 248, 0.3);
  
  --page-bg: #070e17;
  --header-bg: rgba(7, 14, 23, 0.94);
  --header-border: rgba(56, 189, 248, 0.15);
  --card-bg: #0f1926;
  --surface: #0f1926;
  --card-hover-bg: #142234;
  --line: #192a3f;
  --line-hover: #263e5e;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-contrast: #ffffff;
  --black: #f8fafc;
  --white: #0f1926;
  --muted: #94a3b8;
  
  --input-bg: #0a1320;
  --input-border: #1a2a40;
  --input-focus-border: #38bdf8;
  --input-text: #f8fafc;
  
  --success: #34d399;
  --success-bg: rgba(16, 185, 129, 0.18);
  --success-border: rgba(16, 185, 129, 0.4);
  --success-text: #34d399;
  
  --warning: #fcd34d;
  --warning-bg: rgba(245, 158, 11, 0.18);
  --warning-border: rgba(245, 158, 11, 0.4);
  --warning-text: #fcd34d;
  
  --danger: #f87171;
  --danger-bg: rgba(239, 68, 68, 0.18);
  --danger-border: rgba(239, 68, 68, 0.4);
  --danger-text: #f87171;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 6px 20px -2px rgba(0, 0, 0, 0.65), 0 2px 8px -2px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px -4px rgba(0, 0, 0, 0.85);
}

/* ========================================================
   RESETS & TIPOGRAFIA GLOBAL (100% NATIVE SCALE)
   ======================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
  color-scheme: light dark;
  background-color: var(--page-bg);
  -webkit-text-size-adjust: 100%;
}

/* Escala compacta de 80% exclusiva para telas de Computador/PC (Desktop) */
@media (min-width: 769px) {
  html:not(.login-html):not(:has(.login-page)) {
    zoom: 0.8;
  }

  /* Compensa exatamente a proporção do zoom (100vh / 0.8 = 125vh) para garantir
     que o body ocupe 100% da viewport real do navegador, mantendo o sticky footer
     perfeitamente colado ao rodapé mesmo em telas com pouco conteúdo */
  body:not(.login-body):not(:has(.login-page)) {
    min-height: calc(100vh / 0.8);
    min-height: calc(100dvh / 0.8);
  }

  @supports not (zoom: 1) {
    body:not(.login-body):not(:has(.login-page)) {
      transform: scale(0.8);
      transform-origin: top center;
      width: 125%;
      min-height: calc(100vh / 0.8);
    }
  }
}

/* Escala 100% nativa para Versão Mobile (<= 768px): máxima ergonomia, legibilidade e toque */
@media (max-width: 768px) {
  html:not(.login-html):not(:has(.login-page)) {
    zoom: 1 !important;
  }

  body {
    min-height: 100vh;
    min-height: 100dvh;
  }
}

@media print {
  html {
    zoom: 1 !important;
  }
  .app-header,
  .app-footer,
  .mobile-bottom-bar,
  .mobile-sticky-action-bar,
  .nav-backdrop {
    display: none !important;
  }
}

body {
  /* Escala global ajustada para 80% do tamanho atual */
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-sans);
  color: var(--text-main);
  background-color: var(--page-bg);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  transition: background-color 220ms ease, color 220ms ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  width: 100%;
}

/* Trava de scroll de fundo quando o drawer mobile está aberto */
body.menu-locked {
  overflow: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
}

/* ========================================================
   HEADER & NAVEGAÇÃO SUPERIOR (GLASSMORPHISM)
   ======================================================== */
.app-header {
  background: var(--header-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #ffffff;
  border-bottom: 1px solid var(--header-border);
  position: sticky;
  top: 0;
  z-index: 500;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
  transition: background 220ms ease, border-color 220ms ease;
}

.header-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #ffffff;
  transition: opacity 160ms ease;
  flex-shrink: 0;
}

.brand-link:hover {
  opacity: 0.92;
}

/* Logo Oficial - Tamanho Estrito e Trava Visual */
.brand-logo-img {
  width: 40px !important;
  height: 40px !important;
  max-width: 40px !important;
  max-height: 40px !important;
  min-width: 40px !important;
  min-height: 40px !important;
  flex: 0 0 40px !important;
  object-fit: cover !important;
  border-radius: 50% !important;
  background: #ffffff !important;
  padding: 2px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35) !important;
  display: block !important;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.brand-tag {
  font-size: 0.72rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

/* Área de ações do Header no Mobile (botão tema + toggle) */
.header-mobile-right {
  display: none;
  align-items: center;
  gap: 10px;
}

.header-theme-toggle {
  display: none;
}

/* Navegação Principal (Desktop) */
.nav-menu {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-menu-header-mobile {
  display: none;
}

.nav-item {
  color: #cbd5e1;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 8px 14px;
  border-radius: 8px;
  transition: all 180ms ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nav-item:hover, .nav-item.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

.nav-item.active {
  background: rgba(56, 189, 248, 0.18);
  color: #38bdf8;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.08);
  padding: 4px 12px 4px 6px;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  margin-left: 4px;
}

.user-avatar {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
  color: #071a2d;
  font-weight: 800;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.1;
  color: #ffffff;
}

.user-role {
  font-size: 0.65rem;
  color: #94a3b8;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.btn-install {
  background: #0284c7;
  color: #ffffff;
  border: 0;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 160ms, transform 160ms;
}

.btn-install:hover {
  background: #0369a1;
  transform: translateY(-1px);
}

.header-user-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-logout {
  background: rgba(239, 68, 68, 0.14);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 160ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-logout:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
  transform: translateY(-1px);
}

/* Botão Moderno de Alternância de Tema */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #f8fafc;
  cursor: pointer;
  font-size: 1.15rem;
  transition: all 200ms cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  flex-shrink: 0;
}

.theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.24);
  transform: scale(1.08);
  box-shadow: 0 0 14px var(--accent-glow);
}

.theme-toggle-btn:active {
  transform: scale(0.92);
}

/* Ícones do alternador */
.theme-icon-light,
.theme-icon-dark {
  line-height: 1;
  display: inline-block;
}

:root:not([data-theme="dark"]) .theme-icon-light {
  display: none !important;
}
:root:not([data-theme="dark"]) .theme-icon-dark {
  display: inline-block !important;
}

[data-theme="dark"] .theme-icon-light {
  display: inline-block !important;
}
[data-theme="dark"] .theme-icon-dark {
  display: none !important;
}

/* Botão Hambúrguer Animado para Telas Mobile */
.mobile-toggle {
  display: none;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  padding: 10px 11px;
  justify-content: center;
  align-items: center;
  width: 42px;
  height: 42px;
  transition: all 180ms ease;
}

.mobile-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: #ffffff;
  border-radius: 2px;
  transition: transform 220ms ease, opacity 220ms ease;
  transform-origin: center;
}

.mobile-toggle.is-active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.mobile-toggle.is-active span:nth-child(2) {
  opacity: 0;
}
.mobile-toggle.is-active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Overlay Backdrop do Menu Mobile (Escurece o fundo suavemente sem borrar o menu) */
.nav-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(3, 7, 18, 0.6);
  z-index: 400;
  opacity: 0;
  transition: opacity 200ms ease;
  pointer-events: none;
}

.nav-backdrop.is-visible {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

/* ========================================================
   CONTEÚDO PRINCIPAL & LAYOUT
   ======================================================== */
.main-content {
  flex: 1 0 auto;
  padding: 28px 20px 48px;
}

.container {
  max-width: 1240px;
  margin: 0 auto;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.page-title {
  font-size: clamp(1.35rem, 3.2vw, 1.85rem);
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: clamp(0.85rem, 2vw, 0.95rem);
  margin-top: 4px;
  line-height: 1.45;
}

/* ========================================================
   ALERTAS VISUAIS
   ======================================================== */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-weight: 600;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.alert-success {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}

.alert-danger {
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid var(--danger-border);
}

/* ========================================================
   MÉTRICAS / CARDS DO ADM (STATS)
   ======================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.stat-card:active {
  transform: scale(0.98);
}

.stat-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: color 180ms ease;
}

.stat-card:hover .stat-label {
  color: var(--text-main);
}

.stat-icon {
  font-size: 1.35rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.08);
  transition: transform 200ms ease, background-color 200ms ease;
}

.stat-card:hover .stat-icon {
  transform: scale(1.06);
  background: rgba(56, 189, 248, 0.16);
}

.stat-number {
  font-size: clamp(1.8rem, 3.5vw, 2.2rem);
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
  letter-spacing: -0.02em;
}

/* ========================================================
   CARD DE DESTAQUE (FUNCIONÁRIO)
   ======================================================== */
.highlight-card {
  background: linear-gradient(135deg, #071a2d 0%, #102a43 60%, #1c466b 100%);
  color: #ffffff;
  border-radius: 20px;
  padding: clamp(20px, 4vw, 28px);
  margin-bottom: 28px;
  box-shadow: 0 16px 36px rgba(7, 26, 45, 0.35);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

[data-theme="dark"] .highlight-card {
  background: linear-gradient(135deg, #071526 0%, #0d223d 60%, #133357 100%);
  border-color: rgba(56, 189, 248, 0.3);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
  color: #f1f5f9;
}

.highlight-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(56, 189, 248, 0.22);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.45);
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

.highlight-title {
  font-size: clamp(1.25rem, 3vw, 1.55rem);
  font-weight: 800;
  margin-bottom: 8px;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.highlight-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 16px 0 22px;
  font-size: 0.92rem;
  color: #e2e8f0;
}

[data-theme="dark"] .highlight-details {
  color: #cbd5e1;
}

[data-theme="dark"] .highlight-details strong {
  color: #ffffff;
}

/* ========================================================
   CARDS DE SERVIÇOS E REGISTROS (GRID MODERNO)
   ======================================================== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}

.service-card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}

.service-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--line-hover);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.card-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.card-info-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.88rem;
}

.card-info-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  word-break: break-word;
  font-size: 0.88rem;
}

.card-info-item > span:first-child {
  width: 26px;
  height: 26px;
  min-width: 26px;
  border-radius: 7px;
  background: var(--card-hover-bg);
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.84rem;
  line-height: 1;
  flex-shrink: 0;
}

.card-info-item strong {
  color: var(--text-main);
  font-weight: 700;
}

.card-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

/* ========================================================
   BADGES DE STATUS (POLIDAS COM LIVE DOT)
   ======================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  gap: 6px;
  line-height: 1;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.badge-pendente {
  background: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid var(--warning-border);
}
.badge-pendente::before {
  background: var(--warning);
}

.badge-concluido {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}
.badge-concluido::before {
  background: var(--success);
}

.badge-andamento {
  background: rgba(56, 189, 248, 0.14);
  color: #0284c7;
  border: 1px solid rgba(56, 189, 248, 0.35);
}
.badge-andamento::before {
  background: #0284c7;
}

[data-theme="dark"] .badge-pendente {
  background: rgba(245, 158, 11, 0.18) !important;
  color: #fcd34d !important;
  border-color: rgba(245, 158, 11, 0.4) !important;
}

[data-theme="dark"] .badge-concluido {
  background: rgba(16, 185, 129, 0.18) !important;
  color: #6ee7b7 !important;
  border-color: rgba(16, 185, 129, 0.4) !important;
}

[data-theme="dark"] .badge-andamento {
  background: rgba(56, 189, 248, 0.18) !important;
  color: #7dd3fc !important;
  border-color: rgba(56, 189, 248, 0.4) !important;
}

/* ========================================================
   ACORDEÃO DE DOCUMENTOS (CLIENTE & ADM)
   ======================================================== */
.accordion-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.accordion-card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 200ms ease, border-color 200ms ease;
}

.accordion-card.is-open {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.accordion-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  background: var(--card-bg);
  user-select: none;
  transition: background 160ms ease;
  gap: 12px;
}

.accordion-header:hover {
  background: var(--card-hover-bg);
}

.accordion-title-box {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.accordion-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.accordion-date {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.4;
}

.accordion-icon {
  font-size: 0.9rem;
  color: var(--accent);
  transition: transform 220ms ease;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.1);
  flex-shrink: 0;
}

.accordion-card.is-open .accordion-icon {
  transform: rotate(180deg);
}

.accordion-content {
  display: none;
  padding: 20px;
  background: var(--page-bg);
  border-top: 1px solid var(--line);
}

.accordion-card.is-open .accordion-content {
  display: block;
}

.docs-sequence-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.doc-download-item {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.doc-download-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--line-hover);
}

.doc-order-badge {
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 6px;
  background: linear-gradient(135deg, #071a2d 0%, #1c466b 100%);
  color: #ffffff;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.doc-badge-1 {
  background: #0284c7;
  color: #ffffff;
}

.doc-badge-2 {
  background: #102a43;
  color: #ffffff;
}

.doc-badge-3 {
  background: #475569;
  color: #ffffff;
}

.doc-badge-4 {
  background: #059669;
  color: #ffffff;
}

[data-theme="dark"] .doc-order-badge {
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #f8fafc;
}

[data-theme="dark"] .doc-badge-1 {
  background: rgba(2, 132, 199, 0.28) !important;
  color: #38bdf8 !important;
  border: 1px solid rgba(56, 189, 248, 0.5) !important;
}

[data-theme="dark"] .doc-badge-2 {
  background: rgba(99, 102, 241, 0.28) !important;
  color: #a5b4fc !important;
  border: 1px solid rgba(165, 180, 252, 0.5) !important;
}

[data-theme="dark"] .doc-badge-3 {
  background: rgba(148, 163, 184, 0.22) !important;
  color: #e2e8f0 !important;
  border: 1px solid rgba(148, 163, 184, 0.45) !important;
}

[data-theme="dark"] .doc-badge-4 {
  background: rgba(16, 185, 129, 0.28) !important;
  color: #6ee7b7 !important;
  border: 1px solid rgba(110, 231, 183, 0.5) !important;
}

.doc-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
}

.doc-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

/* ========================================================
   BARRA DE PESQUISA & FILTROS
   ======================================================== */
.search-filter-bar {
  background: var(--card-bg);
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.search-input-wrap {
  flex: 1;
  min-width: 240px;
  position: relative;
}

.search-input-wrap input {
  width: 100%;
  padding: 11px 16px;
  border: 1px solid var(--input-border);
  border-radius: 10px;
  font-size: 0.92rem;
  outline: none;
  background: var(--input-bg);
  color: var(--input-text);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.search-input-wrap input:focus {
  border-color: var(--input-focus-border);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ========================================================
   BOTÕES MODERNOS & TOUCH-FRIENDLY
   ======================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  min-height: 42px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  border: 0;
  transition: all 180ms ease;
  user-select: none;
  line-height: 1;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, #102a43 0%, #1c466b 100%);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(16, 42, 67, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #071a2d 0%, #102a43 100%);
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(16, 42, 67, 0.28);
}

[data-theme="dark"] .btn-primary {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  border: 1px solid rgba(56, 189, 248, 0.3);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
  color: #ffffff;
}

[data-theme="dark"] .btn-primary:hover {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
}

.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(16, 185, 129, 0.22);
}

.btn-success:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(16, 185, 129, 0.3);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(239, 68, 68, 0.22);
}

.btn-danger:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(239, 68, 68, 0.3);
}

.btn-danger-outline {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #dc2626;
}

.btn-danger-outline:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: #dc2626;
  color: #b91c1c;
  transform: translateY(-1px);
}

[data-theme="dark"] .btn-danger-outline {
  border-color: rgba(248, 113, 113, 0.45) !important;
  color: #f87171 !important;
  background: rgba(239, 68, 68, 0.08) !important;
}

[data-theme="dark"] .btn-danger-outline:hover {
  background: rgba(239, 68, 68, 0.22) !important;
  border-color: #f87171 !important;
  color: #ffffff !important;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-main);
}

.btn-outline:hover {
  background: var(--card-hover-bg);
  border-color: var(--line-hover);
  transform: translateY(-1px);
}

[data-theme="dark"] .btn-outline {
  border-color: #24466d !important;
  color: #e2e8f0 !important;
  background: rgba(255, 255, 255, 0.05) !important;
}

[data-theme="dark"] .btn-outline:hover {
  border-color: #38bdf8 !important;
  color: #ffffff !important;
  background: rgba(56, 189, 248, 0.18) !important;
}

.btn-sm {
  padding: 6px 12px;
  min-height: 34px;
  font-size: 0.82rem;
  border-radius: 8px;
}

/* ========================================================
   FORMULÁRIOS & CAIXAS
   ======================================================== */
.form-box {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: clamp(20px, 4vw, 32px);
  box-shadow: var(--shadow-sm);
  max-width: 820px;
  margin: 0 auto;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.field-group label {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-main);
}

select,
input,
textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--input-border);
  border-radius: 10px;
  font: inherit;
  font-size: 0.94rem;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
  background: var(--input-bg);
  color: var(--input-text);
}

select option {
  background: var(--card-bg);
  color: var(--text-main);
}

.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus,
select:focus,
input:focus,
textarea:focus {
  border-color: var(--input-focus-border);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.field-group small {
  color: var(--text-muted);
  font-size: 0.82rem;
}

@media (max-width: 768px) {
  select,
  input,
  textarea {
    font-size: 16px !important;
  }
}

/* Scrollbar Personalizada */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.6);
}

/* Abas PWA Modernas */
.pwa-tabs-nav {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--line);
  padding-bottom: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 640px) {
  .pwa-tabs-nav {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    border-bottom: 0;
    padding-bottom: 0;
  }
  .pwa-tabs-nav .btn {
    width: 100%;
    text-align: center;
  }
}

/* Barra de Abas / Chips Rápidos */
.quick-tabs-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
@media (max-width: 640px) {
  .quick-tabs-bar {
    display: flex;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
  }
  .quick-tabs-bar .btn {
    white-space: nowrap;
    flex-shrink: 0;
  }
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

/* ========================================================
   ESTADO VAZIO (EMPTY STATE)
   ======================================================== */
.empty-state {
  background: var(--card-bg);
  border: 1px dashed var(--line-hover);
  border-radius: 16px;
  padding: 40px 20px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  color: var(--text-muted);
}

/* ========================================================
   TELA DE LOGIN (SPLIT CARD / MOBILE HERO 100% NATIVE SCALE)
   ======================================================== */
html.login-html,
html:has(.login-page) {
  zoom: 1 !important;
  height: 100% !important;
  min-height: 100% !important;
  background-color: #071a2d !important;
  background: #071a2d !important;
  overflow-x: hidden;
}

[data-theme="dark"] html.login-html,
[data-theme="dark"] html:has(.login-page) {
  background-color: #040a12 !important;
  background: #040a12 !important;
}

body.login-body,
body:has(.login-page) {
  zoom: 1 !important;
  transform: none !important;
  width: 100% !important;
  min-height: 100vh !important;
  min-height: 100dvh !important;
  margin: 0 !important;
  padding: 0 !important;
  background-color: #071a2d !important;
  background: #071a2d !important;
  display: flex !important;
  flex-direction: column !important;
  overflow-x: hidden !important;
}

[data-theme="dark"] body.login-body,
[data-theme="dark"] body:has(.login-page) {
  background-color: #040a12 !important;
  background: #040a12 !important;
}

.login-page {
  flex: 1 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  padding: 40px 20px;
  background: linear-gradient(135deg, #071a2d 0%, #102a43 58%, #1c466b 100%);
  position: relative;
  box-sizing: border-box;
}

[data-theme="dark"] .login-page {
  background: linear-gradient(135deg, #040a12 0%, #081628 58%, #0f243d 100%);
}

.login-theme-toggle {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 20;
}

.login-card {
  display: grid;
  width: 100%;
  max-width: 880px;
  min-height: 480px;
  background: var(--card-bg);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.45);
  grid-template-columns: 0.85fr 1.15fr;
  border: 1px solid rgba(255, 255, 255, 0.12);
  margin: auto;
  position: relative;
  z-index: 5;
}

[data-theme="dark"] .login-card {
  border-color: rgba(56, 189, 248, 0.2);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.75);
}

.login-brand {
  background: linear-gradient(145deg, #071a2d 0%, #102a43 100%);
  color: #ffffff;
  padding: 44px 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .login-brand {
  background: linear-gradient(145deg, #060e1a 0%, #0d1e34 100%);
}

.brand-mark {
  width: 64px;
  height: 64px;
  background: #ffffff;
  color: var(--navy);
  font-weight: 900;
  font-size: 1.5rem;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-logo-img {
  width: 72px !important;
  height: 72px !important;
  max-width: 72px !important;
  max-height: 72px !important;
  min-width: 72px !important;
  min-height: 72px !important;
  flex: 0 0 72px !important;
  object-fit: cover !important;
  border-radius: 50% !important;
  background: #ffffff !important;
  padding: 3px !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45) !important;
  display: block !important;
}

.login-content {
  padding: 44px clamp(24px, 5vw, 48px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--card-bg);
}

.login-eyebrow {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 6px;
}

.login-title {
  font-size: clamp(1.6rem, 3.5vw, 2rem);
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.login-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 22px;
}

/* ========================================================
   RODAPÉ (FOOTER)
   ======================================================== */
.app-footer {
  background: var(--header-bg);
  color: #94a3b8;
  font-size: 0.82rem;
  padding: 16px 20px;
  border-top: 1px solid var(--header-border);
  margin-top: auto;
  flex-shrink: 0;
  width: 100%;
}

.app-footer p {
  margin: 0;
  line-height: 1.5;
}

.app-footer strong {
  color: #ffffff;
  font-weight: 700;
}

.footer-container {
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.pwa-status {
  font-weight: 700;
  color: var(--success);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

@media (max-width: 768px) {
  .app-footer {
    padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  }
}

/* ========================================================
   BARRA DE NAVEGAÇÃO INFERIOR MOBILE (PWA DOCK)
   Disponível exclusivamente para Telas Pequenas (<= 768px)
   ======================================================== */
.mobile-bottom-bar {
  display: none;
}

@media (max-width: 768px) {
  .mobile-bottom-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(62px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(7, 26, 45, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    align-items: center;
    justify-content: space-around;
    z-index: 450;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.35);
  }

  [data-theme="dark"] .mobile-bottom-bar {
    background: rgba(6, 14, 25, 0.96);
    border-top-color: rgba(56, 189, 248, 0.18);
  }

  .bottom-bar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 100%;
    text-decoration: none;
    color: #94a3b8;
    background: transparent;
    border: 0;
    cursor: pointer;
    transition: all 160ms ease;
    user-select: none;
    position: relative;
    padding: 4px 0;
  }

  .bottom-bar-item:active {
    transform: scale(0.92);
  }

  .bottom-bar-icon {
    font-size: 1.25rem;
    line-height: 1;
    transition: transform 180ms ease;
  }

  .bottom-bar-label {
    font-size: 0.67rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1;
  }

  .bottom-bar-item.active {
    color: #38bdf8;
  }

  .bottom-bar-item.active .bottom-bar-icon {
    transform: translateY(-2px);
  }

  .bottom-bar-item.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: #38bdf8;
    box-shadow: 0 2px 8px rgba(56, 189, 248, 0.6);
  }

  /* Compensa a altura do Dock inferior para não sobrepor o conteúdo */
  .main-content {
    padding-bottom: calc(82px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* ========================================================
   RESPONSIVIDADE E DRAWER MOBILE (<= 768px)
   ======================================================== */
@media (max-width: 768px) {
  /* Exibe os controles móveis no cabeçalho com alvos de toque generosos */
  .header-mobile-right {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .header-theme-toggle {
    display: inline-flex;
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
    border-radius: 12px;
  }

  .header-theme-toggle:active {
    transform: scale(0.92);
  }

  .mobile-toggle {
    display: flex;
    width: 44px;
    height: 44px;
    border-radius: 12px;
  }

  .mobile-toggle:active {
    transform: scale(0.92);
  }

  .desktop-theme-toggle {
    display: none !important;
  }

  /* Menu Dropdown Mobile - 100% Nítido, Elegante e Sem Desfoque/Borrão */
  .nav-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    max-height: calc(100dvh - 75px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #091728;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6);
    border-radius: 0 0 20px 20px;
    padding: 16px 18px 24px;
    display: none;
    flex-direction: column;
    gap: 6px;
    z-index: 600;
  }

  [data-theme="dark"] .nav-menu {
    background: #071220;
    border-bottom-color: rgba(56, 189, 248, 0.25);
  }

  .nav-menu.nav-open {
    display: flex;
    animation: slideDownNav 180ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }

  @keyframes slideDownNav {
    from {
      opacity: 0;
      transform: translateY(-8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .nav-menu-header-mobile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 14px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .nav-mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .nav-mobile-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: #ffffff;
  }

  .nav-mobile-badge {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.35);
  }

  .nav-close-btn {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 50%;
    color: #ffffff;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 160ms ease;
  }

  .nav-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
  }

  .nav-item {
    font-size: 0.95rem;
    padding: 11px 15px;
    border-radius: 10px;
    min-height: 44px;
    color: #e2e8f0;
  }

  .nav-item:hover, .nav-item.active {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
  }

  .user-pill {
    margin: 10px 0 6px 0;
    padding: 8px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
  }

  .user-avatar {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .user-name {
    font-size: 0.92rem;
  }

  .btn-install {
    width: 100%;
    padding: 12px;
    font-size: 0.95rem;
    margin-top: 4px;
    border-radius: 12px;
    min-height: 46px;
  }

  .header-user-actions {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    width: 100%;
  }

  .btn-logout {
    width: 100%;
    padding: 12px;
    font-size: 0.95rem;
    border-radius: 12px;
    min-height: 46px;
  }

  /* ========================================================
     AJUSTES GERAIS DE LAYOUT E ERGONOMIA MOBILE (<= 768px)
     ======================================================== */
  .main-content {
    padding: 16px 14px calc(88px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .container {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  /* Cabeçalho da Página no Mobile */
  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 20px;
  }

  .page-header > div:first-child {
    width: 100%;
  }

  .page-header > div:last-child,
  .page-header > .btn {
    width: 100%;
  }

  .page-header > div:last-child .btn {
    width: 100%;
    justify-content: center;
  }

  .page-title {
    font-size: 1.45rem;
    line-height: 1.25;
  }

  .page-subtitle {
    font-size: 0.88rem;
    line-height: 1.4;
  }

  /* Toque & Botões Generosos no Mobile (Apple & Material Guidelines) */
  .btn {
    min-height: 48px;
    padding: 12px 18px;
    font-size: 0.95rem;
    border-radius: 12px;
    touch-action: manipulation;
  }

  .btn:active {
    transform: scale(0.97);
  }

  .btn-sm {
    min-height: 38px;
    padding: 8px 14px;
    font-size: 0.84rem;
    border-radius: 9px;
  }

  /* Formulários e Inputs Mobile Touch */
  select,
  input,
  textarea {
    min-height: 48px;
    font-size: 16px !important; /* Previne auto-zoom indesejado do iOS Safari */
    border-radius: 12px;
    padding: 12px 14px;
  }

  textarea {
    min-height: 96px;
  }

  .field-group {
    gap: 8px;
    margin-bottom: 20px;
  }

  .field-group label {
    font-size: 0.9rem;
  }

  /* Barra de Busca e Filtros */
  .search-filter-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    gap: 10px;
    border-radius: 14px;
  }

  .search-filter-bar > div,
  .search-filter-bar > button,
  .search-filter-bar > a {
    width: 100% !important;
    min-width: 100% !important;
    justify-content: center;
  }

  /* Abas e Chips com Swipe Horizontal Suave */
  .pwa-tabs-nav,
  .quick-tabs-bar {
    display: flex !important;
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
    padding-bottom: 6px;
    margin-bottom: 18px;
    scrollbar-width: none;
    border-bottom: 0 !important;
  }

  .pwa-tabs-nav::-webkit-scrollbar,
  .quick-tabs-bar::-webkit-scrollbar {
    display: none;
  }

  .pwa-tabs-nav .btn,
  .quick-tabs-bar .btn {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    width: auto !important;
    padding: 10px 16px;
    font-size: 0.88rem;
  }

  /* Card de Destaque Técnico / Próximo Atendimento */
  .highlight-card {
    padding: 18px 16px;
    border-radius: 18px;
    margin-bottom: 22px;
  }

  .highlight-title {
    font-size: 1.35rem;
  }

  .highlight-details {
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 12px 0 18px;
    font-size: 0.88rem;
  }

  .highlight-card .btn {
    width: 100%;
    justify-content: center;
  }

  /* Cards de Serviços e Entidades */
  .cards-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .service-card {
    padding: 16px 14px;
    border-radius: 16px;
    gap: 12px;
  }

  .card-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .card-top .badge {
    align-self: flex-start;
  }

  .card-title {
    font-size: 1.05rem;
  }

  .card-info-item {
    font-size: 0.86rem;
    gap: 8px;
  }

  .card-info-item > span:first-child {
    width: 24px;
    height: 24px;
    min-width: 24px;
    font-size: 0.8rem;
  }

  .card-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .card-footer > *,
  .card-footer .btn,
  .card-footer a {
    width: 100% !important;
    justify-content: center;
  }

  .card-footer > div {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
  }

  .card-footer > div > * {
    flex: 1 1 120px;
    justify-content: center;
  }

  /* Acordeões de Documentos */
  .accordion-card {
    border-radius: 14px;
  }

  .accordion-header {
    padding: 14px;
    gap: 10px;
  }

  .accordion-title {
    font-size: 1rem;
  }

  .accordion-content {
    padding: 14px 12px;
  }

  .docs-sequence-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .doc-download-item {
    padding: 14px;
  }

  .doc-download-item .btn {
    width: 100%;
    justify-content: center;
  }

  /* Canvas de Assinatura Mobile */
  .canvas-wrapper {
    height: 180px !important;
    border-radius: 12px;
  }

  /* Modais no Mobile (Bottom-sheet Touch Friendly) */
  .sinai-modal-card {
    width: calc(100% - 24px) !important;
    max-width: 480px;
    margin: 12px auto;
    padding: 20px 16px !important;
    border-radius: 20px !important;
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
  }

  .sinai-modal-footer {
    flex-direction: column-reverse;
    gap: 10px;
  }

  .sinai-modal-footer > * {
    width: 100% !important;
  }

  .sinai-modal-footer .btn,
  .sinai-modal-footer form,
  .sinai-modal-footer form button {
    width: 100% !important;
    justify-content: center;
    min-height: 48px;
  }

  /* Login Card no Mobile */
  .login-page {
    padding: 68px 16px 32px;
    align-items: flex-start;
  }

  .login-card {
    grid-template-columns: 1fr;
    max-width: 460px;
    border-radius: 20px;
    min-height: auto;
  }

  .login-brand {
    padding: 28px 24px;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .login-content {
    padding: 32px 24px;
  }

  /* Métricas em 2 colunas proporcionais */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
  }

  .stat-card {
    padding: 14px;
    border-radius: 14px;
  }

  .stat-header {
    margin-bottom: 6px;
  }

  .stat-label {
    font-size: 0.72rem;
    line-height: 1.2;
  }

  .stat-icon {
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
    border-radius: 8px;
  }

  .stat-number {
    font-size: 1.6rem;
  }
}

@media (max-width: 420px) {
  .stats-grid {
    gap: 8px;
  }

  .stat-card {
    padding: 12px 10px;
  }

  .stat-label {
    font-size: 0.68rem;
  }

  .stat-icon {
    width: 28px;
    height: 28px;
    font-size: 0.95rem;
  }

  .stat-number {
    font-size: 1.45rem;
  }
}

/* ========================================================
   CHECKLIST DE MONITORAMENTO E APLICAÇÃO (ÁREAS & PRAGAS)
   ======================================================== */
.checklist-block {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.checklist-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}

.checklist-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.checklist-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.checklist-items-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.checklist-item-card {
  background: var(--card-hover-bg);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  padding: 14px;
  position: relative;
  transition: var(--transition);
}

.checklist-item-card:hover {
  border-color: var(--accent);
}

.checklist-item-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.checklist-item-badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 3px 10px;
  border-radius: 999px;
}

.btn-remove-item {
  background: transparent;
  border: 1px solid var(--danger-border);
  color: var(--danger);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-remove-item:hover {
  background: var(--danger-bg);
}

.checklist-row-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 640px) {
  .checklist-row-grid {
    grid-template-columns: 1fr;
  }
}

.qtd-indet-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.input-qtd-field {
  flex: 1;
}

.toggle-indet-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-main);
  background: var(--page-bg);
  border: 1px solid var(--line);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.toggle-indet-label:hover {
  border-color: var(--accent);
}

.device-options-group {
  margin-top: 10px;
}

.device-options-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: block;
}

.device-pills-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.device-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--page-bg);
  border: 1px solid var(--line);
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.device-pill input[type="checkbox"] {
  accent-color: var(--accent);
}

.device-pill:has(input:checked) {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* ========================================================
   GRÁFICOS DE MONITORAMENTO E LAUDO DE PRAGAS
   (Disponível ao Cliente e ADM, oculto ao Funcionário)
   ======================================================== */
.chart-service-card {
  margin-top: 18px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.chart-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.chart-card-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.chart-kpis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.chart-kpi-item {
  background: var(--card-hover-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}

.chart-kpi-val {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.1;
  margin-bottom: 4px;
}

.chart-kpi-lbl {
  font-size: 0.74rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.charts-two-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}

@media (max-width: 768px) {
  .charts-two-columns {
    grid-template-columns: 1fr;
  }
}

.chart-box {
  background: var(--card-hover-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
}

.chart-box-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 10px;
  text-align: center;
}

.chart-canvas-wrap {
  position: relative;
  width: 100%;
  height: 220px;
}

.chart-table-wrap {
  margin-top: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.chart-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.chart-table th, .chart-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.chart-table th {
  background: var(--page-bg);
  color: var(--text-muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  font-weight: 700;
}

.badge-device {
  display: inline-block;
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent-glow);
  color: var(--accent);
  margin-right: 4px;
  margin-bottom: 2px;
  font-weight: 600;
}

/* ========================================================
   MÓDULO DE ASSINATURA DIGITAL & AUDITORIA FORENSE
   Lei Federal nº 14.063/2020 & MP nº 2.200-2/2001
   ======================================================== */
.signature-section {
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.signature-section-header {
  border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .signature-section-header {
  background: linear-gradient(135deg, #071526 0%, #0d223d 100%) !important;
  border-color: rgba(56, 189, 248, 0.2);
}

.signature-modes .btn.active-mode {
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.4);
  transform: scale(1.02);
}

.gps-audit-bar {
  transition: var(--transition);
}

[data-theme="dark"] .gps-audit-bar {
  background: #0d1e30 !important;
  border-color: rgba(56, 189, 248, 0.2) !important;
}

.signature-card {
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.signature-card:hover {
  border-color: var(--line-hover);
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .signature-card {
  background: #0f1d2e !important;
  border-color: rgba(56, 189, 248, 0.15) !important;
}

.canvas-wrapper {
  background: #ffffff !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
  border-radius: 10px;
  overflow: hidden;
  touch-action: none !important;
}

.canvas-wrapper canvas {
  background: #ffffff !important;
  touch-action: none !important;
}

[data-theme="dark"] .canvas-wrapper {
  border-color: rgba(56, 189, 248, 0.3) !important;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
  .signature-section-header {
    flex-direction: column;
    align-items: flex-start !important;
  }
  .signature-modes {
    width: 100%;
    margin-top: 10px;
    display: flex;
    gap: 8px;
  }
  .signature-modes button {
    flex: 1;
    text-align: center;
  }
  .signatures-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ========================================================
   REGRAS ESPECÍFICAS DE CONTRASTE NO MODO ESCURO
   ======================================================== */
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6,
[data-theme="dark"] strong,
[data-theme="dark"] b {
  color: var(--text-main);
}

[data-theme="dark"] [style*="color: var(--navy-dark)"],
[data-theme="dark"] [style*="color:var(--navy-dark)"] {
  color: var(--text-main) !important;
}

[data-theme="dark"] [style*="color: var(--navy)"],
[data-theme="dark"] [style*="color:var(--navy)"] {
  color: var(--accent) !important;
}

[data-theme="dark"] [style*="color: #334155"],
[data-theme="dark"] [style*="color:#334155"],
[data-theme="dark"] [style*="color: #475569"],
[data-theme="dark"] [style*="color:#475569"] {
  color: var(--text-muted) !important;
}

[data-theme="dark"] [style*="color: #065f46"],
[data-theme="dark"] [style*="color:#065f46"],
[data-theme="dark"] [style*="color: #047857"],
[data-theme="dark"] [style*="color:#047857"] {
  color: #34d399 !important;
}

[data-theme="dark"] [style*="color: #92400e"],
[data-theme="dark"] [style*="color:#92400e"],
[data-theme="dark"] [style*="color: #b45309"],
[data-theme="dark"] [style*="color:#b45309"] {
  color: #fcd34d !important;
}

[data-theme="dark"] [style*="color: var(--warning)"],
[data-theme="dark"] [style*="color:var(--warning)"] {
  color: #fcd34d !important;
}

[data-theme="dark"] [style*="color: var(--success)"],
[data-theme="dark"] [style*="color:var(--success)"] {
  color: #34d399 !important;
}

[data-theme="dark"] [style*="background: #f1f5f9"],
[data-theme="dark"] [style*="background:#f1f5f9"],
[data-theme="dark"] [style*="background: #f8fafc"],
[data-theme="dark"] [style*="background:#f8fafc"] {
  background: var(--card-hover-bg) !important;
  border-color: var(--line) !important;
  color: var(--text-main) !important;
}

[data-theme="dark"] [style*="background: #ecfdf5"],
[data-theme="dark"] [style*="background:#ecfdf5"] {
  background: var(--success-bg) !important;
  border-color: var(--success-border) !important;
  color: var(--text-main) !important;
}

[data-theme="dark"] [style*="background: #fff"],
[data-theme="dark"] [style*="background:#fff"],
[data-theme="dark"] [style*="background: white"],
[data-theme="dark"] [style*="background:white"] {
  background: var(--card-bg) !important;
  border-color: var(--line) !important;
  color: var(--text-main) !important;
}

[data-theme="dark"] [style*="background: #071a2d"] {
  background: #040913 !important;
}

[data-theme="dark"] select,
[data-theme="dark"] input,
[data-theme="dark"] textarea {
  background-color: #091424 !important;
  color: #f8fafc !important;
  border-color: #1e3857 !important;
}

[data-theme="dark"] select option {
  background: #0d1b2e !important;
  color: #f8fafc !important;
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
  color: #64748b !important;
}

[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
  border-color: #38bdf8 !important;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25) !important;
}

[data-theme="dark"] input[readonly] {
  background: #071220 !important;
  color: var(--text-muted) !important;
  border-color: var(--line) !important;
}

[data-theme="dark"] code {
  background: rgba(56, 189, 248, 0.15) !important;
  color: #38bdf8 !important;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

/* ========================================================
   MODAL DE CONFIRMAÇÃO DO SISTEMA ("TELINHA DE EXCLUSÃO")
   ======================================================== */
.sinai-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.sinai-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.sinai-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 9, 19, 0.72);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.sinai-modal-card {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--line);
  padding: 24px;
  z-index: 1;
  transform: scale(0.92) translateY(12px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.sinai-modal-overlay.active .sinai-modal-card {
  transform: scale(1) translateY(0);
}

.sinai-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--page-bg);
  border: 1px solid var(--line);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.sinai-modal-close:hover {
  background: var(--line);
  color: var(--text-main);
  transform: scale(1.05);
}

.sinai-modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.sinai-modal-icon-badge {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.4rem;
}

.sinai-modal-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
  line-height: 1.25;
}

.sinai-modal-subtitle {
  font-size: 0.78rem;
  color: var(--danger);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-top: 3px;
}

.sinai-modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 22px;
}

.sinai-modal-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

.sinai-modal-entity-box {
  background: var(--page-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sinai-modal-entity-name {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text-main);
  word-break: break-word;
}

.sinai-modal-entity-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sinai-modal-entity-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.sinai-modal-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(2, 132, 199, 0.1);
  color: var(--accent);
  border: 1px solid rgba(2, 132, 199, 0.25);
}

.sinai-modal-pill.danger {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: var(--danger-border);
}

.sinai-modal-alert-box {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  border-radius: 12px;
  padding: 12px 14px;
}

.sinai-modal-alert-icon {
  font-size: 1.2rem;
  line-height: 1.2;
  flex-shrink: 0;
}

.sinai-modal-alert-text {
  font-size: 0.82rem;
  color: var(--danger-text);
  line-height: 1.45;
  font-weight: 600;
}

.sinai-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.btn-danger-solid {
  background: #dc2626 !important;
  color: #ffffff !important;
  border: 1px solid #b91c1c !important;
  padding: 10px 18px !important;
  border-radius: 10px !important;
  font-weight: 700 !important;
  font-size: 0.9rem !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3) !important;
}

.btn-danger-solid:hover {
  background: #b91c1c !important;
  border-color: #991b1b !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.45) !important;
}

/* ========================================================
   MELHORIAS DE EXPERIÊNCIA E INTERFACE MOBILE - BAIXA TÉCNICA
   ======================================================== */

/* Card Resumo do Atendimento Mobile */
.baixa-info-card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.baixa-info-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
}

.baixa-info-title {
  color: var(--text-main);
  font-size: 1.2rem;
  font-weight: 800;
  margin: 0 0 4px 0;
  line-height: 1.3;
}

.baixa-info-meta {
  color: var(--text-muted);
  font-size: 0.88rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.baixa-info-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.btn-quick-contact {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
  background: var(--page-bg);
  color: var(--text-main);
  border: 1px solid var(--line);
  transition: all 0.15s ease;
  min-height: 42px;
}

.btn-quick-contact:hover,
.btn-quick-contact:active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

/* Barra de Navegação Rápida entre Seções (Pill Stepper Mobile) */
.mobile-section-nav {
  position: relative;
  z-index: 10;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 14px;
  margin: -10px -16px 20px -16px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  scrollbar-width: none;
}

.mobile-section-nav::-webkit-scrollbar {
  display: none;
}

.sec-nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 15px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--page-bg);
  border: 1px solid var(--line);
  white-space: nowrap;
  text-decoration: none;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.sec-nav-pill:active,
.sec-nav-pill.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* Pills de Serviços Contratados */
.touch-services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.touch-service-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--page-bg);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  user-select: none;
  transition: all 0.15s ease;
  min-height: 48px;
}

.touch-service-pill input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.touch-service-pill:has(input:checked) {
  background: rgba(2, 132, 199, 0.1);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

/* ========================================================
   OTIMIZAÇÕES RESPONSIVAS: VERSO DA OS & ASSINATURAS
   ======================================================== */

.baixa-card-body {
  padding: 20px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* 1. Verso da OS: Cards de Pragas */
.verso-pest-card {
  background: var(--page-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.verso-pest-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
  min-width: 0;
}

.verso-pest-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.verso-pest-control-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  flex-wrap: wrap;
  min-width: 0;
}

/* Controles Segmentados Touch (Sim / Não) */
.segmented-control {
  display: inline-flex;
  background: var(--page-bg);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 2px;
  gap: 3px;
  max-width: 100%;
  box-sizing: border-box;
}

.seg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  min-height: 38px;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  white-space: nowrap;
}

.seg-btn input[type="radio"] {
  display: none;
}

.seg-btn.seg-nao:has(input:checked) {
  background: rgba(16, 185, 129, 0.16);
  color: #059669;
  border-color: #10b981;
}

.seg-btn.seg-sim:has(input:checked) {
  background: rgba(239, 68, 68, 0.16);
  color: #dc2626;
  border-color: #ef4444;
}

.verso-pest-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

@media (min-width: 640px) {
  .verso-pest-grid {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }
}

.verso-pest-grid .field-group {
  margin-bottom: 0 !important;
  width: 100%;
  min-width: 0;
}

.verso-pest-grid input {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

/* 2. Verso da OS: Observação & QR Code */
.verso-obs-card {
  background: var(--page-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.verso-obs-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  min-width: 0;
}

@media (min-width: 640px) {
  .verso-obs-layout {
    flex-direction: row;
    align-items: flex-start;
  }
}

.verso-obs-field {
  flex: 1;
  min-width: 0;
  width: 100%;
}

.verso-obs-field textarea {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.verso-obs-qrcode {
  width: 100%;
  max-width: 220px;
  margin: 0 auto;
  text-align: center;
  background: var(--card-bg);
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 12px;
  box-sizing: border-box;
}

@media (min-width: 640px) {
  .verso-obs-qrcode {
    width: 190px;
    margin: 0;
    flex-shrink: 0;
  }
}

/* 3. Seção de Assinaturas */
.signature-section {
  margin-top: 28px;
  margin-bottom: 24px;
  scroll-margin-top: 60px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.signature-section-header {
  background: linear-gradient(135deg, rgba(7, 26, 45, 0.95), rgba(16, 42, 67, 0.95));
  color: #fff;
  padding: 16px 18px;
  border-radius: 12px 12px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
}

.signature-modes {
  display: flex;
  gap: 6px;
  width: 100%;
}

@media (min-width: 640px) {
  .signature-modes {
    width: auto;
  }
}

.signature-modes button {
  flex: 1;
  min-height: 40px;
  font-size: 0.82rem;
  padding: 8px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.gps-audit-bar {
  background: rgba(16, 42, 67, 0.04);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

@media (min-width: 600px) {
  .gps-audit-bar {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
  }
  .gps-audit-bar .gps-refresh-btn {
    width: auto;
    flex-shrink: 0;
  }
}

.gps-icon-wrapper {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.gps-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  line-height: 1.2;
}

.gps-badge.badge-info {
  background: rgba(56, 189, 248, 0.12);
  color: #0284c7;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.gps-badge.badge-success {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.gps-badge.badge-pending {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.gps-refresh-btn {
  font-size: 0.78rem !important;
  padding: 6px 12px !important;
  min-height: 32px !important;
  font-weight: 700;
  border-radius: 6px;
}

.signatures-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 16px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

@media (min-width: 820px) {
  .signatures-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 20px;
  }
}

.signature-card {
  background: var(--page-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box;
  overflow: hidden;
}

@media (min-width: 640px) {
  .signature-card {
    padding: 18px;
  }
}

.sig-cliente-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 12px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

@media (min-width: 520px) {
  .sig-cliente-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.sig-cliente-grid .field-group {
  margin-bottom: 0 !important;
  min-width: 0 !important;
}

.sig-cliente-grid input {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* Área de Assinatura Mobile */
.canvas-wrapper {
  position: relative;
  background: #ffffff;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  overflow: hidden;
  height: 180px;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  touch-action: none;
  box-sizing: border-box;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.03);
}

.canvas-wrapper canvas {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  display: block;
  cursor: crosshair;
  touch-action: none;
  box-sizing: border-box;
}

.canvas-guideline {
  position: absolute;
  bottom: 34px;
  left: 20px;
  right: 20px;
  border-bottom: 1.5px dashed #94a3b8;
  pointer-events: none;
  display: flex;
  justify-content: flex-end;
  font-size: 0.72rem;
  color: #94a3b8;
  padding-bottom: 2px;
  font-style: italic;
}

.sig-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 10px;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
}

.sig-card-actions button {
  flex: 1 1 auto;
  min-height: 40px;
  font-size: 0.82rem;
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sig-touch-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

/* Barra Fixa Inferior Mobile */
.mobile-sticky-action-bar {
  display: none;
}

@media (max-width: 768px) {
  .mobile-section-nav {
    margin: -14px -10px 18px -10px !important;
    padding: 10px 12px !important;
  }
  .baixa-card-body {
    padding: 12px 10px !important;
  }
  .verso-pest-card {
    padding: 12px 10px !important;
  }
  .verso-obs-card {
    padding: 12px 10px !important;
  }
  .signature-card {
    padding: 12px 10px !important;
  }
  .signature-section-header {
    padding: 14px 12px !important;
    flex-direction: column;
    align-items: flex-start !important;
  }
  .verso-pest-control-wrap {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
  }
  .seg-btn {
    padding: 6px 10px;
    font-size: 0.8rem;
    min-height: 38px;
  }
  .mobile-sticky-action-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-top: 1px solid var(--line);
    padding: 10px 16px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.15);
    z-index: 100;
    align-items: center;
    gap: 12px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .form-box {
    padding: 14px 10px 95px !important;
    border-radius: 14px;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden;
  }

  .btn-submit-mobile {
    flex: 1;
    min-height: 48px;
    padding: 12px 18px;
    font-size: 1rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 12px;
  }

  .qtd-indet-wrap {
    flex-wrap: wrap;
  }
}

/* Destaque de Erro Visual (Glow) */
.field-error-glow {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.35) !important;
  animation: shakeError 0.3s ease-in-out;
}

@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* Toast de Alerta Flutuante */
.mobile-form-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: #0f172a;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  z-index: 9999;
  opacity: 0;
  transition: all 0.25s ease;
  pointer-events: none;
  max-width: 90%;
  text-align: center;
}

.mobile-form-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}


