/* ============================================
   SISTEMA DE CAMPAMENTOS TRANSITORIOS
   Estilos Globales - Professional Theme
   Tema (colores + Montserrat): shared/temas/tema.css
   Incluir tema.css ANTES de este archivo en cada HTML.
   ============================================ */

/* Page transition animation */
.main-content {
    animation: pageFadeIn 0.35s ease;
}

@keyframes pageFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stats cards staggered entrance */
.stat-card {
    animation: statSlideUp 0.4s ease backwards;
}

.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }
.stat-card:nth-child(5) { animation-delay: 0.25s; }
.stat-card:nth-child(6) { animation-delay: 0.3s; }

@keyframes statSlideUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card entrance */
.card {
    animation: cardFade 0.4s ease backwards;
}

.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.15s; }

@keyframes cardFade {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Layout (colores y --font-family en temas/tema.css) */
:root {
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --header-height: 70px;
    --border-radius: 6px;
    --shadow: 0 1px 2px rgba(0,0,0,0.05), 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
    --transition: all 0.2s ease;
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--light);
    color: var(--dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white) !important;
    padding: 20px;
}

html:has(body.login-page),
body.login-page {
    background: var(--white) !important;
}

.login-container {
    display: flex;
    max-width: 1000px;
    width: 100%;
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
    border: 1px solid var(--light-border);
}

.login-card {
    flex: 1;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    width: 96px;
    height: 96px;
    max-width: 100%;
    margin: 0 auto 16px;
    background: transparent;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    overflow: hidden;
    flex-shrink: 0;
}

.login-logo .logo-campamento {
    width: 100%;
    height: 100%;
    max-width: 96px;
    max-height: 96px;
    object-fit: contain;
    object-position: center;
    display: block;
}

.login-header h1 {
    font-size: 24px;
    color: var(--dark);
    margin-bottom: 5px;
}

.login-header p {
    color: var(--secondary);
    font-size: 14px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 14px;
    border: 1.5px solid var(--light-border);
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: var(--transition);
    background: var(--white);
    font-family: var(--font-family);
    color: var(--dark);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-accent);
    box-shadow: 0 0 0 3px rgba(var(--color-primario-rgb), 0.1);
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
    border-color: var(--border-muted);
}

.form-group input::placeholder,
.form-group select::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.password-field {
    position: relative;
    display: flex;
    align-items: center;
}

.password-field input {
    width: 100%;
    padding-right: 44px;
}

.password-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: var(--border-radius);
    background: transparent;
    color: var(--secondary);
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-family);
}

.password-toggle:hover {
    color: var(--primary);
    background: rgba(var(--color-primario-rgb), 0.08);
}

.password-toggle:focus-visible {
    outline: none;
    color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--color-primario-rgb), 0.2);
}

.password-toggle[aria-pressed="true"] {
    color: var(--primary);
}

.password-toggle svg {
    display: block;
    pointer-events: none;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.horario-rango {
    display: flex;
    align-items: center;
    gap: 8px;
}

.horario-rango input[type="time"] {
    flex: 1;
    min-width: 0;
}

.horario-sep {
    color: var(--secondary);
    font-size: 13px;
    font-weight: 500;
    flex-shrink: 0;
    text-transform: lowercase;
}

.checkbox-group {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--secondary);
}

.checkbox-label input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkmark {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border: 2px solid var(--light-border);
    border-radius: 3px;
    background: var(--white);
    pointer-events: none;
}

.forgot-password {
    font-size: 14px;
    color: var(--primary);
    text-decoration: none;
}

.forgot-password:hover {
    text-decoration: underline;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--light-border);
    color: var(--secondary);
    font-size: 14px;
}

.login-footer a {
    color: var(--primary);
    text-decoration: none;
}

.login-info {
    flex: 1;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    position: relative;
    overflow: hidden;
}

.login-info::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(var(--color-primario-rgb), 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.info-content h2 {
    font-size: 28px;
    margin-bottom: 15px;
}

.info-content p {
    font-size: 16px;
    opacity: 0.9;
    margin-bottom: 30px;
}

.info-features {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.info-features li {
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    padding: 11px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    letter-spacing: 0.01em;
}

.btn-header {
    padding: 14px 26px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 10px;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn-primary::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: -1;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--color-primario-rgb), 0.3);
}

.btn-primary:hover::after {
    opacity: 1;
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: none;
}

.btn-secondary {
    background: var(--white);
    color: var(--dark);
    border: 1px solid var(--light-border);
}

.btn-secondary:hover {
    background: var(--light);
    border-color: var(--primary-light);
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.btn-secondary:active {
    transform: translateY(0);
}

.btn-block {
    width: 100%;
    padding: 14px;
    font-size: 16px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-danger {
    background: var(--danger-bright);
    color: var(--white);
    border: 1px solid var(--danger-bright);
}

.btn-danger:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: var(--white);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(220,38,38,0.3);
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 4px;
    transition: var(--transition);
    font-size: 16px;
}

.btn-icon:hover {
    background: var(--light);
    transform: scale(1.1);
}

.btn-icon {
    transition: all 0.2s ease;
}

.btn-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.btn-link:hover {
    text-decoration: underline;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success-text);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning-text);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
    animation: badgePulse 2s infinite;
}

@keyframes badgePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.badge-info {
    background: var(--info-bg);
    color: var(--info-text);
}

.badge-primary {
    background: var(--primary-tint);
    color: var(--primary-dark);
}

.badge-secondary {
    background: var(--surface-muted);
    color: var(--surface-muted-text);
}

.badge-success-solid {
    background: #22c55e;
    color: var(--white);
    padding: 5px 14px;
    font-size: 12px;
}

.badge-danger-solid {
    background: var(--danger-bright);
    color: var(--white);
    padding: 5px 14px;
    font-size: 12px;
}

.badge-info-solid {
    background: #22c55e;
    color: var(--white);
    padding: 5px 14px;
    font-size: 12px;
}

.badge-warning-solid {
    background: #f59e0b;
    color: var(--white);
    padding: 5px 14px;
    font-size: 12px;
}

.badge-secondary-solid {
    background: #64748b;
    color: var(--white);
    padding: 5px 14px;
    font-size: 12px;
}

.badge-pendiente {
    background: var(--warning-bg);
    color: var(--warning-text);
}

.badge-resuelto {
    background: var(--success-bg);
    color: var(--success-text);
}

/* ============================================
   DASHBOARD LAYOUT
   ============================================ */
.dashboard-page {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: var(--transition);
    box-shadow: 2px 0 8px rgba(0,0,0,0.05);
}

.sidebar-header {
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    text-align: center;
}

.sidebar-header .logo {
    width: 72px;
    height: 72px;
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    flex-shrink: 0;
    background: transparent;
    border-radius: 12px;
    overflow: hidden;
}

.sidebar-header .logo svg {
    width: 100%;
    height: 100%;
    stroke: var(--white);
}

.sidebar-header .logo .logo-campamento {
    width: 100%;
    height: 100%;
    max-width: 72px;
    max-height: 72px;
    object-fit: contain;
    object-position: center;
    display: block;
}

.sidebar-header h2 {
    font-size: 12px;
    font-weight: 700;
    white-space: normal;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--white);
    line-height: 1.3;
    max-width: 180px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    margin: 2px 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    transition: var(--transition);
    font-size: 14px;
    font-weight: 500;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.1);
    color: var(--white);
}

.sidebar-nav li.active a {
    background: var(--sidebar-active);
    color: var(--white);
    border-left-color: var(--white);
    font-weight: 600;
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
}

.nav-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

.nav-text {
    white-space: nowrap;
    flex: 1;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.25);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--white);
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
    line-height: 1.3;
}

.user-role {
    font-size: 11px;
    color: rgba(255,255,255,0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
    line-height: 1.3;
}

.logout-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: var(--transition);
    font-size: 16px;
    margin-left: auto;
    flex-shrink: 0;
}

.logout-btn:hover {
    background: rgba(255,255,255,0.15);
    color: var(--white);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 20px;
    transition: var(--transition);
}

.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed);
}

/* Header */
.header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    padding: 24px 28px;
    background: var(--white);
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    min-height: 90px;
    animation: headerSlideDown 0.3s ease;
    flex-wrap: wrap;
}

@keyframes headerSlideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--light);
    border-radius: var(--border-radius);
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition);
    color: var(--dark);
}

.menu-toggle:hover {
    background: var(--light-border);
}

.header-title {
    flex: 1;
    min-width: 0;
}

