/* =============================================================================
   ❄️ OPENFRIO - SISTEMA CORPORATIVO DE GESTÃO & ORÇAMENTAÇÃO (TECNOFRIO & CMR)
   DESIGN SYSTEM INDUSTRIAL & OPERACIONAL (LIGHT / DARK THEMES)
   ============================================================================= */

:root {
  /* Cores Oficiais Grupo OpenFrio / Tecnofrio */
  --brand-navy-950: #04101e;
  --brand-navy-900: #061526;
  --brand-navy-800: #0a2540;
  --brand-navy-700: #0e3357;
  --brand-navy-600: #144473;
  --brand-cyan-500: #0284c7;
  --brand-cyan-400: #00a3e0;
  --brand-cyan-300: #38bdf8;
  --brand-cyan-100: #e0f2fe;
  --brand-cyan-50:  #f0f9ff;
  --brand-orange-500: #ff7a00;
  --brand-orange-600: #ea580c;
  --brand-orange-100: #ffedd5;

  /* Estados de Interface */
  --color-success: #16a34a;
  --color-success-bg: #dcfce7;
  --color-warning: #d97706;
  --color-warning-bg: #fef3c7;
  --color-danger: #dc2626;
  --color-danger-bg: #fee2e2;
  --color-info: #0284c7;
  --color-info-bg: #e0f2fe;

  /* Cores de Segregação Fiscal: Produtos vs Serviços */
  --seg-prod-primary: #0284c7;
  --seg-prod-primary-hover: #0369a1;
  --seg-prod-light: #e0f2fe;
  --seg-prod-border: #bae6fd;

  --seg-serv-primary: #7e22ce;
  --seg-serv-primary-hover: #6b21a8;
  --seg-serv-light: #f3e8ff;
  --seg-serv-border: #e9d5ff;

  /* Tema Claro Padrão */
  --bg-app: #f4f7fb;
  --bg-surface: #ffffff;
  --bg-surface-subtle: #f8fafc;
  --bg-sidebar: #0a2540;
  --bg-sidebar-hover: #12355c;
  --bg-sidebar-active: #194678;
  --sidebar-text: #e2e8f0;
  --sidebar-text-muted: #94a3b8;
  --sidebar-border: rgba(255, 255, 255, 0.08);

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;
  --text-heading: #0f172a;
  --bg-page: #f4f7fb;

  --border-light: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-focus: #0284c7;

  --card-shadow: 0 2px 10px rgba(10, 37, 64, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
  --card-shadow-hover: 0 12px 28px rgba(10, 37, 64, 0.08), 0 4px 10px rgba(0, 0, 0, 0.03);
  --modal-shadow: 0 25px 50px -12px rgba(10, 37, 64, 0.25);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* =============================================================================
   MODO ESCURO PROFISSIONAL (SEM NÉON / SEM CLICHÊS DE IA)
   ============================================================================= */
[data-theme="dark"] {
  --bg-app: #090e17;
  --bg-surface: #101726;
  --bg-surface-subtle: #162033;
  --bg-sidebar: #070b12;
  --bg-sidebar-hover: #121c2d;
  --bg-sidebar-active: #19263e;
  --sidebar-text: #f1f5f9;
  --sidebar-text-muted: #94a3b8;
  --sidebar-border: rgba(255, 255, 255, 0.06);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --text-heading: #f8fafc;
  --bg-page: #090e17;

  --border-light: #1e293b;
  --border-medium: #334155;
  --border-focus: #38bdf8;

  --card-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  --card-shadow-hover: 0 14px 32px rgba(0, 0, 0, 0.6);
  --modal-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);

  --color-success-bg: rgba(22, 163, 74, 0.15);
  --color-warning-bg: rgba(217, 119, 6, 0.15);
  --color-danger-bg: rgba(220, 38, 38, 0.15);
  --color-info-bg: rgba(2, 132, 199, 0.15);

  /* --brand-navy-900 e --brand-cyan-50 sao usados em varios pontos do HTML como
     "texto de destaque" e "caixa clara de apoio". No claro sao quase-preto sobre
     quase-branco; sem este par no escuro ficam quase-preto sobre quase-preto
     (texto ilegivel) — aqui os dois se invertem juntos para manter o contraste. */
  --brand-navy-900: #f8fafc;
  --brand-cyan-50: rgba(2, 132, 199, 0.12);

  /* Cores de Segregação Fiscal no Modo Escuro */
  --seg-prod-primary: #38bdf8;
  --seg-prod-primary-hover: #0284c7;
  --seg-prod-light: rgba(2, 132, 199, 0.18);
  --seg-prod-border: rgba(56, 189, 248, 0.35);

  --seg-serv-primary: #c084fc;
  --seg-serv-primary-hover: #a855f7;
  --seg-serv-light: rgba(147, 51, 234, 0.18);
  --seg-serv-border: rgba(192, 132, 252, 0.35);
}

/* =============================================================================
   RESETS & TIPOGRAFIA
   ============================================================================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.25s ease, color 0.25s ease;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
}

a {
  color: var(--brand-cyan-500);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--brand-cyan-400);
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

.hidden {
  display: none !important;
}

/* =============================================================================
   TELA DE LOGIN (ALTA VISIBILIDADE & CONTRASTE PERFEITO)
   ============================================================================= */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-app);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

/* Brilhos radiais vivos e lentos ao fundo (respiracao sutil, sem neon) */
.login-screen::before,
.login-screen::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
  z-index: 0;
  will-change: transform, opacity;
}

.login-screen::before {
  width: 520px;
  height: 520px;
  top: -160px;
  left: -140px;
  background: radial-gradient(circle, rgba(2, 132, 199, 0.28) 0%, transparent 70%);
  animation: loginGlowDriftA 16s ease-in-out infinite;
}

.login-screen::after {
  width: 460px;
  height: 460px;
  bottom: -160px;
  right: -120px;
  background: radial-gradient(circle, rgba(255, 122, 0, 0.2) 0%, transparent 70%);
  animation: loginGlowDriftB 20s ease-in-out infinite;
}

@keyframes loginGlowDriftA {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.85; }
  50% { transform: translate(70px, 50px) scale(1.2); opacity: 1; }
}

@keyframes loginGlowDriftB {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.85; }
  50% { transform: translate(-60px, -40px) scale(1.15); opacity: 1; }
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--card-shadow-hover);
  padding: 36px 32px;
  position: relative;
  z-index: 2;
  animation: fadeIn 0.35s ease-out;
}

.login-brand-wrapper {
  text-align: center;
  margin-bottom: 24px;
}

.login-logo-container {
  background: rgba(255, 255, 255, 0.92);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  border: 1px solid rgba(10, 37, 64, 0.1);
  box-shadow: 0 2px 10px rgba(10, 37, 64, 0.06);
  margin-bottom: 14px;
  display: inline-block;
  width: 100%;
}

.login-logo-img {
  width: 100%;
  max-width: 360px;
  height: auto;
  display: block;
  margin: 0 auto;
}

.login-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 600;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon i.icon-prefix {
  position: absolute;
  left: 14px;
  color: var(--text-dim);
  font-size: 1rem;
  pointer-events: none;
}

.form-control {
  width: 100%;
  height: 40px;
  padding: 0 12px 0 36px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.btn-toggle-password {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}

.btn-toggle-password:hover {
  color: var(--text-main);
}

.login-btn {
  height: 46px;
  background: linear-gradient(135deg, var(--brand-navy-800) 0%, var(--brand-cyan-500) 100%);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.25s ease;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.3);
  margin-top: 6px;
}

.login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.45);
  filter: brightness(1.06);
}

.login-error {
  min-height: 20px;
  font-size: 0.82rem;
  color: var(--color-danger);
  text-align: center;
  font-weight: 600;
}

.login-footer-info {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* =============================================================================
   DIGISAT ERP DESIGN SYSTEM & DESKTOP BLUE BACKDROP
   ============================================================================= */
.app-shell {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background: radial-gradient(circle at 50% 35%, #1d61a3 0%, #0d3869 55%, #041830 100%);
  color: var(--text-main);
}

[data-theme="dark"] .app-shell {
  background: radial-gradient(circle at 50% 35%, #0e2b4d 0%, #06182e 55%, #020914 100%);
}

/* SIDEBAR REVERTIDA E ESTILIZADA COMO DIGISAT METRO SIDEBAR */
.sidebar {
  width: 110px;
  background: rgba(4, 16, 30, 0.95);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  transition: width 0.25s ease;
}

.sidebar:hover {
  width: 220px;
}

.sidebar-header {
  padding: 12px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.2);
}

.sidebar-brand-box {
  background: transparent;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.sidebar-brand-logo {
  width: 100%;
  max-width: 180px;
  height: auto;
  max-height: 44px;
  display: block;
}

.sidebar-close-btn {
  display: none;
}

.sidebar-nav {
  flex: 1;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.nav-section-title {
  display: none;
}

/* BOTOES VERTICAIS METRO DIGISAT */
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: #ffffff;
  border-radius: 4px;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  width: 100%;
  text-align: left;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}

.nav-item i {
  font-size: 1.15rem;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  flex-shrink: 0;
  color: #ffffff;
}

/* CORES CARACTERISTICAS DOS TILES DIGISAT */
.nav-item[data-tab="tabDashboard"] i { background: #8b5cf6; }
.nav-item[data-tab="tabObras"] i { background: #008ed6; }
.nav-item[data-tab="tabApoioVendas"] i { background: #70b300; }
.nav-item[data-tab="tabEstudoTributario"] i { background: #d946ef; }
.nav-item[data-tab="tabFornecedores"] i { background: #0284c7; }
.nav-item[data-tab="tabFuncionarios"] i { background: #9333ea; }
.nav-item[data-tab="tabRelatorios"] i { background: #0f766e; }
.nav-item[data-tab="tabUsuarios"] i { background: #ea580c; }
.nav-item[data-tab="tabLogs"] i { background: #e11d48; }

.nav-item:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateX(2px);
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.22);
  border-left: 4px solid #70b300;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.nav-badge-master {
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  background: #ea580c;
  color: #ffffff;
  padding: 2px 4px;
  border-radius: 3px;
  margin-left: auto;
}

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(0, 0, 0, 0.18);
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-cyan-500), var(--brand-navy-800));
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.user-meta {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-meta-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.user-meta-role {
  font-size: 0.72rem;
  color: var(--brand-cyan-300);
  font-weight: 500;
}

.sidebar-footer-actions {
  display: flex;
  gap: 8px;
}

.theme-toggle-btn, .logout-btn {
  flex: 1;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.logout-btn:hover {
  background: rgba(220, 38, 38, 0.2);
  border-color: rgba(220, 38, 38, 0.4);
  color: #fca5a5;
}

/* Painel de Conteúdo Principal */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  color: var(--text-main);
}

/* DigiSat ERP System Header Topbar */
.topbar {
  height: 44px;
  background: rgba(6, 23, 44, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
  z-index: 90;
  color: #f1f5f9;
  font-size: 0.8rem;
  backdrop-filter: blur(10px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1 1 0;
  min-width: 0; /* sem isto o grupo nao encolhia e empurrava o botao Salvar para fora da tela (build 107) */
}

.menu-toggle-btn {
  display: none;
  background: transparent;
  border: none;
  font-size: 1.1rem;
  color: #ffffff;
  cursor: pointer;
}

/* Titulo e usuario numa linha cada, cortados com reticencias: o topbar tem 44px
   fixos e, sem isso, o texto quebrava em 3 linhas e vazava por cima do conteudo
   (relato de 23/09/2026, campo do usuario "quebrado"). Texto completo no title. */
.page-title-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 300px;
  line-height: 1.25;
}

.page-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.3px;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-breadcrumb {
  font-size: 0.72rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-breadcrumb strong {
  color: #e2e8f0;
  font-weight: 700;
}

/* BOTÕES DE NAVEGAÇÃO RÁPIDA NO TOPBAR */
.topbar-nav-shortcuts {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: #f1f5f9;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(8px);
}

.topbar-nav-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.topbar-nav-btn.btn-home {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}

.topbar-nav-btn.btn-home:hover {
  background: #38bdf8;
  color: #04101e;
}

.topbar-nav-btn.btn-extended {
  background: linear-gradient(135deg, rgba(234, 88, 12, 0.2), rgba(245, 158, 11, 0.2));
  border-color: rgba(245, 158, 11, 0.45);
  color: #fbbf24;
}

.topbar-nav-btn.btn-extended:hover {
  background: linear-gradient(135deg, #ea580c, #f59e0b);
  color: #ffffff;
}

/* Botao Salvar fixo no topo: verde normal; ambar quando ha alteracao nao salva; esmaecido enquanto salva */
.topbar-nav-btn.topbar-save-btn {
  background: #16a34a;
  border-color: #16a34a;
  color: #ffffff;
}

.topbar-nav-btn.topbar-save-btn:hover {
  background: #15803d;
  border-color: #15803d;
}

.topbar-nav-btn.topbar-save-btn.is-dirty {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #1f2937;
  animation: topbarSavePulse 1.8s ease-in-out infinite;
}

.topbar-nav-btn.topbar-save-btn.is-saving {
  opacity: 0.75;
  cursor: progress;
}

@keyframes topbarSavePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.55); }
  50% { box-shadow: 0 0 0 5px rgba(245, 158, 11, 0); }
}

.topbar-nav-btn.btn-print-budget {
  background: rgba(14, 165, 233, 0.16);
  border-color: rgba(14, 165, 233, 0.5);
  color: #7dd3fc;
}

.topbar-nav-btn.btn-print-budget:hover {
  background: #0284c7;
  border-color: #0284c7;
  color: #ffffff;
}

.topbar-nav-btn.btn-print-laudo {
  background: rgba(249, 115, 22, 0.16);
  border-color: rgba(249, 115, 22, 0.5);
  color: #fdba74;
}

.topbar-nav-btn.btn-print-laudo:hover {
  background: #ea580c;
  border-color: #ea580c;
  color: #ffffff;
}

.topbar-nav-btn.btn-import-excel {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.45);
  color: #22c55e;
}

.topbar-nav-btn.btn-import-excel:hover {
  background: #16a34a;
  border-color: #16a34a;
  color: #ffffff;
}

.btn-outline-success {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.45);
  color: #22c55e;
}

.btn-outline-success:hover {
  background: #16a34a;
  border-color: #16a34a;
  color: #ffffff;
}

@media (max-width: 900px) {
  .topbar-nav-btn span {
    display: none;
  }
  .topbar-nav-btn {
    padding: 0 8px;
  }
  /* Build 112: no topo so' ficam "Visao Estendida" e "Salvar" - o texto fica sempre visivel (nunca so' o icone) */
  .topbar-nav-btn.btn-extended span,
  .topbar-nav-btn.topbar-save-btn span {
    display: inline;
  }
  .topbar-nav-btn.btn-extended,
  .topbar-nav-btn.topbar-save-btn {
    padding: 0 10px;
  }
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.digisat-control-icons {
  display: flex;
  align-items: center;
  gap: 4px;
}

.digisat-control-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: 3px;
  transition: background 0.15s ease;
}

.digisat-control-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.digisat-control-btn.btn-close:hover {
  background: #dc2626;
  color: #ffffff;
}

.digisat-control-btn {
  position: relative;
}

.update-badge-dot {
  display: none;
  position: absolute;
  top: 3px;
  right: 3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-danger, #dc2626);
  border: 1.5px solid var(--brand-navy-950, #0a2540);
  animation: updateBadgePulse 2s infinite ease-in-out;
}

#updateAvailableBtn:not(.hidden) .update-badge-dot {
  display: block;
}

@keyframes updateBadgePulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.6;
    transform: scale(1.25);
  }
}

.active-work-context {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.65);
  padding: 4px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 0.8rem;
  color: #e2e8f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.active-work-context label {
  font-weight: 700;
  color: #94a3b8;
  margin-left: 2px;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.active-work-context select {
  background: #091322;
  color: #38bdf8;
  border: 1px solid #334155;
  border-radius: 5px;
  padding: 3px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  min-width: 160px;
  max-width: 290px;
  outline: none;
  cursor: pointer;
  transition: all 0.18s ease;
}

.active-work-context select:hover,
.active-work-context select:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.active-work-btn-group {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 4px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-left: 4px;
}

.active-work-add {
  background: rgba(56, 189, 248, 0.14);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.28);
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.72rem;
  transition: all 0.15s ease;
}

.active-work-add:hover {
  background: #38bdf8;
  color: #0f172a;
  transform: translateY(-1px);
}

.active-work-add.btn-fiscal-params {
  background: rgba(245, 158, 11, 0.18);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.4);
}

.active-work-add.btn-fiscal-params:hover {
  background: #f59e0b;
  color: #0f172a;
}

.form-control-sm {
  padding: 6px 10px;
  font-size: 0.82rem;
  height: 32px;
}

.work-tax-params-grid input {
  font-weight: 600;
}

.status-dot.offline {
  background: var(--color-warning);
}

.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  color: var(--text-main);
  background:
    linear-gradient(rgba(2, 132, 199, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(2, 132, 199, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 85% 8%, rgba(255, 122, 0, 0.10), transparent 28%),
    radial-gradient(circle at 12% 78%, rgba(2, 132, 199, 0.09), transparent 32%),
    var(--bg-app);
  background-size: 34px 34px, 34px 34px, auto, auto, auto;
}

[data-theme="dark"] .content-area {
  background:
    linear-gradient(rgba(56, 189, 248, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 85% 8%, rgba(255, 122, 0, 0.10), transparent 28%),
    radial-gradient(circle at 12% 78%, rgba(2, 132, 199, 0.12), transparent 32%),
    var(--bg-app);
  background-size: 34px 34px, 34px 34px, auto, auto, auto;
}

.work-context-bar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 80px;
  margin-bottom: 20px;
  padding: 14px 18px;
  background: #ffffff;
  border: 1px solid #d7e2ec;
  border-left: 5px solid var(--brand-orange-500);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(4, 16, 30, 0.06);
}

.work-context-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  flex-wrap: wrap;
  padding-bottom: 10px;
  border-bottom: 1px solid #eef2f6;
}

.work-context-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 auto;
}

.work-context-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(2, 132, 199, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-cyan-600);
  font-size: 1.15rem;
  flex-shrink: 0;
}

.work-context-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.work-context-label {
  display: block;
  color: var(--text-dim);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.work-context-names {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.work-company-highlight {
  color: var(--brand-navy-900);
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: -0.2px;
}

.work-context-separator {
  color: #94a3b8;
  font-size: 1.1rem;
}

.work-name-highlight {
  color: var(--brand-cyan-600);
  font-size: 0.98rem;
  font-weight: 700;
}

.work-context-details {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.work-metric-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #475569;
  font-weight: 600;
}

.work-metric-pill.value-pill {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.3);
  color: #15803d;
}

.work-metric-pill.value-pill .metric-val {
  font-weight: 800;
  color: #16a34a;
}

.work-metric-pill.tax-pill {
  background: rgba(239, 68, 68, 0.06);
  border-color: rgba(239, 68, 68, 0.25);
  color: #b91c1c;
}

.work-metric-pill.tax-pill .metric-val {
  font-weight: 800;
  color: #dc2626;
}

.metric-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: #64748b;
  font-weight: 700;
}

.change-control-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  flex-wrap: wrap;
}

.btn-group-segmented {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #f8fafc;
  padding: 3px 6px;
  border-radius: 7px;
  border: 1px solid #e2e8f0;
}

[data-theme="dark"] .work-context-bar {
  background: var(--bg-surface);
  border-color: var(--border-light);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .work-context-header-row {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .work-company-highlight {
  color: #f1f5f9;
}

[data-theme="dark"] .work-name-highlight {
  color: #38bdf8;
}

[data-theme="dark"] .work-metric-pill {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
}

[data-theme="dark"] .btn-group-segmented {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
}

.tab-panel {
  display: none;
  flex-direction: column;
  gap: 22px;
  animation: fadeIn 0.25s ease-out;
  color: var(--text-main);
}

.tab-panel.active {
  display: flex;
}

/* =============================================================================
   CARDS, KPI WIDGETS & CONTAINERS
   ============================================================================= */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(190px, 1fr));
  gap: 16px;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-shadow-hover);
}

.kpi-card-wide {
  min-height: 118px;
}

.kpi-card-clickable {
  position: relative;
  cursor: pointer;
}

.kpi-card-clickable:focus-visible {
  outline: 2px solid var(--brand-cyan-500, #0284c7);
  outline-offset: 2px;
}

.kpi-info-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.72rem;
  color: var(--text-muted);
  opacity: 0.45;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.kpi-card-clickable:hover .kpi-info-badge,
.kpi-card-clickable:focus-visible .kpi-info-badge {
  opacity: 1;
  color: var(--brand-cyan-500, #0284c7);
}

.kpi-icon-box.purple {
  background: #ede9fe;
  color: #6d28d9;
}

.module-hero {
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 32px;
  color: #fff;
  background: radial-gradient(circle at 75% 20%, rgba(0, 163, 224, 0.75), transparent 34%), linear-gradient(120deg, #04101e, #0e4c7e 68%, #0877b5);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 30px rgba(4, 16, 30, 0.18);
}

.module-hero h2 {
  margin: 4px 0 6px;
  color: #fff;
  font-size: clamp(1.35rem, 2.2vw, 2rem);
}

.module-hero p {
  max-width: 620px;
  color: rgba(255, 255, 255, 0.76);
}

.module-kicker {
  color: #7dd3fc;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.surface-card-caption {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.works-board .data-table small {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.74rem;
}

.work-actions {
  white-space: nowrap;
}

.work-modal-dialog {
  max-width: 720px;
}

.form-section-label {
  margin: 4px 0 10px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--border-light);
  color: var(--brand-cyan-500);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.work-cnpj-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 10px;
}

.work-cnpj-btn {
  height: 40px;
  margin-bottom: 16px;
}

.work-form-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 12px;
}

.work-form-grid-value {
  grid-template-columns: 1.1fr 1fr;
}

.tax-rate-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.form-status {
  min-height: 20px;
  margin: -8px 0 8px;
  color: var(--color-info);
  font-size: 0.76rem;
}

.form-help {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.kpi-data {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi-title {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-value {
  font-size: 1.6rem;
  font-weight: 800;
  font-family: var(--font-heading);
  color: var(--text-main);
}

.kpi-subtext {
  font-size: 0.74rem;
  color: var(--text-dim);
}

.kpi-icon-box {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  background: var(--brand-cyan-100);
  color: var(--brand-cyan-500);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

[data-theme="dark"] .kpi-icon-box {
  background: rgba(2, 132, 199, 0.2);
  color: var(--brand-cyan-300);
}

.kpi-icon-box.orange {
  background: var(--brand-orange-100);
  color: var(--brand-orange-500);
}

[data-theme="dark"] .kpi-icon-box.orange {
  background: rgba(255, 122, 0, 0.2);
  color: #fb923c;
}

.kpi-icon-box.green {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.surface-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
  color: var(--text-main);
}

.surface-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.surface-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.surface-card-title i {
  color: var(--brand-cyan-500);
}

.surface-card-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* =============================================================================
   SIMULADOR BIDIRECIONAL DE MARGEM & LUCRO (% <=> R$)
   ============================================================================= */
.profit-simulator-box {
  background: linear-gradient(145deg, var(--bg-surface-subtle) 0%, var(--bg-surface) 100%);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.profit-inputs-row {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) repeat(2, minmax(0, 1fr));
  gap: 18px;
}

@media (max-width: 768px) {
  .profit-inputs-row {
    grid-template-columns: 1fr;
  }
}

.profit-input-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--card-shadow);
}

.profit-input-card.featured {
  border-color: var(--brand-cyan-500);
}

.profit-input-card label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.profit-input-wrap {
  display: flex;
  align-items: center;
  position: relative;
}

.profit-input-wrap input {
  font-size: 1.15rem;
  font-weight: 800;
  font-family: var(--font-heading);
  height: 44px;
  padding: 0 38px 0 14px;
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-medium);
  background: var(--bg-surface-subtle);
  color: var(--text-main);
}

.profit-input-wrap input:focus {
  outline: none;
  border-color: var(--brand-cyan-500);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.profit-input-suffix {
  position: absolute;
  right: 12px;
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.9rem;
  pointer-events: none;
}

/* Seletor Segmentado: Margem sobre Venda x Markup sobre Custo */
.pricing-mode-toggle {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.pricing-mode-toggle button {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 7px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s ease, box-shadow 0.2s ease;
}

.pricing-mode-toggle button:hover:not(.active) {
  background: var(--bg-surface);
  color: var(--text-main);
}

.pricing-mode-toggle button.active {
  background: var(--brand-cyan-500);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.35);
}

/* Seletor de Modo de Visualização (Dono vs Cliente) */
.view-mode-toggle-group {
  display: inline-flex;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 4px;
}

.view-mode-btn {
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.18s ease;
}

.view-mode-btn.active {
  background: var(--brand-navy-800);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(10, 37, 64, 0.2);
}

/* =============================================================================
   CAMPOS EDITÁVEIS INLINE NAS TABELAS
   ============================================================================= */
.table-input {
  width: 100%;
  min-width: 80px;
  height: 32px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 0.85rem;
  transition: all 0.15s ease;
}

.table-input:focus {
  outline: none;
  border-color: var(--brand-cyan-500);
  background: var(--bg-surface);
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}

.table-select {
  height: 32px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 0.85rem;
}

.table-select:focus {
  outline: none;
  border-color: var(--brand-cyan-500);
}

/* Callout Executivo */
.executive-callout {
  background: var(--brand-cyan-50);
  border: 1px solid var(--brand-cyan-300);
  border-left: 5px solid var(--brand-cyan-500);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  color: var(--brand-navy-900);
  font-size: 0.86rem;
  line-height: 1.55;
}

[data-theme="dark"] .executive-callout {
  background: rgba(2, 132, 199, 0.12);
  border-color: rgba(56, 189, 248, 0.3);
  color: #e0f2fe;
}

.executive-callout strong {
  color: var(--brand-cyan-500);
}

[data-theme="dark"] .executive-callout strong {
  color: var(--brand-cyan-300);
}

/* Botões */
.btn {
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--brand-navy-800);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--brand-navy-700);
  box-shadow: 0 2px 8px rgba(10, 37, 64, 0.2);
}

.btn-cyan {
  background: var(--brand-cyan-500);
  color: #ffffff;
}

.btn-cyan:hover {
  background: var(--brand-cyan-400);
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25);
}

.btn-secondary {
  background: var(--bg-surface-subtle);
  border-color: var(--border-medium);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--border-light);
}

.btn-outline-primary {
  background: transparent;
  border-color: var(--border-medium);
  color: var(--text-main);
}

.btn-outline-primary:hover {
  background: var(--bg-surface-subtle);
  border-color: var(--brand-cyan-500);
  color: var(--brand-cyan-500);
}

.btn-danger {
  background: var(--color-danger);
  color: #ffffff;
}

.btn-danger:hover {
  background: #b91c1c;
}

.btn-sm {
  height: 30px;
  padding: 0 10px;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
}

/* Tabelas */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}

