/* ============================================================
   ROLLAZO Admin — dark/red panel styles
   ============================================================ */

:root {
    --bg: #0a0506;
    --bg-soft: #12080a;
    --surface: #1a0d10;
    --surface-2: #241317;
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.14);
    --red: #d1050c;
    --red-bright: #ff2229;
    --amber: #e8a33d;
    --green: #2fbf71;
    --red-soft: #e05858;
    --text: #f7efe6;
    --text-soft: #c9b8ac;
    --text-muted: #9a877b;
    --radius: 16px;
    --radius-sm: 10px;
    --font-display: "Bebas Neue", "Arial Narrow", sans-serif;
    --font-body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---------- Login ---------- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at 20% 10%, rgba(209, 5, 12, 0.25), transparent 55%),
        radial-gradient(ellipse at 90% 90%, rgba(232, 163, 61, 0.12), transparent 50%),
        var(--bg);
    padding: 24px;
}

.login-wrap { width: min(420px, 100%); }

.login-card {
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: 24px;
    padding: 44px 38px;
    text-align: center;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.login-logo {
    width: 72px; height: 72px;
    margin: 0 auto 16px;
    object-fit: contain;
    border-radius: 18px;
    filter: drop-shadow(0 6px 20px rgba(209, 5, 12, 0.5));
}

.login-card h1 {
    font-family: var(--font-display);
    font-size: 40px;
    letter-spacing: 2px;
    color: #fff;
}

.login-card h1 span {
    background: linear-gradient(135deg, var(--red-bright), var(--amber));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-sub { color: var(--text-muted); font-size: 13.5px; margin: 6px 0 28px; }

.login-card form { display: grid; gap: 16px; text-align: left; }

.field { display: grid; gap: 7px; }
.field label { font-size: 13px; font-weight: 700; color: var(--text-soft); }

.field input, .field select, .field textarea, .input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 12px 15px;
    font-size: 14.5px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.field input:focus, .field select:focus, .field textarea:focus, .input:focus {
    outline: none;
    border-color: var(--red-bright);
    box-shadow: 0 0 0 3px rgba(209, 5, 12, 0.2);
}

.remember { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-soft); cursor: pointer; }
.remember input { accent-color: var(--red); width: 16px; height: 16px; }

.login-back { display: block; margin-top: 26px; color: var(--text-muted); font-size: 13px; }
.login-back:hover { color: var(--red-bright); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 14px;
    border: 1.5px solid transparent;
    transition: all 0.18s ease;
    white-space: nowrap;
}

.btn:active { transform: scale(0.97); }
.btn-primary { background: linear-gradient(135deg, var(--red-bright), var(--red)); color: #fff; box-shadow: 0 8px 24px rgba(209, 5, 12, 0.35); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(209, 5, 12, 0.5); }
.btn-outline { background: transparent; border-color: var(--line-strong); color: var(--text); }
.btn-outline:hover { border-color: var(--red-bright); color: var(--red-bright); }
.btn-danger { background: rgba(224, 88, 88, 0.12); border-color: rgba(224, 88, 88, 0.4); color: #ff9aa0; }
.btn-danger:hover { background: rgba(224, 88, 88, 0.22); }
.btn-ghost { background: transparent; color: var(--text-muted); border: none; }
.btn-ghost:hover { color: var(--red-bright); }
.btn-sm { padding: 7px 14px; font-size: 12.5px; }
.btn-lg { padding: 14px 28px; font-size: 15px; }
.btn-block { width: 100%; }

/* ---------- Admin layout ---------- */
.admin-body { display: flex; min-height: 100vh; }

.sidebar {
    width: 248px;
    flex-shrink: 0;
    background: #070304;
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 20px;
    border-bottom: 1px solid var(--line);
}

.sidebar-logo { width: 42px; height: 42px; object-fit: contain; border-radius: 12px; }

.sidebar-brand span {
    font-family: var(--font-display);
    font-size: 22px;
    letter-spacing: 1.5px;
    color: #fff;
}

.sidebar-brand small { display: block; font-family: var(--font-body); font-size: 10.5px; color: var(--red-bright); letter-spacing: 2px; }

/* min-height: 0 + overflow-y: auto: si el menú es más alto que la pantalla
   (laptop pequeña, muchos roles), el nav hace scroll interno y el pie con
   «Cerrar sesión» siempre queda visible (antes quedaba cortado e inalcanzable
   porque el sidebar es sticky con height:100vh). */
.sidebar-nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 18px 12px;
    display: grid;
    gap: 4px;
    align-content: start;
}

/* Scrollbar sutil acorde al tema oscuro */
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.16); border-radius: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.28); }
.sidebar-nav { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.16) transparent; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-soft);
    font-size: 14px;
    font-weight: 600;
    transition: all 0.16s ease;
    width: 100%;
    background: transparent;
    border: none;
    text-align: left;
}

