/* =========================================================
   Colinas del Río · Sistema de diseño
   Verde bosque + crema + dorado, con azul río. Inter (UI) y Fredoka (marca)
   ========================================================= */
:root {
  --bg: #f4f1ea;
  --surface: #ffffff;
  --surface-2: #faf8f4;
  --surface-3: #f1ede4;
  --line: #e7e1d5;
  --line-2: #d8d0c0;
  --text: #17201c;
  --text-2: #46514b;
  --muted: #7d857f;
  --brand: #1e4a37;        /* verde bosque */
  --brand-2: #2b634b;
  --brand-50: #e8f1ec;
  --brand-100: #d3e5db;
  --gold: #a87a33;         /* dorado / latón */
  --gold-2: #c69a52;
  --gold-50: #f7efe1;
  --sky: #2f7a8c;          /* azul río */
  --sky-50: #e4f1f3;
  --danger: #b23b2b;
  --danger-50: #fbecea;
  --warn: #a8690f;
  --warn-50: #fbf1e0;
  --info: #285e93;
  --info-50: #e7f0f9;
  --ok: #26734d;
  --ok-50: #e4f3ea;
  --rail: #11231b;
  --rail-2: #1a3127;
  --rail-text: #a9bab1;
  --ring: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent);
  --sh-1: 0 1px 2px rgba(23, 32, 28, .05);
  --sh-2: 0 1px 2px rgba(23, 32, 28, .04), 0 6px 20px -6px rgba(23, 32, 28, .10);
  --sh-3: 0 24px 60px -12px rgba(17, 35, 27, .35);
  --r-sm: 10px; --r: 14px; --r-lg: 20px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Fredoka", "Inter", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    --bg: #0f1613; --surface: #17201c; --surface-2: #1c2622; --surface-3: #222d28; --line: #2a3530; --line-2: #36433d;
    --text: #edf0ec; --text-2: #c3cbc6; --muted: #8b968f;
    --brand: #4fa37b; --brand-2: #63b48d; --brand-50: #18302a; --brand-100: #1f3d33;
    --gold: #d2a560; --gold-2: #e0b878; --gold-50: #2c2618; --sky: #6ab3c4; --sky-50: #16303a;
    --danger: #ec6b5a; --danger-50: #351c18; --warn: #e3a447; --warn-50: #33270f; --info: #6aa5e0; --info-50: #172a3d; --ok: #57b886; --ok-50: #16301f;
    --rail: #0a120e; --rail-2: #14211b;
    --sh-1: 0 1px 2px rgba(0,0,0,.4); --sh-2: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -8px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
