/* ==========================================
   Panel de Control Electoral - Saylla 2026
   Estilos principales v2.0 — Profesional
   ========================================== */

/* ---- Variables CSS ---- */
:root {
    --primary: #14B8A6; /* Teal */
    --primary-light: #2DD4BF;
    --primary-dark: #0D9488;
    --accent: #1F2937; /* Dark Gray / Inverted */
    --accent-light: #374151;
    --accent-dark: #111827;
    --success: #14B8A6; /* Using Primary Teal for positive */
    --success-light: #2DD4BF;
    --warning: #F59E0B; /* Amber / Tertiary */
    --warning-light: #FBBF24;
    --info: #818CF8; /* Indigo / Secondary */
    --info-light: #A5B4FC;
    --danger: #dc2626;

    --bg-body: #F3F4F6;
    --bg-card: #FFFFFF;
    --bg-sidebar: #FFFFFF;
    --bg-topbar: #FFFFFF;

    --text-primary: #3f3f46; /* Brownish dark grey */
    --text-secondary: #52525b;
    --text-muted: #a1a1aa;
    --text-white: #ffffff;
    --text-sidebar: #52525b;

    --border: #e4e4e7;
    --border-light: #f4f4f5;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 9999px; /* Pill shapes */

    --sidebar-width: 280px;
    --topbar-height: 76px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Reset & Base ---- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}
a { text-decoration: none; color: inherit; }