.nav-link:hover { background: var(--surface); color: #fff; }
.nav-link.is-active { background: linear-gradient(135deg, rgba(209, 5, 12, 0.25), rgba(209, 5, 12, 0.08)); color: var(--red-bright); }
.nav-link svg { flex-shrink: 0; }

.nav-btn { font-family: inherit; }
.nav-btn:hover { color: var(--red-soft); }

.nav-section {
    padding: 16px 14px 4px;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--amber);
    opacity: 0.85;
}

.nav-group { display: grid; gap: 2px; }
.nav-group-head { display: flex; align-items: center; gap: 12px; }
.nav-caret { margin-left: auto; opacity: 0.55; transition: transform 0.2s ease; }
.nav-group-head.is-active .nav-caret { transform: rotate(180deg); }

.nav-sub {
    display: grid;
    gap: 2px;
    margin-left: 16px;
    padding-left: 12px;
    border-left: 1px solid var(--line-strong);
}

.nav-sub-link { padding: 8px 14px; font-size: 13px; color: var(--text-muted); }
.nav-sub-link:hover { background: var(--surface); color: #fff; }
.nav-sub-link.is-active { background: rgba(209, 5, 12, 0.14); color: var(--red-bright); }

.sidebar-foot { padding: 16px 12px; border-top: 1px solid var(--line); display: grid; gap: 4px; }

/* ---------- Main ---------- */
.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 22px 32px;
    border-bottom: 1px solid var(--line);
    background: rgba(10, 5, 6, 0.8);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-badge {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--amber);
}

.admin-topbar h1 {
    font-family: var(--font-display);
    font-size: 32px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #fff;
    line-height: 1;
    margin-top: 4px;
}

.topbar-user { display: flex; align-items: center; gap: 12px; }

.user-avatar {
    width: 42px; height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--red-bright), var(--red));
    font-weight: 800;
    font-size: 17px;
    color: #fff;
}

.topbar-user strong { display: block; font-size: 13.5px; }
.topbar-user small { color: var(--text-muted); font-size: 11.5px; }

.live-clock {
    font-family: 'Bebas Neue', monospace;
    font-size: 22px;
    letter-spacing: 2px;
    color: var(--amber);
    background: rgba(255, 117, 15, 0.08);
    border: 1px solid rgba(255, 117, 15, 0.2);
    border-radius: 10px;
    padding: 6px 14px;
    min-width: 80px;
    text-align: center;
    line-height: 1;
    user-select: none;
}

.admin-content { padding: 30px 32px 60px; max-width: 1240px; width: 100%; }

/* ---------- Alerts ---------- */
.alert {
    border-radius: var(--radius-sm);
    padding: 13px 18px;
    font-size: 13.5px;
    margin-bottom: 20px;
}

.alert ul { list-style: none; display: grid; gap: 3px; }
.alert-success { background: rgba(47, 191, 113, 0.12); border: 1px solid rgba(47, 191, 113, 0.35); color: #8fe6b8; }
.alert-error { background: rgba(209, 5, 12, 0.12); border: 1px solid rgba(209, 5, 12, 0.4); color: #ff9aa0; }
.alert-info { background: rgba(59, 130, 246, 0.12); border: 1px solid rgba(59, 130, 246, 0.35); color: #9ec5fe; }

/* ---------- Toolbar & filters ---------- */
.toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }

.toolbar-title .section-eyebrow {
    font-family: var(--font-display);
    font-size: 13px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--red-bright);
}

.toolbar-title h2 { font-family: var(--font-display); font-size: 30px; letter-spacing: 1px; text-transform: uppercase; color: #fff; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; }
.filters .input { width: auto; min-width: 220px; }

/* ---------- Panels ---------- */
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 24px;
    overflow: hidden;
}

.panel-narrow { max-width: 640px; }

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--line);
}

.panel-head h3 { font-size: 15.5px; color: #fff; }

.panel-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 24px; }
.order-grid { grid-template-columns: 1fr 1fr; }
.panel-grid-2 { grid-template-columns: 1fr 1fr; }

