/* =====================================================
   REFUGIO PATAGONIA — Design System
   Paleta: #bfe41a (lima), #001641 (navy), #7563fd (violeta)
   Complementos: blanco, gris, negro
   ===================================================== */

:root {
    --lima:    #bfe41a;
    --lima-dk: #9bbc00;
    --lima-lt: #d4f04d;
    --navy:    #001641;
    --navy-lt: #002580;
    --violet:  #7563fd;
    --violet-lt: #9080ff;

    --white:   #ffffff;
    --gray-50: #f8f9fa;
    --gray-100:#f1f3f5;
    --gray-200:#e9ecef;
    --gray-300:#dee2e6;
    --gray-400:#ced4da;
    --gray-500:#adb5bd;
    --gray-600:#6c757d;
    --gray-700:#495057;
    --gray-800:#343a40;
    --gray-900:#212529;
    --black:   #0a0c10;

    --success: #28c76f;
    --danger:  #ea5455;
    --warning: #ff9f43;
    --info:    #00cfe8;

    --sidebar-w: 260px;
    --sidebar-w-collapsed: 76px;
    --topbar-h:  68px;
    --footer-h:  52px;
    --radius:    12px;
    --radius-lg: 18px;
    --shadow:    0 2px 12px rgba(0,22,65,0.10);
    --shadow-lg: 0 8px 32px rgba(0,22,65,0.16);
    --shadow-xl: 0 16px 48px rgba(0,22,65,0.18);
    --touch-min: 48px;
    --ease-out:  cubic-bezier(0.22, 1, 0.36, 1);

    --font-display: 'Space Grotesk', sans-serif;
    --font-body:    'Inter', sans-serif;
}

/* =====================================================
   RESET & BASE
   ===================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-body);
    background: var(--gray-100);
    color: var(--gray-800);
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: 1fr auto;
    grid-template-areas:
        "sidebar main"
        "sidebar footer";
    -webkit-tap-highlight-color: transparent;
    transition: grid-template-columns 0.3s var(--ease-out);
}

body.sidebar-collapsed {
    --sidebar-w: var(--sidebar-w-collapsed);
    grid-template-columns: var(--sidebar-w-collapsed) 1fr;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; -webkit-tap-highlight-color: transparent; }

/* =====================================================
   ANIMACIONES — Fade Up
   ===================================================== */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(28px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.94);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.fade-up {
    opacity: 0;
    animation: fadeUp 0.55s var(--ease-out) forwards;
}

.fade-up-slow {
    opacity: 0;
    animation: fadeUp 0.7s var(--ease-out) forwards;
}

.fade-in {
    opacity: 0;
    animation: fadeIn 0.45s ease forwards;
}

.scale-in {
    opacity: 0;
    animation: scaleIn 0.5s var(--ease-out) forwards;
}

/* Respetar preferencia de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
    .fade-up, .fade-up-slow, .fade-in, .scale-in {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

/* =====================================================
   SIDEBAR
   ===================================================== */
.sidebar {
    grid-area: sidebar;
    background: var(--navy);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.3s var(--ease-out), transform 0.3s var(--ease-out);
}

.sidebar-collapse-btn {
    display: none;
    position: absolute;
    top: 18px;
    right: 10px;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.75);
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    z-index: 2;
    transition: background 0.2s, color 0.2s, transform 0.2s;
}

.sidebar-collapse-btn:hover {
    background: rgba(191, 228, 26, 0.2);
    color: var(--lima);
}

body.sidebar-collapsed .sidebar-collapse-btn i {
    transform: rotate(180deg);
}

.sidebar-logo {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(191,228,26,.15);
}

.sidebar-logo-img {
    width: 100%;
    max-height: 90px;
    object-fit: contain;
    filter: brightness(1.1);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: rgba(255,255,255,.05);
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(191,228,26,.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: var(--lima);
    flex-shrink: 0;
}
.user-name { display: block; font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: .75rem; color: var(--lima); opacity: .85; text-transform: uppercase; letter-spacing: .05em; }

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
}

.nav-section-label {
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--gray-500);
    padding: 8px 20px 4px;
    margin-top: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 20px;
    min-height: var(--touch-min);
    font-size: .95rem;
    font-weight: 500;
    color: rgba(255,255,255,.75);
    border-left: 3px solid transparent;
    transition: all .2s ease;
}

.nav-item:hover {
    background: rgba(191,228,26,.1);
    color: var(--white);
    border-left-color: rgba(191,228,26,.5);
}

