/* ══════════════════════════════════════════════════════════════
   STYLE.CSS — Sistema Financeiro & RH 2026 — Completo
   Paleta, Tipografia, Componentes, Responsivo, Dark Mode
   Blocos 1-9
   ══════════════════════════════════════════════════════════════ */

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

:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: #e0e7ff;
  --success: #22c55e;
  --success-light: #dcfce7;
  --success-dark: #16a34a;
  --warning: #f59e0b;
  --warning-light: #fef9c3;
  --warning-dark: #ca8a04;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --danger-dark: #dc2626;
  --info: #3b82f6;
  --info-light: #dbeafe;
  --info-dark: #2563eb;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-sidebar: #1e1b4b;
  --bg-sidebar-hover: #312e81;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --border-focus: #6366f1;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.10), 0 4px 6px rgba(0,0,0,.05);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --sidebar-width: 260px;
  --header-height: 64px;
  --transition: all .2s ease;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --border: #334155;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.20);
  --shadow: 0 1px 3px rgba(0,0,0,.30), 0 1px 2px rgba(0,0,0,.20);
  --shadow-md: 0 4px 6px rgba(0,0,0,.25);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.30);
  --primary-light: #312e81;
  --success-light: #14532d;
  --warning-light: #422006;
  --danger-light: #450a0a;
  --info-light: #1e3a5f;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; min-height: 100vh; display: flex; overflow-x: hidden; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* ═══ SIDEBAR ═══ */
