/* =====================================================================
   SISTEMA DE CONTROL DE VOTOS ELECTORALES 2026
   Paleta: Blanco, Azul (primario) y Rojo (acento)
   Diseño responsive: mobile-first
   ===================================================================== */

:root {
    --color-azul: #003a91;
    --color-azul-dark: #002a6b;
    --color-azul-light: #1e5dc1;
    --color-azul-soft: #e8f0fb;
    --color-rojo: #d50032;
    --color-rojo-dark: #a8002a;
    --color-blanco: #ffffff;
    --color-gris-100: #f7f8fb;
    --color-gris-200: #e9edf2;
    --color-gris-300: #d1d8e0;
    --color-gris-500: #7b8a99;
    --color-gris-700: #3d4854;
    --color-gris-900: #1a1f25;
    --color-exito: #10b981;
    --color-error: #dc2626;
    --color-warning: #f59e0b;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,58,145,0.08);
    --shadow-lg: 0 8px 24px rgba(0,58,145,0.12);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--color-gris-100);
    color: var(--color-gris-900);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ===== FRANJA ROJA SUPERIOR (firma visual) ===== */
.franja-roja {
    height: 4px;
    background: linear-gradient(90deg, var(--color-rojo) 0%, var(--color-rojo-dark) 100%);
    width: 100%;
}

.franja-roja-bottom {
    height: 3px;
    background: var(--color-rojo);
    margin-top: auto;
}

/* ===== HEADER / NAVBAR ===== */
.navbar {
    background: var(--color-azul);
    color: white;
    padding: 0.75rem 1.25rem;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
    gap: 1rem;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.05rem;
    color: white;
    text-decoration: none;
}

.navbar-brand .logo-icon {
    width: 36px;
    height: 36px;
    background: white;
    color: var(--color-azul);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 800;
    font-size: 1.1rem;
    border: 2px solid var(--color-rojo);
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
}

.navbar-user .perfil-badge {
    background: var(--color-rojo);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-logout {
    background: rgba(255,255,255,0.15);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    text-decoration: none;
    transition: background 0.15s;
}

.btn-logout:hover { background: rgba(255,255,255,0.25); }

/* ===== LAYOUT PRINCIPAL ===== */
.layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    min-height: calc(100vh - 60px);
}

.sidebar {
    background: white;
    border-right: 1px solid var(--color-gris-200);
    padding: 1.25rem 0;
    overflow-y: auto;
}

.sidebar-section {
    padding: 0 1rem;
    margin-bottom: 1.25rem;
}

.sidebar-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--color-gris-500);
    padding: 0 0.5rem 0.5rem;
    border-bottom: 1px solid var(--color-gris-200);
    margin-bottom: 0.4rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.75rem;
    color: var(--color-gris-700);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background: var(--color-azul-soft);
    color: var(--color-azul);
}

.sidebar-link.active {
    background: var(--color-azul-soft);
    color: var(--color-azul);
    border-left-color: var(--color-rojo);
    font-weight: 600;
}

.sidebar-link .icon { font-size: 1.05rem; width: 20px; text-align: center; }

.main-content {
    padding: 1.5rem 1.75rem;
    overflow-x: auto;
}

