/* ==========================================================================
   Ordena · sistema visual para panel, cocina, POS y pedido por QR.
   (El kiosco tiene su propio archivo porque vive en un lienzo fijo.)
   ========================================================================== */

:root {
    --brand:       #FF5A2B;
    --brand-2:     #FFC043;
    --brand-ink:   #ffffff;
    --brand-soft:  color-mix(in srgb, var(--brand) 12%, #fff);

    --bg:          #F6F7FB;
    --panel:       #FFFFFF;
    --panel-2:     #FBFCFE;
    --line:        #E4E8F0;
    --line-strong: #CFD6E4;

    --ink:         #10131C;
    --ink-2:       #48506A;
    --ink-3:       #8B93AB;

    --ok:          #129D62;
    --ok-bg:       #E4F7EE;
    --warn:        #B8770A;
    --warn-bg:     #FFF3DC;
    --danger:      #D62B45;
    --danger-bg:   #FDE8EB;
    --info:        #2563EB;
    --info-bg:     #E7EFFE;

    --r-sm: 10px;
    --r:    14px;
    --r-lg: 20px;

    --shadow-xs: 0 1px 2px rgba(16, 19, 28, .06);
    --shadow:    0 6px 22px rgba(16, 19, 28, .09);
    --shadow-lg: 0 24px 60px rgba(16, 19, 28, .18);

    --ease: cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: var(--bg);
    color: var(--ink);
    font: 15px/1.55 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
img { display: block; max-width: 100%; }

h1, h2, h3, h4 { font-family: Outfit, Inter, sans-serif; letter-spacing: -.02em; line-height: 1.2; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

/* ------------------------------------------------------------- estructura */

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

.side {
    position: sticky; top: 0; align-self: start;
    height: 100vh;
    display: flex; flex-direction: column;
    padding: 20px 16px;
    background: var(--panel);
    border-right: 1px solid var(--line);
}

.side-brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 22px; }
.side-brand .mark {
    width: 38px; height: 38px; border-radius: 11px;
    display: grid; place-items: center;
    font-family: Outfit, sans-serif; font-weight: 800; font-size: 19px;
    color: var(--brand-ink);
    background: linear-gradient(140deg, var(--brand), var(--brand-2));
    flex: none;
}
.side-brand b { font-family: Outfit, sans-serif; font-size: 18px; font-weight: 700; display: block; }
.side-brand span { font-size: 12px; color: var(--ink-3); }

.nav { display: grid; gap: 2px; }
.nav a, .nav button {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 12px;
    border-radius: var(--r-sm);
    font-size: 14.5px; font-weight: 500;
    color: var(--ink-2);
    text-decoration: none;
    width: 100%; text-align: left;
    transition: background .18s var(--ease), color .18s var(--ease);
}
.nav a:hover, .nav button:hover { background: var(--bg); color: var(--ink); }
.nav .on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav .ico { width: 20px; text-align: center; font-size: 16px; }
.nav .tally {
    margin-left: auto;
    min-width: 22px; padding: 1px 7px;
    border-radius: 99px;
    background: var(--danger); color: #fff;
    font-size: 11.5px; font-weight: 700; text-align: center;
}

.nav-group { margin-top: 20px; }
.nav-group > p {
    padding: 0 12px 7px;
    font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
    color: var(--ink-3);
}

.side-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); }

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

.topbar-app {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 14px;
    padding: 14px 26px;
    background: rgba(255, 255, 255, .86);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}
.topbar-app h1 { font-size: 21px; font-weight: 700; }
.topbar-app .sub { font-size: 13px; color: var(--ink-3); }
.grow { margin-left: auto; }

.page { padding: 26px; display: grid; gap: 20px; align-content: start; }
.page.wide { max-width: none; }

/* ------------------------------------------------------------------ carta */

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-xs);
}
.card-head {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
}
.card-head h2 { font-size: 16px; font-weight: 650; }
.card-head p { font-size: 13px; color: var(--ink-3); }
.card-body { padding: 20px; }
.card-body.tight { padding: 12px; }