.sidebar { width: var(--sidebar-width); background: var(--bg-sidebar); color: #e0e7ff; height: 100vh; position: fixed; top: 0; left: 0; z-index: 100; display: flex; flex-direction: column; transition: transform .3s ease; overflow-y: auto; }
.sidebar-header { padding: 24px 20px 16px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar-header h2 { font-size: 18px; font-weight: 700; color: #fff; display: flex; align-items: center; gap: 10px; }
.sidebar-header h2 .logo-icon { font-size: 22px; }
.sidebar-header small { display: block; margin-top: 4px; font-size: 12px; color: #a5b4fc; font-weight: 400; }
.nav-links { list-style: none; padding: 12px 0; flex: 1; }
.nav-links li { margin: 2px 8px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-radius: var(--radius-sm); color: #c7d2fe; font-size: 14px; font-weight: 500; transition: var(--transition); cursor: pointer; text-decoration: none; }
.nav-link:hover { background: var(--bg-sidebar-hover); color: #fff; }
.nav-link.active { background: var(--primary); color: #fff; font-weight: 600; box-shadow: 0 2px 8px rgba(99,102,241,.4); }
.nav-icon { font-size: 18px; width: 24px; text-align: center; flex-shrink: 0; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.1); font-size: 11px; color: #818cf8; text-align: center; }

/* ═══ MAIN ═══ */
.main-content { flex: 1; margin-left: var(--sidebar-width); min-height: 100vh; display: flex; flex-direction: column; }
.top-bar { height: var(--header-height); background: var(--bg-card); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 28px; position: sticky; top: 0; z-index: 50; box-shadow: var(--shadow-sm); gap: 16px; }
.top-bar h1 { font-size: 20px; font-weight: 700; color: var(--text); flex: 1; }
.menu-toggle { display: none; background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text); padding: 4px; }
.header-right { display: flex; align-items: center; gap: 14px; }
.badge-alertas { background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; min-width: 24px; height: 24px; border-radius: 12px; display: flex; align-items: center; justify-content: center; padding: 0 6px; cursor: pointer; transition: var(--transition); }
.badge-alertas:hover { transform: scale(1.1); }
.badge-alertas.zero { background: var(--text-light); }
.theme-toggle { background: none; border: 1px solid var(--border); border-radius: var(--radius-sm); width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 18px; transition: var(--transition); color: var(--text); }
.theme-toggle:hover { background: var(--border); }
.data-hoje { font-size: 13px; color: var(--text-muted); font-weight: 500; }

/* ═══ LOGIN SCREEN ═══ */
.login-screen { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%); padding: 24px; }
.login-box { background: var(--bg-card); border-radius: 16px; padding: 40px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.3); text-align: center; }
.login-logo { font-size: 48px; margin-bottom: 12px; }
.login-box h2 { font-size: 24px; font-weight: 800; margin-bottom: 4px; color: var(--text); }
.login-subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 28px; }
.login-form { text-align: left; }
.login-field { margin-bottom: 16px; }
.login-field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.login-field input { width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; font-family: inherit; transition: var(--transition); background: var(--bg); color: var(--text); }
.login-field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.login-btn { width: 100%; padding: 12px; background: var(--primary); color: #fff; border: none; border-radius: var(--radius-sm); font-size: 15px; font-weight: 700; cursor: pointer; font-family: inherit; transition: var(--transition); margin-top: 4px; }
.login-btn:hover { background: var(--primary-hover); }
.login-btn:disabled { opacity: .6; cursor: not-allowed; }
.login-error { color: #ef4444; font-size: 13px; text-align: center; margin-top: 12px; min-height: 20px; }
.login-link { display: block; margin-top: 20px; font-size: 13px; color: var(--text-muted); text-decoration: none; }
.login-link:hover { color: var(--primary); }

/* ═══ EMPRESA SELECTOR ═══ */
.empresa-selector { flex-shrink: 0; }
.empresa-selector select { padding: 6px 28px 6px 12px; border: 2px solid var(--primary-light); border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; color: var(--primary); background: var(--bg-card); cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236366f1' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; font-family: inherit; max-width: 260px; }
.empresa-selector select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

/* ═══ LOGOUT ═══ */
.btn-logout { background: none; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px 12px; font-size: 12px; font-weight: 600; color: var(--text-muted); cursor: pointer; font-family: inherit; transition: var(--transition); }
.btn-logout:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-light); }

/* ═══ PAGES ═══ */
.page-container { padding: 28px; flex: 1; }
.page { display: none; animation: fadeIn .3s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ═══ TOOLBAR ═══ */
.page-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.toolbar-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: 10px; }
.input-search { width: 240px; padding: 8px 14px; }
.select-sm { width: auto; min-width: 140px; padding: 8px 12px; font-size: 13px; }
.filter-group { display: flex; gap: 4px; }
.btn-filter { background: transparent; border: 1px solid var(--border); color: var(--text-muted); }
.btn-filter.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ═══ KPI CARDS ═══ */
.kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 28px; }
.kpi-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); cursor: pointer; transition: var(--transition); display: flex; align-items: flex-start; gap: 16px; position: relative; overflow: hidden; }
.kpi-card::before { content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%; border-radius: 4px 0 0 4px; }
.kpi-card.kpi-funcionarios::before { background: var(--primary); }
.kpi-card.kpi-banco-horas::before { background: var(--info); }
.kpi-card.kpi-despesas::before { background: var(--warning); }
.kpi-card.kpi-extras::before { background: var(--success); }
.kpi-card.kpi-dividas::before { background: var(--danger); }
.kpi-card.kpi-alertas::before { background: #f97316; }
.kpi-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.kpi-icon { width: 48px; height: 48px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.kpi-funcionarios .kpi-icon { background: var(--primary-light); }
.kpi-banco-horas .kpi-icon { background: var(--info-light); }
.kpi-despesas .kpi-icon { background: var(--warning-light); }
.kpi-extras .kpi-icon { background: var(--success-light); }
.kpi-dividas .kpi-icon { background: var(--danger-light); }
.kpi-alertas .kpi-icon { background: #fff7ed; }
[data-theme="dark"] .kpi-alertas .kpi-icon { background: #431407; }
.kpi-info { flex: 1; min-width: 0; }
.kpi-label { display: block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); margin-bottom: 4px; }
.kpi-value { display: block; font-size: 28px; font-weight: 800; line-height: 1.1; color: var(--text); }
.kpi-sub { display: block; font-size: 12px; color: var(--text-muted); margin-top: 4px; font-weight: 400; }

/* ═══ SECTIONS ═══ */
.section-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 28px; }
.section-box { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.section-box.full-width { grid-column: 1 / -1; }
.section-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.section-title .icon { font-size: 18px; }

/* ═══ ALERTS ═══ */
.alerts-list { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow-y: auto; }
.alert-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--radius-sm); cursor: pointer; transition: var(--transition); font-size: 14px; }
.alert-item:hover { transform: translateX(4px); }
.alert-item.critico { background: var(--danger-light); color: var(--danger-dark); border-left: 3px solid var(--danger); }
.alert-item.atencao { background: var(--warning-light); color: var(--warning-dark); border-left: 3px solid var(--warning); }
.alert-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.critico .alert-dot { background: var(--danger); }
.atencao .alert-dot { background: var(--warning); }
.alert-empty { text-align: center; padding: 20px; color: var(--text-muted); font-size: 14px; }

/* ═══ STATUS ANO ═══ */
.status-ano-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.mes-status { text-align: center; padding: 12px 8px; border-radius: var(--radius-sm); background: var(--bg); border: 1px solid var(--border); transition: var(--transition); }
.mes-status:hover { transform: scale(1.05); box-shadow: var(--shadow-sm); }
.mes-nome { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; color: var(--text-muted); margin-bottom: 4px; }
.mes-icone { font-size: 20px; }
.mes-status.lancado { border-color: var(--success); background: var(--success-light); }
.mes-status.parcial { border-color: var(--warning); background: var(--warning-light); }

/* ═══ CHART ═══ */
.chart-container { position: relative; height: 280px; }
.chart-container canvas { max-height: 100%; }

/* ═══ BH LIST (Dashboard) ═══ */
.bh-list { display: flex; flex-direction: column; gap: 12px; }
.bh-item { display: flex; align-items: center; gap: 14px; }
.bh-nome { width: 140px; font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; }
.bh-bar-wrap { flex: 1; height: 20px; background: var(--bg); border-radius: 10px; overflow: hidden; position: relative; border: 1px solid var(--border); }
.bh-bar { height: 100%; border-radius: 10px; transition: width .5s ease; min-width: 2px; }
.bh-bar.positivo { background: linear-gradient(90deg, var(--success), #4ade80); }
.bh-bar.negativo { background: linear-gradient(90deg, var(--danger), #f87171); }
.bh-bar.zero { background: var(--text-light); width: 2px !important; }
.bh-saldo { width: 80px; font-size: 13px; font-weight: 700; text-align: right; flex-shrink: 0; }
.bh-saldo.positivo { color: var(--success-dark); }
.bh-saldo.negativo { color: var(--danger-dark); }
.bh-saldo.zero { color: var(--text-muted); }
.bh-empty { text-align: center; padding: 20px; color: var(--text-muted); font-size: 13px; }

/* ═══ BADGES ═══ */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; letter-spacing: .3px; text-transform: uppercase; }
.badge-ativo, .badge-pago { background: var(--success-light); color: var(--success-dark); }
.badge-pendente { background: var(--warning-light); color: var(--warning-dark); }
.badge-atrasado, .badge-inativo { background: var(--danger-light); color: var(--danger-dark); }
.badge-ferias { background: var(--warning-light); color: var(--warning-dark); }
.badge-afastado { background: var(--info-light); color: var(--info-dark); }
.badge-gerado { background: var(--info-light); color: var(--info-dark); }
.badge-enviado { background: var(--success-light); color: var(--success-dark); }
.badge-falha { background: var(--danger-light); color: var(--danger-dark); }
.badge-normal { background: var(--success-light); color: var(--success-dark); }
.badge-falta { background: var(--danger-light); color: var(--danger-dark); }
.badge-atestado { background: var(--info-light); color: var(--info-dark); }
.badge-folga, .badge-feriado { background: var(--warning-light); color: var(--warning-dark); }
.badge-aprovado { background: var(--success-light); color: var(--success-dark); }
.badge-comum { background: var(--info-light); color: var(--info-dark); }
.badge-especial { background: var(--warning-light); color: var(--warning-dark); }

/* ═══ BUTTONS ═══ */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; font-family: 'Inter', sans-serif; cursor: pointer; transition: var(--transition); border: none; text-decoration: none; white-space: nowrap; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 4px 12px rgba(99,102,241,.3); }
.btn-secondary { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--bg); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #16a34a; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-xs { padding: 4px 10px; font-size: 11px; }
.btn-icon { width: 32px; height: 32px; padding: 0; justify-content: center; border-radius: var(--radius-xs); font-size: 14px; }

/* ═══ FORMS ═══ */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .3px; color: var(--text-muted); margin-bottom: 6px; }
.form-input, .form-select, textarea.form-input { width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; font-family: 'Inter', sans-serif; color: var(--text); background: var(--bg-card); transition: var(--transition); }
.form-input:focus, .form-select:focus, textarea.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.form-input::placeholder { color: var(--text-light); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.form-check input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); }
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .form-input, .inline-form .form-select { width: auto; min-width: 120px; }
.cfg-form { max-width: 600px; }
.form-error { border-color: var(--danger) !important; }
.form-error-msg { font-size: 11px; color: var(--danger); margin-top: 4px; }

/* ═══ TABLES ═══ */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th { background: var(--bg); padding: 12px 16px; text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--text); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(99,102,241,.03); }
[data-theme="dark"] tbody tr:hover { background: rgba(99,102,241,.08); }
td .btn-xs { margin: 0 2px; }

/* ═══ DRAWER ═══ */
.drawer-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,.4); z-index: 200; animation: fadeIn .2s ease; }
.drawer-overlay.open { display: block; }
.drawer { position: fixed; top: 0; right: -520px; width: 520px; max-width: 92vw; height: 100vh; background: var(--bg-card); z-index: 201; box-shadow: -4px 0 20px rgba(0,0,0,.15); transition: right .3s ease; display: flex; flex-direction: column; }
.drawer.open { right: 0; }
.drawer-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.drawer-header h3 { font-size: 18px; font-weight: 700; }
.drawer-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-muted); padding: 4px; }
.drawer-close:hover { color: var(--danger); }
.drawer-body { flex: 1; overflow-y: auto; padding: 24px; }
.drawer-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 12px; justify-content: flex-end; }