/* ---- Sidebar ---- */
.sidebar {
    position: fixed; top: 0; left: 0;
    width: var(--sidebar-width); height: 100vh;
    background: var(--bg-sidebar);
    z-index: 1000;
    display: flex; flex-direction: column;
    transition: var(--transition);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.2);
}
.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex; align-items: center; justify-content: space-between;
}
.sidebar-logo { display: flex; align-items: center; gap: 12px; color: var(--text-primary); }
.sidebar-logo i { font-size: 28px; color: var(--primary); }
.sidebar-logo h2 { font-size: 20px; font-weight: 800; letter-spacing: 2px; }
.sidebar-logo span { font-size: 11px; color: var(--text-muted); font-weight: 600; letter-spacing: 1px; text-transform: uppercase; }
.sidebar-close { display: none; background: none; border: none; color: var(--text-primary); font-size: 20px; cursor: pointer; }
.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.nav-item {
    display: flex; align-items: center; gap: 14px;
    padding: 13px 18px; border-radius: var(--radius-xl);
    color: var(--text-sidebar); font-size: 14px; font-weight: 600;
    transition: var(--transition); position: relative; overflow: hidden;
    margin-bottom: 4px; border: 1px solid transparent;
}
.nav-item:hover { color: var(--primary); background: rgba(20, 184, 166, 0.08); }
.nav-item.active {
    background: var(--primary); color: white;
    font-weight: 700; box-shadow: 0 4px 12px rgba(20, 184, 166, 0.25);
}
.nav-item i { font-size: 18px; width: 24px; text-align: center; }
.sidebar-footer { padding: 16px 16px 24px; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.countdown-box {
    display: flex; align-items: center; gap: 12px; padding: 14px;
    background: var(--bg-body); border-radius: var(--radius-lg);
    color: var(--text-primary); border: 1px solid var(--border);
}
.countdown-box i { font-size: 22px; color: var(--warning); }
.countdown-box small { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); font-weight: 600; }
.countdown-timer { font-size: 14px; font-weight: 700; color: var(--text-primary); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ---- Main Content ---- */
.main-content { margin-left: var(--sidebar-width); min-height: 100vh; transition: var(--transition); }

/* ---- Top Bar ---- */
.topbar {
    position: sticky; top: 0; z-index: 500;
    height: var(--topbar-height); background: var(--bg-topbar);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; padding: 0 28px; gap: 20px;
    box-shadow: var(--shadow-sm); backdrop-filter: blur(20px);
}
.menu-toggle {
    display: none; background: none; border: none; font-size: 22px;
    color: var(--text-primary); cursor: pointer; padding: 8px;
    border-radius: var(--radius-sm); transition: var(--transition);
}
.menu-toggle:hover { background: var(--bg-body); }
.topbar-title h1 { font-size: 20px; font-weight: 700; color: var(--text-primary); }
.topbar-subtitle { font-size: 12px; color: var(--text-muted); font-weight: 400; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.topbar-date {
    display: flex; align-items: center; gap: 8px; padding: 8px 16px;
    background: var(--bg-body); border-radius: var(--radius-xl);
    font-size: 13px; color: var(--text-secondary); font-weight: 500;
}
.topbar-date i { color: var(--primary); }

/* ---- Page Content ---- */
.page-content { padding: 28px; }

/* ---- Page Transition ---- */
.page-content { animation: pageIn 0.4s ease-out; }
@keyframes pageIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---- KPI Cards ---- */
.kpi-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px; margin-bottom: 28px;
}
.kpi-card {
    background: var(--bg-card); border-radius: var(--radius-lg);
    padding: 24px; display: flex; align-items: flex-start; gap: 16px;
    box-shadow: var(--shadow-sm); transition: var(--transition);
    position: relative; overflow: hidden; border: 1px solid var(--border); cursor: pointer;
}
.kpi-card::before { content: ''; position: absolute; top: 0; left: 0; width: 6px; height: 100%; border-radius: var(--radius-lg) 0 0 var(--radius-lg); }
.kpi-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); border-color: var(--primary-light); }
.kpi-card.primary::before { background: var(--primary); }
.kpi-card.success::before { background: var(--success); }
.kpi-card.warning::before { background: var(--warning); }
.kpi-card.info::before { background: var(--info); }
.kpi-card.accent::before { background: var(--accent); }
.kpi-icon {
    width: 52px; height: 52px; border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; flex-shrink: 0;
}
.kpi-card.primary .kpi-icon { background: rgba(26, 35, 126, 0.1); color: var(--primary); }
.kpi-card.success .kpi-icon { background: rgba(46, 125, 50, 0.1); color: var(--success); }
.kpi-card.warning .kpi-icon { background: rgba(245, 127, 23, 0.1); color: var(--warning); }
.kpi-card.info .kpi-icon { background: rgba(2, 119, 189, 0.1); color: var(--info); }
.kpi-card.accent .kpi-icon { background: rgba(198, 40, 40, 0.1); color: var(--accent); }
.kpi-info { flex: 1; }
.kpi-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; margin-bottom: 4px; }
.kpi-value { font-size: 28px; font-weight: 800; color: var(--text-primary); line-height: 1.2; }
.kpi-detail { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

/* ---- Circular Progress ---- */
.circular-progress {
    position: relative; width: 70px; height: 70px; flex-shrink: 0;
}
.circular-progress svg { width: 70px; height: 70px; transform: rotate(-90deg); }
.circular-progress .bg { fill: none; stroke: var(--border); stroke-width: 6; }
.circular-progress .fg { fill: none; stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset 1s ease; }
.circular-progress .fg.green { stroke: var(--success); }
.circular-progress .fg.orange { stroke: var(--warning); }
.circular-progress .fg.blue { stroke: var(--info); }
.circular-progress .fg.red { stroke: var(--accent); }
.circular-progress .pct {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 800; color: var(--text-primary);
}

/* ---- Cards / Panels ---- */
.card {
    background: var(--bg-card); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm); border: 1px solid var(--border);
    overflow: hidden; transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
    padding: 20px 24px; border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-header h3 {
    font-size: 16px; font-weight: 700; color: var(--text-primary);
    display: flex; align-items: center; gap: 10px;
}
.card-header h3 i { color: var(--primary); }
.card-body { padding: 24px; }
.card-body.no-padding { padding: 0; }

/* ---- Charts Grid ---- */
.charts-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px; margin-bottom: 28px;
}
.chart-container { position: relative; height: 300px; width: 100%; }

