:root {
    /* Modo Claro (Por Defecto) */
    --primary: #0a2540;
    --primary-hover: #07192c;
    --secondary: #e2e8f0;
    --secondary-hover: #cbd5e1;
    --accent: #dc2626;
    --background: #f8fafc;
    --surface: rgba(255, 255, 255, 0.9);
    --surface-border: rgba(10, 37, 64, 0.1);
    --text: #0a2540;
    --text-muted: #64748b;
    --success: #10b981;
    --danger: #dc2626;
}

body.dark-mode {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --secondary: #27272a;
    --secondary-hover: #3f3f46;
    --background: #121212;
    --surface: rgba(24, 24, 24, 0.95);
    --surface-border: rgba(255, 255, 255, 0.08);
    --text: #f4f4f5;
    --text-muted: #a1a1aa;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--background);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* No centrar verticalmente en móvil */
    padding: 0;
}

/* Background animated shapes */
.bg-shape {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    animation: float 20s infinite ease-in-out alternate;
}

.shape1 {
    width: 400px;
    height: 400px;
    background: rgba(10, 37, 64, 0.1);
    top: -100px;
    left: -100px;
}

.shape2 {
    width: 500px;
    height: 500px;
    background: rgba(220, 38, 38, 0.05);
    bottom: -150px;
    right: -150px;
    animation-delay: -5s;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(50px, 50px) scale(1.1);
    }
}

/* App Container */
.app-container {
    width: 100%;
    max-width: 600px;
    padding: 20px 16px;
    position: relative;
    min-height: 100vh;
    box-sizing: border-box;
}

/* Views Management */
.view {
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.view.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
    animation: slideUp 0.4s ease forwards;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUpRow {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

.skeleton {
    animation: shimmer 2s infinite linear;
    background: linear-gradient(to right, var(--secondary) 4%, var(--surface-border) 25%, var(--secondary) 36%);
    background-size: 1000px 100%;
}

.skeleton-row {
    width: 100%;
    border-radius: 4px;
    height: 20px;
}

.animate-row {
    animation: slideUpRow 0.3s ease forwards;
    opacity: 0;
}

@keyframes flashSos {
    0% { background-color: var(--danger); color: white; }
    50% { background-color: transparent; color: var(--danger); }
    100% { background-color: var(--danger); color: white; }
}

.sos-flash {
    animation: flashSos 1s infinite;
}

/* Glassmorphism Panel */
.glass-panel {
    background: var(--surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--surface-border);
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Typography */
.text-center {
    text-align: center;
}

h1 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

h2 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 20px;
}

h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-muted);
}

.subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 32px;
}

/* Logo */
.logo-container {
    width: 140px;
    height: 140px;
    background: white;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    box-shadow: 0 10px 25px rgba(10, 37, 64, 0.15);
    overflow: hidden;
    padding: 10px;
    border: 1px solid var(--surface-border);
}

.app-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 14px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 24px;
    border-radius: 14px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: white;
}

.btn-large {
    width: 100%;
    padding: 18px 24px;
    font-size: 1.1rem;
}

.btn-block {
    width: 100%;
}

.btn-small {
    padding: 10px 16px;
    font-size: 0.9rem;
}

.btn-primary {
    background: var(--primary);
    box-shadow: 0 8px 20px rgba(10, 37, 64, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(10, 37, 64, 0.3);
    background: var(--primary-hover);
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-secondary {
    background: var(--accent);
    color: white;
}

.btn-secondary:hover {
    background: var(--secondary-hover);
    transform: translateY(-2px);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Helpers */
.mt-3 {
    margin-top: 16px;
}

.mt-4 {
    margin-top: 24px;
}

/* Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding: 0 8px;
}

.app-header h2 {
    margin: 0;
}

/* Forms */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.95rem;
}

input[type="number"],
input[type="text"],
input[type="email"],
input[type="password"],
textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--surface-border);
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 1.05rem;
    color: var(--primary);
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: all 0.3s;
}

body.dark-mode input, body.dark-mode textarea {
    background: rgba(15, 23, 42, 0.8);
    color: var(--text);
}

input[type="number"]:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(10, 37, 64, 0.1);
}

/* File Upload UI */
.file-upload-wrapper {
    position: relative;
    width: 100%;
}

.file-upload-wrapper input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.file-upload-ui {
    background: rgba(255, 255, 255, 0.8);
    border: 2px dashed var(--surface-border);
    border-radius: 12px;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-muted);
    transition: all 0.3s;
}