.header-title h1 {
    font-size: 30px;
    font-weight: 800;
    color: var(--dark);
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.header-title p {
    font-size: 15px;
    color: var(--secondary);
    margin-top: 6px;
    font-weight: 400;
}

.header-actions {
    margin-left: auto;
    display: flex;
    gap: 10px;
    align-items: center;
}

/* ============================================
   STATS CARDS
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stats-grid-small {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.stat-card {
    background: var(--white);
    padding: 20px 24px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
    border: 1px solid var(--light-border);
}

.stat-card:hover {
    border-color: var(--primary-light);
    box-shadow: 0 6px 20px -6px rgba(var(--color-primario-rgb), 0.2);
    transform: translateY(-3px);
}

.stat-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    color: var(--white);
    flex-shrink: 0;
}

.stat-icon.campamentos { background: linear-gradient(135deg, var(--primary-light), var(--primary)); }
.stat-icon.familias { background: linear-gradient(135deg, var(--primary-light), var(--primary)); }
.stat-icon.inventario { background: linear-gradient(135deg, var(--primary-light), var(--primary)); }
.stat-icon.alertas { background: linear-gradient(135deg, var(--danger-bright), var(--danger)); }
.stat-icon.menores { background: linear-gradient(135deg, var(--primary-light), var(--primary)); }
.stat-icon.vulnerables { background: linear-gradient(135deg, #f97316, #ea580c); }
.stat-icon.roles { background: linear-gradient(135deg, var(--primary-light), var(--primary)); }
.stat-icon.usuarios { background: linear-gradient(135deg, var(--primary-light), var(--primary)); }
.stat-icon.permisos { background: linear-gradient(135deg, var(--primary-light), var(--primary)); }
.stat-icon.sesiones { background: linear-gradient(135deg, var(--primary-light), var(--primary)); }
.stat-icon.categorias { background: linear-gradient(135deg, var(--primary-light), var(--primary)); }
.stat-icon.alerta { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-icon.agotado { background: linear-gradient(135deg, var(--danger-bright), #b91c1c); }

.stat-icon.success { background: linear-gradient(135deg, var(--primary-light), var(--primary)); }
.stat-icon.comedor { background: linear-gradient(135deg, #f97316, #ea580c); }
.stat-icon.incidencias { background: linear-gradient(135deg, #f59e0b, #d97706); }

.stat-info h3 {
    font-size: 13px;
    color: var(--secondary);
    font-weight: 400;
    margin-bottom: 2px;
}

.stat-number {
    font-size: 28px;
    font-weight: 700;
    color: var(--dark);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.stat-change {
    font-size: 12px;
    font-weight: 500;
}

.stat-change.positive { color: var(--success); }
.stat-change.negative { color: var(--danger); }
.stat-change.neutral { color: var(--secondary); }

/* ============================================
   DASHBOARD GRID
   ============================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.chart-card {
    min-width: 0;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    border: 1px solid var(--light-border);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--light-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--dark);
}

.card-body {
    padding: 20px;
}

/* ============================================
   FILTERS BAR
   ============================================ */
.filters-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px 20px;
    background: var(--white);
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    flex-wrap: wrap;
    align-items: center;
}

.search-box {
    flex: 1;
    min-width: 250px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.search-box .search-input {
    flex: 1;
}

.search-btn {
    width: 42px;
    height: 42px;
    border: none;
    background: var(--primary);
    color: var(--white);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.search-btn:hover {
    background: var(--primary-hover);
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--surface-muted);
    color: var(--surface-muted-text);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.filter-chip .chip-close {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1;
}

.filter-chip .chip-close:hover {
    color: var(--danger);
}

.filter-chip-active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.filter-chip-active .chip-close {
    color: var(--white);
}

.filter-chip-active .chip-close:hover {
    color: var(--surface-muted);
}

.filter-dropdown-wrapper {
    position: relative;
    display: inline-block;
}

.filter-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--white);
    border: 1px solid var(--light-border);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    overflow: hidden;
}

.filter-dropdown.active {
    display: block;
    animation: dropdownIn 0.15s ease;
}

@keyframes dropdownIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.filter-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    font-size: 13px;
    color: var(--dark);
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid var(--light-border);
}

.filter-dropdown-item:last-child {
    border-bottom: none;
}

.filter-dropdown-item:hover {
    background: var(--color-primario-tint-soft);
    color: var(--primary);
}

.filter-dropdown-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--white);
    color: var(--surface-muted-text);
    border: 1.5px solid var(--light-border);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filter-btn svg {
    width: 14px;
    height: 14px;
}

.search-input {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid var(--light-border);
    border-radius: var(--border-radius);
    font-size: 14px;
    font-family: var(--font-family);
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-accent);
    box-shadow: 0 0 0 3px rgba(var(--color-primario-rgb), 0.12);
}

.search-input {
    transition: all 0.25s ease;
}

.search-btn {
    padding: 10px 14px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
}

.search-btn:hover {
    background: var(--primary-light);
}

.filter-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-select,
.filter-date {
    padding: 10px 14px;
    border: 1.5px solid var(--light-border);
    border-radius: var(--border-radius);
    font-size: 14px;
    background: var(--white);
    cursor: pointer;
    min-width: 150px;
    font-family: var(--font-family);
    color: var(--dark);
    transition: var(--transition);
}

.filter-select:hover,
.filter-date:hover {
    border-color: var(--border-muted);
}

.filter-select:focus,
.filter-date:focus {
    outline: none;
    border-color: var(--primary-accent);
    box-shadow: 0 0 0 3px rgba(var(--color-primario-rgb), 0.1);
}

/* ============================================
   TABLES
   ============================================ */
.table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 769px) and (max-width: 1280px) {
    .table-responsive .data-table {
        min-width: 700px;
    }
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 600;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--light-border);
    background: var(--light);
}

.data-table td {
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--light-border);
    color: var(--dark);
}

.data-table tbody tr {
    animation: rowFadeIn 0.3s ease backwards;
}

.data-table tbody tr:nth-child(1) { animation-delay: 0.02s; }
.data-table tbody tr:nth-child(2) { animation-delay: 0.04s; }
.data-table tbody tr:nth-child(3) { animation-delay: 0.06s; }
.data-table tbody tr:nth-child(4) { animation-delay: 0.08s; }
.data-table tbody tr:nth-child(5) { animation-delay: 0.1s; }
.data-table tbody tr:nth-child(6) { animation-delay: 0.12s; }
.data-table tbody tr:nth-child(7) { animation-delay: 0.14s; }
.data-table tbody tr:nth-child(8) { animation-delay: 0.16s; }
.data-table tbody tr:nth-child(9) { animation-delay: 0.18s; }
.data-table tbody tr:nth-child(10) { animation-delay: 0.2s; }

