/* ============================================================
   FinTax — Design System
   Identidade: Corporativo · Dados financeiros · Fiscal · B2B
   Paleta: Azul Marinho #0D1B2A · Verde Petróleo #0F766E · Azul #2563EB · Verde #22C55E
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ---------- TOKENS FinTax ---------- */
:root {
  --bg:           #F2F4F7;
  --surface:      #ffffff;
  --sidebar-bg:   #0D1B2A;
  --sidebar-txt:  #c8d6e5;
  --sidebar-sub:  #6b8499;
  --accent:       #0F766E;
  --accent-h:     #0d6460;
  --accent-blue:  #2563EB;
  --accent-blue-h:#1d4ed8;
  --danger:       #dc2626;
  --success:      #22C55E;
  --success-dark: #16a34a;
  --warning:      #d97706;
  --txt:          #0D1B2A;
  --txt-sub:      #475569;
  --txt-muted:    #6b7280;
  --border:       #e2e8f0;
  --radius:       10px;
  --shadow:       0 1px 3px rgba(0,0,0,.07), 0 4px 14px rgba(0,0,0,.05);
  --shadow-md:    0 4px 20px rgba(0,0,0,.10), 0 1px 4px rgba(0,0,0,.06);
  --sidebar-w:    234px;
  --font:         'Inter', system-ui, -apple-system, sans-serif;
  --mono:         'SF Mono', 'Fira Code', 'Fira Mono', monospace;
  --transition:   .18s ease;
}

/* ---------- RESET ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: var(--font); background: var(--bg); color: var(--txt); }
a { color: var(--accent); text-decoration: none; }
ul { list-style: none; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(145deg, #0D1B2A 0%, #0c2340 45%, #0F2E3D 80%, #0a1a0f 100%);
  position: relative;
  overflow: hidden;
}
/* Padrão decorativo de fundo */
body.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(15,118,110,.18) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(37,99,235,.12) 0%, transparent 50%),
    radial-gradient(circle at 60% 10%, rgba(34,197,94,.07) 0%, transparent 40%);
  pointer-events: none;
}

.login-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 48px 44px;
  width: 100%;
  max-width: 410px;
  box-shadow: 0 32px 80px rgba(0,0,0,.4), 0 0 0 1px rgba(255,255,255,.06);
  animation: fadeUp .4s ease;
  position: relative;
  z-index: 1;
}

/* Logo FinTax no login */
.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}
.login-logo-icon {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
}
.login-logo-text {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -.04em;
  color: var(--txt);
  line-height: 1;
}
.login-logo-text span { color: var(--accent); }

.login-sub {
  font-size: .78rem;
  color: var(--txt-muted);
  margin-bottom: 32px;
  font-weight: 400;
  letter-spacing: .02em;
  text-transform: uppercase;
  padding-left: 54px;
}

/* ---------- INPUTS ---------- */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: .75rem;
  font-weight: 600;
  color: var(--txt-sub);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: .9rem;
  color: var(--txt);
  background: var(--bg);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
  background: var(--surface);
}

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: .85rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  text-decoration: none;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: scale(.97); }

.btn--primary  { background: var(--accent); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--accent-h); box-shadow: 0 4px 16px rgba(15,118,110,.35); }

.btn--ghost    { background: transparent; color: var(--txt-sub); border: 1.5px solid var(--border); }
.btn--ghost:hover { background: var(--bg); color: var(--txt); }