/* ---------- KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px; margin-bottom: 26px; }

.kpi-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.18s ease, border-color 0.18s ease;
}

.kpi-card:hover { transform: translateY(-3px); border-color: rgba(209, 5, 12, 0.45); }

.kpi-emoji { font-size: 32px; }

.kpi-label { display: block; color: var(--text-muted); font-size: 12.5px; }
.kpi-value { font-family: var(--font-display); font-size: 30px; letter-spacing: 1px; color: var(--amber); }

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

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.table th {
    text-align: left;
    padding: 12px 18px;
    color: var(--text-muted);
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.table td { padding: 13px 18px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); vertical-align: middle; }

.table tbody tr { transition: background 0.14s ease; }
.table tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
.table tfoot td { padding: 10px 18px; font-size: 13px; }

.td-muted { color: var(--text-muted); }
.td-strong { font-weight: 800; }

.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell strong { white-space: nowrap; }
.user-cell .user-avatar { width: 34px; height: 34px; font-size: 14px; flex-shrink: 0; }

.field-hint { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.td-right { text-align: right; color: var(--text-muted); }
.td-total { font-size: 15px; color: #fff; border-top: 1px solid var(--line-strong); }
.td-empty { text-align: center; color: var(--text-muted); padding: 40px !important; }
.td-actions { display: flex; gap: 8px; justify-content: flex-end; }
.td-actions form { display: inline; }

.thumb {
    width: 44px; height: 44px;
    border-radius: 10px;
    object-fit: cover;
    display: block;
}

.thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 800;
    color: var(--text-muted);
    background: var(--bg-soft);
}

.mono, .link-mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }
.link-mono { color: var(--amber); }
.link-mono:hover { text-decoration: underline; }

.mini-badge {
    display: inline-block;
    margin-left: 8px;
    background: rgba(232, 163, 61, 0.15);
    color: var(--amber);
    border: 1px solid rgba(232, 163, 61, 0.3);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    vertical-align: middle;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 700;
    padding: 4px 11px;
    border-radius: 999px;
    white-space: nowrap;
}

.badge-active { background: rgba(47, 191, 113, 0.12); color: #8fe6b8; }
.badge-inactive { background: rgba(224, 88, 88, 0.12); color: #ff9aa0; }
.badge-neutral { background: rgba(255, 255, 255, 0.08); color: var(--text-soft); }
.badge-pickup { background: rgba(232, 163, 61, 0.14); color: var(--amber); }
.badge-delivery { background: rgba(47, 191, 113, 0.12); color: #8fe6b8; }
.badge-promo { background: rgba(232, 163, 61, 0.14); color: var(--amber); font-size: 10.5px; padding: 2px 8px; }
.badge-done { background: rgba(47, 191, 113, 0.15); color: #8fe6b8; font-size: 13px; padding: 8px 16px; }

.status-pill, .pay-pill {
    display: inline-block;
    font-size: 11.5px;
    font-weight: 700;
    padding: 4px 11px;
    border-radius: 999px;
}

.status-received { background: rgba(232, 163, 61, 0.15); color: var(--amber); }
.status-preparing { background: rgba(255, 34, 41, 0.14); color: var(--red-bright); }
.status-ready { background: rgba(129, 140, 248, 0.15); color: #a5b4fc; }
.status-delivered { background: rgba(47, 191, 113, 0.14); color: #8fe6b8; }
.status-cancelled { background: rgba(224, 88, 88, 0.16); color: #ff9aa0; }
.badge-cancelled { background: rgba(224, 88, 88, 0.16); color: #ff9aa0; }
/* Variante grande para el detalle de pedido (igual que badge-done) */
.order-actions .badge-cancelled { font-size: 13px; padding: 8px 16px; }

.alert-timeout {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 177, 38, 0.1);
    border: 1px solid rgba(255, 177, 38, 0.3);
    color: #ffb126;
    border-radius: 12px;
    padding: 14px 20px;
    margin: 20px 0;
    font-size: 14px;
    animation: alertPulse 2s ease-in-out infinite;
}

@keyframes alertPulse {
    0%, 100% { border-color: rgba(255, 177, 38, 0.3); }
    50% { border-color: rgba(255, 177, 38, 0.6); }
}