@keyframes rowFadeIn {
    from {
        opacity: 0;
        transform: translateX(-6px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.data-table tbody tr {
    transition: background 0.2s ease;
}

.data-table tbody tr:hover {
    background: var(--color-primario-tint-soft);
}

.data-table tbody tr td:first-child {
    border-radius: 6px 0 0 6px;
}

.data-table tbody tr td:last-child {
    border-radius: 0 6px 6px 0;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table .actions {
    display: flex;
    gap: 4px;
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar-sm {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--white);
}

/* ============================================
   CAMPAMENTOS GRID
   ============================================ */
.campamentos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.campamento-card {
    background: var(--white);
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--light-border);
}

.campamento-card.is-inactive {
    opacity: 0.72;
    border-color: #94a3b8;
}

.campamento-card.is-inactive .campamento-header {
    background: #64748b;
}

.campamento-card:hover {
    box-shadow: 0 8px 25px -8px rgba(var(--color-primario-rgb), 0.2);
    transform: translateY(-4px);
}

.campamento-header {
    padding: 18px 22px;
    background: var(--primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.campamento-header h3 {
    color: var(--white);
    font-size: 17px;
    font-weight: 700;
    margin: 0;
}

.campamento-icon {
    display: none;
}

.campamento-status {
    flex-shrink: 0;
}

.campamento-body {
    padding: 22px;
}

.campamento-location {
    font-size: 14px;
    color: var(--secondary);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.campamento-location::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23009BDB' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z'/%3E%3Ccircle cx='12' cy='10' r='3'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    flex-shrink: 0;
}

.campamento-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.campamento-stats .stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.campamento-stats .stat-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.campamento-stats .stat-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--dark);
}

.progress-bar {
    height: 6px;
    background: var(--light-border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0;
}

.progress-fill {
    height: 100%;
    background: #22c55e;
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-fill.warning { background: #f59e0b; }
.progress-fill.danger { background: var(--danger-bright); }
.progress-fill.info { background: var(--primary); }

.progress-text {
    display: none;
}

.campamento-footer {
    padding: 16px 22px;
    background: var(--light);
    display: flex;
    gap: 8px;
    justify-content: space-between;
    border-top: 1px solid var(--light-border);
}

.campamento-footer .btn {
    flex: 1;
    justify-content: center;
}

/* ============================================
   ROLES GRID
   ============================================ */
.roles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.rol-card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid var(--light-border);
}

.rol-card:hover {
    border-color: var(--primary-light);
    box-shadow: 0 8px 25px -8px rgba(var(--color-primario-rgb), 0.2);
    transform: translateY(-4px);
}

.rol-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.rol-header {
    padding: 20px;
    background: var(--light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--light-border);
}

.rol-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    color: var(--white);
}

.rol-icon.admin { background: linear-gradient(135deg, var(--primary-light), var(--primary)); }
.rol-icon.manager { background: linear-gradient(135deg, var(--primary-light), var(--primary)); }
.rol-icon.coordinator { background: linear-gradient(135deg, var(--primary-light), var(--primary)); }
.rol-icon.volunteer { background: linear-gradient(135deg, var(--primary-light), var(--primary)); }
.rol-icon.viewer { background: linear-gradient(135deg, var(--primary-light), var(--primary)); }
.rol-icon.guest { background: linear-gradient(135deg, var(--text-muted), var(--secondary)); }

.rol-body {
    padding: 20px;
}

.rol-body h3 {
    font-size: 16px;
    margin-bottom: 4px;
    color: var(--dark);
    font-weight: 600;
}

.rol-body > p {
    font-size: 13px;
    color: var(--secondary);
    margin-bottom: 16px;
}

.rol-stats {
    display: flex;
    gap: 20px;
}

.rol-stats .stat {
    display: flex;
    flex-direction: column;
}

.rol-stats .stat-label {
    font-size: 12px;
    color: var(--secondary);
}

.rol-stats .stat-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
}

.rol-footer {
    padding: 14px 20px;
    background: var(--light);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    border-top: 1px solid var(--light-border);
}

/* ============================================
   REPORT TYPES
   ============================================ */
.report-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.report-type-card {
    background: var(--white);
    padding: 24px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
    transition: var(--transition);
    border: 1px solid var(--light-border);
}

.report-type-card:hover {
    border-color: var(--primary-light);
    box-shadow: 0 8px 25px -8px rgba(var(--color-primario-rgb), 0.2);
    transform: translateY(-4px);
}

.report-type-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.report-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
    color: var(--white);
    transition: transform 0.3s ease;
}

.report-type-card:hover .report-icon {
    transform: scale(1.1);
}

.report-icon.ocupacion { background: linear-gradient(135deg, var(--primary-light), var(--primary)); }
.report-icon.poblacion { background: linear-gradient(135deg, var(--primary-light), var(--primary)); }
.report-icon.inventario { background: linear-gradient(135deg, var(--primary-light), var(--primary)); }
.report-icon.actividad { background: linear-gradient(135deg, var(--primary-light), var(--primary)); }

.report-type-card h3 {
    font-size: 15px;
    margin-bottom: 6px;
    color: var(--dark);
    font-weight: 600;
}

.report-type-card p {
    font-size: 13px;
    color: var(--secondary);
    margin-bottom: 16px;
    line-height: 1.4;
}

/* ============================================
   CHARTS — ocupación (barra acotada + scroll)
   ============================================ */
.chart-placeholder {
    padding: 16px 12px 8px;
    text-align: center;
    color: var(--secondary);
    overflow: hidden;
    min-height: 260px;
    box-sizing: border-box;
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 16px;
    height: 200px;
    max-height: 200px;
    margin-top: 12px;
    padding: 0 8px 40px;
    overflow-x: auto;
    overflow-y: hidden;
    box-sizing: border-box;
}

.chart-bars .bar {
    flex: 0 0 56px;
    width: 56px;
    max-height: 100%;
    min-height: 8px;
    background: linear-gradient(to top, var(--primary), var(--primary-light));
    border-radius: 3px 3px 0 0;
    position: relative;
    transition: var(--transition);
    align-self: flex-end;
}

.chart-bars .bar.over {
    background: linear-gradient(to top, var(--danger), #f87171);
}

.chart-bars .bar:hover {
    opacity: 0.85;
}

.chart-bars .bar span {
    position: absolute;
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    color: var(--secondary);
    white-space: nowrap;
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chart-bars .bar .bar-pct {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    font-weight: 600;
    color: var(--dark);
    white-space: nowrap;
}

.chart-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    color: var(--secondary);
    font-size: 14px;
}

.chart-line {
    position: relative;
    height: 200px;
    margin-top: 30px;
    background: linear-gradient(to top, var(--light) 1px, transparent 1px) 0 0/100% 40px,
                linear-gradient(to right, var(--light) 1px, transparent 1px) 0 0/40px 100%;
}

.line-point {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--primary);
    border-radius: 50%;
    transform: translate(-50%, 50%);
}

.chart-pie {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    margin: 20px auto;
    background: conic-gradient(
        var(--primary) 0deg 126deg,
        var(--primary-light) 126deg 226.8deg,
        var(--primary-mid) 226.8deg 306deg,
        var(--primary-pale) 306deg 360deg
    );
    position: relative;
}

.chart-pie::after {
    content: '';
    position: absolute;
    width: 80px;
    height: 80px;
    background: var(--white);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.pie-slice {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 700;
    color: var(--white);
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.pie-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    margin-top: 20px;
}

.pie-legend span {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--secondary);
}

.pie-legend i {
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

/* ============================================
   ACTIVITY LIST
   ============================================ */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    background: var(--light);
    border-radius: var(--border-radius);
    transition: var(--transition);
    border: 1px solid transparent;
}

.activity-item:hover {
    border-color: var(--light-border);
    background: var(--white);
}

.activity-icon {
    width: 36px;
    height: 36px;
    background: var(--white);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--primary);
    flex-shrink: 0;
    box-shadow: var(--shadow);
}

.activity-details p {
    font-size: 14px;
    color: var(--dark);
    margin-bottom: 2px;
}

.activity-time {
    font-size: 12px;
    color: var(--secondary);
}

/* ============================================
   LOCATION GROUP (Geocodificación)
   ============================================ */
.location-group {
    border: 1px solid var(--light-border);
    border-radius: var(--border-radius);
    padding: 16px;
    background: #fafbff;
}

.location-group > label,
.location-group-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.location-pin-icon {
    width: 18px;
    height: 18px;
    color: var(--primary);
    flex-shrink: 0;
}

.geo-hint {
    text-align: center;
    margin-top: 8px;
    color: var(--secondary);
    font-size: 12px;
}

.mapa-preview {
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid var(--light-border);
}

.mapa-preview iframe,
.leaflet-map-box {
    width: 100%;
    height: 220px;
    border: 0;
    display: block;
    background: #e8eef5;
}

.leaflet-map-detalle {
    min-height: 280px;
    height: 100%;
    border-radius: 0 0 14px 14px;
}

.geo-status {
    text-align: left;
    margin: 8px 0;
    min-height: 1.2em;
}

.geo-status .geo-ok { color: #166534; }
.geo-status .geo-err { color: #b91c1c; }
.geo-status .geo-wait { color: var(--color-primary); }

.mapa-preview .form-hint {
    display: block;
    padding: 6px 12px;
    background: var(--light);
    font-size: 12px;
    color: var(--secondary);
}

.mapa-preview.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Identificación / código campamento */
.camp-identificacion {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 4px;
}

.camp-identificacion-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.camp-identificacion-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
    margin: 0;
}

.camp-codigo-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 110px;
    padding: 8px 16px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.5px;
    border-radius: 8px;
    font-variant-numeric: tabular-nums;
}

.camp-codigo-nota {
    margin: 0;
    padding: 8px 12px;
    background: var(--surface-muted);
    border-radius: 6px;
    font-size: 12px;
    color: var(--secondary);
    align-self: flex-end;
    max-width: 280px;
}

.campamento-codigo-row {
    padding: 0 16px 4px;
}

.camp-card-codigo {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    background: rgba(var(--color-primario-rgb), 0.1);
    padding: 2px 8px;
    border-radius: 4px;
}

.form-row.form-row-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.form-row.form-row-3 .form-group {
    margin: 0;
}

/* Más específico que .modal-content (max-width: 520px) para que no quede cortado */
.modal-content.modal-content-lg {
    max-width: 860px;
    width: 96%;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

.modal-content.modal-content-lg .modal-header {
    flex-shrink: 0;
}

.modal-content.modal-content-lg .modal-form {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-content.modal-content-lg .modal-form-scroll {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1 1 auto;
}

.modal-content.modal-content-lg .modal-actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    flex-shrink: 0;
    margin: 0 -24px -24px;
    padding: 14px 24px 20px;
    background: var(--white);
    border-top: 1px solid var(--light-border);
    box-shadow: 0 -6px 16px -8px rgba(15, 23, 42, 0.12);
}

.modal-content.modal-content-lg .leaflet-map-box {
    height: 220px;
}

.form-section.personal-apoyo-crear,
.form-section.personal-apoyo-editar {
    margin-top: 8px;
    padding: 14px;
    border: 1px solid var(--light-border, #e2e8f0);
    border-radius: 8px;
    background: var(--primary-tint, #f0f7f5);
}

.form-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.form-section-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark, #1e293b);
}

.personal-apoyo-lista {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

.personal-apoyo-fila {
    padding: 12px;
    border: 1px solid var(--light-border, #dbe4ee);
    border-radius: 8px;
    background: var(--white, #fff);
}

.personal-apoyo-fila-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.9rem;
}

.personal-apoyo-fila .form-row {
    margin-bottom: 0;
}

.personal-apoyo-vacio {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .personal-apoyo-fila .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .modal-content.modal-content-lg {
        max-width: 100%;
        width: 100%;
        max-height: 92vh;
        border-radius: 12px 12px 0 0;
    }

    .modal-content.modal-content-lg .modal-form {
        padding: 14px 16px 0;
        gap: 12px;
    }

    .modal-content.modal-content-lg .modal-actions {
        margin: 0;
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    }

    .modal-content.modal-content-lg .leaflet-map-box {
        height: 180px;
    }
}

.modal-actions-center {
    justify-content: center;
}

@media (max-width: 640px) {
    .form-row.form-row-3 {
        grid-template-columns: 1fr;
    }
    .camp-identificacion-row {
        flex-direction: column;
        align-items: flex-start;
    }
    .camp-codigo-nota {
        align-self: stretch;
        max-width: none;
    }
}

/* ============================================
   SUB-TABS (Distribución)
   ============================================ */
.tabs-secondary {
    background: transparent;
    box-shadow: none;
    padding: 0;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--light-border);
    border-radius: 0;
}

.tabs-secondary .tab {
    border-radius: 8px 8px 0 0;
    border-bottom: 3px solid transparent;
    padding: 10px 20px;
}

.tabs-secondary .tab:hover {
    background: var(--light);
}

.tabs-secondary .tab.active {
    background: transparent;
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.subtab-content {
    display: none;
}

.subtab-content.active {
    display: block;
}

.header-actions-inline {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.td-items {
    font-size: 13px;
    max-width: 280px;
}

.td-items em {
    color: var(--secondary);
}

/* ============================================
   BENEFICIARIOS DE COMIDA
   ============================================ */
.td-beneficiarios {
    max-width: 300px;
}

.beneficiario-tag {
    display: inline-block;
    padding: 3px 10px;
    background: var(--primary-tint);
    color: var(--primary-dark);
    border: 1px solid var(--primary-light);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin: 2px;
    cursor: pointer;
    transition: var(--transition);
}

.beneficiario-tag:hover {
    background: var(--primary);
    color: var(--white);
}

.beneficiarios-selector {
    border: 1px solid var(--light-border);
    border-radius: var(--border-radius);
    padding: 12px;
    background: #fafbff;
}

.checkbox-todos {
    font-weight: 600;
    padding: 8px 12px;
    background: var(--white);
    border-radius: 6px;
    border: 1px solid var(--light-border);
    margin-bottom: 8px;
}

.beneficiarios-lista {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
    background: var(--white);
    border-radius: 6px;
    border: 1px solid var(--light-border);
}

.beneficiario-check {
    font-size: 13px;
    padding: 6px 8px;
    border-radius: 4px;
}

.beneficiario-check:hover {
    background: var(--surface-muted);
}

/* ============================================
   COMIDAS RECIBIDAS (Modal persona)
   ============================================ */
.comidas-seccion {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--light-border);
}

.comidas-persona-lista {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
}

.comida-persona-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--light);
    border: 1px solid var(--light-border);
    border-radius: var(--border-radius);
}

.comida-persona-item.pendiente {
    background: var(--warning-bg);
    border-color: #fde68a;
}

.comida-persona-icon {
    font-size: 22px;
    width: 40px;
    height: 40px;
    background: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: var(--shadow);
}

.comida-persona-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.comida-persona-info strong {
    font-size: 14px;
    color: var(--dark);
}

.comida-persona-info span {
    font-size: 12px;
    color: var(--secondary);
}

@media (max-width: 640px) {
    .beneficiarios-lista {
        grid-template-columns: 1fr;
    }

    .td-beneficiarios {
        max-width: none;
    }
}

/* ============================================
   EDAD AUTO-CALCULADA
   ============================================ */
.edad-auto {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 16px;
    background: linear-gradient(135deg, var(--primary-tint), #dbeafe);
    color: var(--primary-dark);
    border: 1px solid var(--primary-light);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    line-height: 1.4;
}

.form-group:has(.edad-auto) {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.form-group:has(.edad-auto) label {
    width: 100%;
    flex: 0 0 100%;
}

.form-group:has(.edad-auto) input[type="date"] {
    width: auto;
    min-width: 160px;
    flex: none;
    align-self: center;
}

/* ============================================
   LISTA DE FAMILIARES (registro)
   ============================================ */
.familiares-lista {
    background: var(--light);
    border: 1px solid var(--light-border);
    border-radius: var(--border-radius);
    padding: 10px;
    margin-bottom: 10px;
    max-height: 200px;
    overflow-y: auto;
}

.familiar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--white);
    border: 1px solid var(--light-border);
    border-radius: 6px;
    margin-bottom: 6px;
}

.familiar-item:last-child {
    margin-bottom: 0;
}

.familiar-item span:nth-child(2) {
    flex: 1;
    font-size: 14px;
}

#btnAgregarFamiliar {
    margin-top: 4px;
}

#grupoFamiliares {
    border: 1px solid var(--light-border);
    border-radius: var(--border-radius);
    padding: 14px;
    background: #fafbff;
}

#grupoFamiliares > label:first-child {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 10px;
}