.work-products-table-scroll {
  max-height: 520px;
  overflow-y: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  background: var(--bg-surface-subtle);
  padding: 10px 14px;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.data-table th.sortable-col {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s ease;
}

.data-table th.sortable-col:hover {
  color: var(--brand-cyan-500);
}

.data-table th.sortable-col .sort-icon {
  display: inline-block;
  margin-left: 4px;
  color: var(--brand-cyan-500);
  font-size: 0.7rem;
}

.data-table td {
  padding: 10px 14px;
  font-size: 0.85rem;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: var(--bg-surface-subtle);
}

.data-table tfoot tr {
  background: var(--bg-surface-subtle);
  font-weight: 700;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-active, .badge-success {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.badge-inactive, .badge-danger {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.badge-warning {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.badge-info {
  background: var(--color-info-bg);
  color: var(--color-info);
}

.badge-approved {
  background: var(--color-success-bg);
  color: var(--color-success);
  box-shadow: inset 0 0 0 1px var(--color-success);
}

.btn-approve-proposal {
  background: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid var(--color-success);
  font-weight: 700;
}

.badge-master {
  background: var(--brand-orange-500);
  color: #ffffff;
}

/* Modais */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 16, 30, 0.7);
  backdrop-filter: blur(5px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--modal-shadow);
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface-subtle);
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  color: var(--text-dim);
  cursor: pointer;
}

.modal-close-btn:hover {
  color: var(--color-danger);
}

/* O <form> entre o dialogo e o corpo/rodape precisa herdar a restricao de altura
   do dialogo; sem isso ele cresce livre e o rodape (com o botao Salvar) e'
   renderizado fora da area visivel do modal. */
.modal-dialog > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1 1 auto;
  min-height: 0;
}

.empty-state-panel {
  background: var(--bg-surface);
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  margin-bottom: 18px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state-panel i {
  font-size: 1.9rem;
  color: var(--brand-cyan-500, #0284c7);
  margin-bottom: 10px;
  display: block;
}

.empty-state-panel h3 {
  color: var(--text-heading);
  font-size: 1.05rem;
  margin: 0 0 6px;
}

.empty-state-panel p {
  margin: 0 0 16px;
  font-size: 0.86rem;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-surface-subtle);
  flex: 0 0 auto;
}

.dashboard-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.dashboard-edit-grid { display: grid; grid-template-columns: 1.4fr 1fr 1.2fr; gap: 12px; }
.dashboard-edit-grid label { display: grid; gap: 6px; color: var(--text-muted); font-size: 0.75rem; font-weight: 800; }
.dashboard-edit-grid input { color: var(--text-main); background: var(--bg-surface-subtle); }
.dashboard-dedicated-card { gap: 18px; }
.dashboard-module-hero { min-height: 128px; }
.dashboard-modal-dialog { max-width: 1180px; }
.dashboard-modal-header { padding: 14px 22px; }
.dashboard-export-brand { display: flex; align-items: center; gap: 14px; }
.dashboard-export-brand img { width: 150px; max-height: 42px; object-fit: contain; }
.dashboard-export-brand strong, .dashboard-export-brand small { display: block; }
.dashboard-export-brand strong { color: var(--text-main); font-size: 1rem; }
.dashboard-export-brand small { margin-top: 3px; color: var(--text-muted); font-size: 0.76rem; }
.dashboard-modal-body { gap: 18px; }
.dashboard-modal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--text-muted); font-size: 0.82rem; }
.dashboard-modal-toolbar > div { display: flex; gap: 8px; }
.dashboard-export-note { padding: 12px 14px; color: var(--text-muted); background: var(--bg-surface-subtle); border: 1px solid var(--border-light); border-radius: var(--radius-sm); font-size: 0.78rem; }

/* Botão Flutuante WhatsApp */
.whatsapp-support-btn {
  position: fixed !important;
  bottom: 24px !important;
  right: 24px !important;
  width: 56px !important;
  height: 56px !important;
  border-radius: 50% !important;
  background: #25d366 !important;
  color: #ffffff !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.85rem !important;
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4) !important;
  cursor: pointer !important;
  z-index: 999999 !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
  animation: waPulse 2.5s infinite ease-in-out !important;
  text-decoration: none !important;
}

.whatsapp-support-btn.hidden {
  display: none !important;
}

.whatsapp-support-btn:hover {
  transform: scale(1.1);
  background: #20ba5a !important;
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.6) !important;
}

.wa-tooltip {
  position: absolute;
  right: 68px;
  background: #1e293b;
  color: #ffffff;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  transform: translateX(8px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.whatsapp-support-btn:hover .wa-tooltip {
  opacity: 1;
  transform: translateX(0);
}

/* =============================================================================
   DIGISAT ERP LAUNCHER GRID & WINDOW COMPONENTS
   ============================================================================= */

/* CENTRED DIGISAT DASHBOARD LAUNCHER */
.digisat-launcher-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px 10px 32px;
  min-height: 82vh;
  position: relative;
}

.launcher-ambient-glow {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 750px;
  height: 480px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.16) 0%, rgba(13, 56, 105, 0) 70%);
  pointer-events: none;
  z-index: 0;
}

.digisat-launcher-container {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  align-items: flex-start;
  position: relative;
  z-index: 1;
}

/* LAUNCHER BRAND HEADER & LOGO OPENFRIO */
.launcher-brand-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
  border-radius: 12px;
  padding: 14px 22px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.launcher-brand-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.launcher-logo-glow-box {
  background: #ffffff;
  padding: 6px 14px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.35);
}

.launcher-brand-logo {
  height: 36px;
  width: auto;
  object-fit: contain;
}

.launcher-brand-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.5px;
  margin: 0;
}

.launcher-brand-subtitle {
  font-size: 0.75rem;
  font-weight: 600;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.launcher-status-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.status-pulse-dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 10px #10b981;
  animation: statusPulse 1.8s infinite ease-in-out;
}

@keyframes statusPulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1.15); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.promo-card-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.promo-card-logo {
  height: 26px;
  width: auto;
  filter: brightness(0) invert(1);
}

/* CARDS DO BANNERS E TILES DIGISAT */
.digisat-promo-card {
  width: 340px;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  flex-shrink: 0;
  align-self: flex-start;
}

.digisat-promo-img-box {
  position: relative;
  padding: 24px 20px;
  background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}

.digisat-promo-badge {
  background: #ffffff;
  color: #ea580c;
  font-weight: 900;
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 3px;
  width: max-content;
  text-transform: uppercase;
}

.digisat-promo-title {
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1.2;
  margin: 12px 0 6px;
}

.digisat-promo-version {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fef08a;
}

.digisat-promo-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  font-size: 0.75rem;
  opacity: 0.9;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  padding-top: 10px;
}

/* GRID DE TILES DIGISAT (2 LINHAS X 4 COLUNAS) */
.digisat-tiles-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-gap: 12px;
  flex: 0 0 100%;
  width: 100%;
  /* Sem "order" fixo: a posicao visual segue a ordem real no HTML (logo apos
     o card de novidade, antes do painel de KPI da obra). */
}