/* ---- Tables ---- */
.table-responsive { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead { background: var(--bg-body); }
.data-table th {
    padding: 14px 16px; text-align: left; font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-secondary);
    border-bottom: 2px solid var(--border); white-space: nowrap;
    cursor: pointer; user-select: none; position: relative;
}
.data-table th.sortable:hover { color: var(--primary); }
.data-table th .sort-icon { margin-left: 4px; font-size: 10px; opacity: 0.4; }
.data-table th.sort-asc .sort-icon, .data-table th.sort-desc .sort-icon { opacity: 1; color: var(--primary); }
.data-table td {
    padding: 14px 16px; font-size: 13px; color: var(--text-primary);
    border-bottom: 1px solid var(--border-light); vertical-align: middle;
}
.data-table tbody tr { transition: var(--transition); }
.data-table tbody tr:hover { background: rgba(26, 35, 126, 0.03); }

/* ---- Inline Editable Cell ---- */
.editable-cell {
    cursor: pointer; padding: 4px 8px; border-radius: 4px;
    transition: var(--transition); min-width: 60px; display: inline-block;
}
.editable-cell:hover { background: rgba(26, 35, 126, 0.06); }
.editable-cell.empty { color: var(--text-muted); font-style: italic; }
.editable-input {
    width: 100%; padding: 4px 8px; border: 2px solid var(--primary);
    border-radius: 4px; font-family: 'Inter', sans-serif; font-size: 13px;
    outline: none; background: var(--bg-card);
    box-shadow: 0 0 0 4px rgba(26, 35, 126, 0.1);
}

/* ---- Badges ---- */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-radius: var(--radius-xl);
    font-size: 11px; font-weight: 600; letter-spacing: 0.3px;
}
.badge-success { background: rgba(46, 125, 50, 0.1); color: var(--success); }
.badge-danger { background: rgba(198, 40, 40, 0.1); color: var(--danger); }
.badge-warning { background: rgba(245, 127, 23, 0.1); color: var(--warning); }
.badge-info { background: rgba(2, 119, 189, 0.1); color: var(--info); }
.badge-primary { background: rgba(26, 35, 126, 0.1); color: var(--primary); }

/* ---- Toggle Switch ---- */
.toggle-switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
    position: relative; width: 44px; height: 24px; background: #d0d0d0; border-radius: 24px;
    transition: var(--transition); flex-shrink: 0;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.2), 0 1px 2px rgba(0,0,0,0.05);
    border: 2px solid #bbb;
}
.toggle-slider::before {
    content: ''; position: absolute; height: 18px; width: 18px;
    left: 1px; top: 1px; background: white; border-radius: 50%;
    transition: var(--transition); box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.toggle-slider::after {
    content: 'No'; position: absolute; right: -28px; top: 50%; transform: translateY(-50%);
    font-size: 11px; font-weight: 700; color: var(--text-muted);
    transition: var(--transition); white-space: nowrap;
}
.toggle-switch input:checked + .toggle-slider {
    background: var(--success); border-color: var(--success);
    box-shadow: 0 0 8px rgba(46,125,50,0.4), inset 0 1px 3px rgba(0,0,0,0.1);
}
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }
.toggle-switch input:checked + .toggle-slider::after {
    content: 'Sí'; right: -24px; color: var(--success); font-weight: 700;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px; padding: 10px 24px; border: none; border-radius: var(--radius-xl);
    font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: var(--transition); white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-outline { background: transparent; border: 2px solid var(--border); color: var(--text-primary); border-radius: var(--radius-xl); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: rgba(20, 184, 166, 0.05); }
.btn-sm { padding: 6px 16px; font-size: 12px; }
.btn-lg { padding: 14px 32px; font-size: 15px; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 50%; }
.btn-group { display: flex; gap: 8px; }

/* ---- Forms ---- */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.form-control {
    width: 100%; padding: 12px 20px; border: 1px solid var(--border);
    border-radius: var(--radius-xl); font-family: 'Inter', sans-serif;
    font-size: 14px; color: var(--text-primary); background: var(--bg-body);
    transition: var(--transition); outline: none;
}
.form-control:focus { border-color: var(--primary); background: var(--bg-card); box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.15); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control {
    cursor: pointer; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%235a5a7a' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px;
}
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }

/* ---- Search Bar Real-time ---- */
.search-bar {
    position: relative; max-width: 400px;
}
.search-bar input {
    width: 100%; padding: 10px 16px 10px 42px; border: 2px solid var(--border);
    border-radius: var(--radius-xl); font-family: 'Inter', sans-serif;
    font-size: 14px; outline: none; transition: var(--transition);
    background: var(--bg-card);
}
.search-bar input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(26, 35, 126, 0.1); }
.search-bar i {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); font-size: 16px;
}

/* ---- Filters Bar ---- */
.filters-bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
    padding: 16px 24px; background: var(--bg-body);
    border-bottom: 1px solid var(--border-light);
}
.filters-bar .form-control { max-width: 180px; padding: 8px 14px; font-size: 13px; }

/* ---- Miembros Form Table ---- */
.members-form-table { width: 100%; border-collapse: collapse; }
.members-form-table th {
    padding: 12px 14px; font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-secondary);
    background: var(--bg-body); border-bottom: 2px solid var(--border); text-align: left;
}
.members-form-table td { padding: 8px 10px; border-bottom: 1px solid var(--border-light); }
.members-form-table .cargo-cell { font-weight: 600; color: var(--text-primary); font-size: 12px; white-space: nowrap; min-width: 160px; }
.members-form-table .cargo-cell.titular { color: var(--primary); }
.members-form-table .cargo-cell.suplente { color: var(--text-secondary); }
.members-form-table .form-control { padding: 8px 12px; font-size: 13px; }

/* ---- Palotes / Counter ---- */
.palotes-container { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 28px; }
.palote-box {
    background: var(--bg-card); border-radius: var(--radius-md);
    padding: 32px; text-align: center;
    box-shadow: var(--shadow-sm); border: 1px solid var(--border-light);
    transition: var(--transition);
}
.palote-box:hover { box-shadow: var(--shadow-md); }
.palote-box.varones { border-top: 4px solid var(--info); }
.palote-box.mujeres { border-top: 4px solid var(--accent-light); }
.palote-label { font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.palote-box.varones .palote-label { color: var(--info); }
.palote-box.mujeres .palote-label { color: var(--accent-light); }
.palote-icon { font-size: 40px; margin-bottom: 12px; }
.palote-box.varones .palote-icon { color: var(--info); }
.palote-box.mujeres .palote-icon { color: var(--accent-light); }
.palote-count { font-size: 56px; font-weight: 800; color: var(--text-primary); margin: 12px 0; line-height: 1; transition: transform 0.15s; }
.palote-controls { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 16px; }
.palote-btn {
    width: 52px; height: 52px; border-radius: 50%; border: none;
    font-size: 24px; font-weight: 700; cursor: pointer;
    transition: var(--transition); display: flex; align-items: center;
    justify-content: center; color: white;
}
.palote-btn.plus { background: linear-gradient(135deg, var(--success), var(--success-light)); }
.palote-btn.minus { background: linear-gradient(135deg, var(--accent), var(--accent-light)); }
.palote-btn:hover { transform: scale(1.15); box-shadow: var(--shadow-md); }
.palote-btn:active { transform: scale(0.95); }

/* ---- Total Box ---- */
.total-box {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white; border-radius: var(--radius-md); padding: 24px;
    text-align: center; box-shadow: var(--shadow-md); margin-bottom: 28px;
}
.total-box h3 { font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; opacity: 0.9; margin-bottom: 8px; }
.total-box .total-value { font-size: 48px; font-weight: 800; line-height: 1; }
.total-box .total-detail { font-size: 13px; opacity: 0.8; margin-top: 8px; }

/* ---- Mesa Card ---- */
.mesas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.mesa-card {
    background: var(--bg-card); border-radius: var(--radius-lg);
    overflow: hidden; box-shadow: var(--shadow-sm);
    border: 1px solid var(--border); transition: var(--transition);
}
.mesa-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); border-color: var(--primary); }
.mesa-card-header {
    padding: 20px; background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white; display: flex; align-items: center; justify-content: space-between;
}
.mesa-card-header h4 { font-size: 18px; font-weight: 700; }
.mesa-card-header .mesa-number { font-size: 12px; opacity: 0.9; }
.mesa-card-body { padding: 20px; }
.mesa-stat {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 0; border-bottom: 1px solid var(--border-light); font-size: 13px;
}
.mesa-stat:last-child { border-bottom: none; }
.mesa-stat-label { color: var(--text-secondary); }
.mesa-stat-value { font-weight: 700; }
.mesa-card-footer { padding: 12px 20px; background: var(--bg-body); display: flex; gap: 8px; }