/* ===== ENCABEZADO DE PÁGINA ===== */
.page-header {
    margin-bottom: 1.25rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--color-gris-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.page-title {
    font-size: 1.4rem;
    color: var(--color-azul);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-title::before {
    content: '';
    width: 4px;
    height: 24px;
    background: var(--color-rojo);
    border-radius: 2px;
}

/* ===== TARJETAS ===== */
.card {
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid var(--color-gris-200);
}

.card-title {
    font-size: 1rem;
    color: var(--color-azul);
    margin-bottom: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ===== STAT CARDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    border-radius: var(--radius-md);
    padding: 1.1rem;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--color-azul);
    transition: transform 0.15s;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card.rojo { border-left-color: var(--color-rojo); }
.stat-card.exito { border-left-color: var(--color-exito); }

.stat-card .label {
    font-size: 0.75rem;
    color: var(--color-gris-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.stat-card .value {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--color-azul);
    line-height: 1;
}

.stat-card .desc {
    font-size: 0.75rem;
    color: var(--color-gris-500);
    margin-top: 0.35rem;
}

/* ===== FORMULARIOS ===== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.85rem;
}

.form-group { margin-bottom: 0.85rem; }

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-gris-700);
    margin-bottom: 0.3rem;
}

.form-label .req { color: var(--color-rojo); margin-left: 2px; }

.form-control {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--color-gris-300);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    background: white;
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-azul);
    box-shadow: 0 0 0 3px rgba(0,58,145,0.1);
}

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ===== BOTONES ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1.1rem;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    font-family: inherit;
}

.btn-primary {
    background: var(--color-azul);
    color: white;
}
.btn-primary:hover { background: var(--color-azul-dark); }

.btn-danger {
    background: var(--color-rojo);
    color: white;
}
.btn-danger:hover { background: var(--color-rojo-dark); }

.btn-secondary {
    background: var(--color-gris-200);
    color: var(--color-gris-700);
}
.btn-secondary:hover { background: var(--color-gris-300); }

.btn-success {
    background: var(--color-exito);
    color: white;
}

.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.75rem; }
.btn-block { width: 100%; }

/* ===== TABLAS ===== */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
    background: white;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-gris-200);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table thead {
    background: var(--color-azul);
    color: white;
}

.table thead th {
    padding: 0.7rem 0.85rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
}

.table tbody tr {
    border-bottom: 1px solid var(--color-gris-200);
    transition: background 0.1s;
}

.table tbody tr:last-child { border-bottom: none; }
.table tbody tr:hover { background: var(--color-azul-soft); }

.table tbody td {
    padding: 0.65rem 0.85rem;
    color: var(--color-gris-700);
}

.table .acciones { display: flex; gap: 0.35rem; flex-wrap: wrap; }

/* ===== ALERTAS ===== */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.875rem;
    border-left: 4px solid;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.alert-success { background: #d1fae5; color: #065f46; border-color: var(--color-exito); }
.alert-error   { background: #fee2e2; color: #991b1b; border-color: var(--color-error); }
.alert-warning { background: #fef3c7; color: #92400e; border-color: var(--color-warning); }
.alert-info    { background: var(--color-azul-soft); color: var(--color-azul); border-color: var(--color-azul); }

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 0.18rem 0.55rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.badge-azul    { background: var(--color-azul-soft); color: var(--color-azul); }
.badge-rojo    { background: #fee2e2; color: var(--color-rojo); }
.badge-exito   { background: #d1fae5; color: #065f46; }
.badge-gris    { background: var(--color-gris-200); color: var(--color-gris-700); }

/* ===== TABS ===== */
.tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 2px solid var(--color-gris-200);
    margin-bottom: 1rem;
    overflow-x: auto;
}

.tab {
    padding: 0.65rem 1.1rem;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-gris-500);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    text-decoration: none;
    transition: all 0.15s;
    font-family: inherit;
}

.tab:hover { color: var(--color-azul); }

.tab.active {
    color: var(--color-azul);
    border-bottom-color: var(--color-rojo);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== BARRA DE PROGRESO ===== */
.progress {
    width: 100%;
    height: 22px;
    background: var(--color-gris-200);
    border-radius: 11px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--color-azul) 0%, var(--color-azul-light) 100%);
    transition: width 0.4s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    color: white;
    font-weight: 600;
    font-size: 0.75rem;
}

.progress-bar.completo { background: linear-gradient(90deg, var(--color-exito) 0%, #34d399 100%); }
.progress-bar.parcial { background: linear-gradient(90deg, var(--color-warning) 0%, #fbbf24 100%); }

/* ===== CHECKBOX MESA (asignación) ===== */
.mesa-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem;
    background: var(--color-gris-100);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-gris-200);
}

.mesa-item {
    display: flex;
    align-items: center;
    padding: 0.45rem 0.6rem;
    background: white;
    border: 1px solid var(--color-gris-300);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.15s;
    user-select: none;
}

.mesa-item:hover:not(.asignada-otro) {
    border-color: var(--color-azul);
    background: var(--color-azul-soft);
}

.mesa-item input[type=checkbox] { margin-right: 0.45rem; cursor: pointer; }

.mesa-item.libre { border-left: 3px solid var(--color-exito); }
.mesa-item.asignada-actual {
    border-left: 3px solid var(--color-azul);
    background: var(--color-azul-soft);
}
.mesa-item.asignada-otro {
    border-left: 3px solid var(--color-rojo);
    background: #fef2f2;
    color: var(--color-gris-500);
    cursor: not-allowed;
    opacity: 0.7;
}
.mesa-item.asignada-otro input { cursor: not-allowed; }

.mesa-item .mesa-num { font-weight: 700; color: var(--color-azul); }
.mesa-item .mesa-info {
    font-size: 0.7rem;
    color: var(--color-gris-500);
    margin-top: 0.1rem;
    display: block;
}

/* ===== LEYENDA DE ESTADOS ===== */
.legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: var(--color-gris-700);
    margin: 0.5rem 0;
}

.legend-item { display: flex; align-items: center; gap: 0.4rem; }

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.legend-dot.libre { background: var(--color-exito); }
.legend-dot.asignada { background: var(--color-azul); }
.legend-dot.otro { background: var(--color-rojo); }

/* ===== RESPONSIVE / MOBILE ===== */
.menu-toggle {
    display: none;
    background: rgba(255,255,255,0.15);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.1rem;
}

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

    .sidebar {
        position: fixed;
        left: -260px;
        top: 60px;
        bottom: 0;
        width: 250px;
        z-index: 99;
        transition: left 0.25s;
        box-shadow: var(--shadow-lg);
    }
    .sidebar.open { left: 0; }

    .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }

    .main-content { padding: 1rem; }

    .navbar-user .nombre-completo { display: none; }

    .stats-grid { grid-template-columns: repeat(2, 1fr); }

    .page-title { font-size: 1.15rem; }

    .table thead th, .table tbody td {
        padding: 0.5rem 0.55rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .navbar { padding: 0.6rem 0.85rem; }
    .navbar-brand { font-size: 0.9rem; }
    .navbar-brand .logo-icon { width: 30px; height: 30px; font-size: 0.95rem; }
}

/* Backdrop sidebar móvil */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 60px 0 0 0;
    background: rgba(0,0,0,0.4);
    z-index: 98;
}
.sidebar-backdrop.show { display: block; }

/* ===== UTILIDADES ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.w-full { width: 100%; }
.text-muted { color: var(--color-gris-500); font-size: 0.85rem; }
.empty-state {
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--color-gris-500);
}
.empty-state .icon { font-size: 2.5rem; margin-bottom: 0.5rem; opacity: 0.4; }

/* Modal simple */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal-backdrop.show { display: flex; }

.modal {
    background: white;
    border-radius: var(--radius-md);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
.modal-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-gris-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--color-azul);
    color: white;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.modal-header h3 { font-size: 1.05rem; }
.modal-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
}
.modal-body { padding: 1.25rem; }
.modal-footer {
    padding: 0.85rem 1.25rem;
    border-top: 1px solid var(--color-gris-200);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    background: var(--color-gris-100);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* Foto del candidato/acta preview */
.photo-thumb {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--color-gris-200);
    background: var(--color-gris-100);
}

.acta-thumb {
    max-width: 200px;
    max-height: 150px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-gris-300);
    cursor: pointer;
}

/* Notificación toast (Supervisión) */
.toast {
    position: fixed;
    top: 80px;
    right: 1rem;
    background: var(--color-azul);
    color: white;
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 300;
    max-width: 320px;
    border-left: 4px solid var(--color-rojo);
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

.toast.fadeOut { animation: fadeOut 0.4s forwards; }

@keyframes fadeOut {
    to { opacity: 0; transform: translateX(110%); }
}

/* Print-friendly */
@media print {
    .navbar, .sidebar, .btn, .acciones { display: none !important; }
    .main-content { padding: 0 !important; }
    .table { font-size: 0.75rem; }
}

/* =====================================================================
   ESTILOS COMPLEMENTARIOS PARA VISTAS RESTANTES
   ===================================================================== */

/* Subtítulo de página */
.page-subtitle {
    color: var(--color-gris-500);
    font-size: 0.85rem;
    margin-top: 0.25rem;
    flex-basis: 100%;
}

/* Stats con colores - alias usados en vistas */
.stat-card.stat-azul { border-left-color: var(--color-azul); }
.stat-card.stat-rojo { border-left-color: var(--color-rojo); }
.stat-card .stat-label,
.stat-label {
    font-size: 0.75rem;
    color: var(--color-gris-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 0.35rem;
}
.stat-card .stat-value,
.stat-value {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--color-azul);
    line-height: 1;
}
.stat-link {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--color-azul);
    text-decoration: none;
    font-weight: 600;
}
.stat-link:hover { color: var(--color-rojo); }

/* Form helpers */
.form-hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--color-gris-500);
}
.form-group-wide { grid-column: span 2; }
.form-group-full { grid-column: 1 / -1; }
.form-inline {
    display: flex;
    gap: 0.85rem;
    align-items: flex-end;
    flex-wrap: wrap;
}
.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.25rem;
    padding: 1rem 0;
    flex-wrap: wrap;
}
.btn-grande { padding: 0.85rem 2rem; font-size: 1rem; }