.digisat-tile-btn {
  border: none;
  border-radius: 8px;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 135px;
  color: #ffffff;
  cursor: pointer;
  position: relative;
  text-align: left;
  box-shadow: 0 8px 18px rgba(4, 16, 30, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.digisat-tile-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  filter: brightness(1.08);
}

.digisat-tile-btn:focus-visible,
.dashboard-view-toggle button:focus-visible,
.dashboard-actions .btn:focus-visible {
  outline: 3px solid rgba(56, 189, 248, 0.5);
  outline-offset: 2px;
}

/* BOTÃO DE ANÁLISE ESTENDIDA */
.btn-extended-analysis {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #ffffff !important;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn-extended-analysis:hover {
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(14, 165, 233, 0.45);
  color: #ffffff !important;
}

.btn-extended-analysis:active {
  transform: translateY(0);
}

.dashboard-summary-item.highlight-markup {
  border-left-width: 4px;
}

.digisat-tile-btn .tile-shortcut {
  position: absolute;
  top: 8px;
  left: 10px;
  font-size: 0.65rem;
  opacity: 0.75;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.digisat-tile-btn .tile-pin {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 0.7rem;
  opacity: 0.6;
}

.digisat-tile-btn i.tile-icon {
  font-size: 2.2rem;
  margin: 18px 0 10px;
  align-self: center;
}

.digisat-tile-btn .tile-title {
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
}

/* TILES COM CORES OFICIAIS DIGISAT */
.tile-blue-light { background: #0096e6; }
.tile-purple { background: #8b32c6; }
.tile-blue-cyan { background: #008ed6; }
.tile-blue-deep { background: #006eb3; }
.tile-purple-dark { background: #712ca7; }
.tile-lime { background: #70b300; }
.tile-teal { background: #008299; }
.tile-cyan-dark { background: #007299; }

/* DIGISAT FOOTER LOGO ON DESKTOP */
.digisat-desktop-footer {
  margin-top: 30px;
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.78rem;
}

.digisat-desktop-footer a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: underline;
}

/* =============================================================================
   DIGISAT ERP FLOATING WINDOW STYLE (JANELAS DE MOVIMENTACOES E CADASTROS)
   ============================================================================= */
.digisat-window {
  background: #ffffff;
  color: #1e293b;
  border-radius: 6px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.2);
  margin-bottom: 24px;
}

[data-theme="dark"] .digisat-window {
  background: #0f172a;
  color: #f8fafc;
  border-color: #334155;
}

/* CABECALHO COLORIDO DA JANELA ERP */
.digisat-window-header {
  height: 38px;
  background: #70b300; /* Lime green Padrao DigiSat para Movimentacoes */
  color: #ffffff;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 0.95rem;
}

.digisat-window-header.header-purple { background: #8b32c6; }
.digisat-window-header.header-blue { background: #008ed6; }
.digisat-window-header.header-teal { background: #008299; }
.digisat-window-header.header-orange { background: #ea580c; }
.digisat-window-header.header-dark { background: #0f172a; }

.digisat-window-header .window-title-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.digisat-window-header .window-close-btn {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.15s ease;
}

.digisat-window-header .window-close-btn:hover {
  opacity: 1;
}

/* BARRA DE PESQUISA SUPERIOR DA JANELA */
.digisat-search-bar {
  padding: 10px 14px;
  background: #f1f5f9;
  border-bottom: 1px solid #cbd5e1;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}

.digisat-company-filter { min-width: 190px; padding: 8px 10px; color: var(--text-main); background: var(--bg-surface); border: 1px solid var(--border-medium); border-radius: var(--radius-sm); }

[data-theme="dark"] .digisat-search-bar {
  background: #1e293b;
  border-bottom-color: #334155;
}

.digisat-search-input-wrap {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  overflow: hidden;
  max-width: 400px;
  width: 100%;
}

[data-theme="dark"] .digisat-search-input-wrap {
  background: #0f172a;
  border-color: #475569;
}

.digisat-search-input-wrap input {
  border: none;
  padding: 6px 10px;
  width: 100%;
  font-size: 0.85rem;
  background: transparent;
  color: inherit;
}

.digisat-search-input-wrap input:focus {
  outline: none;
}

.digisat-search-btn {
  background: #70b300;
  color: #ffffff;
  border: none;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 0.9rem;
}

.digisat-detailed-search-btn {
  background: #70b300;
  color: #ffffff;
  border: none;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
}

/* LINHA DE CONTEXTO DE PESQUISA */
.digisat-filter-info {
  padding: 6px 14px;
  background: #ffffff;
  font-size: 0.78rem;
  color: #64748b;
  border-bottom: 1px solid #e2e8f0;
}

[data-theme="dark"] .digisat-filter-info {
  background: #0f172a;
  border-bottom-color: #1e293b;
  color: #94a3b8;
}

/* BARRA INFERIOR DE COMANDOS DIGISAT (ATALHOS F3, F5, F6, F9, F10) */
.digisat-command-bar {
  background: #70b300;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.digisat-cmd-btn {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 3px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background 0.15s ease;
}

.digisat-cmd-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(180px, 1fr)); }
  .digisat-tiles-grid { grid-template-columns: repeat(2, 1fr); }
  .digisat-launcher-container { flex-direction: column; }
  .work-dashboard-card { width: 100%; flex-basis: 100%; }
}

@media (max-width: 700px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(140px, 1fr)); gap: 10px; }
  .kpi-card { padding: 14px; }
  .kpi-value { font-size: 1.15rem; }
  .digisat-tiles-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .digisat-tile-btn { min-height: 105px; padding: 12px 10px; }
  .digisat-tile-btn i.tile-icon { font-size: 1.65rem; margin: 10px 0 6px; }
  .digisat-tile-btn .tile-title { font-size: 0.76rem; }
  .module-hero { align-items: flex-start; flex-direction: column; padding: 22px; }
  .module-hero .btn { width: 100%; }
  .work-cnpj-row, .work-form-grid, .work-form-grid-value { grid-template-columns: 1fr; }
  .work-cnpj-btn { width: 100%; margin-bottom: 8px; }
  .tax-rate-grid { grid-template-columns: repeat(2, 1fr); }
  .work-context-bar { align-items: flex-start; flex-direction: column; gap: 8px; }
  .work-context-details { flex-wrap: wrap; margin-left: 0; }
  .work-context-details span:first-child { padding-left: 0; border-left: 0; }
  .launcher-heading { align-items: flex-start; flex-direction: column; }
  .launcher-grid { grid-template-columns: repeat(2, 1fr); }
  .digisat-launcher-wrapper { width: 100%; overflow-x: hidden; padding: 16px 10px 28px; }
  .launcher-brand-header { align-items: flex-start; flex-direction: column; gap: 12px; padding: 14px; }
  .launcher-brand-left { align-items: flex-start; gap: 10px; min-width: 0; width: 100%; }
  .launcher-logo-glow-box { flex: 0 0 auto; padding: 5px 8px; }
  .launcher-brand-logo { max-width: 112px; height: auto; }
  .launcher-brand-info { min-width: 0; }
  .launcher-brand-title { font-size: 0.82rem; line-height: 1.2; overflow-wrap: anywhere; }
  .launcher-brand-subtitle { font-size: 0.64rem; line-height: 1.25; overflow-wrap: anywhere; }
  .launcher-status-chip { width: 100%; justify-content: center; text-align: center; white-space: normal; line-height: 1.25; }
}

/* =============================================================================
   IMPRESSÃO TIMBRADA A4 OFICIAL (@media print)
   ============================================================================= */
@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }

  /* FORÇAR TEMA CLARO E LIMPAR TODAS AS VARIÁVEIS NO DOCUMENTO IMPRESSO */
  :root,
  html,
  html[data-theme="dark"],
  body,
  body[data-theme="dark"] {
    color-scheme: light !important;
    background: #ffffff !important;
    background-color: #ffffff !important;
    color: #0f172a !important;
    height: auto !important;
    min-height: 0 !important;

    --bg-app: #ffffff !important;
    --bg-surface: #ffffff !important;
    --bg-surface-subtle: #f8fafc !important;
    --bg-page: #ffffff !important;
    --bg-sidebar: #ffffff !important;

    --text-main: #0f172a !important;
    --text-muted: #475569 !important;
    --text-dim: #64748b !important;
    --text-heading: #0a2540 !important;

    --brand-navy-950: #04101e !important;
    --brand-navy-900: #061526 !important;
    --brand-navy-800: #0a2540 !important;
    --brand-navy-700: #0e3357 !important;
    --brand-navy-600: #144473 !important;

    --brand-cyan-500: #0284c7 !important;
    --brand-cyan-400: #00a3e0 !important;
    --brand-cyan-300: #0369a1 !important;
    --brand-cyan-100: #e0f2fe !important;
    --brand-cyan-50:  #f0f9ff !important;

    --brand-orange-500: #d97706 !important;
    --brand-orange-600: #b45309 !important;
    --brand-orange-100: #ffedd5 !important;

    --border-light: #cbd5e1 !important;
    --border-medium: #94a3b8 !important;
    --border-focus: #0284c7 !important;
  }

  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    box-sizing: border-box !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  html, body {
    background: #ffffff !important;
    background-color: #ffffff !important;
    color: #0f172a !important;
    font-size: 8.5pt !important;
    line-height: 1.3 !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    margin: 0 auto !important;
    padding: 0 !important;
    width: 210mm !important;
    max-width: 210mm !important;
    box-sizing: border-box !important;
  }

  body.print-mode-proposal,
  body.print-mode-owner,
  body.print-mode-products,
  body.print-mode-tax,
  body.print-mode-dashboard {
    padding: 8mm 10mm 10mm 10mm !important;
    background: #ffffff !important;
    width: 210mm !important;
    max-width: 210mm !important;
    box-sizing: border-box !important;
  }

  /* 1. ZERO ROLAGEM, SCROLLBAR OU LIMITAÇÃO DE ALTURA */
  html, body, .app-shell, .main-wrapper, .content-area,
  .table-responsive, .work-products-table-scroll,
  [style*="overflow"], [style*="max-height"],
  div[style*="max-height"], div[style*="overflow"],
  #workProductsTableContainer, #materialsSectionCard, .tab-panel {
    overflow: visible !important;
    max-height: none !important;
    height: auto !important;
  }

  /* 2. OCULTAÇÃO TOTAL DE CONTROLES DE INTERFACE E NAVEGAÇÃO */
  .sidebar, .topbar, .whatsapp-support-btn, .cookie-banner, .sidebar-backdrop,
  .no-print, .btn, .surface-card-actions, .view-mode-toggle-group,
  .digisat-command-bar, .digisat-search-bar,
  .digisat-window-header, .active-work-context, .change-control-actions,
  .cost-mode-selector-bar, .products-credit-config-bar, .placeholder-row,
  .modal-close-btn, .col-actions, .work-context-bar {
    display: none !important;
  }

  /* Ocultação total de tooltips, popovers flutuantes e balões informativos no PDF / Impressão */
  .dashboard-floating-tooltip,
  .dashboard-floating-tooltip.visible,
  .dashboard-bar-row::after,
  .dashboard-bar-row:hover::after,
  .dashboard-bar-row:focus-visible::after,
  .dashboard-column-item::after,
  .dashboard-column-item:hover::after,
  .chart-item-clickable::after,
  [data-tooltip]::after,
  [data-tooltip]::before,
  .tooltip,
  .wa-tooltip {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    content: none !important;
  }

  /* Modais NUNCA aparecem na impressão, exceto o dashboard na sua modalidade específica */
  body:not(.print-mode-dashboard) .modal-backdrop,
  body:not(.print-mode-dashboard) #dashboardModal,
  body:not(.print-mode-dashboard) .modal-dialog {
    display: none !important;
  }

  /* ===========================================================================
     CABEÇALHO ESTRATÉGICO DO DONO (APOIO ESTRATÉGICO DE VENDA & MARGEM)
     =========================================================================== */
  body.print-mode-owner .profit-simulator-box {
    display: block !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    background: #ffffff !important;
    border: 1.5px solid #0a2540 !important;
    border-radius: 6px !important;
    padding: 8px 12px !important;
    margin-bottom: 12px !important;
    box-shadow: none !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: visible !important;
  }

  body:not(.print-mode-owner) .profit-simulator-box,
  body.print-mode-proposal .profit-simulator-box,
  body.print-mode-products .profit-simulator-box,
  body.print-mode-tax .profit-simulator-box,
  body.print-mode-dashboard .profit-simulator-box {
    display: none !important;
  }

  body.print-mode-owner .profit-simulator-box h3 {
    color: #0a2540 !important;
    font-size: 8.5pt !important;
    font-weight: 800 !important;
    margin: 0 0 2px 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
  }

  body.print-mode-owner .profit-simulator-box span {
    color: #475569 !important;
    font-size: 6.8pt !important;
  }

  body.print-mode-owner .profit-inputs-row {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    margin: 6px 0 !important;
    max-width: 100% !important;
  }

  /* O card estoura a folha quando o input (width:auto) cresce com o valor
     grande (ex.: R$ 27.714,72 com fonte 11pt) e empurra o card do Lucro:
     limite de largura resolvido com min-width 0 + overflow visible em cada
     card e max-width no wrap interno do input. */
  body.print-mode-owner .profit-input-card {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 4px !important;
    padding: 6px 8px !important;
    flex: 1 1 0 !important;
    min-width: 0 !important;
    box-shadow: none !important;
    overflow: visible !important;
  }

  body.print-mode-owner .profit-input-card.featured:first-child {
    flex: 1.4 1 0 !important;
    border-left: 4px solid #ea580c !important;
    background: #fff7ed !important;
    min-width: 0 !important;
  }

  body.print-mode-owner .profit-input-card.featured:nth-child(2) {
    border-left: 4px solid #0284c7 !important;
    background: #f0f9ff !important;
    min-width: 0 !important;
  }

  body.print-mode-owner .profit-input-card.featured:nth-child(3) {
    border-left: 4px solid #16a34a !important;
    background: #f0fdf4 !important;
    min-width: 0 !important;
  }

  body.print-mode-owner .profit-input-card label {
    display: block !important;
    margin-bottom: 2px !important;
  }

  body.print-mode-owner .profit-input-card label span:first-child {
    font-size: 7.2pt !important;
    font-weight: 800 !important;
    display: block !important;
  }

  body.print-mode-owner .profit-input-card label span:last-child {
    font-size: 6.2pt !important;
    color: #64748b !important;
    display: block !important;
  }

  body.print-mode-owner .pricing-mode-toggle {
    display: none !important;
  }

  body.print-mode-owner .profit-input-wrap input {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    font-size: 11pt !important;
    font-weight: 900 !important;
    padding: 0 !important;
    min-width: 0 !important;
    max-width: 100% !important;
    width: auto !important;
    text-overflow: clip !important;
  }

  /* O wrap interno também precisa poder encolher dentro do card em folha A4;
     sem isso o input larga (width auto = largura do valor) e empurra o card
     vizinho para fora da margem direita do papel. */
  body.print-mode-owner .profit-input-wrap {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  body.print-mode-owner #inputGrossSalePrice {
    color: #ea580c !important;
  }

  body.print-mode-owner #inputMarginPercent {
    color: #0284c7 !important;
  }

  body.print-mode-owner #inputProfitReais {
    color: #16a34a !important;
  }

  body.print-mode-owner .profit-input-suffix {
    font-size: 9pt !important;
    font-weight: 800 !important;
    color: #475569 !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    flex: 0 0 auto !important;
  }

  /* Painel de desmembramento Produtos/Serviços dentro do card Valor Bruto:
     grid 1fr 1fr fixo + inputs de R$ com fonte 0.88rem estouram 210mm quando
     a obra tem valor grande; encolher para coluna única evita overflow. */
  body.print-mode-owner .split-products-services-panel {
    max-width: 100% !important;
    overflow: visible !important;
  }

  body.print-mode-owner .split-products-services-panel .profit-input-wrap {
    max-width: 100% !important;
    min-width: 0 !important;
  }

  body.print-mode-owner .split-products-services-panel input.form-control {
    font-size: 8.5pt !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  body.print-mode-owner .profit-simulator-box > div:last-child {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 6px !important;
    margin-top: 6px !important;
    max-width: 100% !important;
  }

  body.print-mode-owner .profit-simulator-box > div:last-child > div {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 4px !important;
    padding: 4px 6px !important;
  }

  body.print-mode-owner .profit-simulator-box > div:last-child > div span {
    font-size: 6.2pt !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    display: block !important;
    margin-bottom: 2px !important;
  }

  body.print-mode-owner #simTotalCost {
    color: #0f172a !important;
    font-size: 8.5pt !important;
    font-weight: 800 !important;
  }

  body.print-mode-owner #simTotalTax {
    color: #dc2626 !important;
    font-size: 8.5pt !important;
    font-weight: 800 !important;
  }

  body.print-mode-owner #simNetProfit {
    color: #0284c7 !important;
    font-size: 8.5pt !important;
    font-weight: 800 !important;
  }

  body.print-mode-owner #simBreakEven {
    color: #475569 !important;
    font-size: 8.5pt !important;
    font-weight: 800 !important;
  }

  body.print-mode-owner #simSalePrice {
    color: #0a2540 !important;
    font-size: 9.5pt !important;
    font-weight: 900 !important;
  }

  body.print-mode-owner #simMarginMarkupCompare {
    color: #0f172a !important;
    font-size: 8.5pt !important;
    font-weight: 800 !important;
  }

  body.print-mode-owner #simMarginMarkupCompareSecondary {
    color: #64748b !important;
    font-size: 6pt !important;
  }

  .print-only,
  #printPurchasesBanner {
    display: block !important;
  }

  .app-shell, .main-wrapper, .content-area, .tab-panel, .tab-panel.active {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    background: #ffffff !important;
    background-color: #ffffff !important;
    animation: none !important;
    transform: none !important;
    overflow: visible !important;
    max-height: none !important;
    height: auto !important;
  }

  /* 3. CABEÇALHO TIMBRADO OFICIAL DE ENGENHARIA */
  .print-header {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    background: #ffffff !important;
    border-bottom: 2.5px solid #0a2540 !important;
    padding-bottom: 9px !important;
    margin-bottom: 12px !important;
    position: relative !important;
  }

  .print-header::before {
    content: '' !important;
    display: block !important;
    height: 4px !important;
    background: linear-gradient(90deg, #0a2540 0%, #0284c7 45%, #10b981 75%, #f97316 100%) !important;
    border-radius: 2px !important;
    margin-bottom: 9px !important;
  }

  .print-header-top {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 16px !important;
  }

  .print-logo-box {
    background: linear-gradient(135deg, #0a2540 0%, #0e3357 100%) !important;
    padding: 6px 12px !important;
    border-radius: 6px !important;
    display: inline-flex !important;
    align-items: center !important;
    border: 1px solid #1e3a5f !important;
  }

  .print-logo {
    max-height: 38px !important;
    display: block !important;
  }

  .print-meta {
    text-align: right !important;
    font-size: 8pt !important;
    color: #334155 !important;
    line-height: 1.35 !important;
  }

  .print-header-details {
    margin-top: 8px !important;
    padding: 6px 10px !important;
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 6px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    font-size: 8pt !important;
    color: #1e293b !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
  }

  .print-doc-badge {
    display: inline-block !important;
    background: linear-gradient(135deg, #0a2540 0%, #0284c7 100%) !important;
    color: #ffffff !important;
    font-weight: 800 !important;
    font-size: 7.8pt !important;
    padding: 4px 10px !important;
    border-radius: 4px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.6px !important;
  }

  .print-work-meta-row strong {
    color: #0a2540 !important;
  }

  /* RODAPÉ OFICIAL CORPORATIVO EM TODAS AS IMPRESSÕES A4 */
  .print-official-footer {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    border-top: 1.5px solid #0a2540 !important;
    padding-top: 6px !important;
    margin-top: 14px !important;
    font-size: 7pt !important;
    color: #475569 !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .print-footer-brand strong {
    color: #0a2540 !important;
    font-weight: 800 !important;
    font-size: 7.5pt !important;
  }

  .print-footer-brand span {
    display: block !important;
    color: #64748b !important;
  }

  .print-footer-compliance {
    text-align: right !important;
    font-style: italic !important;
    color: #64748b !important;
  }

  /* 4. ISOLAMENTO ESTRITO POR DOCUMENTO (FIREWALL DE VISÃO) */

  /* ===========================================================================
     MODO PROPOSTA COMERCIAL DO CLIENTE (body.print-mode-proposal)
     =========================================================================== */
  body.print-mode-proposal .work-context-bar,
  body.print-mode-proposal #tabApoioVendas > .surface-card:first-child,
  body.print-mode-proposal #materialsSectionCard,
  body.print-mode-proposal #ownerLaborSection,
  body.print-mode-proposal #ownerOtherExpensesSection,
  body.print-mode-proposal #scenariosMatrixSection,
  body.print-mode-proposal #resultsCard,
  body.print-mode-proposal #consolidatedCostsSummaryBox,
  body.print-mode-proposal .tab-panel:not(#tabApoioVendas) {
    display: none !important;
  }
  body.print-mode-proposal #clientProposalSection {
    display: block !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    margin-bottom: 0 !important;
    background: transparent !important;
  }
  body.print-mode-proposal #clientProposalSection .surface-card-header {
    border-bottom: 2px solid #0a2540 !important;
    padding-bottom: 8px !important;
    margin-bottom: 10px !important;
    page-break-after: avoid !important;
  }
  body.print-mode-proposal #clientProposalSection .surface-card-title {
    color: #0a2540 !important;
    font-size: 12.5pt !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    margin: 0 0 2px 0 !important;
  }
  body.print-mode-proposal #clientProposalSection .surface-card-header span {
    color: #475569 !important;
    font-size: 7.5pt !important;
    font-weight: 600 !important;
  }
  body.print-mode-proposal .proposal-intro-letter {
    display: block !important;
    margin-bottom: 10px !important;
    font-size: 7.8pt !important;
    color: #334155 !important;
    line-height: 1.4 !important;
    page-break-after: avoid !important;
  }
  body.print-mode-proposal #clientProposalSection .data-table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 7.8pt !important;
    margin-bottom: 10px !important;
    page-break-inside: auto !important;
  }
  body.print-mode-proposal #clientProposalSection .data-table thead {
    display: table-header-group !important;
  }
  body.print-mode-proposal #clientProposalSection .data-table th {
    background: #0a2540 !important;
    color: #ffffff !important;
    border: 1px solid #0a2540 !important;
    padding: 5px 8px !important;
    font-size: 7.2pt !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.4px !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  body.print-mode-proposal #clientProposalSection .data-table td {
    border: 1px solid #cbd5e1 !important;
    padding: 5px 8px !important;
    color: #0f172a !important;
    font-size: 7.8pt !important;
    vertical-align: middle !important;
  }
  body.print-mode-proposal #clientProposalSection .data-table tr {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
  body.print-mode-proposal #clientProposalSection .data-table tbody tr:nth-child(even) {
    background: #f8fafc !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  body.print-mode-proposal #clientProposalSection .data-table tfoot {
    display: table-row-group !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
  body.print-mode-proposal #clientProposalSection .data-table tfoot tr {
    background: #f0f9ff !important;
    border-top: 2.5px solid #0284c7 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  body.print-mode-proposal #clientProposalSection .data-table tfoot td {
    border: 1px solid #93c5fd !important;
    color: #0369a1 !important;
    font-size: 9.5pt !important;
    font-weight: 900 !important;
    padding: 8px 10px !important;
  }
  body.print-mode-proposal #clientProposalGrandTotal {
    color: #0284c7 !important;
    font-size: 11pt !important;
    font-weight: 900 !important;
    text-align: right !important;
  }
  body.print-mode-proposal .proposal-terms-box {
    display: block !important;
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    border-left: 4px solid #0284c7 !important;
    border-radius: 4px !important;
    padding: 8px 12px !important;
    margin-top: 10px !important;
    font-size: 7.2pt !important;
    line-height: 1.4 !important;
    color: #334155 !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* ===========================================================================
     MODO ORÇAMENTO INTERNO DO DONO (DOC. 4683 - body.print-mode-owner)
     =========================================================================== */
  body.print-mode-owner .work-context-bar,
  body.print-mode-owner #clientProposalSection,
  body.print-mode-owner .tab-panel:not(#tabApoioVendas),
  body.print-mode-owner #tabApoioVendas > .surface-card:first-child > .surface-card-header,
  body.print-mode-owner #materialsSectionCard > .surface-card-header {
    display: none !important;
  }
  body.print-mode-owner .surface-card {
    display: block !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: none !important;
    margin-bottom: 10px !important;
    page-break-inside: auto !important;
    break-inside: auto !important;
    padding: 8px 10px !important;
    background: #ffffff !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }
  body.print-mode-owner #tabApoioVendas > .surface-card:first-child {
    border: none !important;
    padding: 0 !important;
    margin-bottom: 8px !important;
  }
  body.print-mode-owner #scenariosMatrixSection {
    display: block !important;
    page-break-inside: auto !important;
    break-inside: auto !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    padding: 8px 10px !important;
    margin-top: 8px !important;
    margin-bottom: 10px !important;
    background: #ffffff !important;
  }
  body.print-mode-owner #scenariosMatrixSection h3 {
    font-size: 8.5pt !important;
    color: #0a2540 !important;
    font-weight: 800 !important;
    margin: 0 0 6px 0 !important;
  }
  body.print-mode-owner .data-table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 7.2pt !important;
    page-break-inside: auto !important;
  }
  body.print-mode-owner .data-table thead {
    display: table-header-group !important;
  }
  body.print-mode-owner .data-table th {
    background: #0a2540 !important;
    color: #ffffff !important;
    border: 1px solid #0a2540 !important;
    padding: 3px 6px !important;
    font-size: 6.8pt !important;
    text-transform: uppercase !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  body.print-mode-owner .data-table td {
    border: 1px solid #cbd5e1 !important;
    padding: 3px 6px !important;
    color: #0f172a !important;
  }
  body.print-mode-owner .data-table tbody tr:nth-child(even) {
    background: #f8fafc !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  /* Quebra de página: linha de tabela PODE quebrar entre folhas (break-inside
     auto). Manter "avoid" em todas as tr forçava a ÚLTIMA linha da tabela de
     compras a cair sozinha numa folha nova, que saía com o thead repetido +
     fragmento do tfoot - a "folha em branco com lixo" do fim do relatório.
     Linhas em branco no meio do documento continuam evitadas (tfoot e cards),
     mas não à custa de folhas vazias no meio do fluxo. */
  body.print-mode-owner .data-table tr {
    page-break-inside: auto !important;
    break-inside: auto !important;
  }
  body.print-mode-owner .data-table tfoot {
    display: table-row-group !important;
    page-break-inside: auto !important;
    break-inside: auto !important;
  }
  body.print-mode-owner .data-table tfoot tr {
    background: #f1f5f9 !important;
    font-weight: 800 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* MODO FICHA TÉCNICA DE PRODUTOS (3364 / ITENS DA OBRA) */
  body.print-mode-products .work-context-bar,
  body.print-mode-products #tabApoioVendas > .surface-card:first-child,
  body.print-mode-products #materialsSectionCard > .surface-card-header,
  body.print-mode-products #printPurchasesBanner,
  body.print-mode-products .work-products-actions-bar,
  body.print-mode-products #purchasesTableContainer,
  body.print-mode-products .cost-mode-selector-bar,
  body.print-mode-products #ownerLaborSection,
  body.print-mode-products #ownerOtherExpensesSection,
  body.print-mode-products #scenariosMatrixSection,
  body.print-mode-products #clientProposalSection,
  body.print-mode-products #resultsCard,
  body.print-mode-products .tab-panel:not(#tabApoioVendas) {
    display: none !important;
  }
  body.print-mode-products #tabApoioVendas {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  body.print-mode-products #materialsSectionCard,
  body.print-mode-products #workProductsTableContainer {
    display: block !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
  }
  body.print-mode-products #printProductsTechnicalBanner {
    display: block !important;
    page-break-after: avoid !important;
  }
  body.print-mode-products .work-products-table-scroll {
    overflow: visible !important;
    max-height: none !important;
  }
  body.print-mode-products #workProductsTableContainer .data-table {
    width: 100% !important;
    table-layout: fixed !important;
    border-collapse: collapse !important;
    font-size: 7.2pt !important;
  }
  body.print-mode-products #workProductsTableContainer .data-table th {
    background: #0a2540 !important;
    color: #ffffff !important;
    border: 1px solid #0a2540 !important;
    padding: 5px 4px !important;
    font-size: 6.8pt !important;
    text-transform: uppercase !important;
    letter-spacing: 0.3px !important;
  }
  body.print-mode-products #workProductsTableContainer .data-table td {
    border: 1px solid #cbd5e1 !important;
    padding: 4px 5px !important;
    color: #0f172a !important;
    vertical-align: middle !important;
    font-size: 7.2pt !important;
    word-break: break-word !important;
    white-space: normal !important;
  }
  body.print-mode-products #workProductsTableContainer .data-table tr {
    page-break-inside: avoid !important;
  }
  body.print-mode-products #workProductsTableContainer .data-table tbody tr:nth-child(even) {
    background: #f8fafc !important;
  }
  body.print-mode-products #workProductsTableContainer .data-table tfoot {
    display: table-row-group !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
  body.print-mode-products #workProductsTableContainer .data-table tfoot tr {
    background: #f1f5f9 !important;
    font-weight: 800 !important;
    border-top: 2px solid #0a2540 !important;
  }
  body.print-mode-products #workProductsTableContainer .data-table tfoot td {
    border-top: 2px solid #0a2540 !important;
    color: #0a2540 !important;
    font-size: 7.5pt !important;
  }
  body.print-mode-products #workProductsTableContainer .data-table input.table-input {
    display: none !important;
  }
  body.print-mode-products #workProductsTableContainer .data-table .print-only {
    display: block !important;
  }
  body.print-mode-products #workProductsTableContainer .data-table .col-prod-num {
    width: 4% !important;
    text-align: center !important;
  }
  body.print-mode-products #workProductsTableContainer .data-table .col-prod-code {
    width: 13% !important;
    text-align: left !important;
    font-family: monospace, monospace !important;
    font-size: 7pt !important;
  }
  body.print-mode-products #workProductsTableContainer .data-table .col-prod-desc {
    width: 42% !important;
    text-align: left !important;
    font-weight: 600 !important;
  }
  body.print-mode-products #workProductsTableContainer .data-table .col-prod-unit {
    width: 6% !important;
    text-align: center !important;
  }
  body.print-mode-products #workProductsTableContainer .data-table .col-prod-qty {
    width: 9% !important;
    text-align: right !important;
  }
  body.print-mode-products #workProductsTableContainer .data-table .col-prod-unitcost {
    width: 12% !important;
    text-align: right !important;
  }
  body.print-mode-products #workProductsTableContainer .data-table .col-prod-loss {
    width: 6% !important;
    text-align: right !important;
  }
  body.print-mode-products #workProductsTableContainer .data-table .col-prod-total {
    width: 14% !important;
    text-align: right !important;
    font-weight: 800 !important;
    color: #0a2540 !important;
  }
  body.print-mode-products #workProductsTableContainer .data-table .col-actions,
  body.print-mode-products #workProductsTableContainer .data-table th:last-child,
  body.print-mode-products #workProductsTableContainer .data-table td:last-child {
    display: none !important;
  }

  /* =========================================================================
     MODO ESTUDO TRIBUTÁRIO & LAUDO FISCAL A4 (body.print-mode-tax)
     ========================================================================= */
  body.print-mode-tax .work-context-bar,
  body.print-mode-tax .tab-panel:not(#tabEstudoTributario),
  body.print-mode-tax .surface-card-actions,
  body.print-mode-tax .tax-interactive-note,
  body.print-mode-tax #taxStudySuppliersTableSection,
  body.print-mode-tax .executive-callout,
  body.print-mode-tax #tabEstudoTributario > .surface-card > .surface-card-header,
  body.print-mode-tax #chkTaxFreeMode,
  body.print-mode-tax label:has(#chkTaxFreeMode),
  body.print-mode-tax #chkZeroIrpj,
  body.print-mode-tax label:has(#chkZeroIrpj),
  body.print-mode-tax #chkZeroCsll,
  body.print-mode-tax label:has(#chkZeroCsll),
  body.print-mode-tax .tax-discount-action-bar,
  body.print-mode-tax .discount-presets-group,
  body.print-mode-tax #consolidatedCostsSummaryBox,
  body.print-mode-tax .profit-simulator-box {
    display: none !important;
  }

  body.print-mode-tax #tabEstudoTributario {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
  }

  body.print-mode-tax #tabEstudoTributario .surface-card {
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    page-break-inside: auto !important;
  }

  body.print-mode-tax #tabEstudoTributario .surface-card-header {
    border-bottom: 2px solid #0a2540 !important;
    padding-bottom: 6px !important;
    margin-bottom: 12px !important;
    page-break-after: avoid !important;
  }

  body.print-mode-tax #tabEstudoTributario .surface-card-title {
    color: #0a2540 !important;
    font-size: 13pt !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
  }

  body.print-mode-tax #tabEstudoTributario .surface-card-header span {
    color: #475569 !important;
    font-size: 7.5pt !important;
    font-weight: 600 !important;
  }

  /* Painel de Alíquotas no Laudo Impresso */
  body.print-mode-tax .tax-rates-print-panel {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 4px !important;
    padding: 8px 10px !important;
    margin-bottom: 10px !important;
    page-break-inside: avoid !important;
  }

  body.print-mode-tax .tax-rates-print-grid {
    display: grid !important;
    grid-template-columns: repeat(8, 1fr) !important;
    gap: 6px !important;
  }

  body.print-mode-tax .tax-rates-print-grid .form-control {
    border: 1px solid #94a3b8 !important;
    background: #ffffff !important;
    color: #0a2540 !important;
    font-weight: 800 !important;
    font-size: 8pt !important;
    text-align: center !important;
    padding: 2px !important;
    height: auto !important;
    border-radius: 3px !important;
    -webkit-appearance: none !important;
    -moz-appearance: textfield !important;
  }

  body.print-mode-tax .tax-rates-print-grid label {
    font-size: 6.5pt !important;
    font-weight: 700 !important;
    color: #334155 !important;
    text-transform: uppercase !important;
    margin-bottom: 2px !important;
    text-align: center !important;
    display: block !important;
  }

  /* Callout DRE Operacional */
  body.print-mode-tax .executive-callout {
    background: #f0fdf4 !important;
    border: 1px solid #86efac !important;
    border-left: 4px solid #16a34a !important;
    color: #0f172a !important;
    font-size: 7.8pt !important;
    padding: 6px 10px !important;
    margin-bottom: 10px !important;
    page-break-inside: avoid !important;
  }

  body.print-mode-tax .executive-callout strong {
    color: #0a2540 !important;
    font-weight: 800 !important;
  }

  /* Tabela de Créditos de ICMS & PIS/COFINS */
  body.print-mode-tax #tabEstudoTributario .data-table {
    table-layout: fixed !important;
    width: 100% !important;
    font-size: 7.2pt !important;
    border-collapse: collapse !important;
  }

  body.print-mode-tax #tabEstudoTributario .data-table th {
    background: #0a2540 !important;
    color: #ffffff !important;
    border: 1px solid #0a2540 !important;
    padding: 4px 6px !important;
    font-size: 6.8pt !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
  }

  body.print-mode-tax #tabEstudoTributario .data-table td {
    border: 1px solid #cbd5e1 !important;
    padding: 3px 5px !important;
    color: #0f172a !important;
    vertical-align: middle !important;
  }

  /* Proporções das colunas no A4 da Tabela de Créditos Tributários */
  body.print-mode-tax #tabEstudoTributario .data-table th:nth-child(1),
  body.print-mode-tax #tabEstudoTributario .data-table td:nth-child(1) { width: 27% !important; text-align: left !important; }
  body.print-mode-tax #tabEstudoTributario .data-table th:nth-child(2),
  body.print-mode-tax #tabEstudoTributario .data-table td:nth-child(2) { width: 17% !important; text-align: right !important; }
  body.print-mode-tax #tabEstudoTributario .data-table th:nth-child(3),
  body.print-mode-tax #tabEstudoTributario .data-table td:nth-child(3) { width: 9% !important; text-align: center !important; }
  body.print-mode-tax #tabEstudoTributario .data-table th:nth-child(4),
  body.print-mode-tax #tabEstudoTributario .data-table td:nth-child(4) { width: 15% !important; text-align: right !important; color: #1d4ed8 !important; font-weight: 700 !important; }
  body.print-mode-tax #tabEstudoTributario .data-table th:nth-child(5),
  body.print-mode-tax #tabEstudoTributario .data-table td:nth-child(5) { width: 8% !important; text-align: center !important; }
  body.print-mode-tax #tabEstudoTributario .data-table th:nth-child(6),
  body.print-mode-tax #tabEstudoTributario .data-table td:nth-child(6) { width: 8% !important; text-align: center !important; }
  body.print-mode-tax #tabEstudoTributario .data-table th:nth-child(7),
  body.print-mode-tax #tabEstudoTributario .data-table td:nth-child(7) { width: 16% !important; text-align: right !important; color: #15803d !important; font-weight: 700 !important; }
  
  /* Oculta coluna 8 redundante na impressão para garantir respiro perfeito no A4 */
  body.print-mode-tax #tabEstudoTributario .data-table th:nth-child(8),
  body.print-mode-tax #tabEstudoTributario .data-table td:nth-child(8) { display: none !important; }

  body.print-mode-tax #tabEstudoTributario .data-table tfoot tr {
    background: #f1f5f9 !important;
    border-top: 2px solid #0a2540 !important;
    font-weight: 800 !important;
  }

  body.print-mode-tax #tabEstudoTributario .data-table input {
    border: none !important;
    background: transparent !important;
    color: #0f172a !important;
    font-weight: 700 !important;
    font-size: 7.2pt !important;
    text-align: inherit !important;
    width: 100% !important;
    padding: 0 !important;
    box-shadow: none !important;
  }

  /* Bloco Demonstrativo de Apuração */
  body.print-mode-tax .tax-demonstrative-box {
    border: 1.5px solid #0a2540 !important;
    border-radius: 6px !important;
    background: #ffffff !important;
    padding: 12px 14px !important;
    margin-top: 10px !important;
    box-shadow: none !important;
    page-break-inside: auto !important;
  }

  body.print-mode-tax .tax-demonstrative-title {
    color: #0a2540 !important;
    font-size: 10pt !important;
    font-weight: 800 !important;
    border-bottom: 2px solid #0a2540 !important;
    padding-bottom: 5px !important;
    margin-bottom: 10px !important;
    letter-spacing: 0.3px !important;
  }

  /* Bloco 1: Operacional */
  body.print-mode-tax .tax-op-block {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    border-left: 4px solid #0a2540 !important;
    border-radius: 6px !important;
    padding: 9px 12px !important;
    margin-bottom: 9px !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  body.print-mode-tax .tax-op-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 8px !important;
  }

  body.print-mode-tax .tax-op-grid .form-input,
  body.print-mode-tax .tax-op-grid input {
    border: none !important;
    background: transparent !important;
    color: #0f172a !important;
    font-weight: 800 !important;
    font-size: 8.8pt !important;
    padding: 0 !important;
    opacity: 1 !important;
    -webkit-text-fill-color: #0f172a !important;
    cursor: default !important;
  }

  body.print-mode-tax .tax-op-subtotal {
    border-top: 1px dashed #94a3b8 !important;
    margin-top: 6px !important;
    padding-top: 4px !important;
    font-size: 8.5pt !important;
    font-weight: 800 !important;
    color: #0a2540 !important;
  }

  /* Blocos 2, 3, 4 & 5: ICMS, PIS/COFINS, ISS e Simples Nacional */
  body.print-mode-tax .tax-taxes-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 8px !important;
    margin-bottom: 9px !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  body.print-mode-tax .tax-card-icms {
    background: #f0f9ff !important;
    border: 1px solid #bae6fd !important;
    border-left: 3.5px solid #0284c7 !important;
    border-radius: 5px !important;
    padding: 7px 9px !important;
    font-size: 7.5pt !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  body.print-mode-tax .tax-card-pc {
    background: #f0fdf4 !important;
    border: 1px solid #bbf7d0 !important;
    border-left: 3.5px solid #10b981 !important;
    border-radius: 5px !important;
    padding: 7px 9px !important;
    font-size: 7.5pt !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  body.print-mode-tax .tax-card-iss {
    background: #faf5ff !important;
    border: 1px solid #e9d5ff !important;
    border-left: 3.5px solid #8b5cf6 !important;
    border-radius: 5px !important;
    padding: 7px 9px !important;
    font-size: 7.5pt !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  body.print-mode-tax .tax-card-sn {
    background: #fff7ed !important;
    border: 1px solid #fed7aa !important;
    border-left: 3.5px solid #f97316 !important;
    border-radius: 5px !important;
    padding: 7px 9px !important;
    font-size: 7.5pt !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  /* Total Impostos Faturamento no Print */
  body.print-mode-tax .tax-card-faturamento-total {
    background: #fef2f2 !important;
    border: 1.5px solid #fca5a5 !important;
    border-left: 4px solid #ef4444 !important;
    border-radius: 5px !important;
    padding: 6px 10px !important;
    margin-bottom: 9px !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  /* Subtotal Lucro Líquido no Print */
  body.print-mode-tax .tax-subtotal-net-box {
    background: #f0f9ff !important;
    border: 1.5px solid #bae6fd !important;
    border-left: 4px solid #0284c7 !important;
    border-radius: 5px !important;
    padding: 6px 10px !important;
    margin-bottom: 9px !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  body.print-mode-tax #taxLucroLiquidoMemorial {
    background: #f8fafc !important;
    border: 1px dashed #cbd5e1 !important;
    border-radius: 4px !important;
    padding: 6px 8px !important;
    margin-bottom: 8px !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  /* Bloco 4: IRPJ & CSLL */
  body.print-mode-tax .tax-card-ir-csll {
    background: #fffbeb !important;
    border: 1px solid #fde68a !important;
    border-left: 3.5px solid #d97706 !important;
    border-radius: 5px !important;
    padding: 6px 8px !important;
    margin-bottom: 8px !important;
    font-size: 7.5pt !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  /* Bloco 5: Resultado Líquido Final */
  body.print-mode-tax .tax-net-result-box {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%) !important;
    border: 2px solid #059669 !important;
    border-radius: 6px !important;
    padding: 9px 14px !important;
    font-size: 9.5pt !important;
    font-weight: 900 !important;
    color: #065f46 !important;
    margin-bottom: 6px !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  body.print-mode-tax .tax-net-result-box #taxCardNet {
    font-size: 13pt !important;
    font-weight: 900 !important;
    color: #047857 !important;
  }

  /* Memória de Cálculo Final */
  body.print-mode-tax .tax-net-real-memorial {
    background: #f0fdf4 !important;
    border: 1px dashed #6ee7b7 !important;
    border-radius: 4px !important;
    padding: 6px 10px !important;
    margin-bottom: 10px !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  /* Bloco 6: Simulador Sem Nota / Desconto se ativo */
  body.print-mode-tax .tax-saved-container {
    border: 1.5px solid #ea580c !important;
    background: #ffffff !important;
    padding: 8px 10px !important;
    margin-bottom: 8px !important;
    page-break-inside: avoid !important;
  }

  body.print-mode-tax .tax-saved-header {
    background: #fff7ed !important;
    border: 1px solid #fed7aa !important;
    padding: 6px 10px !important;
    border-radius: 4px !important;
    color: #9a3412 !important;
    font-weight: 800 !important;
    font-size: 8.5pt !important;
  }

  body.print-mode-tax .tax-discount-results-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 6px !important;
    margin-top: 6px !important;
  }

  body.print-mode-tax .tax-sim-card {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 4px !important;
    padding: 6px 8px !important;
  }

  body.print-mode-tax .tax-sim-card-title {
    font-size: 6.8pt !important;
    font-weight: 700 !important;
    color: #334155 !important;
  }

  body.print-mode-tax .tax-sim-card-val {
    font-size: 9.5pt !important;
    font-weight: 800 !important;
  }

  /* Bloco 7: Créditos Remanescentes */
  body.print-mode-tax .tax-remaining-credits-box {
    background: #f8fafc !important;
    border: 1px dashed #0284c7 !important;
    border-radius: 4px !important;
    padding: 6px 10px !important;
    page-break-inside: avoid !important;
    margin-bottom: 0 !important;
  }

  /* 5. TABELAS E QUEBRA DE PÁGINAS SEM CORTES */
  .table-responsive {
    border: none !important;
    overflow: visible !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  .data-table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 7.5pt !important;
    page-break-inside: auto !important;
  }

  .data-table thead {
    display: table-header-group !important;
  }

  .data-table tr {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .data-table th {
    background: #f1f5f9 !important;
    color: #0a2540 !important;
    border: 1px solid #94a3b8 !important;
    padding: 4px 6px !important;
    font-weight: 700 !important;
    font-size: 7.2pt !important;
    text-transform: uppercase !important;
  }

  .data-table td {
    border: 1px solid #cbd5e1 !important;
    padding: 4px 6px !important;
    color: #0f172a !important;
  }

  /* Totalizadores aparecem SOMENTE no final da tabela (última folha), nunca repetidos em cada página */
  tfoot,
  .data-table tfoot,
  table tfoot {
    display: table-row-group !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .data-table tfoot tr {
    background: #f8fafc !important;
    border-top: 2px solid #0a2540 !important;
    font-weight: 800 !important;
  }

  /* REGRAS RÍGIDAS DE ENQUADRAMENTO A4 PARA A TABELA DE PRODUTOS */
  #workProductsTableContainer .data-table {
    table-layout: fixed !important;
    width: 100% !important;
  }

  #workProductsTableContainer .data-table th,
  #workProductsTableContainer .data-table td {
    overflow: hidden !important;
    word-break: break-word !important;
    padding: 3px 4px !important;
    font-size: 7pt !important;
  }

  #workProductsTableContainer .data-table .col-prod-num { width: 4% !important; text-align: center !important; }
  #workProductsTableContainer .data-table .col-prod-code { width: 11% !important; }
  #workProductsTableContainer .data-table .col-prod-desc { width: 37% !important; }
  #workProductsTableContainer .data-table .col-prod-unit { width: 6% !important; text-align: center !important; }
  #workProductsTableContainer .data-table .col-prod-qty { width: 9% !important; text-align: right !important; }
  #workProductsTableContainer .data-table .col-prod-unitcost { width: 13% !important; text-align: right !important; }
  #workProductsTableContainer .data-table .col-prod-loss { width: 6% !important; text-align: right !important; }
  #workProductsTableContainer .data-table .col-prod-total { width: 14% !important; text-align: right !important; }

  /* QUADRO CONSOLIDADO EXECUTIVO DE CUSTOS NA IMPRESSÃO */
  body.print-mode-owner #consolidatedCostsSummaryBox {
    display: block !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    margin-top: 14px !important;
    margin-bottom: 0 !important;
    border: 1.5px solid #0a2540 !important;
    box-shadow: none !important;
    background: #ffffff !important;
  }

  #consolidatedCostsSummaryBox,
  #consolidatedCostsSummaryBox * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  #consolidatedCostsSummaryBox .consolidated-costs-header {
    background: #0a2540 !important;
    color: #ffffff !important;
  }
  #consolidatedCostsSummaryBox .consolidated-costs-header span {
    color: #ffffff !important;
  }

  #consolidatedCostsSummaryBox table,
  #consolidatedCostsSummaryBox tr,
  #consolidatedCostsSummaryBox td {
    background: #ffffff !important;
  }

  #consolidatedCostsSummaryBox strong {
    color: #0f172a !important;
  }

  #summaryPurchasesCostDisplay {
    color: #0a2540 !important;
    font-weight: 800 !important;
  }

  #summaryLaborCostDisplay {
    color: #d97706 !important;
    font-weight: 800 !important;
  }

  #summaryOtherExpensesCostDisplay {
    color: #d97706 !important;
    font-weight: 800 !important;
  }

  #consolidatedCostsSummaryBox tr:last-child,
  #consolidatedCostsSummaryBox tr:last-child td {
    background: #f0fdf4 !important;
    color: #0a2540 !important;
  }

  #summaryGrandTotalCostDisplay {
    color: #0a2540 !important;
    font-weight: 900 !important;
  }

  body.print-mode-proposal #consolidatedCostsSummaryBox,
  body.print-mode-products #consolidatedCostsSummaryBox,
  body.print-mode-tax #consolidatedCostsSummaryBox {
    display: none !important;
  }

  .surface-card {
    display: block !important;
    page-break-inside: auto !important;
    break-inside: auto !important;
  }

  .surface-card-header {
    page-break-after: avoid !important;
  }

  /* 6. INPUTS E SELECTS EM TABELAS TRANSFORMADOS EM TEXTO PURO */
  .data-table input,
  .data-table select,
  .table-input,
  .table-select {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    color: #000000 !important;
    padding: 0 !important;
    font-weight: 600 !important;
    font-size: inherit !important;
    width: auto !important;
    max-width: 100% !important;
  }

  /* 7. BLOCOS DE ASSINATURA E RODAPÉ A4 */
  .print-signatures-block {
    display: block !important;
    margin-top: 14px !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .app-footer,
  footer.app-footer,
  .no-print {
    display: none !important;
  }

  /* Modais NUNCA aparecem na impressão (exceto dashboard na sua classe específica) */
  body:not(.print-mode-dashboard) .modal-backdrop,
  body:not(.print-mode-dashboard) .modal-dialog,
  body:not(.print-mode-dashboard) #dashboardModal,
  #workModal,
  #companyModal,
  #employeeModal,
  #supplierModal,
  #productModal,
  #catalogModal,
  #romaneioModal,
  #auditModal,
  #proposalImportModal,
  #companyPrintModal,
  #workPrintModal,
  #proposalImportConflictModal {
    display: none !important;
  }

  /* ===========================================================================
     8. MODAL DE DASHBOARD - RELATÓRIO GERENCIAL & GRÁFICOS (print-mode-dashboard)
     =========================================================================== */
  body.print-mode-dashboard .app-header,
  body.print-mode-dashboard .app-nav,
  body.print-mode-dashboard .work-context-bar,
  body.print-mode-dashboard .content-area,
  body.print-mode-dashboard .main-content,
  body.print-mode-dashboard .tab-panel,
  body.print-mode-dashboard .app-footer,
  body.print-mode-dashboard .print-header,
  body.print-mode-dashboard .notification-bell-container {
    display: none !important;
  }

  body.print-mode-dashboard,
  body.print-mode-dashboard #dashboardModal,
  body.print-mode-dashboard .modal-backdrop#dashboardModal {
    position: static !important;
    display: block !important;
    visibility: visible !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #ffffff !important;
    overflow: visible !important;
    inset: auto !important;
    transform: none !important;
  }

  body.print-mode-dashboard #dashboardModal .dashboard-modal-dialog,
  body.print-mode-dashboard #dashboardModal .modal-dialog {
    display: flex !important;
    flex-direction: column !important;
    visibility: visible !important;
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: #ffffff !important;
    overflow: visible !important;
    transform: none !important;
  }

  body.print-mode-dashboard #dashboardModal .dashboard-modal-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    border-bottom: 2px solid #0a2540 !important;
    background: #0a2540 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color: #ffffff !important;
    padding: 8px 12px !important;
    margin: 0 0 10px 0 !important;
    border-radius: 4px !important;
    page-break-after: avoid !important;
    break-after: avoid !important;
  }

  body.print-mode-dashboard #dashboardModal .modal-close-btn,
  body.print-mode-dashboard #dashboardModal .dashboard-modal-toolbar,
  body.print-mode-dashboard #dashboardModal .dashboard-scenarios-controls,
  body.print-mode-dashboard #dashboardModal .no-print {
    display: none !important;
  }

  body.print-mode-dashboard #dashboardModal .dashboard-export-brand {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
  }

  body.print-mode-dashboard #dashboardModal .dashboard-export-brand img {
    height: 36px !important;
    width: auto !important;
    background: #ffffff !important;
    padding: 2px 6px !important;
    border-radius: 3px !important;
    display: block !important;
  }

  body.print-mode-dashboard #dashboardModal .dashboard-export-brand strong {
    color: #ffffff !important;
    font-size: 11pt !important;
    display: block !important;
  }

  body.print-mode-dashboard #dashboardModal .dashboard-export-brand small {
    color: #93c5fd !important;
    font-size: 7.5pt !important;
    display: block !important;
  }

  body.print-mode-dashboard #dashboardModal .dashboard-modal-body {
    display: flex !important;
    flex-direction: column !important;
    overflow: visible !important;
    background: #ffffff !important;
    padding: 0 !important;
    gap: 10px !important;
  }

  /* 8 CARDS DE RESUMO DO TOPO */
  body.print-mode-dashboard #dashboardModal .dashboard-modal-summary {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 6px !important;
    background: #ffffff !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    margin-bottom: 2px !important;
  }

  body.print-mode-dashboard #dashboardModal .dashboard-summary-item {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    border-left: 3.5px solid #0a2540 !important;
    border-radius: 4px !important;
    padding: 5px 7px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body.print-mode-dashboard #dashboardModal .dashboard-summary-item span {
    font-size: 6.8pt !important;
    font-weight: 700 !important;
    color: #475569 !important;
    text-transform: uppercase !important;
  }

  body.print-mode-dashboard #dashboardModal .dashboard-summary-item strong {
    font-size: 10pt !important;
    font-weight: 900 !important;
    color: #0a2540 !important;
  }

  body.print-mode-dashboard #dashboardModal .dashboard-summary-item small {
    font-size: 6.5pt !important;
    color: #64748b !important;
  }

  /* GRÁFICOS EXPANDIDOS EM ALTA DEFINIÇÃO */
  body.print-mode-dashboard #dashboardModal .work-dashboard-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    margin-top: 4px !important;
  }

  body.print-mode-dashboard #dashboardModal .dashboard-chart-panel {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 4px !important;
    padding: 8px 10px !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body.print-mode-dashboard #dashboardModal .dashboard-chart-panel h3 {
    font-size: 8.5pt !important;
    font-weight: 800 !important;
    color: #0a2540 !important;
    margin: 0 0 6px 0 !important;
    border-bottom: 1px solid #e2e8f0 !important;
    padding-bottom: 4px !important;
  }

  body.print-mode-dashboard #dashboardModal .dashboard-chart-panel h3 small {
    font-size: 6.8pt !important;
    color: #64748b !important;
  }

  body.print-mode-dashboard #dashboardModal .dashboard-columns-container {
    height: 160px !important;
    display: flex !important;
    align-items: flex-end !important;
    gap: 8px !important;
    padding: 5px 0 !important;
  }

  body.print-mode-dashboard #dashboardModal .dashboard-column-bar {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    transition: none !important;
    animation: none !important;
  }

  body.print-mode-dashboard #dashboardModal .dashboard-bar-track {
    background: #e2e8f0 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body.print-mode-dashboard #dashboardModal .dashboard-bar-fill {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    transition: none !important;
    animation: none !important;
  }

  body.print-mode-dashboard #dashboardModal .dashboard-bar-label {
    color: #334155 !important;
    opacity: 1 !important;
    font-size: 7.2pt !important;
  }

  body.print-mode-dashboard #dashboardModal .dashboard-legend-item {
    color: #334155 !important;
    opacity: 1 !important;
    font-size: 7pt !important;
  }

  body.print-mode-dashboard #dashboardModal .dashboard-pie-layout {
    min-height: 120px !important;
    grid-template-columns: 100px 1fr !important;
    gap: 8px !important;
  }

  body.print-mode-dashboard #dashboardModal .dashboard-pie {
    width: 100px !important;
    height: 100px !important;
  }

  body.print-mode-dashboard #dashboardModal .dashboard-pie-slice {
    transform-origin: 90px 90px !important;
  }

  body.print-mode-dashboard #dashboardModal .dashboard-pie-hole {
    fill: #ffffff !important;
  }

  body.print-mode-dashboard #dashboardModal .dashboard-pie-base {
    fill: #f1f5f9 !important;
    stroke: #cbd5e1 !important;
  }

  /* PAINEL DE SEGREGAÇÃO (PRODUTOS VS SERVIÇOS) */
  body.print-mode-dashboard #dashboardModal .dashboard-segregation-analytics {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 4px !important;
    padding: 8px 10px !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    margin-top: 6px !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body.print-mode-dashboard #dashboardModal .segregation-analytics-header {
    border-bottom: 1px solid #e2e8f0 !important;
    padding-bottom: 4px !important;
    margin-bottom: 6px !important;
  }

  body.print-mode-dashboard #dashboardModal .segregation-heading {
    font-size: 8.5pt !important;
    font-weight: 800 !important;
    color: #0a2540 !important;
    margin: 0 !important;
  }

  body.print-mode-dashboard #dashboardModal .segregation-subheading {
    font-size: 6.8pt !important;
    color: #64748b !important;
    margin: 0 !important;
  }

  body.print-mode-dashboard #dashboardModal .segregation-grid-cards {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    margin-top: 6px !important;
  }

  body.print-mode-dashboard #dashboardModal .segregation-card {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 4px !important;
    padding: 6px 8px !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body.print-mode-dashboard #dashboardModal .seg-amount-large {
    font-size: 11pt !important;
    font-weight: 900 !important;
    color: #0a2540 !important;
    margin: 2px 0 4px 0 !important;
  }

  body.print-mode-dashboard #dashboardModal .seg-progress-wrap {
    height: 4px !important;
    background: #e2e8f0 !important;
    margin-bottom: 6px !important;
    border-radius: 2px !important;
  }

  body.print-mode-dashboard #dashboardModal .seg-progress-fill {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    transition: none !important;
    animation: none !important;
  }

  body.print-mode-dashboard #dashboardModal .seg-tax-table {
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    font-size: 7.2pt !important;
  }

  body.print-mode-dashboard #dashboardModal .seg-tax-line {
    display: flex !important;
    justify-content: space-between !important;
    padding: 1px 0 !important;
    color: #334155 !important;
  }

  body.print-mode-dashboard #dashboardModal .seg-tax-line.total-line {
    border-top: 1px dashed #94a3b8 !important;
    padding-top: 3px !important;
    font-weight: 800 !important;
    color: #0a2540 !important;
  }

  body.print-mode-dashboard #dashboardModal .seg-card-footer {
    border-top: 1px solid #e2e8f0 !important;
    padding-top: 3px !important;
    margin-top: 4px !important;
    font-size: 7pt !important;
    display: flex !important;
    justify-content: space-between !important;
  }

  body.print-mode-dashboard #dashboardModal .segregation-insight-card {
    background: #f0fdf4 !important;
    border: 1px solid #86efac !important;
    border-radius: 4px !important;
    padding: 5px 8px !important;
    margin-top: 6px !important;
    font-size: 7.2pt !important;
    color: #14532d !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* INDICADORES DE INTELIGÊNCIA OPERACIONAL (5 METRICS) */
  body.print-mode-dashboard #dashboardModal .dashboard-advanced-metrics-grid {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 6px !important;
    margin-top: 4px !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  body.print-mode-dashboard #dashboardModal .dashboard-metric-box {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 4px !important;
    padding: 5px 7px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body.print-mode-dashboard #dashboardModal .dashboard-metric-box-title {
    font-size: 6.5pt !important;
    font-weight: 700 !important;
    color: #475569 !important;
    text-transform: uppercase !important;
  }

  body.print-mode-dashboard #dashboardModal .dashboard-metric-box-val {
    font-size: 10pt !important;
    font-weight: 900 !important;
  }

  body.print-mode-dashboard #dashboardModal .dashboard-metric-box-sub {
    font-size: 6.2pt !important;
    color: #64748b !important;
  }

  /* MATRIZ DE CENÁRIOS E DRE EXECUTIVA */
  body.print-mode-dashboard #dashboardModal .dashboard-modal-section {
    page-break-inside: auto !important;
    break-inside: auto !important;
  }

  body.print-mode-dashboard #dashboardModal .dashboard-scenarios-modal-table,
  body.print-mode-dashboard #dashboardModal .dashboard-executive-dre-table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 7.2pt !important;
    page-break-inside: auto !important;
    background: #ffffff !important;
  }

  body.print-mode-dashboard #dashboardModal .dashboard-scenarios-modal-table th,
  body.print-mode-dashboard #dashboardModal .dashboard-executive-dre-table th {
    background: #0a2540 !important;
    color: #ffffff !important;
    border: 1px solid #0a2540 !important;
    padding: 3px 5px !important;
    font-size: 6.8pt !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body.print-mode-dashboard #dashboardModal .dashboard-scenarios-modal-table td,
  body.print-mode-dashboard #dashboardModal .dashboard-executive-dre-table td {
    border: 1px solid #cbd5e1 !important;
    padding: 3px 5px !important;
    color: #0f172a !important;
  }

  body.print-mode-dashboard #dashboardModal .dashboard-scenarios-modal-table tr.scenario-active-row {
    background: #ecfdf5 !important;
    font-weight: 800 !important;
    border-left: 3px solid #10b981 !important;
  }

  body.print-mode-dashboard #dashboardModal .dashboard-export-note {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 4px !important;
    padding: 5px 8px !important;
    color: #475569 !important;
    font-size: 6.8pt !important;
    margin-top: 6px !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
}