/* ============================================
   VIVIENDA PERDIDA
   ============================================ */
.vivienda-box {
    background: var(--danger-bg);
    border: 1px solid #fecaca;
    border-radius: var(--border-radius);
    padding: 16px;
}

.vivienda-box label {
    font-size: 13px;
    font-weight: 500;
    color: var(--dark);
}

#grupoVivienda > label:first-child {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
}

.vivienda-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 12px;
    background: var(--danger-bg);
    border: 1px solid #fecaca;
    border-radius: var(--border-radius);
}

.vivienda-info-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.vivienda-info-item strong {
    font-size: 14px;
    color: var(--dark);
}

@media (max-width: 640px) {
    .vivienda-info {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   ASIGNAR PERSONA A CENTRO
   ============================================ */
.asignar-lista {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 360px;
    overflow-y: auto;
    margin: 12px 0;
}

.asignar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--light);
    border: 1px solid var(--light-border);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.asignar-item:hover {
    background: var(--primary-tint);
    border-color: var(--primary-light);
}

.asignar-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.asignar-item-info strong {
    font-size: 14px;
    color: var(--dark);
}

.asignar-item-info span {
    font-size: 12px;
    color: var(--secondary);
}

.asignar-item .btn {
    flex-shrink: 0;
}

.asignar-item-destacado {
    background: #fefce8 !important;
    border-color: #facc15 !important;
}

.asignar-item-destacado:hover {
    background: #fef9c3 !important;
}

/* ============================================
   CONSUMO DE ITEMS
   ============================================ */
.usado-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 12px;
    background: #fef3c7;
    color: var(--warning-text);
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
}

.usado-cero {
    color: var(--secondary);
    font-size: 13px;
}

.consumo-lista {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 240px;
    overflow-y: auto;
    margin-bottom: 12px;
}

.consumo-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--light);
    border: 1px solid var(--light-border);
    border-radius: 6px;
    font-size: 14px;
}

.consumo-item strong {
    color: var(--dark);
    font-weight: 700;
    margin-left: 12px;
    white-space: nowrap;
}

/* ============================================
   SECTION CARD (reemplaza tabs)
   ============================================ */
.section-card {
    display: block;
    margin-bottom: 24px;
}

.section-card > .filters-bar {
    margin-bottom: 16px;
}

.section-card::before {
    content: '';
    display: block;
    height: 2px;
    background: linear-gradient(to right, transparent, var(--primary-light), transparent);
    margin-bottom: 24px;
    opacity: 0.3;
}

.section-card:first-of-type::before {
    display: none;
}

#btnGeocodificar {
    margin-top: 8px;
}

.coords-success {
    background: #dcfce7;
    color: #166534;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.coords-error {
    background: #fee2e2;
    color: var(--danger-text);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-top: 8px;
}
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: modalOverlayIn 0.2s ease;
}

.modal.active {
    display: flex;
}

/* Bloqueo de scroll del fondo mientras hay modal(es) abiertos */
body.modal-open {
    overflow: hidden;
}

@keyframes modalOverlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    animation: modalContentIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalContentIn {
    from {
        opacity: 0;
        transform: translateY(-16px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-content {
    background: var(--white);
    border-radius: 10px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.2s ease;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}

.modal-content.modal-lg {
    max-width: 720px;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--light-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 17px;
    font-weight: 600;
    color: var(--dark);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--light);
    border-radius: 6px;
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--secondary);
}

.modal-close:hover {
    background: var(--light-border);
    color: var(--dark);
}

.modal-form {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-body {
    padding: 24px;
}

.modal-body > p {
    color: var(--secondary);
    font-size: 14px;
    margin-bottom: 16px;
}

.modal-body .form-group {
    margin-bottom: 16px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 16px 24px 24px;
    border-top: 1px solid var(--light-border);
}

.permissions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.permission-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
}

.permission-item input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Modal Roles: permisos legibles (scoped, no afecta otros modales) */
#rolModal .permissions-select-all {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--light-border);
    font-weight: 600;
    cursor: pointer;
}

#rolModal .permissions-select-all input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

#rolModal .permissions-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 20px;
}

#rolModal .permission-item {
    align-items: flex-start;
    min-width: 0;
    overflow: visible;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.35;
    text-overflow: unset;
}

#rolModal .permission-item input {
    flex-shrink: 0;
    margin-top: 2px;
}

@media (max-width: 640px) {
    #rolModal .permissions-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    display: flex;
    gap: 8px;
    justify-content: center;
    padding: 20px;
}

.pagination .btn {
    min-width: 40px;
}

/* ============================================
   RESPONSIVE - Adaptable a cualquier pantalla
   ============================================ */

/* --- Pantallas muy grandes (1440px+) --- */
@media (min-width: 1440px) {
    .main-content {
        padding: 30px 40px;
    }

    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .stats-grid-small {
        grid-template-columns: repeat(6, 1fr);
    }

    .campamentos-grid,
    .roles-grid {
        grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    }
}