/* Pantalla de cocina: siempre oscura (mejor en cocina, menos reflejo) */
body.kds {
  --bg: #0c1210; --surface: #151d19; --surface-2: #1a241f; --surface-3: #212c27; --line: #26322c; --line-2: #33413a;
  --text: #f1f4f1; --text-2: #c9d2cc; --muted: #84918a;
  --brand: #4fa37b; --brand-2: #63b48d; --brand-50: #17302a; --brand-100: #1f3d33;
  --gold: #d9ad66; --gold-2: #e6c07f; --gold-50: #2c2618; --sky: #6ab3c4; --sky-50: #16303a;
  --danger: #f07060; --danger-50: #3a1d18; --warn: #f0b250; --warn-50: #35290f;
  --info: #6fa9e6; --info-50: #162a3e; --ok: #5cc08e; --ok-50: #15301f;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; font-feature-settings: "cv11", "ss01";
}
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.01em; color: var(--text); }
h1 { font-family: var(--display); font-weight: 600; font-size: 1.95rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0; }
a { color: var(--brand); }
svg.i { width: 1.15em; height: 1.15em; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: .85rem; }
.xs { font-size: .75rem; }
.hidden { display: none !important; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: .75rem; }
.spread { justify-content: space-between; }
.grow { flex: 1; }
.right { text-align: right; }
.center { text-align: center; }
.num, .money { font-variant-numeric: tabular-nums; }
.money { font-weight: 650; letter-spacing: -.01em; }
.eyebrow { font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.divider { height: 1px; background: var(--line); margin: .9rem 0; border: 0; }

/* ---------- Estructura de la app ---------- */
.app { display: grid; grid-template-columns: 92px minmax(0, 1fr); min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; background: var(--rail); color: var(--rail-text);
  display: flex; flex-direction: column; align-items: center; padding: 1rem 0 .9rem; gap: .35rem; z-index: 30;
  background-image: radial-gradient(120% 60% at 0% 0%, rgba(198,154,82,.10), transparent 60%);
}
.rail .logo { margin-bottom: 1rem; }
.rail .lb { width: 54px; height: 54px; }
.rail a.nav {
  width: 72px; padding: .6rem 0 .5rem; border-radius: 14px; display: flex; flex-direction: column; align-items: center; gap: .3rem;
  color: var(--rail-text); text-decoration: none; font-size: .7rem; font-weight: 600; letter-spacing: .02em; position: relative; transition: background .15s, color .15s;
}
.rail a.nav svg { width: 22px; height: 22px; }
.rail a.nav:hover { background: rgba(255,255,255,.05); color: #fff; }
.rail a.nav.on { background: var(--rail-2); color: #fff; }
.rail a.nav.on::before { content: ''; position: absolute; left: -10px; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold-2); }
.rail .sp { flex: 1; }
.rail .me { display: flex; flex-direction: column; align-items: center; gap: .45rem; }
.rail .out { background: transparent; border: 0; color: var(--rail-text); min-height: 0; padding: .45rem; border-radius: 10px; }
.rail .out:hover { color: #fff; background: rgba(255,255,255,.06); }
.main { min-width: 0; display: flex; flex-direction: column; }
.page { width: 100%; max-width: 1320px; margin: 0 auto; padding: 1.75rem 2rem 2.5rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-head .sub { color: var(--muted); margin-top: .3rem; max-width: 640px; }
.page-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .rail { position: sticky; top: 0; height: auto; flex-direction: row; padding: .5rem .75rem; gap: .25rem; overflow-x: auto; scrollbar-width: none; }
  .rail .logo { margin: 0 .4rem 0 0; }
  .rail .lb { width: 40px; height: 40px; }
  .rail a.nav { width: auto; flex-direction: row; padding: .45rem .7rem; font-size: .8rem; }
  .rail a.nav.on::before { display: none; }
  .rail .sp { flex: 1; }
  .rail .me { flex-direction: row; }
  .rail .me .avatar { display: none; }
  .page { padding: 1.1rem 1rem 2rem; }
  h1 { font-size: 1.5rem; }
}
@media (max-width: 480px) {
  .rail a.nav span { display: none; }
  .rail a.nav svg { width: 24px; height: 24px; }
}

/* ---------- Marca ---------- */
.logo { display: inline-flex; align-items: center; gap: .7rem; text-decoration: none; color: inherit; }
.lb { width: 44px; height: 44px; border-radius: 50%; background: #fbf4ea; display: grid; place-items: center; flex: none; box-shadow: 0 0 0 2px rgba(255,255,255,.06), 0 4px 12px -4px rgba(0,0,0,.35); overflow: hidden; }
.lb img { width: 94%; height: 94%; object-fit: contain; display: block; }
.logo .wm { font-family: var(--display); font-weight: 700; font-size: 1.2rem; letter-spacing: 0; line-height: 1.05; }
.logo .wm small { display: block; font-family: var(--font); font-size: .66rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); margin-top: .15rem; }

/* ---------- Botones ---------- */
button, .btn {
  font: inherit; font-weight: 600; font-size: .92rem; border: 1px solid var(--line-2); background: var(--surface); color: var(--text);
  border-radius: var(--r-sm); padding: .55rem 1rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 42px; text-decoration: none; transition: background .15s, border-color .15s, box-shadow .15s, transform .06s; box-shadow: var(--sh-1); white-space: nowrap;
}
button:hover, .btn:hover { border-color: color-mix(in srgb, var(--text) 25%, var(--line-2)); }
button:active { transform: translateY(1px); }
button:focus-visible, .btn:focus-visible, input:focus-visible { outline: none; box-shadow: var(--ring); }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 1px 0 rgba(255,255,255,.12) inset, 0 6px 14px -6px color-mix(in srgb, var(--brand) 70%, transparent); }
.btn-primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #fff; box-shadow: 0 6px 14px -6px color-mix(in srgb, var(--gold) 80%, transparent); }
.btn-gold:hover { background: var(--gold-2); border-color: var(--gold-2); }
.btn-soft { background: var(--brand-50); border-color: transparent; color: var(--brand); box-shadow: none; }
.btn-soft:hover { background: var(--brand-100); border-color: transparent; }
.btn-danger { color: var(--danger); background: var(--surface); }
.btn-danger:hover { background: var(--danger-50); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn-lg { min-height: 54px; font-size: 1.02rem; padding: .8rem 1.4rem; border-radius: 13px; }
.btn-sm { min-height: 34px; padding: .3rem .7rem; font-size: .83rem; border-radius: 9px; }
.btn-icon { min-height: 38px; width: 38px; padding: 0; }
.btn-block { width: 100%; }

/* ---------- Formularios ---------- */
input, select, textarea {
  font: inherit; width: 100%; padding: .6rem .8rem; border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text); min-height: 44px; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
input::placeholder, textarea::placeholder { color: var(--muted); }
textarea { min-height: 80px; resize: vertical; }
label { display: block; font-size: .8rem; font-weight: 600; color: var(--text-2); margin: .85rem 0 .35rem; }
label.check { display: flex; align-items: center; gap: .6rem; color: var(--text); font-size: .93rem; font-weight: 500; margin: .7rem 0; }
label.check input { width: 20px; height: 20px; min-height: 0; accent-color: var(--brand); }
.input-icon { position: relative; }
.input-icon svg { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-icon input { padding-left: 2.4rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 1rem; }
@media (max-width: 620px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.hint { font-size: .8rem; color: var(--muted); margin-top: .35rem; }

/* ---------- Tarjetas ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-2); }
.card-pad { padding: 1.25rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.card-head h3 { display: flex; align-items: center; gap: .55rem; }
.card-head h3 svg { color: var(--gold); }
.card-body { padding: 1.1rem 1.25rem; }
.gap { display: grid; gap: 1rem; }
.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.cols-3-2 { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1rem; align-items: start; }
@media (max-width: 980px) { .cols-2, .cols-3-2 { grid-template-columns: 1fr; } }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.kpi { padding: 1.1rem 1.2rem; display: flex; flex-direction: column; gap: .6rem; position: relative; overflow: hidden; }
.kpi .top { display: flex; align-items: center; justify-content: space-between; }
.kpi .l { color: var(--muted); font-size: .8rem; font-weight: 600; }
.kpi .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.kpi .ic.gold { background: var(--gold-50); color: var(--gold); }
.kpi .ic.info { background: var(--info-50); color: var(--info); }
.kpi .ic.warn { background: var(--warn-50); color: var(--warn); }
.kpi .ic.danger { background: var(--danger-50); color: var(--danger); }
.kpi .v { font-size: 1.7rem; font-weight: 750; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi.hero { background: linear-gradient(135deg, var(--brand) 0%, #173a2b 100%); border-color: transparent; color: #fff; }
.kpi.hero .l { color: rgba(255,255,255,.7); }
.kpi.hero .ic { background: rgba(255,255,255,.12); color: #f3dcb1; }
.kpi.hero .v { color: #fff; }
.kpi.hero::after { content: ''; position: absolute; right: -30px; bottom: -40px; width: 140px; height: 140px; border-radius: 50%; border: 18px solid rgba(255,255,255,.05); }

/* ---------- Estados ---------- */
.pill { display: inline-flex; align-items: center; gap: .4rem; padding: .22rem .65rem .22rem .55rem; border-radius: 999px; font-size: .76rem; font-weight: 650; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .9; }
.pill.plain::before { display: none; }
.st-en_espera, .pill.warn { background: var(--warn-50); color: var(--warn); }
.st-en_preparacion, .pill.info { background: var(--info-50); color: var(--info); }
.st-listo, .pill.ok { background: var(--ok-50); color: var(--ok); }
.st-entregado, .st-cancelado, .st-sin_pedidos, .pill.mute { background: var(--surface-3); color: var(--muted); }
.pill.danger { background: var(--danger-50); color: var(--danger); }
.pill.gold { background: var(--gold-50); color: var(--gold); }
.st-en_preparacion::before { animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* ---------- Pestañas / segmentado ---------- */
.seg { display: inline-flex; padding: 4px; gap: 2px; background: var(--surface-3); border-radius: 12px; border: 1px solid var(--line); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg button { background: transparent; border: 0; box-shadow: none; min-height: 36px; padding: .35rem .9rem; border-radius: 9px; color: var(--text-2); font-weight: 600; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--sh-1), 0 0 0 1px var(--line); }
.chips { display: flex; gap: .45rem; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; flex-wrap: nowrap; }
.chip { min-height: 40px; border-radius: 999px; padding: .4rem .95rem; box-shadow: none; background: var(--surface); color: var(--text-2); }
.chip.on { background: var(--text); color: var(--surface); border-color: var(--text); }
.chip .ct { font-size: .72rem; opacity: .6; font-weight: 700; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: .7rem 1.25rem; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: .8rem 1.25rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data .right { text-align: right; }
table.data.compact td, table.data.compact th { padding: .55rem 1rem; }
.cell-main { display: flex; align-items: center; gap: .8rem; }
.cell-main b { font-weight: 650; }

/* ---------- Avatar / miniatura ---------- */
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem; color: #fff; flex: none; letter-spacing: .02em; }
.thumb { width: 48px; height: 48px; border-radius: 12px; object-fit: cover; flex: none; display: grid; place-items: center; font-family: var(--display); font-weight: 600; color: var(--brand); background: var(--brand-50); }

/* ---------- Interruptor ---------- */
.switch { position: relative; width: 46px; height: 26px; flex: none; display: inline-block; margin: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line-2); border-radius: 999px; transition: .2s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::before { transform: translateX(20px); }
.switch input:focus-visible + span { box-shadow: var(--ring); }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(9, 18, 14, .55); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 1rem; animation: fade .15s ease; }
.modal { background: var(--surface); border-radius: 22px; width: 100%; max-width: 540px; max-height: 92vh; overflow: auto; padding: 1.5rem 1.5rem 0; box-shadow: var(--sh-3); position: relative; animation: pop .18s cubic-bezier(.2,.9,.3,1.2); border: 1px solid var(--line); }
.modal.wide { max-width: 780px; }
.modal > h2:first-of-type { font-family: var(--display); font-size: 1.5rem; font-weight: 600; padding-right: 2.5rem; margin-bottom: .35rem; }
.modal .m-close { position: absolute; top: 1rem; right: 1rem; }
.modal .actions { position: sticky; bottom: 0; display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; margin: 1.4rem -1.5rem 0; padding: 1rem 1.5rem; background: var(--surface); border-top: 1px solid var(--line); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@media (max-width: 600px) {
  .modal-bg { align-items: flex-end; padding: 0; }
  .modal { border-radius: 22px 22px 0 0; max-height: 94vh; }
}

/* ---------- Toast ---------- */
#toast { position: fixed; left: 50%; bottom: 1.4rem; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: .5rem; align-items: center; pointer-events: none; }
#toast div { display: flex; align-items: center; gap: .6rem; background: #14211b; color: #f1f4f1; padding: .75rem 1.1rem; border-radius: 12px; box-shadow: var(--sh-3); max-width: 92vw; font-weight: 500; animation: pop .2s ease; }
#toast div svg { color: #7fd1a6; }
#toast div.err { background: #3a1410; }
#toast div.err svg { color: #ff9b8c; }

/* ---------- Vacío ---------- */
.empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.empty .ei { width: 52px; height: 52px; border-radius: 16px; background: var(--surface-3); display: grid; place-items: center; color: var(--muted); }
.empty .ei svg { width: 24px; height: 24px; }
.empty b { color: var(--text-2); }

/* ---------- Barras ---------- */
.bars { display: flex; flex-direction: column; gap: .7rem; }
.bars .b { display: grid; grid-template-columns: minmax(0, 38%) 1fr auto; align-items: center; gap: .8rem; font-size: .9rem; }
.bars .b .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.bars .track { height: 8px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.bars .fill { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--brand-2), var(--brand)); }
.bars .b:first-child .fill { background: linear-gradient(90deg, var(--gold-2), var(--gold)); }

/* ---------- Impresión de tiquetes (navegador) ---------- */
#print-area { display: none; }
@media print {
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block !important; }
  @page { margin: 0; }
}
.ticket { font-family: "Courier New", ui-monospace, monospace; font-size: 12px; color: #000; background: #fff; padding: 2mm 3mm; white-space: pre; line-height: 1.25; page-break-after: always; }
.ticket .c { text-align: center; } .ticket .r { text-align: right; }
.ticket .b { font-weight: bold; } .ticket .big { font-size: 1.5em; }
.ticket .sep { border-top: 1px dashed #000; margin: 3px 0; height: 0; }
.ticket.w58 { width: 58mm; font-size: 10.5px; } .ticket.w80 { width: 80mm; }

/* utilidades de grid */
.menu-layout > *, .grid2 > *, .cols > *, .cols-2 > *, .cols-3-2 > * { min-width: 0; }

.pill.sky { background: var(--sky-50); color: var(--sky); }
.kpi .ic.sky { background: var(--sky-50); color: var(--sky); }


/* ---------- App instalada (iPhone/Android): pantalla fija ---------- */
/* 'clip' corta lo que sobra a los lados sin volver la página una caja con su propio desplazamiento (no rompe el menú fijo) */
html, body { overflow-x: clip; overscroll-behavior-x: none; }
body { -webkit-text-size-adjust: 100%; touch-action: manipulation; }
/* iPhone acerca la pantalla si una casilla tiene letra menor a 16 px: se evita en celular */
@media (max-width: 760px) { input, select, textarea { font-size: 16px !important; } }