.nav-item.active {
    background: rgba(191,228,26,.15);
    color: var(--lima);
    border-left-color: var(--lima);
    font-weight: 600;
}

.nav-item i {
    width: 22px;
    text-align: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    opacity: .9;
}

.nav-item.active i { opacity: 1; }

.sidebar-footer {
    padding: 12px 0;
    border-top: 1px solid rgba(255,255,255,.08);
}

.nav-logout { color: rgba(255,255,255,.5) !important; }
.nav-logout:hover { color: var(--danger) !important; background: rgba(234,84,85,.1) !important; border-left-color: var(--danger) !important; }

.nav-item span,
.user-info,
.nav-section-label {
    transition: opacity 0.2s ease;
}

/* Sidebar plegado — solo iconos */
body.sidebar-collapsed .sidebar-logo {
    padding: 18px 12px 14px;
}

body.sidebar-collapsed .sidebar-logo-img {
    max-height: 40px;
}

body.sidebar-collapsed .sidebar-user {
    justify-content: center;
    padding: 14px 10px;
}

body.sidebar-collapsed .user-info,
body.sidebar-collapsed .nav-section-label,
body.sidebar-collapsed .nav-item span {
    display: none;
}

body.sidebar-collapsed .nav-item {
    justify-content: center;
    gap: 0;
    padding: 14px 10px;
    border-left-width: 0;
    border-radius: 10px;
    margin: 2px 8px;
}

body.sidebar-collapsed .nav-item.active {
    border-left-width: 0;
    box-shadow: inset 0 0 0 2px rgba(191, 228, 26, 0.35);
}

body.sidebar-collapsed .nav-section-label {
    height: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

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

/* =====================================================
   TOPBAR
   ===================================================== */
.topbar {
    height: var(--topbar-h);
    background: #7664FF;
    border-bottom: none;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: 0 4px 20px rgba(118, 100, 255, 0.35);
    color: #fff;
}

.sidebar-toggle {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    font-size: 1.25rem;
    width: var(--touch-min);
    height: var(--touch-min);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s, transform .15s;
    flex-shrink: 0;
}

.sidebar-toggle:active { transform: scale(0.94); background: rgba(255, 255, 255, 0.28); }

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 22, 65, 0.45);
    z-index: 99;
    backdrop-filter: blur(3px);
    animation: fadeIn .25s ease;
}

.sidebar-backdrop.active { display: block; }