/* --- Laptops grandes (1281px - 1440px) --- */
@media (min-width: 1281px) and (max-width: 1440px) {
    .stats-grid-small {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* --- Laptops / tablets horizontal (1025px - 1280px) --- */
@media (min-width: 1025px) and (max-width: 1280px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-grid-small {
        grid-template-columns: repeat(3, 1fr);
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Tablets horizontal (901px - 1024px) --- */
@media (min-width: 901px) and (max-width: 1024px) {
    :root {
        --sidebar-width: 220px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-grid-small {
        grid-template-columns: repeat(3, 1fr);
    }

    .campamentos-grid,
    .roles-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .report-types {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* --- Tablets vertical (769px - 900px) --- */
@media (min-width: 769px) and (max-width: 900px) {
    :root {
        --sidebar-width: 210px;
    }

    .sidebar-header h2 {
        font-size: 16px;
    }

    .sidebar-nav a {
        padding: 10px 16px;
        font-size: 14px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-grid-small {
        grid-template-columns: repeat(2, 1fr);
    }

    .campamentos-grid,
    .roles-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .report-types {
        grid-template-columns: repeat(2, 1fr);
    }

    .header-title h1 {
        font-size: 20px;
    }
}

/* --- Tablets pequeñas / móviles grandes (641px - 768px) --- */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        box-shadow: none;
    }

    .sidebar.active {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0,0,0,0.3);
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }

    .main-content {
        margin-left: 0;
        padding: 16px;
    }

    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
    }

    .header {
        flex-wrap: wrap;
        gap: 12px;
        padding: 14px 16px;
    }

    .header-title {
        flex: 1;
        min-width: 0;
    }

    .header-title h1 {
        font-size: 20px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .header-title p {
        font-size: 13px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .header-actions {
        margin-left: 0;
        width: 100%;
        display: flex;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 8px;
    }

    .header-actions .btn {
        min-height: 44px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stats-grid-small {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
        gap: 10px;
    }

    .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 22px;
    }

    .stat-number {
        font-size: 22px;
    }

    .campamentos-grid,
    .roles-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .report-types {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .filters-bar {
        flex-direction: column;
        gap: 12px;
        padding: 14px;
    }

    .search-box {
        min-width: 100%;
    }

    .filter-group {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .filter-select,
    .filter-date {
        min-width: 0;
        width: 100%;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .login-container {
        flex-direction: column;
        max-width: 440px;
    }

    .login-info {
        display: none;
    }

    .permissions-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Tablas convertidas en tarjetas */
    .data-table thead {
        display: none;
    }

    .data-table,
    .data-table tbody,
    .data-table tr,
    .data-table td {
        display: block;
        width: 100%;
    }

    .data-table tr {
        background: var(--white);
        border: 1px solid var(--light-border);
        border-radius: var(--border-radius);
        margin-bottom: 12px;
        padding: 12px;
        box-shadow: var(--shadow);
    }

    .data-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 4px;
        border-bottom: 1px solid var(--surface-muted);
        font-size: 14px;
        text-align: right;
        gap: 12px;
    }

    .data-table td:last-child {
        border-bottom: none;
    }

    .data-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--secondary);
        font-size: 12px;
        text-transform: uppercase;
        text-align: left;
        flex-shrink: 0;
    }

    .data-table td.actions {
        justify-content: flex-end;
        padding-top: 10px;
    }

    .data-table td.actions::before {
        display: none;
    }

    .data-table td .user-cell {
        flex-direction: row-reverse;
    }

    /* Tabs con scroll horizontal */
    .tabs {
        padding: 4px;
        gap: 4px;
    }

    .tab {
        padding: 10px 16px;
        font-size: 13px;
        flex-shrink: 0;
    }

    /* Cards internas */
    .card-header {
        flex-wrap: wrap;
        gap: 10px;
        padding: 14px 16px;
    }

    .card-header h3 {
        font-size: 15px;
        width: 100%;
    }

    .card-body {
        padding: 14px;
    }

    /* Pagination */
    .pagination {
        flex-wrap: wrap;
        padding: 12px;
    }

    .pagination .btn {
        min-height: 44px;
        flex: 1;
        min-width: 60px;
    }

    /* Orden items */
    .orden-item-row {
        flex-wrap: wrap;
    }

    .orden-item-row .item-select,
    .orden-item-row .item-nombre {
        flex: 1 1 100%;
    }

    .orden-item-row .item-cantidad {
        flex: 1;
        max-width: none;
    }

    /* Modal a pantalla casi completa */
    .modal {
        padding: 10px;
        align-items: flex-end;
    }

    .modal-content {
        max-width: 100%;
        width: 100%;
        max-height: 92vh;
        border-radius: 12px 12px 0 0;
    }

    .modal-content.modal-lg {
        max-width: 100%;
    }
}

/* --- Móviles (481px - 640px) --- */
@media (max-width: 640px) {
    .stats-grid,
    .stats-grid-small {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 12px;
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }

    .stat-info h3 {
        font-size: 12px;
    }

    .stat-number {
        font-size: 20px;
    }

    .stat-change {
        font-size: 11px;
    }

    .report-types {
        grid-template-columns: 1fr;
    }

    .campamento-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .campamento-footer,
    .rol-footer {
        flex-direction: column;
    }

    .campamento-footer .btn,
    .rol-footer .btn {
        width: 100%;
    }

    .filter-group {
        grid-template-columns: 1fr;
    }

    .chart-bars .bar {
        width: 40px;
    }

    .activity-item {
        padding: 12px;
        gap: 10px;
    }
}

/* --- Móviles pequeños (hasta 480px) --- */
@media (max-width: 480px) {
    .main-content {
        padding: 10px;
    }

    .header {
        padding: 12px;
    }

    .header-title h1 {
        font-size: 18px;
    }

    .header-actions .btn {
        font-size: 13px;
        padding: 10px 14px;
    }

    .stats-grid,
    .stats-grid-small {
        grid-template-columns: 1fr;
    }

    .stat-card {
        flex-direction: row;
        text-align: left;
        padding: 14px;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .stat-number {
        font-size: 20px;
    }

    .campamento-stats {
        grid-template-columns: 1fr;
    }

    .permissions-grid {
        grid-template-columns: 1fr;
    }

    .login-card {
        padding: 24px 20px;
    }

    .login-header h1 {
        font-size: 20px;
    }

    .login-logo {
        width: 80px;
        height: 80px;
        font-size: 40px;
    }

    .login-logo .logo-campamento {
        max-width: 80px;
        max-height: 80px;
    }

    .search-box {
        flex-direction: row;
    }

    .btn {
        min-height: 44px;
    }

    .btn-sm {
        min-height: 38px;
    }

    .chart-bars {
        gap: 10px;
    }

    .chart-bars .bar {
        width: 32px;
    }

    .pie-legend {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* --- Móviles muy pequeños (hasta 360px) --- */
@media (max-width: 360px) {
    .header-title h1 {
        font-size: 16px;
    }

    .sidebar {
        width: 100%;
    }

    .stat-card {
        padding: 12px;
    }

    .tabs {
        gap: 2px;
    }

    .tab {
        padding: 8px 12px;
        font-size: 12px;
    }

    .modal-actions {
        flex-direction: column;
    }

    .modal-actions .btn {
        width: 100%;
    }
}

/* --- Pantallas táctiles: áreas de toque más grandes --- */
@media (hover: none) and (pointer: coarse) {
    .btn,
    .btn-icon,
    .tab,
    .sidebar-nav a,
    .menu-toggle {
        min-height: 44px;
    }

    .btn-icon {
        min-width: 44px;
    }

    .sidebar-nav a {
        padding: 14px 20px;
    }

    input[type="checkbox"] {
        width: 22px;
        height: 22px;
    }
}

/* --- Modo horizontal en móviles (altura reducida) --- */
@media (max-height: 500px) and (orientation: landscape) {
    .sidebar {
        width: 220px;
    }

    .sidebar-nav a {
        padding: 8px 16px;
    }

    .sidebar-header,
    .sidebar-footer {
        padding: 10px 16px;
    }

    .modal-content {
        max-height: 96vh;
    }

    .login-page {
        padding: 10px;
        align-items: flex-start;
    }
}

/* --- Impresión --- */
@media print {
    .sidebar,
    .menu-toggle,
    .header-actions,
    .filters-bar,
    .pagination,
    .btn,
    .actions {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
        padding: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .data-table thead {
        display: table-header-group;
    }

    .data-table,
    .data-table tbody,
    .data-table tr,
    .data-table td {
        display: table-row;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--surface-muted);
}

::-webkit-scrollbar-thumb {
    background: var(--border-muted);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   TABS
   ============================================ */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    background: var(--white);
    padding: 6px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.tab {
    padding: 10px 20px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    color: var(--secondary);
    white-space: nowrap;
}

.tab:hover {
    background: var(--color-primary-tint-soft2);
    color: var(--primary);
}

.tab.active {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(var(--color-primario-rgb), 0.25);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: tabFadeIn 0.3s ease;
}

@keyframes tabFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   ORDER ITEMS LIST
   ============================================ */
.orden-items-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    background: var(--light);
    border-radius: var(--border-radius);
    border: 1px solid var(--light-border);
}

.orden-item-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.orden-item-row .item-select {
    flex: 2;
    padding: 8px 12px;
    border: 2px solid var(--light-border);
    border-radius: 6px;
    font-size: 14px;
}

.orden-item-row .item-nombre {
    flex: 3;
    padding: 8px 12px;
    border: 2px solid var(--light-border);
    border-radius: 6px;
    font-size: 14px;
}

.orden-item-row .item-cantidad {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid var(--light-border);
    border-radius: 6px;
    font-size: 14px;
    max-width: 120px;
}

.orden-item-row .item-unidad {
    font-size: 13px;
    color: var(--secondary);
    font-weight: 600;
    min-width: 24px;
}

.orden-item-row .remove-item {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--secondary);
    font-size: 14px;
    display: none;
}

/* ============================================
   TEXT COLORS
   ============================================ */
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-success { color: var(--success); }

/* ============================================
   BADGE COLORS EXTRA
   ============================================ */


/* ============================================
   INFO DEL CENTRO + MAPA
   ============================================ */
.campamento-info-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 20px;
    margin-bottom: 20px;
}

.info-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--surface-muted);
    gap: 12px;
}

.info-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.info-label {
    font-size: 13px;
    color: var(--secondary);
}

.info-item strong {
    font-size: 14px;
    color: var(--dark);
    text-align: right;
}

.map-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.map-card .card-header {
    flex-shrink: 0;
}

.map-card .card-body,
.map-card .map-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0 !important;
    position: relative;
}

.map-body iframe,
.map-body .leaflet-map-box {
    flex: 1 1 auto;
    width: 100%;
    height: 100% !important;
    min-height: 280px;
    border: 0;
    display: block;
    border-radius: 0 0 14px 14px;
}

.mapa-preview iframe,
.mapa-preview .leaflet-map-box {
    width: 100%;
    height: 240px;
    border: 0;
    display: block;
}

/* ============================================
   MODAL DETALLE DE PERSONA
   ============================================ */
.persona-detalle {
    padding: 20px;
}

.persona-perfil {
    text-align: center;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--light-border);
    margin-bottom: 20px;
}

.persona-avatar-grande {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    margin: 0 auto 12px;
}

.persona-perfil h3 {
    font-size: 20px;
    color: var(--dark);
    margin-bottom: 8px;
}

.badge-jefe {
    font-size: 13px;
    padding: 6px 14px;
}

.persona-documento {
    color: var(--secondary);
    font-size: 14px;
    margin-top: 8px;
}

.persona-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}

.persona-info-item {
    background: var(--light);
    padding: 12px;
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.persona-info-item strong {
    font-size: 14px;
    color: var(--dark);
}

/* ============================================
   LISTA DE FAMILIA
   ============================================ */
.familia-seccion h4 {
    font-size: 15px;
    color: var(--dark);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.familia-lista {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 260px;
    overflow-y: auto;
}

.familia-miembro {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--light);
    border-radius: var(--border-radius);
    border: 1px solid var(--light-border);
    cursor: pointer;
    transition: var(--transition);
}

.familia-miembro:hover {
    background: #eef2ff;
    border-color: var(--primary-light);
}

.familia-miembro.jefe {
    background: var(--primary-tint);
    border-color: var(--primary-light);
}

.familia-miembro-avatar {
    width: 42px;
    height: 42px;
    background: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: var(--shadow);
}

.familia-miembro-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.familia-miembro-info strong {
    font-size: 14px;
    color: var(--dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.familia-miembro-info span {
    font-size: 12px;
    color: var(--secondary);
}

.familia-subtitulo {
    font-size: 13px;
    color: var(--secondary);
    margin: 12px 0 4px;
    font-weight: 600;
}

.familia-vacia {
    text-align: center;
    color: var(--secondary);
    font-size: 14px;
    padding: 20px;
    background: var(--light);
    border-radius: var(--border-radius);
}

/* ============================================
   WIZARD - Agregar Nueva Familia
   ============================================ */
.wizard-modal {
    background: rgba(0,0,0,0.5);
}

.modal-wizard {
    width: 98%;
    max-width: 1400px;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    overflow: hidden;
}

.wizard-header {
    background: var(--primary);
    color: var(--white);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.wizard-header h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
}

.wizard-close {
    background: none;
    border: none;
    color: var(--white);
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.wizard-close:hover {
    background: rgba(255,255,255,0.2);
}

.wizard-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: #f5f7fa;
}

.wizard-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-top: 1px solid var(--light-border);
    background: var(--white);
    flex-shrink: 0;
}

.wizard-dots {
    display: flex;
    gap: 8px;
    align-items: center;
}

.wizard-dots .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-muted);
    transition: var(--transition);
    cursor: default;
}

.wizard-dots .dot.active {
    background: var(--primary);
}

.wizard-nav {
    display: flex;
    gap: 12px;
}

/* Steps */
.wizard-step {
    display: none;
    animation: stepFade 0.3s ease;
}

.wizard-step.active {
    display: block;
}

@keyframes stepFade {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.wizard-step h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 20px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-light);
}

.wizard-step h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 12px;
    margin-top: 20px;
}

/* Formación INCES: UC múltiple + perfiles */
.uc-inces-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
    min-height: 0;
}
.uc-inces-search-wrap {
    position: relative;
}
.uc-inces-dropdown {
    position: absolute;
    z-index: 40;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    max-height: 240px;
    overflow: auto;
    background: var(--white, #fff);
    border: 1px solid var(--border, #d0d5dd);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}
.uc-inces-option {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    padding: 10px 12px;
    font-size: 13px;
    color: var(--dark, #1e293b);
    cursor: pointer;
}
.uc-inces-option:hover {
    background: var(--surface-muted, #f1f5f9);
}
.uc-inces-option.muted {
    cursor: default;
    color: var(--text-muted, #64748b);
}
.uc-inces-perfiles {
    padding: 10px 12px;
    border: 1px solid var(--border, #d0d5dd);
    border-radius: 8px;
    background: var(--bg-secondary, #f8fafc);
    font-size: 13px;
    color: var(--dark, #1e293b);
}
.uc-inces-perfil-list {
    margin: 0;
    padding-left: 18px;
}
.uc-inces-perfil-list li {
    margin: 4px 0;
}

/* Fields grid */
.step-fields {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px 24px;
    margin-bottom: 20px;
    align-items: start;
}

.step-fields-2col {
    grid-template-columns: repeat(2, 1fr);
    align-items: start;
}

.step-fields-3col {
    grid-template-columns: repeat(3, 1fr);
    align-items: start;
}

.step-fields-4col {
    grid-template-columns: repeat(4, 1fr);
    align-items: start;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    min-height: 72px;
    justify-content: flex-start;
}

.field-group.full-width {
    grid-column: 1 / -1;
    min-height: 0;
}

/* Checkbox alignment */
.field-group .checkbox-label {
    padding: 10px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--dark);
}

.field-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--dark);
    line-height: 1.3;
}

.field-input, .field-select, .field-textarea {
    padding: 10px 14px;
    border: 1.5px solid var(--light-border);
    border-radius: var(--border-radius);
    font-size: 14px;
    font-family: var(--font-family);
    background: var(--white);
    color: var(--dark);
    transition: var(--transition);
    width: 100%;
}

.field-input:focus, .field-select:focus, .field-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--color-primario-rgb), 0.1);
}

.field-input:disabled, .field-select:disabled {
    background: var(--surface-muted);
    color: var(--text-muted);
    cursor: not-allowed;
}

.field-textarea {
    resize: vertical;
    min-height: 80px;
}

/* Toggle switch */
.toggle-field {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 4px 0;
    flex-wrap: wrap;
    min-height: 52px;
    flex: 1;
    align-content: flex-start;
}

.toggle-label-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--dark);
    flex: 0 0 100%;
    line-height: 1.3;
    margin-bottom: 4px;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    margin-top: 2px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--light-border);
    border-radius: 24px;
    transition: 0.3s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.toggle-detail {
    flex: 1;
    min-width: 180px;
    padding: 8px 12px;
    border: 1.5px solid var(--light-border);
    border-radius: var(--border-radius);
    font-size: 13px;
    font-family: var(--font-family);
    background: var(--white);
}

.toggle-detail:disabled {
    background: var(--surface-muted);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* Nucleus family panel */
.nucleus-panel {
    background: #eef2f7;
    border-radius: 10px;
    padding: 16px;
    margin-top: 16px;
}

.nucleus-panel h4 {
    margin-top: 0;
    margin-bottom: 12px;
    color: var(--primary);
    font-size: 14px;
    font-weight: 700;
}

.nucleus-list {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nucleus-item {
    display: grid;
    grid-template-columns: 2fr 1.2fr 1fr 1.2fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--white);
    border-radius: var(--border-radius);
    font-size: 13px;
    border: 1px solid var(--light-border);
}

.nucleus-item.nucleus-header {
    background: var(--surface-muted);
    border-color: var(--border-muted);
    padding: 8px 14px;
}

.nucleus-item.nucleus-header .nucleus-cell {
    font-weight: 700;
    color: var(--secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nucleus-cell {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nucleus-cell-name {
    font-weight: 600;
    color: var(--dark);
}

.nucleus-cell-fecha,
.nucleus-cell-rol,
.nucleus-cell-doc {
    color: var(--secondary);
    font-size: 12px;
}

.nucleus-remove {
    background: none;
    border: none;
    color: var(--danger-bright);
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: var(--transition);
}

.nucleus-remove:hover {
    background: #fee2e2;
}

/* Map preview in wizard */
.wizard-map-preview {
    margin-top: 10px;
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid var(--light-border);
}

.wizard-map-preview iframe {
    width: 100%;
    height: 200px;
    border: none;
    display: block;
}

/* Checkbox grid for alerts/requirements */
.check-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0 32px;
}

.check-grid .toggle-field {
    padding: 8px 0;
    align-items: flex-start;
}

.check-grid .toggle-label-text {
    flex: 0 0 100%;
    margin-bottom: 8px;
}

/* Responsive wizard */
@media (max-width: 768px) {
    .modal-wizard {
        width: 98%;
        max-height: 96vh;
    }
    .step-fields, .step-fields-2col, .step-fields-3col, .step-fields-4col {
        grid-template-columns: 1fr;
    }
    .check-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }
    .toggle-field {
        flex-wrap: wrap;
    }
    .toggle-detail {
        min-width: 100%;
        margin-top: 8px;
    }
    .wizard-footer {
        flex-direction: column;
        gap: 12px;
    }
    .wizard-dots {
        order: -1;
    }
}

/* Checkbox jefe de familia en formulario */
.checkbox-jefe {
    padding: 12px;
    background: var(--primary-tint);
    border: 1px solid var(--primary-light);
    border-radius: var(--border-radius);
    font-weight: 600;
    color: var(--dark);
}

.form-hint {
    font-size: 12px;
    color: var(--secondary);
    margin-top: 4px;
}

/* ============================================
   COMEDOR - Control de cola
   ============================================ */
.comedor-card {
    max-width: 760px;
    margin: 0 auto 20px;
    box-shadow: var(--shadow-lg);
}

.comedor-asignacion-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin-bottom: 18px;
    padding: 12px 14px;
    background: var(--color-primario-tint-soft, #eef6f4);
    border: 1px solid var(--color-primary-border, #b7d4cc);
    border-radius: 8px;
}

.comedor-asignacion-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--dark, #1a1a1a);
    white-space: nowrap;
}

.comedor-asignacion-bar .selectCampamentoComedor {
    flex: 1 1 220px;
    min-width: 180px;
    max-width: 100%;
}

.comedor-camp-nombre-fijo {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary, #0d6b5c);
}

.comedor-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.comedor-form-row {
    align-items: flex-start;
    gap: 24px;
}

.comedor-form-row .form-group {
    flex: 1;
}

.comedor-info-persona {
    padding: 12px 16px;
    background: var(--color-primario-tint-soft);
    border: 1px solid var(--color-primary-border);
    border-radius: 8px;
    color: var(--dark);
    font-size: 14px;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.radio-group-inline {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 16px;
}

.radio-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
    color: var(--dark);
}

.radio-label input[type="radio"],
.radio-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.radio-label.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.radio-label.is-disabled input {
    cursor: not-allowed;
}

.comedor-aviso-duplicado {
    margin: 8px 0 0;
    font-size: 13px;
    color: #b45309;
    line-height: 1.35;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* Responsive para nuevas secciones */
@media (max-width: 1024px) {
    .campamento-info-grid {
        grid-template-columns: 1fr;
    }

    .persona-info-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .persona-info-grid {
        grid-template-columns: 1fr;
    }

    .map-body iframe,
    .map-body .leaflet-map-box {
        min-height: 240px;
        height: 100% !important;
    }

    .familia-miembro .badge {
        display: none;
    }
}

/* ============================================
   INCIDENCIAS
   ============================================ */
.module-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.module-selector select {
    padding: 8px 12px;
    border: 1.5px solid var(--light-border);
    border-radius: 8px;
    background: var(--white);
    color: var(--dark);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    min-width: 200px;
}

.module-selector select:focus {
    border-color: var(--primary);
    outline: none;
}

.incidencia-form .form-group-inline {
    display: flex;
    flex-direction: column;
}

.input-with-btn {
    display: flex;
    gap: 8px;
    align-items: center;
}

.input-with-btn select,
.input-with-btn input {
    flex: 1;
}

.input-with-btn .btn {
    flex-shrink: 0;
}

.incidencias-stats .stat-card {
    background: var(--white);
    border: 1px solid var(--light-border);
    box-shadow: var(--shadow);
}

.incidencia-card .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: transparent;
}

.incidencia-card .stat-icon svg {
    width: 26px;
    height: 26px;
}

.incidencia-card-total .stat-icon {
    background: var(--primary-tint);
    color: var(--primary);
}

.incidencia-card-actividades .stat-icon {
    background: #e0e7ff;
    color: #4f46e5;
}

.incidencia-card-medicos .stat-icon {
    background: #fce7f3;
    color: #db2777;
}

.incidencia-card-estatus .stat-icon {
    background: #dcfce7;
    color: #16a34a;
}

.stat-text-success {
    color: #16a34a;
    font-size: 15px;
    font-weight: 600;
}

.form-actions-right {
    display: flex;
    justify-content: flex-end;
    padding-top: 8px;
}

@media (max-width: 768px) {
    .module-selector {
        width: 100%;
    }

    .module-selector select {
        flex: 1;
        min-width: auto;
    }

    .input-with-btn {
        flex-wrap: wrap;
    }

    .input-with-btn .btn {
        width: 100%;
    }
}

.incidencia-section {
    display: none;
}

.incidencia-section.active {
    display: block;
    animation: cardFade 0.4s ease;
}

.header-actions-inline {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.header-actions-inline .filter-select,
.header-actions-inline .filter-input {
    min-width: min(220px, 100%);
    flex: 1 1 160px;
}

/* ============================================
   CALENDARIO DE PLANIFICACIÓN
   ============================================ */
.calendar-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.calendar-controls h3 {
    margin: 0;
    font-size: 20px;
    color: var(--dark);
}

.calendar-nav {
    display: flex;
    gap: 10px;
}

.calendar-year {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
}

.calendar-card-body {
    padding: 0;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    text-align: center;
    font-weight: 700;
    font-size: 13px;
    padding: 12px 16px;
    background: var(--dark);
    color: var(--white);
}

.calendar-weekdays .text-danger {
    color: #fca5a5;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    padding: 16px;
    background: var(--light);
}

.calendar-day {
    min-height: 110px;
    background: var(--white);
    border: 1px solid var(--light-border);
    border-radius: var(--border-radius);
    padding: 8px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.calendar-day:hover {
    background: var(--light);
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.calendar-day.other-month {
    background: var(--light);
    color: var(--secondary);
    cursor: default;
}

.calendar-day.other-month:hover {
    border-color: var(--light-border);
    box-shadow: none;
    transform: none;
}

.calendar-day.today {
    border: 2px solid var(--primary);
    background: var(--color-primary-tint-sky);
}

.calendar-day-number {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 4px;
}

.calendar-day-count {
    position: absolute;
    top: 6px;
    right: 6px;
    background: var(--primary);
    color: var(--white);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
}

.calendar-day-event {
    font-size: 10px;
    display: block;
    margin-top: 2px;
    padding: 2px 4px;
    border-radius: 3px;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    font-weight: 500;
}

.calendar-day-more {
    font-size: 10px;
    color: var(--secondary);
    margin-top: auto;
}

/* Modal personalizado */
.planning-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    min-height: 100%;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    padding: max(12px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) max(12px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
}

.planning-modal {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    margin: auto;
    align-self: center;
    animation: cardFade 0.25s ease;
    min-width: 0;
}

.planning-modal-xl {
    max-width: 1100px;
}

.planning-modal-lg {
    max-width: 700px;
}

.planning-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--primary);
    color: var(--white);
    flex-shrink: 0;
}

.planning-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.planning-modal-header svg {
    vertical-align: middle;
    margin-right: 6px;
}

.planning-modal-header .btn-close {
    background: transparent;
    border: none;
    color: var(--white);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    transition: var(--transition);
}

.planning-modal-header .btn-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.planning-modal-body {
    padding: 20px;
    overflow-y: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    min-width: 0;
}

.planning-modal-body .form-actions-right {
    margin-top: 16px;
}

.planning-modal-body .data-table {
    min-width: 800px;
}

@media (max-width: 768px) {
    .calendar-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .calendar-controls h3 {
        text-align: center;
    }

    .calendar-nav {
        justify-content: space-between;
    }

    .calendar-weekdays,
    .calendar-grid {
        gap: 4px;
        padding: 8px;
    }

    .calendar-weekdays {
        font-size: 10px;
        padding: 8px;
    }

    .calendar-day {
        min-height: 70px;
        padding: 4px;
    }

    .calendar-day-number {
        font-size: 11px;
    }

    .calendar-day-event {
        display: none;
    }

    .calendar-day-count {
        top: 2px;
        right: 2px;
        font-size: 9px;
        padding: 1px 4px;
    }

    .planning-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .planning-modal,
    .planning-modal-lg,
    .planning-modal-xl {
        max-width: 100%;
        width: 100%;
        max-height: 92vh;
        border-radius: 12px 12px 0 0;
        margin: 0;
    }

    .planning-modal-header {
        padding: 14px 16px;
    }

    .planning-modal-header h3 {
        font-size: 15px;
        line-height: 1.3;
        padding-right: 8px;
    }

    .planning-modal-body {
        padding: 12px 14px calc(14px + env(safe-area-inset-bottom, 0px));
    }

    /* En móvil las tablas pasan a tarjetas: no forzar min-width */
    .planning-modal-body .data-table {
        min-width: 0;
        width: 100%;
    }
}

/* ============================================
   INVENTARIO DE COCINA
   ============================================ */
.cocina-header {
    gap: 16px;
}

.back-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    flex-shrink: 0;
    transition: var(--transition);
}

.back-arrow:hover {
    background: var(--primary-dark);
    transform: translateX(-2px);
}

.back-arrow svg {
    width: 20px;
    height: 20px;
}

.cocina-title {
    font-size: 22px;
    font-weight: 500;
    color: var(--dark);
    margin: 0;
}

.cocina-section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 12px;
}

.cocina-text {
    font-size: 14px;
    color: var(--secondary);
    line-height: 1.6;
}

.cocina-stats {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
}

.cocina-stats .stat-card {
    flex: 0 1 300px;
    max-width: 320px;
    justify-content: center;
    text-align: center;
    padding: 24px 20px;
}

.cocina-stats .stat-info {
    text-align: center;
}

.cocina-stats .stat-number {
    font-size: 34px;
    font-weight: 700;
    color: var(--primary);
    margin-top: 10px;
}

.cocina-stats .stat-info h3 {
    font-size: 13px;
    font-weight: 500;
    color: var(--secondary);
}

.cocina-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.cocina-filters {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.cocina-filters .filter-select,
.cocina-filters .filter-input {
    min-width: 220px;
}

.cocina-search {
    position: relative;
    min-width: 260px;
}

.cocina-search svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--secondary);
    pointer-events: none;
}

.cocina-search .filter-input {
    width: 100%;
    padding: 10px 12px 10px 40px;
    border-radius: 999px;
    border: 1px solid var(--light-border);
    background: var(--white);
    box-shadow: var(--shadow);
    font-size: 14px;
    transition: var(--transition);
}

.cocina-search .filter-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--color-primario-rgb), 0.12);
}