.file-upload-wrapper:hover .file-upload-ui {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(10, 37, 64, 0.02);
}

.file-upload-wrapper.has-file .file-upload-ui {
    border-color: var(--success);
    border-style: solid;
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

/* Dashboard Stats */
.dashboard-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 24px;
}

.stat-box {
    text-align: center;
}

.stat-box h3 {
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary);
    text-shadow: 0 0 20px rgba(10, 37, 64, 0.15);
}

/* Table */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}

.data-table th,
.data-table td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid var(--surface-border);
}

.data-table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    font-size: 0.95rem;
}

.data-table tbody tr {
    transition: background 0.2s;
}

.data-table tbody tr:hover {
    background: rgba(10, 37, 64, 0.02);
}

.empty-state {
    text-align: center;
    padding: 30px;
    color: var(--text-muted);
    font-style: italic;
}

/* Nuevos Componentes (Search, Progreso, Paginación, Dark Mode Toggle) */
.search-input {
    margin-bottom: 16px;
    padding: 10px 14px;
    font-size: 0.9rem;
    border-radius: 8px;
}

.progress-bar-container {
    width: 100%;
    background: var(--secondary);
    border-radius: 10px;
    overflow: hidden;
    height: 8px;
}

.progress-bar-fill {
    height: 100%;
    background: var(--success);
    transition: width 0.4s ease-out;
}

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.btn-page {
    background: var(--background);
    border: 1px solid var(--surface-border);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text);
}

.btn-page:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.dark-mode-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ticker Live Feed */
.ticker-wrap {
    width: 100%;
    overflow: hidden;
    background-color: var(--primary);
    color: white;
    padding: 8px 0;
    box-sizing: border-box;
    margin-bottom: 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.2);
}

@keyframes ticker {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

.ticker-move {
    display: inline-block;
    padding-left: 100%;
    animation: ticker 25s linear infinite;
}

.ticker-item {
    margin-right: 30px;
}

.btn-view-doc {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.btn-view-doc:hover {
    background: var(--accent);
    color: white;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s;
}

.modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.modal-body {
    flex: 1;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 12px;
    min-height: 300px;
}

.modal-body img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
}

.modal-body iframe {
    width: 100%;
    height: 70vh;
    border: none;
}

/* Toast */
.toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--success);
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.4);
    z-index: 1000;
    transition: bottom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
    bottom: 40px;
}

.toast.error {
    background: var(--danger);
    box-shadow: 0 10px 25px rgba(239, 68, 68, 0.4);
}

/* =========================================
   LOGIN SCREEN SPECIAL STYLES (MATCHING IMAGE)
   ========================================= */

/* Background specific for login */
body.is-login-screen {
    background-image: url('https://res.cloudinary.com/dtmqftcsr/image/upload/v1789525696/laguna_del_salado_al2w2s.jpg');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: scroll;
    /* scroll en vez de fixed para iOS */
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

body.is-login-screen::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    z-index: 0;
}

/* Hide default shapes on login */
body.is-login-screen .bg-shape {
    display: none;
}

/* The Panel */
.login-glass-panel {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    color: white;
    position: relative;
    z-index: 1;
}

.login-title {
    font-size: 2.2rem;
    font-weight: 400;
    margin-bottom: 30px;
    color: white !important;
    text-align: left;
}

.login-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 400;
    color: white !important;
    font-size: 1rem;
}

.login-input {
    width: 100%;
    background: transparent !important;
    border: 1px solid rgba(255, 255, 255, 0.7) !important;
    color: white !important;
    padding: 12px 16px !important;
    border-radius: 8px !important;
    font-size: 1.1rem !important;
    outline: none;
    transition: all 0.3s;
}

.login-input::placeholder {
    color: rgba(255, 255, 255, 0.6) !important;
}

.login-input:focus {
    border-color: white !important;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2) !important;
}

.login-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    margin-bottom: 30px;
    font-size: 0.9rem;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white !important;
    cursor: pointer;
}

.remember-me input[type="checkbox"] {
    width: 16px;
    height: 16px;
    background: transparent;
    border: 1px solid white;
    border-radius: 3px;
    cursor: pointer;
}

.forgot-password {
    color: #38bdf8;
    text-decoration: none;
    transition: color 0.3s;
}

.forgot-password:hover {
    color: #7dd3fc;
}

.btn-login-special {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 12px 40px;
    font-size: 1.1rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.btn-login-special:hover {
    background: #2563eb;
}

/* =========================================
   ADMIN DASHBOARD STYLES
   ========================================= */

/* Wider container for admin */
#view-admin~* {}

#view-admin {
    width: 100%;
}

