/* =======================================================
   ALDRASCAN ADMIN PANEL — css/admin.css
   Panel de gestión de leads Aoralscan
   ======================================================= */

:root {
    --primary: #006CFF;
    --dark-blue: #003B8E;
    --light-blue: #4FA3FF;
    --purple: #7c3aed;
    --teal: #0d9488;
    --orange: #f97316;
    --green: #16a34a;
    --red: #dc2626;

    /* DARK (default del admin) */
    --bg:        #0f0f11;
    --surface:   #18181b;
    --surface-2: #1f1f23;
    --border:    rgba(255,255,255,0.07);
    --text:      #e4e4e7;
    --text-muted:#71717a;
    --white:     #ffffff;

    /* LIGHT override */
    --bg-light:        #f4f4f6;
    --surface-light:   #ffffff;
    --surface-2-light: #f0f0f4;
    --border-light:    rgba(0,0,0,0.08);
    --text-light:      #18181b;
    --text-muted-light:#6b7280;

    --font: 'Inter',-apple-system,BlinkMacSystemFont,sans-serif;
    --radius: 12px;
    --radius-lg: 20px;
    --sidebar-w: 240px;
    --topbar-h: 64px;
    --transition: 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    transition: background var(--transition), color var(--transition);
}

/* ---- LIGHT MODE ---- */
body.light-mode {
    background: var(--bg-light);
    color: var(--text-light);
}

/* =============================================
   SIDEBAR
   ============================================= */
.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 500;
    transition: transform var(--transition), background var(--transition);
    overflow-y: auto;
}
body.light-mode .sidebar {
    background: var(--surface-light);
    border-color: var(--border-light);
}

.sidebar-header {
    padding: 20px 18px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}
body.light-mode .sidebar-header { border-color: var(--border-light); }

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}
.logo-icon {
    width: 34px; height: 34px;
    background: var(--primary);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: .95rem;
}
.logo-text { display: flex; flex-direction: column; line-height: 1.2; }
.logo-name { font-size: .92rem; font-weight: 700; color: var(--text); }
body.light-mode .logo-name { color: var(--text-light); }
.logo-sub { font-size: .68rem; color: var(--text-muted); font-weight: 500; }

/* ---- LOGO IMAGEN SIDEBAR ---- */
.sidebar-logo-img {
    height: 34px;
    width: auto;
    object-fit: contain;
    /* dark mode (default admin): logo blanco = perfecto */
    filter: brightness(1);
    transition: filter .2s ease;
}
body.light-mode .sidebar-logo-img {
    /* En modo claro invertimos para que se vea oscuro */
    filter: invert(1) brightness(.18);
}

.sidebar-close {
    display: none;
    background: none; border: none; color: var(--text-muted);
    font-size: 1.1rem; cursor: pointer; padding: 4px;
}
body.light-mode .sidebar-close { color: var(--text-muted-light); }

.sidebar-nav {
    flex: 1;
    padding: 16px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.nav-section-label {
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 8px 8px 4px;
    display: block;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius);
    text-decoration: none;
    font-size: .88rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: all var(--transition);
    cursor: pointer;
    position: relative;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: var(--text); }
body.light-mode .nav-item:hover { background: rgba(0,0,0,.04); color: var(--text-light); }
.nav-item.active {
    background: rgba(0,108,255,.15);
    color: var(--primary);
    font-weight: 600;
}
body.light-mode .nav-item.active { background: rgba(0,108,255,.08); }
.nav-item i { width: 18px; text-align: center; font-size: .85rem; }
.nav-badge {
    margin-left: auto;
    background: var(--primary);
    color: white;
    font-size: .65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 50px;
    min-width: 22px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
}
body.light-mode .sidebar-footer { border-color: var(--border-light); }
.theme-toggle-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: .85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}
.theme-toggle-btn:hover { border-color: var(--primary); color: var(--primary); }

/* =============================================
   MAIN CONTENT
   ============================================= */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin var(--transition);
}

/* ---- TOPBAR ---- */
.topbar {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 400;
    transition: background var(--transition);
}
body.light-mode .topbar {
    background: var(--surface-light);
    border-color: var(--border-light);
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.hamburger-btn {
    display: none;
    background: none; border: none;
    color: var(--text-muted); font-size: 1.1rem;
    cursor: pointer; padding: 6px;
}
.page-title h1 { font-size: 1.05rem; font-weight: 700; line-height: 1.2; }
.page-title span { font-size: .78rem; color: var(--text-muted); }
body.light-mode .page-title span { color: var(--text-muted-light); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.last-update {
    display: flex; align-items: center; gap: 6px;
    font-size: .75rem; color: var(--text-muted);
}
body.light-mode .last-update { color: var(--text-muted-light); }
.refresh-btn {
    width: 34px; height: 34px;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius); cursor: pointer;
    color: var(--text-muted); font-size: .88rem;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition);
}
.refresh-btn:hover { border-color: var(--primary); color: var(--primary); transform: rotate(90deg); }
body.light-mode .refresh-btn { background: var(--surface-2-light); border-color: var(--border-light); }