.pay-pending { background: rgba(224, 88, 88, 0.13); color: #ff9aa0; }
.pay-paid { background: rgba(47, 191, 113, 0.14); color: #8fe6b8; }
.pay-failed { background: rgba(224, 88, 88, 0.2); color: #ff9aa0; }

/* ---------- Pagination ---------- */
.pagination { padding: 16px 22px; border-top: 1px solid var(--line); }
.pagination nav { display: flex; justify-content: center; }

.pagination .pagination { --bs-pagination-bg: transparent; }
.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    margin: 0 3px;
    padding: 0 10px;
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 600;
    transition: all 0.15s ease;
}

.pagination a:hover { background: var(--red); color: #fff; }
.pagination .active > span { background: linear-gradient(135deg, var(--red-bright), var(--red)); color: #fff; }
.pagination .disabled > span { opacity: 0.35; }

/* ---------- Order detail ---------- */
.mb-16 { margin-bottom: 16px; }

.order-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 26px;
}

.order-head .section-eyebrow {
    font-family: var(--font-display);
    font-size: 13px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--red-bright);
}

.order-number { font-family: var(--font-display); font-size: 40px; letter-spacing: 1.5px; color: #fff; }
.order-meta { color: var(--text-muted); font-size: 13.5px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.info-list { padding: 8px 22px 20px; display: grid; gap: 4px; }

.info-row { display: flex; justify-content: space-between; gap: 16px; padding-block: 9px; border-bottom: 1px dashed rgba(255, 255, 255, 0.07); font-size: 13.5px; }
.info-row span { color: var(--text-muted); }
.info-row strong { color: var(--text); text-align: right; }

.timeline-vertical { padding: 18px 22px; display: grid; gap: 16px; }

.tv-step { display: flex; align-items: center; gap: 12px; position: relative; }
.tv-step:not(:last-child)::after {
    content: "";
    position: absolute;
    left: 9px; top: 26px;
    width: 2px; height: 22px;
    background: var(--line-strong);
}

.tv-dot {
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 2px solid var(--line-strong);
    flex-shrink: 0;
    z-index: 1;
}

.tv-step.is-done .tv-dot { background: var(--green); border-color: var(--green); box-shadow: 0 0 0 4px rgba(47, 191, 113, 0.15); }
.tv-step.is-cancelled .tv-dot { background: var(--red-soft); border-color: var(--red-soft); box-shadow: 0 0 0 4px rgba(224, 88, 88, 0.15); }
.tv-step.is-cancelled .tv-label { color: #ff9aa0; }
.tv-label { font-size: 13.5px; font-weight: 600; color: var(--text-muted); }
.tv-step.is-done .tv-label { color: var(--text); }

.history-list { list-style: none; padding: 10px 22px 20px; display: grid; gap: 10px; }
.history-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; }
.history-time { color: var(--text-muted); }

/* ---------- Status bars ---------- */
.status-bars { padding: 20px 22px; display: grid; gap: 14px; }

.status-bar-row { display: grid; grid-template-columns: 130px 1fr 30px; gap: 12px; align-items: center; font-size: 12.5px; }
.status-bar-label { color: var(--text-soft); }
.status-bar-count { font-weight: 800; color: var(--text); text-align: right; }

.status-bar-track { height: 9px; border-radius: 99px; background: var(--bg-soft); overflow: hidden; }
.status-bar-fill { height: 100%; border-radius: 99px; transition: width 0.5s ease; }
.status-bar-received { background: var(--amber); }
.status-bar-preparing { background: var(--red-bright); }
.status-bar-ready { background: #a5b4fc; }
.status-bar-delivered { background: var(--green); }

/* ---------- Forms ---------- */
.form-stack { padding: 24px 26px 28px; display: grid; gap: 18px; }
.form-stack .field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-stack .field-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.field-check { align-self: end; padding-bottom: 10px; }

/* ---------- Settings ---------- */
.settings-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.settings-tab {
    padding: 9px 20px;
    border-radius: 999px;
    border: 1.5px solid var(--line-strong);
    color: var(--text-soft);
    font-size: 13.5px;
    font-weight: 700;
    transition: all 0.16s ease;
}

.settings-tab:hover { border-color: var(--red-bright); color: var(--red-bright); }
.settings-tab.is-active {
    background: linear-gradient(135deg, var(--red-bright), var(--red));
    border-color: transparent;
    color: #fff;
    box-shadow: 0 8px 24px rgba(209, 5, 12, 0.35);
}

.toolbar-actions { display: flex; gap: 8px; }

.btn-success {
    background: linear-gradient(135deg, #1f7a3d, #14602e);
    color: #fff;
}
.btn-success:hover { background: linear-gradient(135deg, #249149, #1a7a39); }

.order-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.recipe-table { display: grid; gap: 8px; }
.recipe-row {
    display: grid;
    grid-template-columns: 1fr 140px;
    gap: 12px;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-soft);
    border-radius: 8px;
}

/* Resumen de utilidad del producto (precio − costo de receta) */
.recipe-unit-cost { color: var(--green); opacity: 0.85; }
.recipe-no-cost { color: var(--red-soft); }

.recipe-cost-warning {
    margin-top: 12px;
    font-size: 12.5px;
    color: var(--amber);
    background: rgba(232, 163, 61, 0.08);
    border: 1px dashed rgba(232, 163, 61, 0.4);
    border-radius: 10px;
    padding: 10px 12px;
}

.recipe-summary-note {
    color: var(--text-muted);
    font-size: 11.5px;
}

.recipe-summary {
    margin-top: 14px;
    background: var(--bg-soft);
    border: 1px dashed var(--line-strong);
    border-radius: 10px;
    padding: 12px 14px;
    display: grid;
    gap: 6px;
}

.recipe-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 13.5px;
    color: var(--text-soft);
}

.recipe-summary-row strong {
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.recipe-summary-row.recipe-utility {
    border-top: 1px dashed var(--line-strong);
    padding-top: 8px;
    font-weight: 800;
}

.recipe-utility.util-positive { color: var(--green); }
.recipe-utility.util-positive strong { color: var(--green); }
.recipe-utility.util-negative { color: var(--red-soft); }
.recipe-utility.util-negative strong { color: var(--red-soft); }

.td-util-pos { color: var(--green); }
.td-util-neg { color: var(--red-soft); }
.recipe-name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.recipe-name small { color: var(--text-muted); font-weight: 500; }
.recipe-row input { min-width: 0; }

.divider {
    height: 1px;
    background: var(--line);
    margin: 4px 0 2px;
}

.form-foot {
    padding: 16px 22px;
    border-top: 1px solid var(--line);
}

/* ---------- Toggles ---------- */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 4px 0;
}

.toggle-label strong { display: block; font-size: 14.5px; color: #fff; }
.toggle-label small { color: var(--text-muted); font-size: 12.5px; }

.toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    flex-shrink: 0;
    cursor: pointer;
}

.toggle input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }

.toggle .track {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1.5px solid var(--line-strong);
    transition: background 0.2s ease, border-color 0.2s ease;
}

.toggle .track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: transform 0.2s ease, background 0.2s ease;
}

.toggle input:checked + .track {
    background: linear-gradient(135deg, var(--red-bright), var(--red));
    border-color: transparent;
}

.toggle input:checked + .track::after {
    transform: translateX(22px);
    background: #fff;
}

/* ---------- Hours editor ---------- */
.hours-grid {
    padding: 8px 22px;
    display: grid;
    gap: 2px;
}

.hours-row {
    display: grid;
    grid-template-columns: 110px 96px 1fr;
    align-items: center;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
}

.hours-row:last-child { border-bottom: none; }

.hours-day { font-weight: 700; color: var(--text); font-size: 13.5px; }

.hours-closed { justify-self: start; }

.hours-times {
    display: flex;
    align-items: center;
    gap: 8px;
    transition: opacity 0.18s ease;
}

.hours-times.is-disabled { opacity: 0.35; pointer-events: none; }

.hours-times input {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 9px 12px;
    font-size: 13.5px;
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
}

.hours-times input:focus {
    outline: none;
    border-color: var(--red-bright);
    box-shadow: 0 0 0 3px rgba(209, 5, 12, 0.2);
}

.hours-sep { color: var(--text-muted); }

/* ---------- Image upload ---------- */
.image-upload { display: grid; gap: 10px; }

.image-dropzone {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 170px;
    border: 1.5px dashed var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--bg);
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.18s ease, background 0.18s ease;
}

.image-dropzone:hover { border-color: var(--red-bright); background: rgba(209, 5, 12, 0.04); }

.image-preview { width: 100%; height: 170px; object-fit: cover; display: block; }
.image-preview.is-empty { display: none; }

.image-dropzone-hint {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    pointer-events: none;
}

.image-preview:not(.is-empty) ~ .image-dropzone-hint { display: none; }

.image-input { display: none; }

/* ---------- Notificaciones push ---------- */
.push-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
}

.push-btn:hover {
    border-color: var(--red);
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.push-btn.is-active {
    border-color: rgba(74, 222, 128, 0.5);
    color: #4ade80;
    background: rgba(74, 222, 128, 0.08);
}

.push-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
    .panel-grid, .order-grid, .panel-grid-2 { grid-template-columns: 1fr; }
    .form-stack .field-row-3 { grid-template-columns: 1fr 1fr; }
    .form-stack .field-row-3 .field-check { grid-column: 1 / -1; }
}

/* Botón "Instalar app" del topbar (PWA, Windows/Android) */
.push-btn-install {
    margin-left: 8px;
    color: var(--green);
    border-color: rgba(47, 191, 113, 0.45);
}
.push-btn-install:hover {
    background: rgba(47, 191, 113, 0.12);
    border-color: var(--green);
}

/* Botón "Probar aviso" del topbar (junto a Activar notificaciones) */
.push-btn-test {
    margin-left: 8px;
    color: var(--amber);
    border-color: rgba(232, 163, 61, 0.45);
}
.push-btn-test:hover {
    background: rgba(232, 163, 61, 0.12);
    border-color: var(--amber);
}

/* --- Popup de nuevo pedido (live updates) --- */
.order-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.66);
    backdrop-filter: blur(3px);
}
.order-modal-card {
    position: relative;
    width: min(420px, 92vw);
    background: var(--surface-2);
    border: 1px solid rgba(209, 5, 12, 0.55);
    border-radius: 14px;
    padding: 28px 24px 22px;
    text-align: center;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
    animation: order-modal-pop 0.18s ease-out;
}
@keyframes order-modal-pop {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.order-modal-icon { font-size: 34px; line-height: 1; }
.order-modal-card h3 {
    margin: 10px 0 6px;
    font-size: 1.3rem;
    color: var(--text);
}
.order-modal-meta {
    margin: 0 0 18px;
    color: var(--red-soft);
    font-weight: 700;
    font-size: 1.02rem;
}
.order-modal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.6;
}
.order-modal-close:hover { opacity: 1; }
.order-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* --- Live updates de pedidos (refresco automático) --- */
.live-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    margin: 0 0 14px;
    border-radius: 10px;
    background: rgba(209, 5, 12, 0.14);
    border: 1px solid rgba(209, 5, 12, 0.45);
    color: #ffd9db;
    font-weight: 600;
    font-size: 0.92rem;
}
.live-banner-close {
    margin-left: auto;
    background: none;
    border: none;
    color: #ffd9db;
    cursor: pointer;
    font-size: 0.85rem;
    opacity: 0.7;
}
.live-banner-close:hover { opacity: 1; }
@keyframes live-flash {
    0% { background: rgba(209, 5, 12, 0.28); }
    100% { background: transparent; }
}
tr.live-new { animation: live-flash 1.8s ease-out; }
@keyframes live-flash-green {
    0% { background: rgba(47, 191, 113, 0.25); }
    100% { background: transparent; }
}
tr.live-changed { animation: live-flash-green 1.8s ease-out; }