.topbar-title h1 {
    font-family: 'Open Sans', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.01em;
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-alert {
    position: relative;
    color: #fff;
    font-size: 1.15rem;
    padding: 6px;
    opacity: 0.95;
    transition: opacity .2s;
}

.topbar-alert:hover { opacity: 1; }

.alert-badge {
    position: absolute;
    top: -4px; right: -4px;
    background: var(--danger);
    color: white;
    font-size: .65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
}

.topbar-time {
    font-size: .9rem;
    color: rgba(255, 255, 255, 0.9);
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

/* =====================================================
   PAGE CONTENT
   ===================================================== */
.page-content {
    flex: 1;
    padding: 28px 32px 36px;
}

/* =====================================================
   FOOTER
   ===================================================== */
.app-footer {
    grid-area: footer;
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    margin-left: var(--sidebar-w);
    height: var(--footer-h);
    transition: margin-left 0.3s var(--ease-out);
}

.footer-inner {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
}

.footer-copy { font-size: .78rem; color: var(--gray-500); }

.footer-logo {
    height: 22px;
    width: auto;
    opacity: .7;
    filter: grayscale(30%);
}

/* =====================================================
   CARDS
   ===================================================== */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: none;
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--navy);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title i {
    color: var(--lima);
    font-size: 1.05rem;
    width: 1.25em;
    text-align: center;
}

.card-body { padding: 24px 28px; }

/* =====================================================
   STAT CARDS (Dashboard)
   ===================================================== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px 26px;
    box-shadow: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
    position: relative;
    overflow: hidden;
    transition: transform .28s var(--ease-out);
    min-height: 168px;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}

.stat-card.lima::before   { background: var(--lima); }
.stat-card.navy::before   { background: var(--navy); }
.stat-card.violet::before { background: var(--violet); }
.stat-card.success::before { background: var(--success); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.danger::before  { background: var(--danger); }

.stat-card:hover { transform: translateY(-4px); }

/* Tarjetas principales — fondo pleno, texto blanco */
.stat-card--filled {
    border: none;
    color: #fff;
    padding: 20px 18px 18px;
    min-height: 148px;
    justify-content: center;
    align-items: center;
    gap: 12px;
    text-align: center;
}

.stat-card--filled::before { display: none; }

.stat-card--filled::after {
    content: '';
    position: absolute;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    top: -40px;
    right: -30px;
    pointer-events: none;
}

.stat-card--filled:hover {
    transform: translateY(-5px);
}

.stat-card--green  { background: #98e601; }
.stat-card--navy   { background: #001743; }
.stat-card--teal   { background: #00d6b9; }
.stat-card--purple { background: #7e47ff; }

.stat-card--filled .stat-icon {
    width: auto;
    height: auto;
    padding: 0;
    background: none;
    border-radius: 0;
    font-size: 2rem;
    color: #fff;
    line-height: 1;
    opacity: 0.95;
}

.stat-card--filled .stat-data {
    text-align: center;
}

.stat-card--filled .stat-value {
    color: #fff;
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}

.stat-card--filled .stat-label {
    color: rgba(255, 255, 255, 0.92);
    font-size: .9rem;
    font-weight: 600;
    margin-top: 4px;
    letter-spacing: 0.01em;
}

.stat-card--filled.stat-card--green .stat-value,
.stat-card--filled.stat-card--green .stat-label {
    text-shadow: 0 1px 8px rgba(0, 30, 0, 0.15);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-icon.lima   { background: rgba(191,228,26,.15); color: var(--lima-dk); }
.stat-icon.navy   { background: rgba(0,22,65,.1);     color: var(--navy); }
.stat-icon.violet { background: rgba(117,99,253,.15); color: var(--violet); }
.stat-icon.success { background: rgba(40,199,111,.15); color: var(--success); }
.stat-icon.warning { background: rgba(255,159,67,.15); color: var(--warning); }
.stat-icon.danger  { background: rgba(234,84,85,.15);  color: var(--danger); }

.stat-data { flex: 1; min-width: 0; width: 100%; }
.stat-value {
    font-family: var(--font-display);
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--navy);
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.stat-label { font-size: .85rem; color: var(--gray-500); font-weight: 500; margin-top: 4px; }

/* =====================================================
   CHARTS GRID
   ===================================================== */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.chart-wrap { position: relative; height: 240px; }

/* =====================================================
   TABLES
   ===================================================== */
.table-wrap { overflow-x: auto; }

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

thead th {
    background: var(--gray-50);
    color: var(--gray-600);
    font-weight: 600;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 12px 16px;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--gray-200);
}

tbody tr { border-bottom: 1px solid var(--gray-100); transition: background .15s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--gray-50); }
tbody td { padding: 13px 16px; vertical-align: middle; }

/* =====================================================
   BADGES
   ===================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-lima    { background: rgba(191,228,26,.18); color: #6b8500; }
.badge-navy    { background: rgba(0,22,65,.1);     color: var(--navy); }
.badge-violet  { background: rgba(117,99,253,.15); color: var(--violet); }
.badge-success { background: rgba(40,199,111,.15); color: #1a8049; }
.badge-danger  { background: rgba(234,84,85,.15);  color: #c02b2c; }
.badge-warning { background: rgba(255,159,67,.15); color: #995500; }
.badge-gray    { background: var(--gray-100);      color: var(--gray-600); }

/* =====================================================
   FORMS
   ===================================================== */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }

label {
    font-size: .82rem;
    font-weight: 600;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    gap: 6px;
}

input[type="text"], input[type="email"], input[type="tel"],
input[type="password"], input[type="number"], input[type="date"],
select, textarea {
    width: 100%;
    min-height: var(--touch-min);
    padding: 12px 16px;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
    color: var(--gray-800);
    background: var(--white);
    transition: border-color .2s, box-shadow .2s;
    outline: none;
    appearance: none;
}

textarea { min-height: 96px; }

input:focus, select:focus, textarea:focus {
    border-color: var(--violet);
    box-shadow: 0 0 0 3px rgba(117,99,253,.12);
}

select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236c757d' d='M6 8L0 0h12z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

textarea { resize: vertical; min-height: 80px; }

.form-hint { font-size: .78rem; color: var(--gray-500); margin-top: 2px; }

/* =====================================================
   BUTTONS
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: var(--touch-min);
    padding: 12px 22px;
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s var(--ease-out);
    text-decoration: none;
    white-space: nowrap;
}

.btn i { font-size: 1.05em; }

.btn:active:not(:disabled) { transform: scale(0.97); }

.btn-primary   { background: var(--navy);   color: var(--white); }
.btn-primary:hover { background: var(--navy-lt); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,22,65,.3); }

.btn-lima      { background: var(--lima);   color: var(--navy); }
.btn-lima:hover { background: var(--lima-lt); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(191,228,26,.4); }

.btn-violet    { background: var(--violet); color: var(--white); }
.btn-violet:hover { background: var(--violet-lt); transform: translateY(-1px); }

.btn-outline   { background: transparent; border: 1.5px solid var(--gray-300); color: var(--gray-700); }
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-400); }

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

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

.btn-sm { min-height: 40px; padding: 8px 14px; font-size: .85rem; }
.btn-lg { min-height: 54px; padding: 14px 28px; font-size: 1.05rem; }
.btn-xl { min-height: 58px; padding: 16px 32px; font-size: 1.1rem; border-radius: var(--radius-lg); }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* =====================================================
   MODALS
   ===================================================== */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 200;
    display: none;
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity .3s ease;
}

.modal-overlay.active {
    display: block;
    opacity: 1;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    width: calc(100% - 40px);
    min-width: 320px;
    max-width: 640px;
    height: auto;
    max-height: min(90vh, 860px);
    overflow-y: auto;
    margin: 0;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: 210;
    display: none;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.94);
    transition: transform 0.35s var(--ease-out), opacity 0.35s ease;
    animation: none !important;
}

.modal.fade-up,
.modal.fade-up-slow,
.modal.fade-in,
.modal.scale-in {
    animation: none !important;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.94);
}