.cocina-search .filter-input::placeholder {
    color: var(--text-muted);
}

.cocina-form .form-row {
    align-items: flex-end;
}

.cocina-form .form-group-large {
    flex: 2;
    min-width: min(280px, 100%);
}

.form-actions-left {
    display: flex;
    justify-content: flex-start;
    padding-top: 8px;
}

.card-accent {
    border-top: 3px solid var(--primary);
}

.text-primary { color: var(--primary); }
.text-info { color: var(--info); }
.text-muted { color: var(--secondary); }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.cocina-table thead th {
    background: var(--primary);
    color: var(--white);
    border-bottom: none;
    font-weight: 600;
}

.cocina-table tbody tr:hover {
    background: var(--light);
}

.cocina-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cocina-list li {
    padding: 12px 16px;
    border-bottom: 1px solid var(--light-border);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 14px;
}

.cocina-list li:last-child {
    border-bottom: none;
}

.cocina-list .badge {
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .cocina-card-header {
        flex-direction: column;
        align-items: stretch;
    }

    .cocina-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .cocina-filters .filter-select,
    .cocina-filters .filter-input {
        min-width: auto;
        width: 100%;
    }
}

/* ============================================
   SIDEBAR SUBMENÚS
   ============================================ */
.sidebar-nav .has-submenu > .menu-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    margin: 2px 0;
    border-left: 3px solid transparent;
    transition: var(--transition);
}