/* --------------------------------------------------------------- botones */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 40px; padding: 0 16px;
    border-radius: var(--r-sm);
    border: 1px solid var(--line-strong);
    background: var(--panel);
    font-size: 14px; font-weight: 600;
    white-space: nowrap;
    transition: transform .14s var(--ease), background .18s, border-color .18s, box-shadow .18s;
}
.btn:hover { background: var(--bg); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; pointer-events: none; }

.btn-primary {
    color: var(--brand-ink);
    background: linear-gradient(140deg, var(--brand), var(--brand-2));
    border-color: transparent;
    box-shadow: 0 6px 16px color-mix(in srgb, var(--brand) 30%, transparent);
}
.btn-primary:hover { filter: brightness(1.04); background: linear-gradient(140deg, var(--brand), var(--brand-2)); }
.btn-ghost  { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); background: var(--danger-bg); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; padding: 0; }

/* -------------------------------------------------------------- formulario */

.field { display: grid; gap: 6px; }
.field > label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--ink-3); }

.input, .select, .textarea {
    width: 100%;
    height: 40px; padding: 0 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    background: var(--panel);
    font-size: 14.5px;
    transition: border-color .16s, box-shadow .16s;
}
.textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 32px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 4.5 6 8.5 10 4.5' fill='none' stroke='%238B93AB' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 11px center; background-size: 12px;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}
.input[type="color"] { padding: 4px; height: 40px; cursor: pointer; }

.row { display: grid; gap: 14px; }
.row.c2 { grid-template-columns: 1fr 1fr; }
.row.c3 { grid-template-columns: repeat(3, 1fr); }
.row.c4 { grid-template-columns: repeat(4, 1fr); }

.check { display: flex; align-items: center; gap: 9px; font-size: 14px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); cursor: pointer; }

/* ---------------------------------------------------------------- tablas */

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
    text-align: left; font-size: 11.5px; font-weight: 700;
    letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3);
    padding: 10px 14px; border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--panel-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .thumb { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; background: var(--bg); }

/* ------------------------------------------------------------- etiquetas */

.chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 12px; font-weight: 650;
    background: var(--bg); color: var(--ink-2);
    white-space: nowrap;
}
.chip.ok      { background: var(--ok-bg);     color: var(--ok); }
.chip.warn    { background: var(--warn-bg);   color: var(--warn); }
.chip.danger  { background: var(--danger-bg); color: var(--danger); }
.chip.info    { background: var(--info-bg);   color: var(--info); }
.chip.brand   { background: var(--brand-soft); color: var(--brand); }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ------------------------------------------------------------------- KPI */

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.kpi {
    padding: 16px 18px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-xs);
}
.kpi .label { font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.kpi .value {
    font-family: Outfit, sans-serif; font-size: 30px; font-weight: 750;
    letter-spacing: -.03em; margin-top: 4px;
    font-variant-numeric: tabular-nums;
}
.kpi .foot { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }

/* ------------------------------------------------------------- grafico -- */

.chart { width: 100%; height: 190px; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--ink-2); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; }

.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 1fr 52px; align-items: center; gap: 12px; font-size: 13.5px; }
.bar-row .track { height: 9px; border-radius: 99px; background: var(--bg); overflow: hidden; }
.bar-row .track i {
    display: block; height: 100%; border-radius: 99px;
    background: linear-gradient(90deg, var(--brand), var(--brand-2));
    transition: width .6s var(--ease);
}
.bar-row .cap { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 600; }

/* ------------------------------------------------------------- dialogos -- */

.modal-scrim {
    position: fixed; inset: 0; z-index: 90;
    display: grid; place-items: center;
    padding: 24px;
    background: rgba(16, 19, 28, .5);
    backdrop-filter: blur(3px);
    animation: fade .2s var(--ease);
}
@keyframes fade { from { opacity: 0; } }

