/* ═══════════════════════════════════════════════════════════
   El Milagro · Sistema de Restaurante — Estilos base
   ═══════════════════════════════════════════════════════════ */
@font-face {
    font-family: 'InterVar';
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url('../vendor/fonts/inter-latin-wght-normal.woff2') format('woff2-variations');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'InterVar';
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url('../vendor/fonts/inter-latin-ext-wght-normal.woff2') format('woff2-variations');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    --em-primary: #0d6efd;
    --em-primary-rgb: 13, 110, 253;
    --em-primary-dark: #0a58ca;
    --em-primary-soft: #e7f0ff;
    --em-navy: #0b3a5c;
    --em-bg: #f4f6fa;
    --em-surface: #ffffff;
    --em-border: #e5e8ef;
    --em-text: #182032;
    --em-muted: #6a7385;
    --em-side: #0f1b2d;
    --em-side-2: #16263d;
    --em-side-text: #a9b4c7;
    --em-radius: 14px;
    --em-radius-sm: 10px;
    --em-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 2px 6px rgba(16, 24, 40, .05);
    --em-shadow-lg: 0 10px 30px rgba(16, 24, 40, .12);
    --st-pend: #e03131;
    --st-prep: #f59f00;
    --st-ent: #2f9e44;
    --sidebar-w: 256px;
    --bs-body-font-family: 'InterVar', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    --bs-body-color: var(--em-text);
    --bs-body-bg: var(--em-bg);
    --bs-border-color: var(--em-border);
    --bs-border-radius: 10px;
    --bs-border-radius-lg: 14px;
}

html { -webkit-text-size-adjust: 100%; }
body { background: var(--em-bg); font-feature-settings: 'cv11', 'ss01'; letter-spacing: -.005em; }
a { text-decoration: none; }
.fw-800 { font-weight: 800 !important; }
.fw-700 { font-weight: 700 !important; }
.text-muted, .text-secondary { color: var(--em-muted) !important; }
.tabular { font-variant-numeric: tabular-nums; }
.small-caps { text-transform: uppercase; letter-spacing: .06em; font-size: .72rem; font-weight: 700; color: var(--em-muted); }