.sidebar-nav .has-submenu.active > .menu-row {
    background: var(--sidebar-active);
    border-left-color: var(--white);
}

.sidebar-nav .has-submenu > .menu-row:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-nav .has-submenu > .menu-row:hover .menu-link,
.sidebar-nav .has-submenu > .menu-row:hover .submenu-toggle {
    color: var(--white);
}

.menu-link {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
}

.sidebar-nav .has-submenu.active > .menu-row .menu-link,
.sidebar-nav .has-submenu.active > .menu-row .submenu-toggle {
    color: var(--white);
}

.sidebar-nav .has-submenu.active > .menu-row .menu-link {
    font-weight: 600;
}

.submenu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
    padding: 0;
    margin-right: 16px;
}

.submenu-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--white);
    border-radius: 6px;
}

.submenu-toggle svg {
    width: 14px;
    height: 14px;
    transition: var(--transition);
}

.has-submenu.open .submenu-toggle svg,
html.campamentos-inv-open .has-submenu .submenu-toggle svg {
    transform: rotate(180deg);
}

.sidebar-nav .submenu,
html.campamentos-inv-open .has-submenu .submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    margin: 4px 8px;
}

.sidebar-nav .has-submenu.open .submenu,
html.campamentos-inv-open .has-submenu .submenu {
    max-height: 600px;
}