/* ═══ MODAL ═══ */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,.5); z-index: 300; display: flex; align-items: center; justify-content: center; animation: fadeIn .2s ease; }
.modal-box { background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow-lg); width: 480px; max-width: 90vw; max-height: 80vh; overflow-y: auto; }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-body { padding: 24px; }

/* ═══ TABS ═══ */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tab { padding: 10px 18px; font-size: 13px; font-weight: 600; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap; transition: var(--transition); background: none; border-top: none; border-left: none; border-right: none; font-family: 'Inter', sans-serif; }
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ═══ FUNC GRID (Bloco 2) ═══ */
.func-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; }
.func-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); transition: var(--transition); }
.func-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.func-card-header { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.func-avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--primary-light); display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700; color: var(--primary); flex-shrink: 0; }
.func-card-name { font-size: 15px; font-weight: 700; color: var(--text); }
.func-card-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.func-card-details { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; line-height: 1.8; }
.func-card-details strong { color: var(--text); font-weight: 600; }
.func-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ═══ BH SALDO GRID (Bloco 3) ═══ */
.bh-saldo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.bh-saldo-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; display: flex; align-items: center; gap: 14px; }
.bh-saldo-info { flex: 1; }
.bh-saldo-name { font-size: 14px; font-weight: 600; color: var(--text); }
.bh-saldo-empresa { font-size: 11px; color: var(--text-muted); }
.bh-saldo-value { font-size: 20px; font-weight: 800; }
.bh-saldo-value.positivo { color: var(--success-dark); }
.bh-saldo-value.negativo { color: var(--danger-dark); }
.bh-saldo-value.zero { color: var(--text-muted); }
.bh-saldo-detail { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ═══ DESP TOTAIS ═══ */
.desp-totais { padding: 16px 0 0; display: flex; gap: 20px; justify-content: flex-end; font-size: 14px; font-weight: 600; }
.desp-totais span { color: var(--text-muted); }
.desp-totais strong { color: var(--text); }

/* ═══ HOL TOTAIS ═══ */
.hol-totais { padding: 16px 0 0; display: flex; gap: 24px; flex-wrap: wrap; font-size: 13px; }
.hol-totais .hol-stat, .pag-totais .hol-stat { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 16px; }
.hol-totais .hol-stat-label, .pag-totais .hol-stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; }
.hol-totais .hol-stat-value, .pag-totais .hol-stat-value { font-size: 18px; font-weight: 700; color: var(--text); }