.print-header {
  display: none;
}

/* Responsividade Mobile / Tablet */
@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    /* Largura fixa e generosa: em toque o :hover de desktop nao dispara de
       forma confiavel, entao a gaveta nao pode depender dele pra abrir larga. */
    width: 260px !important;
    transform: translateX(-100%);
    box-shadow: var(--modal-shadow);
  }

  .nav-item span {
    white-space: normal;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
  }

  .menu-toggle-btn, .sidebar-close-btn {
    display: flex;
  }

  /* O topbar de desktop (44px fixos, 1 linha so) nao cabe todo o conteudo em
     telas pequenas: titulo longo + seletores de Empresa/Obra + ~9 icones.
     Aqui ele vira 2 linhas (fluido em altura), esconde o titulo (nao critico
     no celular) e os icones puramente decorativos (Fixar/Minimizar/Maximizar/
     Notificacoes nao tem nenhuma acao — sao so cosmeticos do tema DigiSat),
     e os seletores de Empresa/Obra ficam compactos com rolagem propria como
     rede de seguranca, sem nunca cortar o cabecalho pra fora da tela. */
  .topbar {
    height: auto;
    min-height: 44px;
    flex-wrap: wrap;
    padding: 8px 10px;
    row-gap: 6px;
  }

  .page-title-box {
    display: none;
  }

  .topbar-left {
    flex: 1 1 auto;
    min-width: 0;
  }

  .active-work-context {
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  .active-work-context::-webkit-scrollbar {
    display: none;
  }

  .active-work-context > * {
    flex-shrink: 0;
  }

  .active-work-context label {
    display: none;
  }

  .active-work-context select {
    max-width: 118px;
  }

  .topbar-right {
    width: 100%;
    justify-content: flex-end;
  }

  .no-mobile {
    display: none !important;
  }
}

/* Banner de Cookies / LGPD */
.cookie-banner {
  position: fixed;
  bottom: 20px;
  left: 20px;
  right: 90px;
  max-width: 600px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  box-shadow: var(--modal-shadow);
  z-index: 99998;
  animation: fadeIn 0.3s ease-out;
}

.cookie-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.82rem;
  color: var(--text-main);
}

.work-dashboard-card { margin-top: 20px; }
.work-dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.dashboard-chart-panel { padding: 16px; background: var(--bg-surface); border: 1px solid var(--border-light); border-radius: var(--radius-sm); }
.dashboard-chart-panel {
  position: relative;
  padding: 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.dashboard-chart-panel.clickable-chart {
  cursor: pointer;
}

.dashboard-chart-panel.clickable-chart:hover {
  border-color: var(--brand-cyan-500);
  box-shadow: 0 8px 24px rgba(32, 168, 223, 0.12);
  transform: translateY(-2px);
}

.dashboard-chart-panel h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 16px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-heading);
}

.chart-expand-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--brand-cyan-500);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-light);
  transition: all 0.18s ease;
}

.dashboard-chart-panel:hover .chart-expand-badge {
  background: var(--brand-cyan-500);
  color: #ffffff;
  border-color: var(--brand-cyan-500);
}

.dashboard-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.dashboard-summary-item { min-width: 0; padding: 12px; border-left: 3px solid var(--brand-cyan-500); background: var(--bg-surface-subtle); border-radius: var(--radius-sm); }
.dashboard-summary-item span, .dashboard-summary-item small { display: block; color: var(--text-muted); font-size: 0.72rem; }
.dashboard-summary-item strong { display: block; margin: 3px 0; overflow-wrap: anywhere; color: var(--text-main); font-size: 1rem; }
.dashboard-summary-item.danger { border-left-color: var(--color-danger); }
.dashboard-summary-item.danger strong { color: var(--color-danger); }
.dashboard-summary-item.success { border-left-color: var(--color-success); }
.dashboard-summary-item.success strong { color: var(--color-success); }
.dashboard-view-toggle { display: inline-flex; gap: 4px; padding: 3px; background: var(--bg-surface-subtle); border: 1px solid var(--border-light); border-radius: var(--radius-sm); }
.dashboard-view-toggle button { border: 0; border-radius: 4px; padding: 6px 10px; color: var(--text-muted); background: transparent; cursor: pointer; font-size: 0.75rem; font-weight: 700; }
.dashboard-view-toggle button.active { color: #fff; background: var(--brand-cyan-500); }
.dashboard-bar-row { position: relative; margin: 14px 0; padding: 5px 7px 7px; border-radius: var(--radius-sm); cursor: pointer; transition: background 0.18s ease, transform 0.18s ease; }
.dashboard-bar-row:hover, .dashboard-bar-row:focus-visible { background: var(--bg-surface-subtle); transform: translateX(3px); outline: none; }
.dashboard-bar-row::after { content: attr(data-tooltip); position: absolute; z-index: 5; left: 8px; bottom: calc(100% + 6px); max-width: min(320px, 90vw); padding: 7px 10px; border: 1px solid var(--border-medium); border-radius: var(--radius-sm); color: var(--text-main); background: var(--bg-surface); box-shadow: var(--modal-shadow); font-size: 0.72rem; font-weight: 700; line-height: 1.3; opacity: 0; pointer-events: none; transform: translateY(4px); transition: opacity 0.16s ease, transform 0.16s ease; }
.dashboard-bar-row:hover::after, .dashboard-bar-row:focus-visible::after { opacity: 1; transform: translateY(0); }
.dashboard-floating-tooltip { position: fixed; z-index: 100000; max-width: min(340px, calc(100vw - 24px)); padding: 9px 12px; border: 1px solid var(--border-medium); border-radius: var(--radius-sm); color: var(--text-main); background: var(--bg-surface); box-shadow: var(--modal-shadow); font-size: 0.74rem; font-weight: 700; line-height: 1.35; opacity: 0; pointer-events: none; transform: translateY(4px); transition: opacity 0.14s ease, transform 0.14s ease; }
.dashboard-floating-tooltip.visible { opacity: 1; transform: translateY(0); }
@media print {
  .dashboard-bar-row::after,
  .dashboard-bar-row:hover::after,
  .dashboard-bar-row:focus-visible::after,
  .dashboard-floating-tooltip,
  .dashboard-floating-tooltip.visible,
  [data-tooltip]::after {
    display: none !important;
    content: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
  }
}
.dashboard-bar-label { display: flex; justify-content: space-between; gap: 12px; color: var(--text-muted); font-size: 0.78rem; }
.dashboard-bar-label strong { color: var(--text-main); text-align: right; }
.dashboard-bar-track {
  height: 12px;
  margin-top: 7px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  border: 1px solid var(--border-light);
  position: relative;
}

.dashboard-bar-track span {
  display: block;
  height: 100%;
  min-width: 4px;
  border-radius: 5px;
  transition: width 0.75s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: barHorizontalSlide 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

@keyframes barHorizontalSlide {
  0% {
    width: 0% !important;
    opacity: 0.3;
    transform: scaleX(0);
    transform-origin: left;
  }
  100% {
    opacity: 1;
    transform: scaleX(1);
    transform-origin: left;
  }
}

/* =============================================================================
   GRÁFICO DE COLUNAS VERTICAIS ANIMADAS (SUBIDA E DESCIDA EM TEMPO REAL)
   ============================================================================= */
.dashboard-columns-container {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: 14px;
  height: 270px;
  padding: 24px 14px 12px;
  background: var(--bg-surface-subtle);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-medium);
  margin-top: 8px;
  position: relative;
}

.dashboard-column-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  position: relative;
  min-width: 0;
}

.dashboard-column-val-top {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
  white-space: nowrap;
  text-align: center;
  transition: transform 0.2s ease;
}

.dashboard-column-track {
  width: 100%;
  max-width: 64px;
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px 8px 0 0;
  display: flex;
  align-items: flex-end;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.dashboard-column-bar-fill {
  width: 100%;
  border-radius: 6px 6px 0 0;
  transition: height 0.85s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s ease, transform 0.2s ease;
  animation: columnRiseUp 0.85s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 6px;
  position: relative;
  box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

.dashboard-column-bar-fill:hover {
  filter: brightness(1.2);
  transform: scaleY(1.02);
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.4);
}

@keyframes columnRiseUp {
  0% {
    height: 0% !important;
    opacity: 0.2;
    transform: scaleY(0);
    transform-origin: bottom;
  }
  100% {
    opacity: 1;
    transform: scaleY(1);
    transform-origin: bottom;
  }
}

.dashboard-column-pct {
  font-size: 0.72rem;
  font-weight: 800;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

.dashboard-column-label {
  margin-top: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.2;
  white-space: normal;
  word-break: break-word;
}

/* =============================================================================
   MODAL EXPANDIDO DE ALTA RESOLUÇÃO - QUASE TELA CHEIA (FULLSCREEN 97VW X 95VH)
   ============================================================================= */
.dashboard-modal-dialog {
  max-width: 1720px;
  width: 97vw;
  height: 95vh;
  max-height: 95vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.45);
  animation: modalScaleIn 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  backdrop-filter: blur(16px);
}

@keyframes modalScaleIn {
  0% {
    opacity: 0;
    transform: scale(0.94) translateY(20px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.dashboard-modal-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 26px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-surface-subtle);
}

.dashboard-modal-body {
  flex: 1;
  padding: 22px 26px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.dashboard-modal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.dashboard-modal-dialog .dashboard-pie-layout {
  grid-template-columns: 270px 1fr;
  min-height: 280px;
  gap: 24px;
}

.dashboard-modal-dialog .dashboard-pie-container,
.dashboard-modal-dialog .dashboard-pie {
  width: 260px;
  height: 260px;
}

.dashboard-modal-dialog .dashboard-pie-center-label {
  font-size: 8.5px;
}
.dashboard-modal-dialog .dashboard-pie-center-value {
  font-size: 9.5px;
}

/* Painel de Métricas Avançadas da Obra no Modal */
.dashboard-advanced-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.dashboard-metric-box {
  padding: 14px 16px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.dashboard-metric-box-title {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.dashboard-metric-box-val {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 2px;
}

.dashboard-metric-box-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* Tabela DRE Executiva no Modal */
.dashboard-executive-dre-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-medium);
}

.dashboard-executive-dre-table th {
  background: var(--bg-surface-subtle);
  padding: 10px 14px;
  text-align: left;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-medium);
}

.dashboard-executive-dre-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
}

.dashboard-executive-dre-table tr:hover {
  background: var(--bg-surface-subtle);
}

.dashboard-executive-dre-table tr.highlight-total {
  background: rgba(16, 185, 129, 0.08);
  font-weight: 800;
}

.dashboard-executive-dre-table tr.highlight-total td {
  border-top: 2px solid var(--color-success);
  color: var(--color-success);
  font-size: 0.92rem;
}

/* Matriz Comparativa de Cenários de Margem & Markup no Modal */
.dashboard-scenarios-modal-table th {
  white-space: nowrap;
}

.dashboard-scenarios-modal-table td {
  white-space: nowrap;
}

.dashboard-scenarios-modal-table tr.scenario-active-row {
  background: rgba(0, 102, 204, 0.12) !important;
}

.dashboard-scenarios-modal-table tr.scenario-active-row td:first-child {
  border-left: 3px solid var(--brand-cyan-500);
}

.mini-toggle {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.mini-toggle button {
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: calc(var(--radius-sm) - 2px);
  transition: all 0.2s ease;
}

.mini-toggle button.active {
  background: var(--brand-cyan-500);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.modal-scenarios-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface-subtle);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-medium);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.modal-scenarios-badge-label {
  color: var(--text-muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.4px;
}

.scenario-pill-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.scenario-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.scenario-pill small {
  font-size: 0.72rem;
  text-transform: uppercase;
  font-weight: 700;
}

.scenario-pill-margin small {
  color: var(--text-muted);
}

.scenario-pill-margin strong {
  font-size: 1.05rem;
  color: var(--brand-cyan-400);
  font-weight: 800;
}

.scenario-pill-divider {
  color: var(--border-medium);
  font-weight: 300;
  font-size: 0.95rem;
}

.scenario-pill-markup {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 3px 10px;
  border-radius: 6px;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.12);
}

.scenario-pill-markup small {
  color: #fbbf24;
}

.scenario-pill-markup strong {
  font-size: 1.25rem;
  color: #f59e0b;
  font-weight: 900;
  text-shadow: 0 0 8px rgba(245, 158, 11, 0.3);
}

.scenario-mult-badge {
  font-size: 0.88rem;
  font-weight: 800;
  background: #d97706;
  color: #ffffff;
  padding: 2px 8px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

/* Valor de Markup na tabela do modal */
.modal-table-markup-val {
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--brand-orange-500);
  margin-right: 4px;
}

.modal-table-mult-badge {
  font-size: 0.80rem !important;
  font-weight: 800 !important;
  padding: 2px 7px !important;
  border-radius: 4px !important;
  background: rgba(245, 158, 11, 0.18) !important;
  color: #fbbf24 !important;
  border: 1px solid rgba(245, 158, 11, 0.35) !important;
}

.dashboard-tax-controls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 18px; }
.dashboard-tax-controls label { color: var(--text-muted); font-size: 0.72rem; font-weight: 700; }
.dashboard-tax-controls input { width: 100%; margin-top: 5px; padding: 8px; color: var(--text-main); background: var(--bg-page); border: 1px solid var(--border-light); border-radius: var(--radius-sm); }