/* ---- SECTIONS ---- */
.section { display: none; padding: 28px; animation: fadeInUp .3s ease; }
.section.active { display: block; }
@keyframes fadeInUp { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }

/* =============================================
   KPI CARDS
   ============================================= */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.kpi-card {
    border-radius: var(--radius-lg);
    padding: 22px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition);
    border: 1px solid var(--border);
}
body.light-mode .kpi-card { border-color: transparent; }
.kpi-card:hover { transform: translateY(-3px); }
.kpi-card::before {
    content: '';
    position: absolute;
    top: -40px; right: -40px;
    width: 120px; height: 120px;
    border-radius: 50%;
    opacity: .12;
}

.kpi-card--blue   { background: linear-gradient(135deg, rgba(0,108,255,.12), rgba(0,108,255,.04)); }
.kpi-card--purple { background: linear-gradient(135deg, rgba(124,58,237,.12), rgba(124,58,237,.04)); }
.kpi-card--teal   { background: linear-gradient(135deg, rgba(13,148,136,.12), rgba(13,148,136,.04)); }
.kpi-card--orange { background: linear-gradient(135deg, rgba(249,115,22,.12), rgba(249,115,22,.04)); }

.kpi-card--blue::before   { background: var(--primary); }
.kpi-card--purple::before { background: var(--purple); }
.kpi-card--teal::before   { background: var(--teal); }
.kpi-card--orange::before { background: var(--orange); }