.app-container:has(#view-admin.active) {
    max-width: 900px;
}

/* Admin Header */
.admin-header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: cover;
    border: 2px solid var(--surface-border);
}

.btn-danger-icon {
    color: var(--danger) !important;
    background: rgba(220, 38, 38, 0.08);
    border-radius: 10px;
    padding: 10px;
}

.btn-danger-icon:hover {
    background: rgba(220, 38, 38, 0.15);
}

/* Stats Grid */
.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.admin-stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: white;
    border-radius: 18px;
    padding: 18px 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.07);
    border-left: 4px solid transparent;
    transition: transform 0.2s, box-shadow 0.2s;
}

.admin-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.1);
}

.admin-stat-card.accent-blue {
    border-left-color: #3b82f6;
}

.admin-stat-card.accent-green {
    border-left-color: #10b981;
}

.admin-stat-card.accent-navy {
    border-left-color: #0a2540;
}

.stat-card-icon {
    font-size: 1.8rem;
}

.stat-card-number {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
}

.stat-card-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* Admin Panels */
.admin-middle-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

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

.admin-chart-panel {
    margin-bottom: 24px;
    padding: 24px;
}

.ranking-panel {
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ranking-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--background);
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    transition: transform 0.2s;
}

.ranking-item:hover {
    transform: scale(1.02);
}

.ranking-info strong {
    font-size: 0.95rem;
    color: var(--text);
    display: block;
}

.ranking-info span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.ranking-votos {
    font-weight: 700;
    color: var(--success);
    font-size: 1.1rem;
}

.chart-container {
    height: 350px;
    width: 100%;
    position: relative;
}

/* Bottom grid: form + users table */
.admin-bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.admin-bottom-grid .glass-panel {
    padding: 24px;
}

/* Section title */
.section-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px !important;
}

/* Custom select */
.custom-select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--surface-border);
    background: white;
    color: var(--text);
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

.custom-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(10, 37, 64, 0.1);
}

/* Refresh button */
.btn-refresh {
    background: none;
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-refresh:hover {
    background: var(--background);
    border-color: var(--primary);
}

/* Role badges */
.role-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.role-badge.mesa {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
}

.role-badge.base {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
}

.role-badge.admin {
    background: rgba(10, 37, 64, 0.1);
    color: var(--primary);
}

/* Delete button */
.btn-delete {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s;
}

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

/* =========================================
   RESPONSIVE - MÓVIL COMPLETO
   ========================================= */

@media (max-width: 768px) {

    /* Cuerpo: login centrado, resto desde arriba */
    body {
        align-items: flex-start;
    }

    /* Contenedor principal: ocupa todo el ancho */
    .app-container {
        max-width: 100%;
        padding: 12px 12px 40px 12px;
        min-height: 100vh;
    }

    /* Admin view más ancho en móvil también */
    .app-container:has(#view-admin.active) {
        max-width: 100%;
    }

    /* Glass panel: menos padding */
    .glass-panel {
        padding: 20px 16px;
        border-radius: 16px;
    }

    /* Logo más pequeño */
    .logo-container {
        width: 90px;
        height: 90px;
    }

    /* Login panel más compacto */
    .login-glass-panel {
        padding: 28px 20px;
        border-radius: 12px;
    }

    .login-title {
        font-size: 1.8rem;
        margin-bottom: 20px;
    }

    /* Header más compacto */
    .app-header {
        margin-bottom: 16px;
        padding: 0 4px;
    }

    h2 {
        font-size: 1.2rem;
    }

    /* ADMIN: estadísticas en fila de 3 compactas */
    .admin-stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        margin-bottom: 14px;
    }

    .admin-stat-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 12px 8px;
        gap: 6px;
        border-left: none;
        border-top: 3px solid transparent;
    }

    .admin-stat-card.accent-blue {
        border-top-color: #3b82f6;
    }

    .admin-stat-card.accent-green {
        border-top-color: #10b981;
    }

    .admin-stat-card.accent-navy {
        border-top-color: #0a2540;
    }

    .stat-card-icon {
        font-size: 1.4rem;
    }

    .stat-card-number {
        font-size: 1.3rem;
    }

    .stat-card-label {
        font-size: 0.65rem;
    }

    /* Gráfico más bajo en móvil */
    .chart-container {
        height: 160px;
    }

    .admin-chart-panel {
        padding: 16px;
        margin-bottom: 14px;
    }

    /* Bottom grid: en columna */
    .admin-bottom-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .admin-bottom-grid .glass-panel {
        padding: 18px 16px;
    }

    /* Header marca admin más compacto */
    .admin-header-brand h2 {
        font-size: 1rem !important;
    }

    .admin-header-brand p {
        display: none;
        /* Ocultar subtítulo en móvil */
    }

    /* Tabla más compacta */
    .data-table th,
    .data-table td {
        padding: 10px 8px;
        font-size: 0.85rem;
    }

    /* Inputs más compactos */
    input[type="number"],
    input[type="text"],
    input[type="email"],
    input[type="password"] {
        font-size: 1rem;
        padding: 12px 14px;
    }

    /* En login, el app-container no interfiere con el centrado */
    body.is-login-screen .app-container {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 20px 16px;
    }

    .login-glass-panel {
        max-width: 100%;
    }
}

