/* ============== Base ============== */
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select { font: inherit; outline: none; }
svg { width: 18px; height: 18px; stroke-linecap: round; stroke-linejoin: round; }

:root {
  --bg: #e4e9f1;
  --surface: #ffffff;
  --border: rgba(20,30,60,.17);
  --text: #1c2340;
  --text-dim: #7a7566;
  --muted: #a49c88;
  --primary: #1e2846;
  --primary-dark: #151d33;
  --success: #4e7a52;
  --warning: #c1902f;
  --danger: #b4432e;
  --sidebar-bg: #faf8f2;
  --sidebar-active: #f1e4de;
  --sidebar-text: #4a4636;
  --sidebar-text-active: #1e2846;
  --sidebar-muted: #a49c88;
  --sidebar-border: #ece5d5;
  --shadow-sm: 0 1px 2px rgba(20,26,48,.06), 0 3px 8px rgba(20,26,48,.07);
  --shadow: 0 2px 5px rgba(20,26,48,.06), 0 10px 26px rgba(20,26,48,.11);
  --card-border: rgba(20,30,60,.14);
  --radius: 12px;
}

/* ============== Layout ============== */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px;
  border-bottom: 1px solid var(--sidebar-border);
}
.brand-logo {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: grid; place-items: center;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .3px;
}
.brand-logo img { width: 100%; height: 100%; object-fit: contain; padding: 4px; display: block; }
.brand-logo.has-logo { background: var(--surface); border: 1px solid var(--sidebar-border); }
.brand-name { color: var(--sidebar-text-active); font-weight: 700; font-size: 15px; letter-spacing: .2px; }
.brand-name .brand-kana { color: var(--sidebar-muted); font-weight: 500; font-size: 12px; margin-left: 6px; }
.brand-tag { color: var(--sidebar-muted); font-size: 11px; margin-top: 2px; }

.sidebar-credit {
  text-align: center;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .2px;
  color: var(--sidebar-muted);
  margin-top: 12px;
}

.nav {
  flex: 1; min-height: 0; overflow-y: auto; padding: 12px 12px; display: flex; flex-direction: column; gap: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(28,35,64,.15) transparent;
}
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-track { background: transparent; }
.nav::-webkit-scrollbar-thumb { background: rgba(28,35,64,.15); border-radius: 3px; }
.nav::-webkit-scrollbar-thumb:hover { background: rgba(28,35,64,.25); }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-radius: 8px;
  color: var(--sidebar-text);
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  position: relative;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--sidebar-active); color: var(--sidebar-text-active); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(180,67,46,.22), rgba(180,67,46,.04));
  color: var(--sidebar-text-active);
  box-shadow: inset 3px 0 0 var(--danger);
}
.nav-item .badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}
.nav-item .badge:empty, .nav-item .badge[data-zero] { display: none; }
.nav-item-disabled { color: var(--sidebar-muted); cursor: not-allowed; }
.nav-item-disabled:hover { background: none; color: var(--sidebar-muted); }
.nav-item-soon {
  margin-left: auto;
  background: var(--sidebar-active);
  color: var(--sidebar-muted);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
}

.sidebar-footer { padding: 16px; padding-bottom: 20px; border-top: 1px solid var(--sidebar-border); flex-shrink: 0; }
.sidebar-back-link {
  display: block;
  margin-top: 12px;
  color: var(--sidebar-muted);
  font-size: 12px;
  font-weight: 500;
  text-align: center;
}
.sidebar-back-link:hover { color: var(--sidebar-text-active); }
.user-card { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 13px;
}
.user-name { color: var(--sidebar-text-active); font-size: 13px; font-weight: 600; }
.user-role { color: var(--sidebar-muted); font-size: 11px; }

/* ============== Main ============== */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.page-title { font-size: 20px; font-weight: 700; color: var(--text); }
.top-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg);
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: border-color .15s;
  width: 320px;
}
.search:focus-within { border-color: var(--primary); background: #fff; }
.search svg { color: var(--text-dim); }
.search input { border: none; background: none; flex: 1; }
.icon-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: grid; place-items: center;
  color: var(--text-dim);
  transition: all .15s;
  position: relative;
}
.icon-btn:hover { background: var(--bg); color: var(--text); }
.notif-btn-wrap { position: relative; }
.notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px; background: var(--danger);
  border-radius: 50%; border: 2px solid #fff;
  display: none;
}
.notif-dot.show { display: block; }
.notif-badge {
  position: absolute; top: 2px; right: 2px;
  min-width: 18px; height: 18px; padding: 0 4px;
  background: var(--danger); color: #fff;
  border-radius: 9px; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface);
  line-height: 1;
}
.notif-badge[data-zero] { display: none; }

/* Notif dropdown */
.notif-dropdown {
  display: none;
  position: fixed;
  z-index: 1100;
  width: 340px;
  max-height: 80vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  overflow-x: hidden;
  overflow-y: auto;
  flex-direction: column;
}
.notif-dropdown.show { display: flex; }
.notif-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.notif-count {
  background: var(--primary); color: #fff;
  border-radius: 9px; font-size: 11px; font-weight: 700;
  min-width: 20px; height: 20px; padding: 0 6px;
  display: flex; align-items: center; justify-content: center;
}
.notif-body { overflow-y: auto; max-height: 300px; }
.notif-empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 13px; }
.notif-item {
  display: flex; align-items: flex-start; gap: 10px;
  width: 100%; text-align: left;
  padding: 10px 16px;
  border: none; background: none;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--hover); }