@media (max-width: 640px) {
    .form-stack .field-row, .form-stack .field-row-3 { grid-template-columns: 1fr; }
    .hours-row { grid-template-columns: 1fr 1fr; }
    .hours-day { grid-column: 1 / -1; }
    .hours-times { grid-column: 1 / -1; }
}

@media (max-width: 820px) {
    /* El panel pasa a una sola columna: sidebar arriba, contenido abajo. */
    .admin-body { flex-direction: column; }

    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        flex-direction: column; /* filas: marca / navegación / pie */
        border-right: none;
        border-bottom: 1px solid var(--line);
    }

    .sidebar-brand { border-bottom: none; padding: 12px 16px 4px; }

    /* La navegación pasa de grid vertical a una cinta horizontal con scroll.
       (Antes se dejaba display:grid y el flex-direction:row + overflow-x no
       surtían efecto → el menú se veía roto en pantallas pequeñas.) */
    .sidebar-nav {
        display: flex;
        flex-direction: row;
        align-items: center;
        overflow-x: auto;
        width: 100%;
        flex: none;
        gap: 4px;
        padding: 6px 12px 10px;
        scrollbar-width: none; /* Firefox */
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
    }
    .sidebar-nav::-webkit-scrollbar { display: none; }

    .nav-link { width: auto; white-space: nowrap; padding: 9px 13px; }

    /* Los separadores de sección (REPORTES / CONFIGURACIÓN) se ocultan en
       la cinta horizontal. */
    .nav-section { display: none; }

    .sidebar-foot {
        flex-direction: row;
        justify-content: flex-end;
        gap: 6px;
        padding: 0 12px 12px;
        border-top: none;
    }

    .admin-content { padding: 22px 18px 50px; }

    .admin-topbar { padding: 14px 16px; gap: 10px; flex-wrap: wrap; row-gap: 8px; }
    .admin-topbar h1 { font-size: 26px; }
    .topbar-badge { display: none; }
    .topbar-user { gap: 8px; }
    .topbar-user div { display: none; }
    .push-btn .push-btn-label { display: none; }
    .push-btn { padding: 8px 9px; }
    .push-btn-install, .push-btn-test { margin-left: 4px; }
    .user-avatar { width: 36px; height: 36px; font-size: 15px; }
}