/* Foto thumbnail (alias) */
.foto-thumb {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--color-gris-200);
    background: var(--color-gris-100);
}
.foto-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-gris-200);
    color: var(--color-gris-500);
    font-weight: 700;
}

/* Badges adicionales */
.badge-verde { background: #d1fae5; color: #065f46; }
.badge-violeta { background: #ede9fe; color: #6d28d9; }
.badge-azul-claro { background: #dbeafe; color: var(--color-azul); }

/* Tabs - alias tab-btn */
.tab-btn {
    padding: 0.65rem 1.1rem;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-gris-500);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    text-decoration: none;
    transition: all 0.15s;
    font-family: inherit;
}
.tab-btn:hover { color: var(--color-azul); }
.tab-btn.active {
    color: var(--color-azul);
    border-bottom-color: var(--color-rojo);
}

/* Progress bar (sistema usado en supervision/avance) */
.progress-bar {
    width: 100%;
    height: 18px;
    background: var(--color-gris-200);
    border-radius: 9px;
    overflow: hidden;
    position: relative;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-azul) 0%, var(--color-azul-light) 100%);
    transition: width 0.4s ease;
    border-radius: 9px;
}
.progress-bar.progress-completo .progress-fill {
    background: linear-gradient(90deg, var(--color-exito) 0%, #34d399 100%);
}
.progress-bar.progress-parcial .progress-fill {
    background: linear-gradient(90deg, var(--color-warning) 0%, #fbbf24 100%);
}
.progress-bar-big {
    width: 100%;
    height: 24px;
    background: var(--color-gris-200);
    border-radius: 12px;
    overflow: hidden;
    margin: 0.75rem 0;
}
.progress-bar-big .progress-fill {
    background: linear-gradient(90deg, var(--color-azul) 0%, var(--color-rojo) 100%);
    border-radius: 12px;
}

/* Leyenda (alias en español) */
.leyenda {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: var(--color-gris-700);
    margin: 0.5rem 0;
}
.leyenda-item { display: flex; align-items: center; gap: 0.4rem; }
.cuadro {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    display: inline-block;
}
.cuadro.libre { background: var(--color-exito); }
.cuadro.asignada-actual { background: var(--color-azul); }
.cuadro.asignada-otro { background: var(--color-rojo); }

/* Modo selector (radio cards) */
.modo-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.radio-card {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem;
    background: var(--color-gris-100);
    border: 2px solid var(--color-gris-200);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.15s;
}
.radio-card:hover { border-color: var(--color-azul); }
.radio-card input[type=radio]:checked ~ span { color: var(--color-azul); }
.radio-card:has(input:checked) {
    border-color: var(--color-azul);
    background: var(--color-azul-soft);
}
.modo-grupo { margin-bottom: 1rem; }

/* Mesa cards (Personero dashboard) */
.mesa-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}
.mesa-card {
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-gris-200);
    border-top: 4px solid var(--color-azul);
    overflow: hidden;
}
.mesa-card-header {
    padding: 1rem;
    border-bottom: 1px solid var(--color-gris-200);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: var(--color-azul-soft);
}
.mesa-card-numero {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--color-azul);
}
.mesa-card-local {
    font-size: 0.8rem;
    color: var(--color-gris-500);
    margin-top: 0.15rem;
}
.mesa-card-body { padding: 0.5rem 1rem; }

