/* ===== SIGEM CSS — GMASystem Tecnologia v2.0 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ===== SCROLLBARS GLOBAIS ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.3); }
::-webkit-scrollbar-corner { background: transparent; }
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }

:root {
  --brand: #e8460a;
  --brand-dark: #c53a08;
  --brand-2: #c026bb;
  --brand-3: #7c3aed;
  --bg: #0e0e1a;
  --bg-2: #13131f;
  --bg-3: #181828;
  --bg-card: #1a1a2e;
  --bg-card-hover: #1e1e35;
  --border: rgba(255,255,255,.07);
  --border-2: rgba(255,255,255,.12);
  --text: #e8e8f0;
  --text-300: #b0b0cc;
  --text-400: #7878a0;
  --text-500: #505070;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --purple: #8b5cf6;
  --cyan: #06b6d4;
  --font-mono: 'Consolas', 'Monaco', 'Cascadia Code', monospace;
  --shadow-lg: 0 20px 60px rgba(0,0,0,.6);
  --radius-lg: 16px;
  --sidebar-w: 260px;
  --sidebar-w-collapsed: 68px;
  --topbar-h: 60px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,.4);
}

html, body { height: 100%; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); font-size: .9rem; line-height: 1.5; overflow-x: hidden; }

/* ===== LAYOUT PRINCIPAL (Footer Livre e Scroll Nativo) ===== */
html, body { height: auto; min-height: 100vh; overflow-x: hidden; }

.app-layout { display: flex; min-height: 100vh; }

.main-content { 
  flex: 1; min-width: 0; 
  display: flex; flex-direction: column; 
  margin-left: var(--sidebar-w); transition: margin-left .3s ease; 
}
.sidebar-collapsed .main-content { margin-left: var(--sidebar-w-collapsed); }
.page-content { flex: 1; padding: 24px; display: flex; flex-direction: column; gap: 20px; }

/* ===== SIDEBAR ===== */
.sidebar { 
  position: fixed; top: 0; bottom: 0; left: 0; 
  width: var(--sidebar-w); height: 100vh; 
  background: var(--bg-2); border-right: 1px solid var(--border); 
  display: flex; flex-direction: column; z-index: 100;  
  transition: width .3s ease, left .3s ease; overflow: hidden; 
}
.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }

.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 16px; border-bottom: 1px solid var(--border); min-height: 64px; position: relative; }
.sidebar-logo { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; flex-shrink: 0; }
.sidebar-brand-text { flex: 1; overflow: hidden; }
.system-name { font-size: 1.05rem; font-weight: 700; background: linear-gradient(135deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; white-space: nowrap; }
.company-name { font-size: .65rem; color: var(--text-400); white-space: nowrap; }

/* NOVA ÁREA DO USUÁRIO COM O BOTÃO RECOLHER INCLUSO */
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 16px; border-bottom: 1px solid var(--border); transition: all 0.3s; flex-wrap: wrap; justify-content: center; }
.sidebar-avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--brand-2)); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .9rem; flex-shrink: 0; color: white; }
.sidebar-user-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sidebar-user-name { font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; }
.sidebar-user-role { display: flex; align-items: center; gap: 4px; font-size: .65rem; color: var(--text-400); text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }
.sidebar-user-role svg { width: 12px; height: 12px; }

/* O Botão de Recolher agora fica aqui */
.sidebar-collapse-btn { background: rgba(255,255,255,0.05); border: 1px solid var(--border); border-radius: 6px; color: #fff; cursor: pointer; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; transition: all .2s; flex-shrink: 0; }
.sidebar-collapse-btn:hover { background: rgba(255,255,255,0.1); border-color: var(--brand); color: var(--brand); }
.collapse-icon { display: flex; align-items: center; justify-content: center; transition: transform .3s ease; }

/* Comportamento quando a Sidebar Recolhe */
.sidebar-collapsed .sidebar-user-info { display: none; }
.sidebar-collapsed .sidebar-user { padding: 12px 8px; flex-direction: column; }
.sidebar-collapsed .sidebar-collapse-btn { margin-top: 8px; width: 36px; height: 30px; }
.sidebar-collapsed .collapse-icon { transform: rotate(180deg); } /* Vira a setinha para a direita */

/* Busca na Sidebar */
.sidebar-search-wrap { padding: 12px 12px 4px; }
.sidebar-search-wrap .input-icon-wrap { position: relative; display: flex; align-items: center; }
.sidebar-search-wrap .input-icon-wrap .input-icon { position: absolute; left: 12px; color: var(--text-500); pointer-events: none; }
.sidebar-search-wrap .input-icon-wrap .form-control { background: rgba(255,255,255,0.03); border-color: var(--border); height: 36px; font-size: .8rem; padding-left: 38px; width: 100%; border-radius: var(--radius-sm); color: var(--text); outline: none; transition: border-color .2s; }
.sidebar-search-wrap .input-icon-wrap .form-control:focus { background: rgba(255,255,255,0.06); border-color: var(--brand); }

/* MENU ACORDEÃO (TÍTULOS E LINKS BRANCOS) */
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 8px; overflow-x: hidden; }
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 10px; }
.sidebar-section { margin-bottom: 6px; }

.sidebar-section-title { 
  cursor: pointer; display: flex; justify-content: space-between; align-items: center; 
  font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; 
  color: #ffffff; /* Módulos em Branco */
  padding: 8px 10px; font-weight: 700; transition: color .2s, background .2s; 
  user-select: none; border-radius: var(--radius-sm);
}
.sidebar-section-title:hover { background: rgba(255,255,255,0.05); }
.sidebar-section-title svg { width: 14px; height: 14px; transition: transform .3s ease; stroke-width: 2.5; }