/* ---- Progress Bar ---- */
.progress { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 4px; transition: width 0.6s ease; }
.progress-bar.bg-success { background: var(--success); }
.progress-bar.bg-primary { background: var(--primary); }
.progress-bar.bg-warning { background: var(--warning); }

/* ---- Empty State ---- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state i { font-size: 56px; margin-bottom: 16px; opacity: 0.4; }
.empty-state h4 { font-size: 18px; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 14px; max-width: 400px; margin: 0 auto 20px; }

/* ---- Action Bar ---- */
.action-bar {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}

/* ======== MODAL SYSTEM ======== */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.5); z-index: 2000;
    align-items: flex-start; justify-content: center;
    padding: 40px 20px; overflow-y: auto;
    backdrop-filter: blur(4px);
    opacity: 0; transition: opacity 0.3s ease;
}
.modal-overlay.active { display: flex; opacity: 1; }
.modal-overlay.showing { opacity: 1; }

.modal {
    background: var(--bg-card); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl); width: 100%; max-width: 700px;
    transform: translateY(-20px) scale(0.97); transition: transform 0.3s ease;
    animation: modalIn 0.3s ease forwards;
}
@keyframes modalIn {
    from { transform: translateY(-20px) scale(0.97); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}
.modal.modal-lg { max-width: 900px; }
.modal.modal-sm { max-width: 480px; }

.modal-header {
    padding: 20px 24px; border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center; justify-content: space-between;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.modal-header h3 { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.modal-header h3 i { opacity: 0.8; }
.modal-close {
    background: rgba(255,255,255,0.2); border: none; color: white;
    width: 36px; height: 36px; border-radius: 50%;
    font-size: 18px; cursor: pointer; transition: var(--transition);
    display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: rgba(255,255,255,0.3); transform: rotate(90deg); }

.modal-body { padding: 24px; max-height: 70vh; overflow-y: auto; }
.modal-footer {
    padding: 16px 24px; border-top: 1px solid var(--border-light);
    display: flex; align-items: center; justify-content: flex-end; gap: 10px;
    background: var(--bg-body); border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ======== TOOLTIPS ======== */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%) translateY(4px);
    background: var(--text-primary); color: white;
    padding: 6px 12px; border-radius: 6px; font-size: 11px;
    white-space: nowrap; pointer-events: none;
    opacity: 0; transition: all 0.2s ease; z-index: 3000;
}
[data-tooltip]:hover::after { opacity: 1; transform: translateX(-50%) translateY(-6px); }

/* ======== SKELETON LOADING ======== */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.skeleton-text { height: 14px; width: 80%; margin-bottom: 8px; }
.skeleton-title { height: 24px; width: 60%; margin-bottom: 12px; }
.skeleton-avatar { width: 52px; height: 52px; border-radius: var(--radius-md); }
.skeleton-card { height: 120px; width: 100%; }
.skeleton-row { height: 48px; width: 100%; margin-bottom: 4px; }

/* ======== ACTIVITY FEED ======== */
.activity-feed { max-height: 320px; overflow-y: auto; }
.activity-item {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 12px 0; border-bottom: 1px solid var(--border-light);
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; flex-shrink: 0;
}
.activity-icon.green { background: rgba(46,125,50,0.1); color: var(--success); }
.activity-icon.blue { background: rgba(2,119,189,0.1); color: var(--info); }
.activity-icon.orange { background: rgba(245,127,23,0.1); color: var(--warning); }
.activity-icon.red { background: rgba(198,40,40,0.1); color: var(--accent); }
.activity-text { font-size: 13px; color: var(--text-primary); line-height: 1.4; }
.activity-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ======== PAGINATION ======== */
.pagination {
    display: flex; align-items: center; justify-content: center;
    gap: 4px; padding: 16px 24px;
}
.pagination-btn {
    min-width: 36px; height: 36px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: var(--bg-card);
    color: var(--text-secondary); font-size: 13px; font-weight: 600;
    cursor: pointer; transition: var(--transition);
    display: flex; align-items: center; justify-content: center;
    font-family: 'Inter', sans-serif;
}
.pagination-btn:hover { border-color: var(--primary); color: var(--primary); background: rgba(26,35,126,0.04); }
.pagination-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.pagination-btn:disabled { opacity: 0.4; cursor: default; }
.pagination-info { font-size: 13px; color: var(--text-muted); margin: 0 12px; }

/* ======== EXPORT BUTTONS ======== */
.export-group { display: flex; gap: 6px; }
.btn-export {
    padding: 6px 12px; font-size: 12px;
    display: inline-flex; align-items: center; gap: 6px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--bg-card); color: var(--text-secondary);
    cursor: pointer; transition: var(--transition); font-family: 'Inter', sans-serif; font-weight: 600;
}
.btn-export:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.btn-export.csv:hover { border-color: var(--success); color: var(--success); }
.btn-export.pdf:hover { border-color: var(--accent); color: var(--accent); }

/* ---- Overlay mobile sidebar ---- */
.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.5); z-index: 999;
    opacity: 0; transition: opacity 0.3s;
}
.sidebar-overlay.active { display: block; opacity: 1; }