.tipos-eleccion-list { display: flex; flex-direction: column; }
.tipo-eleccion-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--color-gris-200);
    gap: 0.5rem;
    flex-wrap: wrap;
}
.tipo-eleccion-row:last-child { border-bottom: none; }
.tipo-eleccion-row.completado { opacity: 0.85; }
.te-info { display: flex; align-items: center; gap: 0.5rem; flex:1; min-width: 150px; }
.te-codigo {
    background: var(--color-rojo);
    color: white;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 700;
}
.te-nombre { font-size: 0.85rem; font-weight: 500; }

/* Empty state grande */
.empty-state-big {
    padding: 3rem 1rem;
    text-align: center;
}
.empty-state-big h3 {
    color: var(--color-azul);
    margin-bottom: 0.5rem;
}
.empty-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    opacity: 0.6;
}

/* Back link y contexto */
.back-link {
    display: inline-block;
    color: var(--color-azul);
    text-decoration: none;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    flex-basis: 100%;
}
.back-link:hover { color: var(--color-rojo); }
.contexto-mesa {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 0.5rem;
    flex-basis: 100%;
}

/* Agrupaciones (Registrar votos) */
.agrupaciones-stack { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.25rem; }
.agrupacion-card {
    background: white;
    border-radius: var(--radius-md);
    padding: 1.1rem;
    border: 1px solid var(--color-gris-200);
    border-left: 4px solid var(--color-azul);
    box-shadow: var(--shadow-sm);
}
.agrupacion-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}
.agrupacion-nombre {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-azul);
}
.agrupacion-siglas {
    font-size: 0.75rem;
    color: var(--color-gris-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.agrupacion-input { min-width: 180px; flex: 0 0 auto; }
.agrupacion-input .form-label { font-size: 0.7rem; }
.input-votos-agrupacion {
    font-size: 1.1rem;
    font-weight: 700;
    text-align: center;
    color: var(--color-azul);
}

.candidatos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.6rem;
    padding: 0.75rem;
    background: var(--color-gris-100);
    border-radius: var(--radius-sm);
    margin-top: 0.5rem;
}
.candidato-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem;
    background: white;
    border: 1px solid var(--color-gris-200);
    border-radius: var(--radius-sm);
}
.cand-foto {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--color-gris-200);
    flex-shrink: 0;
}
.cand-foto-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-gris-200);
    color: var(--color-gris-500);
    font-weight: 700;
    font-size: 0.85rem;
}
.cand-info { flex: 1; min-width: 0; }
.cand-nombre {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-gris-900);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cand-numero {
    font-size: 0.7rem;
    color: var(--color-rojo);
    font-weight: 700;
}
.input-votos-candidato {
    width: 60px;
    flex-shrink: 0;
    padding: 0.3rem;
    text-align: center;
    font-weight: 600;
}