/* ═══ DIVIDAS GRID (Bloco 8) ═══ */
.dividas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); gap: 20px; }
.divida-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.divida-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.divida-devedor { font-size: 18px; font-weight: 700; color: var(--text); }
.divida-desc { font-size: 13px; color: var(--text-muted); }
.divida-progress { margin: 16px 0; }
.divida-progress-info { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.divida-parcelas { margin-top: 16px; display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow-y: auto; }
.divida-parcela { display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 8px 12px; border-radius: var(--radius-xs); background: var(--bg); }
.divida-parcela.paga { opacity: .7; }
.divida-actions { margin-top: 16px; display: flex; gap: 8px; }

/* ═══ WHATSAPP ═══ */
.wpp-status-box { display: flex; align-items: center; gap: 16px; padding: 16px; }
.wpp-status-indicator { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.wpp-status-indicator::before { content: ''; width: 12px; height: 12px; border-radius: 50%; background: var(--danger); display: inline-block; }
.wpp-status-indicator.connected::before { background: var(--success); }
.wpp-progress { margin-top: 16px; display: flex; align-items: center; gap: 12px; }
.wpp-progress .progress-bar { flex: 1; }

/* ═══ PROGRESS BAR ═══ */
.progress-bar { width: 100%; height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; border: 1px solid var(--border); }
.progress-fill { height: 100%; border-radius: 4px; transition: width .5s ease; background: linear-gradient(90deg, var(--primary), #818cf8); }
.progress-fill.success { background: linear-gradient(90deg, var(--success), #4ade80); }

/* ═══ AUDIT TIMELINE ═══ */
.audit-timeline { display: flex; flex-direction: column; gap: 8px; max-height: 500px; overflow-y: auto; }
.audit-entry { display: flex; gap: 12px; padding: 12px; border-radius: var(--radius-sm); background: var(--bg); border-left: 3px solid var(--primary); font-size: 13px; }
.audit-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; min-width: 120px; }
.audit-op { font-weight: 600; color: var(--text); }
.audit-detail { color: var(--text-muted); flex: 1; word-break: break-word; }
.audit-entry.INSERT { border-left-color: var(--success); }
.audit-entry.UPDATE { border-left-color: var(--info); }
.audit-entry.DELETE { border-left-color: var(--danger); }

/* ═══ REL PANELS ═══ */
.rel-panel { display: none; }
.rel-panel.active { display: block; }
.cfg-panel { display: none; }
.cfg-panel.active { display: block; }

/* ═══ RESUMO ANUAL ═══ */
.resumo-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.resumo-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; text-align: center; }
.resumo-card-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; font-weight: 600; }
.resumo-card-value { font-size: 22px; font-weight: 800; color: var(--text); margin-top: 4px; }

/* ═══ TOAST ═══ */
.toast-container { position: fixed; top: 80px; right: 24px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 20px; box-shadow: var(--shadow-lg); font-size: 14px; display: flex; align-items: center; gap: 10px; animation: slideIn .3s ease; max-width: 400px; }
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); }
@keyframes slideIn { from { opacity: 0; transform: translateX(100px); } to { opacity: 1; transform: translateX(0); } }

/* ═══ LOADING ═══ */
.loading { display: flex; align-items: center; justify-content: center; padding: 40px; color: var(--text-muted); gap: 10px; }
.spinner { width: 20px; height: 20px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══ EMPTY STATE ═══ */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 48px; opacity: .4; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,.3); }
  .main-content { margin-left: 0; }
  .menu-toggle { display: flex; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .section-grid { grid-template-columns: 1fr; }
  .status-ano-grid { grid-template-columns: repeat(4, 1fr); }
  .func-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .page-container { padding: 16px; }
  .top-bar { padding: 0 16px; }
  .top-bar h1 { font-size: 16px; }
  .data-hoje { display: none; }
  .kpi-grid { grid-template-columns: 1fr; gap: 12px; }
  .kpi-value { font-size: 22px; }
  .status-ano-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .chart-container { height: 220px; }
  .drawer { width: 100%; max-width: 100vw; }
  .page-toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-left, .toolbar-right { flex-wrap: wrap; }
  .input-search { width: 100%; }
  .dividas-grid { grid-template-columns: 1fr; }
}