/* Pantallas muy angostas: ajustes finos */
@media (max-width: 480px) {
    .admin-topbar { padding: 12px; }
    .admin-content { padding: 18px 12px 44px; }
    .sidebar-brand { padding: 10px 14px 2px; }
    .sidebar-brand span { font-size: 19px; }
    .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
    .kpi-card { padding: 14px; gap: 10px; }
    .kpi-emoji { font-size: 24px; }
    .kpi-value { font-size: 24px; }
    .kpi-label { font-size: 11px; }
    .order-number { font-size: 30px; }
    .info-row { flex-direction: column; gap: 2px; }
    .info-row strong { text-align: left; }
    .status-bar-row { grid-template-columns: 100px 1fr 26px; gap: 8px; }
    .table th, .table td { padding: 10px; }
    .panel-head { padding: 14px; }
    .toolbar { align-items: stretch; flex-direction: column; }
    .filters { width: 100%; }
    .filters .input { width: 100%; min-width: 0; }
    .order-actions .btn { flex: 1 1 auto; }
}

/* Detalle desplegable de "Ventas por sucursal" (reporte de ventas) */
.branch-detail-row > td {
    background: rgba(0, 0, 0, 0.18);
    padding: 14px 18px;
}
.table-compact { margin: 0; }
.table-compact th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted, #9aa4b2); }
.table-compact td { padding: 8px 12px; font-size: 13px; }