.suma-info {
    margin-top: 0.5rem;
    padding: 0.45rem 0.75rem;
    background: var(--color-gris-100);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--color-gris-700);
    border-left: 3px solid var(--color-gris-300);
}
.suma-info.ok {
    background: #d1fae5;
    color: #065f46;
    border-left-color: var(--color-exito);
}
.suma-info.error {
    background: #fee2e2;
    color: #991b1b;
    border-left-color: var(--color-error);
}

/* Modal alternativo (con .modal y .show) usado en personeros.php */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal.show { display: flex; }
.modal-content {
    background: white;
    border-radius: var(--radius-md);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
.modal-title { font-size: 1.05rem; }

/* Dashboard layout */
.dashboard-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}
@media (max-width: 900px) {
    .dashboard-row { grid-template-columns: 1fr; }
}

/* Avance grande (dashboard supervisión) */
.avance-big {
    text-align: center;
    padding: 0.75rem 0;
}
.avance-pct {
    font-size: 3rem;
    font-weight: 800;
    color: var(--color-azul);
    line-height: 1;
}
.avance-label {
    color: var(--color-gris-500);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}
.avance-detalle {
    font-size: 0.85rem;
    color: var(--color-gris-700);
    font-weight: 600;
}

/* Notificaciones (lista) */
.live-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    background: var(--color-rojo);
    border-radius: 50%;
    margin-left: 0.5rem;
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(213,0,50,0.5); }
    70% { box-shadow: 0 0 0 8px rgba(213,0,50,0); }
    100% { box-shadow: 0 0 0 0 rgba(213,0,50,0); }
}
.notif-lista {
    max-height: 380px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.notif-item {
    display: flex;
    gap: 0.6rem;
    padding: 0.65rem;
    background: var(--color-gris-100);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--color-azul);
    transition: background 0.15s;
}
.notif-item.nuevo {
    background: var(--color-azul-soft);
    border-left-color: var(--color-rojo);
    animation: slideIn 0.3s;
}
.notif-icon { font-size: 1.2rem; }
.notif-content { flex: 1; min-width: 0; }
.notif-titulo {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-azul);
}
.notif-mensaje { font-size: 0.8rem; color: var(--color-gris-700); }
.notif-fecha {
    font-size: 0.7rem;
    color: var(--color-gris-500);
    margin-top: 0.15rem;
}