/* =============================================================================
   GRÁFICO DE PIZZA / DONUT COM ANIMAÇÃO SUAVE DE ROTAÇÃO
   ============================================================================= */
.dashboard-pie-layout {
  display: grid;
  grid-template-columns: 160px 1fr;
  align-items: center;
  gap: 18px;
  min-height: 180px;
  position: relative;
}

.dashboard-pie-container {
  position: relative;
  width: 160px;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dashboard-pie {
  width: 160px;
  height: 160px;
  overflow: visible;
}

.dashboard-pie-animated {
  transform-origin: 90px 90px;
  animation: pieSmoothSpin 0.95s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes pieSmoothSpin {
  0% {
    transform: rotate(-140deg) scale(0.85);
    opacity: 0;
  }
  60% {
    transform: rotate(12deg) scale(1.03);
    opacity: 1;
  }
  85% {
    transform: rotate(-4deg) scale(0.99);
    opacity: 1;
  }
  100% {
    transform: rotate(0deg) scale(1);
    opacity: 1;
  }
}

.dashboard-pie-base { fill: var(--bg-surface-subtle); stroke: var(--border-light); stroke-width: 1; }
.dashboard-pie-slice {
  cursor: pointer;
  stroke: var(--bg-surface);
  stroke-width: 2.5;
  transition: opacity 0.18s ease, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), filter 0.2s ease;
  transform-origin: 90px 90px;
}
.dashboard-pie-slice:hover, .dashboard-pie-slice:focus {
  opacity: 0.9;
  transform: scale(1.045);
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.25));
  outline: none;
}
.dashboard-pie-hole { fill: var(--bg-surface); pointer-events: none; }
.dashboard-pie-center-label, .dashboard-pie-center-value {
  fill: var(--text-muted);
  text-anchor: middle;
  pointer-events: none;
  font-family: var(--font-sans);
}
.dashboard-pie-center-label { font-size: 7.5px; font-weight: 800; letter-spacing: 0.5px; }
.dashboard-pie-center-value { fill: var(--text-main); font-size: 8px; font-weight: 800; }
.dashboard-legend { display: grid; gap: 8px; }
.dashboard-legend-item { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 8px; color: var(--text-muted); font-size: 0.78rem; padding: 2px 4px; border-radius: 4px; transition: background 0.15s ease; }
.dashboard-legend-item:hover { background: var(--bg-surface-subtle); }

.chart-item-clickable { cursor: pointer; }
.chart-item-clickable:focus-visible { outline: 2px solid var(--brand-cyan-500, #0284c7); outline-offset: 2px; }
.dashboard-column-item.chart-item-clickable:hover .dashboard-column-label,
.dashboard-legend-item.chart-item-clickable:hover span { color: var(--brand-cyan-600, #0284c7); }
.dashboard-legend-item strong { display: grid; text-align: right; color: var(--text-main); }
.dashboard-legend-item small { color: var(--text-muted); font-weight: 600; font-size: 0.72rem; }
.dashboard-legend-dot { width: 9px; height: 9px; border-radius: 50%; }
.money-preview { color: var(--brand-orange-600); font-size: 0.76rem; font-weight: 700; }

.work-dashboard-card { flex: 1 1 0; width: auto; min-width: 0; order: 2; }

@media (max-width: 860px) {
  .profit-inputs-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .work-dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-tax-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .digisat-search-bar { align-items: stretch; flex-direction: column; }
  .digisat-company-filter, .digisat-detailed-search-btn { width: 100%; }
  .dashboard-pie-layout { grid-template-columns: 1fr; justify-items: center; }
  .dashboard-legend { width: 100%; }
  .dashboard-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-edit-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .profit-inputs-row { grid-template-columns: 1fr; }
  .dashboard-summary-grid { grid-template-columns: 1fr; }
}

/* =============================================================================
   BARRA DE CONTROLE DE ALTERAÇÕES & STATUS PENDENTE
   ============================================================================= */
.change-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  transition: all 0.2s ease;
}

.change-status-pill.clean {
  background: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid rgba(22, 163, 74, 0.25);
}

.change-status-pill.dirty {
  background: var(--color-warning-bg);
  color: var(--color-warning);
  border: 1px solid rgba(217, 119, 6, 0.35);
  animation: pulseDirty 2s infinite ease-in-out;
}

@keyframes pulseDirty {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.4); }
  50% { transform: scale(1.02); box-shadow: 0 0 0 5px rgba(217, 119, 6, 0); }
}

/* =============================================================================
   TOAST NOTIFICATIONS FLUTUANTES
   ============================================================================= */
.openfrio-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100000;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: var(--modal-shadow);
  font-size: 0.85rem;
  font-weight: 600;
  transform: translateY(100px);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.openfrio-toast.show {
  transform: translateY(0);
  opacity: 1;
}

.openfrio-toast.success {
  border-left: 4px solid var(--color-success);
}

.openfrio-toast.warning {
  border-left: 4px solid var(--color-warning);
}

.openfrio-toast.error {
  border-left: 4px solid var(--color-danger);
}

/* =============================================================================
   SIMULADOR DE REPASSE DE ECONOMIA & DESCONTO COMERCIAL (SEM NOTA)
   ============================================================================= */
.tax-saved-container {
  background: rgba(245, 158, 11, 0.06);
  border: 2px solid var(--brand-orange-500);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: 0 4px 18px rgba(245, 158, 11, 0.08);
  transition: all 0.25s ease;
}

.tax-saved-header {
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--brand-orange-500);
  background: rgba(245, 158, 11, 0.12);
  border-bottom: 1px solid rgba(245, 158, 11, 0.25);
  flex-wrap: wrap;
  gap: 10px;
}

.tax-discount-body {
  padding: 16px 18px;
  background: var(--bg-surface-subtle);
}

.tax-discount-action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.tax-discount-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.tax-discount-controls-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
  background: var(--bg-surface);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-medium);
}

@media (max-width: 860px) {
  .tax-discount-controls-grid {
    grid-template-columns: 1fr;
  }
}

.discount-presets-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.discount-preset-btn {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-medium);
  color: var(--text-main);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.discount-preset-btn:hover {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--brand-orange-500);
  color: var(--brand-orange-500);
}

.discount-preset-btn.active {
  background: var(--brand-orange-500);
  border-color: var(--brand-orange-500);
  color: #000;
}

.tax-discount-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.tax-sim-card {
  padding: 12px 14px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-medium);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.tax-sim-card.primary {
  border-left: 4px solid var(--brand-cyan-500);
}

.tax-sim-card.savings {
  border-left: 4px solid var(--brand-orange-500);
}

.tax-sim-card.profit {
  border-left: 4px solid var(--color-success);
}

.tax-sim-card-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.tax-sim-card-val {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 2px;
}

.tax-sim-card-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* =============================================================================
   MICROINTERAÇÕES & ANIMAÇÕES EXECUTIVAS ELEGANTES (SUTIS E MODERNAS)
   ============================================================================= */

@media screen {
  .tab-panel.active {
    display: flex !important;
    animation: tabFadeSlideIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }
}

@keyframes tabFadeSlideIn {
  0% {
    opacity: 0;
    transform: translateY(6px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 2. Feedback Físico de Toque/Clique nos Botões e Elementos Clicáveis */
.btn, button, .discount-preset-btn, .dashboard-view-toggle button, .launcher-tile, .nav-item {
  transition: transform 0.12s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease, filter 0.15s ease;
}

.btn:active:not(:disabled), button:active:not(:disabled), .discount-preset-btn:active, .launcher-tile:active, .nav-item:active {
  transform: scale(0.965) !important;
}

/* 3. Pulsação Suave de "Sistema Ativo / Conectado" (Breathing Pulse) */
.status-dot.online, .status-dot.active, .sync-badge-dot.clean {
  position: relative;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  animation: breathingPulse 3.5s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

@keyframes breathingPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* 4. Brilho Sutil de Recálculo em Tempo Real (Value Flash Glow) */
.value-flash-glow {
  animation: valueFlashGlow 0.48s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes valueFlashGlow {
  0% {
    background-color: rgba(16, 185, 129, 0.16) !important;
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.25) !important;
  }
  100% {
    background-color: inherit;
    box-shadow: inherit;
  }
}

/* 5. Reflexo de Luz Metálico Suave (Shimmer Sweep) nas Colunas e Barras */
.dashboard-column-bar-fill, .dashboard-bar-track span {
  position: relative;
  overflow: hidden;
  opacity: 1 !important;
}

.dashboard-column-bar-fill::after, .dashboard-bar-track span::after {
  content: '';
  position: absolute;
  top: 0;
  left: -120%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
  animation: shimmerSweep 4.2s infinite 1.8s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

@keyframes shimmerSweep {
  0% {
    left: -120%;
  }
  35%, 100% {
    left: 220%;
  }
}

/* 6. Destaque Magnético nas Fatias de Pizza */
.dashboard-pie-slice {
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), filter 0.25s ease, opacity 0.2s ease;
  transform-origin: 90px 90px;
}

.dashboard-pie-slice:hover, .dashboard-pie-slice:focus-visible {
  transform: scale(1.07);
  filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.45));
}

/* 7. Elevação Suave e Destaque nas Linhas de Tabelas */
.data-table tbody tr, .dashboard-executive-dre-table tbody tr {
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.data-table tbody tr:hover, .dashboard-executive-dre-table tbody tr:hover {
  background: rgba(2, 132, 199, 0.08) !important;
  transform: translateX(2px);
}

.table-row-reveal {
  animation: rowRevealAnim 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes rowRevealAnim {
  0% {
    opacity: 0;
    transform: translateY(5px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 8. Indicador Ativo do Menu Lateral Desliza em vez de "Saltar" */
.nav-item {
  border-left: 4px solid transparent;
}

/* 9. Elevação Sutil nos Cartões de Indicadores (mesma linguagem do kpi-card) */
.dashboard-metric-box {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
}

.dashboard-metric-box:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-shadow-hover);
}

/* 10. Scrollbar Fina e Alinhada ao Tema (Claro/Escuro) */
::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: var(--border-medium);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--brand-cyan-500);
  background-clip: content-box;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-medium) transparent;
}

/* 11. Seleção de Texto com a Identidade Visual da Marca */
::selection {
  background: rgba(2, 132, 199, 0.25);
  color: var(--text-heading);
}

/* 12. Pulsação Sutil no Selo "Novidade Openfrio" */
.digisat-promo-badge {
  animation: promoBadgeGlow 2.6s infinite ease-in-out;
}

@keyframes promoBadgeGlow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.55);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(255, 255, 255, 0);
  }
}

/* =============================================================================
   MÓDULO DE IMPORTAÇÃO DE PRODUTOS & SELETOR DE MODO DE CUSTO
   ============================================================================= */
.cost-mode-selector-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 14px 0 16px 0;
}

@media (max-width: 768px) {
  .cost-mode-selector-bar {
    grid-template-columns: 1fr;
  }
}

.cost-mode-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg-surface-subtle);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md, 8px);
  padding: 12px 16px;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.cost-mode-card:hover {
  border-color: var(--brand-cyan-500);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

.cost-mode-card.active {
  border-color: var(--brand-cyan-500);
  background: rgba(56, 189, 248, 0.08);
  box-shadow: 0 4px 16px rgba(56, 189, 248, 0.15);
}

.cost-mode-radio {
  margin-top: 2px;
}

.cost-mode-radio input[type="radio"] {
  cursor: pointer;
  width: 17px;
  height: 17px;
  accent-color: var(--brand-cyan-500);
}

.cost-mode-info {
  flex: 1;
}

.cost-mode-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.cost-mode-title-row strong {
  font-size: 0.92rem;
  color: var(--text-heading);
}

.cost-mode-badge {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--brand-cyan-500);
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  display: inline-block;
}

.cost-mode-desc {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin: 0 0 8px 0;
  line-height: 1.35;
}

.cost-mode-kpi {
  display: flex;
  gap: 16px;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-top: 1px dashed var(--border-color);
  padding-top: 6px;
}

.cost-mode-kpi strong {
  color: var(--text-heading);
  font-weight: 800;
}

.products-credit-config-bar {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm, 6px);
  padding: 8px 12px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.import-drop-zone {
  border: 2px dashed var(--brand-cyan-500);
  border-radius: var(--radius-md, 8px);
  padding: 28px;
  text-align: center;
  cursor: pointer;
  background: rgba(56, 189, 248, 0.04);
  transition: all 0.2s ease;
}

.import-drop-zone:hover,
.import-drop-zone.dragover {
  background: rgba(56, 189, 248, 0.12);
  border-color: var(--brand-cyan-600);
  transform: scale(1.01);
}



/* =============================================================================
   ALIQUOTAS POR ITEM/NOTA, ITEM MANUAL E PESQUISA NO CATALOGO (23/09/2026)
   So' tokens do tema (--bg-surface, --text-main, --border-*) - funciona igual no
   claro e no escuro, sem cor fixa.
   ============================================================================= */
.table-input.rate-input {
  min-width: 64px;
  width: 72px;
  padding: 2px 6px;
  text-align: right;
}

.data-table th.col-prod-rate,
.data-table td.col-prod-rate {
  width: 78px;
  text-align: right;
}

.data-table td.col-prod-credit {
  min-width: 118px;
}

.rate-fields-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.rate-fields-grid-5 {
  grid-template-columns: 1.4fr repeat(4, minmax(0, 1fr));
}

.form-hint {
  display: block;
  margin: 2px 0 12px;
  font-size: 0.76rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.picker-search-box {
  position: relative;
}

.picker-search-box > i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
  pointer-events: none;
}

.picker-search-box > input {
  padding-left: 34px;
}

.form-control.picker-select-list {
  height: auto;
  min-height: 150px;
  padding: 4px;
}

.form-control.picker-select-list option {
  padding: 6px 8px;
  border-radius: 4px;
}

.item-total-preview {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--brand-cyan-500);
  background: var(--bg-surface-subtle);
  color: var(--text-main);
  font-size: 0.83rem;
}

.item-total-preview-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.item-total-preview-row > span {
  color: var(--text-muted);
}

.item-total-preview-main {
  padding-top: 6px;
  border-top: 1px solid var(--border-light);
  font-weight: 700;
}

.item-total-preview-main > span {
  color: var(--text-main);
}

.item-total-preview-main > strong {
  font-size: 1.05rem;
  color: var(--text-heading);
}

.item-total-preview .text-success,
.text-success {
  color: var(--color-success);
}

@media (max-width: 640px) {
  .rate-fields-grid,
  .rate-fields-grid-5 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* =============================================================================
   IPI EM R$ NOS PAINEIS DE ITEM E IMPORTACAO DE PROPOSTA EM PDF (23/09/2026)
   ============================================================================= */
.rate-fields-grid-ipi {
  grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(0, 1.3fr);
}

.wp-item-id-grid {
  display: grid;
  grid-template-columns: 1fr 2.4fr 1.1fr;
  gap: 12px;
}

.proposal-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--brand-cyan-500);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.proposal-link-btn:hover {
  text-decoration: underline;
}

.proposal-import-dialog {
  max-width: 1040px;
  width: 96vw;
}

.proposal-import-status {
  margin-top: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.proposal-import-status:empty {
  display: none;
}

.proposal-import-status.is-ok {
  color: var(--color-success);
}

.proposal-import-status.is-error {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.proposal-preview-scroll {
  /* modal-body e' flex coluna com rolagem: sem isso a tabela encolhia a 2px no celular */
  flex-shrink: 0;
  max-height: 300px;
  overflow: auto;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
}

.proposal-preview-table {
  font-size: 0.78rem;
}

.proposal-preview-table td {
  vertical-align: top;
}

.proposal-preview-table tr.is-unselected td {
  opacity: 0.45;
}

.proposal-empty {
  padding: 22px;
  text-align: center;
  color: var(--text-muted);
}

.proposal-preview-summary {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 10px 0 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

.proposal-preview-summary:empty {
  display: none;
}

.proposal-check.is-ok {
  color: var(--color-success);
}

.proposal-check.is-warn {
  color: var(--color-warning);
}

.proposal-check.is-info {
  color: var(--text-muted);
}

#importProposalChecks .proposal-check,
.sales-proposal-checks .proposal-check {
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
}

.proposal-reader-line strong {
  color: var(--text-main);
}

/* "Ler como" da importacao de proposta: o usuario diz de qual fornecedor e' o PDF */
.import-reader-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-bottom: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px dashed var(--border-medium);
  background: var(--bg-surface);
}

.import-reader-bar label {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.import-reader-bar label i {
  color: var(--brand-cyan-500);
}

.import-reader-bar select {
  flex: 1 1 260px;
  max-width: 420px;
  font-size: 0.8rem;
  padding: 5px 8px;
}

.import-reader-hint {
  flex-basis: 100%;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Proposta de venda do grupo (preco de venda da obra) */
.sales-proposal-intro {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  margin-bottom: 14px;
  border-radius: 8px;
  background: rgba(255, 122, 0, 0.08);
  border: 1px solid rgba(255, 122, 0, 0.28);
  font-size: 0.82rem;
  color: var(--text-main);
}

.sales-proposal-intro i {
  color: var(--brand-orange-500);
  margin-top: 2px;
}

.sales-proposal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.sales-proposal-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background: var(--bg-surface-subtle);
  min-width: 0;
}

.sales-proposal-field span {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.sales-proposal-field strong {
  font-size: 0.95rem;
  color: var(--text-main);
  overflow-wrap: anywhere;
}

.sales-proposal-field small {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.sales-proposal-field.is-total {
  border-color: rgba(255, 122, 0, 0.45);
  background: rgba(255, 122, 0, 0.06);
}

.sales-proposal-field.is-total strong {
  font-size: 1.25rem;
  color: var(--brand-orange-600);
}

.sales-proposal-scope {
  margin-bottom: 12px;
  font-size: 0.8rem;
  color: var(--text-main);
}

.sales-proposal-scope ul {
  margin: 6px 0 0 18px;
  color: var(--text-muted);
}

.sales-proposal-installments {
  font-size: 0.8rem;
  margin-bottom: 10px;
}

.sales-proposal-installments tfoot td {
  font-weight: 800;
  border-top: 2px solid var(--border-medium);
}

.sales-proposal-checks {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}

/* Aviso de proposta fora dos modelos reconhecidos (e a confirmacao do sistema)
   sempre por cima do modal que os abriu. */
#unknownLayoutModal,
#customConfirmModal,
#unsavedChangesModal {
  z-index: 100001;
}

.unknown-layout-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.05rem;
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.unknown-layout-text {
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--text-main);
  margin: 0 0 10px;
}

.unknown-layout-summary {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-light);
}

.unknown-layout-summary:empty {
  display: none;
}

.unknown-layout-ack {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(217, 119, 6, 0.35);
  background: var(--color-warning-bg);
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-main);
  cursor: pointer;
}

.unknown-layout-ack input {
  width: 17px;
  height: 17px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--color-warning);
  cursor: pointer;
}

#unknownLayoutContinueBtn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.sales-proposal-target {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--brand-cyan-50);
  border: 1px solid var(--border-light);
  font-size: 0.8rem;
  color: var(--text-main);
}

.proposal-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 2.2fr;
  gap: 12px;
  align-items: start;
}

.proposal-options-checks {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 4px;
  font-size: 0.82rem;
  color: var(--text-main);
}

.proposal-options-checks label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
}

.proposal-options-checks input[type="checkbox"] {
  margin-top: 2px;
}

@media (max-width: 640px) {
  .rate-fields-grid-ipi,
  .proposal-options-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .proposal-options-checks {
    grid-column: 1 / -1;
  }

  .wp-item-id-grid {
    grid-template-columns: 1fr 1fr;
  }

  .wp-item-id-grid > .form-group:nth-child(2) {
    grid-column: 1 / -1;
    order: -1;
  }
}

/* ============================================================================= */
/* DESMEMBRAMENTO DE PRODUTOS VS SERVIÇOS & TAGS DE ESCOPO FISCAL (BUILD 15)      */
/* ============================================================================= */