/* Pantallas muy pequeñas (< 380px) */
@media (max-width: 380px) {
    .admin-stats-grid {
        grid-template-columns: 1fr;
    }

    .admin-stat-card {
        flex-direction: row;
        text-align: left;
        border-top: none;
        border-left: 3px solid transparent;
    }

    .admin-stat-card.accent-blue {
        border-left-color: #3b82f6;
    }

    .admin-stat-card.accent-green {
        border-left-color: #10b981;
    }

    .admin-stat-card.accent-navy {
        border-left-color: #0a2540;
    }
}

/* =========================================
   MAPA Y PINES SOS
   ========================================= */
.sos-marker-flash {
    animation: sosPulse 1s infinite;
    font-size: 24px;
    text-align: center;
    line-height: 24px;
}
@keyframes sosPulse {
    0% { transform: scale(1); filter: drop-shadow(0 0 5px red); }
    50% { transform: scale(1.5); filter: drop-shadow(0 0 15px red); }
    100% { transform: scale(1); filter: drop-shadow(0 0 5px red); }
}

/* Nuevo pin SOS en el mapa: círculo rojo pulsante */
.sos-map-pin {
    position: relative;
    width: 32px;
    height: 32px;
    background: #dc2626;
    border: 3px solid #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.8);
    animation: sosPinPulse 1.2s ease-in-out infinite;
    cursor: pointer;
}
.sos-map-pin::before {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    background: rgba(220, 38, 38, 0.35);
    animation: sosRipple 1.2s ease-out infinite;
}
@keyframes sosPinPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 2px 8px rgba(220,38,38,0.8); }
    50%       { transform: scale(1.15); box-shadow: 0 4px 20px rgba(220,38,38,1); }
}
@keyframes sosRipple {
    0%   { transform: scale(0.8); opacity: 0.8; }
    100% { transform: scale(1.8); opacity: 0; }
}

/* =========================================
   CHAT INTERNO (WAR ROOM)
   ========================================= */
.chat-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
    cursor: pointer;
    z-index: 1000;
    transition: transform 0.2s;
    display: none; /* Se activa con JS */
}
.chat-fab:hover { transform: scale(1.1); }
.chat-fab.has-unread::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 14px; height: 14px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid white;
}

.chat-panel {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 320px;
    height: 450px;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(150%);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid var(--surface-border);
}
.chat-panel.active {
    transform: translateY(0);
}
.chat-header {
    background: var(--primary);
    color: white;
    padding: 15px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.chat-header .close-btn {
    background: none; border: none; color: white; cursor: pointer;
}
.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(0,0,0,0.02);
}
body.dark-mode .chat-messages { background: rgba(0,0,0,0.2); }
.chat-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.85rem;
    position: relative;
    word-break: break-word;
}
.chat-msg.mine {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 2px;
}
.chat-msg.others {
    align-self: flex-start;
    background: var(--background);
    border: 1px solid var(--surface-border);
    border-bottom-left-radius: 2px;
}
.chat-msg-user { font-size: 0.7rem; opacity: 0.7; margin-bottom: 3px; font-weight: 600; }
.chat-msg.mine .chat-msg-user { display: none; }
.chat-input-area {
    padding: 10px;
    background: var(--surface);
    border-top: 1px solid var(--surface-border);
    display: flex;
    gap: 8px;
}
.chat-input-area input {
    flex: 1;
    padding: 10px;
    border-radius: 20px;
    border: 1px solid var(--surface-border);
    background: var(--background);
    color: var(--text);
    outline: none;
}
.chat-input-area button {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
}

@media (max-width: 768px) {
    .chat-panel {
        bottom: 0; right: 0;
        width: 100%; height: 60vh;
        border-radius: 20px 20px 0 0;
    }
}