.btn--danger   { background: var(--danger); color: #fff; }
.btn--danger:hover { background: #b91c1c; }

.btn--full     { width: 100%; }
.btn--sm       { padding: 6px 12px; font-size: .78rem; }

.btn-link {
  background: none; border: none; cursor: pointer;
  color: var(--accent); font-family: var(--font); font-size: .82rem; font-weight: 600;
  padding: 4px 0;
}
.btn-link:hover { text-decoration: underline; }

.login-actions {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

/* ---------- TOAST ---------- */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--txt);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: .84rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .25s, transform .25s;
  pointer-events: none;
  z-index: 9999;
  max-width: 320px;
}
.toast--visible { opacity: 1; transform: translateY(0); }
.toast--success { background: var(--success); }
.toast--error   { background: var(--danger); }
.toast--info    { background: var(--accent); }

/* ============================================================
   DASHBOARD LAYOUT
   ============================================================ */
.layout { display: flex; min-height: 100vh; }

/* ---------- SIDEBAR ---------- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-txt);
  display: flex;
  flex-direction: column;
  padding: 28px 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar__logo {
  padding: 20px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar__logo-icon {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}
.sidebar__logo-wordmark {
  display: flex;
  flex-direction: column;
}
.sidebar__logo-wordmark h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -.03em;
  color: #fff;
  line-height: 1.1;
}
.sidebar__logo-wordmark h1 span { color: #0F766E; }
.sidebar__logo-wordmark small {
  font-size: .6rem;
  color: var(--sidebar-sub);
  font-weight: 400;
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-top: 1px;
}

.sidebar__empresa {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  margin-bottom: 8px;
}
.sidebar__empresa label {
  font-size: .6rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--sidebar-sub);
  display: block;
  margin-bottom: 5px;
}
.sidebar__empresa select {
  width: 100%;
  padding: 6px 10px;
  background: rgba(255,255,255,.07);
  color: #e2e8f0;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 6px;
  font-family: var(--font);
  font-size: .78rem;
  cursor: pointer;
  outline: none;
}
.sidebar__empresa select:focus { border-color: var(--accent); }
.sidebar__empresa .btn { margin-top: 8px; width: 100%; font-size: .75rem; padding: 7px; }

.sidebar__nav { flex: 1; padding: 6px 12px; }
.sidebar__nav-label {
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--sidebar-sub);
  padding: 14px 10px 6px;
  font-weight: 600;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 12px;
  background: transparent;
  border: none;
  color: var(--sidebar-txt);
  font-family: var(--font);
  font-size: .82rem;
  font-weight: 400;
  cursor: pointer;
  border-radius: 7px;
  text-align: left;
  transition: background var(--transition), color var(--transition);
  margin-bottom: 1px;
}
.nav-btn:hover {
  background: rgba(255,255,255,.07);
  color: #fff;
}
.nav-btn.active {
  background: rgba(15,118,110,.22);
  color: #4ade80;
  font-weight: 600;
  border-left: 2.5px solid #0F766E;
  padding-left: 9.5px;
}

.nav-btn .icon {
  width: 16px; height: 16px;
  opacity: .6;
  flex-shrink: 0;
}
.nav-btn:hover .icon { opacity: .9; }
.nav-btn.active .icon { opacity: 1; }

.sidebar__footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.07);
}
.sidebar__footer .nav-btn { color: #f87171; }
.sidebar__footer .nav-btn:hover { background: rgba(220,38,38,.12); color: #fca5a5; }

/* ---------- MAIN ---------- */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 36px 40px;
  max-width: calc(100vw - var(--sidebar-w));
}

.page-header {
  margin-bottom: 28px;
}
.page-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -.02em;
}
.page-header p {
  color: var(--txt-sub);
  font-size: .85rem;
  margin-top: 4px;
  font-weight: 300;
}

/* ---------- CARDS ---------- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.card-empresa {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  background: var(--surface);
  transition: box-shadow var(--transition);
}
.card-empresa:hover { box-shadow: var(--shadow); }
.card-empresa__info { display: flex; flex-direction: column; gap: 2px; }
.card-empresa__info strong { font-size: .9rem; font-weight: 600; }
.card-empresa__info span { font-size: .78rem; color: var(--txt-sub); }
.stats-grid {
    display: flex; /* Usar flexbox para alinhar os gráficos */
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 16px;
    justify-content: center; /* Centraliza os gráficos */
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px 22px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.stat-card__label { font-size: .72rem; color: var(--txt-sub); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.stat-card__value { font-size: 2rem; font-weight: 700; margin-top: 6px; font-family: var(--mono); }
.stat-card--blue  .stat-card__value { color: var(--accent); }
.stat-card--green .stat-card__value { color: var(--success); }
.stat-card--orange .stat-card__value { color: var(--warning); }

/* ---------- FORMS ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid--single { grid-template-columns: 1fr; }
.form-row { display: flex; gap: 12px; align-items: flex-end; margin-top: 20px; }

/* ---------- TABLE ---------- */
.table-wrap { overflow-x: auto; margin-top: 16px; }
table { width: 100%; border-collapse: collapse; font-size: .84rem; }
thead th {
  text-align: left;
  padding: 10px 16px;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--txt-sub);
  font-weight: 600;
  border-bottom: 1.5px solid var(--border);
  background: var(--bg);
}
tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg); }

.user-cell { display: flex; flex-direction: column; gap: 2px; }
.user-cell strong { font-size: .88rem; }
.user-cell small  { color: var(--txt-sub); font-size: .75rem; font-family: var(--mono); }

.checks-grid { display: flex; flex-direction: column; gap: 6px; }
.check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .82rem;
  cursor: pointer;
  color: var(--txt);
}
.check-label input[type="checkbox"] { accent-color: var(--accent); width: 14px; height: 14px; }

/* ---------- BADGES ---------- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-top: 4px;
  width: fit-content;
}
.badge--master { background: #dbeafe; color: #1d4ed8; }
.badge--user   { background: #f3f4f6; color: #6b7280; }

/* ---------- MISC ---------- */
.empty { color: var(--txt-sub); font-size: .85rem; padding: 20px 0; }
.loading-cell { color: var(--txt-sub); font-style: italic; padding: 20px; }
.empresa-ativa-label {
  font-size: .75rem;
  color: var(--sidebar-sub);
  padding: 4px 22px 0;
  font-family: var(--mono);
}
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

#inicioArea .welcome-title {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -.03em;
}
#inicioArea .welcome-sub {
  color: var(--txt-sub);
  font-size: .88rem;
  margin-top: 6px;
  font-weight: 300;
}