/* ---- Animations ---- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeInUp 0.4s ease-out forwards; }
.animate-in:nth-child(1) { animation-delay: 0.05s; }
.animate-in:nth-child(2) { animation-delay: 0.1s; }
.animate-in:nth-child(3) { animation-delay: 0.15s; }
.animate-in:nth-child(4) { animation-delay: 0.2s; }
.animate-in:nth-child(5) { animation-delay: 0.25s; }

/* ---- Responsive ---- */
@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.active { transform: translateX(0); }
    .sidebar-close { display: block; }
    .main-content { margin-left: 0; }
    .menu-toggle { display: flex; }
    .charts-grid { grid-template-columns: 1fr; }
    .palotes-container { grid-template-columns: 1fr; }
    .modal { max-width: 95%; }
}
@media (max-width: 768px) {
    .page-content { padding: 16px; }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .topbar { padding: 0 16px; }
    .topbar-date { display: none; }
    .mesas-grid { grid-template-columns: 1fr; }
    .filters-bar { flex-direction: column; align-items: stretch; }
    .filters-bar .form-control { max-width: 100%; }
}
@media (max-width: 480px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .topbar-title h1 { font-size: 16px; }
    .kpi-value { font-size: 22px; }
}

/* ---- Print styles ---- */
@media print {
    .sidebar, .topbar, .menu-toggle, .btn, .filters-bar, .pagination, .export-group, .modal-overlay { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .page-content { padding: 0 !important; }
    .card { box-shadow: none !important; border: 1px solid #ddd !important; }
}