/* ═══ SCROLLBAR ═══ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
.sidebar-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,.5); z-index: 99; }
.sidebar-overlay.active { display: block; }

/* ═══ DRAWER TABS ═══ */
.drawer-tabs { display: flex; gap: 2px; margin-bottom: 16px; border-bottom: 2px solid var(--border); }
.drawer-tab { padding: 8px 16px; font-size: 13px; font-weight: 600; color: var(--text-muted); cursor: pointer; border: none; background: none; border-bottom: 2px solid transparent; margin-bottom: -2px; font-family: 'Inter', sans-serif; }
.drawer-tab:hover { color: var(--primary); }
.drawer-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.drawer-tab-content { display: none; }
.drawer-tab-content.active { display: block; }

/* ═══ MISC ═══ */
.text-success { color: var(--success-dark); }
.text-danger { color: var(--danger-dark); }
.text-warning { color: var(--warning-dark); }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.gap-2 { gap: 8px; }

/* ─── PAGAMENTOS — Saldo a Pagar Cards ─────────────────── */
.pag-saldo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-bottom: 16px; }
.pag-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; transition: box-shadow .2s; }
.pag-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.pag-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 14px; }
.pag-card-body { display: flex; flex-direction: column; gap: 6px; }
.pag-line { display: flex; justify-content: space-between; font-size: 13px; padding: 2px 0; }
.pag-line.pag-total { border-top: 2px solid var(--primary); margin-top: 6px; padding-top: 8px; font-size: 15px; }
.pag-totais { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.text-warning { color: var(--warning); }
.text-success { color: var(--success); }
@media (max-width: 480px) { .pag-saldo-grid { grid-template-columns: 1fr; } }

/* ─── TERCEIRIZADOS — KPI Cards ───────────────────────────── */
.terc-kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.terc-kpi-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); display: flex; align-items: flex-start; gap: 14px; position: relative; overflow: hidden; transition: var(--transition); }
.terc-kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.terc-kpi-card::before { content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%; border-radius: 4px 0 0 4px; }
.terc-kpi-card.terc-kpi-total::before { background: var(--primary); }
.terc-kpi-card.terc-kpi-pago::before { background: var(--success); }
.terc-kpi-card.terc-kpi-pendente::before { background: var(--warning); }
.terc-kpi-card.terc-kpi-anual::before { background: var(--info); }
.terc-kpi-icon { width: 44px; height: 44px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.terc-kpi-total .terc-kpi-icon { background: var(--primary-light); }
.terc-kpi-pago .terc-kpi-icon { background: var(--success-light); }
.terc-kpi-pendente .terc-kpi-icon { background: var(--warning-light); }
.terc-kpi-anual .terc-kpi-icon { background: var(--info-light); }
.terc-kpi-info { flex: 1; min-width: 0; }
.terc-kpi-label { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); margin-bottom: 4px; }
.terc-kpi-value { display: block; font-size: 22px; font-weight: 800; line-height: 1.2; color: var(--text); }
.terc-kpi-sub { display: block; font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ─── TERCEIRIZADOS — Totais ──────────────────────────────── */
.terc-totais { padding: 16px 0 0; display: flex; gap: 20px; justify-content: flex-end; font-size: 14px; font-weight: 600; }
.terc-totais span { color: var(--text-muted); }
.terc-totais strong { color: var(--text); }

/* ─── TERCEIRIZADOS — Fornecedor Grid ─────────────────────── */
.terc-fornecedor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.terc-forn-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 18px; transition: var(--transition); }
.terc-forn-card:hover { box-shadow: var(--shadow-sm); border-color: var(--primary); }
.terc-forn-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 14px; }
.terc-forn-valor { font-size: 22px; font-weight: 800; color: var(--text); }
.terc-forn-pct { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

/* ─── TERCEIRIZADOS — Fornecedor Modal Items ──────────────── */
.terc-forn-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px; transition: var(--transition); }
.terc-forn-item:hover { border-color: var(--primary); background: rgba(99,102,241,.03); }
.terc-forn-item.inativo { opacity: .5; }
.terc-forn-item-info { flex: 1; }
.terc-forn-item-info strong { display: block; font-size: 14px; color: var(--text); }
.terc-forn-item-info small { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.terc-forn-item-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ─── TERCEIRIZADOS — Responsive ──────────────────────────── */
@media (max-width: 1024px) { .terc-kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .terc-kpi-grid { grid-template-columns: 1fr; } .terc-fornecedor-grid { grid-template-columns: 1fr; } }