/* ---------- ANIMATIONS ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.main > div { animation: fadeUp .3s ease; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; padding: 20px 16px; max-width: 100vw; }
  .form-grid { grid-template-columns: 1fr; }
}

/* ===== NOVOS ESTILOS MANUS ===== */
.badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}
.badge--green { background: rgba(34, 197, 94, 0.1); color: #22c55e; }
.badge--blue { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.stat-card--red { border-left: 4px solid #ef4444; }
.stat-card--red .stat-card__value { color: #ef4444; }
#omieLoading { font-size: 0.9rem; color: var(--txt-light); margin-bottom: 10px; font-style: italic; }
input[type="file"] { background: var(--bg-alt); border: 1px dashed var(--border); padding: 10px; border-radius: 6px; width: 100%; cursor: pointer; }


/* ===== PERFIL DO USUÁRIO ===== */
.perfil-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  max-width: 600px;
}
.perfil-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.perfil-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
}
.perfil-info h3 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.perfil-info p {
  color: var(--txt-sub);
  font-size: 0.9rem;
}
.perfil-details {
  margin-bottom: 24px;
}
.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.detail-row:last-child { border-bottom: none; }
.detail-label {
  font-weight: 600;
  color: var(--txt-sub);
  font-size: 0.85rem;
}
.detail-value {
  color: var(--txt);
  font-weight: 500;
}
.perfil-actions {
  display: flex;
  gap: 12px;
}
.perfil-actions .btn { flex: 1; }

/* ===== INFO BOX ===== */
.info-box {
  background: var(--bg);
  border-left: 4px solid var(--accent);
  padding: 16px;
  border-radius: 6px;
  margin-top: 12px;
}
.info-box strong {
  display: block;
  margin-bottom: 8px;
  color: var(--txt);
}
.info-box p {
  font-size: 0.85rem;
  color: var(--txt-sub);
  margin: 4px 0;
}

/* ===== SIDEBAR PERFIL ===== */
.sidebar__perfil {
  padding: 6px 12px;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

/* --- ESTILOS DRE ANALÍTICO (v89.1) --- */
.dre-section-title {
    background: #e2e8f0;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    color: #334155;
}
.dre-mae-row {
    cursor: pointer;
    font-weight: 600;
    background: #f8fafc;
    transition: background 0.2s ease;
}
.dre-mae-row:hover {
    background: #f0f4f8;
}
.dre-mae-row td:first-child {
    padding-left: 15px;
}
.dre-sub-row {
    font-size: 0.85rem;
    color: #64748b;
    display: none; /* Escondido por padrão */
}
.dre-sub-row td:first-child {
    padding-left: 30px;
}
.dre-total-row {
    background: #dbeafe;
    font-weight: 700;
    color: #1e40af;
}
.dre-total-row td {
    font-size: 0.9rem;
}

/* Ajustes para tabelas */
table thead th, table tbody td {
    padding: 10px 12px; /* Ajustar padding para mais espaço */
}

/* --- ESTILOS DRE ANALÍTICO (v89.1) --- */
.dre-section-title {
    background: #e2e8f0;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    color: #334155;
    padding: 10px 12px;
}
.dre-mae-row {
    cursor: pointer;
    font-weight: 600;
    background: #f8fafc;
    transition: background 0.2s ease;
}
.dre-mae-row:hover {
    background: #f0f4f8;
}
.dre-mae-row td {
    padding: 8px 12px;
}
.dre-mae-row td:first-child {
    padding-left: 15px;
}
.dre-toggle-icon {
    display: inline-block;
    width: 12px;
    text-align: center;
    margin-right: 5px;
    transition: transform 0.2s ease;
}
.dre-mae-row.expanded .dre-toggle-icon {
    transform: rotate(90deg);
}
.dre-sub-row {
    font-size: 0.85rem;
    color: #64748b;
    display: none; /* Escondido por padrão */
}
.dre-sub-row td {
    padding: 6px 12px;
}
.dre-sub-row td:first-child {
    padding-left: 30px;
}
.dre-indent {
    display: inline-block;
    width: 15px;
}
.dre-item-row {
    font-size: 0.75rem;
    color: #94a3b8;
    display: none; /* Escondido por padrão */
}
.dre-item-row td {
    padding: 4px 12px;
}
.dre-item-row td:first-child {
    padding-left: 45px;
}
.dre-indent-more {
    display: inline-block;
    width: 15px;
}
.dre-total-row {
    background: #dbeafe;
    font-weight: 700;
    color: #1e40af;
}
.dre-total-row td {
    font-size: 0.9rem;
    padding: 10px 12px;
}

/* Ajustes para gráficos */
.chart-container {
    position: relative;
    height: 120px; /* Altura padrão para gráficos */
    width: 100%;
    max-width: 300px; /* Limita a largura para torná-los mais compactos */
    margin: 0 auto; /* Centraliza o gráfico */
}

/* Override Chart.js default responsive behavior for fixed size */
#dreChart, #dreLineChart {
    max-width: 100%;
    height: 120px !important; /* Força a altura para ser compacta */
}

.chart-container {
    position: relative;
    width: 100%;
    max-width: 300px; /* Limita a largura máxima */
    height: 150px; /* Altura fixa para miniaturas */
    margin-bottom: 15px; /* Espaçamento entre os gráficos */
}
.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}
.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Ajustes para o DRE */
.dre-categoria-mae, .dre-subcategoria {
    cursor: pointer;
}
.dre-toggle-icon {
    transition: transform 0.2s ease;
}
.dre-toggle-icon.fa-caret-down {
    transform: rotate(90deg);
}
.dre-analitico-row {
    background-color: #f9fafb;
}
.dre-item-analitico td {
    font-size: 0.8em;
    color: #6b7280;
}
.dre-item-manual input[type="text"], .dre-item-manual input[type="number"] {
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.85rem;
    width: 100%;
}
.dre-item-manual input[type="number"] {
    text-align: right;
}

.chart-container {
    width: 280px; /* Largura fixa para gráficos */
    height: 150px; /* Altura fixa para gráficos */
    margin: 0 auto; /* Centralizar */
    position: relative; /* Necessário para Chart.js */
}

/* Ajustes para os cards que contêm os gráficos */
.stats-grid .card {
    flex: 0 0 auto; /* Não permitir que os cards cresçam */
    width: 300px; /* Largura do card que contém o gráfico */
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stats-grid .card h3 {
    text-align: center;
    width: 100%;
}

/* Sobrescrever estilos inline do dashboard.html se necessário */
#dreChart, #dreLineChart {
    max-width: 100% !important;
    max-height: 100% !important;
}

.chart-container {
    position: relative;
    width: 100%;
    height: 150px; /* Altura fixa para gráficos menores */
    margin: auto;
}
.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* BI Charts - Tamanho Compacto */
.chart-container {
    position: relative;
    width: 300px; /* Largura fixa para o gráfico */
    height: 150px; /* Altura fixa para o gráfico */
    margin: 0 auto; /* Centralizar */
    overflow: hidden; /* Garante que o conteúdo não transborde */
}

.chart-container canvas {
    max-width: 100%;
    max-height: 100%;
    display: block; /* Remove espaço extra abaixo do canvas */
}

/* ---------- SORTABLE TABLE HEADERS ---------- */
.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  white-space: nowrap;
}
.sortable:hover {
  background: rgba(37, 99, 235, 0.08);
}
.sort-icon {
  display: inline-block;
  margin-left: 4px;
  font-size: 0.7rem;
  color: var(--txt-sub);
  vertical-align: middle;
}
.sort-icon.asc::after {
  content: "▲";
  color: var(--accent);
}
.sort-icon.desc::after {
  content: "▼";
  color: var(--accent);
}