.sidebar-section-content { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.sidebar-section.collapsed .sidebar-section-content { display: none; }
.sidebar-section.collapsed .sidebar-section-title svg { transform: rotate(-90deg); }

.sidebar-link { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm); color: #ffffff; text-decoration: none; font-size: .83rem; transition: all .15s; white-space: nowrap; position: relative; opacity: 0.85; }
.sidebar-link .icon { display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 22px; color: #ffffff; transition: color .2s; }
.sidebar-link .icon svg { width: 18px; height: 18px; stroke-width: 2; }
.sidebar-link:hover { opacity: 1; background: rgba(255,255,255,.08); }
.sidebar-link:hover .icon { color: var(--brand-3); }
.sidebar-link.active { background: linear-gradient(135deg, rgba(232,70,10,.15), rgba(192,38,187,.1)); color: var(--brand); font-weight: 600; opacity: 1; }
.sidebar-link.active .icon { color: var(--brand); }
.sidebar-link.active::before { content: ''; position: absolute; left: 0; top: 20%; height: 60%; width: 3px; background: var(--brand); border-radius: 0 3px 3px 0; }
.sidebar-label { overflow: hidden; text-overflow: ellipsis; flex: 1; }
.sidebar-tag { font-size: .58rem; background: var(--brand); color: white; padding: 2px 5px; border-radius: 4px; font-weight: 700; margin-left: auto; }
.sidebar-link:has(.icon) [class*="lgpd"], a[href="/admin/lgpd"].sidebar-link { position: relative; }

/* Botão Sair Isolado */
.sidebar-logout-wrap { padding: 12px 16px; border-top: 1px solid var(--border); }
.sidebar-logout-link { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--danger); font-size: .85rem; font-weight: 600; text-decoration: none; padding: 10px; border-radius: var(--radius-sm); border: 1px solid rgba(239,68,68,.3); background: rgba(239,68,68,.05); transition: all .2s; }
.sidebar-logout-link:hover { background: var(--danger); color: #fff; }
.sidebar-logout-link svg { width: 18px; height: 18px; stroke-width: 2; }

.sidebar-footer { padding: 12px 16px; border-top: 1px solid var(--border); }
.sidebar-license-info { overflow: hidden; }
.lic-empresa { font-size: .75rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lic-plano { display: inline-block; font-size: .62rem; padding: 2px 8px; border-radius: 10px; font-weight: 700; text-transform: uppercase; margin-top: 4px; }
.lic-plano.enterprise { background: rgba(139,92,246,.2); color: var(--purple); border: 1px solid rgba(139,92,246,.3); }
.lic-plano.profissional { background: rgba(59,130,246,.2); color: var(--info); border: 1px solid rgba(59,130,246,.3); }
.lic-plano.basico { background: rgba(16,185,129,.2); color: var(--success); border: 1px solid rgba(16,185,129,.3); }
.lic-plano.trial { background: rgba(245,158,11,.2); color: var(--warning); border: 1px solid rgba(245,158,11,.3); }

.sidebar-footer-info { display: flex; align-items: center; gap: 6px; color: var(--text-400); margin-top:6px; font-size:.65rem; flex-wrap: wrap; }
.sidebar-footer-info svg { width: 12px; height: 12px; }
.lic-status-ok { color: var(--success); display: flex; align-items: center; gap: 3px; }
.lic-status-warn { color: var(--warning); display: flex; align-items: center; gap: 3px; }
.lic-status-err { color: var(--danger); display: flex; align-items: center; gap: 3px; }

/* Comportamento quando a Sidebar Recolhe Totalmente */
.sidebar-collapsed .sidebar-brand-text, 
.sidebar-collapsed .sidebar-section-title span, 
.sidebar-collapsed .sidebar-section-title svg,
.sidebar-collapsed .sidebar-label, 
.sidebar-collapsed .sidebar-tag, 
.sidebar-collapsed .sidebar-license-info, 
.sidebar-collapsed .sidebar-search-wrap,
.sidebar-collapsed .sidebar-logout-wrap span { display: none; opacity: 0; pointer-events: none; width: 0; height: 0; padding: 0; margin: 0; overflow: hidden; }

.sidebar-collapsed .sidebar-section-title { padding: 0; margin: 0; cursor: default; }
.sidebar-collapsed .sidebar-section.collapsed .sidebar-section-content { display: flex; } /* Mantém os ícones visíveis mesmo se a sanfona estava fechada */
.sidebar-collapsed .sidebar-link, .sidebar-collapsed .sidebar-logout-link { justify-content: center; padding: 10px; }
.sidebar-collapsed .sidebar-link .icon, .sidebar-collapsed .sidebar-logout-link svg { width: auto; margin: 0; }
.sidebar-collapsed .sidebar-footer { padding: 10px 8px; }

/* Mobile overlay */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 99; backdrop-filter: blur(2px); }
.sidebar-overlay.visible { display: block; }

/* ===== TOPBAR (RELÓGIO E ÍCONES EM BRANCO) ===== */
.topbar { height: var(--topbar-h); background: #13131f; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; padding: 0 20px; position: sticky; top: 0; z-index: 50; flex-shrink: 0; }
.topbar-menu-btn { background: none; border: 1px solid var(--border); color: #fff; font-size: 1.2rem; cursor: pointer; padding: 6px; border-radius: 6px; display: none; align-items: center; justify-content: center; }
.topbar-menu-btn:hover { background: rgba(255,255,255,.06); border-color: var(--brand); }
.topbar-menu-btn svg { width: 20px; height: 20px; }
.topbar-breadcrumb { flex: 1; }
.topbar-breadcrumb h1 { font-size: 1.05rem; font-weight: 700; color: #fff; margin: 0; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* Relógio Branco */
.topbar-clock { font-size: .8rem; color: #fff; font-weight: 600; font-family: monospace; background: rgba(255,255,255,0.05); padding: 4px 10px; border-radius: 6px; border: 1px solid var(--border); }

/* Ícones da Topbar Brancos */
.topbar-btn { background: none; border: 1px solid var(--border); border-radius: 8px; color: #fff; cursor: pointer; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; text-decoration: none; transition: all .2s; position: relative; }
.topbar-btn svg { width: 18px; height: 18px; stroke-width: 2; }
.topbar-btn:hover { border-color: var(--brand); background: rgba(255,255,255,0.05); }
.topbar-btn[title*="LGPD"] { position: relative; }

.badge-dot { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; background: var(--danger); border-radius: 50%; border: 2px solid var(--bg-2); }
.topbar-user { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 10px; border-radius: 8px; border: 1px solid var(--border); transition: all .2s; }
.topbar-user:hover { border-color: var(--brand); background: rgba(255,255,255,0.02); }
.topbar-user-avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--brand-2)); display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; color: white; }
.topbar-user-name { font-size: .82rem; color: #fff; font-weight: 500; }

/* Notification dropdown */
.notif-dropdown { display: none; position: absolute; top: calc(100% + 8px); right: 0; width: 320px; background: var(--bg-card); border: 1px solid var(--border-2); border-radius: var(--radius); box-shadow: var(--shadow); z-index: 200; overflow: hidden; }
.notif-dropdown.open { display: block; }
.notif-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: .85rem; font-weight: 600; }
.notif-header button { background: none; border: none; color: var(--brand); cursor: pointer; font-size: .78rem; }
.notif-item { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); transition: background .15s; }
.notif-item:hover { background: rgba(255,255,255,.03); }
.notif-item.unread { background: rgba(232,70,10,.05); }
.notif-icon-wrap { width: 32px; height: 32px; border-radius: 50%; background: var(--bg-3); display: flex; align-items: center; justify-content: center; font-size: .85rem; flex-shrink: 0; }
.notif-icon-wrap svg { width: 16px; height: 16px; stroke-width: 2; }
.notif-title-text { font-size: .82rem; font-weight: 600; }
.notif-msg-text { font-size: .75rem; color: var(--text-400); margin-top: 2px; }
.notif-time-text { font-size: .68rem; color: var(--text-500); margin-top: 3px; }
.notif-empty { padding: 20px; text-align: center; color: var(--text-500); font-size: .82rem; }

/* ===== ALERTS ===== */
.alert-topbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 20px; font-size: .83rem; border-bottom: 1px solid; flex-shrink: 0; }
.alert-topbar.danger { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.3); color: #fca5a5; }
.alert-topbar.success { background: rgba(16,185,129,.1); border-color: rgba(16,185,129,.3); color: #6ee7b7; }
.alert-close { background: none; border: none; color: inherit; cursor: pointer; font-size: 1rem; opacity: .7; padding: 0 4px; }
.alert-close:hover { opacity: 1; }

/* ===== FOOTER ===== */
.app-footer { background: var(--bg-2); border-top: 1px solid var(--border); padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; flex-shrink: 0; }
.footer-brand { display: flex; align-items: center; gap: 10px; }
.footer-logo { width: 24px; height: 24px; object-fit: contain; }
.fn { font-size: .72rem; font-weight: 600; color: var(--text-300); }
.fs { font-size: .65rem; color: var(--text-400); }
.footer-right { display: flex; align-items: center; gap: 16px; }
.footer-lic { display: flex; gap: 12px; font-size: .68rem; color: var(--text-400); }
.footer-lic span > span { color: var(--text-300); font-weight: 600; }
.footer-version { font-size: .65rem; background: rgba(139,92,246,.15); color: var(--purple); padding: 2px 8px; border-radius: 4px; }
.footer-copy { font-size: .65rem; color: var(--text-500); }

/* ===== PAGE HEADER ===== */
.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 24px; }
.page-title { font-size: 1.3rem; font-weight: 700; }
.page-subtitle { font-size: .8rem; color: var(--text-400); margin-top: 2px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ===== CARDS ===== */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: visible; }
.card-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-title { font-size: .9rem; font-weight: 700; }
.card-subtitle { font-size: .8rem; color: var(--text-400); }
.card-body { padding: 20px; }

/* ===== SECTION-CARD (alias para .card, usado em painéis de permissão/módulos) ===== */
.section-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.section-card-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.section-card-title { font-size: .88rem; font-weight: 700; }
.section-card-body { padding: 16px; overflow-y: auto; }

/* Listas laterais com scroll (painel de usuários/módulos) */
.scroll-list { max-height: 520px; overflow-y: auto; padding: 8px; }
.scroll-list-sm { max-height: 300px; overflow-y: auto; padding: 8px; }

/* Painéis de permissão — grid de 2 colunas com altura fixa */
.perm-layout { display: grid; grid-template-columns: 240px 1fr; gap: 16px; align-items: start; }
.perm-sidebar { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; position: sticky; top: 0; }
.perm-sidebar-header { padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: .85rem; }
.perm-sidebar-list { max-height: calc(100vh - 200px); overflow-y: auto; }
.perm-main { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.perm-main-header { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.perm-main-body { max-height: calc(100vh - 200px); overflow-y: auto; padding: 12px; }

/* ===== KPI CARDS ===== */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.kpi-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; position: relative; overflow: hidden; transition: transform .2s, border-color .2s; }
.kpi-card:hover { transform: translateY(-2px); border-color: var(--border-2); }
.kpi-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.kpi-card.green::before { background: linear-gradient(90deg, var(--success), #34d399); }
.kpi-card.blue::before { background: linear-gradient(90deg, var(--info), #60a5fa); }
.kpi-card.purple::before { background: linear-gradient(90deg, var(--purple), #a78bfa); }
.kpi-card.yellow::before { background: linear-gradient(90deg, var(--warning), #fcd34d); }
.kpi-card.red::before { background: linear-gradient(90deg, var(--danger), #f87171); }
.kpi-card.cyan::before { background: linear-gradient(90deg, var(--cyan), #22d3ee); }
.kpi-icon { font-size: 1.5rem; margin-bottom: 10px; }
.kpi-value { font-size: 1.55rem; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.kpi-label { font-size: .72rem; color: var(--text-400); margin-top: 4px; font-weight: 500; }
.kpi-sub { font-size: .7rem; color: var(--text-500); margin-top: 4px; }
.kpi-progress { margin-top: 10px; }
.kpi-progress-bar { height: 4px; background: rgba(255,255,255,.08); border-radius: 2px; overflow: hidden; }
.kpi-progress-fill { height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); border-radius: 2px; transition: width 1s ease; }
.kpi-progress-pct { font-size: .65rem; color: var(--text-500); margin-top: 4px; }

/* ===== GRIDS ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ===== CHARTS ===== */
.chart-wrap { height: 240px; position: relative; }
.chart-wrap.tall { height: 320px; }

/* ===== FILTER BAR ===== */
.filter-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 0; }
.filter-bar .form-group { flex: 1; min-width: 130px; max-width: 220px; margin: 0; }

/* ===== FORMS ===== */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }
.form-label { font-size: .8rem; font-weight: 600; color: var(--text-300); }
.form-label.required::after { content: ' *'; color: var(--danger); }
.form-control { background: var(--bg-3); border: 1px solid var(--border-2); border-radius: var(--radius-sm); color: var(--text); padding: 9px 12px; font-size: .85rem; width: 100%; transition: border-color .15s, box-shadow .15s; appearance: none; }
.form-control:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(232,70,10,.15); }
.form-control::placeholder { color: var(--text-500); }
.form-control-lg { padding: 12px 14px; font-size: 1rem; }
.form-control option { background: var(--bg-3); }
textarea.form-control { resize: vertical; }
.input-group { display: flex; align-items: stretch; }
.input-prefix { background: var(--bg-2); border: 1px solid var(--border-2); border-right: none; border-radius: var(--radius-sm) 0 0 var(--radius-sm); padding: 9px 12px; font-size: .8rem; color: var(--text-400); white-space: nowrap; display: flex; align-items: center; }
.input-group .form-control { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-icon-wrap { position: relative; }
.input-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: .9rem; pointer-events: none; }
.input-icon-wrap .form-control { padding-left: 38px; }
.form-actions { display: flex; gap: 12px; justify-content: flex-end; padding-top: 16px; border-top: 1px solid var(--border); margin-top: 16px; }
.uppercase { text-transform: uppercase; }

/* ===== BUTTONS ===== */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: var(--radius-sm); font-size: .85rem; font-weight: 600; cursor: pointer; border: 1px solid transparent; text-decoration: none; transition: all .15s; white-space: nowrap; }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: white; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-secondary { background: var(--bg-3); border-color: var(--border-2); color: var(--text-300); }
.btn-secondary:hover { border-color: var(--border-2); background: var(--bg-card-hover); color: var(--text); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-400); }
.btn-ghost:hover { background: rgba(255,255,255,.06); color: var(--text); }
.btn-danger { background: rgba(239,68,68,.15); border-color: rgba(239,68,68,.3); color: var(--danger); }
.btn-danger:hover { background: rgba(239,68,68,.25); }
.btn-sm { padding: 6px 12px; font-size: .78rem; }
.btn-xs { padding: 4px 8px; font-size: .72rem; }
.btn-lg { padding: 12px 24px; font-size: .95rem; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-group { display: flex; gap: 4px; }

/* ===== TABLES ===== */
.table-wrapper { overflow-x: auto; width: 100%;}
.data-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.data-table th { text-align:left; padding: 10px 14px; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-400); border-bottom: 1px solid var(--border); white-space: nowrap; font-weight: 700; }
.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: rgba(255,255,255,.025); }

/* ===== BADGES ===== */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 20px; font-size: .7rem; font-weight: 700; white-space: nowrap; }
.badge-success { background: rgba(16,185,129,.15); color: var(--success); border: 1px solid rgba(16,185,129,.3); }
.badge-danger { background: rgba(239,68,68,.15); color: var(--danger); border: 1px solid rgba(239,68,68,.3); }
.badge-warning { background: rgba(245,158,11,.15); color: var(--warning); border: 1px solid rgba(245,158,11,.3); }
.badge-info { background: rgba(59,130,246,.15); color: var(--info); border: 1px solid rgba(59,130,246,.3); }
.badge-secondary { background: rgba(255,255,255,.06); color: var(--text-400); }
.badge-orto { background: rgba(139,92,246,.15); color: var(--purple); border: 1px solid rgba(139,92,246,.3); }
.badge-novo { background: rgba(16,185,129,.15); color: var(--success); border: 1px solid rgba(16,185,129,.3); }
.badge-purple { background: rgba(139,92,246,.15); color: var(--purple); border: 1px solid rgba(139,92,246,.3); }
.badge-blue { background: rgba(59,130,246,.15); color: var(--info); border: 1px solid rgba(59,130,246,.3); }
.row-inativo { opacity: .55; }
.badge-aberto { background: rgba(245,158,11,.15); color: var(--warning); border: 1px solid rgba(245,158,11,.3); }
.badge-inativo { background: rgba(80,80,112,.3); color: var(--text-400); }
.badge-naprov { background: rgba(239,68,68,.1); color: var(--danger); }
.badge-reaval { background: rgba(6,182,212,.15); color: var(--cyan); border: 1px solid rgba(6,182,212,.3); }
.badge-role-admin, .badge-role-superadmin { background: rgba(232,70,10,.15); color: var(--brand); border: 1px solid rgba(232,70,10,.3); }
.badge-role-gerente { background: rgba(139,92,246,.15); color: var(--purple); border: 1px solid rgba(139,92,246,.3); }
.badge-role-operador { background: rgba(59,130,246,.15); color: var(--info); border: 1px solid rgba(59,130,246,.3); }

/* License plan badges */
.lic-plano-enterprise { background: rgba(139,92,246,.15); color: var(--purple); border: 1px solid rgba(139,92,246,.3); border-radius: 4px; padding: 2px 8px; font-size: .7rem; font-weight: 700; }
.lic-plano-profissional { background: rgba(59,130,246,.15); color: var(--info); border: 1px solid rgba(59,130,246,.3); border-radius: 4px; padding: 2px 8px; font-size: .7rem; font-weight: 700; }
.lic-plano-basico { background: rgba(16,185,129,.15); color: var(--success); border: 1px solid rgba(16,185,129,.3); border-radius: 4px; padding: 2px 8px; font-size: .7rem; font-weight: 700; }
.lic-plano-trial { background: rgba(245,158,11,.15); color: var(--warning); border: 1px solid rgba(245,158,11,.3); border-radius: 4px; padding: 2px 8px; font-size: .7rem; font-weight: 700; }

/* ===== PERFORMANCE CARDS ===== */
.perf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.perf-card { background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.perf-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.perf-avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--brand-2)); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.1rem; flex-shrink: 0; }
.perf-name { font-weight: 700; font-size: .9rem; }
.perf-meta-bar { margin-bottom: 12px; }
.perf-meta-label { display: flex; justify-content: space-between; font-size: .72rem; color: var(--text-400); margin-bottom: 4px; }
.perf-bar { height: 6px; background: rgba(255,255,255,.06); border-radius: 3px; overflow: hidden; }
.perf-bar-fill { height: 100%; border-radius: 3px; transition: width 1s ease; }
.perf-bar-fill.ok { background: var(--success); }
.perf-bar-fill.warn { background: var(--warning); }
.perf-bar-fill.danger { background: var(--danger); }
.perf-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.perf-stat { text-align: center; }
.perf-stat-value { font-size: .9rem; font-weight: 700; }
.perf-stat-label { font-size: .62rem; color: var(--text-500); margin-top: 2px; }

/* ===== MODALS ===== */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 500; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
.modal-overlay.open { display: flex; }
.modal { background: var(--bg-card); border: 1px solid var(--border-2); border-radius: var(--radius); width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow); animation: modalIn .2s ease; }
@keyframes modalIn { from { opacity: 0; transform: scale(.95) translateY(-20px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-400); cursor: pointer; font-size: 1.1rem; padding: 4px; border-radius: 4px; }
.modal-close:hover { color: var(--text); background: rgba(255,255,255,.06); }
.modal-body { padding: 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); }

/* ===== PAGINATION ===== */
.pagination { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 8px 0; }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-icon { font-size: 3rem; margin-bottom: 12px; opacity: .5; }
.empty-title { font-size: 1.1rem; font-weight: 600; color: var(--text-300); }
.empty-sub { font-size: .82rem; color: var(--text-400); margin-top: 6px; }
.empty-sub a { color: var(--brand); text-decoration: none; }
.empty-state-small { font-size: .82rem; color: var(--text-400); padding: 20px 0; }
.empty-state-small a { color: var(--brand); }

/* ===== TEXT UTILS ===== */
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }
.text-purple { color: var(--purple); }
.text-muted { color: var(--text-400); }
.text-mono { font-family: monospace; }
.text-xs { font-size: .72rem; }
.text-center { text-align: center; }

/* ==== LOGIN ===== */
body.login-page { 
  background: var(--bg); 
  min-height: 100vh; 
  font-family: 'Segoe UI', system-ui, sans-serif; 
  color: var(--text); 
  overflow-x: hidden; 
  margin: 0; 
  padding: 0; 
}

.login-orb { position: fixed; border-radius: 50%; filter: blur(80px); pointer-events: none; animation: float 8s ease-in-out infinite; z-index: 1; }
.orb1 { width: 400px; height: 400px; background: rgba(232,70,10,.15); top: -100px; right: -100px; }
.orb2 { width: 300px; height: 300px; background: rgba(192,38,187,.12); bottom: -100px; left: -100px; animation-delay: -3s; }
.orb3 { width: 250px; height: 250px; background: rgba(124,58,237,.1); top: 50%; left: 50%; transform: translate(-50%,-50%); animation-delay: -6s; }
@keyframes float { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-30px) scale(1.05); } }
input[type="password"]::-ms-reveal, input[type="password"]::-ms-clear { display: none; }
.login-wrapper { position: relative; z-index: 10; display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 20px; box-sizing: border-box; }
.login-split-card { display: flex; width: 100%; max-width: 1100px; min-height: 650px; background: rgba(26,26,46,.9); border-radius: 24px; box-shadow: 0 25px 50px rgba(0,0,0,.6); border: 1px solid rgba(255,255,255,.05); overflow: hidden; backdrop-filter: blur(20px); }
.login-left { flex: 1; padding: 40px 50px; display: flex; flex-direction: column; justify-content: space-between; }
.login-brand { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 36px; }
.login-brand img { width: 60px !important; height: 60px !important; border-radius: 12px; object-fit: contain; }
.login-brand span { font-size: 2.6rem; line-height: 1; font-weight: 800; background: linear-gradient(135deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; letter-spacing: .05em; }
.login-headings { margin-bottom: 30px; text-align: center; }
.login-headings h1 { font-size: 2rem; font-weight: 800; margin-bottom: 8px; color: var(--text); margin-top: 0; }
.login-headings p { font-size: .85rem; color: var(--text-400); margin: 0; }
.login-alert { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3); color: #fca5a5; padding: 12px; border-radius: 8px; font-size: .82rem; margin-bottom: 20px; text-align: center; }
.form-group { margin-bottom: 20px; }
.form-group label.input-label { display: block; font-size: .8rem; font-weight: 600; color: var(--text-300); margin-bottom: 8px; }

.form-control { 
  box-sizing: border-box; 
  width: 100%; 
  height: 48px; 
  background: rgba(255,255,255,.03); 
  border: 1px solid var(--border-2); 
  border-radius: 8px; 
  padding: 0 16px; 
  color: var(--text); 
  font-size: .9rem; 
  transition: all .2s ease; 
}

.form-control:hover { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.2); }
.form-control:focus { border-color: var(--brand-3); background: rgba(255,255,255,.05); outline: none; box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15); }
.input-icon-right-wrap { position: relative; display: flex; align-items: center; }
.input-icon-right-wrap .form-control { padding-right: 46px; }

.btn-toggle-senha { 
  position: absolute; 
  right: 8px; 
  background: none; 
  border: none; 
  color: var(--text-400); 
  cursor: pointer; 
  padding: 6px; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  border-radius: 6px; 
  transition: all .2s ease; 
}
.btn-toggle-senha:hover { color: var(--text); background: rgba(255,255,255,.08); }
.login-options { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; font-size: .85rem; margin-top: 10px; }
.custom-checkbox { display: flex; align-items: center; gap: 8px; color: var(--text-300); cursor: pointer; user-select: none; }
.custom-checkbox input { margin: 0; width: 16px; height: 16px; accent-color: var(--brand-3); cursor: pointer; }
.forgot-link { color: var(--info); text-decoration: none; font-weight: 600; transition: color .2s; }
.forgot-link:hover { color: var(--brand-3); text-decoration: underline; }
/* Login: campos e botão mais compactos */
.login-page .form-control { height: 40px; padding: 0 12px; font-size: .85rem; }
.login-page .input-icon-right-wrap .form-control { padding-right: 42px; }
.login-page .btn-submit { height: 42px; font-size: .95rem; }
.btn-submit { width: 100%; height: 48px; background: linear-gradient(135deg, var(--brand), #c53a08); border: none; border-radius: 8px; color: #fff; font-size: 1rem; font-weight: 700; cursor: pointer; transition: filter .2s; margin-bottom: 24px; }
.btn-submit:hover { filter: brightness(1.1); }
.login-footer-info { display: flex; justify-content: space-between; font-size: .75rem; color: var(--text-500); margin-top: 40px; }
.login-footer-info a { color: var(--text-500); text-decoration: none; transition: color 0.2s; }
.login-footer-info a:hover { color: var(--text-400); }
.login-right { flex: 1.1; margin: 16px; border-radius: 16px; background: linear-gradient(135deg, rgba(124,58,237,.2), rgba(6,182,212,.15)), var(--bg-2); padding: 60px 50px; display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; border: 1px solid rgba(255,255,255,.05); box-sizing: border-box; }
.login-right::before { content: ''; position: absolute; top: -10%; right: -20%; width: 400px; height: 400px; background: rgba(124,58,237,.15); filter: blur(60px); border-radius: 50%; }
.banner-content { position: relative; z-index: 2; text-align: left; pointer-events: none; user-select: none;}
.banner-content h2 { font-size: 2.2rem; font-weight: 800; line-height: 1.25; margin-bottom: 16px; color: #fff; margin-top: 0; }
.banner-content p { font-size: 1rem; color: rgba(255,255,255,.8); margin-bottom: 40px; max-width: 90%; line-height: 1.5; }
.dashboard-mockup { width: 100%; height: 260px; background: var(--bg-card); border-radius: 12px; border: 1px solid rgba(255,255,255,.1); box-shadow: 0 20px 40px rgba(0,0,0,.2); display: flex; flex-direction: column; overflow: hidden; }
.mockup-header { height: 32px; background: rgba(255,255,255,.02); border-bottom: 1px solid rgba(255,255,255,.05); display: flex; align-items: center; padding: 0 16px; gap: 8px; }
.mockup-header span { width: 10px; height: 10px; border-radius: 50%; display: block; }
.mockup-body { flex: 1; padding: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; background: var(--bg-2); }
.mockup-card { background: var(--bg-card); border-radius: 8px; border: 1px solid rgba(255,255,255,.03); }
.m-card-1 { grid-column: span 2; height: 70px; background: rgba(255,255,255,.02); }
.m-card-2 { background: linear-gradient(135deg, rgba(6,182,212,.15), transparent); } 
.m-card-3 { background: linear-gradient(135deg, rgba(255,71,133,.15), transparent); }
@media (max-width: 900px) {
  .login-split-card { flex-direction: column; min-height: auto; max-width: 480px; }
  .login-right { display: none; }
  .login-left { padding: 40px 30px; }
  .login-footer-info { flex-direction: column; align-items: center; gap: 10px; margin-top: 40px; }
}

/* ===== TOAST ===== */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--bg-card); border: 1px solid var(--border-2); border-radius: var(--radius-sm); padding: 12px 16px; font-size: .82rem; box-shadow: var(--shadow); animation: toastIn .3s ease; display: flex; gap: 10px; align-items: center; min-width: 280px; }
.toast.success { border-color: rgba(16,185,129,.4); }
.toast.danger { border-color: rgba(239,68,68,.4); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } }

/* ===== ANIMATIONS ===== */
.animate-in { animation: fadeUp .4s ease; }
.animate-in-2 { animation: fadeUp .4s ease .1s both; }
.animate-in-3 { animation: fadeUp .4s ease .2s both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .sidebar { left: -100%; transition: left .3s ease, width .3s ease; width: var(--sidebar-w) !important; }
  .sidebar.open { left: 0; }
  .main-content { margin-left: 0 !important; }
  .topbar-menu-btn { display: flex; }
  .sidebar-overlay.visible { display: block; }
  .sidebar-collapse-btn { display: none; }
}
@media (max-width: 768px) {
  .grid-2, .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 16px; }
  .filter-bar .form-group { min-width: 100%; max-width: 100%; }
  .ia-layout { flex-direction: column; }
  .ia-sidebar { width: 100%; min-width: 100%; max-height: 200px; }
  .perf-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .topbar-clock { display: none; }
  .login-card { padding: 24px; }
}