.modal.active {
    display: block;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--navy);
}

.modal-close {
    background: none; border: none;
    color: var(--gray-400); font-size: 1.1rem;
    padding: 4px; border-radius: 6px;
    transition: color .2s, background .2s;
}

.modal-close:hover { color: var(--danger); background: rgba(234,84,85,.1); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--gray-100); display: flex; gap: 10px; justify-content: flex-end; }

/* =====================================================
   TOASTS
   ===================================================== */
.toast-container {
    position: fixed;
    top: 20px; right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    max-width: 380px;
    pointer-events: all;
    border-left: 4px solid var(--gray-300);
    animation: toastIn .3s ease;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-12px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.info    { border-left-color: var(--violet); }

.toast-icon { font-size: 1.1rem; }
.toast.success .toast-icon { color: var(--success); }
.toast.error   .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info    .toast-icon { color: var(--violet); }

.toast-msg { flex: 1; font-size: .875rem; font-weight: 500; color: var(--gray-800); }
.toast-close { background: none; border: none; color: var(--gray-400); font-size: .8rem; padding: 2px 4px; }

/* =====================================================
   SEARCH BAR
   ===================================================== */
.search-bar {
    position: relative;
    max-width: 340px;
}

.search-bar i {
    position: absolute;
    left: 12px; top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    pointer-events: none;
}

.search-bar input { padding-left: 36px; }

/* =====================================================
   PILLS / TABS
   ===================================================== */
.pill-tabs {
    display: flex;
    background: var(--gray-100);
    border-radius: var(--radius);
    padding: 4px;
    gap: 2px;
    width: fit-content;
}

.pill-tab {
    padding: 10px 20px;
    min-height: 42px;
    border-radius: 9px;
    font-size: .9rem;
    font-weight: 600;
    color: var(--gray-500);
    background: none;
    border: none;
    cursor: pointer;
    transition: all .2s var(--ease-out);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.pill-tab i { font-size: 1rem; }
.pill-tab:active { transform: scale(0.97); }

.pill-tab.active { background: var(--white); color: var(--navy); box-shadow: var(--shadow); }

/* =====================================================
   ACOMPAÑANTES — Check-in
   ===================================================== */
.acompanantes-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--gray-200);
}

.acompanantes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.acompanantes-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--navy);
    display: flex;
    align-items: center;
    gap: 10px;
}

.acompanantes-title i { color: var(--violet); font-size: 1.1rem; }

.acompanantes-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
    padding: 0 8px;
    border-radius: 20px;
    background: rgba(117, 99, 253, 0.15);
    color: var(--violet);
    font-size: .8rem;
    font-weight: 700;
}