.modal {
    width: min(720px, 100%);
    max-height: calc(100vh - 48px);
    display: flex; flex-direction: column;
    background: var(--panel);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    animation: rise .34s var(--ease);
    overflow: hidden;
}
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.985); } }

.modal-head {
    display: flex; align-items: center; gap: 12px;
    padding: 18px 22px; border-bottom: 1px solid var(--line);
}
.modal-head h2 { font-size: 18px; font-weight: 700; }
.modal-body { padding: 22px; overflow-y: auto; display: grid; gap: 16px; }
.modal-foot {
    display: flex; gap: 10px; justify-content: flex-end;
    padding: 16px 22px; border-top: 1px solid var(--line); background: var(--panel-2);
}

/* ---------------------------------------------------------------- avisos */

#flash {
    position: fixed; right: 20px; bottom: 20px; z-index: 120;
    display: grid; gap: 10px; justify-items: end;
}
.flash {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px;
    border-radius: var(--r);
    background: var(--ink); color: #fff;
    font-size: 14px; font-weight: 550;
    box-shadow: var(--shadow-lg);
    animation: slideIn .32s var(--ease);
    max-width: 380px;
}
.flash.err { background: var(--danger); }
.flash.ok  { background: var(--ok); }
@keyframes slideIn { from { opacity: 0; transform: translateX(24px); } }

.empty-state {
    display: grid; justify-items: center; gap: 10px;
    padding: 56px 20px; text-align: center; color: var(--ink-3);
}
.empty-state .big { font-size: 42px; opacity: .55; }
.empty-state h3 { font-size: 17px; color: var(--ink-2); }

.loader {
    width: 22px; height: 22px; border-radius: 50%;
    border: 3px solid var(--line); border-top-color: var(--brand);
    animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-block { display: grid; place-items: center; padding: 60px; }

/* --------------------------------------------------------------- acceso -- */

.auth-wrap {
    min-height: 100vh;
    display: grid; grid-template-columns: 1fr 1fr;
}
.auth-art {
    position: relative;
    display: grid; align-content: center; gap: 18px;
    padding: 56px;
    color: #fff;
    background: linear-gradient(150deg, #10131C, #1B2130);
    overflow: hidden;
}
.auth-art::after {
    content: ''; position: absolute; inset: auto -20% -40% -20%; height: 70%;
    background: radial-gradient(60% 100% at 50% 100%,
                color-mix(in srgb, var(--brand) 55%, transparent), transparent 70%);
}
.auth-art > * { position: relative; z-index: 2; }
.auth-art h2 { font-size: 40px; font-weight: 800; letter-spacing: -.035em; }
.auth-art p { color: #A8B0C2; font-size: 16px; max-width: 420px; }

.auth-form { display: grid; align-content: center; justify-items: stretch; padding: 56px; }
.auth-form .inner { width: min(380px, 100%); margin: 0 auto; display: grid; gap: 16px; }

.demo-user {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--line); border-radius: var(--r-sm);
    background: var(--panel-2);
    font-size: 13px; text-align: left; width: 100%;
}
.demo-user:hover { border-color: var(--brand); }
.demo-user b { display: block; font-size: 13.5px; }
.demo-user span { color: var(--ink-3); font-size: 12px; }

@media (max-width: 900px) {
    .auth-wrap { grid-template-columns: 1fr; }
    .auth-art { display: none; }
    .shell { grid-template-columns: 1fr; }
    .side {
        position: static; height: auto; flex-direction: row; align-items: center;
        overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line);
    }
    .side-brand { padding: 6px 10px 6px 4px; }
    .nav { grid-auto-flow: column; gap: 4px; }
    .nav-group { margin-top: 0; }
    .nav-group > p { display: none; }
    .side-foot { margin-top: 0; padding-top: 0; border-top: 0; margin-left: auto; }
    .row.c2, .row.c3, .row.c4 { grid-template-columns: 1fr; }
    .page { padding: 16px; }
}