/* Chart container */
.chart-container {
    position: relative;
    width: 100%;
    height: 300px;
}

/* Quick actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.85rem;
}
.quick-action {
    background: var(--color-azul-soft);
    border: 1px solid var(--color-gris-200);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-decoration: none;
    color: var(--color-azul);
    text-align: center;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
}
.quick-action:hover {
    background: var(--color-azul);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.qa-icon { font-size: 1.5rem; }
.qa-label { font-size: 0.85rem; }

/* Badges de mesas inline */
.badges-mesas {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    max-width: 280px;
}

/* Texto coloreado */
.text-rojo { color: var(--color-rojo); font-weight: 700; }
.text-verde { color: var(--color-exito); font-weight: 700; }

/* Mesa-num y mesa-numero (alias) */
.mesa-numero { font-weight: 700; color: var(--color-azul); }

/* Photo-thumb alias en español ya creado arriba como foto-thumb */

/* Responsive ajustes adicionales */
@media (max-width: 600px) {
    .agrupacion-header { flex-direction: column; align-items: stretch; }
    .agrupacion-input { min-width: 100%; }
    .candidatos-grid { grid-template-columns: 1fr; }
    .form-group-wide { grid-column: span 1; }
    .form-inline { flex-direction: column; align-items: stretch; }
}

/* =====================================================================
   LOGO SOMOS PERÚ (reemplaza .logo-icon)
   ===================================================================== */
.navbar-brand .logo-img {
    height: 42px;
    width: auto;
    max-width: 90px;
    object-fit: contain;
    background: white;
    padding: 3px 6px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--color-rojo);
}

@media (max-width: 600px) {
    .navbar-brand .logo-img { height: 34px; max-width: 70px; }
}