.acompanantes-hint {
    font-size: .88rem;
    color: var(--gray-500);
    margin-bottom: 16px;
}

.acompanante-row {
    background: var(--gray-50);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    margin-bottom: 14px;
}

.acompanante-row-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.acompanante-row-num {
    font-size: .85rem;
    font-weight: 600;
    color: var(--gray-600);
    display: flex;
    align-items: center;
    gap: 8px;
}

.acompanante-row-num i { color: var(--violet); }

.btn-remove-acomp {
    color: var(--danger) !important;
    border-color: rgba(234, 84, 85, 0.35) !important;
    min-height: 40px;
    padding: 8px 12px !important;
}

.btn-remove-acomp:hover {
    background: rgba(234, 84, 85, 0.08) !important;
    border-color: var(--danger) !important;
}

/* =====================================================
   CHECK-IN SPECIFIC
   ===================================================== */
.checkin-lookup {
    background: linear-gradient(135deg, var(--navy) 0%, #002580 100%);
    border-radius: var(--radius-lg);
    padding: 32px 36px;
    color: var(--white);
    margin-bottom: 28px;
    box-shadow: none;
    position: relative;
    overflow: hidden;
}

.checkin-lookup::before {
    content: '';
    position: absolute;
    width: 280px;
    height: 280px;
    background: radial-gradient(circle, rgba(191,228,26,.12) 0%, transparent 70%);
    top: -80px;
    right: -60px;
    pointer-events: none;
}

.checkin-lookup h2 {
    font-family: var(--font-display);
    font-size: 1.45rem;
    color: var(--lima);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.checkin-lookup h2 i {
    font-size: 1.3rem;
    opacity: .95;
}

.checkin-lookup p { font-size: .95rem; opacity: .8; margin-bottom: 22px; max-width: 520px; }

.lookup-input-wrap {
    display: flex;
    gap: 12px;
    align-items: stretch;
    flex-wrap: wrap;
}

.lookup-input-wrap input {
    background: rgba(255,255,255,.12);
    border-color: rgba(255,255,255,.25);
    color: var(--white);
    flex: 1;
    min-width: 200px;
    max-width: 360px;
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: 0.04em;
}

.lookup-input-wrap .btn { flex-shrink: 0; }

.lookup-results-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0 !important;
}

.lookup-result-item {
    width: 100%;
    text-align: left;
    background: var(--gray-50);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    cursor: pointer;
    transition: border-color .2s, background .2s, transform .15s;
    font-family: inherit;
}

.lookup-result-item:hover {
    border-color: var(--violet);
    background: rgba(117, 99, 253, 0.06);
    transform: translateY(-1px);
}

.lookup-result-item:active {
    transform: scale(0.99);
}

.lookup-result-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1rem;
    color: var(--navy);
    margin-bottom: 4px;
}

.lookup-result-meta {
    font-size: .85rem;
    color: var(--gray-500);
}

.lookup-result-badge {
    margin-top: 8px;
}

.lookup-input-wrap input::placeholder { color: rgba(255,255,255,.45); }
.lookup-input-wrap input:focus { border-color: var(--lima); box-shadow: 0 0 0 3px rgba(191,228,26,.2); }

/* =====================================================
   CONSUMOS / PRODUCT GRID
   ===================================================== */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    gap: 14px;
}