.split-products-services-panel {
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--brand-cyan-500);
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.split-products-services-panel:focus-within {
  border-color: var(--brand-cyan-500);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

.split-bar-track {
  height: 6px;
  border-radius: 4px;
  background: var(--border-light);
  overflow: hidden;
  display: flex;
  margin-top: 8px;
}

[data-theme="dark"] .split-bar-track {
  background: rgba(255, 255, 255, 0.08);
}

.split-bar-prod {
  background: linear-gradient(90deg, #0284c7, #38bdf8);
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.split-bar-serv {
  background: linear-gradient(90deg, #9333ea, #c084fc);
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.split-total-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* PAINEL EXECUTIVO DE DESMEMBRAMENTO & GANHO TRIBUTÁRIO NO ESTUDO FISCAL */
.tax-study-split-card {
  position: relative;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--card-shadow);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tax-study-split-card:focus-within {
  border-color: var(--brand-cyan-500);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

.split-economy-glow {
  animation: pulseSplitEconomy 3s infinite ease-in-out;
}

@keyframes pulseSplitEconomy {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.25); }
  50% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}

.tax-scope-boxes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.tax-scope-card {
  padding: 14px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s ease;
}

.tax-scope-card.scope-products {
  border-top: 3px solid var(--seg-prod-primary);
}

.tax-scope-card.scope-services {
  border-top: 3px solid var(--seg-serv-primary);
}

.tax-scope-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.tax-scope-title {
  font-size: 0.82rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.02em;
}

.scope-products .tax-scope-title {
  color: var(--seg-prod-primary);
}

.scope-services .tax-scope-title {
  color: var(--seg-serv-primary);
}

.tax-scope-sub {
  font-size: 0.70rem;
  font-weight: 600;
  color: var(--text-muted);
}

.tax-tags-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tax-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 6px;
  border: 1px solid var(--border-medium, #cbd5e1);
  background: var(--bg-surface-subtle, #f8fafc);
  color: #1e293b;
  cursor: pointer;
  user-select: none;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.tax-tag-chip span,
.tax-tag-chip .tax-tag-name {
  color: #1e293b;
  font-weight: 700;
}

.tax-tag-chip:hover {
  border-color: var(--border-focus);
  background: var(--bg-surface);
  transform: translateY(-1px);
}

.tax-tag-chip:active {
  transform: translateY(0);
}

.tax-tag-rate-pill {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.08);
  color: #1e293b;
}

[data-theme="dark"] .tax-tag-rate-pill {
  background: rgba(0, 0, 0, 0.35);
  color: rgba(255, 255, 255, 0.85);
}

.tax-tag-check {
  font-size: 0.62rem;
  opacity: 0;
  transform: scale(0.6);
  transition: all 0.18s ease;
}

/* Fallback base para qualquer tax-tag-chip ativa */
.tax-tag-chip.active {
  background: linear-gradient(135deg, #0284c7, #0369a1) !important;
  border: 1px solid #0284c7 !important;
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
}

.tax-tag-chip.active span,
.tax-tag-chip.active .tax-tag-name {
  color: #ffffff !important;
}

.tax-tag-chip.active .tax-tag-rate-pill {
  background: rgba(0, 0, 0, 0.25) !important;
  color: #ffffff !important;
}

.tax-tag-chip.active .tax-tag-check {
  color: #ffffff !important;
  opacity: 1;
  transform: scale(1);
}

/* PRODUTOS: Azul vibrante */
.scope-products .tax-tag-chip.active,
#workModalTagsProducts .tax-tag-chip.active,
#dashboardTagsProducts .tax-tag-chip.active,
#studyTagsProducts .tax-tag-chip.active,
.tax-tag-chip.tag-prod.active {
  background: linear-gradient(135deg, #0284c7, #0369a1) !important;
  border: 1px solid #0284c7 !important;
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3) !important;
}

/* SERVIÇOS: Roxo vibrante */
.scope-services .tax-tag-chip.active,
#workModalTagsServices .tax-tag-chip.active,
#dashboardTagsServices .tax-tag-chip.active,
#studyTagsServices .tax-tag-chip.active,
.tax-tag-chip.tag-serv.active {
  background: linear-gradient(135deg, #9333ea, #7e22ce) !important;
  border: 1px solid #9333ea !important;
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(147, 51, 234, 0.3) !important;
}

[data-theme="dark"] .tax-tag-chip {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  color: #f1f5f9;
}

[data-theme="dark"] .tax-tag-chip span,
[data-theme="dark"] .tax-tag-chip .tax-tag-name {
  color: #f1f5f9;
}

[data-theme="dark"] .tax-tag-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* =============================================================================
   PAINEL ANALÍTICO DE SEGREGAÇÃO: PRODUTOS VS SERVIÇOS
   ============================================================================= */
.dashboard-segregation-analytics {
  margin-top: 14px;
  padding: 18px 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-top: 3px solid var(--brand-cyan-500);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: all 0.2s ease;
}

.segregation-analytics-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.segregation-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.segregation-icon-bubble {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--seg-prod-light);
  border: 1px solid var(--seg-prod-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--seg-prod-primary);
  flex-shrink: 0;
}

.segregation-heading {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: 0.01em;
}

.segregation-subheading {
  margin: 2px 0 0;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.segregation-badge-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.segregation-badge-pill.active-split {
  background: var(--color-success-bg);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: var(--color-success);
}

.segregation-badge-pill.single-mode {
  background: var(--seg-prod-light);
  border: 1px solid var(--seg-prod-border);
  color: var(--seg-prod-primary);
}

.segregation-grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.segregation-card {
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.segregation-card.seg-card-prod {
  border-top: 3px solid var(--seg-prod-primary);
  background: linear-gradient(180deg, var(--seg-prod-light) 0%, var(--bg-surface-subtle) 35%, var(--bg-surface) 100%);
}

.segregation-card.seg-card-serv {
  border-top: 3px solid var(--seg-serv-primary);
  background: linear-gradient(180deg, var(--seg-serv-light) 0%, var(--bg-surface-subtle) 35%, var(--bg-surface) 100%);
}

[data-theme="dark"] .segregation-card.seg-card-prod {
  background: linear-gradient(180deg, rgba(2, 132, 199, 0.12) 0%, var(--bg-surface-subtle) 40%, var(--bg-surface) 100%);
}

[data-theme="dark"] .segregation-card.seg-card-serv {
  background: linear-gradient(180deg, rgba(147, 51, 234, 0.12) 0%, var(--bg-surface-subtle) 40%, var(--bg-surface) 100%);
}

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

.seg-cat-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.seg-tag-pill {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  letter-spacing: 0.03em;
}

.seg-tag-pill.tag-prod {
  background: var(--seg-prod-light);
  color: var(--seg-prod-primary);
  border: 1px solid var(--seg-prod-border);
}

.seg-tag-pill.tag-serv {
  background: var(--seg-serv-light);
  color: var(--seg-serv-primary);
  border: 1px solid var(--seg-serv-border);
}

.seg-share-badge {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
}

.seg-amount-large {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.seg-card-prod .seg-amount-large {
  color: var(--seg-prod-primary);
}

.seg-card-serv .seg-amount-large {
  color: var(--seg-serv-primary);
}

.seg-progress-wrap {
  width: 100%;
  height: 6px;
  background: var(--border-light);
  border-radius: 999px;
  overflow: hidden;
}

[data-theme="dark"] .seg-progress-wrap {
  background: rgba(255, 255, 255, 0.08);
}

.seg-progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.seg-progress-fill.fill-prod {
  background: linear-gradient(90deg, #0284c7, #38bdf8);
}

.seg-progress-fill.fill-serv {
  background: linear-gradient(90deg, #9333ea, #c084fc);
}

.seg-tax-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.76rem;
}

.seg-tax-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
}

.seg-tax-line strong {
  color: var(--text-main);
  font-weight: 700;
}

.seg-tax-line.credit-line {
  color: var(--color-success);
}

.credit-highlight {
  color: var(--color-success);
  font-weight: 700;
}

.seg-tax-line.total-line {
  padding-top: 8px;
  border-top: 1px dashed var(--border-medium);
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-main);
}

.seg-tax-line.total-line strong {
  font-size: 0.88rem;
}

.seg-tax-prod-val {
  color: var(--seg-prod-primary) !important;
}

.seg-tax-serv-val {
  color: var(--seg-serv-primary) !important;
}

.seg-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-light);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.seg-card-footer strong {
  color: var(--text-main);
  font-size: 0.78rem;
  font-weight: 800;
}

[data-theme="dark"] .seg-card-footer {
  background: rgba(0, 0, 0, 0.25);
  border-color: rgba(255, 255, 255, 0.08);
}

.segregation-insight-card {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--seg-prod-light) 0%, var(--seg-serv-light) 100%);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

[data-theme="dark"] .segregation-insight-card {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.12) 0%, rgba(147, 51, 234, 0.1) 100%);
  border-color: rgba(56, 189, 248, 0.25);
}

.segregation-insight-content {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--text-main);
}

.segregation-insight-content i {
  font-size: 1.1rem;
}

.segregation-insight-highlight {
  font-weight: 800;
  color: var(--color-success);
}

/* =============================================================================
   SELETOR DE ESCOPO / MODO NO MODAL DE SALVAR PARÂMETROS FISCAIS
   ============================================================================= */
.tax-param-mode-selector {
  background: var(--bg-surface-subtle);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.btn-tax-mode {
  padding: 8px 12px;
  font-size: 0.76rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-tax-mode:hover {
  color: var(--text-main);
  background: var(--bg-surface);
}

.btn-tax-mode.active {
  background: var(--bg-surface);
  color: var(--brand-cyan-500);
  border-color: var(--border-medium);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.btn-tax-mode.mode-prod.active {
  color: var(--seg-prod-primary);
  border-color: var(--seg-prod-border);
}

.btn-tax-mode.mode-serv.active {
  color: var(--seg-serv-primary);
  border-color: var(--seg-serv-border);
}

.tax-param-section {
  transition: all 0.25s ease;
}

.tax-param-section.dimmed {
  opacity: 0.45;
  filter: grayscale(0.5);
}

.tax-param-section.highlighted {
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}

/* =============================================================================
   BARRA VISUAL INTERATIVA DE COMPOSIÇÃO DE PREÇO (CUSTO x IMPOSTO x LUCRO)
   ============================================================================= */
.price-composition-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
}

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

.price-composition-track {
  height: 28px;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  background: rgba(148, 163, 184, 0.15);
  border: 1px solid var(--border-light);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);
}

.price-comp-seg {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  color: #ffffff;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  cursor: pointer;
  user-select: none;
}

.price-comp-seg:hover {
  filter: brightness(1.15);
  z-index: 2;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.25);
}

.price-comp-seg.seg-materials {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
}

.price-comp-seg.seg-labor {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.price-comp-seg.seg-other {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.price-comp-seg.seg-taxes {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.price-comp-seg.seg-profit {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.price-composition-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
}

.comp-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.comp-legend-item:hover {
  background: var(--bg-surface-subtle);
  color: var(--text-main);
}

.comp-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.comp-dot.dot-materials { background: #0284c7; }
.comp-dot.dot-labor { background: #f59e0b; }
.comp-dot.dot-other { background: #8b5cf6; }
.comp-dot.dot-taxes { background: #ef4444; }
.comp-dot.dot-profit { background: #10b981; }

.comp-legend-name {
  font-weight: 600;
}

.comp-legend-item strong {
  color: var(--text-main);
  font-weight: 700;
  margin-left: auto;
}

.comp-legend-item small {
  color: var(--text-dim);
  font-size: 0.68rem;
}

/* =============================================================================
   RADAR FISCAL INTELIGENTE (DETECÇÃO DE OPORTUNIDADES & RECUPERAÇÃO DE CRÉDITOS)
   ============================================================================= */
.radar-fiscal-card {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, rgba(2, 132, 199, 0.05) 100%);
  border: 1.5px solid rgba(245, 158, 11, 0.35);
  border-left: 5px solid #f59e0b;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.08);
  animation: fadeIn 0.3s ease-out;
}

.radar-fiscal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}

.radar-fiscal-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 800;
  color: #b45309;
  letter-spacing: 0.5px;
}

.radar-fiscal-counter {
  font-size: 0.72rem;
  font-weight: 700;
  background: #f59e0b;
  color: #ffffff;
  padding: 2px 8px;
  border-radius: 999px;
}

.radar-fiscal-summary-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
}

@media (max-width: 768px) {
  .radar-fiscal-summary-row {
    grid-template-columns: 1fr;
  }
}

.radar-fiscal-list {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.radar-fiscal-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.77rem;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.65);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid rgba(245, 158, 11, 0.18);
}

.radar-fiscal-gain-box {
  background: #ffffff;
  border: 1.5px solid #10b981;
  border-radius: 8px;
  padding: 8px 14px;
  text-align: right;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.1);
}

.radar-fiscal-gain-box .gain-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #047857;
  display: block;
}

.radar-fiscal-gain-box .gain-val {
  font-size: 1.15rem;
  font-weight: 900;
  color: #059669;
  display: block;
}

.radar-fiscal-gain-box .gain-sub {
  font-size: 0.65rem;
  color: var(--text-muted);
  display: block;
}

/* Radar Fiscal com escolha de fornecedor e imposto (build 60) */
.radar-fiscal-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.radar-select-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
}

.radar-fiscal-choice {
  cursor: pointer;
  flex-wrap: wrap;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.radar-fiscal-choice input[type="checkbox"],
.radar-select-all input,
.radar-tax-chip input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--brand-orange-500);
  cursor: pointer;
  flex-shrink: 0;
}

.radar-fiscal-choice.is-checked {
  border-color: rgba(245, 158, 11, 0.55);
  background: rgba(255, 237, 213, 0.75);
}

.radar-choice-name {
  min-width: 0;
}

.radar-choice-missing {
  color: var(--text-muted);
}

.radar-choice-gain {
  margin-left: auto;
  font-weight: 800;
  color: var(--color-success);
  white-space: nowrap;
}

.radar-tax-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.radar-tax-row-label {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-main);
}

.radar-tax-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-medium);
  background: var(--bg-surface);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
}

.radar-tax-chip.is-on {
  border-color: rgba(245, 158, 11, 0.6);
  color: var(--text-main);
}

.radar-tax-rate {
  width: 46px;
  padding: 1px 4px;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  background: var(--bg-surface-subtle);
  color: var(--text-main);
  font-size: 0.76rem;
  font-weight: 700;
  text-align: right;
}

.radar-tax-rate:disabled {
  opacity: 0.5;
}

.radar-tax-chip small {
  font-size: 0.7rem;
}

.radar-fiscal-actions .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

[data-theme="dark"] .radar-fiscal-choice.is-checked {
  background: rgba(245, 158, 11, 0.12);
}

.radar-fiscal-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(245, 158, 11, 0.2);
  flex-wrap: wrap;
}

.radar-fiscal-compliance {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(16, 185, 129, 0.08);
  border: 1.5px solid rgba(16, 185, 129, 0.3);
  border-left: 4.5px solid #10b981;
  border-radius: var(--radius-md);
  padding: 10px 14px;
}

.compliance-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #059669;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.compliance-badge {
  font-size: 0.68rem;
  font-weight: 700;
  background: #10b981;
  color: #ffffff;
  padding: 2px 7px;
  border-radius: 4px;
}

.radar-fiscal-idle {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface-subtle);
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.radar-fiscal-idle-icon {
  font-size: 1rem;
  color: var(--brand-cyan-500);
}

.highlight-pulse {
  animation: pulseGlow 1.2s ease-in-out;
}

@keyframes pulseGlow {
  0% { box-shadow: 0 0 0 0 rgba(2, 132, 199, 0.6); }
  50% { box-shadow: 0 0 0 8px rgba(2, 132, 199, 0.25); }
  100% { box-shadow: 0 0 0 0 rgba(2, 132, 199, 0); }
}

/* =============================================================================
   TAGS E FILTROS DE FORNECEDOR EM CUSTO ITEM A ITEM (FICHA TÉCNICA)
   ============================================================================= */

.supplier-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.1;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  user-select: none;
  border: 1px solid transparent;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.supplier-tag:hover {
  transform: translateY(-1px);
  filter: brightness(0.92);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.supplier-tag.supplier-tag-active {
  box-shadow: 0 0 0 2px var(--brand-cyan-500) !important;
  font-weight: 800;
}

/* 1. Elgin: Azul Elgin Oficial */
.supplier-tag-elgin {
  background: #e0f2fe;
  color: #0284c7;
  border-color: #7dd3fc;
}

/* 2. MBP: Laranja / Âmbar MBP */
.supplier-tag-mbp {
  background: #ffedd5;
  color: #c2410c;
  border-color: #fdba74;
}

/* 3. Openfrio: Azul Marinho Corporativo & Ciano */
.supplier-tag-openfrio {
  background: #0a2540;
  color: #38bdf8;
  border-color: #0284c7;
}

/* 4. Tecnofrio: Verde Esmeralda Tecnofrio */
.supplier-tag-tecnofrio {
  background: #dcfce7;
  color: #15803d;
  border-color: #86efac;
}

/* 5. MS Tubos: Violeta */
.supplier-tag-mstubos {
  background: #f3e8ff;
  color: #7e22ce;
  border-color: #d8b4fe;
}

/* 6. Curva e Cobre: Bronze / Cobre */
.supplier-tag-curvaecobre {
  background: #fef3c7;
  color: #b45309;
  border-color: #fcd34d;
}

/* 7. LC Petry: Slate / Grafite */
.supplier-tag-lcpetry {
  background: #f1f5f9;
  color: #334155;
  border-color: #cbd5e1;
}

/* 8. Genérico / Outros */
.supplier-tag-generic {
  background: #f3f4f6;
  color: #4b5563;
  border-color: #d1d5db;
}

/* Dark Mode Tokens */
[data-theme="dark"] .supplier-tag-elgin {
  background: rgba(2, 132, 199, 0.22);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.45);
}

[data-theme="dark"] .supplier-tag-mbp {
  background: rgba(234, 88, 12, 0.22);
  color: #fb923c;
  border-color: rgba(251, 146, 60, 0.45);
}

[data-theme="dark"] .supplier-tag-openfrio {
  background: #0a2540;
  color: #38bdf8;
  border-color: #38bdf8;
}

[data-theme="dark"] .supplier-tag-tecnofrio {
  background: rgba(22, 163, 74, 0.22);
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.45);
}

[data-theme="dark"] .supplier-tag-mstubos {
  background: rgba(126, 34, 206, 0.22);
  color: #c084fc;
  border-color: rgba(192, 132, 252, 0.45);
}

[data-theme="dark"] .supplier-tag-curvaecobre {
  background: rgba(180, 83, 9, 0.22);
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.45);
}

[data-theme="dark"] .supplier-tag-lcpetry {
  background: rgba(51, 65, 85, 0.3);
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.45);
}

[data-theme="dark"] .supplier-tag-generic {
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  border-color: rgba(255, 255, 255, 0.18);
}

/* Impressão A4 */
@media print {
  .print-supplier-tag {
    font-size: 6.8pt;
    font-weight: 800;
    margin-right: 4px;
    border: none !important;
    background: transparent !important;
    color: #0a2540 !important;
    display: inline !important;
  }
}

/* Chips de Filtro Rápido no Topo da Tabela de Produtos */
.supp-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.supp-filter-chip:hover {
  background: var(--bg-surface-hover);
  border-color: var(--brand-cyan-500);
  color: var(--text-primary);
}

.supp-filter-chip.active {
  background: var(--brand-navy-900);
  color: #ffffff;
  border-color: var(--brand-navy-900);
  font-weight: 700;
}

[data-theme="dark"] .supp-filter-chip.active {
  background: var(--brand-cyan-600);
  color: #ffffff;
  border-color: var(--brand-cyan-500);
}

.supp-filter-chip .chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.supp-filter-chip .chip-count {
  font-size: 0.65rem;
  opacity: 0.85;
}

/* =============================================================================
   BOTÕES DE ATALHO RÁPIDO DE DESMEMBRAMENTO (ESTUDO TRIBUTÁRIO & DASHBOARD)
   ============================================================================= */
.split-presets-group {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}

.btn-xs {
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 6px;
  line-height: 1.4;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid var(--border-light, #e2e8f0);
  background: var(--bg-surface-subtle, #f8fafc);
  color: var(--text-main, #334155);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-xs:hover {
  background: rgba(16, 185, 129, 0.1);
  border-color: #10b981;
  color: #059669;
}

.btn-xs.btn-primary {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  border-color: #059669;
  box-shadow: 0 1px 3px rgba(16, 185, 129, 0.25);
}

.btn-xs.btn-primary:hover {
  background: linear-gradient(135deg, #059669, #047857);
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.35);
}

[data-theme="dark"] .btn-xs {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
}

[data-theme="dark"] .btn-xs:hover {
  background: rgba(16, 185, 129, 0.15);
  border-color: #10b981;
  color: #34d399;
}

/* =============================================================================
   DETALHES DE CÁLCULO E FÓRMULAS PEDAGÓGICAS (SEGREGAÇÃO DE TRIBUTOS)
   ============================================================================= */
.seg-calc-detail {
  font-size: 0.76rem !important;
  color: #475569 !important;
  margin-top: 2px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.35;
}

[data-theme="dark"] .seg-calc-detail {
  color: #94a3b8 !important;
}

.seg-calc-detail.text-success {
  color: #059669 !important;
  font-weight: 700;
}

[data-theme="dark"] .seg-calc-detail.text-success {
  color: #34d399 !important;
}

.seg-tax-line.seg-subtotal-icms {
  background: rgba(2, 132, 199, 0.08);
  padding: 6px 10px;
  border-radius: 6px;
  border-left: 3px solid #0284c7;
  margin: 3px 0 6px;
}

.seg-tax-line.seg-base-pis {
  background: rgba(245, 158, 11, 0.08);
  padding: 6px 10px;
  border-radius: 6px;
  border-left: 3px solid #f59e0b;
  margin: 6px 0 3px;
}

.seg-tax-line.seg-subtotal-pc {
  background: rgba(245, 158, 11, 0.08);
  padding: 6px 10px;
  border-radius: 6px;
  border-left: 3px solid #f59e0b;
  margin: 3px 0 6px;
}

.seg-tax-line.seg-base-serv {
  background: rgba(139, 92, 246, 0.08);
  padding: 6px 10px;
  border-radius: 6px;
  border-left: 3px solid #8b5cf6;
  margin: 2px 0 6px;
}

[data-theme="dark"] .seg-tax-line.seg-subtotal-icms {
  background: rgba(2, 132, 199, 0.15);
}

[data-theme="dark"] .seg-tax-line.seg-base-pis,
[data-theme="dark"] .seg-tax-line.seg-subtotal-pc {
  background: rgba(245, 158, 11, 0.15);
}

[data-theme="dark"] .seg-tax-line.seg-base-serv {
  background: rgba(139, 92, 246, 0.15);
}

.seg-compare-breakdown-box {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  width: 100%;
  margin-top: 10px;
}

.seg-compare-col {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text-main);
}

.seg-compare-col.col-unseg {
  background: rgba(239, 68, 68, 0.05);
  border-color: rgba(239, 68, 68, 0.25);
}

.seg-compare-col.col-actual {
  background: rgba(139, 92, 246, 0.05);
  border-color: rgba(139, 92, 246, 0.25);
}

.seg-compare-col.col-economy {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.35);
}

.seg-compare-col .col-title {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.seg-compare-col.col-unseg .col-title { color: #ef4444; }
.seg-compare-col.col-actual .col-title { color: #8b5cf6; }
.seg-compare-col.col-economy .col-title { color: #10b981; }

.seg-compare-col .col-calc {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.seg-compare-col .col-val {
  font-size: 1.1rem;
  font-weight: 900;
  margin-top: auto;
  padding-top: 4px;
}

.seg-compare-col.col-unseg .col-val { color: var(--text-main); }
.seg-compare-col.col-actual .col-val { color: #8b5cf6; }
.seg-compare-col.col-economy .col-val { color: #10b981; }

[data-theme="dark"] .seg-compare-col.col-unseg {
  background: rgba(239, 68, 68, 0.10);
  border-color: rgba(239, 68, 68, 0.35);
}

[data-theme="dark"] .seg-compare-col.col-actual {
  background: rgba(139, 92, 246, 0.10);
  border-color: rgba(139, 92, 246, 0.35);
}

[data-theme="dark"] .seg-compare-col.col-economy {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.40);
}

/* =============================================================================
   SISTEMA DE CONTRASTE & CORES UNIVERSAL (MODO CLARO E ESCURO)
   GARANTIA DE VISIBILIDADE COMPLETA EM TODAS AS TELAS
   ============================================================================= */
.main-wrapper,
.content-area,
.tab-panel,
.surface-card,
.modal-body,
.digisat-window {
  color: var(--text-main);
}

/* DEMONSTRATIVO DE APURAÇÃO & CARDS FISCAIS */
.tax-demonstrative-box,
.tax-op-block,
.tax-taxes-grid,
.tax-card-icms,
.tax-card-pc,
.tax-card-iss,
.tax-card-sn,
.tax-card-faturamento-total,
.tax-card-ir-csll,
.tax-net-result-box,
.tax-net-real-memorial,
.tax-study-split-card {
  color: var(--text-main);
}

.tax-card-icms span,
.tax-card-pc span,
.tax-card-iss span,
.tax-card-sn span,
.tax-op-block span,
.tax-card-ir-csll span,
.tax-study-split-card span {
  color: var(--text-main);
}

/* Rótulos secundários e percentuais em tom de apoio */
.tax-card-icms small,
.tax-card-pc small,
.tax-card-iss small,
.tax-card-sn small,
.tax-op-block small,
.tax-card-ir-csll small,
.tax-card-icms [id^="taxPct"],
.tax-card-pc [id^="taxPct"],
.tax-card-iss [id^="taxPct"],
.tax-card-sn [id^="taxPct"],
.tax-op-block [id^="taxPct"],
.tax-card-ir-csll [id^="taxPct"] {
  color: var(--text-muted) !important;
}

/* Linhas secundárias identadas com seta (↳) */
.tax-card-icms div[style*="padding-left"],
.tax-card-pc div[style*="padding-left"],
.tax-card-iss div[style*="padding-left"],
.tax-card-sn div[style*="padding-left"] {
  color: var(--text-muted);
}

.tax-card-icms div[style*="padding-left"] span,
.tax-card-pc div[style*="padding-left"] span,
.tax-card-iss div[style*="padding-left"] span,
.tax-card-sn div[style*="padding-left"] span {
  color: var(--text-muted);
}

/* Destaques numéricos oficiais dentro dos blocos fiscais */
.tax-card-icms #taxCardBaseIcms,
.tax-card-icms #taxCardInputIcms {
  color: #3b82f6 !important;
}

.tax-card-pc #taxCardBasePisProd {
  color: var(--brand-cyan-500) !important;
}
.tax-card-pc #taxCardInputPc,
.tax-card-pc #taxCardInputPis,
.tax-card-pc #taxCardInputCofins {
  color: #10b981 !important;
}

.tax-card-iss #taxCardBaseIss,
.tax-card-iss #taxCardBasePisServ {
  color: #8b5cf6 !important;
}

.tax-card-sn #taxCardBaseSn {
  color: #f97316 !important;
}

/* Valores a debitar em vermelho */
.tax-card-icms [style*="color: var(--color-danger)"],
.tax-card-pc [style*="color: var(--color-danger)"],
.tax-card-iss [style*="color: var(--color-danger)"],
.tax-card-sn [style*="color: var(--color-danger)"],
.tax-card-ir-csll [style*="color: var(--color-danger)"],
.tax-card-faturamento-total [style*="color: var(--color-danger)"] {
  color: var(--color-danger) !important;
}

/* Inputs gerais e monetários */
.form-input {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.9rem;
  transition: all 0.2s ease;
}
.form-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.18);
}
.form-input[readonly], .form-input[disabled] {
  background: var(--bg-surface-subtle);
  color: var(--text-muted);
}

/* =============================================================================
   RELATÓRIOS SINTETIZADOS (#printReport, body.print-mode-report)
   Documento próprio de impressão montado por renderReportHtml() (app.js): só ele
   vai pro papel/PDF, com página nomeada "rpt" (margens em toda folha + número de
   página). Independente das regras print-mode-* antigas, que imprimiam a tela.
   ============================================================================= */
#printReport {
  display: none;
}

@page rpt {
  size: A4 portrait;
  margin: 10mm 11mm 12mm 11mm;

  /* Caixas de margem declaradas substituem o cabeçalho/rodapé padrão do navegador
     (data, título da aba, URL) quando "Cabeçalhos e rodapés" está ligado. */
  @top-left {
    content: "";
  }

  @top-center {
    content: "";
  }

  @top-right {
    content: "";
  }

  @bottom-left {
    content: "Grupo OpenFrio · Tecnofrio & CMR";
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    font-size: 6.5pt;
    color: #94a3b8;
  }

  @bottom-right {
    content: "Página " counter(page) " de " counter(pages);
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    font-size: 6.5pt;
    color: #64748b;
  }
}

@media print {
  html:has(> body.print-mode-report),
  body.print-mode-report {
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
  }

  body.print-mode-report > *:not(#printReport) {
    display: none !important;
  }

  body.print-mode-report #printReport {
    display: block !important;
    page: rpt;
  }
}

#printReport .rpt {
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  font-size: 8.2pt;
  line-height: 1.35;
  color: #0f172a;
  background: #ffffff;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

#printReport .rpt * {
  box-sizing: border-box;
}

#printReport .rpt-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding-bottom: 5px;
  border-bottom: 2px solid #0a2540;
}

#printReport .rpt-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

#printReport .rpt-logo {
  width: 32mm;
  height: 10mm;
  padding: 1.2mm 2.5mm;
  border-radius: 4px;
  background: #0a2540;
  display: flex;
  align-items: center;
}

#printReport .rpt-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#printReport .rpt-org {
  font-size: 8.6pt;
  font-weight: 800;
  color: #0a2540;
  letter-spacing: 0.01em;
}

#printReport .rpt-org-sub {
  font-size: 6.8pt;
  color: #64748b;
}

#printReport .rpt-title-box {
  flex-shrink: 0;
  text-align: right;
}

#printReport .rpt-org,
#printReport .rpt-org-sub,
#printReport .rpt-title,
#printReport .rpt-meta {
  white-space: nowrap;
}

#printReport .rpt-title {
  font-size: 10.5pt;
  font-weight: 800;
  color: #0a2540;
  letter-spacing: 0.02em;
}

#printReport .rpt-meta {
  font-size: 6.8pt;
  color: #64748b;
  margin-top: 1px;
}

#printReport .rpt-ident {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  padding: 4px 0;
  font-size: 7.6pt;
  color: #334155;
  border-bottom: 1px solid #e2e8f0;
}

#printReport .rpt-ident b {
  color: #0a2540;
}

#printReport .rpt-taxline {
  margin: 5px 0 0;
  padding: 3px 7px;
  font-size: 7.3pt;
  color: #1e293b;
  background: #f1f5f9;
  border-left: 3px solid #0891b2;
}

#printReport .rpt-taxline b {
  color: #0a2540;
  margin-right: 6px;
}

#printReport .rpt-kpis {
  display: grid;
  gap: 5px;
  margin: 6px 0 2px;
}

#printReport .rpt-kpi {
  padding: 4px 6px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
}

#printReport .rpt-kpi span {
  display: block;
  font-size: 6.4pt;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

#printReport .rpt-kpi strong {
  display: block;
  font-size: 10pt;
  font-weight: 800;
  color: #0a2540;
  font-variant-numeric: tabular-nums;
}

#printReport .rpt-kpi small {
  display: block;
  font-size: 6.6pt;
  color: #64748b;
}

#printReport .rpt-kpi.is-good strong {
  color: #15803d;
}

#printReport .rpt-kpi.is-bad strong {
  color: #b91c1c;
}

#printReport .rpt-section {
  margin-top: 8px;
}

#printReport .rpt-h {
  margin: 0 0 3px;
  padding-bottom: 2px;
  font-size: 7.6pt;
  font-weight: 800;
  color: #0a2540;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid #cbd5e1;
  break-after: avoid;
}

#printReport .rpt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 7.5pt;
}

#printReport .rpt-table thead {
  display: table-header-group;
}

#printReport .rpt-table th {
  padding: 2.5px 5px;
  font-size: 6.8pt;
  font-weight: 700;
  text-align: left;
  color: #ffffff;
  background: #0a2540;
}

#printReport .rpt-table td {
  padding: 2px 5px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
}

#printReport .rpt-table tr {
  break-inside: avoid;
}

#printReport .rpt-table .num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

#printReport .rpt-table .nw {
  white-space: nowrap;
}

#printReport .rpt-table tr.rpt-sub td {
  color: #64748b;
}

#printReport .rpt-table tr.rpt-strong td {
  font-weight: 700;
  background: #f8fafc;
}

#printReport .rpt-table tr.rpt-total td {
  font-weight: 800;
  color: #0a2540;
  background: #eef2f7;
  border-top: 1.5px solid #0a2540;
  border-bottom: none;
}

#printReport .rpt-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: start;
}

#printReport .rpt-columns > div > .rpt-section:first-child {
  margin-top: 8px;
}

#printReport .rpt-note {
  margin: 3px 0 0;
  font-size: 6.8pt;
  color: #64748b;
}

#printReport .rpt-p {
  margin: 8px 0 0;
  font-size: 8pt;
  color: #334155;
}

#printReport .rpt-bullets {
  margin: 0;
  padding-left: 14px;
  font-size: 7.4pt;
  color: #334155;
}

#printReport .rpt-bullets li {
  margin: 1px 0;
}