/* ───────── Layout ───────── */
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); background: var(--em-side); color: var(--em-side-text);
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 1040; transition: transform .25s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 18px 18px 14px; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand-logo { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; background: #fff; }
.brand-name { color: #fff; font-weight: 800; font-size: 1.05rem; line-height: 1.1; }
.brand-sub { font-size: .72rem; color: var(--em-side-text); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 12px 16px; scrollbar-width: thin; scrollbar-color: #2a3b55 transparent; }
.nav-group { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: #6d7a90; padding: 16px 12px 6px; }
.sidebar .nav-link { display: flex; align-items: center; gap: 12px; color: var(--em-side-text); padding: 10px 12px; border-radius: 10px; font-weight: 500; font-size: .93rem; margin-bottom: 2px; }
.sidebar .nav-link i { font-size: 1.1rem; width: 22px; text-align: center; opacity: .9; }
.sidebar .nav-link:hover { background: var(--em-side-2); color: #fff; }
.sidebar .nav-link.active { background: var(--em-primary); color: #fff; box-shadow: 0 6px 16px rgba(var(--em-primary-rgb), .35); }
.sidebar-foot { padding: 12px 18px; font-size: .75rem; color: #6d7a90; display: flex; justify-content: space-between; align-items: center; border-top: 1px solid rgba(255,255,255,.06); }
.sidebar-backdrop { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 1020; height: 62px; background: rgba(255,255,255,.9); backdrop-filter: saturate(1.4) blur(8px);
    border-bottom: 1px solid var(--em-border); display: flex; align-items: center; gap: 12px; padding: 0 20px;
}
.topbar-title { font-weight: 700; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar-clock { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--em-muted); font-size: .92rem; }
.btn-icon { border: 0; background: transparent; width: 40px; height: 40px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem; color: var(--em-text); }
.btn-icon:hover { background: #eef1f6; }
.user-chip { border: 0; background: transparent; display: flex; align-items: center; gap: 10px; padding: 4px 8px; border-radius: 12px; }
.user-chip:hover { background: #eef1f6; }
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex: 0 0 36px; }
.avatar-txt { background: var(--em-primary-soft); color: var(--em-primary-dark); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: .8rem; }
.pill-caja { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.pill-caja.abierta { background: #e6f6ec; color: #1f7a3a; }
.pill-caja.cerrada { background: #fdecec; color: #b42318; }

.content { padding: 24px; flex: 1; }
@media (max-width: 575.98px) { .content { padding: 16px; } .topbar { padding: 0 10px; } }

/* Menú lateral en tablet/móvil y en modo compacto */
@media (min-width: 992px) {
    [data-sidebar-toggle] { display: none; }
    .layout-compacto [data-sidebar-toggle] { display: inline-flex; }
}
@media (max-width: 991.98px) {
    .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); box-shadow: var(--em-shadow-lg); }
    body.sidebar-open .sidebar { transform: none; }
    body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(8, 15, 28, .45); z-index: 1035; }
}
@media (min-width: 992px) {
    .layout-compacto .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); box-shadow: var(--em-shadow-lg); }
    .layout-compacto.sidebar-open .sidebar { transform: none; }
    .layout-compacto.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(8, 15, 28, .35); z-index: 1035; }
}

/* ───────── Encabezados y tarjetas ───────── */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-header h1 { font-size: 1.75rem; font-weight: 800; margin: 0; letter-spacing: -.02em; }
.page-header h1 i { color: var(--em-text); }
.page-sub { margin: 4px 0 0; color: var(--em-muted); }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.back-link { display: inline-flex; gap: 6px; align-items: center; color: var(--em-muted); font-size: .85rem; margin-bottom: 6px; }
.back-link:hover { color: var(--em-primary); }
@media (max-width: 575.98px) { .page-header h1 { font-size: 1.4rem; } .page-actions { width: 100%; } .page-actions .btn { flex: 1; } }

.card { border: 1px solid var(--em-border); border-radius: var(--em-radius); box-shadow: var(--em-shadow); background: var(--em-surface); }
.card-header { background: transparent; border-bottom: 1px solid var(--em-border); padding: 14px 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-header .btn { margin-left: auto; }
.card-body { padding: 18px; }
.card-title-lg { font-size: 1.1rem; font-weight: 800; }

.kpi { position: relative; padding: 18px; border-radius: var(--em-radius); background: #fff; border: 1px solid var(--em-border); box-shadow: var(--em-shadow); height: 100%; overflow: hidden; }
.kpi-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 800; color: #3b4456; }
.kpi-value { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: .85rem; color: var(--em-muted); }
.kpi-icon { position: absolute; right: 16px; top: 16px; font-size: 2rem; opacity: .22; }
.kpi.grad { color: #fff; border: 0; }
.kpi.grad .kpi-label, .kpi.grad .kpi-sub { color: rgba(255,255,255,.9); }
.kpi.grad .kpi-icon { opacity: .35; }
.grad-green { background: linear-gradient(135deg, #12b886, #0ca678); }
.grad-red { background: linear-gradient(135deg, #fa5252, #e03131); }
.grad-blue { background: linear-gradient(135deg, #4c6ef5, #3b5bdb); }
.grad-violet { background: linear-gradient(135deg, #be4bdb, #9c36b5); }
.grad-amber { background: linear-gradient(135deg, #fab005, #f08c00); }

/* ───────── Formularios y botones ───────── */
.form-label { font-weight: 600; font-size: .86rem; margin-bottom: 6px; }
.form-label .req { color: #e03131; }
.form-control, .form-select { border-radius: var(--em-radius-sm); border-color: #d9dee7; padding: .6rem .8rem; }
.form-control:focus, .form-select:focus { border-color: rgba(var(--em-primary-rgb), .6); box-shadow: 0 0 0 .22rem rgba(var(--em-primary-rgb), .15); }
.form-text { font-size: .78rem; }
.input-group-text { background: #f3f5f9; border-color: #d9dee7; }
.btn { border-radius: 10px; font-weight: 600; padding: .55rem 1rem; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn-sm { padding: .35rem .7rem; font-size: .82rem; }
.btn-lg { padding: .8rem 1.3rem; font-size: 1.05rem; border-radius: 12px; }
.btn-primary { --bs-btn-bg: var(--em-primary); --bs-btn-border-color: var(--em-primary); --bs-btn-hover-bg: var(--em-primary-dark); --bs-btn-hover-border-color: var(--em-primary-dark); --bs-btn-active-bg: var(--em-primary-dark); --bs-btn-disabled-bg: var(--em-primary); --bs-btn-disabled-border-color: var(--em-primary); }
.btn-outline-primary { --bs-btn-color: var(--em-primary); --bs-btn-border-color: var(--em-primary); --bs-btn-hover-bg: var(--em-primary); --bs-btn-hover-border-color: var(--em-primary); --bs-btn-active-bg: var(--em-primary-dark); }
.btn-navy { background: var(--em-navy); color: #fff; border-color: var(--em-navy); }
.btn-navy:hover { background: #082c46; color: #fff; }
.btn-soft { background: #eef1f6; color: var(--em-text); border: 0; }
.btn-soft:hover { background: #e2e7ef; }
.btn-act { width: 34px; height: 34px; padding: 0; border-radius: 9px; }
.form-check-input:checked { background-color: var(--em-primary); border-color: var(--em-primary); }
.form-switch .form-check-input { width: 2.6em; height: 1.35em; cursor: pointer; }

/* ───────── Tablas ───────── */
.table-em { margin: 0; }
.table-em > :not(caption) > * > * { padding: .8rem 1rem; border-bottom-color: #eef1f5; vertical-align: middle; }
.table-em thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: #5b6477; font-weight: 800; background: #f8f9fb; border-bottom: 1px solid var(--em-border); white-space: nowrap; }
.table-em tbody tr:hover { background: #fafbfd; }
.table-em td.tabular, .table-em tfoot td { white-space: nowrap; }
.table-responsive { border-radius: 0 0 var(--em-radius) var(--em-radius); }
.thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: #eef1f6; display: inline-flex; align-items: center; justify-content: center; color: #8a93a5; flex: 0 0 44px; }

/* ───────── Badges ───────── */
.badge { font-weight: 700; }
.badge-soft { background: #eef1f6; color: #3b4456; border: 1px solid #e1e5ec; font-weight: 600; }
.badge-soft-success { background: #e6f6ec; color: #1f7a3a; }
.badge-soft-danger { background: #fdecec; color: #b42318; }
.badge-soft-warning { background: #fff4db; color: #9a5b00; }
.badge-soft-primary { background: var(--em-primary-soft); color: var(--em-primary-dark); }
.badge-outline-success { border: 1.5px solid #2f9e44; color: #2f9e44; background: #fff; border-radius: 999px; padding: .45em .9em; }
.badge-rol { font-weight: 600; }
.estado-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* ───────── Estado vacío ───────── */
.empty-state { text-align: center; padding: 40px 16px; }
.empty-state h3, .empty-state h5 { font-weight: 700; }
.empty-icon { width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 50%; background: #e6f6ec; color: #2f9e44; display: flex; align-items: center; justify-content: center; font-size: 2rem; }

/* ───────── Toasts ───────── */
.toast-zone { position: fixed; top: 74px; right: 16px; z-index: 2000; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 32px)); }
.em-toast { background: #fff; border-radius: 12px; box-shadow: var(--em-shadow-lg); padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start; border-left: 4px solid var(--em-primary); animation: toastIn .25s ease; font-size: .92rem; }
.em-toast.ok { border-left-color: #2f9e44; } .em-toast.ok i { color: #2f9e44; }
.em-toast.err { border-left-color: #e03131; } .em-toast.err i { color: #e03131; }
.em-toast.warn { border-left-color: #f59f00; } .em-toast.warn i { color: #f59f00; }
.em-toast i { font-size: 1.2rem; }
@keyframes toastIn { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 575.98px) { .toast-zone { top: 70px; right: 12px; left: 12px; max-width: none; } }

/* ───────── Modales ───────── */
.modal-content { border: 0; border-radius: 18px; box-shadow: var(--em-shadow-lg); }
.modal-header { border-bottom: 1px solid var(--em-border); padding: 16px 20px; }
.modal-title { font-weight: 800; }
.modal-body { padding: 20px; }
.modal-footer { border-top: 1px solid var(--em-border); padding: 14px 20px; }
@media (max-width: 575.98px) {
    .modal-sheet .modal-dialog { margin: 0; position: fixed; bottom: 0; left: 0; right: 0; max-width: none; }
    .modal-sheet .modal-content { border-radius: 20px 20px 0 0; max-height: 92vh; }
    .modal-sheet.fade .modal-dialog { transform: translateY(40px); }
    .modal-sheet.show .modal-dialog { transform: none; }
}

/* ───────── Login ───────── */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: #fff; }
.login-hero { position: relative; background: linear-gradient(160deg, rgba(10, 22, 40, .72), rgba(10, 22, 40, .9)), url('../../uploads/carta/ceviche.jpg') center/cover; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: flex-end; }
.login-hero h2 { font-weight: 800; font-size: 2.3rem; letter-spacing: -.02em; }
.login-hero p { color: rgba(255,255,255,.8); max-width: 460px; }
.login-box { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.login-card { width: 100%; max-width: 400px; }
.login-logo { width: 96px; height: 96px; border-radius: 22px; object-fit: cover; box-shadow: var(--em-shadow-lg); }
@media (max-width: 899.98px) { .login-page { grid-template-columns: 1fr; } .login-hero { display: none; } }

/* ───────── Utilidades ───────── */
.divider { height: 1px; background: var(--em-border); margin: 16px 0; }
.clickable { cursor: pointer; }
.nowrap { white-space: nowrap; }
.min-w-0 { min-width: 0; }
.list-plain { list-style: none; padding: 0; margin: 0; }
.scroll-x { overflow-x: auto; scrollbar-width: none; }
.scroll-x::-webkit-scrollbar { display: none; }
.img-preview { width: 100%; max-width: 260px; aspect-ratio: 1; border-radius: 14px; background: #e9edf3; display: flex; align-items: center; justify-content: center; color: #8a93a5; font-size: 2.4rem; overflow: hidden; margin: 0 auto; }
.img-preview img { width: 100%; height: 100%; object-fit: cover; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(to top, var(--em-bg) 70%, transparent); padding: 16px 0 4px; z-index: 5; }
.quick-actions { background: var(--em-primary); color: #fff; border-radius: var(--em-radius); padding: 22px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; box-shadow: 0 10px 24px rgba(var(--em-primary-rgb), .25); }
.quick-actions h4 { font-weight: 800; margin: 0; }
.quick-actions .btn-light { color: var(--em-primary-dark); }
.quick-actions .btn-outline-light:hover { color: var(--em-primary-dark); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--em-border); font-size: .82rem; font-weight: 600; white-space: nowrap; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }
.nota-item { background: #fff8db; color: #7a4d00; border-radius: 8px; padding: 2px 8px; font-size: .82rem; display: inline-block; }

@media print { .sidebar, .topbar, .toast-zone, .no-print { display: none !important; } .content { padding: 0; } body { background: #fff; } }
