/* ============================================================
   MATERIAL SYMBOLS (LOCAL - CARGA INSTANTÁNEA SIN FOUT)
   ============================================================ */
@font-face {
    font-family: 'Material Symbols Outlined';
    font-style: normal;
    font-weight: 100 700;
    font-display: block;
    src: url('../fonts/material-symbols-outlined.woff2') format('woff2');
}

.material-symbols-outlined {
    font-family: 'Material Symbols Outlined' !important;
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
    width: 1em;
    height: 1em;
    overflow: hidden;
    vertical-align: middle;
}



/* ============================================================
   VARIABLES
   ============================================================ */
:root {
    /* Colores principales */
    --color-primary:        #2563eb;
    --color-primary-hover:  #1d4ed8;
    --color-primary-light:  #eff6ff;
    --color-primary-border: #bfdbfe;

    /* Superficie y fondo */
    --color-bg:             #f8fafc;
    --color-surface:        #ffffff;
    --color-surface-alt:    #f1f5f9;

    /* Bordes */
    --color-border:         #e2e8f0;
    --color-border-strong:  #cbd5e1;

    /* Texto */
    --color-text:           #0f172a;
    --color-text-muted:     #64748b;
    --color-text-light:     #94a3b8;

    /* Estados */
    --color-success:        #059669;
    --color-success-light:  #ecfdf5;
    --color-success-border: #a7f3d0;

    --color-warning:        #d97706;
    --color-warning-light:  #fffbeb;
    --color-warning-border: #fde68a;

    --color-danger:         #dc2626;
    --color-danger-light:   #fef2f2;
    --color-danger-border:  #fecaca;

    --color-info:           #0284c7;
    --color-info-light:     #f0f9ff;
    --color-info-border:    #bae6fd;

    /* Sidebar */
    --sidebar-width:        240px;
    --topbar-height:        60px;

    /* Sombras */
    --shadow-sm:   0 1px 2px rgba(0,0,0,0.05);
    --shadow-md:   0 4px 6px rgba(0,0,0,0.05), 0 1px 3px rgba(0,0,0,0.04);
    --shadow-lg:   0 10px 15px rgba(0,0,0,0.05), 0 4px 6px rgba(0,0,0,0.03);

    /* Radio */
    --radius-sm:   6px;
    --radius-md:   10px;
    --radius-lg:   14px;
    --radius-xl:   18px;
    --radius-full: 9999px;

    /* Tipografía */
    --font-sans:  'Inter', sans-serif;
    --font-title: 'Plus Jakarta Sans', sans-serif;
    --font-mono:  'JetBrains Mono', monospace;

    /* Transición */
    --transition: 150ms ease;
}

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

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    line-height: 1.5;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, select, textarea { font-family: inherit; }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }

/* ============================================================
   TIPOGRAFÍA
   ============================================================ */
h1, h2, h3, h4 { font-family: var(--font-title); font-weight: 700; line-height: 1.2; color: var(--color-text); }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }
h4 { font-size: 0.9375rem; }

p { font-size: 0.875rem; color: var(--color-text-muted); }

.text-sm    { font-size: 0.8125rem; }
.text-xs    { font-size: 0.75rem; }
.text-mono  { font-family: var(--font-mono); }
.text-muted { color: var(--color-text-muted); }
.text-light { color: var(--color-text-light); }
.font-bold  { font-weight: 700; }
.font-semi  { font-weight: 600; }

/* ============================================================
   LAYOUT PRINCIPAL
   ============================================================ */
.app-wrapper {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ---- SIDEBAR ---- */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 14px;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 40;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 8px 16px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 12px;
}

.sidebar-brand-icon {
    width: 40px;
    height: 40px;
    background: var(--color-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.25rem;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(37,99,235,0.25);
}

.sidebar-brand-name {
    font-family: var(--font-title);
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.2;
}

.sidebar-brand-sub {
    font-size: 0.7rem;
    color: var(--color-text-light);
    font-weight: 500;
}

/* Nav */
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-muted);
    transition: background var(--transition), color var(--transition);
}

.nav-item:hover {
    background: var(--color-surface-alt);
    color: var(--color-text);
}

.nav-item.active {
    background: var(--color-primary-light);
    color: var(--color-primary);
    border-left: 3px solid var(--color-primary);
    padding-left: 9px;
}

.nav-item .nav-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* Sidebar footer */
.sidebar-footer {
    border-top: 1px solid var(--color-border);
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-footer .nav-item {
    font-size: 0.8125rem;
    font-weight: 500;
}

.btn-cerrar-turno {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 9px 12px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--color-danger);
    background: var(--color-danger-light);
    border: 1px solid var(--color-danger-border);
    margin-bottom: 6px;
    transition: background var(--transition);
}