#printReport .rpt-bar {
  display: flex;
  height: 9px;
  border-radius: 3px;
  overflow: hidden;
  background: #e2e8f0;
}

#printReport .rpt-bar span {
  display: block;
  height: 100%;
}

#printReport .rpt-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  margin-top: 3px;
  font-size: 7pt;
  color: #334155;
}

#printReport .rpt-legend i {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 3px;
  border-radius: 2px;
  vertical-align: middle;
}

#printReport .rpt-sign {
  display: flex;
  gap: 28px;
  margin-top: 30px;
  break-inside: avoid;
}

#printReport .rpt-sign > div {
  flex: 1;
  padding-top: 4px;
  font-size: 7.4pt;
  text-align: center;
  color: #334155;
  border-top: 1px solid #334155;
}

#printReport .rpt-sign small {
  color: #64748b;
}

#printReport .rpt-foot {
  margin-top: 10px;
  padding-top: 3px;
  font-size: 6.4pt;
  color: #94a3b8;
  border-top: 1px solid #e2e8f0;
}

/* ---- Análise Estendida (build 64): gráficos, diagnóstico Produtos x Serviços e
   indicadores do modal do Dashboard, desenhados para o papel (SVG estático). ---- */
#printReport .rpt-kpi.is-warn strong {
  color: #c2410c;
}

#printReport .rpt-kpi.is-cyan strong {
  color: #0e7490;
}

#printReport .rpt-extended .rpt-kpi {
  border-left: 3px solid #0a2540;
}

#printReport .rpt-extended .rpt-kpi.is-good {
  border-left-color: #16a34a;
}

#printReport .rpt-extended .rpt-kpi.is-bad {
  border-left-color: #dc2626;
}

#printReport .rpt-extended .rpt-kpi.is-warn {
  border-left-color: #f97316;
}

#printReport .rpt-extended .rpt-kpi.is-cyan {
  border-left-color: #0891b2;
}

#printReport .rpt-h small {
  font-size: 6.4pt;
  font-weight: 600;
  color: #64748b;
  text-transform: none;
  letter-spacing: 0;
}

#printReport .rpt-extended .rpt-columns {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
}

#printReport .rpt-extended .rpt-columns > div {
  display: flex;
}

#printReport .rpt-extended .rpt-columns > div > .rpt-chart {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

#printReport .rpt-keep {
  break-inside: avoid;
}

/* Romaneio Analitico (conferencia): as tabelas de fornecedor repetem as mesmas colunas, com a mesma largura em todas */
#printReport .rpt-table.rpt-conf-items {
  table-layout: fixed;
}

#printReport .rpt-table.rpt-conf-items th:nth-child(1) { width: 8mm; }
#printReport .rpt-table.rpt-conf-items th:nth-child(2) { width: 21mm; }
#printReport .rpt-table.rpt-conf-items th:nth-child(4) { width: 15mm; }
#printReport .rpt-table.rpt-conf-items th:nth-child(5) { width: 10mm; }
#printReport .rpt-table.rpt-conf-items th:nth-child(6) { width: 24mm; }
#printReport .rpt-table.rpt-conf-items th:nth-child(7) { width: 14mm; }
#printReport .rpt-table.rpt-conf-items th:nth-child(8) { width: 26mm; }

#printReport .rpt-table.rpt-conf-items td:nth-child(2),
#printReport .rpt-table.rpt-conf-items td:nth-child(3) {
  overflow-wrap: anywhere;
}

#printReport .rpt-chart {
  min-width: 0;
  padding: 5px 7px 6px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  break-inside: avoid;
}

#printReport .rpt-chart .rpt-h {
  border-bottom: none;
  margin-bottom: 4px;
}

#printReport .rpt-chart-svg {
  display: block;
  width: 100%;
  height: auto;
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
}

#printReport .rpt-chart-pie-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

#printReport .rpt-chart-pie-wrap .rpt-chart-pie {
  width: 29mm;
  flex-shrink: 0;
}

#printReport .rpt-chart-pie-wrap .rpt-chart-legend {
  flex: 1;
  min-width: 0;
}

#printReport .rpt-svg-center-label {
  font-size: 7px;
  font-weight: 800;
  fill: #475569;
  letter-spacing: 0.04em;
}

#printReport .rpt-svg-center-value {
  font-size: 10px;
  font-weight: 800;
  fill: #0a2540;
}

#printReport .rpt-svg-val {
  font-size: 7.6px;
  font-weight: 700;
  fill: #0f172a;
}

#printReport .rpt-svg-lbl {
  font-size: 6.8px;
  font-weight: 600;
  fill: #334155;
}

#printReport .rpt-svg-lbl-left {
  font-size: 7.4px;
  font-weight: 600;
  fill: #334155;
}

#printReport .rpt-svg-sub {
  font-size: 6.2px;
  font-weight: 500;
  fill: #64748b;
}

#printReport .rpt-chart-legend {
  width: 100%;
  border-collapse: collapse;
  font-size: 6.9pt;
}

#printReport .rpt-chart-legend td {
  padding: 1.6px 2px;
  border-bottom: 1px solid #f1f5f9;
  white-space: nowrap;
}

#printReport .rpt-chart-legend td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#printReport .rpt-chart-legend i {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 4px;
  border-radius: 50%;
  vertical-align: middle;
}

#printReport .rpt-muted {
  color: #64748b;
}

#printReport .rpt-chart-total {
  display: flex;
  justify-content: space-between;
  margin-top: 3px;
  padding-top: 2px;
  font-size: 7pt;
  color: #475569;
  border-top: 1px dashed #cbd5e1;
}

#printReport .rpt-chart-total strong {
  color: #0a2540;
}

#printReport .rpt-seg-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  break-inside: avoid;
}

#printReport .rpt-seg {
  padding: 5px 7px 6px;
  border: 1px solid #bae6fd;
  border-top: 3px solid #0284c7;
  border-radius: 6px;
  background: #f8fcff;
}

#printReport .rpt-seg-serv {
  border-color: #ddd6fe;
  border-top-color: #7c3aed;
  background: #fbfaff;
}

#printReport .rpt-seg-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

#printReport .rpt-seg-head span {
  font-size: 7pt;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #0369a1;
}

#printReport .rpt-seg-serv .rpt-seg-head span {
  color: #6d28d9;
}

#printReport .rpt-seg-head strong {
  font-size: 10.5pt;
  font-weight: 800;
  color: #0369a1;
  font-variant-numeric: tabular-nums;
}

#printReport .rpt-seg-serv .rpt-seg-head strong {
  color: #6d28d9;
}

#printReport .rpt-seg-share {
  font-size: 6.6pt;
  color: #64748b;
}

#printReport .rpt-seg-track {
  height: 4px;
  margin: 2px 0 4px;
  border-radius: 2px;
  background: #e2e8f0;
  overflow: hidden;
}

#printReport .rpt-seg-track i {
  display: block;
  height: 100%;
  background: #0284c7;
}

#printReport .rpt-seg-serv .rpt-seg-track i {
  background: #7c3aed;
}

#printReport .rpt-seg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 7.1pt;
}

#printReport .rpt-seg-table th {
  padding: 1.5px 3px;
  font-size: 6.3pt;
  font-weight: 700;
  text-align: left;
  color: #475569;
  border-bottom: 1px solid #cbd5e1;
}

#printReport .rpt-seg-table td {
  padding: 1.8px 3px;
  border-bottom: 1px solid #eef2f7;
  vertical-align: top;
}

#printReport .rpt-seg-table .num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

#printReport .rpt-seg-table small {
  display: block;
  font-size: 6pt;
  color: #64748b;
}

#printReport .rpt-seg-table .rpt-credit {
  color: #15803d;
}

#printReport .rpt-seg-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 7pt;
  color: #334155;
}

#printReport .rpt-seg-foot b {
  color: #0a2540;
}

#printReport .rpt-metrics {
  display: grid;
  gap: 5px;
  break-inside: avoid;
}

#printReport .rpt-metric {
  padding: 4px 6px;
  border: 1px solid #e2e8f0;
  border-left: 3px solid #0a2540;
  border-radius: 4px;
}

#printReport .rpt-metric span {
  display: block;
  font-size: 6.2pt;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

#printReport .rpt-metric strong {
  display: block;
  font-size: 9.6pt;
  font-weight: 800;
  color: #0a2540;
  font-variant-numeric: tabular-nums;
}

#printReport .rpt-metric small {
  display: block;
  font-size: 6.2pt;
  color: #64748b;
}

#printReport .rpt-metric.is-bad { border-left-color: #dc2626; }
#printReport .rpt-metric.is-bad strong { color: #b91c1c; }
#printReport .rpt-metric.is-good { border-left-color: #16a34a; }
#printReport .rpt-metric.is-good strong { color: #15803d; }
#printReport .rpt-metric.is-warn { border-left-color: #f97316; }
#printReport .rpt-metric.is-warn strong { color: #c2410c; }
#printReport .rpt-metric.is-info { border-left-color: #3b82f6; }
#printReport .rpt-metric.is-info strong { color: #1d4ed8; }
#printReport .rpt-metric.is-cyan { border-left-color: #0891b2; }
#printReport .rpt-metric.is-cyan strong { color: #0e7490; }

/* =============================================================================
   FUNDO COM FORMA (build 58) - "o fundo esta muito vazio, sem graca"
   Cristais de gelo em traco fino e ondas de ar frio nas cores da marca, parados
   (sem animacao: zero custo ao rolar - o desenho fica na camada do proprio
   painel, pintado uma vez). Continua discreto para nao competir com os numeros.
   ============================================================================= */
.content-area {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cpath d='M100 100L100 8M100 66L84.7 53.1M100 66L115.3 53.1M100 42L87.7 31.7M100 42L112.3 31.7M100 24L92.3 17.6M100 24L107.7 17.6M100 100L179.7 54M129.4 83L132.9 63.3M129.4 83L148.2 89.8M150.2 71L153 55.2M150.2 71L165.3 76.5M165.8 62L167.6 52.2M165.8 62L175.2 65.4M100 100L179.7 146M129.4 117L148.2 110.2M129.4 117L132.9 136.7M150.2 129L165.3 123.5M150.2 129L153 144.8M165.8 138L175.2 134.6M165.8 138L167.6 147.8M100 100L100 192M100 134L115.3 146.9M100 134L84.7 146.9M100 158L112.3 168.3M100 158L87.7 168.3M100 176L107.7 182.4M100 176L92.3 182.4M100 100L20.3 146M70.6 117L67.1 136.7M70.6 117L51.8 110.2M49.8 129L47 144.8M49.8 129L34.7 123.5M34.2 138L32.4 147.8M34.2 138L24.8 134.6M100 100L20.3 54M70.6 83L51.8 89.8M70.6 83L67.1 63.3M49.8 71L34.7 76.5M49.8 71L47 55.2M34.2 62L24.8 65.4M34.2 62L32.4 52.2M110 82.7L120 100L110 117.3L90 117.3L80 100L90 82.7Z' fill='none' stroke='rgba(10,37,64,0.10)' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3Ccircle cx='100' cy='100' r='97' fill='none' stroke='rgba(2,132,199,0.07)' stroke-width='0.8' stroke-dasharray='2 5'/%3E%3C/svg%3E") right 4% bottom 96px / 340px 340px no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cpath d='M100 100L100 8M100 66L84.7 53.1M100 66L115.3 53.1M100 42L87.7 31.7M100 42L112.3 31.7M100 100L179.7 54M129.4 83L132.9 63.3M129.4 83L148.2 89.8M150.2 71L153 55.2M150.2 71L165.3 76.5M100 100L179.7 146M129.4 117L148.2 110.2M129.4 117L132.9 136.7M150.2 129L165.3 123.5M150.2 129L153 144.8M100 100L100 192M100 134L115.3 146.9M100 134L84.7 146.9M100 158L112.3 168.3M100 158L87.7 168.3M100 100L20.3 146M70.6 117L67.1 136.7M70.6 117L51.8 110.2M49.8 129L47 144.8M49.8 129L34.7 123.5M100 100L20.3 54M70.6 83L51.8 89.8M70.6 83L67.1 63.3M49.8 71L34.7 76.5M49.8 71L47 55.2' fill='none' stroke='rgba(2,132,199,0.12)' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") left 2.5% bottom 190px / 150px 150px no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 240' preserveAspectRatio='none'%3E%3Cpath d='M0 150C240 110 480 190 720 150S1200 110 1440 150V240H0Z' fill='rgba(2,132,199,0.07)'/%3E%3Cpath d='M0 186C300 150 600 222 900 186S1260 160 1440 192V240H0Z' fill='rgba(10,37,64,0.06)'/%3E%3Cpath d='M0 126C260 94 520 168 760 130S1180 94 1440 122' fill='none' stroke='rgba(255,122,0,0.28)' stroke-width='1.5' vector-effect='non-scaling-stroke'/%3E%3Cpath d='M0 112C300 84 560 150 820 116S1200 84 1440 108' fill='none' stroke='rgba(2,132,199,0.18)' stroke-width='1' stroke-dasharray='3 7' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E") center bottom / 100% 230px no-repeat,
    linear-gradient(rgba(2, 132, 199, 0.035) 1px, transparent 1px) 0 0 / 34px 34px,
    linear-gradient(90deg, rgba(2, 132, 199, 0.035) 1px, transparent 1px) 0 0 / 34px 34px,
    radial-gradient(circle at 85% 8%, rgba(255, 122, 0, 0.10), transparent 28%),
    radial-gradient(circle at 12% 78%, rgba(2, 132, 199, 0.09), transparent 32%),
    var(--bg-app);
}

[data-theme="dark"] .content-area {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cpath d='M100 100L100 8M100 66L84.7 53.1M100 66L115.3 53.1M100 42L87.7 31.7M100 42L112.3 31.7M100 24L92.3 17.6M100 24L107.7 17.6M100 100L179.7 54M129.4 83L132.9 63.3M129.4 83L148.2 89.8M150.2 71L153 55.2M150.2 71L165.3 76.5M165.8 62L167.6 52.2M165.8 62L175.2 65.4M100 100L179.7 146M129.4 117L148.2 110.2M129.4 117L132.9 136.7M150.2 129L165.3 123.5M150.2 129L153 144.8M165.8 138L175.2 134.6M165.8 138L167.6 147.8M100 100L100 192M100 134L115.3 146.9M100 134L84.7 146.9M100 158L112.3 168.3M100 158L87.7 168.3M100 176L107.7 182.4M100 176L92.3 182.4M100 100L20.3 146M70.6 117L67.1 136.7M70.6 117L51.8 110.2M49.8 129L47 144.8M49.8 129L34.7 123.5M34.2 138L32.4 147.8M34.2 138L24.8 134.6M100 100L20.3 54M70.6 83L51.8 89.8M70.6 83L67.1 63.3M49.8 71L34.7 76.5M49.8 71L47 55.2M34.2 62L24.8 65.4M34.2 62L32.4 52.2M110 82.7L120 100L110 117.3L90 117.3L80 100L90 82.7Z' fill='none' stroke='rgba(125,211,252,0.10)' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3Ccircle cx='100' cy='100' r='97' fill='none' stroke='rgba(56,189,248,0.08)' stroke-width='0.8' stroke-dasharray='2 5'/%3E%3C/svg%3E") right 4% bottom 96px / 340px 340px no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cpath d='M100 100L100 8M100 66L84.7 53.1M100 66L115.3 53.1M100 42L87.7 31.7M100 42L112.3 31.7M100 100L179.7 54M129.4 83L132.9 63.3M129.4 83L148.2 89.8M150.2 71L153 55.2M150.2 71L165.3 76.5M100 100L179.7 146M129.4 117L148.2 110.2M129.4 117L132.9 136.7M150.2 129L165.3 123.5M150.2 129L153 144.8M100 100L100 192M100 134L115.3 146.9M100 134L84.7 146.9M100 158L112.3 168.3M100 158L87.7 168.3M100 100L20.3 146M70.6 117L67.1 136.7M70.6 117L51.8 110.2M49.8 129L47 144.8M49.8 129L34.7 123.5M100 100L20.3 54M70.6 83L51.8 89.8M70.6 83L67.1 63.3M49.8 71L34.7 76.5M49.8 71L47 55.2' fill='none' stroke='rgba(56,189,248,0.12)' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") left 2.5% bottom 190px / 150px 150px no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 240' preserveAspectRatio='none'%3E%3Cpath d='M0 150C240 110 480 190 720 150S1200 110 1440 150V240H0Z' fill='rgba(56,189,248,0.06)'/%3E%3Cpath d='M0 186C300 150 600 222 900 186S1260 160 1440 192V240H0Z' fill='rgba(2,132,199,0.08)'/%3E%3Cpath d='M0 126C260 94 520 168 760 130S1180 94 1440 122' fill='none' stroke='rgba(255,122,0,0.24)' stroke-width='1.5' vector-effect='non-scaling-stroke'/%3E%3Cpath d='M0 112C300 84 560 150 820 116S1200 84 1440 108' fill='none' stroke='rgba(56,189,248,0.18)' stroke-width='1' stroke-dasharray='3 7' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E") center bottom / 100% 230px no-repeat,
    linear-gradient(rgba(56, 189, 248, 0.035) 1px, transparent 1px) 0 0 / 34px 34px,
    linear-gradient(90deg, rgba(56, 189, 248, 0.035) 1px, transparent 1px) 0 0 / 34px 34px,
    radial-gradient(circle at 85% 8%, rgba(255, 122, 0, 0.10), transparent 28%),
    radial-gradient(circle at 12% 78%, rgba(2, 132, 199, 0.12), transparent 32%),
    var(--bg-app);
}

@media (max-width: 860px) {
  .content-area,
  [data-theme="dark"] .content-area {
    background-size: 190px 190px, 90px 90px, 100% 150px, 34px 34px, 34px 34px, auto, auto, auto;
    background-position: right 3% bottom 60px, left 3% bottom 130px, center bottom, 0 0, 0 0, 0 0, 0 0, 0 0;
  }
}

/* =============================================================================
   DESEMPENHO (build 58) - computador fraco navegando liso, sem tirar animacao
   ============================================================================= */
/* Desfoque de vidro atras de fundo praticamente opaco (95%) ou atras de um painel
   solido nao aparece na tela, mas obriga a placa de video a refazer o desfoque a
   cada quadro. Sai onde era invisivel. */