/* =================================================================
   MÓDULO ESTOQUE + CLÍNICA + PERFORMANCE RANKING + RESPONSIVIDADE
   ================================================================= */

/* ---- Movimentação de Estoque ---- */
.tipo-mov-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tipo-mov-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 16px 8px; background: var(--bg-3); border: 2px solid var(--border);
  border-radius: var(--radius); cursor: pointer; transition: all .2s; text-align: center;
  position: relative; gap: 4px; user-select: none;
}
.tipo-mov-card input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.tipo-mov-card:hover { border-color: var(--border-2); transform: translateY(-2px); }
.tipo-mov-card.selected { border-color: var(--brand); background: rgba(232,70,10,.08); }
.tipo-mov-card.entrada.selected { border-color: var(--success); background: rgba(16,185,129,.1); }
.tipo-mov-card.saida.selected { border-color: var(--danger); background: rgba(239,68,68,.08); }
.tipo-mov-card.perda.selected { border-color: var(--warning); background: rgba(245,158,11,.08); }
.tipo-mov-card.ajuste.selected { border-color: #38bdf8; background: rgba(56,189,248,.08); }
.tipo-icon { font-size: 1.8rem; line-height: 1; }
.tipo-label { font-size: .82rem; font-weight: 700; color: var(--text); }
.tipo-desc { font-size: .68rem; color: var(--text-400); }
.total-display {
  font-size: 1.6rem; font-weight: 800; color: var(--success);
  background: rgba(16,185,129,.07); border: 1px solid rgba(16,185,129,.2);
  border-radius: var(--radius-sm); padding: 10px 18px; text-align: right;
  font-family: var(--font-mono);
}

/* ---- Acesso Rápido Cards ---- */
.quick-action-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 18px 14px; background: var(--bg-3); border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer; transition: all .2s;
  text-decoration: none; gap: 8px; min-width: 90px; flex: 1;
}
.quick-action-card:hover { border-color: var(--border-2); transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.quick-action-card.green { border-color: rgba(16,185,129,.3); }
.quick-action-card.green:hover { background: rgba(16,185,129,.08); border-color: var(--success); }
.quick-action-card.blue { border-color: rgba(59,130,246,.3); }
.quick-action-card.blue:hover { background: rgba(59,130,246,.08); border-color: #3b82f6; }
.quick-action-card.red { border-color: rgba(239,68,68,.3); }
.quick-action-card.red:hover { background: rgba(239,68,68,.08); border-color: var(--danger); }
.quick-action-card.purple { border-color: rgba(139,92,246,.3); }
.quick-action-card.purple:hover { background: rgba(139,92,246,.08); border-color: #8b5cf6; }
.qa-icon { font-size: 1.8rem; line-height: 1; }
.qa-label { font-size: .78rem; font-weight: 600; color: var(--text-400); text-align: center; }

/* ---- Tabela row highlights ---- */
tr.row-danger { background: rgba(239,68,68,.04) !important; }
tr.row-warning { background: rgba(245,158,11,.04) !important; }
tr.row-danger:hover { background: rgba(239,68,68,.09) !important; }
tr.row-warning:hover { background: rgba(245,158,11,.09) !important; }

/* ---- Status agenda ---- */
.agenda-lista { display: flex; flex-direction: column; gap: 8px; padding: 8px 0; }
.agenda-item {
  display: grid; grid-template-columns: 56px 4px 1fr auto; gap: 12px; align-items: center;
  padding: 10px 16px; background: var(--bg-3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); transition: background .15s;
}
.agenda-item:hover { background: var(--bg-card-hover); }
.agenda-hora { text-align: center; }
.hora-inicio { display: block; font-size: .95rem; font-weight: 700; color: var(--text); font-family: var(--font-mono); }
.hora-dur { font-size: .68rem; color: var(--text-500); }
.agenda-cor { width: 4px; height: 44px; border-radius: 2px; }
.agenda-info { min-width: 0; }
.agenda-paciente { font-size: .88rem; font-weight: 700; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agenda-detalhe { display: flex; gap: 10px; flex-wrap: wrap; font-size: .72rem; color: var(--text-400); }
.agenda-valor { font-size: .75rem; display: flex; gap: 6px; align-items: center; margin-top: 2px; }
.agenda-status select { min-width: 130px; font-size: .72rem; padding: 4px 6px; height: auto; }

/* ---- Agenda completa (dia a dia) ---- */
.agenda-completa { display: flex; flex-direction: column; gap: 10px; }
.agenda-card {
  display: grid; grid-template-columns: 72px 5px 1fr auto; gap: 14px; align-items: center;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; transition: all .2s;
}
.agenda-card:hover { border-color: var(--border-2); transform: translateX(2px); }
.agenda-card.status-concluido { opacity: .75; }
.agenda-card.status-cancelado { opacity: .5; filter: grayscale(.3); }
.agenda-card.status-em_atendimento { border-color: rgba(16,185,129,.4); background: rgba(16,185,129,.03); }
.agenda-card-hora { text-align: center; min-width: 60px; }
.hora-grande { font-size: 1.1rem; font-weight: 800; font-family: var(--font-mono); color: var(--text); }
.hora-dur-label { font-size: .68rem; color: var(--text-500); }
.agenda-card-cor { width: 5px; height: 60px; border-radius: 3px; align-self: center; }
.agenda-card-body { min-width: 0; }
.ag-paciente { font-size: .95rem; font-weight: 700; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ag-detalhe { display: flex; gap: 12px; flex-wrap: wrap; font-size: .75rem; color: var(--text-400); margin-bottom: 4px; }
.ag-footer { display: flex; gap: 8px; align-items: center; font-size: .78rem; }
.agenda-card-acoes { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; min-width: 120px; }
.status-badge {
  font-size: .72rem; font-weight: 600; padding: 4px 10px;
  border-radius: 20px; border: 1px solid var(--border);
  white-space: nowrap;
}
.status-badge.status-concluido { color: var(--success); border-color: rgba(16,185,129,.3); background: rgba(16,185,129,.08); }
.status-badge.status-em_atendimento { color: #38bdf8; border-color: rgba(56,189,248,.3); background: rgba(56,189,248,.08); }
.status-badge.status-agendado { color: var(--text-400); }
.status-badge.status-faltou { color: var(--danger); border-color: rgba(239,68,68,.3); }
.status-badge.status-cancelado { color: var(--text-500); }

/* ---- Ficha paciente ---- */
.alerta-medico {
  background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.35);
  color: #fca5a5; padding: 6px 14px; border-radius: 6px;
  font-size: .8rem; font-weight: 600; margin-top: 4px; display: inline-block;
}
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; flex-wrap: wrap; }
.tab-btn {
  padding: 10px 18px; font-size: .82rem; font-weight: 600; background: none;
  border: none; border-bottom: 2px solid transparent; color: var(--text-400);
  cursor: pointer; transition: all .2s; margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab-content { display: none; }
.tab-content.active { display: block; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.info-item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.info-item:last-child { border-bottom: none; }
.info-label { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-500); margin-bottom: 2px; }
.info-value { font-size: .85rem; color: var(--text); }

/* ---- Prontuário ---- */
.prontuario-item { padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 12px; }
.pront-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: .85rem; }
.pront-queixa { font-size: .8rem; color: var(--text-400); margin-bottom: 6px; font-style: italic; }
.pront-evolucao { font-size: .85rem; line-height: 1.6; white-space: pre-wrap; }
.pront-prescricao { margin-top: 8px; font-size: .8rem; padding: 8px; background: rgba(139,92,246,.07); border-radius: 6px; border-left: 3px solid #8b5cf6; }

/* ---- Busca autocomplete ---- */
.busca-dropdown {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 200;
  background: var(--bg-card); border: 1px solid var(--border-2);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  max-height: 300px; overflow-y: auto;
}
.busca-item { padding: 10px 14px; cursor: pointer; font-size: .82rem; border-bottom: 1px solid var(--border); transition: background .15s; }
.busca-item:hover { background: var(--bg-3); }
.busca-item:last-child { border-bottom: none; }

/* ---- Performance Ranking ---- */
.ranking-lista { display: flex; flex-direction: column; gap: 12px; }
.ranking-item {
  display: grid; grid-template-columns: 44px 40px 1fr auto; gap: 12px; align-items: center;
  padding: 14px 16px; background: var(--bg-3); border: 1px solid var(--border);
  border-radius: var(--radius); transition: all .2s;
}
.ranking-item:hover { border-color: var(--border-2); transform: translateX(3px); }
.ranking-posicao { text-align: center; min-width: 40px; }
.medalha { font-size: 1.6rem; }
.ranking-num { font-size: 1rem; font-weight: 800; color: var(--text-400); font-family: var(--font-mono); }
.ranking-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1rem; color: white; text-transform: uppercase;
  flex-shrink: 0;
}
.ranking-info { min-width: 0; flex: 1; }
.ranking-nome { font-weight: 700; font-size: .92rem; margin-bottom: 6px; }
.ranking-barra-wrap { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.ranking-barra { flex: 1; height: 8px; background: var(--bg-2); border-radius: 4px; overflow: hidden; }
.ranking-barra-fill { height: 100%; border-radius: 4px; transition: width .6s ease; }
.ranking-barra-fill.barra-ok { background: linear-gradient(90deg, var(--success), #34d399); }
.ranking-barra-fill.barra-warn { background: linear-gradient(90deg, var(--warning), #fbbf24); }
.ranking-barra-fill.barra-danger { background: linear-gradient(90deg, var(--danger), #f87171); }
.ranking-pct { font-size: .78rem; font-weight: 700; font-family: var(--font-mono); min-width: 36px; text-align: right; }
.ranking-stats { display: flex; gap: 10px; flex-wrap: wrap; font-size: .72rem; color: var(--text-400); }
.ranking-stats span { display: flex; align-items: center; gap: 3px; }
.ranking-valor { text-align: right; min-width: 110px; }
.rv-fat { font-size: .95rem; font-weight: 800; font-family: var(--font-mono); color: var(--success); }
.rv-ticket { margin-top: 2px; }

/* ---- PCT bar inline tabela ---- */
.pct-inline { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.pct-bar-wrap { flex: 1; height: 6px; background: var(--bg-2); border-radius: 3px; overflow: hidden; min-width: 50px; }
.pct-bar-fill { height: 100%; border-radius: 3px; transition: width .4s ease; }
.pct-bar-fill.ok { background: var(--success); }
.pct-bar-fill.warn { background: var(--warning); }
.pct-bar-fill.danger { background: var(--danger); }
.text-purple { color: #a78bfa; }
.text-info { color: #38bdf8; }

/* ---- KPI extras ---- */
.kpi-card.red { border-color: rgba(239,68,68,.25); }
.kpi-card.red .kpi-value { color: var(--danger); }
.kpi-card.yellow { border-color: rgba(245,158,11,.25); }
.kpi-card.yellow .kpi-value { color: var(--warning); }
.kpi-card.purple { border-color: rgba(139,92,246,.25); }
.kpi-card.purple .kpi-value { color: #a78bfa; }
.kpi-sub { font-size: .7rem; color: var(--text-500); margin-top: 2px; }
.kpi-progress { margin-top: 8px; }
.kpi-progress-bar { height: 4px; background: var(--bg-2); border-radius: 2px; overflow: hidden; }
.kpi-progress-fill { height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); border-radius: 2px; transition: width .5s ease; }
.kpi-progress-pct { font-size: .68rem; color: var(--text-500); margin-top: 3px; text-align: right; }

/* ---- Form sections ---- */
.form-section-title {
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--brand); margin: 20px 0 12px; padding-bottom: 8px;
  border-bottom: 1px solid rgba(232,70,10,.2);
}
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.form-control-xs { font-size: .72rem; padding: 4px 8px; height: auto; }
.form-control-lg { font-size: 1.1rem; padding: 12px 14px; font-weight: 600; }
.uppercase { text-transform: uppercase; }

/* ---- Btn extras ---- */
.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-success:hover { background: #059669; border-color: #059669; }
.btn-info { background: #38bdf8; color: white; border-color: #38bdf8; }
.btn-info:hover { background: #0ea5e9; }
.btn-xs { font-size: .68rem; padding: 3px 8px; height: auto; }
.btn-lg { padding: 12px 24px; font-size: .95rem; }
.btn-group { display: flex; gap: 4px; }
.ml-1 { margin-left: 4px; }
.ml-2 { margin-left: 8px; }

/* ---- Modal ---- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 500; display: none; align-items: center; justify-content: center; padding: 16px; }
.modal-overlay.open { display: flex; }
.modal { background: var(--bg-card); border: 1px solid var(--border-2); border-radius: var(--radius-lg); width: 100%; max-width: 600px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 1rem; font-weight: 700; margin: 0; }
.modal-close { background: none; border: none; color: var(--text-400); cursor: pointer; font-size: 1.1rem; padding: 4px 8px; border-radius: 6px; }
.modal-close:hover { background: var(--bg-3); color: var(--text); }
.modal-body { padding: 22px; overflow-y: auto; flex: 1; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); }

/* ---- Aniversariantes ---- */
@keyframes birthdayPulse { 0%,100%{box-shadow:0 0 0 0 rgba(245,158,11,.4)} 50%{box-shadow:0 0 0 8px rgba(245,158,11,0)} }

/* ---- Empty state ---- */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-title { font-size: 1rem; font-weight: 600; color: var(--text-400); margin-bottom: 6px; }
.empty-sub { font-size: .82rem; color: var(--text-500); }
.empty-sub a { color: var(--brand); text-decoration: none; }

/* ---- Misc ---- */
.text-mono { font-family: var(--font-mono); }
.text-xs { font-size: .72rem; }
.text-muted { color: var(--text-400) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-center { text-align: center; }
.badge { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 20px; font-size: .7rem; font-weight: 600; border: 1px solid transparent; }
.badge-success { background: rgba(16,185,129,.12); color: #34d399; border-color: rgba(16,185,129,.25); }
.badge-danger { background: rgba(239,68,68,.12); color: #f87171; border-color: rgba(239,68,68,.25); }
.badge-warning { background: rgba(245,158,11,.12); color: #fbbf24; border-color: rgba(245,158,11,.25); }
.badge-info { background: rgba(56,189,248,.12); color: #38bdf8; border-color: rgba(56,189,248,.25); }
.badge-secondary { background: rgba(255,255,255,.06); color: var(--text-400); border-color: var(--border); }
.badge-primary { background: rgba(232,70,10,.12); color: var(--brand); border-color: rgba(232,70,10,.25); }

/* ================================================================
   RESPONSIVIDADE COMPLETA — TODOS OS DISPOSITIVOS DO MERCADO
   ================================================================ */

/* Desktop grande 1440px+ */
@media (min-width: 1440px) {
  :root { --sidebar-w: 260px; }
  .kpi-grid { grid-template-columns: repeat(6, 1fr); }
  .page-content { max-width: 1600px; }
}

/* Desktop 1024–1440px */
@media (max-width: 1440px) {
  .kpi-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
}

/* Tablet landscape + pequeno laptop 768–1024px */
@media (max-width: 1024px) {
  .sidebar { left: -100%; transition: left .28s ease, width .28s ease; width: var(--sidebar-w) !important; box-shadow: none; }
  .sidebar.open { left: 0; box-shadow: 8px 0 40px rgba(0,0,0,.4); }
  .main-content { margin-left: 0 !important; }
  .topbar-menu-btn { display: flex !important; }
  .sidebar-overlay.visible { display: block; }
  .sidebar-collapse-btn { display: none !important; }
  .grid-2 { grid-template-columns: 1fr; }
  .ranking-stats { gap: 8px; }
  .agenda-card { grid-template-columns: 56px 4px 1fr; }
  .agenda-card-acoes { grid-column: 3; display: flex; flex-direction: row; flex-wrap: wrap; gap: 4px; }
}

/* Tablet portrait 600–768px */
@media (max-width: 768px) {
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 12px; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .page-actions { width: 100%; display: flex; flex-wrap: wrap; gap: 8px; }
  .page-actions .btn { flex: 1; justify-content: center; min-width: 120px; }
  .filter-bar { flex-wrap: wrap; }
  .filter-bar .form-group { min-width: calc(50% - 8px); max-width: 100%; }
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table th, .table td { padding: 8px 10px; font-size: .78rem; }
  .tipo-mov-grid { grid-template-columns: repeat(2, 1fr); }
  .ranking-item { grid-template-columns: 40px 36px 1fr; }
  .ranking-valor { display: none; }
  .tabs { gap: 0; }
  .tab-btn { padding: 8px 12px; font-size: .76rem; }
  .info-grid { grid-template-columns: 1fr; }
  .agenda-card { grid-template-columns: 60px 4px 1fr; gap: 8px; padding: 12px; }
  .agenda-card-acoes { grid-column: 1 / -1; display: flex; flex-direction: row; gap: 4px; flex-wrap: wrap; }
  .modal { max-height: 95vh; }
  .quick-action-card { min-width: 70px; padding: 12px 8px; }
  .qa-icon { font-size: 1.4rem; }
}

/* Mobile grande 480–600px */
@media (max-width: 600px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi-card { padding: 14px 10px; }
  .kpi-value { font-size: 1.3rem; }
  .card-header { flex-wrap: wrap; gap: 8px; }
  .filter-bar .form-group { min-width: 100%; }
  .ranking-item { grid-template-columns: 36px 1fr; }
  .ranking-avatar { display: none; }
  .ranking-stats { gap: 6px; }
  .agenda-item { grid-template-columns: 52px 3px 1fr; }
  .agenda-status { grid-column: 1 / -1; }
  .topbar-right { gap: 8px; }
}

/* Mobile 360–480px */
@media (max-width: 480px) {
  :root { --sidebar-w: 100vw; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .kpi-card { padding: 12px 8px; }
  .kpi-value { font-size: 1.1rem; }
  .kpi-icon { font-size: 1.3rem; }
  .topbar { padding: 0 12px; }
  .topbar-clock { display: none; }
  .topbar-title { font-size: .88rem; }
  .page-content { padding: 8px; }
  .card { border-radius: 10px; }
  .card-header { padding: 12px 14px; }
  .card-body { padding: 12px; }
  .login-card { padding: 20px 16px; }
  .login-system { font-size: 1.5rem; }
  .tipo-mov-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .total-display { font-size: 1.2rem; padding: 8px 12px; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; }
  .tab-btn { white-space: nowrap; padding: 8px 10px; }
  .btn-lg { padding: 10px 18px; font-size: .88rem; }
  .form-section-title { font-size: .68rem; margin: 14px 0 10px; }
  .agenda-lista { gap: 6px; }
  .prontuario-item { padding: 12px; }
}

/* Mobile pequeno < 360px */
@media (max-width: 360px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .page-actions .btn { font-size: .78rem; padding: 6px 10px; }
  .table th, .table td { padding: 6px 8px; font-size: .72rem; white-space: nowrap; }
}

/* Touch: remove hover effects que atrapalham */
@media (hover: none) {
  .ranking-item:hover { transform: none; }
  .quick-action-card:hover { transform: none; }
  .agenda-card:hover { transform: none; }
  .tipo-mov-card:hover { transform: none; }
}

/* Print */
@media print {
  .sidebar, .topbar, .page-actions, .filter-bar, .btn { display: none !important; }
  .main-content { margin: 0 !important; }
  .card { border: 1px solid #ddd; break-inside: avoid; }
}

/* =================================================================
   MELHORIAS v2.1 — Dashboard avançado, KPIs com MoM, Podium, etc.
   ================================================================= */

/* ---- dash-topbar (filtro compacto no topo) ---- */
.dash-topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.filter-bar-inline { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.form-group-inline { display: flex; flex-direction: column; gap: 4px; }
.form-label-sm { font-size: .68rem; color: var(--text-500); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.form-control-sm { font-size: .8rem; padding: 5px 10px; height: 32px; }
.dash-topbar-actions { display: flex; gap: 8px; }

/* ---- Alert banner ---- */
.alert-banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid; animation: fadeUp .3s ease; }
.alert-banner.warning { background: rgba(245,158,11,.08); border-color: rgba(245,158,11,.3); color: #fcd34d; }
.alert-banner.danger { background: rgba(239,68,68,.08); border-color: rgba(239,68,68,.3); color: #fca5a5; }
.alert-banner.success { background: rgba(16,185,129,.08); border-color: rgba(16,185,129,.3); color: #6ee7b7; }
.alert-banner-icon { font-size: 1.2rem; flex-shrink: 0; }
.alert-banner-body { flex: 1; font-size: .82rem; }
.alert-banner-close { background: none; border: none; color: inherit; cursor: pointer; opacity: .6; font-size: .9rem; padding: 0 4px; flex-shrink: 0; }
.alert-banner-close:hover { opacity: 1; }

/* ---- KPI cards v2 com icon-wrap e badge ---- */
.kpi-featured { position: relative; overflow: hidden; }
.kpi-card-bg { position: absolute; inset: 0; background: linear-gradient(135deg, rgba(232,70,10,.06) 0%, transparent 60%); pointer-events: none; }
.kpi-header-row { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; min-height: 36px; }
.kpi-icon-wrap { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.kpi-icon-wrap.orange { background: rgba(232,70,10,.15); }
.kpi-icon-wrap.green  { background: rgba(16,185,129,.15); }
.kpi-icon-wrap.blue   { background: rgba(59,130,246,.15); }
.kpi-icon-wrap.purple { background: rgba(139,92,246,.15); }
.kpi-icon-wrap.cyan   { background: rgba(6,182,212,.15); }
.kpi-icon-wrap.yellow { background: rgba(245,158,11,.15); }
.kpi-icon-wrap.red    { background: rgba(239,68,68,.15); }
.kpi-icon-wrap.gray   { background: rgba(255,255,255,.07); }
.kpi-badge { font-size: .68rem; font-weight: 700; padding: 3px 8px; border-radius: 20px; white-space: nowrap; }
.kpi-badge-up   { background: rgba(16,185,129,.15); color: var(--success); border: 1px solid rgba(16,185,129,.25); }
.kpi-badge-down { background: rgba(239,68,68,.12); color: var(--danger); border: 1px solid rgba(239,68,68,.2); }
.kpi-progress-wrap { margin-top: 10px; }
.kpi-progress-track { height: 5px; background: rgba(255,255,255,.07); border-radius: 3px; overflow: hidden; }
.kpi-progress-fill { height: 100%; border-radius: 3px; transition: width 1s ease; }
.kpi-progress-fill.orange { background: linear-gradient(90deg, var(--brand), #f97316); }
.kpi-progress-fill.green  { background: linear-gradient(90deg, var(--success), #34d399); }
.kpi-progress-fill.purple { background: linear-gradient(90deg, var(--purple), #a78bfa); }
.kpi-progress-fill.blue   { background: linear-gradient(90deg, var(--info), #60a5fa); }
.kpi-progress-label { font-size: .67rem; color: var(--text-500); margin-top: 4px; }
.kpi-prev { font-size: .68rem; color: var(--text-500); margin-top: 6px; border-top: 1px solid var(--border); padding-top: 6px; }
.kpi-sub-row { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.kpi-chip { font-size: .65rem; padding: 2px 7px; border-radius: 10px; font-weight: 600; }
.kpi-chip.green  { background: rgba(16,185,129,.12); color: #34d399; }
.kpi-chip.red    { background: rgba(239,68,68,.12); color: #f87171; }
.kpi-chip.blue   { background: rgba(59,130,246,.12); color: #60a5fa; }
.kpi-chip.yellow { background: rgba(245,158,11,.12); color: #fbbf24; }

/* ---- Charts grid ---- */
.grid-charts { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; }
.chart-card-main { }
.chart-legend-inline { display: flex; gap: 10px; align-items: center; }
.cleg { font-size: .72rem; font-weight: 600; }
.cleg::before { content: '●'; margin-right: 4px; }
.cleg.orange::before { color: var(--brand); }
.cleg.purple::before { color: var(--purple); }
.cleg.green::before  { color: var(--success); }

/* ---- Pódio do mês ---- */
.podium-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.podium-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 20px 12px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--bg-3); text-align: center; position: relative; overflow: hidden;
  transition: transform .2s, border-color .2s;
}
.podium-card:hover { transform: translateY(-4px); }
.podium-1 { border-color: rgba(251,191,36,.35); background: linear-gradient(180deg, rgba(251,191,36,.06) 0%, var(--bg-3) 60%); }
.podium-2 { border-color: rgba(156,163,175,.35); }
.podium-3 { border-color: rgba(180,83,9,.3); }
.podium-medal { font-size: 2rem; line-height: 1; }
.podium-avatar {
  width: 48px; height: 48px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 800; color: white; text-transform: uppercase;
}
.podium-1 .podium-avatar { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.podium-nome { font-weight: 700; font-size: .88rem; color: var(--text); }
.podium-fat { font-size: 1.05rem; font-weight: 800; color: var(--success); font-family: var(--font-mono); }
.podium-pct-bar { width: 100%; height: 6px; background: rgba(255,255,255,.07); border-radius: 3px; overflow: hidden; }
.podium-pct-fill { height: 100%; border-radius: 3px; transition: width .8s ease; }
.podium-pct-fill.ok { background: var(--success); }
.podium-pct-fill.warn { background: var(--warning); }
.podium-pct-fill.danger { background: var(--danger); }
.podium-pct-label { font-size: .68rem; color: var(--text-500); }
.podium-stats { display: flex; gap: 8px; font-size: .72rem; color: var(--text-400); flex-wrap: wrap; justify-content: center; }

/* ---- Table improvements ---- */
.table-hover tbody tr:hover { background: var(--bg-card-hover); }
.row-aprov { }
.td-paciente { }
.consultor-tag { background: rgba(255,255,255,.05); border: 1px solid var(--border); padding: 2px 8px; border-radius: 6px; font-size: .78rem; white-space: nowrap; }
.aprovado-badge { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; font-size: .8rem; font-weight: 700; }
.aprovado-badge.ok { background: rgba(16,185,129,.15); color: var(--success); border: 1px solid rgba(16,185,129,.3); }
.aprovado-badge.no { background: rgba(239,68,68,.15); color: var(--danger); border: 1px solid rgba(239,68,68,.3); }
.aprovado-badge.pending { background: rgba(255,255,255,.06); color: var(--text-500); border: 1px solid var(--border); }
.status-dot { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; font-size: .75rem; font-weight: 700; }
.status-dot.green { background: rgba(16,185,129,.15); color: var(--success); }
.status-dot.red   { background: rgba(239,68,68,.12); color: var(--danger); }
.status-dot.gray  { background: rgba(255,255,255,.05); color: var(--text-500); }
.th-sort { user-select: none; }
.th-sort:hover { color: var(--brand); }
.text-right { text-align: right !important; }
.text-center { text-align: center !important; }

/* ---- Form improvements ---- */
.field-error { border-color: var(--danger) !important; box-shadow: 0 0 0 2px rgba(239,68,68,.2) !important; }
.form-control:focus { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(232,70,10,.15); outline: none; }
.input-with-icon { position: relative; }
.form-hint { font-size: .7rem; color: var(--text-500); margin-top: 3px; }
.form-label.required::after { content: ' *'; color: var(--danger); }

/* ---- Sidebar search ---- */
.sidebar-search-wrap { padding: 8px 4px 12px; }
.sidebar-search { width: 100%; background: rgba(255,255,255,.05); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 12px; font-size: .78rem; color: var(--text); outline: none; transition: border-color .2s; }
.sidebar-search:focus { border-color: var(--brand); }
.sidebar-search::placeholder { color: var(--text-500); }
.sidebar-collapsed .sidebar-search-wrap { display: none; }

/* ---- btn-danger ---- */
.btn-danger { background: rgba(239,68,68,.15); color: var(--danger); border-color: rgba(239,68,68,.3); }
.btn-danger:hover { background: var(--danger); color: white; border-color: var(--danger); }

/* ---- Gerente performance template gerente ---- */
.perf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 16px; }
.perf-card { background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; transition: all .2s; }
.perf-card:hover { border-color: var(--border-2); transform: translateY(-2px); }
.perf-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.perf-avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--brand-2)); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .9rem; color: white; text-transform: uppercase; flex-shrink: 0; }
.perf-name { font-weight: 700; font-size: .88rem; }
.perf-meta-bar { margin-bottom: 10px; }
.perf-meta-label { display: flex; justify-content: space-between; font-size: .7rem; color: var(--text-400); margin-bottom: 4px; }
.perf-bar { height: 6px; background: rgba(255,255,255,.07); border-radius: 3px; overflow: hidden; }
.perf-bar-fill { height: 100%; border-radius: 3px; transition: width .8s ease; }
.perf-bar-fill.ok { background: var(--success); }
.perf-bar-fill.warn { background: var(--warning); }
.perf-bar-fill.danger { background: var(--danger); }
.perf-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.perf-stat { text-align: center; }
.perf-stat-value { font-size: .88rem; font-weight: 700; }
.perf-stat-label { font-size: .65rem; color: var(--text-500); }

/* ---- Badge variants ---- */
.badge-orto  { background: rgba(139,92,246,.15); color: #a78bfa; border-color: rgba(139,92,246,.25); }
.badge-novo  { background: rgba(16,185,129,.15); color: #34d399; border-color: rgba(16,185,129,.25); }
.badge-purple { background: rgba(139,92,246,.15); color: #a78bfa; border-color: rgba(139,92,246,.25); }
.badge-blue   { background: rgba(59,130,246,.15); color: #60a5fa; border-color: rgba(59,130,246,.25); }
.row-inativo  { opacity: .55; }
.badge-aberto { background: rgba(245,158,11,.12); color: #fbbf24; border-color: rgba(245,158,11,.25); }
.badge-inativo { background: rgba(255,255,255,.06); color: var(--text-500); border-color: var(--border); }
.badge-naprov { background: rgba(239,68,68,.12); color: #f87171; border-color: rgba(239,68,68,.25); }
.badge-reaval { background: rgba(59,130,246,.12); color: #60a5fa; border-color: rgba(59,130,246,.25); }

/* ---- Responsive para novas grid ---- */
@media (max-width: 900px) {
  .grid-charts { grid-template-columns: 1fr; }
  .podium-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
}
@media (max-width: 600px) {
  .podium-grid { grid-template-columns: 1fr; max-width: 280px; margin: 0 auto; }
  .dash-topbar { flex-direction: column; align-items: flex-start; }
  .dash-topbar-actions { width: 100%; }
  .dash-topbar-actions .btn { flex: 1; justify-content: center; }
  .filter-bar-inline { width: 100%; }
  .filter-bar-inline .form-group-inline { flex: 1; }
}

/* ---- Aniversariantes ---- */
.aniversariante-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.aniversariante-item:last-child { border-bottom: none; }
.aniv-avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, #f59e0b, #fbbf24); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .85rem; color: white; text-transform: uppercase; flex-shrink: 0; }
.aniv-info { flex: 1; min-width: 0; }
.aniv-nome { font-size: .82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aniv-data { }

/* ---- Estoque dashboard improvements ---- */
.estoque-alerta-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.estoque-alerta-item:last-child { border-bottom: none; }
.estoque-alerta-info { flex: 1; min-width: 0; }
.estoque-alerta-nome { font-weight: 600; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.estoque-alerta-sub { font-size: .72rem; color: var(--text-400); }
.estoque-alerta-qty { text-align: right; font-family: var(--font-mono); font-weight: 700; font-size: .9rem; }

/* ---- Print improvements ---- */
@media print {
  .dash-topbar, .page-actions, .filter-bar, .filter-bar-inline, .btn, .sidebar, .topbar, .app-footer, .alert-banner { display: none !important; }
  .main-content { margin: 0 !important; }
  .card { border: 1px solid #ccc; break-inside: avoid; page-break-inside: avoid; }
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }
  body { background: white; color: black; }
}

/* ══════════════════════════════════════════════════════
   LGPD — Banner de Cookies + Footer Privacy
   ══════════════════════════════════════════════════════ */

/* Cookie Banner */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9000;
  background: linear-gradient(135deg, #1a1a35 0%, #16162a 100%);
  border-top: 1px solid rgba(232, 70, 10, 0.4);
  box-shadow: 0 -8px 32px rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .8rem 1.5rem;
  gap: 1.2rem;
  animation: slideUpCookie .4s ease;
}
@keyframes slideUpCookie {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.cookie-banner-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 1000px;
  width: 100%;
  flex-wrap: wrap;
}
.cookie-icon { font-size: 1.8rem; flex-shrink: 0; }
.cookie-text { flex: 1; min-width: 200px; }
.cookie-text strong { color: #fff; font-size: .9rem; display: block; margin-bottom: .2rem; }
.cookie-text p { color: #94a3b8; font-size: .8rem; line-height: 1.5; margin: 0; }
.cookie-link { color: #e8460a; font-size: .78rem; text-decoration: none; }
.cookie-link:hover { text-decoration: underline; }
.cookie-actions { display: flex; gap: .6rem; flex-shrink: 0; }
.btn-cookie-recusar {
  padding: .5rem 1rem; border-radius: 8px; border: 1px solid rgba(255,255,255,.2);
  background: transparent; color: #94a3b8; font-size: .82rem; cursor: pointer;
  transition: all .2s; white-space: nowrap;
}
.btn-cookie-recusar:hover { border-color: #fff; color: #fff; }
.btn-cookie-aceitar {
  padding: .5rem 1.2rem; border-radius: 8px; border: none;
  background: linear-gradient(135deg, #e8460a, #c026bb);
  color: #fff; font-size: .82rem; font-weight: 700; cursor: pointer;
  transition: all .2s; white-space: nowrap;
}
.btn-cookie-aceitar:hover { opacity: .9; transform: translateY(-1px); }

/* Footer LGPD links */
.footer-lgpd {
  display: flex;
  align-items: center;
  gap: .7rem;
  flex-wrap: wrap;
  justify-content: center;
  padding: .5rem 0 .3rem;
  font-size: .78rem;
}
.footer-lgpd a {
  color: #94a3b8;
  text-decoration: none;
  transition: color .2s;
}
.footer-lgpd a:hover { color: #e8460a; }
.footer-lgpd span { color: #3a3a5a; }

/* Sidebar LGPD link — destaque leve */
.sidebar-link:has(.icon) [class*="lgpd"],
a[href="/admin/lgpd"].sidebar-link {
  position: relative;
}

/* Topbar LGPD badge */
.topbar-btn[title*="LGPD"] {
  position: relative;
}

@media (max-width: 640px) {
  .cookie-banner-content { flex-direction: column; text-align: center; }
  .cookie-actions { width: 100%; }
  .btn-cookie-recusar, .btn-cookie-aceitar { flex: 1; }
}

/* ===== PERMISSÕES — layout responsivo ===== */
@media (max-width: 768px) {
  .perm-layout { grid-template-columns: 1fr; }
  .perm-sidebar { position: static; }
  .perm-sidebar-list { max-height: 200px; }
  .perm-main-body { max-height: none; }
  .sa-layout { grid-template-columns: 1fr; }
}

/* ===== GRID DE 2 COLUNAS GENÉRICO ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 768px) { .grid-2 { grid-template-columns: 1fr; } }

/* ===== ALERT INLINE ===== */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: .85rem; }
.alert-success { background: rgba(16,185,129,.1); border: 1px solid rgba(16,185,129,.3); color: #10b981; }
.alert-danger  { background: rgba(239,68,68,.1);  border: 1px solid rgba(239,68,68,.3);  color: #ef4444; }
.alert-info    { background: rgba(59,130,246,.1); border: 1px solid rgba(59,130,246,.3); color: #3b82f6; }
.alert-warning { background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.3); color: #f59e0b; }

/* ===== BADGE NÍVEL ===== */
.badge-nivel { font-size:.65rem; padding:2px 7px; border-radius:20px; font-weight:700; display:inline-block; }
.badge-nivel.superadmin { background:var(--brand)22; color:var(--brand); }
.badge-nivel.admin      { background:var(--brand-2)22; color:var(--brand-2); }
.badge-nivel.gerente    { background:var(--brand-3)22; color:var(--brand-3); }
.badge-nivel.operador   { background:var(--bg-3); color:var(--text-400); border:1px solid var(--border); }

/* ===== KPI icon wraps ===== */
.kpi-icon-wrap { width:38px; height:38px; border-radius:10px; display:flex; align-items:center; justify-content:center; font-size:1.1rem; }
.kpi-icon-wrap.blue   { background:rgba(59,130,246,.15); }
.kpi-icon-wrap.green  { background:rgba(16,185,129,.15); }
.kpi-icon-wrap.purple { background:rgba(124,58,237,.15); }
.kpi-icon-wrap.orange { background:rgba(232,70,10,.15); }
.kpi-header-row { display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; }

/* ===== SIDEBAR SCROLLBAR OVERRIDE (fina e elegante) ===== */
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 10px; }

/* ===== MODAL SCROLLBAR ===== */
.m-box::-webkit-scrollbar { width: 4px; }
.m-box::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 10px; }

/* ===== PERM scrollbars ===== */
.perm-sidebar-list::-webkit-scrollbar { width: 3px; }
.perm-sidebar-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 10px; }
.perm-main-body::-webkit-scrollbar { width: 4px; }
.perm-main-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 10px; }

/* ===== TABLE WRAPPER scrollbar ===== */
.table-wrapper::-webkit-scrollbar { height: 5px; }
.table-wrapper::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 10px; }

/* ── Form sem overflow:hidden para não cortar botão Salvar ── */
.card.form-card { overflow: visible; }

/* ── Botão Salvar fixo no rodapé (mobile/telas pequenas) ── */
.form-actions-sticky {
  bottom: 0;
  background: var(--bg-card);
  padding: 14px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  z-index: 10;
  margin: 0 -20px -20px -20px;
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ── Forçar tabelas a ter scroll horizontal com indicador visual ── */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
  position: relative;
}
.table-wrapper table { min-width: 800px; }

/* ===== SESSÃO: MÓDULO MEU PERFIL E ALTERAR SENHA (LAYOUT MODERNO) ===== */
.perfil-moderno-wrapper {
  max-width: 100%; /* Preenche toda a área vazia */
  margin: 0;
  width: 100%;
}

/* O GRANDE SEGREDO: Grid de 2 colunas lado a lado */
.perfil-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 50px;
  align-items: start;
}

/* Cria uma linha vertical separando a coluna da direita */
.perfil-grid > .perfil-section:last-child {
  border-left: 1px solid var(--border);
  padding-left: 50px;
}

.perfil-section {
  margin-bottom: 0;
}

/* Títulos das sessões */
.sessao-titulo {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

/* Linha divisória suave */
hr.perfil-divider {
  border: none;
  border-top: 1px dashed var(--border-2);
  margin: 32px 0;
}

/* ---- Seção de Avatar ---- */
.perfil-avatar-wrap {
  display: flex;
  align-items: center;
  gap: 24px;
}

/* Foto perfeitamente redonda e bem dimensionada */
.perfil-avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-3);
  flex-shrink: 0;
  border: 2px solid var(--border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.perfil-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  font-weight: 700;
  font-size: 1.8rem;
  text-transform: uppercase;
}

.perfil-avatar-info h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text);
}

.perfil-avatar-info p {
  font-size: .78rem;
  color: var(--text-400);
  margin-bottom: 12px;
}

/* Botões da foto melhor distribuídos */
.perfil-avatar-acoes {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.perfil-avatar-acoes .btn {
  font-size: 0.82rem;
  padding: 8px 16px;
}

/* ---- Inputs e Olho da Senha ---- */
.input-icon-right-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon-right-wrap .form-control {
  padding-right: 44px;
  transition: all 0.2s;
}

.input-estado-success .form-control {
  border-color: var(--success);
  box-shadow: 0 0 0 1px rgba(16,185,129,0.2);
}

.input-estado-error .form-control {
  border-color: var(--danger);
  box-shadow: 0 0 0 1px rgba(239,68,68,0.2);
}

.btn-toggle-senha {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-400);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s;
  border-radius: 4px;
}

.btn-toggle-senha:hover {
  color: var(--text);
  background: rgba(255,255,255,0.06);
}

/* ---- Regras de Validação ---- */
.label-icon-success {
  color: var(--success);
  margin-left: 6px;
  font-size: 1rem;
}

.senha-regras {
  margin-top: 10px;
  font-size: 0.75rem;
  background: rgba(0,0,0,0.15);
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.senha-regras-titulo {
  color: var(--text-300);
  margin-bottom: 10px;
  font-weight: 600;
}

.senha-regras ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.senha-regras li {
  color: var(--text-500);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.2s;
}

.senha-regras li::before {
  content: '●';
  font-size: 0.5rem;
}

.senha-regras li.regra-falha {
  color: var(--danger);
}

.senha-regras li.text-success {
  color: var(--success) !important;
}

/* ---- Botão Salvar no Rodapé ---- */
.form-actions-perfil {
  border-top: 1px solid var(--border);
  padding-top: 24px;
  margin-top: 32px;
  display: flex;
  justify-content: center;
  width: 100%; /* Força a div a pegar a largura toda para o centro ser exato */
}

.form-actions-perfil .btn {
  margin: 0 auto; /* Reforça a centralização cravada no meio */
}

/* ---- Responsividade Mobile ---- */
@media (max-width: 900px) {
  /* No celular ou tablet pequeno, o lado a lado quebra e fica um embaixo do outro */
  .perfil-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }
  
  .perfil-grid > .perfil-section:last-child {
    border-left: none; /* Tira a linha lateral */
    padding-left: 0;
    border-top: 1px dashed var(--border-2); /* Coloca uma linha horizontal */
    padding-top: 30px;
  }
}

@media (max-width: 600px) {
  .card-body {
    padding: 24px 20px !important;
  }
  
  .perfil-avatar-wrap {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  
  .perfil-avatar-acoes {
    justify-content: center;
  }
  
  .form-actions-perfil {
    justify-content: center;
  }
  
  .form-actions-perfil .btn {
    width: auto; /* Tira aquele tamanho gigante de 100% da tela */
    padding: 10px 32px; /* Deixa o botão menor e elegante */
    font-size: 0.9rem;
  }
}

/* ===== REMOVE O OLHO NATIVO DOS NAVEGADORES ===== */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
    display: none;
}

input[type="password"]::-webkit-contacts-auto-fill-button,
input[type="password"]::-webkit-credentials-auto-fill-button {
    visibility: hidden;
    display: none !important;
    pointer-events: none;
}

/* ===== REMOVE O OLHO NATIVO DOS NAVEGADORES ===== */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
    display: none;
}

input[type="password"]::-webkit-contacts-auto-fill-button,
input[type="password"]::-webkit-credentials-auto-fill-button {
    visibility: hidden;
    display: none !important;
    pointer-events: none;
}

/* Melhoria nos Cards (Cor apenas no topo e ícone flutuante) */
.kpi-card-modern {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease;
}

.kpi-card-modern:hover { transform: translateY(-3px); border-color: var(--border-2); }

.kpi-card-modern::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
}

.kpi-card-modern.orange::before { background: var(--brand); }
.kpi-card-modern.green::before { background: var(--success); }
.kpi-card-modern.blue::before { background: var(--info); }
.kpi-card-modern.purple::before { background: var(--brand-3); }

.kpi-icon-wrap {
    width: 42px; height: 42px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.03);
    color: var(--text-400);
}

.orange .kpi-icon-wrap { color: var(--brand); background: rgba(232, 70, 10, 0.1); }
.green .kpi-icon-wrap { color: var(--success); background: rgba(16, 185, 129, 0.1); }
.blue .kpi-icon-wrap { color: var(--info); background: rgba(59, 130, 246, 0.1); }
.purple .kpi-icon-wrap { color: var(--brand-3); background: rgba(124, 58, 237, 0.1); }

/* Estilo da Chave de Licença */
.text-xs-key {
    font-family: var(--font-mono);
    background: var(--bg-3);
    padding: 4px 8px;
    border-radius: 4px;
    color: var(--cyan);
    font-size: 0.75rem;
}

/* Mini Progress Bar na Tabela */
.progress-mini {
    height: 4px;
    background: var(--bg-3);
    border-radius: 2px;
    margin-top: 4px;
    width: 80px;
}
.progress-fill {
    height: 100%;
    background: var(--brand);
    border-radius: 2px;
}

/* Botão de trocar status */
.btn-status-toggle {
    transition: all 0.3s ease;
}
.btn-status-toggle:hover {
    color: var(--brand);
    transform: rotate(180deg);
}

/* ===== ATUALIZAÇÕES PARA GESTÃO DE LICENÇAS ===== */
/* Utilitários para ícones e alinhamentos rápidos (Evita inline styles) */
.icon-sm { width: 18px; height: 18px; }
.icon-xs { width: 14px; height: 14px; }
.text-primary { color: var(--brand); }
.align-middle { vertical-align: middle; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }

/* Estilo do ícone de atenção no Modal de Confirmação */
.icon-warning-wrap {
    background: rgba(232, 70, 10, 0.1);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px auto;
}

.icon-warning-wrap i {
    color: var(--brand);
    width: 30px;
    height: 30px;
}

/* ===== SVG ICONS NOS BOTÕES ===== */
.btn svg {
  flex-shrink: 0;
  stroke-width: 2px;
  opacity: 0.85;
  transition: opacity 0.2s ease;
}

.btn:hover svg {
  opacity: 1;
}

/* ===== SVG ICONS NOS BOTÕES ===== */
.btn svg, .btn-ghost svg {
  flex-shrink: 0;
  stroke-width: 2px;
  opacity: 0.85;
  transition: opacity 0.2s ease;
  vertical-align: middle; /* Alinha o ícone perfeitamente com o texto */
}

.btn:hover svg, .btn-ghost:hover svg {
  opacity: 1;
}

/* ===== ÍCONE DE BUSCA DENTRO DO INPUT ===== */
.input-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon-wrap .input-icon {
  position: absolute;
  left: 12px;
  color: var(--text-500);
  pointer-events: none; /* Garante que o ícone não bloqueie o clique no input */
}

.input-icon-wrap .form-control {
  padding-left: 38px; /* Dá o espaço para o texto não ficar em cima da lupa */
}

/* =================================================================
   MÓDULO DE LEADS (NOVO/EDITAR/DETALHES)
   ================================================================= */
.lead-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 40px;
  align-items: start;
}
.lead-col {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* =================================================================
   MÓDULO DE OPORTUNIDADES (NOVA/EDITAR)
   ================================================================= */
.opp-form-col {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.opp-form-col .form-group {
  margin-bottom: 0;
}

/* Expandindo a altura e a fonte dos campos */
.opp-form-col .form-control {
  height: 48px;
  font-size: .95rem;
  padding: 0 16px;
}
.opp-form-col .input-icon-wrap .form-control {
  padding-left: 42px;
}
.opp-form-col textarea.form-control {
  height: auto;
  padding-top: 12px;
}
.opp-form-col .input-icon {
  left: 14px;
  width: 18px;
  height: 18px;
}

/* Títulos roxos com barra (Padrão do Sistema) */
.opp-section-title {
  color: var(--brand-3) !important;
  border-bottom: 2px solid rgba(124, 58, 237, 0.25) !important;
  margin: 0 0 16px 0 !important;
  padding-bottom: 12px !important;
  font-size: 1rem !important;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}
.opp-section-title svg {
  stroke: var(--brand-3) !important;
  width: 20px;
  height: 20px;
}

/* =================================================================
   MELHORIA: MODAL DE CONFIRMAÇÃO PERSONALIZADO
   ================================================================= */

/* Container do ícone de alerta centralizado no modal */
.icon-confirm-wrap {
    width: 64px;
    height: 64px;
    background: rgba(232, 70, 10, 0.1); /* Laranja da sua marca com opacidade */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: var(--brand);
    border: 1px solid rgba(232, 70, 10, 0.2);
}

.icon-confirm-wrap svg {
    stroke-width: 2.5px;
}

/* Ajuste específico para o modal de confirmação ser mais direto */
#modalConfirmarAcao .modal {
    border: 1px solid var(--border-2);
    box-shadow: var(--shadow-lg);
    animation: modalInConfirm 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Animação de entrada levemente diferente (zoom suave) */
@keyframes modalInConfirm {
    from { 
        opacity: 0; 
        transform: scale(0.9) translateY(-10px); 
    }
    to { 
        opacity: 1; 
        transform: scale(1) translateY(0); 
    }
}

/* Estilo para garantir que o texto da mensagem não fique colado nas bordas */
#confirmMensagem {
    padding: 0 10px;
    margin-bottom: 0;
}

.btn {
  text-align: center;
}

/* Ajuste de botões dentro do footer do modal de confirmação */
#modalConfirmarAcao .modal-footer {
    border-top: 1px solid var(--border);
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.02);
}

/* Variante para o botão de confirmação quando for exclusão (dinâmico via JS) */
.btn-confirm-danger {
    background: var(--danger) !important;
    border-color: var(--danger) !important;
    color: white !important;
}

.btn-confirm-danger:hover {
    filter: brightness(1.2);
}

/* =================================================================
   TÍTULOS DE SEÇÃO DE FORMULÁRIOS (ROXO)
   ================================================================= */
.form-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--brand-3) !important; /* Cor Roxa */
  border-bottom: 2px solid rgba(124, 58, 237, 0.25) !important; /* Linha roxa translúcida */
  margin: 28px 0 16px 0 !important;
  padding-bottom: 12px !important;
}

.form-section-title svg {
  stroke: var(--brand-3) !important; /* Ícone Roxo */
  width: 20px;
  height: 20px;
  stroke-width: 2.5px;
}

/* Remove a margem do topo se o título for o primeiro elemento do card */
.card-body > .form-section-title:first-child {
  margin-top: 0 !important;
}

/* =================================================================
   ESTILOS MODERNOS DE LISTAGEM (TABELAS E FILTROS)
   ================================================================= */

/* Barra de filtros alinhada no centro, sem labels */
.filter-bar-modern {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center; /* Centraliza tudo verticalmente */
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
}
.filter-bar-modern .form-group {
  margin-bottom: 0;
}
.filter-bar-modern .form-control {
  height: 42px;
  background: rgba(255,255,255,0.03);
}

/* Tabela com mais respiro e linhas suaves */
.table-modern {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.table-modern th {
  color: var(--text-500);
  font-size: .7rem;
  padding: 16px 20px;
  text-transform: uppercase;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  letter-spacing: 0.05em;
}
.table-modern td {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  vertical-align: middle;
}
.table-modern tbody tr {
  transition: background .2s;
}
.table-modern tbody tr:hover {
  background: var(--bg-3);
}

/* Botões de Ação Circulares (Editar / Excluir) */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-2);
  color: var(--text-300);
  background: transparent;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
}
.btn-icon:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border-color: var(--border-2);
}

/* Variante da Lixeira em Vermelho */
.btn-icon.danger {
  color: var(--danger);
  border-color: rgba(239,68,68,0.3);
  background: rgba(239,68,68,0.05);
}
.btn-icon.danger:hover {
  background: rgba(239,68,68,0.15);
  color: var(--danger);
  border-color: var(--danger);
}

/* Badges de Aprovação Circulares (Substituindo emojis) */
.status-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
}
.status-circle.ok {
  background: rgba(16,185,129,0.15);
  border: 1px solid rgba(16,185,129,0.3);
  color: var(--success);
}
.status-circle.no {
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.3);
  color: var(--danger);
}

/* =================================================================
   ESTILOS DA TABELA DE MOVIMENTAÇÕES E FILTROS
   ================================================================= */

/* Barra de Filtros Responsiva */
.filter-bar-modern {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
}

/* Tabela Moderna */
.table-modern {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.table-modern th {
  color: var(--text-500);
  font-size: .7rem;
  padding: 16px 14px;
  text-transform: uppercase;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  letter-spacing: 0.05em;
}
.table-modern td {
  padding: 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  vertical-align: middle;
}
.table-modern tbody tr {
  transition: background .2s;
}
.table-modern tbody tr:hover {
  background: var(--bg-3);
}

/* =================================================================
   ESTILOS GERAIS E TABELA DE PRODUTOS
   ================================================================= */
.text-mono { font-family: monospace; }

.table-modern {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.table-modern th {
  color: var(--text-500);
  font-size: .7rem;
  padding: 16px 14px;
  text-transform: uppercase;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  letter-spacing: 0.05em;
  text-align: left; /* Garante alinhamento à esquerda */
}
.table-modern td {
  padding: 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  vertical-align: middle;
  text-align: left; /* Garante alinhamento à esquerda */
}
.table-modern tbody tr {
  transition: background .2s;
}
.table-modern tbody tr:hover {
  background: var(--bg-3);
}

/* Botões de Ação na Tabela */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-2);
  color: var(--text-300);
  background: transparent;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
}
.btn-icon:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border-color: var(--border-2);
}

/* Barra de Filtros Responsiva */
.filter-bar-modern {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end; /* Mantém os botões alinhados com a base dos inputs */
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
}
.filter-bar-modern .form-group {
  margin-bottom: 0;
}

/* Badge de Status com SVGs da Tabela */
.badge-status-svg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: .75rem;
  font-weight: 600;
}
.badge-status-svg.esgotado { background: rgba(239,68,68,0.1); color: var(--danger); border: 1px solid rgba(239,68,68,0.25); }
.badge-status-svg.critico { background: rgba(245,158,11,0.1); color: var(--warning); border: 1px solid rgba(245,158,11,0.25); }
.badge-status-svg.baixo { background: rgba(251,146,60,.15); color: #fb923c; border: 1px solid rgba(251,146,60,.3); }
.badge-status-svg.ok { background: rgba(16,185,129,0.1); color: var(--success); border: 1px solid rgba(16,185,129,0.25); }

/* Ajuste para botões de filtro menores e lado a lado */
.filter-actions-group {
  display: flex;
  gap: 8px;
  align-items: center;
  /* Garante que os botões fiquem alinhados com a base dos inputs */
  margin-top: auto; 
}

.btn-filter-sm {
  height: 38px !important;
  padding: 0 12px !important;
  font-size: 0.8rem !important;
  min-width: auto !important;
  flex: none !important;
}

/* Badge de Controlado com cor mais viva (Roxo Neon) */
.badge-controlado-viva {
  background: rgba(139, 92, 246, 0.2);
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.5);
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 800;
  text-transform: uppercase;
}

/* =================================================================
   ESTILOS DO FORMULÁRIO DE PRODUTO (VERSÃO FINAL)
   ================================================================= */

/* Container do botão voltar para garantir que ele fique na esquerda */
.back-button-container {
    display: flex;
    justify-content: flex-start;
    width: 100%;
    margin-bottom: 20px;
}

/* Grid de duas colunas com proporção real de 50/50 */
.product-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

/* Divisor vertical entre as colunas */
.product-form-col:first-child {
    border-right: 1px solid var(--border);
    padding-right: 40px;
}

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

/* Estilo dos títulos de seção no formulário */
.section-title-form {
    color: var(--brand-3);
    border-bottom: 2px solid rgba(124, 58, 237, 0.15);
    padding-bottom: 10px;
    margin-bottom: 5px;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Estilização do checkbox controlado */
.checkbox-modern {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 12px;
    background: rgba(124, 58, 237, 0.05);
    border: 1px solid rgba(124, 58, 237, 0.15);
    border-radius: 10px;
    transition: all 0.2s;
    margin-top: 5px;
}

.checkbox-modern:hover {
    background: rgba(124, 58, 237, 0.1);
}

/* Ajuste para telas menores (Tablets/Celulares) */
@media (max-width: 900px) {
    .product-form-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    .product-form-col:first-child {
        border-right: none;
        padding-right: 0;
        border-bottom: 1px dashed var(--border-2);
        padding-bottom: 30px;
    }
}

/* =================================================================
   ESTILOS DO FORMULÁRIO DE PRODUTO (VERSÃO COM MAIS RESPIRO)
   ================================================================= */

.back-button-container {
    display: flex;
    justify-content: flex-start;
    width: 100%;
    margin-bottom: 20px;
}

.product-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px; /* Aumentei o espaço entre as colunas para dar mais ar */
    align-items: start;
}

.product-form-col:first-child {
    border-right: 1px solid var(--border);
    padding-right: 60px; /* Aumentei o respiro lateral interno da primeira coluna */
}

.product-form-col {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.section-title-form {
    color: var(--brand-3);
    border-bottom: 2px solid rgba(124, 58, 237, 0.15);
    padding-bottom: 10px;
    margin-bottom: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.checkbox-modern {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 15px; /* Aumentei o preenchimento do checkbox */
    background: rgba(124, 58, 237, 0.05);
    border: 1px solid rgba(124, 58, 237, 0.15);
    border-radius: 10px;
}

@media (max-width: 900px) {
    .product-form-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    .product-form-col:first-child {
        border-right: none;
        padding-right: 0;
        border-bottom: 1px dashed var(--border-2);
        padding-bottom: 30px;
    }
}

/* =================================================================
   DASHBOARD DE ESTOQUE - KPI & GRIDS (VERSÃO FINAL CONSOLIDADA)
   ================================================================= */

.kpi-grid-modern {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.kpi-card-modern {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s;
}

/* Faixa de cor no topo dos KPIs (Padrão: Azul, Laranja, Roxo) */
.kpi-card-modern::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
}

.kpi-blue::before { background: var(--info); }
.kpi-orange::before { background: #c53a08; } 
.kpi-purple::before { background: var(--brand-3); }

/* Ícones dos KPIs sincronizados com a cor do detalhe */
.kpi-icon-modern {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.kpi-blue .kpi-icon-modern { background: rgba(59, 130, 246, 0.1); color: var(--info); }
.kpi-orange .kpi-icon-modern { background: rgba(197, 58, 8, 0.1); color: #c53a08; }
.kpi-purple .kpi-icon-modern { background: rgba(124, 58, 237, 0.1); color: var(--brand-3); }

.kpi-value-modern {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
}

.kpi-label-modern {
    font-size: 0.75rem;
    color: var(--text-500);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-top: 4px;
}

/* =================================================================
   QUICK ACTIONS (ÍCONES BRANCOS QUE MUDAM DE COR NO HOVER)
   ================================================================= */

.quick-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 10px;
}

.qa-button {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 25px 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    transition: all 0.2s ease-in-out;
    text-align: center;
}

/* Ícone inicialmente branco */
.qa-button svg {
    color: #ffffff !important;
    transition: color 0.2s, transform 0.2s;
}

.qa-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

.qa-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    transition: color 0.2s;
}

.qa-entrada:hover { border-color: var(--success); background: rgba(16, 185, 129, 0.03); }
.qa-entrada:hover .qa-title, .qa-entrada:hover svg { color: var(--success) !important; }

.qa-saida:hover { border-color: 0
  ,var(--danger); background: rgba(239, 68, 68, 0.03); }
.qa-saida:hover .qa-title, .qa-saida:hover svg { color: var(--danger) !important; }

.qa-ajuste:hover { border-color: var(--info); background: rgba(59, 130, 246, 0.03); }
.qa-ajuste:hover .qa-title, .qa-ajuste:hover svg { color: var(--info) !important; }

.qa-perda:hover { border-color: #c53a08; background: rgba(197, 58, 8, 0.03); }
.qa-perda:hover .qa-title, .qa-perda:hover svg { color: #c53a08 !important; }

/* =================================================================
   PAINEL DA CLÍNICA - KPI & LAYOUT
   ================================================================= */

.kpi-blue::before { background: var(--info); }
.kpi-orange::before { background: #c53a08; }
.kpi-purple::before { background: var(--brand-3); }

.kpi-blue .kpi-icon-modern { background: rgba(59, 130, 246, 0.1); color: var(--info); }
.kpi-orange .kpi-icon-modern { background: rgba(197, 58, 8, 0.1); color: #c53a08; }
.kpi-purple .kpi-icon-modern { background: rgba(124, 58, 237, 0.1); color: var(--brand-3); }

/* Estilo da Lista de Agenda */
.agenda-item-modern {
    display: grid;
    grid-template-columns: 70px 4px 1fr auto;
    gap: 15px;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

.agenda-item-modern:hover { background: rgba(255, 255, 255, 0.02); }

.agenda-time-box {
    text-align: center;
    font-family: var(--font-mono);
}

.agenda-time-box .main-time {
    display: block;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text);
}

.agenda-time-box .sub-time {
    font-size: 0.7rem;
    color: var(--text-500);
}

.alerta-medico-tag {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
}

/* =================================================================
   QUICK ACTIONS CLÍNICA - HOVER PADRONIZADO
   ================================================================= */

/* 1. Agendar (Verde) */
.qa-entrada:hover { 
    border-color: var(--success); 
    background: rgba(16, 185, 129, 0.03); 
}
.qa-entrada:hover .qa-title, 
.qa-entrada:hover svg { 
    color: var(--success) !important; 
}

/* 2. Paciente (Azul) */
.qa-ajuste:hover { 
    border-color: var(--info); 
    background: rgba(59, 130, 246, 0.03); 
}
.qa-ajuste:hover .qa-title, 
.qa-ajuste:hover svg { 
    color: var(--info) !important; 
}

/* 3. Buscar (Vermelho - Conforme pedido) */
.qa-saida:hover { 
    border-color: var(--danger); 
    background: rgba(239, 68, 68, 0.03); 
}
.qa-saida:hover .qa-title, 
.qa-saida:hover svg { 
    color: var(--danger) !important; 
}

/* 4. Agenda Lista (Laranja) */
.qa-perda:hover { 
    border-color: #c53a08; 
    background: rgba(197, 58, 8, 0.03); 
}
.qa-perda:hover .qa-title, 
.qa-perda:hover svg { 
    color: #c53a08 !important; 
}

.studio-wrap {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 16px;
}

@media (max-width: 768px) {
  .studio-wrap {
    grid-template-columns: 1fr !important;
  }
}

/* =================================================================
   EMODULO MARKETING: WHATSAPP
   ================================================================= */
.pill-status { padding: 4px 10px; border-radius: 20px; font-weight: 800; font-size: 9px; display: inline-flex; align-items: center; gap: 6px; text-transform: uppercase; }
.pill-green { background: rgba(34, 197, 94, 0.1); color: #4ade80; }
.pill-orange { background: rgba(251, 146, 60, 0.1); color: #fb923c; }
.pill-purple { background: rgba(124, 58, 237, 0.1); color: #a78bfa; }
.badge-bi-trans { padding: 4px 10px; border-radius: 6px; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.badge-bi-trans.orange { background: rgba(197, 58, 8, 0.15); color: #fb923c; border: 1px solid rgba(197, 58, 8, 0.3); }
.bi-link-orange { color: var(--sigem-orange); text-decoration: none; transition: 0.2s; }
.bi-chart-card { border-radius: 16px; padding: 24px; border: 1px solid var(--bi-border); background: var(--bi-card-darker); }
.span-3 { grid-column: span 3; }
.bi-clean-table { width: 100%; border-collapse: collapse; text-align: left; }
.bi-clean-table th { color: #8b949e; padding: 12px 10px; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.bi-clean-table td { padding: 14px 10px; font-size: 12px; border-bottom: 1px solid rgba(255,255,255,0.02); color: #ffffff; vertical-align: middle; }

  :root {
    --bi-bg: #090c10;
    --bi-card-darker: #1a1a2e;
    --bi-border: rgba(255,255,255,0.08);
    --sigem-orange: #c53a08;
    --sigem-purple: #7c3aed;
  }

  .bi-wrapper { padding: 20px; background: var(--bi-bg); min-height: 100vh; font-family: 'Inter', sans-serif; }
  
  .kpi-card { transition: none !important; transform: none !important; }
  .kpi-card.orange::before { background: var(--sigem-orange) !important; }
  .kpi-card.purple::before { background: var(--sigem-purple) !important; }

  .wa-main-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
  }

  .wa-list-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 320px; 
    overflow-y: auto;
    padding-right: 8px;
  }

  .wa-list-container::-webkit-scrollbar { width: 4px; }
  .wa-list-container::-webkit-scrollbar-track { background: rgba(255,255,255,0.02); }
  .wa-list-container::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }

  .wa-item-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--bi-border);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
  }

  .wa-item-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateX(4px);
  }

  .wa-info-group {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .wa-icon-circle {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .wa-name { font-weight: 700; color: #fff; font-size: 0.9rem; margin-bottom: 2px; }
  .wa-sub { font-size: 0.75rem; color: #8b949e; }
  .status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
  .dot-online { background: #10b981; box-shadow: 0 0 8px rgba(16, 185, 129, 0.5); }
  .dot-offline { background: #ef4444; }

  @media (max-width: 900px) {
    .wa-main-layout { grid-template-columns: 1fr; }
  }

  /*MAC*/

  /* ─── BARRA DE PROGRESSO NO TOPO ────────────────────────── */
    #license-progress-bar {
      position: fixed;
      top: 0; left: 0;
      height: 3px;
      background: linear-gradient(90deg, var(--ok), #4ade80);
      z-index: 9998;
      transition: width 1s linear, background .6s;
      width: 100%;
    }
    #license-progress-bar.warn    { background: linear-gradient(90deg, var(--warning), #fbbf24); }
    #license-progress-bar.expired { background: var(--danger); width: 0% !important; }

    /* ─── BADGE FLUTUANTE ────────────────────────────────────── */
    #license-badge {
      position: fixed;
      top: 14px;
      right: 18px;
      z-index: 9999;
      display: flex;
      align-items: center;
      gap: 9px;
      background: var(--badge-bg);
      backdrop-filter: blur(10px);
      border: 1.5px solid rgba(255,255,255,.15);
      border-radius: 50px;
      padding: 8px 16px 8px 10px;
      font-family: 'Rajdhani', sans-serif;
      font-size: 14px;
      font-weight: 600;
      letter-spacing: .04em;
      color: #fff;
      box-shadow: 0 4px 20px rgba(0,0,0,.35);
      cursor: default;
      user-select: none;
      transition: border-color .4s, box-shadow .4s;
    }
    #license-badge .dot {
      width: 10px; height: 10px;
      border-radius: 50%;
      background: var(--ok);
      flex-shrink: 0;
      animation: pulse-ok 2s infinite;
    }
    @keyframes pulse-ok   { 0%,100%{box-shadow:0 0 0 0 rgba(22,163,74,.6)}  50%{box-shadow:0 0 0 6px rgba(22,163,74,0)} }
    @keyframes pulse-warn { 0%,100%{box-shadow:0 0 0 0 rgba(217,119,6,.7)}  50%{box-shadow:0 0 0 6px rgba(217,119,6,0)} }
    @keyframes pulse-dead { 0%,100%{box-shadow:0 0 0 0 rgba(229,62,62,.7)}  50%{box-shadow:0 0 0 7px rgba(229,62,62,0)} }

    #license-badge.warn    { border-color: rgba(217,119,6,.5); }
    #license-badge.warn    .dot { background: var(--warning); animation-name: pulse-warn; }
    #license-badge.expired { border-color: rgba(229,62,62,.6); }
    #license-badge.expired .dot { background: var(--danger);  animation-name: pulse-dead; }

    #license-badge .label     { opacity: .7; font-weight: 400; font-size: 12px; margin-right: 2px; }
    #license-badge .countdown { font-size: 15px; font-weight: 700; letter-spacing: .06em; }
  /* ─── OVERLAY DE BLOQUEIO ────────────────────────────────── */
    #block-overlay {
      display: none;
      position: fixed;
      inset: 0;
      z-index: 99999;
      background: rgba(6,6,12,.97);
      backdrop-filter: blur(18px);
      align-items: center;
      justify-content: center;
      flex-direction: column;
      text-align: center;
      font-family: 'Rajdhani', sans-serif;
      color: #fff;
    }
    #block-overlay.show { display: flex; }

    #block-overlay .lock-icon {
      width: 80px; height: 80px;
      margin-bottom: 24px;
      animation: lockBounce 1.8s ease-in-out infinite;
    }
    @keyframes lockBounce {
      0%,100%{ transform: translateY(0) rotate(-3deg); }
      50%    { transform: translateY(-10px) rotate(3deg); }
    }

    #block-overlay h2 {
      font-size: clamp(26px,5vw,44px);
      font-weight: 700;
      letter-spacing: .06em;
      margin: 0 0 10px;
      background: linear-gradient(135deg, #ff6b6b, #ff3333);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
    }
    #block-overlay p {
      font-family: sans-serif;
      font-size: 15px;
      color: rgba(255,255,255,.6);
      max-width: 380px;
      line-height: 1.6;
      margin: 0 0 28px;
    }
    #block-overlay .contact-box {
      border: 1.5px solid rgba(255,255,255,.12);
      border-radius: 10px;
      padding: 16px 28px;
      font-size: 14px;
      color: rgba(255,255,255,.75);
      background: rgba(255,255,255,.04);
      line-height: 1.7;
      font-family: sans-serif;
    }
    #block-overlay .contact-box strong { color: #fff; }
    #block-overlay::after {
      content:'';
      position:absolute;
      inset:0;
      background: repeating-linear-gradient(
        0deg, transparent, transparent 2px,
        rgba(255,255,255,.015) 2px, rgba(255,255,255,.015) 4px
      );
      pointer-events: none;
    }
    
/* ===== CORREÇÕES GLOBAIS DE FORMULÁRIO ===== */
/* A altura fixa de .form-control (48px, do login) fazia toda <textarea> ignorar "rows". */
textarea.form-control { height: auto; padding-top: 10px; padding-bottom: 10px; }
/* Celular: fonte de 16px nos campos evita o zoom automático do iPhone ao tocar */
@media (max-width: 600px) {
  .form-control, select.form-control, textarea.form-control { font-size: 16px; }
}

/* ===== PÁGINA DE FORMULÁRIO (criar/editar) =====
   Coluna centralizada; cabeçalho com "← Voltar" à esquerda e título à direita;
   card com respiro e tipografia uniforme. Uso:
   <div class="form-pagina"> .page-header > a.btn + .fp-titulo ; .form-pagina-card </div>
   .fp-larga = formulários largos de várias colunas. */
.form-pagina { width: 100%; max-width: 640px; margin-left: auto; margin-right: auto; }
.form-pagina.fp-larga { max-width: 880px; }
.form-pagina .page-header { flex-direction: row-reverse; align-items: center; } /* título à esquerda, Voltar à direita */
.form-pagina .fp-titulo { text-align: left; min-width: 0; }
.form-pagina-card { padding: 28px; }
.form-pagina-card input, .form-pagina-card select, .form-pagina-card textarea, .form-pagina-card button { font-family: inherit; }
.form-pagina-card .form-control { font-size: .9rem; }
.form-pagina-card textarea.form-control { line-height: 1.5; resize: vertical; }
.form-pagina-card .form-control::placeholder { font-size: .88rem; color: var(--text-500); opacity: 1; }
.form-pagina-card .form-group { margin-bottom: 20px; }
.form-pagina-card .form-label { display: block; font-size: .82rem; font-weight: 600; color: var(--text); margin-bottom: 6px; letter-spacing: .01em; }
.form-pagina-card .form-label.required::after { color: var(--brand); }
.fp-obrig { color: var(--brand); }
.fp-hint { font-size: .75rem; color: var(--text-400); margin-top: 6px; line-height: 1.45; }
.fp-secao { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; border-top: 1px solid var(--border); padding-top: 18px; margin: 4px 0 12px; }
.fp-secao .form-label { margin-bottom: 0; }
.fp-secao small { font-size: .75rem; color: var(--text-400); }
.fp-secao:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.fp-mini { display: block; font-size: .72rem; font-weight: 600; color: var(--text-400); margin: 12px 0 4px; text-transform: uppercase; letter-spacing: .04em; }
.fp-dica { background: var(--bg-3); border: 1px solid var(--border); border-left: 3px solid var(--brand); border-radius: var(--radius-sm);
  padding: 12px 14px; margin: 20px 0; font-size: .8rem; color: var(--text-400); line-height: 1.5; }
.fp-dica strong { color: var(--text); }
.fp-acoes { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--border); padding-top: 18px; }
@media (max-width: 768px) {
  .form-pagina-card { padding: 16px; }
  .form-pagina-card .btn { min-height: 40px; }
  .form-pagina .page-header { flex-direction: row-reverse; align-items: center; }
  .fp-acoes .btn { flex: 1; justify-content: center; }
}