.btn-cerrar-turno:hover { background: #fee2e2; }

/* ---- CONTENIDO PRINCIPAL ---- */
.main-content {
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100vh;
    overflow: hidden;
}

/* ---- TOPBAR ---- */
.topbar {
    height: var(--topbar-height);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 30;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-dot {
    width: 10px;
    height: 10px;
    background: var(--color-success);
    border-radius: var(--radius-full);
    box-shadow: 0 0 0 3px var(--color-success-light);
}

.topbar-title {
    font-family: var(--font-title);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-text);
}

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

.topbar-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-text-muted);
}

.topbar-badge .badge-amount {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--color-primary);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    padding-left: 16px;
    border-left: 1px solid var(--color-border);
}

.topbar-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    transition: background var(--transition), color var(--transition);
    position: relative;
}

.topbar-icon-btn:hover { background: var(--color-surface-alt); color: var(--color-text); }

.topbar-notif-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 7px;
    height: 7px;
    background: var(--color-primary);
    border-radius: var(--radius-full);
    border: 1.5px solid var(--color-surface);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 16px;
    border-left: 1px solid var(--color-border);
}

.topbar-user-info { text-align: right; }

.topbar-user-name {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.2;
}

.topbar-user-role {
    font-size: 0.7rem;
    color: var(--color-text-light);
}

.topbar-avatar {
    width: 36px;
    height: 36px;
    background: var(--color-primary-light);
    border: 1px solid var(--color-primary-border);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-primary);
}

/* ---- PÁGINA ---- */
.page-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* Scrollbar */
.page-content::-webkit-scrollbar { width: 5px; }
.page-content::-webkit-scrollbar-track { background: var(--color-surface-alt); }
.page-content::-webkit-scrollbar-thumb { background: var(--color-border-strong); border-radius: 4px; }

/* ============================================================
   COMPONENTES GLOBALES
   ============================================================ */

/* --- BOTONES --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    transition: all var(--transition);
    border: 1px solid transparent;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
    background: var(--color-primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37,99,235,0.25);
}
.btn-primary:hover { background: var(--color-primary-hover); }

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: var(--color-border);
    box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--color-surface-alt); }

.btn-danger {
    background: var(--color-danger-light);
    color: var(--color-danger);
    border-color: var(--color-danger-border);
}
.btn-danger:hover { background: #fecaca; }

.btn-success {
    background: var(--color-success);
    color: #fff;
    box-shadow: 0 2px 8px rgba(5,150,105,0.2);
}
.btn-success:hover { background: #047857; }

.btn-sm { padding: 6px 12px; font-size: 0.8125rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; border-radius: var(--radius-md); }

/* --- CARDS --- */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body { padding: 20px; }
.card-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface-alt);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* --- FORMS --- */
.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text);
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    color: var(--color-text);
    background: var(--color-surface);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-control::placeholder { color: var(--color-text-light); }

select.form-control { cursor: pointer; }

/* --- TABLES --- */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
}

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

.table thead tr {
    background: var(--color-surface-alt);
    border-bottom: 1px solid var(--color-border);
}

.table th {
    padding: 10px 16px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
    vertical-align: middle;
}

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

/* --- BADGES --- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px solid transparent;
}

.badge-primary { background: var(--color-primary-light); color: var(--color-primary); border-color: var(--color-primary-border); }
.badge-success { background: var(--color-success-light); color: var(--color-success); border-color: var(--color-success-border); }
.badge-warning { background: var(--color-warning-light); color: var(--color-warning); border-color: var(--color-warning-border); }
.badge-danger  { background: var(--color-danger-light);  color: var(--color-danger);  border-color: var(--color-danger-border); }
.badge-neutral { background: var(--color-surface-alt); color: var(--color-text-muted); border-color: var(--color-border); }

/* --- ALERTS --- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success { background: var(--color-success-light); color: var(--color-success); border-color: var(--color-success-border); }
.alert-danger  { background: var(--color-danger-light);  color: var(--color-danger);  border-color: var(--color-danger-border); }
.alert-warning { background: var(--color-warning-light); color: var(--color-warning); border-color: var(--color-warning-border); }
.alert-info    { background: var(--color-info-light);    color: var(--color-info);    border-color: var(--color-info-border); }

/* --- MODALS --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.5);
    backdrop-filter: blur(3px);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-overlay.hidden { display: none; }

.modal {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 560px;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface-alt);
}

.modal-title {
    font-family: var(--font-title);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-text);
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    transition: background var(--transition);
}

.modal-close:hover { background: var(--color-border); color: var(--color-text); }

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface-alt);
}

/* --- UTILIDADES --- */
.d-flex  { display: flex; }
.d-grid  { display: grid; }
.d-none  { display: none; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.w-100 { width: 100%; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-primary { color: var(--color-primary); }
.text-success { color: var(--color-success); }
.text-danger  { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }

/* Nav sub-menu */
.nav-group { display: flex; flex-direction: column; }
.nav-sub   { display: flex; flex-direction: column; padding-left: 2.5rem; margin-top: -0.25rem; }
.nav-sub-item {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: background var(--transition), color var(--transition);
}
.nav-sub-item:hover, .nav-sub-item.active {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.hidden { display: none !important; }