.sidebar,
.topbar,
.topbar-nav-btn,
.dashboard-modal-dialog {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* Menu lateral: ao passar o mouse ele abre POR CIMA do conteudo (a margem
   negativa anda junto com a largura). Antes ele empurrava a tela inteira e o
   navegador remontava todas as tabelas a cada quadro da animacao de 0,25s. */
@media (min-width: 861px) {
  .sidebar {
    position: relative;
    transition: width 0.25s ease, margin-right 0.25s ease, box-shadow 0.25s ease;
  }

  .sidebar:hover {
    margin-right: -110px;
    box-shadow: 12px 0 30px rgba(4, 16, 30, 0.30);
  }
}

/* Modo leve (html.perf-lite): ligado sozinho em maquina de ate' 4 nucleos / 4 GB
   ou que nao sustenta a animacao na abertura (app.js applyPerformanceProfile).
   Todas as animacoes continuam; so' os efeitos de desfoque em tempo real (os
   mais caros para placa de video fraca) viram cor solida equivalente. */
html.perf-lite *,
html.perf-lite *::before,
html.perf-lite *::after {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

html.perf-lite .modal-backdrop {
  background: rgba(4, 16, 30, 0.76);
}

html.perf-lite .launcher-brand-header {
  background: rgba(15, 23, 42, 0.94);
}

html.perf-lite .login-screen::before,
html.perf-lite .login-screen::after {
  filter: none;
}

@media print {
  .content-area,
  [data-theme="dark"] .content-area {
    background: #ffffff !important;
  }
}


/* ============================================================================
   Obra impressa = bloqueada; original x copia (build 75)
   ============================================================================ */
.work-badge-slot { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; vertical-align: middle; }
.work-origin-badge,
.work-lock-badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px;
  font-size: 0.66rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap;
  border: 1px solid var(--border-light, #cbd5e1); background: var(--bg-surface-subtle, #f1f5f9); color: var(--text-muted, #475569);
}
.work-origin-badge.is-copy { border-color: #f59e0b; background: rgba(245, 158, 11, 0.12); color: #b45309; }
.work-lock-badge { border-color: #ef4444; background: rgba(239, 68, 68, 0.10); color: #b91c1c; }
[data-theme="dark"] .work-origin-badge.is-copy { color: #fbbf24; }
[data-theme="dark"] .work-lock-badge { color: #fca5a5; }

.rpt-origin-badge {
  display: inline-block; margin: 2px 0 3px; padding: 2px 9px; border: 1.5px solid #0f2a47; border-radius: 4px;
  font-size: 8.5pt; font-weight: 800; letter-spacing: 0.06em; color: #0f2a47; background: #fff;
}
.rpt-origin-badge.is-copy { border-color: #c2410c; color: #c2410c; background: #fff7ed; }

/* ===== Imposto bruto (sem deduzir créditos) e simulação "desconto = imposto bruto" - Estudo Tributário (build 80) ===== */
.tax-gross-panel { margin: 12px 16px 4px; padding: 12px 14px; border: 1px solid var(--border-medium); border-left: 4px solid var(--color-danger); border-radius: var(--radius-sm); background: var(--bg-surface); }
.tax-gross-title { font-size: 0.8rem; font-weight: 800; letter-spacing: 0.03em; color: var(--text-heading); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.tax-gross-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 4px 22px; }
.tax-gross-row { display: flex; justify-content: space-between; gap: 10px; font-size: 0.8rem; padding: 3px 0; border-bottom: 1px dashed var(--border-light); color: var(--text-main); }
.tax-gross-row strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tax-gross-row.sum, .tax-gross-row.total { font-weight: 800; }
.tax-gross-row.credit strong { color: var(--color-success); }
.tax-gross-row.total { grid-column: 1 / -1; font-size: 0.92rem; border-bottom: 0; padding-top: 6px; }
.tax-gross-row.total strong { color: var(--color-danger); font-size: 1rem; }
.tax-gross-whatif { margin-top: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--bg-surface-subtle); border: 1px dashed var(--brand-orange-500); }
.tax-gross-whatif-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 0.82rem; font-weight: 800; color: var(--text-heading); margin-bottom: 8px; }
.tax-gross-whatif-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.tax-gross-whatif-grid small { display: block; font-size: 0.72rem; color: var(--text-muted); }
.tax-gross-whatif-grid strong { display: block; font-size: 1.05rem; font-variant-numeric: tabular-nums; color: var(--text-heading); }
.tax-gross-whatif-grid em { display: block; font-style: normal; font-size: 0.74rem; color: var(--text-muted); }
@media print { .tax-gross-panel { display: none; } }

/* ===== Histórico de impressões e contagem de cópias (build 81) ===== */
.work-lock-badge.is-clickable { cursor: pointer; }
.work-lock-badge.is-clickable:hover { filter: brightness(0.95); text-decoration: underline; }
.work-copies-note { display: inline-block; margin-top: 2px; font-size: 0.7rem; font-weight: 700; color: var(--text-muted); }
#printHistoryLinks a { color: var(--brand-cyan-500); font-weight: 700; }

/* ===== Mostrar creditos de entrada nao utilizados (builds 82-84) ===== */
.tax-credits-ignored-note { margin: 0 0 14px; padding: 10px 14px; border: 1px solid var(--border-medium); border-left: 4px solid var(--brand-cyan-500); border-radius: var(--radius-sm); background: var(--bg-surface-subtle); font-size: 0.82rem; font-weight: 600; color: var(--text-main); }
@media print { .tax-credits-ignored-note { display: none !important; } }

/* ===== Simulação Sem Nota em abas (build 91) ===== */
.tax-sim-hint { margin: 10px 16px 0; padding: 8px 12px; border: 1px solid var(--border-medium); border-left: 4px solid var(--brand-orange-500); border-radius: var(--radius-sm); background: var(--bg-surface-subtle); font-size: 0.8rem; font-weight: 600; color: var(--text-main); }
.tax-sim-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 16px 0; border-bottom: 1px solid var(--border-medium); }
.tax-sim-tab { appearance: none; cursor: pointer; padding: 7px 14px; border: 1px solid var(--border-medium); border-bottom: none; border-radius: var(--radius-sm) var(--radius-sm) 0 0; background: var(--bg-surface-subtle); color: var(--text-muted); font-size: 0.8rem; font-weight: 700; }
.tax-sim-tab:hover { color: var(--text-main); }
.tax-sim-tab.active { background: var(--bg-surface); color: var(--brand-cyan-500); border-color: var(--brand-cyan-500); box-shadow: inset 0 3px 0 var(--brand-cyan-500); }
.tax-sim-host { margin: 4px 16px 12px; }
.tax-sim-title { margin: 14px 0 4px; font-size: 0.8rem; font-weight: 800; letter-spacing: 0.02em; text-transform: uppercase; color: var(--text-main); }
.tax-sim-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.tax-sim-table th, .tax-sim-table td { padding: 6px 8px; border-bottom: 1px solid var(--border-medium); text-align: left; }
.tax-sim-table th { background: var(--bg-surface-subtle); color: var(--text-muted); font-weight: 800; }
.tax-sim-table .num { text-align: right; white-space: nowrap; }
.tax-sim-table tr.is-strong td, .tax-sim-table tr.is-total td { font-weight: 800; }
.tax-sim-note { margin: 4px 0 0; font-size: 0.74rem; color: var(--text-muted); }
@media print { .tax-sim-tabs, .tax-sim-hint, .tax-sim-host { display: none !important; } }

/* Relatorio: bloco que comeca numa folha nova (ex.: Simulacao Sem Nota do Estudo Tributario com nota) */
.rpt-page-break { break-before: page; page-break-before: always; }

/* Relatorio: lista longa cabe em 1 folha (densidade automatica: renderReportHtml -> rpt-dense1 / rpt-dense2) */
#printReport .rpt-dense1 .rpt-table td { padding: 0.8px 5px; font-size: 7.1pt; line-height: 1.22; }
#printReport .rpt-dense1 .rpt-table th { padding: 2px 5px; }
#printReport .rpt-dense1 .rpt-section { margin-top: 6px; }
#printReport .rpt-dense2 .rpt-table td { padding: 0.3px 5px; font-size: 6.6pt; line-height: 1.15; }
#printReport .rpt-dense2 .rpt-table th { padding: 1.5px 5px; font-size: 6.4pt; }
#printReport .rpt-dense2 .rpt-section { margin-top: 5px; }

/* Relatorio com muitos quadros em 1 folha (Estudo Tributario): espacamento menor entre blocos e linhas */
#printReport .rpt-compact .rpt-section { margin-top: 5px; }
#printReport .rpt-compact .rpt-table td { padding: 1.2px 5px; }
#printReport .rpt-compact .rpt-kpis { margin-top: 5px; }

/* ===== Seletor de empresa e obra com pesquisa (topo) ===== */
.ctx-picker { position: relative; display: inline-flex; margin-right: 6px; }
.ctx-picker .ctx-native { position: absolute; left: 0; top: 0; width: 1px; height: 1px; min-width: 0; max-width: 1px; padding: 0; border: 0; opacity: 0; pointer-events: none; }
.ctx-picker-btn { display: inline-flex; align-items: center; gap: 8px; min-width: 190px; max-width: 330px; padding: 4px 10px; background: #091322; color: #38bdf8; border: 1px solid #334155; border-radius: 6px; font-size: 0.8rem; font-weight: 600; cursor: pointer; text-align: left; transition: all 0.18s ease; }
.ctx-picker-btn:hover, .ctx-picker-btn[aria-expanded="true"], .ctx-picker-btn:focus-visible { border-color: #38bdf8; box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2); outline: none; }
.ctx-picker-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-picker-caret { font-size: 0.65rem; opacity: 0.8; transition: transform 0.15s ease; }
.ctx-picker-btn[aria-expanded="true"] .ctx-picker-caret { transform: rotate(180deg); }
.ctx-picker-panel { position: fixed; z-index: 4000; display: flex; flex-direction: column; max-height: min(70vh, 520px); background: #0b1626; color: #e2e8f0; border: 1px solid #38bdf8; border-radius: 10px; box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55); overflow: hidden; }
.ctx-picker-panel.hidden { display: none; }
.ctx-picker-search { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid #1e2c42; background: #0e1c31; }
.ctx-picker-search > i { color: #38bdf8; font-size: 0.85rem; }
.ctx-picker-search input { flex: 1; min-width: 0; background: transparent; border: none; outline: none; color: #f1f5f9; font-size: 0.9rem; font-weight: 600; }
.ctx-picker-search input::placeholder { color: #64748b; font-weight: 500; }
.ctx-picker-count { font-size: 0.7rem; font-weight: 700; color: #64748b; white-space: nowrap; }
.ctx-picker-list { overflow-y: auto; padding: 4px 0; }
.ctx-picker-group { margin-top: 4px; padding: 7px 14px; font-size: 0.74rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: #7dd3fc; background: #13294a; border-top: 1px solid #24406a; border-bottom: 1px solid #24406a; border-left: 3px solid #38bdf8; }
.ctx-picker-group:first-child { margin-top: 0; }
.ctx-picker-item { padding: 7px 14px; cursor: pointer; border-left: 3px solid transparent; }
.ctx-picker-item.is-active { background: rgba(56, 189, 248, 0.14); border-left-color: #38bdf8; }
.ctx-picker-item.is-current .ctx-picker-item-title { color: #38bdf8; }
.ctx-picker-item-title { font-size: 0.84rem; font-weight: 700; color: #e2e8f0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-picker-item-title i { font-size: 0.72rem; }
.ctx-picker-item-sub { margin-top: 1px; font-size: 0.72rem; color: #94a3b8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-picker-new { margin-top: 4px; border-top: 1px solid #1e2c42; color: #34d399; }
.ctx-picker-new .ctx-picker-item-title { color: #34d399; }
.ctx-picker-empty { padding: 18px 14px; font-size: 0.82rem; color: #94a3b8; text-align: center; }
.ctx-picker-foot { padding: 6px 12px; border-top: 1px solid #1e2c42; font-size: 0.66rem; color: #64748b; text-align: center; background: #0e1c31; }
@media (max-width: 900px) { .ctx-picker-btn { min-width: 130px; max-width: 170px; } }
@media print { .ctx-picker-panel { display: none !important; } }

.ctx-picker-sort { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-bottom: 1px solid #1e2c42; background: #0b1626; font-size: 0.68rem; font-weight: 700; color: #64748b; }
.ctx-picker-sort-btn { appearance: none; cursor: pointer; padding: 2px 9px; border: 1px solid #263a57; border-radius: 999px; background: transparent; color: #94a3b8; font-size: 0.68rem; font-weight: 700; transition: all 0.15s ease; }
.ctx-picker-sort-btn:hover { border-color: #38bdf8; color: #e2e8f0; }
.ctx-picker-sort-btn.is-active { background: rgba(56, 189, 248, 0.18); border-color: #38bdf8; color: #38bdf8; }

/* Topo (build 107): sem o titulo da empresa, quem encolhe quando a tela e' estreita sao os seletores de empresa e obra */
.topbar .topbar-nav-shortcuts { flex: 0 0 auto; }
.topbar .active-work-context { flex: 1 1 auto; min-width: 0; }
.topbar .active-work-context .ctx-picker { flex: 1 1 130px; min-width: 0; margin-right: 0; }
.topbar .active-work-context .ctx-picker .ctx-picker-btn { width: 100%; min-width: 0; }
.topbar .topbar-right { flex: 0 0 auto; margin-left: 8px; }
.topbar .active-work-context > i,
.topbar .active-work-context > label,
.topbar .active-work-btn-group { flex: 0 0 auto; }

/* =============================================================================
   PROPOSTA AO CLIENTE (proposta formal timbrada - modulo "Proposta Formal" do app.js, prefixo fp)
   Tela: formulario + previa. Papel: .fp-doc dentro de #printReport (body.print-mode-formal), pagina nomeada
   "fpage"; cabecalho (logos + titulo) e rodape repetem em toda folha (tabela com thead/tfoot).
   ============================================================================= */
.fp-modal-dialog { max-width: 1280px; width: 96vw; }
.fp-template-dialog { max-width: 980px; }
.fp-modal-body { max-height: 78vh; overflow: auto; padding: 16px 20px; }
.fp-layout { display: grid; grid-template-columns: minmax(380px, 1fr) minmax(380px, 1fr); gap: 20px; align-items: start; }
.fp-preview-col { position: sticky; top: 0; }
@media (max-width: 1000px) { .fp-layout { grid-template-columns: 1fr; } .fp-preview-col { position: static; } }
.fp-work-line { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 4px; }
.fp-number-line { font-size: 0.82rem; color: var(--brand-cyan-500); font-weight: 700; margin-bottom: 12px; }
.fp-block-title { margin: 14px 0 8px; padding-bottom: 5px; border-bottom: 1px solid var(--border-light); color: var(--brand-cyan-500); font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; }
.fp-sub-title { margin: 10px 0 6px; font-size: 0.8rem; font-weight: 700; color: var(--text-heading); }
.fp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.fp-span2 { grid-column: span 2; }
.fp-textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.8rem; line-height: 1.45; }
textarea.fp-textarea[rows="8"], textarea.fp-textarea[rows="10"], textarea.fp-textarea[rows="12"] { min-height: 170px; }
.fp-help { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }
.fp-valor-note { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }
.fp-model-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.fp-model-row .form-control { flex: 1; }
.fp-pay-gen { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 8px; }
.fp-pay-gen label { font-size: 0.72rem; color: var(--text-muted); display: flex; flex-direction: column; gap: 3px; width: 92px; }
.fp-pay-edit { display: grid; grid-template-columns: 1fr 140px 34px; gap: 6px; margin-bottom: 6px; }
.fp-pay-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 6px 0 10px; }
.fp-sum { font-size: 0.76rem; font-weight: 700; }
.fp-sum-ok { color: #16a34a; }
.fp-sum-bad { color: #dc2626; }
.fp-hist-empty { font-size: 0.8rem; color: var(--text-muted); padding: 6px 0; }
.fp-hist { width: 100%; border-collapse: collapse; font-size: 0.76rem; }
.fp-hist th, .fp-hist td { padding: 5px 6px; border-bottom: 1px solid var(--border-light); text-align: left; }
.fp-hist-actions { white-space: nowrap; text-align: right !important; }
.fp-hist td:first-child, .fp-hist td:nth-child(3) { white-space: nowrap; }
.fp-preview { background: #cbd5e1; border: 1px solid var(--border-light); border-radius: 8px; padding: 10px; max-height: 74vh; overflow: auto; }
.fp-preview .fp-doc:not(.fp-paged) { zoom: 0.6; width: 210mm; margin: 0 auto; padding: 8mm 13mm; background: #ffffff; }
.fp-preview .fp-pb { border-top: 1px dashed #94a3b8; margin: 14px 0; }

/* ---- o documento (tela e papel) ---- */
.fp-doc { font-family: Arial, Helvetica, sans-serif; font-size: 10pt; line-height: 1.28; color: #000; text-align: justify; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.fp-doc * { box-sizing: border-box; }
.fp-doc .fp-sheet { width: 100%; border-collapse: collapse; }
.fp-doc .fp-sheet thead { display: table-header-group; }
.fp-doc .fp-sheet tfoot { display: table-footer-group; }
.fp-doc .fp-sheet td { padding: 0; vertical-align: top; }
.fp-doc .fp-logos { display: flex; justify-content: center; align-items: center; gap: 6mm; }
.fp-doc .fp-logo-main { display: block; width: 76mm; height: 19.35mm; }
.fp-doc .fp-logo-side { display: flex; flex-direction: column; align-items: center; gap: 0.5mm; width: 36mm; }
.fp-doc .fp-logo-side img { display: block; }
.fp-doc .fp-logo-tf { width: 36mm; height: 8.25mm; }
.fp-doc .fp-logo-cmr { width: 34mm; height: 8.3mm; }
.fp-doc .fp-logo-side .fp-amp { width: 4mm; height: 6.6mm; }
.fp-doc .fp-title { text-align: center; font-size: 14pt; font-weight: 700; margin: 3mm 0 5mm; }
.fp-doc .fp-foot { text-align: center; font-size: 7.2pt; line-height: 1.3; border-top: 0.6pt solid #1e3a5f; padding-top: 2mm; margin-top: 3mm; }
.fp-doc .fp-foot .fp-p { margin: 0; text-align: center; }
.fp-doc .fp-foot .fp-hr { border: 0; border-top: 0.6pt solid #1e3a5f; margin: 1.5mm 0; }
.fp-doc .fp-foot .fp-gap { height: 4pt; }
.fp-doc .fp-p { margin: 0 0 2pt; }
.fp-doc .fp-gap { height: 6pt; }
.fp-doc .fp-b { font-weight: 700; }
.fp-doc .fp-bi { font-weight: 700; font-style: italic; margin-top: 10pt; }
.fp-doc .fp-h1, .fp-doc .fp-h2 { font-family: Arial, Helvetica, sans-serif; letter-spacing: normal; }
.fp-doc .fp-h1 { font-size: 13pt; font-weight: 700; margin: 10pt 0 6pt; text-align: left; break-after: avoid; }
.fp-doc .fp-h2 { font-size: 10pt; font-weight: 700; font-style: italic; margin: 7pt 0 3pt; text-align: left; break-after: avoid; }
.fp-doc .fp-under { text-decoration: underline; }
.fp-doc .fp-hr { border: 0; border-top: 0.6pt solid #000; margin: 4pt 0; }
.fp-doc .fp-pb { height: 0; break-after: page; page-break-after: always; }
.fp-doc tr.fp-pbrow { break-after: page; page-break-after: always; }
.fp-doc tr.fp-keep { break-after: avoid; }
.fp-doc tr.fp-avoid { break-inside: avoid; }
.fp-doc tr.fp-pbrow:not(.fp-row) td { height: 0; padding: 0; }
.fp-preview .fp-doc tr.fp-pbrow:not(.fp-row) td { border-top: 1px dashed #94a3b8; }
.fp-doc .fp-num { display: flex; gap: 6pt; margin: 5pt 0 2pt; }
.fp-doc .fp-num > b { flex: 0 0 30pt; }
.fp-doc .fp-num > span { flex: 1; }
.fp-doc .fp-li { display: flex; gap: 6pt; margin: 1pt 0 1pt 14pt; }
.fp-doc .fp-li > span, .fp-doc .fp-li > .fp-lead { flex: 1; }
.fp-doc .fp-arrow::before { content: ''; flex: 0 0 auto; width: 0; height: 0; margin-top: 4pt; border-left: 5pt solid #000; border-top: 3pt solid transparent; border-bottom: 3pt solid transparent; }
.fp-doc .fp-dot::before { content: '\2022'; flex: 0 0 8pt; }
.fp-doc .fp-lead { display: flex; align-items: baseline; }
.fp-doc .fp-lead span { white-space: nowrap; }
.fp-doc .fp-lead i { flex: 1; border-bottom: 1pt dotted #000; margin: 0 3pt; transform: translateY(-2pt); }
.fp-doc .fp-lead b { font-weight: 400; white-space: nowrap; }
.fp-doc .fp-red { color: #e00000; }
.fp-doc .fp-box { border: 0.8pt solid #000; padding: 3pt 5pt; margin: 8pt 0; break-inside: avoid; }
.fp-doc .fp-box p { margin: 0; }
.fp-doc .fp-price { margin: 6pt 0; }
.fp-doc .fp-price-row { display: flex; justify-content: space-between; border: 0.8pt solid #000; padding: 3pt 12pt; font-weight: 700; font-style: italic; }
.fp-doc .fp-price-ext { text-align: center; font-weight: 700; font-style: italic; margin: 12pt 0 8pt; }
.fp-doc .fp-pay { margin: 4pt 0 4pt 18pt; }
.fp-doc .fp-pay-row { display: grid; grid-template-columns: 14pt 110pt 26pt 78pt; align-items: center; margin: 2pt 0; }
.fp-doc .fp-diamond { width: 5pt; height: 5pt; background: #000; transform: rotate(45deg); }
.fp-doc .fp-pay-v { text-align: right; }
.fp-doc .fp-pay-note { margin: 8pt 0 4pt; }
.fp-doc .fp-client { margin: 6pt 0 8pt 8pt; text-align: left; }
.fp-doc .fp-cl { margin: 0; }
.fp-doc .fp-cl-name { font-weight: 700; margin: 8pt 0 6pt; }
.fp-doc .fp-localobra { margin-top: 10pt; }
.fp-doc .fp-intro { margin: 16pt 0 10pt; }
.fp-doc .fp-index { margin: 16pt 0 14pt; }
.fp-doc .fp-index-title { text-align: center; font-weight: 700; margin-bottom: 8pt; }
.fp-doc .fp-idx { text-align: left; margin: 2pt 0 2pt 40pt; }
.fp-doc .fp-idx.fp-lead { margin-right: 40pt; }
.fp-doc .fp-signer { margin-top: 30pt; width: 62mm; text-align: left; }
.fp-doc .fp-signer .fp-sign-line { margin: 0 0 3pt; width: 100%; }
.fp-doc .fp-sign { margin-top: 14pt; break-inside: avoid; }
.fp-doc .fp-sign-top { display: flex; justify-content: space-between; align-items: flex-start; }
.fp-doc .fp-sign-date { white-space: nowrap; }
.fp-doc .fp-sign-line { border-top: 0.8pt solid #000; width: 62%; margin: 30pt auto 3pt; }
.fp-doc .fp-sign-who { text-align: center; }
.fp-doc .fp-wit { display: flex; justify-content: space-between; margin-top: 26pt; }
.fp-doc .fp-wit > div { width: 44%; text-align: center; }
.fp-doc .fp-wit .fp-sign-line { width: 100%; margin: 0 0 3pt; }

@page fpage { size: A4 portrait; margin: 0; }

@media print {
  body.print-mode-report.print-mode-formal #printReport { page: fpage; }
}

/* ---- folhas A4 (fpPaginatedHtml): cabecalho, corpo, rodape e numero em cada folha ---- */
.fp-doc .fp-mb { display: flow-root; }
.fp-doc.fp-paged .fp-page { position: relative; width: 210mm; height: 296.6mm; padding: 8mm 13mm 9mm; background: #ffffff; overflow: hidden; break-after: page; page-break-after: always; }
.fp-doc.fp-paged .fp-page:last-child { break-after: auto; page-break-after: auto; }
.fp-doc.fp-paged .fp-page-head { margin-bottom: 2mm; }
.fp-doc.fp-paged .fp-page-foot { position: absolute; left: 13mm; right: 13mm; bottom: 9mm; }
.fp-doc.fp-paged .fp-page-num { position: absolute; right: 13mm; bottom: 4mm; font-size: 6.5pt; color: #64748b; }
.fp-doc.fp-paged .fp-foot { margin-top: 0; }
.fp-preview .fp-doc.fp-paged .fp-page { zoom: 0.6; margin: 0 auto 12px; box-shadow: 0 1px 6px rgba(15, 23, 42, 0.25); }

/* Proposta grampeada na obra (Obras e Projetos) */
.work-proposal-chip { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; padding: 3px 9px; font-size: 0.72rem; font-weight: 600; color: var(--text-heading); background: var(--bg-surface-alt, #f1f5f9); border: 1px solid var(--border-light); border-radius: 999px; cursor: pointer; font-family: inherit; }
.work-proposal-chip:hover { border-color: var(--color-primary, #0284c7); color: var(--color-primary, #0284c7); }

/* ---- Orcamento ao Cliente (modelo Digisat, prefixo bq) e anexos na lista de obras ---- */
.bq-item-row { margin-bottom: 10px; padding: 8px 10px 10px; border: 1px solid var(--border-light); border-radius: 8px; background: var(--bg-surface-subtle, transparent); }
.bq-item-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.bq-item-head .bq-item-n { flex: 1; font-size: 0.78rem; font-weight: 700; color: var(--text-heading); }
.bq-item-head select.form-control { width: 130px; flex: 0 0 auto; }
.bq-item-l1 { display: grid; grid-template-columns: 110px minmax(0, 1fr) 110px; gap: 6px; }
.bq-item-l2 { display: grid; grid-template-columns: 70px 60px minmax(0, 1fr) 90px 90px minmax(0, 1fr); gap: 6px; margin-top: 6px; }
.bq-item-row .bq-f { min-width: 0; }
.bq-item-row .bq-f label { display: block; margin-bottom: 2px; font-size: 0.68rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bq-item-row .form-control { min-width: 0; width: 100%; padding-left: 8px; padding-right: 8px; }
.bq-item-row .bq-item-total { padding: 8px 2px; text-align: right; font-weight: 700; color: var(--text-heading); white-space: nowrap; }
@media (max-width: 640px) { .bq-item-l1, .bq-item-l2 { grid-template-columns: 1fr 1fr; } }
.bq-tax-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 12px; }
.bq-chip-action { color: var(--color-primary, #0284c7); border-color: var(--color-primary, #0284c7); }
.bq-chip-signed { border-color: #16a34a; color: #166534; }
.bq-preview { background: #ffffff; padding: 6px; }

/* Janela "Imprimir Documentos da Obra": a descricao de cada documento quebra linha em vez de passar da borda
   (com .btn { white-space: nowrap } o texto saia da janela e criava barra de rolagem lateral). */
#workPrintModal .modal-body .btn { white-space: normal; align-items: center; height: auto; min-height: 0; line-height: 1.3; padding-top: 10px; padding-bottom: 10px; }
#workPrintModal .modal-body .btn > div { min-width: 0; }

/* Orcamento ao Cliente: padrao quadriculado do Digisat, com a logo do Grupo OpenFrio */
.bq-doc { background: #ffffff; color: #000000; font-family: Arial, Helvetica, sans-serif; font-size: 8.4pt; line-height: 1.3; width: 100%; box-sizing: border-box; }
.bq-doc table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.bq-doc .bq-box { border: 1px solid #000000; }
.bq-doc .bq-box td { border: 1px solid #000000; padding: 2.2pt 5pt; vertical-align: middle; }
.bq-doc .bq-h1 { text-align: center; font-weight: 700; font-size: 9.5pt; letter-spacing: 0.5pt; padding: 2pt 0; }
.bq-doc .bq-h2 { text-align: center; font-weight: 700; font-size: 6.6pt; }
.bq-doc .bq-brand { text-align: center; vertical-align: middle; padding: 6pt 8pt; }
.bq-doc .bq-logo { display: block; margin: 0 auto 3pt; max-width: 100%; max-height: 22mm; width: auto; height: auto; object-fit: contain; }
.bq-doc .bq-brand-addr { font-size: 6pt; line-height: 1.25; color: #1f2937; }
.bq-doc .bq-v { text-align: right; }
.bq-doc .bq-items { margin-top: 0; border: 1px solid #000000; border-top: 0; font-size: 7.8pt; }
.bq-doc .bq-items th { background: #d9d9d9; border-bottom: 1px solid #000000; padding: 2pt 4pt; font-weight: 700; text-align: center; }
.bq-doc .bq-items th.l { text-align: left; }
.bq-doc .bq-items td { padding: 2.5pt 4pt; vertical-align: top; border-bottom: 1px dotted #6b7280; }
.bq-doc .bq-items .c { text-align: center; }
.bq-doc .bq-items .r { text-align: right; white-space: nowrap; }
.bq-doc .bq-items .bq-qtd-row td { border-bottom: 0; padding-top: 1pt; }
.bq-doc .bq-box-tot { border-top: 1px solid #000000; }
.bq-doc .bq-box-tot td { border: 0; padding: 1.6pt 5pt; }
.bq-doc .bq-box-tot .r { text-align: right; }
.bq-doc .bq-n { float: right; }
.bq-doc .bq-box-pay { border-top: 1px solid #000000; }
.bq-doc .bq-box-pay td { padding: 3pt 6pt; }
.bq-doc .bq-total-l { width: 16%; text-align: left; }
.bq-doc .bq-total-v { width: 20%; text-align: right; }
.bq-doc .bq-obs { border: 1px solid #000000; border-top: 0; padding: 3pt 6pt; min-height: 70mm; }
.bq-doc .bq-obs-t { font-size: 7.4pt; margin-bottom: 2pt; }
.bq-doc .bq-obs-text { white-space: pre-wrap; font-size: 9pt; }
.bq-doc .bq-approve { border: 1px solid #000000; border-top: 0; padding: 22mm 6pt 14mm; text-align: center; break-inside: avoid; }
.bq-doc .bq-foot { margin-top: 3pt; text-align: center; font-size: 6.5pt; color: #374151; }
.bq-doc .bq-box-tot td { white-space: nowrap; }
.bq-doc .bq-box td { overflow-wrap: anywhere; }
.bq-doc .bq-brand { white-space: normal; overflow: hidden; }
.bq-doc .bq-items td.bq-desc-cell { white-space: normal; }
.bq-doc .bq-emit { text-align: center; padding: 3pt 6pt; overflow-wrap: anywhere; }
.bq-item-row .bq-item-ro { padding: 8px 2px; font-weight: 600; color: var(--text-heading); white-space: nowrap; }

/* Proposta/Orcamento: campo CNPJ com botao Buscar ao lado */
.fp-cnpj-row { display: flex; gap: 6px; align-items: stretch; }
.fp-cnpj-row .form-control { flex: 1 1 auto; min-width: 0; }
.fp-cnpj-row .btn { flex: 0 0 auto; white-space: nowrap; }

/* Proposta ao Cliente: campos de varias linhas (Enter pula linha), tarja vermelha dos parametros */
textarea.fp-autogrow { field-sizing: content; min-height: 2.4rem; padding: 8px 14px; resize: vertical; line-height: 1.4; font-family: inherit; overflow: hidden; }
.fp-title-grid { grid-template-columns: 110px 1fr; }
.fp-red-field { border-left: 4px solid #d00000; background: rgba(208, 0, 0, 0.06); border-radius: 6px; padding: 8px 10px; }
.fp-red-field label { color: #b00000; font-weight: 700; }
.fp-red-textarea { color: #c00000; border-color: #d00000; background: rgba(208, 0, 0, 0.04); font-family: inherit; }
.fp-doc .fp-red-text { color: #e00000; font-weight: 700; }

.fp-sign-box { border: 1px solid var(--border-light, #cbd5e1); border-left: 4px solid var(--brand-cyan-500, #0ea5e9); border-radius: 8px; padding: 10px 12px; margin: 10px 0; background: rgba(14, 165, 233, 0.05); }
.fp-sign-box-title { font-weight: 700; margin-bottom: 8px; }

/* Lista de obras: coluna Documentos e janela "Documentos da obra" */
.work-docs-cell { min-width: 190px; max-width: 260px; vertical-align: middle; }
.work-doc-pills { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.work-doc-pills .work-proposal-chip { margin: 0; }
.work-doc-import { background: rgba(16, 185, 129, 0.12); color: #047857; border-color: rgba(16, 185, 129, 0.45); }
.work-doc-all { background: transparent; }
.work-doc-more { font-size: 0.72rem; color: var(--text-muted); font-weight: 700; }
.import-docnum-box { margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--border-color); border-left: 4px solid var(--brand-cyan-500, #0ea5e9); border-radius: 8px; background: var(--bg-surface); }
.import-docnum-box label { font-weight: 700; }
.work-docs-dialog { max-width: 720px; width: 94vw; }
.work-docs-obra { font-weight: 800; margin-bottom: 10px; color: var(--text-heading, inherit); }
.work-docs-section { border: 1px solid var(--border-color); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; background: var(--bg-surface); }
.work-docs-section-title { font-weight: 800; font-size: 0.85rem; margin-bottom: 8px; display: flex; gap: 6px; align-items: center; }
.work-docs-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px dashed var(--border-color); }
.work-docs-row:first-of-type { border-top: 0; }
.work-docs-info { display: flex; flex-direction: column; min-width: 0; }
.work-docs-info span { font-size: 0.75rem; color: var(--text-muted); overflow-wrap: anywhere; }
.work-docs-actions { flex: 0 0 auto; }
.work-docs-empty { font-size: 0.8rem; color: var(--text-muted); }
.work-docs-attach { margin-top: 6px; padding: 10px 12px; border: 1px dashed var(--border-color); border-radius: 8px; }
.work-docs-attach-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.work-docs-attach-row input[type=file] { flex: 1 1 220px; min-width: 0; }
.work-docs-attach-row input[type=text] { flex: 0 0 140px; }

/* Lista de obras: Documentos e Acoes ficam sempre visiveis na borda direita (build 124).
   Em tela estreita a tabela rolava para a direita e os botoes ficavam escondidos; agora o que e' largo
   (empresa, nome, valores) rola por baixo e as duas colunas de botoes ficam fixas. Nenhuma coluna foi removida. */
#tabObras .data-table th,
#tabObras .data-table td { padding: 8px 9px; }
#tabObras .data-table th:nth-last-child(2),
#tabObras .data-table td:nth-last-child(2) { box-sizing: border-box; width: 160px; min-width: 160px; max-width: 160px; }
#tabObras .data-table td.work-actions { display: table-cell; white-space: normal; }
#tabObras .data-table th:last-child,
#tabObras .data-table td:last-child { box-sizing: border-box; width: 150px; min-width: 150px; max-width: 150px; }
#tabObras .data-table td.work-actions .btn { margin: 0 4px 4px 0; }
#tabObras .data-table th:nth-last-child(2),
#tabObras .data-table td:nth-last-child(2) { position: sticky; right: 150px; z-index: 2; background: var(--bg-surface, #fff); box-shadow: -6px 0 8px -6px rgba(15, 23, 42, 0.28); }
#tabObras .data-table th:last-child,
#tabObras .data-table td:last-child { position: sticky; right: 0; z-index: 2; background: var(--bg-surface, #fff); }
#tabObras .data-table th:nth-last-child(2),
#tabObras .data-table th:last-child { background: var(--bg-surface-subtle); z-index: 3; }
#tabObras .data-table tbody tr:hover { transform: none; }