.submenu-group {
    padding: 8px 0;
}

.submenu-group + .submenu-group {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.submenu-title {
    display: block;
    padding: 6px 16px 4px 44px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 4px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.submenu-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.submenu-list li a {
    display: flex;
    align-items: center;
    padding: 7px 12px 7px 52px;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
    margin: 0 8px;
}

.submenu-list li a::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    margin-right: 10px;
    flex-shrink: 0;
}

.submenu-list li a:hover,
.submenu-list li.active a {
    background: rgba(255, 255, 255, 0.12);
    color: var(--white);
}

.submenu-list li.active a::before,
.submenu-list li a:hover::before {
    background: var(--primary);
}

.sidebar.collapsed .submenu {
    display: none;
}

/* ==================== INVENTARIO PORTAL ==================== */
.inventario-portal-header {
    justify-content: space-between;
}

.inventario-portal-header .header-title h1 {
    font-size: 28px;
    font-weight: 700;
}

.inventario-portal-header .header-title p {
    color: var(--secondary);
    font-size: 14px;
}

.portal-search-card {
    margin-bottom: 24px;
    padding: 16px;
}

.portal-search {
    display: flex;
    align-items: center;
    gap: 10px;
}

.portal-search-input {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--text);
    background: #fff;
    outline: none;
    transition: var(--transition);
}

.portal-search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 188, 212, 0.12);
}

.portal-search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.portal-search-btn svg {
    width: 18px;
    height: 18px;
}

.portal-filter-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
}

.portal-filter-btn svg {
    width: 16px;
    height: 16px;
}

.portal-cards {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 24px;
}

.portal-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 280px;
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text);
    overflow: hidden;
    transition: var(--transition);
}

.portal-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}

.portal-card-title {
    padding: 24px 20px 12px;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
}

.portal-card-icon {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
}

.portal-card-icon svg {
    width: 64px;
    height: 64px;
    color: var(--text);
}

.portal-card-footer {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    display: flex;
    justify-content: center;
    transition: var(--transition);
}

.portal-card-access {
    background: #fff;
    color: var(--primary);
    padding: 6px 22px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.portal-card:hover .portal-card-footer {
    background: var(--primary-dark);
}

@media (max-width: 768px) {
    .sidebar-nav .submenu {
        margin: 4px 12px;
    }

    .submenu-list li a {
        padding: 10px 12px 10px 48px;
        font-size: 14px;
    }

    .portal-cards {
        gap: 16px;
    }

    .portal-card {
        width: 100%;
        max-width: 320px;
    }
}

/* ============================================
   RESPONSIVE POLISH (móvil / tablet)
   Breakpoints: 768px (tablet/móvil), 480px (móvil chico)
   ============================================ */
html {
    overflow-x: clip;
}

body {
    overflow-x: clip;
    max-width: 100vw;
}

img,
svg,
video,
iframe,
canvas {
    max-width: 100%;
}

@media (max-width: 768px) {
    .dashboard-page {
        width: 100%;
        max-width: 100vw;
        overflow-x: clip;
    }

    .main-content {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow-x: clip;
    }

    .sidebar {
        max-width: min(280px, 86vw);
        height: 100%;
        height: 100dvh;
        overflow: hidden;
    }

    .sidebar-header h2 {
        max-width: 100%;
        font-size: 11px;
        padding: 0 4px;
    }

    .modal {
        padding: 0;
        align-items: flex-end;
        overflow-x: hidden;
    }

    .modal-content,
    .modal-content.modal-lg,
    .modal-content.modal-content-lg,
    .modal-wizard {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        max-height: 92vh;
        max-height: 92dvh;
        border-radius: 12px 12px 0 0;
    }

    .modal-header {
        padding: 14px 16px;
        gap: 8px;
    }

    .modal-header h2 {
        font-size: 16px;
        line-height: 1.25;
        min-width: 0;
    }

    .modal-form,
    .modal-body {
        padding-left: 16px;
        padding-right: 16px;
    }

    .modal-actions {
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    }

    .modal-actions .btn {
        flex: 1 1 auto;
        min-width: min(140px, 100%);
    }

    .form-row,
    .form-row.form-row-3,
    .comedor-form-row,
    .cocina-form .form-row {
        grid-template-columns: 1fr;
    }

    .comedor-card {
        max-width: 100%;
        margin-bottom: 16px;
    }

    .comedor-form-row {
        gap: 14px;
    }

    .radio-group-inline {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .tabs {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .tab {
        min-height: 44px;
    }

    .header-actions-inline {
        width: 100%;
    }

    .header-actions-inline .filter-select,
    .header-actions-inline .filter-input,
    .header-actions-inline .btn {
        min-width: 0;
        width: 100%;
        flex: 1 1 100%;
    }

    .data-table td.actions {
        gap: 8px;
        flex-wrap: wrap;
    }

    .data-table td.actions .btn,
    .data-table td.actions .btn-icon {
        min-height: 40px;
        min-width: 40px;
    }

    .login-page {
        padding: 16px;
        align-items: center;
    }

    .login-container {
        width: 100%;
        max-width: 440px;
        margin: 0 auto;
    }

    .login-card {
        padding: 28px 20px;
    }

    .wizard-header {
        padding: 14px 16px;
    }

    .wizard-header h2 {
        font-size: 16px;
    }

    .wizard-body {
        padding: 14px 16px;
    }

    .wizard-nav {
        width: 100%;
        display: flex;
        gap: 8px;
    }

    .wizard-nav .btn {
        flex: 1;
        min-height: 44px;
    }

    #rolModal .permissions-grid {
        grid-template-columns: 1fr;
    }

    .permissions-grid {
        grid-template-columns: 1fr;
    }

    .filters-bar .btn,
    .card-header .btn {
        min-height: 44px;
    }

    .calendar-grid {
        overflow-x: auto;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 10px;
    }

    .modal-actions {
        flex-direction: column;
    }

    .modal-actions .btn {
        width: 100%;
        min-width: 0;
    }

    .header-actions {
        gap: 8px;
    }

    .header-actions .btn {
        flex: 1 1 calc(50% - 8px);
        justify-content: center;
    }

    .tabs {
        padding: 4px;
        gap: 2px;
    }

    .tab {
        padding: 10px 12px;
        font-size: 13px;
        flex: 1 1 auto;
        text-align: center;
    }

    .comedor-card .card-header h3 {
        font-size: 15px;
        text-align: center;
    }

    .radio-label {
        min-height: 40px;
    }

    .login-card {
        padding: 22px 16px;
        box-shadow: none;
        border: none;
    }

    .login-container {
        box-shadow: none;
        border: none;
    }

    .stat-card,
    .card {
        min-width: 0;
    }

    .filters-bar {
        padding: 12px;
    }

    .data-table td {
        flex-wrap: wrap;
        justify-content: flex-start;
        text-align: left;
        gap: 6px;
    }

    .data-table td::before {
        width: 100%;
        margin-bottom: 2px;
    }

    .data-table td.actions {
        justify-content: stretch;
    }

    .data-table td.actions .btn {
        flex: 1;
    }
}