.product-card {
    background: var(--white);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 20px 14px;
    min-height: 130px;
    text-align: center;
    cursor: pointer;
    transition: all .25s var(--ease-out);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.product-card:hover {
    border-color: var(--violet);
    box-shadow: 0 6px 20px rgba(117,99,253,.22);
    transform: translateY(-3px);
}

.product-card:active:not(.disabled):not(.no-stock) {
    transform: scale(0.96);
    border-color: var(--lima);
}

.product-card.selected {
    border-color: var(--lima);
    background: rgba(191,228,26,.08);
}

.product-card.disabled {
    opacity: .4;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(0.35);
}

.product-card.no-stock {
    opacity: .45;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

.product-icon { font-size: 2.4rem; margin-bottom: 10px; line-height: 1; }
.product-name { font-size: .88rem; font-weight: 600; color: var(--gray-800); line-height: 1.35; }
.product-stock { font-size: .75rem; color: var(--gray-400); margin-top: 6px; }
.product-stock.low { color: var(--warning); font-weight: 600; }

/* Botones de producto — fondo pleno */
.product-card--filled {
    border: none;
    min-height: 88px;
    padding: 18px 16px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.product-card--filled.c-green  { background: #98e601; box-shadow: 0 4px 16px rgba(152, 230, 1, 0.3); }
.product-card--filled.c-purple { background: #7e47ff; box-shadow: 0 4px 16px rgba(126, 71, 255, 0.3); }
.product-card--filled.c-teal   { background: #00d6b9; box-shadow: 0 4px 16px rgba(0, 214, 185, 0.3); }
.product-card--filled.c-navy   { background: #001743; box-shadow: 0 4px 16px rgba(0, 23, 67, 0.35); }

.product-card--filled:hover {
    transform: translateY(-3px) scale(1.02);
    filter: brightness(1.05);
}

.product-card--filled.c-green:hover  { box-shadow: 0 8px 24px rgba(152, 230, 1, 0.4); }
.product-card--filled.c-purple:hover { box-shadow: 0 8px 24px rgba(126, 71, 255, 0.4); }
.product-card--filled.c-teal:hover   { box-shadow: 0 8px 24px rgba(0, 214, 185, 0.4); }
.product-card--filled.c-navy:hover   { box-shadow: 0 8px 24px rgba(0, 23, 67, 0.45); }

.product-card--filled:active:not(.disabled):not(.no-stock) {
    transform: scale(0.97);
    filter: brightness(0.97);
}

.product-card--filled .product-name {
    font-family: 'Open Sans', sans-serif;
    font-size: 1.08rem;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    line-height: 1.3;
}

.product-card--filled .product-stock {
    font-family: 'Open Sans', sans-serif;
    font-size: .72rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.82);
    margin-top: 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.product-card--filled .product-stock.low {
    color: #fff;
    opacity: 1;
}

.product-card--filled.c-green .product-name,
.product-card--filled.c-green .product-stock {
    text-shadow: 0 1px 6px rgba(0, 40, 0, 0.15);
}

/* =====================================================
   STOCK INDICATORS
   ===================================================== */
.stock-bar {
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 6px;
}

.stock-fill {
    height: 100%;
    border-radius: 3px;
    transition: width .5s ease;
}

.stock-fill.high   { background: var(--success); }
.stock-fill.medium { background: var(--warning); }
.stock-fill.low    { background: var(--danger); }

/* =====================================================
   LOGIN PAGE
   ===================================================== */
.login-page {
    min-height: 100vh;
    min-height: 100dvh;
    background:
        linear-gradient(155deg, #001228 0%, #001641 28%, #001a4d 52%, #001838 76%, #002055 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
    padding: 28px;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 700px;
    height: 700px;
    background: radial-gradient(circle, rgba(0, 37, 128, 0.35) 0%, transparent 65%);
    top: -220px;
    right: -120px;
    pointer-events: none;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(0, 32, 96, 0.3) 0%, transparent 65%);
    bottom: -120px;
    left: -100px;
    pointer-events: none;
}

.login-box {
    background: var(--white);
    border-radius: 24px;
    padding: 44px 40px;
    width: 100%;
    max-width: 460px;
    box-shadow: var(--shadow-xl);
    position: relative;
    z-index: 1;
}

.login-box.scale-in {
    animation-delay: 0.1s;
}

.login-logo {
    width: 260px;
    max-width: 72vw;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    filter: drop-shadow(0 6px 28px rgba(0, 0, 0, 0.28));
}

.login-title {
    font-family: var(--font-display);
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--navy);
    text-align: center;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.login-subtitle {
    font-size: .95rem;
    color: var(--gray-500);
    text-align: center;
    margin-bottom: 32px;
}

.login-footer {
    margin-top: 32px;
    text-align: center;
    border-top: 1px solid var(--gray-100);
    padding-top: 24px;
}

.login-footer img { height: 24px; margin: 0 auto; opacity: .65; }

.login-box .form-group label i { color: var(--violet); font-size: .9rem; }

.login-box .btn-primary { font-size: 1.05rem; }

/* =====================================================
   PAGE HEADER
   ===================================================== */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.page-header-left h2 {
    font-family: var(--font-display);
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--navy);
    letter-spacing: -0.02em;
}

.page-header-left p { color: var(--gray-500); font-size: .95rem; margin-top: 4px; }

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.date-filter-form {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.date-filter-quick {
    display: flex;
    gap: 6px;
}

.date-filter-field {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--white);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 6px 12px;
    color: var(--gray-500);
}

.date-filter-field input[type="date"] {
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: .9rem;
    font-weight: 600;
    color: var(--navy);
    padding: 4px 0;
    min-height: auto;
}

.date-filter-field input[type="date"]:focus {
    outline: none;
    box-shadow: none;
}

.historial-tabs-wrap {
    padding: 14px 18px !important;
}

.historial-tabs {
    flex-wrap: wrap;
}

.historial-tabs .pill-tab {
    text-decoration: none;
    color: var(--gray-600);
}

.historial-tabs .pill-tab.active {
    color: var(--navy);
}

.historial-tabs--sub .pill-tab {
    font-size: 0.88rem;
    padding: 8px 14px;
}

.historial-filters {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* =====================================================
   ACTION CARDS (Dashboard operador)
   ===================================================== */
.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.action-card {
    text-decoration: none;
    transition: transform .28s var(--ease-out), border-color .28s var(--ease-out);
    border: 2px solid rgb(152, 230, 1) !important;
    box-shadow: none !important;
}

.action-card:hover {
    transform: translateY(-5px);
    border-color: #98e601 !important;
}

.action-card:active {
    transform: translateY(-2px) scale(0.99);
}

.action-card-body {
    text-align: center;
    padding: 40px 28px;
}

.action-card-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 2rem;
    transition: transform .3s var(--ease-out);
    background: rgba(152, 230, 1, 0.15);
    color: rgb(152, 230, 1);
}

.action-card:hover .action-card-icon { transform: scale(1.06); }

.action-card-icon.navy   { background: rgba(0,22,65,.08);   color: var(--navy); }
.action-card-icon.lima   { background: rgba(191,228,26,.18); color: var(--lima-dk); }
.action-card-icon.violet { background: rgba(117,99,253,.14); color: var(--violet); }

.action-card-title {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 8px;
}

.action-card-desc {
    font-size: .9rem;
    color: var(--gray-500);
    line-height: 1.45;
}

/* =====================================================
   INDICADORES DE CONSUMO
   ===================================================== */
.limit-indicators {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.limit-indicator {
    text-align: center;
    padding: 12px 20px;
    border-radius: var(--radius-lg);
    min-width: 90px;
    transition: background .25s ease;
}

.limit-indicator i { font-size: 1.25rem; display: block; margin-bottom: 4px; }

.limit-indicator-label {
    font-size: .78rem;
    margin-top: 2px;
    font-weight: 600;
}

.limit-indicator.free {
    background: rgba(191,228,26,.14);
}

.limit-indicator.free i { color: var(--lima-dk); }

.limit-indicator.done {
    background: rgba(40,199,111,.14);
}

.limit-indicator.done i { color: var(--success); }

/* Info visitante en consumos */
.visita-info-card .visita-avatar {
    width: 56px;
    height: 56px;
    background: rgba(0,22,65,.08);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--navy);
    flex-shrink: 0;
}

.visita-info-card .visita-nombre {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--navy);
}

.visita-info-card .visita-meta {
    font-size: .88rem;
    color: var(--gray-500);
    margin-top: 2px;
}

.visita-info-row {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

/* Footer sponsor en páginas internas */
.footer-sponsor {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px 0 8px;
    margin-top: 12px;
    border-top: 1px solid var(--gray-200);
    font-size: .78rem;
    color: var(--gray-500);
}

.footer-sponsor .footer-logo {
    height: 22px;
    opacity: .7;
}

/* =====================================================
   EMPTY STATE
   ===================================================== */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--gray-400);
}

.empty-state i {
    font-size: 3.5rem;
    margin-bottom: 16px;
    display: block;
    color: var(--gray-300);
}

.empty-state h3 { font-size: 1.1rem; font-weight: 600; color: var(--gray-600); margin-bottom: 8px; }
.empty-state p  { font-size: .9rem; }

/* =====================================================
   UTILS
   ===================================================== */
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px !important; }
.mt-2 { margin-top: 16px !important; }
.mt-3 { margin-top: 24px !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 8px !important; }
.mb-2 { margin-bottom: 16px !important; }
.mb-3 { margin-bottom: 24px !important; }
.d-flex { display: flex; }
.gap-1  { gap: 8px; }
.gap-2  { gap: 16px; }
.align-center { align-items: center; }
.flex-1 { flex: 1; }
.text-muted { color: var(--gray-500); }
.text-sm    { font-size: .82rem; }
.text-right { text-align: right; }
.fw-600     { font-weight: 600; }
.fw-700     { font-weight: 700; }
.w-100      { width: 100%; }

/* Alert inline */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    font-size: .9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    line-height: 1.45;
}

.alert i { font-size: 1.1rem; flex-shrink: 0; }

.alert-danger  { background: rgba(234,84,85,.1);  color: #c02b2c;  border: 1px solid rgba(234,84,85,.25); }
.alert-success { background: rgba(40,199,111,.1); color: #1a8049;  border: 1px solid rgba(40,199,111,.25); }
.alert-warning { background: rgba(255,159,67,.1); color: #884400;  border: 1px solid rgba(255,159,67,.25); }
.alert-info    { background: rgba(117,99,253,.1); color: var(--violet); border: 1px solid rgba(117,99,253,.25); }

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
    padding-top: 20px;
}

.page-btn {
    width: 36px; height: 36px;
    border: 1.5px solid var(--gray-300);
    border-radius: 8px;
    background: var(--white);
    color: var(--gray-700);
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s;
}

.page-btn:hover    { border-color: var(--violet); color: var(--violet); }
.page-btn.active   { background: var(--navy); border-color: var(--navy); color: var(--white); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* =====================================================
   TABLET & TOUCH — objetivo principal de uso
   ===================================================== */
@media (min-width: 768px) and (max-width: 1200px) {
    html { font-size: 16px; }

    :root {
        --sidebar-w: 240px;
        --topbar-h: 72px;
    }

    .page-content { padding: 24px 28px 32px; }

    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
    }

    .stat-card--filled .stat-icon { font-size: 2.1rem; }
    .stat-card--filled .stat-value { font-size: 2.65rem; }
    .stat-card--filled .stat-label { font-size: .92rem; }
    .stat-card--filled { min-height: 155px; padding: 22px 20px 20px; }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
        gap: 18px;
    }


    .action-grid {
        grid-template-columns: repeat(3, 1fr);
    }

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

    .lookup-input-wrap input {
        max-width: none;
        flex: 1 1 280px;
    }

    .pill-tabs {
        flex-wrap: wrap;
        width: 100%;
        max-width: 100%;
    }

    .pill-tab { flex: 1; justify-content: center; min-width: 120px; }

    tbody td { padding: 15px 16px; }
    thead th { padding: 14px 16px; }
}

/* Dispositivos táctiles: áreas de toque ampliadas */
@media (pointer: coarse) {
    .nav-item { padding: 15px 20px; }
    .page-btn { width: 44px; height: 44px; }
    .modal-close {
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .product-card { min-height: 140px; }
    .search-bar input { min-height: var(--touch-min); font-size: 1rem; }
}

/* =====================================================
   RESPONSIVE — móvil y sidebar colapsable
   ===================================================== */
@media (max-width: 1024px) {
    :root { --sidebar-w: 220px; }
}

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

@media (min-width: 769px) {
    .sidebar-collapse-btn { display: flex; }

    .sidebar-logo { padding-right: 40px; }
}

@media (max-width: 768px) {
    body,
    body.sidebar-collapsed {
        grid-template-columns: 1fr;
        grid-template-areas: "main" "footer";
    }

    body.sidebar-collapsed { --sidebar-w: 260px; }

    .sidebar {
        transform: translateX(-100%);
        width: min(280px, 85vw);
        box-shadow: var(--shadow-xl);
    }

    .sidebar.open { transform: translateX(0); }

    .sidebar-collapse-btn { display: none !important; }

    .main-content, .app-footer { margin-left: 0; }

    .page-content { padding: 18px 16px 24px; }

    .stat-grid { grid-template-columns: 1fr 1fr; gap: 14px; }

    .stat-card--filled {
        min-height: 130px;
        padding: 18px 14px 16px;
        gap: 10px;
    }

    .stat-card--filled .stat-icon { font-size: 1.75rem; }
    .stat-card--filled .stat-value { font-size: 2.1rem; }
    .stat-card--filled .stat-label { font-size: .82rem; }

    .product-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }

    .checkin-lookup { padding: 24px 20px; }

    .lookup-input-wrap { flex-direction: column; align-items: stretch; }

    .lookup-input-wrap input { max-width: none; }

    .lookup-input-wrap .btn { width: 100%; }

    .limit-indicators { width: 100%; justify-content: center; }

    .visita-info-row { flex-direction: column; align-items: flex-start; }

    .login-box { padding: 32px 24px; }

    .modal { width: calc(100% - 24px); }
}
