/* ==========================================================================
   Ordena · pantallas de operación (cocina y punto de venta).
   Se carga despues de app.css.
   ========================================================================== */

/* ==========================================================================
   Pantalla de cocina (KDS) · siempre oscura: se ve de lejos y sin reflejos
   ========================================================================== */

body.kds {
    background: #0A0C12;
    color: #F2F4F9;
    height: 100vh;
    overflow: hidden;
}

.kds-bar {
    display: flex; align-items: center; gap: 16px;
    padding: 14px 22px;
    background: #11141D;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.kds-bar h1 { font-size: 20px; font-weight: 700; }
.kds-bar .sub { font-size: 13px; color: #8A93AB; }
.kds-clock {
    font-family: Outfit, sans-serif; font-size: 24px; font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.kds-bar .btn {
    background: #1B2030; border-color: rgba(255,255,255,.14); color: #F2F4F9;
}
.kds-bar .btn:hover { background: #232a3d; }

.kds-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    padding: 14px;
    height: calc(100vh - 61px);
}

.kds-col { display: flex; flex-direction: column; min-height: 0; }
.kds-col-head {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    border-radius: 12px 12px 0 0;
    font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    background: #11141D;
    border: 1px solid rgba(255,255,255,.08);
    border-bottom: 0;
}
.kds-col-head .n {
    margin-left: auto;
    min-width: 26px; padding: 2px 8px; border-radius: 99px;
    background: rgba(255,255,255,.1); font-size: 13px; letter-spacing: 0;
}
.kds-col[data-col="pending"]   .kds-col-head { color: #FFB020; }
.kds-col[data-col="preparing"] .kds-col-head { color: #63A4FF; }
.kds-col[data-col="ready"]     .kds-col-head { color: #29D07E; }

.kds-list {
    flex: 1; min-height: 0;
    overflow-y: auto;
    display: grid; gap: 12px; align-content: start;
    padding: 12px;
    background: #0D1018;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 0 0 12px 12px;
    scrollbar-width: thin;
}

.ticket {
    border-radius: 14px;
    background: #161B27;
    border: 1px solid rgba(255,255,255,.09);
    border-left: 5px solid #3A425A;
    overflow: hidden;
    animation: ticketIn .32s cubic-bezier(.16,1,.3,1) both;
}
@keyframes ticketIn { from { opacity: 0; transform: translateY(14px) scale(.98); } }

.ticket.late   { border-left-color: #FFB020; }
.ticket.urgent { border-left-color: #FF4D5E; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255,77,94,0); }
    50%      { box-shadow: 0 0 0 5px rgba(255,77,94,.18); }
}

.ticket-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px 8px; }
.ticket-code { font-family: Outfit, sans-serif; font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.ticket-when {
    margin-left: auto;
    font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums;
    color: #8A93AB;
}
.ticket.late .ticket-when   { color: #FFB020; }
.ticket.urgent .ticket-when { color: #FF4D5E; }

.ticket-tags { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 14px 10px; }
.ticket-tags .chip { background: rgba(255,255,255,.08); color: #C6CDDD; font-size: 11.5px; }

.ticket-items { padding: 0 14px 12px; display: grid; gap: 8px; }
.ti { display: flex; gap: 10px; font-size: 15px; line-height: 1.35; }
.ti b {
    flex: none; min-width: 26px; height: 24px;
    display: grid; place-items: center;
    border-radius: 7px; background: rgba(255,255,255,.1);
    font-size: 13.5px; font-weight: 700;
}
.ti .mods { display: block; font-size: 13px; color: #8A93AB; margin-top: 2px; }
.ti .note { display: block; font-size: 13px; color: #FFB020; margin-top: 2px; }

.ticket-foot { display: flex; gap: 8px; padding: 10px 14px 13px; border-top: 1px solid rgba(255,255,255,.07); }
.ticket-foot .btn { flex: 1; background: #1F2637; border-color: rgba(255,255,255,.12); color: #F2F4F9; }
.ticket-foot .btn:hover { background: #28304a; }
.ticket-foot .btn-go {
    color: #08121C;
    background: linear-gradient(140deg, #29D07E, #7BE3A8);
    border-color: transparent;
    font-weight: 700;
}

.kds-empty {
    display: grid; justify-items: center; gap: 8px;
    padding: 40px 16px; text-align: center;
    color: #5E6883; font-size: 14px;
}
.kds-empty .big { font-size: 34px; opacity: .5; }

/* acceso rapido dentro del KDS */
.kds-gate {
    position: fixed; inset: 0; z-index: 50;
    display: grid; place-items: center;
    background: #0A0C12;
}
.kds-gate .box {
    width: min(380px, 92vw);
    display: grid; gap: 14px;
    padding: 28px;
    background: #11141D;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 18px;
}
.kds-gate h2 { font-size: 20px; }
.kds-gate .input { background: #0D1018; border-color: rgba(255,255,255,.14); color: #fff; }

/* ==========================================================================
   Punto de venta (POS)
   ========================================================================== */

body.pos { height: 100vh; overflow: hidden; }

.pos-shell { display: grid; grid-template-columns: 1fr 390px; height: 100vh; }

.pos-main { display: flex; flex-direction: column; min-width: 0; }

.pos-bar {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 18px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}
.pos-bar h1 { font-size: 18px; font-weight: 700; }
.pos-bar .sub { font-size: 12.5px; color: var(--ink-3); }

.pos-cats { display: flex; gap: 8px; padding: 12px 18px; overflow-x: auto; flex: none; }
.pos-cats::-webkit-scrollbar { display: none; }
.pos-cat {
    flex: none;
    padding: 9px 16px;
    border-radius: 99px;
    border: 1px solid var(--line-strong);
    background: var(--panel);
    font-size: 14px; font-weight: 600; color: var(--ink-2);
    white-space: nowrap;
    transition: all .18s var(--ease);
}
.pos-cat.on {
    background: var(--brand); border-color: transparent; color: var(--brand-ink);
    box-shadow: 0 6px 16px color-mix(in srgb, var(--brand) 32%, transparent);
}

.pos-grid {
    flex: 1; min-height: 0;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    gap: 12px;
    padding: 6px 18px 20px;
    align-content: start;
}

.pos-item {
    border-radius: var(--r);
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-xs);
    text-align: left;
    transition: transform .16s var(--ease), border-color .18s, box-shadow .18s;
}
.pos-item:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.pos-item:active { transform: scale(.97); }
.pos-item img { width: 100%; height: 96px; object-fit: cover; background: var(--bg); }
.pos-item .b { padding: 9px 11px 11px; display: grid; gap: 3px; }
.pos-item .b strong { font-size: 13.5px; font-weight: 600; line-height: 1.25; }
.pos-item .b span { font-family: Outfit, sans-serif; font-size: 15px; font-weight: 700; }
.pos-item.off { opacity: .45; pointer-events: none; }

/* --- ticket --- */

.pos-ticket {
    display: flex; flex-direction: column;
    background: var(--panel);
    border-left: 1px solid var(--line);
    min-height: 0;
}
.pos-ticket-head {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.pos-ticket-head h2 { font-size: 16px; }

.pos-lines { flex: 1; overflow-y: auto; padding: 8px 14px; }
.pos-line {
    display: grid; grid-template-columns: 1fr auto; gap: 4px 10px;
    padding: 10px 6px;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
}
.pos-line .nm { font-weight: 600; }
.pos-line .mods { grid-column: 1 / -1; font-size: 12px; color: var(--ink-3); }
.pos-line .amt { font-variant-numeric: tabular-nums; font-weight: 650; text-align: right; }
.pos-line .ctl { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.pos-step {
    width: 28px; height: 28px; border-radius: 8px;
    border: 1px solid var(--line-strong); background: var(--panel);
    font-size: 16px; line-height: 1; display: grid; place-items: center;
}
.pos-step:hover { background: var(--bg); }
.pos-qty { min-width: 26px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

.pos-foot { padding: 14px 18px 18px; border-top: 1px solid var(--line); background: var(--panel-2); display: grid; gap: 10px; }
.pos-total { display: flex; justify-content: space-between; align-items: baseline; }
.pos-total span { font-size: 13.5px; color: var(--ink-3); }
.pos-total b { font-family: Outfit, sans-serif; font-size: 28px; font-weight: 800; letter-spacing: -.03em; }
.pos-pay { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pos-pay .btn { flex-direction: column; height: 58px; gap: 2px; font-size: 12.5px; }
.pos-pay .btn .ic { font-size: 18px; }
.pos-pay .btn.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }

@media (max-width: 1000px) {
    .pos-shell { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
    .pos-ticket { border-left: 0; border-top: 1px solid var(--line); max-height: 46vh; }
    .kds-board { grid-template-columns: 1fr; height: auto; }
    body.kds { overflow: auto; height: auto; }
}