/* ---------- SYNC BANNER ---------- */
.sync-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 24px;
  margin-top: 20px;
  box-shadow: var(--shadow);
  gap: 20px;
}
.sync-banner__info h4 {
  margin: 0 0 4px 0;
  font-size: 0.95rem;
  color: var(--txt);
}
.sync-banner__info p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--txt-sub);
}
.btn--sync {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.btn--sync:hover {
  background: var(--accent-h);
}
.btn--sync:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.btn--sync .spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.btn--sync.syncing .spinner {
  display: inline-block;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- DRE v90 Styles --- */
.dre-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.dre-table th { background: var(--surface); border-bottom: 2px solid var(--border); padding: 8px 10px; text-align: left; white-space: nowrap; }
.dre-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.dre-table .dre-group-header td { background: #1e293b; color: #fff; padding: 10px; font-size: 0.92rem; }
.dre-table .dre-cat-mae td { background: #f8fafc; }
.dre-table .dre-cat-mae:hover td { background: #e2e8f0; }
.dre-table .dre-sub-cat td { background: #fefefe; color: #475569; }
.dre-table .dre-sub-cat:hover td { background: #f1f5f9; }
.dre-table .dre-item td { color: #64748b; font-size: 0.82rem; }
.dre-table .dre-item:hover td { background: #f8fafc; }
.dre-table .dre-toggle-icon { display: inline-block; width: 16px; font-size: 0.7rem; transition: transform 0.2s; margin-right: 4px; }

/* Modal styles */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-content { background: var(--surface); border-radius: var(--radius); padding: 24px; width: 90%; position: relative; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.modal-content .close { position: absolute; top: 12px; right: 16px; font-size: 1.5rem; cursor: pointer; color: #94a3b8; }
.modal-content .close:hover { color: #1e293b; }
.modal-content .field label { display: block; font-size: 0.8rem; font-weight: 600; color: #64748b; text-transform: uppercase; margin-bottom: 4px; }
.modal-content .field select,
.modal-content .field input[type="text"],
.modal-content .field input[type="number"],
.modal-content .field input[type="month"] { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.9rem; background: #fff; }

.btn--secondary { background: #f1f5f9; color: #334155; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; font-family: var(--font); font-weight: 600; font-size: 0.85rem; padding: 8px 16px; transition: var(--transition); }
.btn--secondary:hover { background: #e2e8f0; border-color: #cbd5e1; }

/* ============================================================
   DRE customizável — editor v91
   ============================================================ */
.dre-grupos-lista { display: flex; flex-direction: column; gap: 10px; }
.dre-grupo {
  border: 1px solid #e5e7eb; border-radius: 8px; background: #fff;
  padding: 10px; box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.dre-grupo-header {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px;
}
.dre-grupo-handle {
  cursor: grab; color: #9ca3af; font-weight: 700; padding: 4px 6px;
  user-select: none;
}
.dre-grupo-label {
  flex: 1; min-width: 220px; font-weight: 700; text-transform: uppercase;
  border: 1px solid #e5e7eb; border-radius: 6px; padding: 6px 8px;
}
.dre-grupo-sinal, .dre-grupo-tot {
  border: 1px solid #e5e7eb; border-radius: 6px; padding: 6px 8px; background: #fff;
}
.dre-categorias-lista {
  list-style: none; padding: 6px; margin: 0; min-height: 32px;
  background: #f9fafb; border: 1px dashed #e5e7eb; border-radius: 6px;
  display: flex; flex-direction: column; gap: 4px;
}
.dre-categoria {
  display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 6px;
  padding: 6px 8px; cursor: grab;
}
.dre-categoria input[type="text"] {
  flex: 1; border: none; outline: none; background: transparent; font-size: 0.95em;
}
.dre-cat-handle { color: #9ca3af; user-select: none; }
.sortable-ghost { opacity: 0.4; }
.sortable-chosen { background: #eff6ff; }


/* ══════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE — WePrime BPO
   Breakpoints: mobile < 768px, tablet 768–1024px
   ══════════════════════════════════════════════════════════════ */

/* ── Overlay para fechar sidebar no mobile ── */
#sidebarOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 999;
  backdrop-filter: blur(2px);
}
#sidebarOverlay.active { display: block; }

/* ── Botão hambúrguer — sempre visível ── */
#btnToggleSidebar {
  position: fixed !important;
  top: 14px !important;
  z-index: 1100 !important;
  transition: left .25s ease !important;
}

/* ── TABLET (768–1024px) ── */
@media (max-width: 1024px) {
  .sidebar {
    width: 220px !important;
  }
  .main {
    margin-left: 220px;
  }
  .layout--expanded .main {
    margin-left: 0;
  }
}

/* ── MOBILE (< 768px) ── */
@media (max-width: 768px) {

  /* Sidebar desliza por cima do conteúdo */
  .sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    height: 100dvh;
    width: 260px !important;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform .25s ease !important;
    overflow-y: auto;
  }
  .sidebar.open {
    transform: translateX(0) !important;
  }
  .sidebar--hidden {
    transform: translateX(-100%) !important;
  }

  /* Conteúdo ocupa tela inteira */
  .main {
    margin-left: 0 !important;
    padding: 56px 12px 80px !important;
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* Botão hambúrguer */
  #btnToggleSidebar {
    left: 12px !important;
    top: 12px !important;
    width: 36px !important;
    height: 36px !important;
    font-size: 18px !important;
  }

  /* Header do conteúdo */
  .page-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
  }
  .page-header h2 { font-size: 18px !important; margin-top: 4px; }

  /* Usuário no canto direito */
  .main__header {
    right: 12px !important;
    top: 12px !important;
  }

  /* Filtros em coluna */
  .filters, .form-grid {
    flex-direction: column !important;
    grid-template-columns: 1fr !important;
  }
  .filters > * { width: 100% !important; }

  /* Tabelas — scroll horizontal */
  .table-container {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  table {
    min-width: 600px;
  }
  .table-container table {
    font-size: 12px !important;
  }

  /* Cards em coluna */
  .stat-cards, [class*="grid-col"],
  [style*="display:grid"], [style*="display: grid"] {
    /* não forçar — pode quebrar layouts específicos */
  }

  /* Botões de ação menores */
  .btn--sm { font-size: 11px !important; padding: 4px 8px !important; }

  /* Modais — fullscreen no mobile */
  .modal-content {
    width: 96vw !important;
    max-width: 96vw !important;
    max-height: 92dvh !important;
    overflow-y: auto !important;
    margin: 4vh auto !important;
    border-radius: 12px !important;
  }
  .modal {
    align-items: flex-start !important;
    padding: 4vh 0 !important;
  }

  /* NF-e modal — abas em scroll horizontal */
  #nfeAbas {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    padding-bottom: 4px;
  }

  /* Ocultar colunas menos importantes em tabelas */
  .col-hide-mobile { display: none !important; }

  /* Botões de ação lado a lado */
  .page-header > div:last-child {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  /* Cards de totais */
  [class*="stat-card"] {
    padding: 10px 12px !important;
  }

  /* Bottom safe area para dispositivos com notch */
  .main { padding-bottom: calc(80px + env(safe-area-inset-bottom)) !important; }
}

/* ── MOBILE XS (< 400px) ── */
@media (max-width: 400px) {
  .sidebar { width: 240px !important; }
  .main { padding: 52px 8px 80px !important; }
  .btn { font-size: 12px !important; padding: 7px 10px !important; }
}


/* ══════════════════════════════════════════════════════════════
   PEDIDOS — KANBAN
   ══════════════════════════════════════════════════════════════ */

#pedidosArea { display:none; }

.pkb-board-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}
.pkb-board {
  display: grid;
  /* 7 colunas com largura mínima — scroll horizontal quando não couber */
  grid-template-columns: repeat(7, minmax(180px, 1fr));
  gap: 10px;
  padding: 4px 0 16px;
  min-height: 70vh;
  align-items: flex-start;
  min-width: calc(7 * 180px + 6 * 10px);
}

.pkb-col {
  min-width: 0;  /* permite encolher */
  position: relative; /* necessário para o handle de resize */
  background: var(--color-background-secondary, #f5f5f5);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 180px);
  transition: background .15s;
}
.pkb-col--drag-over { background: #e3f2fd !important; }

/* Handle de redimensionamento de coluna Kanban */
.pkb-col-resize {
  position: absolute;
  top: 0;
  right: -5px;
  width: 10px;
  height: 100%;
  cursor: col-resize;
  z-index: 10;
  border-radius: 5px;
}
.pkb-col-resize::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 32px;
  border-radius: 2px;
  background: transparent;
  transition: background .15s;
}
.pkb-col-resize:hover::after,
.pkb-col-resize--dragging::after {
  background: var(--color-primary, #2563eb);
}
.pkb-col-resize--dragging { cursor: col-resize; }

.pkb-col-header {
  padding: 10px 10px 8px;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 12px 12px 0 0;
  background: var(--color-background-secondary, #f5f5f5);
  position: sticky;
  top: 0;
  z-index: 1;
}
.pkb-col-count {
  background: rgba(0,0,0,.12);
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 11px;
}

.pkb-col-body {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pkb-add-btn {
  margin: 6px 8px 10px;
  padding: 7px;
  background: none;
  border: 2px dashed rgba(0,0,0,.15);
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--color-text-secondary, #666);
  transition: all .15s;
}
.pkb-add-btn:hover { background: rgba(0,0,0,.05); border-color: rgba(0,0,0,.3); }

.pkb-empty { font-size: 12px; opacity: .35; text-align: center; padding: 20px 0; }

/* Cards */
.pkb-card {
  background: var(--color-background-primary, #fff);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  transition: box-shadow .15s, transform .1s;
  border-left: 4px solid transparent;
  user-select: none;
}
.pkb-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.15); transform: translateY(-1px); }
.pkb-card--cinza     { border-left-color: #9e9e9e; background: #fafafa; }
.pkb-card--amarelo   { border-left-color: #f9a825; background: #fffde7; }
.pkb-card--vermelho  { border-left-color: #c62828; background: #fff5f5; }
.pkb-card--verde     { border-left-color: #2e7d32; background: #f1f8e9; }
.pkb-card--verde-escuro { border-left-color: #1b5e20; background: #e8f5e9; }
.pkb-card--roxo      { border-left-color: #6a1b9a; background: #f3e5f5; }

.pkb-card-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:6px; }
.pkb-card-num    { font-size:12px; font-weight:800; opacity:.6; font-family:monospace; }
.pkb-card-cliente{ font-size:14px; font-weight:700; margin-bottom:5px; line-height:1.3; }
.pkb-card-meta   { display:flex; justify-content:space-between; font-size:11px; opacity:.55; margin-bottom:3px; }
.pkb-card-valor  { font-weight:700; color:var(--color-primary, #2563eb); opacity:1 !important; }
.pkb-card-footer { display:flex; gap:10px; font-size:11px; opacity:.5; margin-top:6px; padding-top:6px; border-top:1px solid var(--color-border-tertiary, #eee); }

/* Badges */
.pkb-badge { font-size:10px; font-weight:700; padding:2px 6px; border-radius:4px; }
.pkb-badge--red    { background:#fce4ec; color:#c62828; }
.pkb-badge--yellow { background:#fff8e1; color:#f57f17; }
.pkb-badge--gray   { background:#f5f5f5; color:#757575; }

/* Pop-up in-app de notificações (desliza da direita, empilha) */
#notifPopupContainer {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 99999;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  pointer-events: none;
  max-width: 340px;
  width: calc(100vw - 40px);
}
.notif-popup {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.18), 0 0 0 1px rgba(0,0,0,.07);
  border-left: 4px solid #0F766E;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 14px;
  pointer-events: auto;
  cursor: pointer;
  animation: notifSlideIn .35s cubic-bezier(.21,1.02,.73,1) both;
  transition: box-shadow .15s;
}
.notif-popup:hover { box-shadow: 0 12px 40px rgba(0,0,0,.22), 0 0 0 1px rgba(0,0,0,.1); }
.notif-popup-icon    { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.notif-popup-content { flex: 1; min-width: 0; }
.notif-popup-titulo  { font-size: 13px; font-weight: 700; color: #1a1a1a; line-height: 1.3; }
.notif-popup-corpo   { font-size: 11.5px; color: #555; margin-top: 3px; line-height: 1.4; white-space: pre-line; }
.notif-popup-fechar  {
  background: none; border: none; cursor: pointer; font-size: 15px;
  opacity: .3; flex-shrink: 0; padding: 0 0 0 6px; line-height: 1; color: #333;
}
.notif-popup-fechar:hover { opacity: .65; }
.notif-popup-barra {
  position: absolute;
  bottom: 0; left: 4px; right: 0;
  height: 3px;
  background: #0F766E;
  border-radius: 0 0 0 8px;
  transform-origin: left;
  animation: notifBarra linear forwards;
}
@keyframes notifSlideIn {
  from { opacity: 0; transform: translateX(calc(100% + 30px)); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes notifSlideOut {
  from { opacity: 1; transform: translateX(0); max-height: 200px; margin-bottom: 0; }
  to   { opacity: 0; transform: translateX(calc(100% + 30px)); max-height: 0; margin-bottom: -10px; }
}
@keyframes notifBarra {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

/* Balão de ajuda do Kanban */
.pkb-ajuda-balloon {
  display: none;
  position: absolute;
  right: 0;
  top: 46px;
  z-index: 2000;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,.18);
  padding: 18px 20px;
  width: 370px;
  font-size: 12px;
  line-height: 1.6;
  color: #333;
}
.pkb-ajuda-balloon::before {
  content: '';
  position: absolute;
  top: -8px;
  right: 10px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-left: 1px solid #ddd;
  border-top: 1px solid #ddd;
  transform: rotate(45deg);
}
.pkb-ajuda-balloon h4 { margin: 0 0 10px; font-size: 13px; }
.pkb-ajuda-balloon .pkb-aj-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid #f0f0f0;
}
.pkb-ajuda-balloon .pkb-aj-row:last-child { border-bottom: none; }
.pkb-ajuda-balloon .pkb-aj-icon { font-size: 15px; min-width: 20px; text-align: center; margin-top: 1px; }
.pkb-ajuda-balloon .pkb-aj-label { font-weight: 700; }
.pkb-ajuda-balloon .pkb-aj-desc { opacity: .7; font-size: 11px; }
.pkb-ajuda-balloon .pkb-aj-arrow { font-size: 10px; opacity: .4; margin: 0 4px; }
.pkb-ajuda-drag-tip {
  margin-top: 12px;
  padding: 8px 10px;
  background: #f0f4ff;
  border-radius: 8px;
  font-size: 11px;
  color: #3949ab;
}

/* Mobile — scroll horizontal em vez de quebrar em linhas */
@media (max-width: 1024px) {
  .pkb-board {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 10px;
    min-width: max-content;
    overflow-x: visible; /* .pkb-board-wrap cuida do scroll */
  }
  .pkb-board .pkb-col {
    flex: 0 0 230px;
    min-width: 230px;
    max-height: 78vh;
  }
}
@media (max-width: 768px) {
  .pkb-board {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
    min-width: max-content;
    overflow-x: visible;
    padding-bottom: 20px;
  }
  .pkb-board .pkb-col {
    flex: 0 0 250px;
    min-width: 250px;
    max-height: 72vh;
  }
}

/* Card urgente */
.pkb-card--urgente {
  border-left-color: #c62828 !important;
  box-shadow: 0 0 0 2px rgba(198,40,40,.25), 0 2px 8px rgba(0,0,0,.1) !important;
  order: -1;
}
.pkb-col-body { display: flex; flex-direction: column; }

/* Card dúvidas */
.pkb-card--duvida {
  border-left-color: #c62828 !important;
  background: #fff5f5 !important;
}

/* Card cancelado */
.pkb-card--cancelado {
  border-left-color: #9e9e9e !important;
  background: #f0f0f0 !important;
  opacity: .78;
  position: relative;
}
.pkb-card--cancelado::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: repeating-linear-gradient(
    -45deg, transparent, transparent 8px, rgba(0,0,0,.035) 8px, rgba(0,0,0,.035) 16px
  );
  pointer-events: none;
  z-index: 0;
}
.pkb-card--cancelado > * { position: relative; z-index: 1; }
.pkb-badge--cancelado {
  background: #616161;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: .4px;
}

/* ── Autocomplete IBGE Municípios ─────────────────────────────────────────── */
.ibge-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 12px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid #f1f5f9;
  transition: background .1s;
}
.ibge-item:hover { background: #eff6ff; }
.ibge-item:last-child { border-bottom: none; }

/* ── Modal Faturar OS ─────────────────────────────────────────────────────── */
.os-fat-tab {
  padding: 8px 14px;
  border: none;
  border-bottom: 2.5px solid transparent;
  background: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  border-radius: 6px 6px 0 0;
  transition: all .15s;
  white-space: nowrap;
}
.os-fat-tab--active {
  color: #1e40af;
  border-bottom-color: #2563eb;
  background: #eff6ff;
}
.os-fat-tab:hover:not(.os-fat-tab--active) {
  background: #f8fafc;
  color: #334155;
}
.os-fat-lbl {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  margin-bottom: 4px;
  letter-spacing: .3px;
}
.os-fat-parc-btn {
  padding: 6px 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 6px;
  background: #f8fafc;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  transition: all .15s;
}
.os-fat-parc-btn--active {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}
.os-fat-parc-btn:hover:not(.os-fat-parc-btn--active) {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

/* ── Configurar NF-e de Saída ─────────────────────────── */
.csaida-tab {
  background:none; border:none; padding:8px 16px;
  font-size:13px; font-weight:600; color:#64748b;
  cursor:pointer; border-bottom:2px solid transparent; margin-bottom:-2px;
}
.csaida-tab--active { color:#2563eb; border-bottom-color:#2563eb; }
.csaida-tab:hover:not(.csaida-tab--active) { color:#374151; }

.csaida-item {
  border:1px solid #e5e7eb; border-radius:8px;
  margin-bottom:6px; overflow:hidden; background:#fff;
  transition: box-shadow .15s;
}
.csaida-item--sel { border-color:#3b82f6; background:#eff6ff; }
.csaida-item:hover { box-shadow:0 1px 5px rgba(0,0,0,.08); }

.csaida-item__row {
  display:flex; align-items:center; gap:10px;
  padding:8px 12px;
}
.csaida-item__desc { flex:1; min-width:0; }
.csaida-item__nome {
  display:block; font-size:13px; font-weight:600; color:#1e293b;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.csaida-item__ncm  { display:block; font-size:11px; color:#64748b; }
.csaida-item__qtd  { display:flex; align-items:center; gap:5px; }
.csaida-mini-input {
  padding:4px 6px; border:1px solid #d1d5db; border-radius:4px;
  font-size:13px; background:#fff;
}
.csaida-mini-input:focus { outline:none; border-color:#3b82f6; }
.csaida-expand-btn {
  width:28px; height:28px; border-radius:6px;
  border:1px solid #d1d5db; background:#f8fafc;
  cursor:pointer; font-size:14px; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
}
.csaida-expand-btn:hover { background:#e2e8f0; }

.csaida-item__exp {
  border-top:1px solid #e5e7eb;
  background:#f8fafc; padding:12px 14px;
}
.csaida-exp-grid {
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(135px,1fr));
  gap:10px; margin-bottom:12px;
}
.csaida-lbl { font-size:.72rem; font-weight:600; color:#64748b; text-transform:uppercase; letter-spacing:.04em; display:block; margin-bottom:4px; }
.csaida-difal-row { border-top:1px dashed #fde68a; padding-top:10px; }

.cs-tot-th { padding:7px 8px; border:1px solid #e2e8f0; text-align:right; white-space:nowrap; }
.cs-tot-td { padding:5px 8px; border:1px solid #e2e8f0; }
.cs-tot-r  { text-align:right; }

/* ============================================================
   DESIGN SYSTEM — Componentes globais (2026-07-29)
   Fills gaps: form-input, modal-header, form-label, select
   ============================================================ */

/* ── form-input: classe universal para <input> e <select> em modais ── */
.form-input {
  width: 100%;
  padding: 8px 11px;
  border: 1.5px solid #d1d5db;
  border-radius: 7px;
  font-family: var(--font);
  font-size: .875rem;
  line-height: 1.45;
  color: var(--txt);
  background: #fff;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15,118,110,.10);
}
.form-input::placeholder { color: #9ca3af; font-weight: 400; }
.form-input:disabled,
.form-input[readonly] {
  background: var(--bg);
  color: var(--txt-muted);
  cursor: not-allowed;
  opacity: .75;
}
select.form-input {
  cursor: pointer;
}

/* ── modal-header: cabeçalho padronizado dos 37 modais ── */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1.5px solid var(--border);
}
.modal-header h3,
.modal-header h4 {
  font-size: .95rem;
  font-weight: 700;
  color: var(--txt);
  margin: 0;
  letter-spacing: -.01em;
  line-height: 1.3;
}
/* close button dentro do modal-header: sai do fluxo absoluto */
.modal-header .close {
  position: static !important;
  top: auto !important;
  right: auto !important;
  flex-shrink: 0;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  color: #94a3b8;
  padding: 3px 7px;
  border-radius: 5px;
  transition: color .15s, background .15s;
}
.modal-header .close:hover { color: #1e293b; background: #e2e8f0; }

/* ── form-label: rótulo de campo padronizado ── */
.form-label {
  display: block;
  font-size: .72rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 5px;
  line-height: 1;
}

/* ── Melhorias em inputs/selects dentro de modal .field (selector existente) ── */
.modal-content .field select,
.modal-content .field input[type="text"],
.modal-content .field input[type="email"],
.modal-content .field input[type="number"],
.modal-content .field input[type="date"],
.modal-content .field input[type="month"],
.modal-content .field textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1.5px solid #d1d5db;
  border-radius: 7px;
  font-family: var(--font);
  font-size: .875rem;
  color: var(--txt);
  background: #fff;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.modal-content .field select:focus,
.modal-content .field input:focus,
.modal-content .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15,118,110,.10);
}
.modal-content .field label {
  font-size: .72rem !important;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 5px;
}

/* ── Melhora visual das tabelas (headers mais leves) ── */
thead th {
  background: #f8fafc;
  color: #64748b;
  font-size: .68rem;
  letter-spacing: .08em;
}

/* ── Scrollbar fina nos divs de scroll interno dos modais ── */
.modal-content > div::-webkit-scrollbar { width: 5px; }
.modal-content > div::-webkit-scrollbar-track { background: transparent; }
.modal-content > div::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
.modal-content > div::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