/* ===== Catálogo: selector de tipo (Producto/Servicio vs Combo/Kit) ===== */
.type-chooser { padding: 18px 20px 22px; border-bottom: 1px solid var(--line-strong, rgba(255,255,255,0.08)); }
.type-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.type-card {
    display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
    padding: 20px 18px; text-align: left; cursor: pointer;
    background: var(--bg-soft, rgba(255,255,255,0.03));
    border: 1px solid var(--line-strong, rgba(255,255,255,0.12));
    border-radius: 14px; color: inherit; font-family: inherit;
    transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}
.type-card:hover { border-color: var(--amber, #e8a33d); background: rgba(232, 163, 61, 0.07); transform: translateY(-1px); }
.type-card-icon { font-size: 26px; line-height: 1; }
.type-card strong { font-size: 15px; color: #fff; }
.type-card small { font-size: 12.5px; color: var(--text-muted, #9aa4b2); line-height: 1.45; }
@media (max-width: 520px) { .type-cards { grid-template-columns: 1fr; } }

.mini-badge-combo { background: rgba(61, 154, 232, 0.15); color: #6db5ef; border-color: rgba(61, 154, 232, 0.35); }

/* ===== Formulario: combo, campos colapsables, modificadores ===== */
.combo-item-row { display: flex; gap: 8px; margin-bottom: 8px; }
.combo-item-row select { flex: 1; min-width: 0; }
.combo-item-row .btn { flex-shrink: 0; }

.combo-sum-hint {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; color: var(--text-soft, #c9cfd8);
    background: rgba(232, 163, 61, 0.08);
    border: 1px dashed rgba(232, 163, 61, 0.35);
    border-radius: 10px; padding: 10px 12px; margin-bottom: 14px;
}
.combo-sum-hint strong { color: var(--amber, #e8a33d); font-size: 15px; }

.radio-inline { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 6px; }
.radio-inline.radio-stack { flex-direction: column; gap: 6px; align-items: flex-start; margin-top: 8px; }

#extra-fields { padding-top: 14px; }
#modifier-fields, #stock-field { padding-top: 10px; }

/* ---------- Inventario: compras / proveedores ---------- */
.badge-warning { background: rgba(240, 180, 41, 0.12); color: #ffd57e; }

.btn-filter {
    padding: 6px 14px;
    border-radius: 999px;
    border: 1.5px solid var(--line-strong);
    color: var(--text-soft);
    font-size: 12.5px;
    font-weight: 700;
    transition: all 0.16s ease;
}
.btn-filter:hover { border-color: var(--red-bright); color: var(--red-bright); }
.btn-filter.is-active {
    background: linear-gradient(135deg, var(--red-bright), var(--red));
    border-color: transparent;
    color: #fff;
}

.purchase-search { position: relative; max-width: 460px; }
.purchase-search input { width: 100%; }
.purchase-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 30;
    background: var(--bg-soft);
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    max-height: 260px;
    overflow: auto;
}
.purchase-result {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 14px;
    border: 0;
    background: none;
    color: var(--text);
    font-size: 13.5px;
    cursor: pointer;
    text-align: left;
}
.purchase-result:hover { background: rgba(255, 255, 255, 0.06); }
.purchase-result small { color: var(--text-muted); white-space: nowrap; }

.purchase-lines input[type="number"], .purchase-lines select { padding: 7px 9px; }
.purchase-lines td { vertical-align: middle; }

.purchase-total-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    padding: 14px 18px 0;
    font-size: 15px;
}
.purchase-total-row strong { font-size: 19px; color: #fff; }

.panel-body { padding: 20px 22px; }

/* ===== Campos de fecha: ícono de calendario blanco (tema oscuro) ===== */
/* color-scheme: dark hace que Firefox y otros navegadores dibujen el ícono
   nativo claro; el filter invierte el ícono de WebKit (Chrome/Edge/Safari). */
input[type="date"],
input[type="datetime-local"] {
    color-scheme: dark;
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(1) grayscale(1) brightness(2);
    cursor: pointer;
    opacity: 0.85;
    transition: opacity 0.15s ease;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* ===== Filtro de rango de fechas (reportes) ===== */
.date-range {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.date-range-field {
    position: relative;
    display: grid;
    gap: 4px;
}

.date-range-field label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.date-range-field .input {
    min-width: 150px;
    padding-right: 40px;
    color: var(--text);
}

.date-range-field .input::placeholder { color: var(--text-muted); }

.date-cal {
    position: absolute;
    right: 3px;
    bottom: 2px;
    top: auto;
    height: 44px;
    aspect-ratio: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.date-cal:hover { background: rgba(255, 255, 255, 0.08); }
.date-cal svg { display: block; }

.date-range-sep {
    align-self: center;
    padding-bottom: 10px;
    color: var(--text-muted);
    font-weight: 700;
}

/* Popover con los dos calendarios */
.range-popover {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 60;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    width: min(600px, 92vw);
    background: var(--surface-2);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.range-popover[hidden] { display: none; }

.range-month { display: grid; gap: 8px; min-width: 0; }

.range-month-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.range-month-title {
    font-size: 13.5px;
    font-weight: 800;
    color: #fff;
    text-transform: capitalize;
}

.range-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid var(--line-strong);
    background: transparent;
    color: var(--text-soft);
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.15s ease;
}

.range-nav:hover { border-color: var(--red-bright); color: var(--red-bright); }

.range-nav-placeholder { width: 28px; height: 28px; }

.range-dow {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    text-align: center;
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.range-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.range-day {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    border: none;
    background: transparent;
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}

.range-day:hover { background: rgba(209, 5, 12, 0.35); color: #fff; }
.range-day.is-today { box-shadow: inset 0 0 0 1px var(--line-strong); }
.range-day.is-start,
.range-day.is-end {
    background: linear-gradient(135deg, var(--red-bright), var(--red));
    color: #fff;
    font-weight: 800;
}
.range-day.in-range { background: rgba(209, 5, 12, 0.22); color: #fff; }

.range-hint {
    grid-column: 1 / -1;
    font-size: 11.5px;
    color: var(--text-muted);
    text-align: center;
    border-top: 1px dashed var(--line);
    padding-top: 10px;
}

@media (max-width: 640px) {
    .range-popover { grid-template-columns: 1fr; width: min(340px, 92vw); }
}