body.light-mode .kpi-card--blue   { background: linear-gradient(135deg,#e8f0ff,#f0f5ff); }
body.light-mode .kpi-card--purple { background: linear-gradient(135deg,#ede9fe,#f5f3ff); }
body.light-mode .kpi-card--teal   { background: linear-gradient(135deg,#ccfbf1,#f0fdfa); }
body.light-mode .kpi-card--orange { background: linear-gradient(135deg,#ffedd5,#fff7ed); }

.kpi-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
}
.kpi-card--blue   .kpi-icon { background: rgba(0,108,255,.2); color: var(--primary); }
.kpi-card--purple .kpi-icon { background: rgba(124,58,237,.2); color: var(--purple); }
.kpi-card--teal   .kpi-icon { background: rgba(13,148,136,.2); color: var(--teal); }
.kpi-card--orange .kpi-icon { background: rgba(249,115,22,.2); color: var(--orange); }

.kpi-data { display: flex; flex-direction: column; gap: 2px; }
.kpi-value { font-size: 2rem; font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.kpi-label { font-size: .75rem; color: var(--text-muted); font-weight: 500; }
body.light-mode .kpi-label { color: var(--text-muted-light); }
.kpi-trend { font-size: .72rem; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
body.light-mode .kpi-trend { color: var(--text-muted-light); }

/* =============================================
   CHARTS ROW
   ============================================= */
.charts-row {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 16px;
    margin-bottom: 24px;
}
.chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: background var(--transition);
}
body.light-mode .chart-card { background: var(--surface-light); border-color: var(--border-light); }
.chart-card--wide {}
.chart-card-header { margin-bottom: 20px; }
.chart-card-header h3 { font-size: .92rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.chart-card-header h3 i { color: var(--primary); }
.chart-subtitle { font-size: .75rem; color: var(--text-muted); margin-top: 2px; display: block; }
body.light-mode .chart-subtitle { color: var(--text-muted-light); }

/* Donut canvas */
.donut-wrap {
    position: relative;
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}
.donut-wrap canvas { max-width: 200px; max-height: 200px; }
.donut-center {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
}
.donut-center span { font-size: 1.8rem; font-weight: 800; display: block; line-height: 1; }
.donut-center small { font-size: .72rem; color: var(--text-muted); }
body.light-mode .donut-center small { color: var(--text-muted-light); }
.donut-legend { display: flex; flex-direction: column; gap: 8px; }
.legend-item {
    display: flex; align-items: center; justify-content: space-between;
    font-size: .78rem;
}
.legend-dot-label { display: flex; align-items: center; gap: 8px; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend-count { font-weight: 700; font-size: .82rem; }

/* Bar chart custom */
.bar-chart-wrap { display: flex; flex-direction: column; gap: 14px; }
.bar-item { display: flex; flex-direction: column; gap: 5px; }
.bar-label-row {
    display: flex; justify-content: space-between; align-items: center;
    font-size: .8rem; font-weight: 500;
}
.bar-count { font-weight: 700; color: var(--primary); }
.bar-track {
    height: 10px;
    background: var(--surface-2);
    border-radius: 50px;
    overflow: hidden;
}
body.light-mode .bar-track { background: var(--surface-2-light); }
.bar-fill {
    height: 100%;
    border-radius: 50px;
    background: linear-gradient(90deg, var(--primary), var(--light-blue));
    transition: width .8s cubic-bezier(.4,0,.2,1);
    width: 0;
}

/* =============================================
   RECENT LEADS
   ============================================= */
.recent-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}
body.light-mode .recent-card { background: var(--surface-light); border-color: var(--border-light); }
.recent-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 18px;
}
.recent-header h3 { font-size: .92rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.recent-header h3 i { color: var(--primary); }
.btn-link { font-size: .8rem; color: var(--primary); text-decoration: none; font-weight: 600; }
.btn-link:hover { text-decoration: underline; }
.recent-list { display: flex; flex-direction: column; gap: 2px; }
.recent-item {
    display: flex; align-items: center; gap: 14px;
    padding: 10px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition);
}
.recent-item:hover { background: var(--surface-2); }
body.light-mode .recent-item:hover { background: var(--surface-2-light); }
.ri-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--primary);
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 700; font-size: .82rem; flex-shrink: 0;
}
.ri-info { flex: 1; min-width: 0; }
.ri-name { font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ri-clinic { font-size: .75rem; color: var(--text-muted); }
body.light-mode .ri-clinic { color: var(--text-muted-light); }
.ri-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.ri-model-tag {
    padding: 3px 8px; border-radius: 50px;
    font-size: .68rem; font-weight: 700; letter-spacing: .04em;
    text-transform: uppercase;
}
.tag-elf            { background: rgba(0,108,255,.15); color: var(--primary); }
.tag-elite          { background: rgba(124,58,237,.15); color: var(--purple); }
.tag-elite-wireless { background: rgba(13,148,136,.15); color: var(--teal); }
.tag-kit-scan       { background: rgba(249,115,22,.15); color: var(--orange); }
.tag-todos,.tag-default { background: rgba(255,255,255,.08); color: var(--text-muted); }
body.light-mode .tag-todos,.tag-default { background: rgba(0,0,0,.06); }
.ri-date { font-size: .7rem; color: var(--text-muted); }
body.light-mode .ri-date { color: var(--text-muted-light); }

/* =============================================
   FILTROS Y TABLA DE LEADS
   ============================================= */
.filters-bar {
    display: flex; align-items: center; gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.search-wrap {
    display: flex; align-items: center; gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 9px 14px;
    flex: 1; min-width: 220px;
    transition: border-color var(--transition);
}
body.light-mode .search-wrap { background: var(--surface-light); border-color: var(--border-light); }
.search-wrap:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,108,255,.1); }
.search-wrap i { color: var(--text-muted); font-size: .85rem; }
.search-wrap input {
    border: none; background: transparent; outline: none;
    font-family: var(--font); font-size: .88rem; color: var(--text);
    width: 100%;
}
body.light-mode .search-wrap input { color: var(--text-light); }
.search-wrap input::placeholder { color: var(--text-muted); }

.filter-group { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-group select {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 9px 12px;
    font-family: var(--font); font-size: .82rem; color: var(--text);
    cursor: pointer; outline: none; transition: border-color var(--transition);
}
body.light-mode .filter-group select { background: var(--surface-light); border-color: var(--border-light); color: var(--text-light); }
.filter-group select:focus { border-color: var(--primary); }
.btn-export-sm {
    display: flex; align-items: center; gap: 6px;
    padding: 9px 16px; border-radius: var(--radius);
    background: var(--primary); color: white;
    border: none; font-family: var(--font); font-size: .82rem;
    font-weight: 600; cursor: pointer; transition: background var(--transition);
    white-space: nowrap;
}
.btn-export-sm:hover { background: var(--dark-blue); }

.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 16px;
    overflow-x: auto;
}
body.light-mode .table-wrap { background: var(--surface-light); border-color: var(--border-light); }
.leads-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.leads-table thead tr { border-bottom: 1px solid var(--border); }
body.light-mode .leads-table thead tr { border-color: var(--border-light); }
.leads-table th {
    padding: 13px 16px; text-align: left;
    font-size: .72rem; font-weight: 700;
    letter-spacing: .06em; text-transform: uppercase;
    color: var(--text-muted);
    background: var(--surface-2);
}
body.light-mode .leads-table th { background: var(--surface-2-light); color: var(--text-muted-light); }
.leads-table td { padding: 13px 16px; font-size: .85rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
body.light-mode .leads-table td { border-color: var(--border-light); }
.leads-table tbody tr:last-child td { border-bottom: none; }
.leads-table tbody tr { transition: background var(--transition); cursor: pointer; }
.leads-table tbody tr:hover { background: var(--surface-2); }
body.light-mode .leads-table tbody tr:hover { background: var(--surface-2-light); }

.td-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--primary);
    display: inline-flex; align-items: center; justify-content: center;
    color: white; font-weight: 700; font-size: .8rem; flex-shrink: 0;
    margin-right: 10px;
}
.td-name-cell { display: flex; align-items: center; }
.td-name { font-weight: 600; font-size: .88rem; }
.td-clinic { font-size: .75rem; color: var(--text-muted); }
body.light-mode .td-clinic { color: var(--text-muted-light); }
.td-email { font-size: .82rem; color: var(--primary); }
.td-phone { font-size: .78rem; color: var(--text-muted); }
body.light-mode .td-phone { color: var(--text-muted-light); }
.td-date { font-size: .78rem; color: var(--text-muted); white-space: nowrap; }
body.light-mode .td-date { color: var(--text-muted-light); }
.action-btn {
    width: 30px; height: 30px; border-radius: 8px;
    border: 1px solid var(--border); background: transparent;
    color: var(--text-muted); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .8rem; transition: all var(--transition);
}
.action-btn:hover { border-color: var(--primary); color: var(--primary); }
.action-btn.del:hover { border-color: var(--red); color: var(--red); }
body.light-mode .action-btn { border-color: var(--border-light); }

.table-loading { text-align: center; padding: 40px; color: var(--text-muted); }
body.light-mode .table-loading { color: var(--text-muted-light); }
.table-empty { text-align: center; padding: 56px; }
.table-empty i { font-size: 2.5rem; color: var(--text-muted); margin-bottom: 12px; display: block; }
.table-empty p { color: var(--text-muted); font-size: .88rem; }
body.light-mode .table-empty i,.table-empty p { color: var(--text-muted-light); }

/* Paginación */
.pagination {
    display: flex; gap: 6px; align-items: center;
    justify-content: center; flex-wrap: wrap;
}
.pg-btn {
    padding: 7px 13px; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--surface);
    color: var(--text); font-family: var(--font); font-size: .82rem;
    cursor: pointer; transition: all var(--transition);
}
body.light-mode .pg-btn { background: var(--surface-light); border-color: var(--border-light); color: var(--text-light); }
.pg-btn:hover { border-color: var(--primary); color: var(--primary); }
.pg-btn.active { background: var(--primary); border-color: var(--primary); color: white; font-weight: 700; }
.table-meta { text-align: center; font-size: .75rem; color: var(--text-muted); margin-top: 10px; }
body.light-mode .table-meta { color: var(--text-muted-light); }

/* =============================================
   SECCIÓN: POR MODELO
   ============================================= */
.modelos-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.modelo-stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: background var(--transition);
}
body.light-mode .modelo-stat-card { background: var(--surface-light); border-color: var(--border-light); }
.ms-header { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.ms-img { width: 52px; height: 52px; object-fit: contain; filter: drop-shadow(0 4px 8px rgba(0,0,0,.2)); }
.ms-header h3 { font-size: .92rem; font-weight: 700; }
.ms-header span { font-size: .72rem; color: var(--text-muted); }
body.light-mode .ms-header span { color: var(--text-muted-light); }
.ms-count { font-size: 2.6rem; font-weight: 900; letter-spacing: -.05em; margin-bottom: 8px; }
.modelo-elf .ms-count { color: var(--primary); }
.modelo-elite .ms-count { color: var(--purple); }
.modelo-wireless .ms-count { color: var(--teal); }
.ms-bar { height: 6px; background: var(--surface-2); border-radius: 50px; overflow: hidden; margin-bottom: 20px; }
body.light-mode .ms-bar { background: var(--surface-2-light); }
.ms-bar-fill { height: 100%; border-radius: 50px; width: 0; transition: width 1s cubic-bezier(.4,0,.2,1); }
.ms-bar--blue   { background: linear-gradient(90deg, var(--primary), var(--light-blue)); }
.ms-bar--purple { background: linear-gradient(90deg, var(--purple), #a78bfa); }
.ms-bar--teal   { background: linear-gradient(90deg, var(--teal), #34d399); }
.ms-leads-list { display: flex; flex-direction: column; gap: 8px; max-height: 240px; overflow-y: auto; }
.ms-lead-item {
    font-size: .8rem; padding: 8px 10px;
    background: var(--surface-2); border-radius: var(--radius);
    display: flex; align-items: center; gap: 8px; cursor: pointer;
    transition: background var(--transition);
}
body.light-mode .ms-lead-item { background: var(--surface-2-light); }
.ms-lead-item:hover { opacity: .8; }
.ms-lead-item i { color: var(--text-muted); font-size: .75rem; }
.ms-lead-name { font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-lead-date { font-size: .7rem; color: var(--text-muted); white-space: nowrap; }

/* =============================================
   MODAL
   ============================================= */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%; max-width: 520px; max-height: 90vh;
    overflow-y: auto;
    margin: 20px;
    box-shadow: 0 24px 80px rgba(0,0,0,.5);
    animation: modalIn .25s ease;
}
body.light-mode .modal { background: var(--surface-light); border-color: var(--border-light); }
@keyframes modalIn { from { opacity:0; transform:scale(.96) translateY(10px); } to { opacity:1; transform:scale(1) translateY(0); } }
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px 16px; border-bottom: 1px solid var(--border);
}
body.light-mode .modal-header { border-color: var(--border-light); }
.modal-header h3 { font-size: .95rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.modal-header h3 i { color: var(--primary); }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 1.1rem; cursor: pointer; padding: 4px; }
.modal-body { padding: 20px 24px; }
.modal-row { margin-bottom: 14px; }
.modal-label { font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 4px; }
body.light-mode .modal-label { color: var(--text-muted-light); }
.modal-value { font-size: .9rem; font-weight: 500; word-break: break-all; }
.modal-message { background: var(--surface-2); border-radius: var(--radius); padding: 12px; font-size: .85rem; line-height: 1.6; color: var(--text-muted); font-style: italic; }
body.light-mode .modal-message { background: var(--surface-2-light); color: var(--text-muted-light); }
.modal-footer {
    display: flex; gap: 8px; padding: 16px 24px 20px;
    border-top: 1px solid var(--border); flex-wrap: wrap;
}
body.light-mode .modal-footer { border-color: var(--border-light); }
.btn-modal-action {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 16px; border-radius: var(--radius);
    font-family: var(--font); font-size: .82rem; font-weight: 600;
    cursor: pointer; text-decoration: none; border: none;
    transition: all var(--transition);
}
.btn-email  { background: rgba(0,108,255,.12); color: var(--primary); }
.btn-email:hover  { background: rgba(0,108,255,.2); }
.btn-phone  { background: rgba(13,148,136,.12); color: var(--teal); }
.btn-phone:hover  { background: rgba(13,148,136,.2); }
.btn-delete { background: rgba(220,38,38,.12); color: var(--red); }
.btn-delete:hover { background: rgba(220,38,38,.2); }

/* =============================================
   TOAST
   ============================================= */
.toast {
    position: fixed; bottom: 24px; right: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 20px;
    font-size: .85rem; font-weight: 600;
    box-shadow: 0 8px 32px rgba(0,0,0,.3);
    z-index: 2000;
    opacity: 0; transform: translateY(12px);
    transition: all .3s ease;
    pointer-events: none;
}
body.light-mode .toast { background: var(--surface-light); border-color: var(--border-light); }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.toast--ok    { border-left: 3px solid var(--green); }
.toast.toast--error { border-left: 3px solid var(--red); }
.toast.toast--info  { border-left: 3px solid var(--primary); }

/* =============================================
   LOADING STATE
   ============================================= */
.loading-state {
    text-align: center; padding: 32px;
    color: var(--text-muted); font-size: .88rem;
}
.loading-state i { margin-right: 8px; }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1024px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .charts-row { grid-template-columns: 1fr; }
    .modelos-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close { display: flex; }
    .main-content { margin-left: 0; }
    .hamburger-btn { display: flex; }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .section { padding: 16px; }
}

@media (max-width: 480px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .filter-group { flex-direction: column; }
    .filters-bar { flex-direction: column; align-items: stretch; }
    .topbar { padding: 0 16px; }
}