.notif-item.notif-red .notif-icon { color: var(--danger); }
.notif-item.notif-amber .notif-icon { color: #f59e0b; }
.notif-item.notif-yellow .notif-icon { color: #eab308; }
.notif-item.notif-blue .notif-icon { color: var(--danger); }
.notif-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.notif-title { font-size: 13px; font-weight: 600; color: var(--text); }
.notif-desc { font-size: 11px; color: var(--muted); margin-top: 2px; }
.notif-arrow {
  margin-left: auto;
  flex-shrink: 0;
  color: var(--muted);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity .15s, transform .15s;
}
.notif-arrow svg { width: 14px; height: 14px; }
.notif-item:hover .notif-arrow {
  opacity: 1;
  transform: translateX(0);
}
.notif-foot { padding: 10px 16px; font-size: 11px; text-align: center; border-top: 1px solid var(--border); }

/* ---- Ana — Painel de Cobranças ---- */
.ana-secao {
  border-top: 2px solid #7c3aed;
  padding: 12px 14px 14px;
  background: linear-gradient(135deg, #faf5ff 0%, #f5f3ff 100%);
}
.ana-header {
  display: flex; align-items: center; gap: 6px; margin-bottom: 8px;
}
.ana-logo {
  font-size: 13px; font-weight: 700; color: #7c3aed; letter-spacing: .5px; flex: 1;
}
.ana-tagline { font-size: 11px; color: #a78bfa; }
.ana-status { font-size: 11px; color: #7c3aed; }
.ana-btn-secundario {
  background: none; border: none; cursor: pointer; color: #a78bfa;
  font-size: 14px; padding: 2px 5px; border-radius: 4px; line-height: 1;
}
.ana-btn-secundario:hover { background: #ede9fe; color: #7c3aed; }
.ana-btn-analisar {
  width: 100%; padding: 9px 0; border: 1.5px dashed #a78bfa; background: #ede9fe;
  color: #6d28d9; font-size: 12px; font-weight: 600; border-radius: 8px;
  cursor: pointer; transition: background .15s;
}
.ana-btn-analisar:hover { background: #ddd6fe; }
.ana-loading {
  display: flex; align-items: center; gap: 8px; color: #7c3aed; font-size: 12px; padding: 4px 0;
}
.ana-spinner {
  width: 14px; height: 14px; border: 2px solid #ddd6fe; border-top-color: #7c3aed;
  border-radius: 50%; animation: spin .7s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.ana-resumo {
  font-size: 11px; color: #6d28d9; background: #ede9fe;
  border-radius: 6px; padding: 6px 10px; margin-bottom: 8px; line-height: 1.4;
}
.ana-cards { display: flex; flex-direction: column; gap: 7px; }
.ana-card {
  background: #fff; border-radius: 8px; padding: 9px 11px;
  border-left: 3px solid #a78bfa; box-shadow: 0 1px 3px rgba(124,58,237,.08);
}
.ana-card-alta { border-left-color: #dc2626; }
.ana-card-media { border-left-color: #f59e0b; }
.ana-card-baixa { border-left-color: #10b981; }
.ana-card-sem-resp { border-left-color: #64748b; border-style: dashed; }
.ana-card-head {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px;
}
.ana-card-head strong { font-size: 12px; color: var(--text); }
.ana-badge {
  font-size: 10px; background: #ede9fe; color: #6d28d9;
  border-radius: 10px; padding: 1px 7px; font-weight: 600;
}
.ana-card-msg { font-size: 11px; color: var(--text-dim); line-height: 1.5; }
.ana-erro { font-size: 11px; color: var(--danger); padding: 4px 0; }
.ana-vazio { font-size: 12px; color: #10b981; text-align: center; padding: 8px 0; }

/* ---- Ana — FAB + painel flutuante ---- */
.ana-fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 1200;
  display: flex; align-items: center; gap: 6px;
  padding: 12px 18px; border: none; border-radius: 999px;
  background: linear-gradient(135deg, #7c3aed, #a78bfa); color: #fff;
  font-size: 13px; font-weight: 700; letter-spacing: .3px;
  box-shadow: 0 6px 20px rgba(124,58,237,.35); cursor: pointer;
  transition: box-shadow .15s, transform .15s;
}
.ana-fab:hover { box-shadow: 0 8px 26px rgba(124,58,237,.45); transform: translateY(-1px); }
.ana-flutuante {
  position: fixed; right: 24px; bottom: 88px; z-index: 1200;
  width: 340px; max-height: 70vh;
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,.18);
  overflow: hidden;
}
.ana-flutuante-topo { display: flex; justify-content: flex-end; padding: 6px 6px 0; flex-shrink: 0; }
.ana-flutuante-close {
  background: none; border: none; cursor: pointer; color: #a78bfa;
  font-size: 18px; line-height: 1; padding: 2px 8px; border-radius: 4px;
}
.ana-flutuante-close:hover { background: #ede9fe; color: #7c3aed; }
.ana-flutuante-body { overflow-y: auto; }

.content { flex: 1; padding: 28px; }
.view { display: none; }
.view.active { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ============== Cards / KPI ============== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}
.kpi {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--card-border);
  border-left: 4px solid transparent;
  position: relative;
  overflow: hidden;
}
.kpi-blue { border-left-color: var(--primary); }
.kpi-green { border-left-color: var(--success); }
.kpi-amber { border-left-color: var(--warning); }
.kpi-red { border-left-color: var(--danger); }
.kpi-purple { border-left-color: #8b5cf6; }
.kpi-teal { border-left-color: #14b8a6; }
.kpi-label { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-dim); font-weight: 600; }
.kpi-value { font-size: 30px; font-weight: 700; margin: 8px 0 4px; color: var(--text); }
.kpi-foot { font-size: 12px; color: var(--text-dim); }
.kpi[data-view] { cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
.kpi[data-view]:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,.10); }

.card {
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 22px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 15px; font-weight: 700; }
.muted { color: var(--text-dim); font-size: 12px; }
.link { color: var(--primary); font-size: 13px; font-weight: 500; cursor: pointer; }
.link:hover { text-decoration: underline; }

.grid-2 { display: grid; grid-template-columns: 1.2fr 1fr; gap: 18px; margin-bottom: 18px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* ============== Bar Chart ============== */
.bar-chart { display: flex; flex-direction: column; gap: 14px; overflow: hidden; }
.bar-row { display: flex; align-items: center; gap: 12px; max-width: 100%; }
.bar-label {
  width: 130px; flex-shrink: 0;
  font-size: 13px; color: var(--text); font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bar-track { flex: 1 1 auto; min-width: 0; height: 10px; background: var(--bg); border-radius: 6px; overflow: hidden; }
.bar-fill {
  height: 100%;
  max-width: 100%;
  background: linear-gradient(90deg, var(--primary), #60a5fa);
  border-radius: 6px;
  transition: width .6s cubic-bezier(.4,0,.2,1);
}
.bar-value {
  flex-shrink: 0;
  min-width: 82px;
  text-align: right;
  font-size: 13px; font-weight: 600; color: var(--text-dim);
  white-space: nowrap;
}

/* ============== Alerts ============== */
.alert-list { display: flex; flex-direction: column; gap: 10px; max-height: 360px; overflow-y: auto; }
.alert-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px;
  border-radius: 10px;
  background: var(--bg);
  border-left: 3px solid transparent;
}
.alert-item[data-view] { cursor: pointer; transition: filter .15s ease, transform .15s ease; }
.alert-item[data-view]:hover { filter: brightness(.96); transform: translateX(2px); }
.alert-item.red { border-color: var(--danger); background: #fef2f2; }
.alert-item.amber { border-color: var(--warning); background: #fffbeb; }
.alert-item.yellow { border-color: #eab308; background: #fefce8; }
.alert-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: grid; place-items: center;
  flex-shrink: 0;
  font-weight: 700;
}
.alert-item.red .alert-icon { background: #fecaca; color: #b91c1c; }
.alert-item.amber .alert-icon { background: #fed7aa; color: #c2410c; }
.alert-item.yellow .alert-icon { background: #fef08a; color: #854d0e; }
.alert-text { flex: 1; }
.alert-title { font-weight: 600; font-size: 13px; }
.alert-desc { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

/* ============== Tables ============== */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  padding: 12px 14px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-dim);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}
.table td {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #f8fafc; }
.table .codigo { font-family: 'SF Mono', monospace; font-size: 12px; color: var(--text-dim); }
.empty { padding: 40px; text-align: center; color: var(--text-dim); font-size: 14px; }

.status {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.status-ok { background: #d1fae5; color: #065f46; }
.status-baixo { background: #fef3c7; color: #92400e; }
.status-zero { background: #fee2e2; color: #991b1b; }
.status-vencida { background: #fee2e2; color: #991b1b; }
.status-critica { background: #fed7aa; color: #c2410c; }
.status-atencao { background: #fef08a; color: #854d0e; }
.status-aberta    { background: #fee2e2; color: #991b1b; }
.status-analise   { background: #fef3c7; color: #92400e; }
.status-resolvida { background: #d1fae5; color: #065f46; }

.row-actions { display: flex; gap: 6px; }
.row-btn {
  width: 30px; height: 30px;
  border-radius: 7px;
  display: grid; place-items: center;
  color: var(--text-dim);
  transition: all .15s;
}
.row-btn:hover { background: var(--bg); color: var(--primary); }
.row-btn.danger:hover { color: var(--danger); }
.row-btn.disabled { opacity: .35; cursor: not-allowed; pointer-events: none; }

/* ============== Toolbar / Filters ============== */
.toolbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.filters { display: flex; gap: 10px; flex: 1; flex-wrap: wrap; }
.filters input, .filters select {
  padding: 10px 14px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  transition: border-color .15s;
}
.filters input:focus, .filters select:focus { border-color: var(--primary); }
.filters input { flex: 1; min-width: 200px; }
.filters select { min-width: 180px; }

.btn {
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  transition: all .15s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-secondary { background: var(--bg); color: var(--text); }
.btn-secondary:hover { background: #e2e8f0; }
.btn-ghost { color: var(--danger); }
.btn-ghost:hover { background: #fee2e2; }

.legend { display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--text-dim); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.dot-red { background: var(--danger); }
.dot-amber { background: #f97316; }
.dot-yellow { background: #eab308; }
.dot-green { background: var(--success); }

/* ============== Modal ============== */
.modal {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(2px);
}
.modal.show { display: flex; }
.modal-content {
  background: #fff;
  border-radius: 14px;
  width: min(640px, 92vw);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(15,23,42,.3);
  animation: slideUp .25s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 17px; font-weight: 700; }
.modal-head .icon-btn { font-size: 22px; line-height: 1; }

.form { padding: 22px 24px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.form-row label { display: flex; flex-direction: column; gap: 6px; }
.form-row label span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .3px;
}
.form-row input, .form-row select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  transition: border-color .15s;
}
.form-row input:focus, .form-row select:focus { border-color: var(--primary); }
.form-actions {
  display: flex; align-items: center; gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  margin-top: 6px;
}
.form-actions .spacer { flex: 1; }

/* ============== Toast ============== */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--text);
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0,0,0,.3);
  z-index: 200;
  opacity: 0;
  transform: translateY(20px);
  transition: all .25s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* ============== WhatsApp ============== */
.whatsapp {
  display: grid;
  grid-template-columns: 340px 1fr;
  height: calc(100vh - 130px);
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.wa-sidebar {
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.wa-sidebar-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px;
  background: #f0f2f5;
  border-bottom: 1px solid var(--border);
}
.wa-avatar { background: linear-gradient(135deg, #25d366, #128c7e); }
.wa-avatar-sm { width: 42px; height: 42px; font-size: 14px; }
.wa-name { font-weight: 600; font-size: 14px; color: var(--text); }
.wa-status { font-size: 11px; color: var(--text-dim); }
.wa-search { padding: 8px 12px; background: #f6f6f6; }
.wa-search input {
  width: 100%;
  padding: 8px 14px;
  border: none;
  background: #fff;
  border-radius: 20px;
  font-size: 13px;
}
.wa-chats { flex: 1; overflow-y: auto; }
.wa-chat-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
}
.wa-chat-item.active { background: #f0f2f5; }
.wa-chat-info { flex: 1; min-width: 0; }
.wa-chat-name { font-weight: 600; font-size: 14px; color: var(--text); }
.wa-chat-preview {
  font-size: 12px; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 2px;
}
.wa-chat-time { font-size: 11px; color: var(--text-dim); align-self: flex-start; }

.wa-main {
  display: flex;
  flex-direction: column;
  background-color: #efeae2;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,.4) 0, transparent 50%),
    radial-gradient(circle at 80% 60%, rgba(255,255,255,.3) 0, transparent 50%);
  min-width: 0;
}
.wa-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px;
  background: #f0f2f5;
  border-bottom: 1px solid var(--border);
}
.wa-head-actions { margin-left: auto; }

.wa-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 8%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.msg {
  max-width: 70%;
  padding: 8px 12px 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  box-shadow: 0 1px 1px rgba(0,0,0,.13);
  position: relative;
  animation: msgIn .2s ease;
}
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg-time {
  font-size: 10px;
  color: rgba(0,0,0,.45);
  margin-left: 8px;
  float: right;
  margin-top: 4px;
}
.msg.in {
  background: #fff;
  align-self: flex-start;
  border-top-left-radius: 0;
}
.msg.out {
  background: #d9fdd3;
  align-self: flex-end;
  border-top-right-radius: 0;
}
.msg-meta {
  font-size: 11px;
  font-weight: 600;
  color: var(--success);
  margin-bottom: 2px;
}

.msg.typing {
  background: #fff;
  align-self: flex-start;
  padding: 12px 16px;
}
.typing-dots { display: inline-flex; gap: 4px; }
.typing-dots span {
  width: 7px; height: 7px;
  background: #94a3b8;
  border-radius: 50%;
  animation: typing 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes typing { 0%, 60%, 100% { opacity: .3; transform: scale(.8); } 30% { opacity: 1; transform: scale(1); } }

.wa-suggestions {
  padding: 8px 16px;
  display: flex; gap: 6px; flex-wrap: wrap;
  background: rgba(255,255,255,.6);
  border-top: 1px solid rgba(0,0,0,.06);
}
.wa-suggestions:empty { display: none; }
.wa-chip {
  background: #fff;
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  transition: all .15s;
}
.wa-chip:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

.wa-input {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  background: #f0f2f5;
}
.wa-input input {
  flex: 1;
  padding: 11px 16px;
  border: none;
  background: #fff;
  border-radius: 20px;
  font-size: 14px;
}
.wa-send {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: #25d366;
  color: #fff;
  display: grid; place-items: center;
  transition: transform .15s;
}
.wa-send:hover { transform: scale(1.05); }
.wa-send svg { width: 20px; height: 20px; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
::-webkit-scrollbar-track { background: transparent; }

/* ============== Ocorrências ============== */
.table-ocorrencias .oc-numero {
  font-family: 'SF Mono', monospace;
  font-weight: 600;
  color: var(--primary);
}
.table-ocorrencias tr.prazo-estourado td {
  background: #fef2f2;
}
.table-ocorrencias tr.prazo-estourado:hover td {
  background: #fee2e2;
}
.oc-tipo {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px;
  white-space: nowrap;
}
.oc-prazo-warn {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--danger);
  font-weight: 600;
}
.oc-foto-icon {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px;
  background: var(--bg);
  border-radius: 5px;
  margin-left: 6px;
  font-size: 11px;
  cursor: pointer;
}
.oc-foto-icon:hover { background: #e2e8f0; }
.oc-origem-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 8px;
  background: #ede9fe;
  color: #6d28d9;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: .3px;
  margin-left: 6px;
}

.modal-wide { width: min(760px, 94vw); }
.form-row-full { grid-template-columns: 1fr; }
.form-row textarea {
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
  resize: vertical;
  transition: border-color .15s;
}
.form-row textarea:focus { border-color: var(--primary); outline: none; }

.oc-numero-bar {
  display: flex;
  gap: 24px;
  padding: 14px 16px;
  background: var(--bg);
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 12px;
}
.oc-numero-bar > div { display: flex; flex-direction: column; gap: 2px; }
.oc-numero-bar strong { font-size: 14px; color: var(--text); }

.foto-uploader {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
}
.foto-uploader .muted { font-size: 12px; }
.foto-preview {
  margin-top: 10px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 10px;
  background: var(--bg);
  display: inline-block;
}
.foto-preview img {
  max-width: 100%;
  max-height: 240px;
  border-radius: 6px;
  display: block;
}

/* Lightbox simples para foto da tabela */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.85);
  display: none;
  align-items: center; justify-content: center;
  z-index: 300;
  cursor: zoom-out;
}
.lightbox.show { display: flex; }
.lightbox img {
  max-width: 90vw; max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
}

/* Card de ocorrência recente no dashboard */
.oc-recent-list { display: flex; flex-direction: column; gap: 10px; max-height: 360px; overflow-y: auto; }
.oc-recent-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px;
  border-radius: 10px;
  background: var(--bg);
  border-left: 3px solid #8b5cf6;
}
.oc-recent-item.estourada { border-color: var(--danger); background: #fef2f2; }
.oc-recent-item.resolvida { border-color: var(--success); background: #f0fdf4; }
.oc-recent-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: #ede9fe;
  display: grid; place-items: center;
  flex-shrink: 0;
  font-size: 14px;
}
.oc-recent-text { flex: 1; min-width: 0; }
.oc-recent-title { font-weight: 600; font-size: 13px; }
.oc-recent-desc {
  font-size: 12px; color: var(--text-dim); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ============== Loading splash ============== */
.loading-splash {
  position: fixed; inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  background: linear-gradient(135deg, #0a0f1e 0%, #1a1f3e 100%);
  transition: opacity .45s ease;
}
.loading-splash.fade-out {
  opacity: 0;
  pointer-events: none;
}
.loading-splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}
.loading-splash-logo {
  width: 56px; height: 56px;
  color: #6366f1;
  animation: splashPulse 2s ease-in-out infinite;
}
.loading-splash-logo svg { width: 100%; height: 100%; }
@keyframes splashPulse {
  0%, 100% { opacity: .6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.08); }
}
.loading-spinner {
  width: 32px; height: 32px;
  border: 3px solid rgba(99,102,241,.25);
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-splash-text {
  color: rgba(255,255,255,.5);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .5px;
}

/* ============== Confirm modal (logout, etc.) ============== */
.confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 15, 30, 0);
  backdrop-filter: blur(0px);
  transition: background .3s ease, backdrop-filter .3s ease;
}
.confirm-backdrop.show {
  background: rgba(10, 15, 30, .55);
  backdrop-filter: blur(8px);
}
.confirm-dialog {
  position: relative;
  width: min(420px, 90vw);
  padding: 36px 32px 28px;
  text-align: center;
  border-radius: 20px;
  background: var(--surface);
  box-shadow:
    0 0 0 1px rgba(255,255,255,.08),
    0 8px 24px rgba(15,23,42,.12),
    0 32px 80px rgba(15,23,42,.24);
  transform: translateY(24px) scale(.96);
  opacity: 0;
  transition: transform .35s cubic-bezier(.16,1,.3,1), opacity .25s ease;
}
.confirm-backdrop.show .confirm-dialog {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.confirm-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--muted);
  transition: background .15s, color .15s;
}
.confirm-close:hover {
  background: var(--bg);
  color: var(--text);
}
.confirm-close svg { width: 16px; height: 16px; }
.confirm-icon-wrap {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 50%, #e0e7ff 100%);
  box-shadow: 0 4px 16px rgba(37,99,235,.12);
}
.confirm-icon-wrap.danger {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 50%, #fecaca 100%);
  box-shadow: 0 4px 16px rgba(239,68,68,.12);
}
.confirm-emoji {
  font-size: 30px;
  line-height: 1;
}
.confirm-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px;
}
.confirm-message {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.6;
  margin: 0 0 28px;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}
.confirm-actions {
  display: flex;
  gap: 12px;
}
.confirm-btn {
  flex: 1;
  padding: 13px 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: all .2s cubic-bezier(.16,1,.3,1);
  letter-spacing: .01em;
}
.confirm-btn-cancel {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}
.confirm-btn-cancel:hover {
  background: #e2e8f0;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(15,23,42,.06);
}
.confirm-btn-primary {
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(37,99,235,.35);
}
.confirm-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(37,99,235,.4);
  filter: brightness(1.05);
}
.confirm-btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(239,68,68,.3);
}
.confirm-btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(239,68,68,.4);
  filter: brightness(1.05);
}
.confirm-btn:active { transform: translateY(0) scale(.98); }

/* Confirm dark mode */
[data-theme="dark"] .confirm-dialog {
  background: #1e293b;
  box-shadow:
    0 0 0 1px rgba(255,255,255,.06),
    0 8px 24px rgba(0,0,0,.3),
    0 32px 80px rgba(0,0,0,.5);
}
[data-theme="dark"] .confirm-icon-wrap {
  background: linear-gradient(135deg, rgba(37,99,235,.15) 0%, rgba(99,102,241,.2) 100%);
}
[data-theme="dark"] .confirm-icon-wrap.danger {
  background: linear-gradient(135deg, rgba(239,68,68,.15) 0%, rgba(220,38,38,.2) 100%);
}
[data-theme="dark"] .confirm-btn-cancel {
  background: #334155;
  border-color: #475569;
  color: #e2e8f0;
}
[data-theme="dark"] .confirm-btn-cancel:hover {
  background: #475569;
}

/* ============== Login screen ============== */
.login-screen {
  position: fixed; inset: 0;
  display: flex;
  z-index: 1000;
}

/* --- Brand panel (left) --- */
.login-brand {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(to right, rgba(20,32,60,.92), rgba(20,32,60,.58)),
    url('/assets/login-bg.jpeg') center/cover no-repeat;
  padding: 48px 52px;
}
@keyframes brandPulse {
  0%   { opacity: .8; transform: scale(1); }
  100% { opacity: 1;  transform: scale(1.04); }
}
.login-brand-content {
  position: relative;
  z-index: 1;
  /* Reforço de legibilidade do texto sobre a foto (independe do brilho local
     da imagem por trás do overlay marinho). */
  text-shadow: 0 2px 14px rgba(0,0,0,.4);
}
.login-brand-logo {
  position: relative;
  width: 120px; height: 120px;
  display: grid; place-items: center;
  color: #eef2f8;
  margin-bottom: 28px;
}
.login-brand-logo::before {
  content: '';
  position: absolute;
  inset: -46px;
  background: radial-gradient(circle, rgba(180,67,46,.42) 0%, rgba(180,67,46,.16) 45%, transparent 72%);
  filter: blur(6px);
  z-index: -1;
  animation: brandPulse 8s ease-in-out infinite alternate;
}
.login-brand-logo svg { width: 120px; height: 120px; }
.login-brand-logo svg circle:last-child { fill: var(--danger); }
.login-brand-name {
  font-size: 38px;
  font-weight: 800;
  color: #eef2f8;
  letter-spacing: -1px;
  line-height: 1.1;
  margin-bottom: 4px;
}
.login-brand-name .brand-kana {
  font-size: 18px;
  font-weight: 500;
  color: rgba(238,242,248,.62);
  margin-left: 10px;
}
.login-brand-tagline {
  font-size: 16px;
  color: rgba(238,242,248,.75);
  margin-bottom: 48px;
  font-weight: 400;
}
.login-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.login-features li {
  display: flex;
  align-items: center;
  gap: 14px;
  color: rgba(238,242,248,.75);
  font-size: 14px;
}
.login-feature-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: rgba(238,242,248,.08);
  border: 1px solid rgba(238,242,248,.14);
  display: grid; place-items: center;
  flex-shrink: 0;
  color: #eef2f8;
}
.login-feature-icon svg { width: 16px; height: 16px; }
.login-brand-footer {
  position: relative; z-index: 1;
  font-size: 12px;
  color: rgba(238,242,248,.55);
}

/* --- Floating glass KPI cards --- */
.login-float-card {
  position: absolute;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.20);
  border-radius: 14px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 12px 28px rgba(8,14,30,.28);
  pointer-events: none;
  animation: floatCard 7s ease-in-out infinite;
}
.login-float-card-icon {
  width: 34px; height: 34px;
  border-radius: 9px;
  flex-shrink: 0;
  display: grid; place-items: center;
  background: rgba(255,255,255,.10);
  color: #eef2f8;
}
.login-float-card-icon svg { width: 16px; height: 16px; }
.login-float-card-1 .login-float-card-icon { color: #ffb199; background: rgba(180,67,46,.28); }
.login-float-card-2 .login-float-card-icon { color: #a9c4ff; background: rgba(70,110,200,.28); }
.login-float-card-3 .login-float-card-icon { color: #a3ecc4; background: rgba(56,161,105,.28); }
.login-float-card-4 .login-float-card-icon { color: #cdb8ff; background: rgba(139,92,246,.26); }
.login-float-card-5 .login-float-card-icon { color: #ffd7a1; background: rgba(193,144,47,.28); }
.login-float-card-text {
  max-width: 148px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
  color: #eef2f8;
}
/* Espalhados na área central/direita (sobre a foto), à direita da coluna de
   texto (que termina por volta de 45% de largura) — zigue-zague pra não
   ficarem enfileirados nem sobrepostos. */
.login-float-card-1 { top: 9%;     left: 56%; animation-delay: 0s; }
.login-float-card-2 { top: 30%;    left: 68%; animation-delay: 1.8s; }
.login-float-card-3 { top: 52%;    left: 52%; animation-delay: 3.6s; }
.login-float-card-4 { bottom: 20%; left: 66%; animation-delay: 5.4s; }
.login-float-card-5 { bottom: 6%;  left: 54%; animation-delay: 2.7s; }
@keyframes floatCard {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* --- Form panel (right) --- */
.login-panel {
  width: min(480px, 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 32px 24px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  animation: slideUp .45s cubic-bezier(.16,1,.3,1);
}
.login-card.shake { animation: shake .4s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}
.login-card-header {
  text-align: center;
  margin-bottom: 36px;
}
.login-card-logo {
  width: 56px; height: 56px;
  display: grid; place-items: center;
  color: var(--primary);
  margin: 0 auto 20px;
}
.login-card-logo svg { width: 44px; height: 44px; }
.login-card-logo svg circle:last-child { fill: var(--danger); }
.login-card-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.login-card-header p {
  font-size: 14px;
  color: var(--text-dim);
}

/* Fields */
.login-field {
  margin-bottom: 18px;
}
.login-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.login-input-wrap {
  position: relative;
}
.login-input-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  display: grid; place-items: center;
}
.login-input-icon svg { width: 16px; height: 16px; }
.login-form input {
  width: 100%;
  padding: 13px 42px 13px 42px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.login-form input::placeholder { color: var(--muted); }
.login-form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30,40,70,.14);
  outline: none;
}
.login-toggle-pwd {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  color: var(--muted);
  padding: 4px;
  border-radius: 6px;
  cursor: pointer;
  transition: color .15s;
  display: grid; place-items: center;
}
.login-toggle-pwd:hover { color: var(--primary); }
.login-toggle-pwd svg { width: 16px; height: 16px; }

/* Error */
.login-error {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f7e2dc;
  color: #8a3624;
  border: 1px solid #e6b5a5;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 14px;
}
.login-error svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Submit button */
.login-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  margin-top: 8px;
  transition: opacity .15s, transform .15s, box-shadow .15s;
  box-shadow: 0 4px 16px rgba(30,40,70,.35);
}
.login-btn svg { width: 16px; height: 16px; transition: transform .15s; }
.login-btn:hover { opacity: .92; transform: translateY(-1px); box-shadow: 0 8px 24px rgba(30,40,70,.4); }
.login-btn:hover svg { transform: translateX(3px); }
.login-btn:active { transform: translateY(0); }

/* Demo credentials */
.login-hint {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid #e2e8f0;
}
.login-hint-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: #94a3b8;
  margin-bottom: 12px;
  text-align: center;
}
.login-hint-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.login-hint-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.login-hint-item:hover {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,.08);
}
.login-hint-role {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 2px 8px;
  border-radius: 20px;
  flex-shrink: 0;
}
.login-hint-role.admin  { background: #ede9fe; color: #7c3aed; }
.login-hint-role.vendas { background: #dbeafe; color: #1d4ed8; }
.login-hint-role.entrega{ background: #dcfce7; color: #15803d; }
.login-hint-item code {
  font-family: 'SF Mono', ui-monospace, monospace;
  font-size: 12px;
  color: #475569;
}

.login-forgot-wrap {
  text-align: right;
  margin-top: 6px;
}
.login-forgot-link {
  font-size: 13px;
  color: var(--primary);
  text-decoration: none;
  opacity: .8;
  transition: opacity .15s;
}
.login-forgot-link:hover { opacity: 1; text-decoration: underline; }

.login-forgot-msg {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
}
.login-forgot-msg svg { flex-shrink: 0; color: var(--primary); margin-top: 1px; }
.login-forgot-msg strong { display: block; color: var(--primary); margin-bottom: 2px; font-size: 13px; }
.login-forgot-msg p { margin: 0; }

[data-theme="dark"] .login-forgot-msg {
  background: rgba(36,64,94,.12);
  border-color: rgba(36,64,94,.3);
}
[data-theme="dark"] .login-forgot-msg strong { color: var(--sidebar-text-active); }

.cfg-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
}
.cfg-user-row:last-child { border-bottom: none; }
.cfg-user-info { display: flex; align-items: center; gap: 12px; }

.catalogo-status {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.catalogo-status.pendente { background: rgba(245,158,11,.15); color: var(--warning); }
.catalogo-status.integrado { background: rgba(16,185,129,.15); color: var(--success); }

.assinatura-situacao {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.assinatura-situacao.em-dia { background: rgba(16,185,129,.15); color: var(--success); }
.assinatura-situacao.atraso { background: rgba(245,158,11,.15); color: var(--warning); }
.assinatura-situacao.vencida, .assinatura-situacao.cancelada { background: rgba(239,68,68,.15); color: var(--danger); }
.assinatura-situacao.sem { background: rgba(100,116,139,.15); color: var(--text-dim); }

/* ---- Modal reset de senha ---- */
.rs-head-icon {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--primary), #60a5fa);
  border-radius: 9px;
  display: grid; place-items: center;
  color: #fff;
  flex-shrink: 0;
}
.rs-input-wrap {
  position: relative;
}
.rs-input-wrap input {
  width: 100%;
  padding: 10px 12px 10px 38px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  box-sizing: border-box;
}
.rs-input-wrap input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
  outline: none;
}
.rs-input-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px;
  color: var(--text-dim);
  pointer-events: none;
  transition: color .15s;
}
.rs-input-wrap.error input        { border-color: var(--danger); }
.rs-input-wrap.error input:focus  { box-shadow: 0 0 0 3px rgba(239,68,68,.1); }
.rs-input-wrap.error .rs-input-icon { color: var(--danger); }
.rs-input-wrap.ok input           { border-color: #10b981; }
.rs-input-wrap.ok input:focus     { box-shadow: 0 0 0 3px rgba(16,185,129,.1); }
.rs-input-wrap.ok .rs-input-icon  { color: #10b981; }
.rs-hint {
  display: block;
  font-size: 11px;
  min-height: 15px;
  margin-top: 2px;
  transition: color .15s;
}
.rs-hint.error  { color: var(--danger); }
.rs-hint.ok     { color: #10b981; }

/* Responsive: mobile — stack vertically */
@media (max-width: 768px) {
  .login-screen { flex-direction: column; }
  .login-brand {
    flex: none;
    padding: 32px 28px 28px;
  }
  .login-brand-logo { width: 56px; height: 56px; margin-bottom: 18px; }
  .login-brand-logo svg { width: 44px; height: 44px; }
  .login-brand-name { font-size: 26px; }
  .login-brand-tagline { font-size: 13px; margin-bottom: 20px; }
  .login-features { display: none; }
  .login-brand-footer { display: none; }
  .login-float-card { display: none; }
  .login-panel { width: 100%; flex: 1; padding: 28px 20px; }
}

/* ============== User card / logout ============== */
.user-card { position: relative; }
.user-info { flex: 1; min-width: 0; }
.logout-btn { color: var(--sidebar-muted); }
.logout-btn:hover { color: #fff; background: var(--danger); }
.logout-btn svg { width: 16px; height: 16px; }

.user-profile-btn {
  display: flex; align-items: center; gap: 12px;
  flex: 1; min-width: 0;
  cursor: pointer;
  border-radius: 8px;
  padding: 5px 6px;
  margin: -5px -6px;
  transition: background .15s ease;
}
.user-profile-btn:hover { background: rgba(28,35,64,.06); }
.user-profile-btn:hover .avatar { box-shadow: 0 0 0 2px rgba(28,35,64,.18); }

/* ============== Modal Perfil ============== */
.perfil-header {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 20px;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border-radius: 10px;
  margin-bottom: 20px;
}
.perfil-avatar { width: 54px; height: 54px; font-size: 20px; flex-shrink: 0; }
.perfil-header-nome { color: #f8fafc; font-weight: 700; font-size: 15px; }
.perfil-header-cargo { color: #94a3b8; font-size: 12px; margin-top: 2px; }
.form-section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: var(--text-dim); margin-bottom: 10px;
}
.form-section-opt { font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 11px; }

/* Hamburger (mobile only) */
.hamburger { display: none; }

/* Sidebar overlay mobile */
.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 50;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.sidebar-overlay.show { opacity: 1; pointer-events: auto; }

/* ============== Periodo toggle ============== */
.periodo-toggle {
  display: inline-flex;
  background: var(--bg);
  padding: 3px;
  border-radius: 8px;
}
.periodo-toggle button {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  border-radius: 6px;
  transition: all .15s;
}
.periodo-toggle button.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(15,23,42,.1);
}

#chartVendas { display: block; max-width: 100%; }
.grafico-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
  font-size: 14px;
}

.chart-tooltip {
  position: fixed;
  background: #1e293b;
  color: #f8fafc;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.5;
  pointer-events: none;
  z-index: 9999;
  box-shadow: 0 8px 24px rgba(0,0,0,.22);
  min-width: 170px;
}
.chart-tooltip .ct-label {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 6px;
  color: #a78bfa;
  border-bottom: 1px solid rgba(255,255,255,.1);
  padding-bottom: 5px;
}
.chart-tooltip .ct-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: #94a3b8;
}
.chart-tooltip .ct-row strong { color: #f8fafc; }

/* ============== Rank badges ============== */
.rank-badge {
  display: inline-grid;
  place-items: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  background: var(--bg);
  color: var(--text);
  margin-right: 8px;
}
.rank-badge.rank-1 { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #fff; }
.rank-badge.rank-2 { background: linear-gradient(135deg, #9ca3af, #6b7280); color: #fff; }
.rank-badge.rank-3 { background: linear-gradient(135deg, #d97706, #b45309); color: #fff; }

/* ============== Status venda ============== */
.status-orcamento { background: #dbeafe; color: #1e40af; }

/* ============== Vendas summary ============== */
.vendas-summary {
  display: flex; gap: 24px;
  padding: 14px 18px;
  background: linear-gradient(135deg, #f0f9ff, #f8fafc);
  border-radius: 10px;
  margin-bottom: 14px;
}
.vendas-summary-item strong { font-size: 18px; color: var(--text); display: block; }
.vendas-summary-item .muted { font-size: 11px; text-transform: uppercase; letter-spacing: .3px; }

/* ============== Itens do form de venda ============== */
.itens-section {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
  background: #fafbfc;
}
.itens-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.itens-list { display: flex; flex-direction: column; gap: 8px; }
.item-row {
  display: grid;
  grid-template-columns: 1fr 80px 110px 100px 32px;
  gap: 8px;
  align-items: center;
}
.item-row select, .item-row input {
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  font-size: 12px;
}
.item-total {
  text-align: right;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}
.item-del {
  font-size: 18px;
  font-weight: 700;
}
.venda-total {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 2px solid var(--border);
  font-size: 14px;
}
.venda-total strong { font-size: 22px; color: var(--primary); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.auto-retorno {
  display: flex; align-items: center; gap: 8px;
  padding: 10px;
  background: var(--bg);
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 8px;
}

/* ============== Ficha cliente ============== */
.ficha-cliente { margin-top: 0; }
.back-btn { margin-bottom: 12px; }
.ficha-header {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 24px;
  align-items: center;
}
.ficha-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  display: grid; place-items: center;
  font-size: 28px;
  font-weight: 700;
}
.ficha-info h2 { font-size: 22px; margin-bottom: 6px; }
.ficha-meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--text-dim); margin-bottom: 8px; }
.ficha-carro { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.placa-tag {
  background: #0f172a; color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: 'SF Mono', monospace;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .5px;
}
.ficha-stats { display: flex; gap: 18px; }
.ficha-stat { text-align: center; }
.ficha-stat-val { font-size: 22px; font-weight: 700; color: var(--text); }
.ficha-stat-lbl { font-size: 11px; color: var(--text-dim); text-transform: uppercase; }
.ficha-actions { display: flex; flex-direction: column; gap: 6px; }

.hist-list { display: flex; flex-direction: column; gap: 8px; max-height: 380px; overflow-y: auto; }
.hist-item {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 8px;
  background: var(--bg);
  font-size: 13px;
}
.hist-num { display: flex; gap: 8px; align-items: center; }
.hist-data { font-size: 12px; }

/* ============== Busca por placa ============== */
.placa-input-wrap {
  display: flex; gap: 10px;
}
.placa-input-wrap input {
  flex: 1;
  font-family: 'SF Mono', monospace;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 2px;
  text-align: center;
  text-transform: uppercase;
}
.placa-resultado { margin-top: 16px; }
.placa-help, .placa-erro {
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 13px;
  background: #f0f9ff;
  color: #1e40af;
}
.placa-erro { background: #fef2f2; color: #991b1b; margin-bottom: 8px; }
.placa-help code {
  background: rgba(0,0,0,.08);
  padding: 1px 6px;
  border-radius: 3px;
  font-family: 'SF Mono', monospace;
}
.placa-info-box {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: linear-gradient(135deg, #0f172a, #1e293b);
  border-radius: 10px;
  color: #fff;
  margin-bottom: 18px;
}
.placa-tag-big {
  background: #fff;
  color: #0f172a;
  padding: 8px 14px;
  border-radius: 6px;
  font-family: 'SF Mono', monospace;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 2px;
  border: 2px solid #0f172a;
}
.placa-veiculo { flex: 1; }
.placa-veiculo strong { font-size: 16px; display: block; margin-bottom: 4px; }
.placa-source {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  background: rgba(255,255,255,.15);
  padding: 2px 8px;
  border-radius: 10px;
}
.placa-section-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text);
}

/* ============== Impersonation banner ============== */
.impersonate-banner {
  background: #7c3aed;
  color: #fff;
  padding: 8px 28px;
  font-size: 13px;
  display: flex;
  align-items: center;
}
.impersonate-banner .btn-sm {
  padding: 4px 12px;
  border-radius: 6px;
  background: rgba(255,255,255,.2);
  color: #fff;
  font-size: 12px;
  border: 1px solid rgba(255,255,255,.3);
}
.impersonate-banner .btn-sm:hover { background: rgba(255,255,255,.3); }

.assinatura-aviso {
  background: #fffbeb;
  color: #92400e;
  border-bottom: 1px solid #fde68a;
  padding: 10px 28px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.assinatura-aviso-fechar {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  flex-shrink: 0;
}
.assinatura-aviso--restrita {
  background: #fef2f2;
  color: #b91c1c;
  border-bottom: 1px solid #fecaca;
}

/* ============== Comunicados da plataforma ============== */
.comunicados-banner {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 28px 0;
}
.comunicado-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-left: 3px solid #b91c1c;
  color: #7f1d1d;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 13px;
}
.comunicado-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 3px 10px;
}
.comunicado-card-body strong { font-size: 13px; font-weight: 700; color: #b91c1c; }
.comunicado-card-body p { margin: 0; line-height: 1.4; flex: 1 1 auto; min-width: 140px; }
.comunicado-card-data { font-size: 11px; color: #dc2626; white-space: nowrap; margin-left: auto; }
.comunicado-card-fechar {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
}

/* ============== Busca Inteligente IA ============== */
.busca-ia-wrap {
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.busca-ia-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.busca-ia-icon { font-size: 18px; flex-shrink: 0; }
.busca-ia-form input[type="text"] {
  flex: 1;
  min-width: 220px;
  padding: 9px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  color: var(--text);
  transition: border-color .15s;
}
.busca-ia-form input[type="text"]:focus { border-color: var(--primary); outline: none; }
.busca-ia-resultado {
  margin-top: 10px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-dim);
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
}
.busca-ia-resultado strong { color: var(--primary); }

/* ============== Tutorial overlay ============== */
.tutorial-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.72);
  display: flex; align-items: center; justify-content: center;
  z-index: 9000;
  backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
.tutorial-overlay.show { opacity: 1; pointer-events: all; }
.tutorial-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 40px 44px;
  max-width: 460px; width: 90%;
  text-align: center;
  position: relative;
  box-shadow: 0 24px 64px rgba(15,23,42,.3);
}
.tutorial-skip {
  position: absolute; top: 14px; right: 16px;
  font-size: 12px; cursor: pointer; background: none; border: none;
}
.tutorial-skip:hover { color: var(--text); }
.tutorial-icon { font-size: 48px; margin-bottom: 8px; }
.tutorial-counter { font-size: 12px; margin-bottom: 6px; }
.tutorial-titulo { font-size: 20px; font-weight: 700; margin-bottom: 12px; }
.tutorial-desc { color: var(--text-dim); line-height: 1.6; margin-bottom: 24px; }
.tutorial-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 24px; }
.tutorial-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border); transition: background .2s, width .2s;
}
.tutorial-dot.active { background: var(--primary); width: 20px; border-radius: 4px; }
.tutorial-dot.done { background: var(--primary); opacity: .4; }
.tutorial-btns { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

/* ============== Print / PDF ============== */
.print-area { display: none; }
body.printing .app { display: none !important; }
body.printing .print-area { display: block; }
body.printing .toast, body.printing .modal, body.printing .lightbox { display: none !important; }

.print-doc {
  max-width: 800px;
  margin: 0 auto;
  padding: 30px;
  font-family: 'Inter', sans-serif;
  color: #0f172a;
}
.print-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 20px;
  align-items: center;
  border-bottom: 3px solid #2563eb;
  padding-bottom: 18px;
  margin-bottom: 22px;
}
.print-logo {
  width: 64px; height: 64px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  display: grid; place-items: center;
  color: #fff;
}
.print-logo svg { width: 36px; height: 36px; }
.print-empresa h1 { font-size: 22px; margin-bottom: 4px; }
.print-empresa div { font-size: 12px; color: #475569; line-height: 1.6; }
.print-numero { text-align: right; }
.print-doc-type {
  background: #2563eb; color: #fff;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  display: inline-block;
}
.print-doc-num { font-size: 22px; font-weight: 700; margin-top: 4px; }
.print-doc-date { font-size: 12px; color: #64748b; }

.print-cliente, .print-itens, .print-total, .print-footer { margin-bottom: 22px; }
.print-cliente h2, .print-itens h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #64748b;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #e2e8f0;
}
.print-cliente div { font-size: 13px; line-height: 1.7; }
.print-itens table { width: 100%; border-collapse: collapse; font-size: 12px; }
.print-itens th {
  background: #f1f5f9;
  padding: 8px;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid #e2e8f0;
}
.print-itens th.r, .print-itens td.r { text-align: right; }
.print-itens td { padding: 10px 8px; border-bottom: 1px solid #e2e8f0; vertical-align: top; }
.print-itens td small { color: #64748b; }

.print-total {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-top: 16px;
}
.print-pgto { font-size: 13px; }
.print-total-box {
  background: #0f172a; color: #fff;
  padding: 14px 22px;
  border-radius: 8px;
  display: flex; flex-direction: column;
  align-items: flex-end;
}
.print-total-box span { font-size: 11px; opacity: .7; text-transform: uppercase; letter-spacing: 1px; }
.print-total-box strong { font-size: 26px; }

.print-footer {
  font-size: 12px;
  color: #475569;
  border-top: 1px solid #e2e8f0;
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.print-validade { color: #b45309; font-weight: 600; }
.print-vendedor { margin-top: 8px; }
.print-venda-ref { font-size: 11px; color: #94a3b8; margin-top: 2px; }
.print-doc-type-orc { background: #d97706 !important; }
.print-fiscal-row {
  display: flex; justify-content: space-between;
  font-size: 11px; color: #94a3b8;
  border-top: 1px dashed #e2e8f0;
  padding-top: 8px; margin-top: 4px;
}
.print-assinatura {
  margin-top: 28px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
}
.print-assinatura-linha { width: 220px; border-top: 1px solid #64748b; }
.print-assinatura div { font-size: 11px; color: #64748b; }
.pc-nome { font-size: 15px; font-weight: 700; margin-bottom: 4px; }

/* ============== Fiscal module ============== */
.fiscal-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}
.fiscal-badge-recibo  { background: #dbeafe; color: #1d4ed8; }
.fiscal-badge-orc     { background: #fef3c7; color: #92400e; }

.fiscal-nfe { font-size: 12px; font-weight: 600; }
.fiscal-nfe-pend { color: var(--text-dim); }
.fiscal-nfe-ok   { color: var(--success); }
.fiscal-nfe-err  { color: var(--danger); }

.fiscal-nfe-banner {
  display: flex; align-items: flex-start; gap: 10px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #1e40af;
}
.fiscal-nfe-banner svg { flex-shrink: 0; margin-top: 1px; }
.fiscal-nfe-banner span { color: #3b82f6; margin-left: 4px; }

/* Modal NF-e */
.nfe-info-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; margin-bottom: 16px;
}
.nfe-info-grid > div {
  background: var(--bg); border-radius: 8px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.nfe-info-grid span { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-dim); }
.nfe-info-grid strong { font-size: 14px; color: var(--text); }
.nfe-dev-banner {
  display: flex; gap: 12px; align-items: flex-start;
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px;
  padding: 12px 14px; margin-bottom: 16px; font-size: 12.5px; color: #78350f;
}
.nfe-dev-banner strong { display: block; margin-bottom: 3px; }
.nfe-dev-banner span { color: #92400e; line-height: 1.5; }

@media print {
  body { background: #fff; }
  .app, .toast, .modal, .lightbox { display: none !important; }
  .print-area { display: block; }
  .print-doc { padding: 0; }
  @page { margin: 1.5cm; }
}

/* ============== Responsive ============== */
@media (max-width: 1024px) {
  .ficha-header { grid-template-columns: auto 1fr; gap: 16px; }
  .ficha-stats { grid-column: 1 / -1; justify-content: flex-start; }
  .ficha-actions { grid-column: 1 / -1; flex-direction: row; }
}

@media (max-width: 768px) {
  .hamburger { display: grid; }

  .sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 260px;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  .sidebar.open { transform: translateX(0); }

  .brand-name, .brand-tag, .nav-item span, .user-name, .user-role { display: block; }
  .nav-item span { display: inline-block; }

  .main { width: 100%; }
  .topbar { padding: 12px 16px; gap: 12px; }
  .page-title { font-size: 16px; }
  .search { width: auto; flex: 1; min-width: 0; }
  .search input::placeholder { font-size: 12px; }
  .search input { font-size: 12px; }

  .content { padding: 16px; }

  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 22px; }
  .kpi-label { font-size: 10px; }
  .kpi-foot { font-size: 11px; }

  .grid-2 { grid-template-columns: 1fr; gap: 12px; }
  .card { padding: 16px; }

  .toolbar { flex-direction: column; align-items: stretch; }
  .filters { flex-direction: column; }
  .filters input, .filters select { min-width: 0; width: 100%; }

  /* Tabelas: scroll horizontal */
  .card { overflow-x: auto; }
  .table { min-width: 600px; }

  .form-row { grid-template-columns: 1fr; }
  .modal-content { width: 96vw; max-height: 94vh; border-radius: 10px; }

  .whatsapp { grid-template-columns: 1fr; height: calc(100vh - 110px); }
  .wa-sidebar { display: none; }

  .ficha-header { grid-template-columns: 1fr; text-align: center; }
  .ficha-avatar { margin: 0 auto; }
  .ficha-meta, .ficha-carro { justify-content: center; }
  .ficha-stats { justify-content: center; }
  .ficha-actions { flex-direction: row; justify-content: center; }

  .item-row {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 10px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
  }

  .vendas-summary { flex-direction: column; gap: 10px; }
  .hist-item { grid-template-columns: 1fr; gap: 4px; }

  .periodo-toggle button { padding: 4px 10px; font-size: 11px; }

  .topbar .search { width: 140px; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .topbar .search { display: none; }
  .filters { gap: 8px; }
  .login-panel { padding: 20px 16px; }
}
