/* ==========================================================
   ComandaX · POS para restaurantes — sistema de diseño
   Tablet y celular primero. Sin dependencias externas.
   ========================================================== */
:root{
  /* marca: chile · mostaza · albahaca · crema · café */
  --primary:#CC3B13; --primary-d:color-mix(in srgb,var(--primary) 82%,#000); --primary-t:#fff;
  --primary-s:color-mix(in srgb,var(--primary) 11%,var(--surface));
  --accent:#F2A93B;
  --bg:#FAF5EC; --surface:#fff; --surface2:#F3EBDD; --text:#2B1D14; --muted:#7A6A5C; --line:#E8DCCB;
  --ok:#447A1E; --warn:#C98200; --err:#B3261E; --info:#2D6A8F;
  --ok-s:color-mix(in srgb,var(--ok) 13%,var(--surface)); --warn-s:color-mix(in srgb,var(--accent) 24%,var(--surface));
  --err-s:color-mix(in srgb,var(--err) 11%,var(--surface)); --info-s:color-mix(in srgb,var(--info) 12%,var(--surface));
  --radius:16px; --radius-s:12px;
  --shadow:0 1px 2px rgba(60,35,15,.06),0 4px 14px rgba(60,35,15,.06);
  --shadow-l:0 10px 34px rgba(60,35,15,.2);
  --top-h:56px; --tab-h:64px; --rail-w:84px;
  --sat:env(safe-area-inset-top,0px); --sab:env(safe-area-inset-bottom,0px);
  --font:ui-rounded,"SF Pro Rounded","Segoe UI Variable Text","Segoe UI",system-ui,-apple-system,Roboto,sans-serif;
}
@media (prefers-color-scheme:dark){:root:not([data-theme=light]){
  --bg:#17110D; --surface:#231A14; --surface2:#2F241B; --text:#F6EBDD; --muted:#B3A08D; --line:#3D3025;
  --primary:#F2643A; --accent:#F2B04F; --ok:#8CC152; --warn:#F2B04F; --err:#F2766E; --info:#6DB3DE;
  --shadow:0 1px 2px rgba(0,0,0,.4),0 4px 14px rgba(0,0,0,.25); --shadow-l:0 10px 34px rgba(0,0,0,.55);
}}
:root[data-theme=dark]{
  --bg:#17110D; --surface:#231A14; --surface2:#2F241B; --text:#F6EBDD; --muted:#B3A08D; --line:#3D3025;
  --primary:#F2643A; --accent:#F2B04F; --ok:#8CC152; --warn:#F2B04F; --err:#F2766E; --info:#6DB3DE;
  --shadow:0 1px 2px rgba(0,0,0,.4),0 4px 14px rgba(0,0,0,.25); --shadow-l:0 10px 34px rgba(0,0,0,.55);
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--text);font:16px/1.4 var(--font);overscroll-behavior-y:contain;-webkit-font-smoothing:antialiased}
a{color:var(--primary);text-decoration:none}
h1,h2,h3{margin:0;line-height:1.2}
button{font-family:inherit}
.ico{width:1.35em;height:1.35em;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round;flex:none;vertical-align:middle}
.ico.fill{fill:currentColor;stroke:none}
.muted{color:var(--muted)} .small{font-size:.85rem} .right{text-align:right} .center{text-align:center}
.hide{display:none!important} .grow{flex:1} .row{display:flex;gap:10px;align-items:center} .wrap{flex-wrap:wrap}
.gap{margin-top:12px} .mt{margin-top:16px} .mb{margin-bottom:12px}
.num{font-variant-numeric:tabular-nums}

/* ---------- estructura: riel (tablet) / barra inferior (celular) ---------- */
.app{min-height:100vh;min-height:100dvh}
.shell{min-width:0;display:flex;flex-direction:column;min-height:100dvh}
.rail{display:none}
.topbar{position:sticky;top:0;z-index:20;display:flex;align-items:center;gap:10px;height:calc(var(--top-h) + var(--sat));padding:var(--sat) 12px 0 14px;background:color-mix(in srgb,var(--bg) 88%,transparent);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);border-bottom:1px solid var(--line)}
.topbar h1{font-size:1.2rem;font-weight:800;flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;letter-spacing:-.01em}
.topbar-actions{display:flex;gap:6px;align-items:center}
.brand-mark{flex:none;width:36px;height:36px;border-radius:11px;background:var(--primary);color:#fff;display:grid;place-items:center;font-weight:800;font-size:1.05rem;overflow:hidden}
.brand-mark img{width:100%;height:100%;object-fit:contain;background:#fff;padding:2px}
.brand-mark .ico{width:22px;height:22px}
.avatar{flex:none;width:40px;height:40px;border-radius:50%;border:2px solid var(--line);background:var(--surface);color:var(--text);font-weight:800;cursor:pointer;display:grid;place-items:center}
.avatar:active{background:var(--surface2)}
.icon-btn{border:0;background:transparent;color:var(--text);width:44px;height:44px;border-radius:12px;cursor:pointer;display:inline-grid;place-items:center}
.icon-btn:active{background:var(--surface2)}
.icon-btn .ico{width:24px;height:24px}
.page{flex:1;width:100%;max-width:1180px;margin:0 auto;padding:16px 14px calc(var(--tab-h) + var(--sab) + 20px)}

.tabbar{position:fixed;left:0;right:0;bottom:0;z-index:20;display:flex;height:calc(var(--tab-h) + var(--sab));padding-bottom:var(--sab);background:var(--surface);border-top:1px solid var(--line);box-shadow:0 -4px 18px rgba(60,35,15,.06)}
.tabbar a,.tabbar button{flex:1;position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;border:0;background:none;color:var(--muted);font-size:.7rem;font-weight:600;cursor:pointer}
.tabbar .ico{width:25px;height:25px}
.tabbar a.on{color:var(--primary)}
.tabbar a.on:before{content:"";position:absolute;top:0;width:34px;height:3px;border-radius:0 0 3px 3px;background:var(--primary)}

@media(min-width:768px){
  .app{display:grid;grid-template-columns:var(--rail-w) minmax(0,1fr)}
  .tabbar{display:none}
  .page{padding:20px 22px 40px}
  .rail{display:flex;flex-direction:column;align-items:stretch;gap:4px;position:sticky;top:0;height:100dvh;padding:calc(14px + var(--sat)) 8px calc(14px + var(--sab));background:var(--surface);border-right:1px solid var(--line)}
  .rail .brand-mark{width:48px;height:48px;border-radius:15px;margin:0 auto 12px;font-size:1.3rem}
  .rail .brand-mark .ico{width:28px;height:28px}
  .rail-name{display:none}
  .rail a,.rail button.rail-more{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;min-height:64px;padding:6px 2px;border-radius:14px;border:0;background:none;color:var(--muted);font-size:.7rem;font-weight:700;cursor:pointer;text-align:center;line-height:1.1}
  .rail .ico{width:26px;height:26px}
  .rail a:hover,.rail button.rail-more:hover{background:var(--surface2)}
  .rail a.on{background:var(--primary-s);color:var(--primary)}
  .rail .sp{flex:1}
  .topbar{padding-left:22px;padding-right:18px}
  .brand-mark.phone{display:none}
}
@media(min-width:1200px){
  :root{--rail-w:224px}
  .rail{padding-left:14px;padding-right:14px}
  .rail .brand-row{display:flex;align-items:center;gap:12px;margin-bottom:14px}
  .rail .brand-row .brand-mark{margin:0;width:44px;height:44px}
  .rail-name{display:block;min-width:0;font-weight:800;line-height:1.15}
  .rail-name small{display:block;font-weight:600;font-size:.72rem;color:var(--muted)}
  .rail a,.rail button.rail-more{flex-direction:row;justify-content:flex-start;gap:14px;min-height:54px;padding:0 14px;font-size:.98rem}
}

/* modo servicio: pantalla completa para tomar la orden */
body.pos-mode .topbar{display:none}
body.pos-mode .tabbar{display:none}
body.pos-mode .page{max-width:none;padding:0}

/* ---------- menú «Más» ---------- */
.overlay{position:fixed;inset:0;background:rgba(30,15,5,.5);opacity:0;pointer-events:none;transition:.2s;z-index:40}
.overlay.on{opacity:1;pointer-events:auto}
.drawer{position:fixed;top:0;bottom:0;right:0;width:min(88vw,340px);background:var(--surface);z-index:50;transform:translateX(104%);transition:transform .24s cubic-bezier(.3,.8,.3,1);display:flex;flex-direction:column;padding-top:var(--sat);box-shadow:var(--shadow-l)}
.drawer.on{transform:none}
.drawer-head{display:flex;align-items:center;gap:12px;padding:16px 14px;border-bottom:1px solid var(--line)}
.drawer-head>div:not(.brand-mark){flex:1;min-width:0} .drawer-head strong{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.drawer-head small{color:var(--muted)}
.drawer-nav{overflow:auto;padding:4px 10px calc(var(--sab) + 18px)}
.drawer-group{font-size:.7rem;font-weight:800;text-transform:uppercase;letter-spacing:.08em;color:var(--muted);padding:16px 10px 6px}
.drawer-nav a,.drawer-logout{display:flex;align-items:center;gap:14px;width:100%;min-height:50px;padding:0 12px;border-radius:13px;color:var(--text);font:inherit;font-weight:600;background:none;border:0;cursor:pointer;text-align:left}
.drawer-nav a.on{background:var(--primary-s);color:var(--primary)}
.drawer-nav a:active,.drawer-logout:active{background:var(--surface2)}
.drawer-nav .ico{color:var(--muted)} .drawer-nav a.on .ico{color:var(--primary)}
.drawer-foot{margin-top:18px;padding:12px;text-align:center;font-size:.75rem;color:var(--muted)}

/* ---------- botones ---------- */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:48px;padding:0 20px;border-radius:var(--radius-s);border:1.5px solid var(--line);background:var(--surface);color:var(--text);font:inherit;font-weight:700;cursor:pointer;text-align:center;user-select:none;-webkit-user-select:none;transition:transform .08s,background .15s}
.btn:active{transform:scale(.97)}
.btn.primary{background:var(--primary);border-color:var(--primary);color:var(--primary-t)}
.btn.primary:active{background:var(--primary-d)}
.btn.ok{background:var(--ok);border-color:var(--ok);color:#fff}
.btn.danger{background:var(--err);border-color:var(--err);color:#fff}
.btn.ghost{background:transparent}
.btn.soft{background:var(--surface2);border-color:transparent}
.btn.line-danger{color:var(--err);border-color:color-mix(in srgb,var(--err) 40%,var(--line))}
.btn.block{display:flex;width:100%} .btn.lg{min-height:58px;font-size:1.08rem;border-radius:14px} .btn.sm{min-height:40px;padding:0 13px;font-size:.9rem;border-radius:11px}
.btn.icon{padding:0;width:48px} .btn.sm.icon{width:40px}
.btn[disabled],.btn.disabled{opacity:.45;pointer-events:none}
.fab{position:fixed;right:18px;bottom:calc(var(--tab-h) + var(--sab) + 18px);z-index:15;width:60px;height:60px;border-radius:20px;border:0;background:var(--primary);color:#fff;box-shadow:0 8px 22px color-mix(in srgb,var(--primary) 45%,transparent);cursor:pointer;display:grid;place-items:center}
.fab .ico{width:28px;height:28px}
.fab:active{transform:scale(.94)}
@media(min-width:768px){.fab{bottom:26px;right:26px}}

/* ---------- tarjetas / listas ---------- */
.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:16px;box-shadow:var(--shadow)}
.card+.card{margin-top:12px}
.card h2{font-size:1.02rem;margin-bottom:10px}
.list{display:grid;grid-template-columns:1fr;gap:10px}
@media(min-width:768px){.list{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(min-width:1280px){.list{grid-template-columns:repeat(3,minmax(0,1fr))}}
.item{display:flex;gap:12px;align-items:center;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:12px;box-shadow:var(--shadow);min-width:0}
.item.click{cursor:pointer} .item.click:active{background:var(--surface2)}
.item .thumb{flex:none;width:54px;height:54px;border-radius:14px;background:var(--surface2);display:flex;align-items:center;justify-content:center;font-size:1.7rem;overflow:hidden;color:var(--muted)}
.item .thumb img{width:100%;height:100%;object-fit:cover}
.item .main{flex:1;min-width:0}
.item .t{font-weight:800;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.item .s{color:var(--muted);font-size:.88rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.item .meta{display:flex;gap:6px;flex-wrap:wrap;margin-top:4px}
.item .actions{display:flex;gap:6px;flex:none}
.item .price{font-weight:800;white-space:nowrap}
.badge{display:inline-flex;align-items:center;gap:4px;padding:2px 10px;border-radius:99px;font-size:.74rem;font-weight:700;background:var(--surface2);color:var(--muted)}
.badge.ok{background:var(--ok-s);color:var(--ok)}
.badge.warn{background:var(--warn-s);color:var(--warn)}
.badge.err{background:var(--err-s);color:var(--err)}
.badge.info{background:var(--info-s);color:var(--info)}
.empty{text-align:center;padding:56px 16px;color:var(--muted)} .empty .big{font-size:3rem;margin-bottom:6px}
.searchbar{display:flex;gap:8px;margin-bottom:12px;position:relative}
.searchbar input{flex:1;padding-left:42px}
.searchbar:before{content:"";position:absolute;left:14px;top:50%;width:18px;height:18px;margin-top:-9px;opacity:.5;pointer-events:none;background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23777' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='m16 16 4.5 4.5'/%3E%3C/svg%3E") center/contain no-repeat}
.pager{display:flex;justify-content:space-between;align-items:center;margin-top:16px;gap:8px}
.alert{padding:12px 14px;border-radius:var(--radius-s);margin-bottom:12px;font-weight:600}
.alert.err{background:var(--err-s);color:var(--err)}
.alert.ok{background:var(--ok-s);color:var(--ok)}
.alert.warn{background:var(--warn-s);color:var(--warn)}

/* ---------- formularios ---------- */
input,select,textarea{font:inherit;font-size:16px;color:var(--text);background:var(--surface);border:1.5px solid var(--line);border-radius:var(--radius-s);padding:11px 13px;min-height:48px;width:100%;appearance:none;-webkit-appearance:none}
select{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23999' stroke-width='2'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 14px center;padding-right:38px}
textarea{min-height:88px;resize:vertical}
input:focus,select:focus,textarea:focus{outline:3px solid color-mix(in srgb,var(--primary) 30%,transparent);border-color:var(--primary)}
.field{display:block;margin-bottom:14px}
.field>span{display:block;font-size:.84rem;font-weight:700;margin-bottom:6px;color:var(--muted)}
.field .err{color:var(--err);font-size:.82rem;margin-top:4px}
.field.bad input,.field.bad select,.field.bad textarea{border-color:var(--err)}
.form-grid{display:grid;grid-template-columns:1fr;gap:0 14px}
@media(min-width:600px){.form-grid{grid-template-columns:1fr 1fr}.form-grid .full{grid-column:1/-1}}
.form-section{font-weight:800;margin:16px 0 8px;padding-top:12px;border-top:1px solid var(--line)}
.switch-row{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px 0;border-bottom:1px solid var(--line)}
.switch{position:relative;width:54px;height:32px;flex:none}
.switch input{position:absolute;opacity:0;width:100%;height:100%;margin:0;cursor:pointer;z-index:1;min-height:0}
.switch i{position:absolute;inset:0;background:var(--line);border-radius:99px;transition:.15s}
.switch i:after{content:"";position:absolute;top:3px;left:3px;width:26px;height:26px;border-radius:50%;background:#fff;transition:.15s;box-shadow:0 1px 3px rgba(0,0,0,.3)}
.switch input:checked+i{background:var(--ok)} .switch input:checked+i:after{left:25px}
.chips{display:flex;gap:8px;overflow-x:auto;padding:2px 0 10px;scrollbar-width:none;-webkit-overflow-scrolling:touch}
.chips::-webkit-scrollbar{display:none}
.chip{flex:none;display:inline-flex;align-items:center;gap:7px;min-height:44px;padding:0 16px;border-radius:99px;border:1.5px solid var(--line);background:var(--surface);color:var(--text);font:inherit;font-weight:700;font-size:.95rem;cursor:pointer;white-space:nowrap}
.chip small{font-weight:800;opacity:.7}
.chip.on{background:var(--primary);border-color:var(--primary);color:#fff}
.seg{display:flex;background:var(--surface2);border-radius:14px;padding:4px;gap:4px}
.seg button{flex:1;min-height:44px;border:0;border-radius:11px;background:transparent;font:inherit;font-weight:700;color:var(--muted);cursor:pointer}
.seg button.on{background:var(--surface);color:var(--text);box-shadow:var(--shadow)}
.stepper{display:flex;align-items:center;gap:8px}
.stepper button{width:52px;height:52px;border-radius:14px;border:1.5px solid var(--line);background:var(--surface);font-size:1.5rem;font-weight:700;color:var(--text);cursor:pointer;display:grid;place-items:center}
.stepper button:active{background:var(--surface2)}
.stepper input{width:72px;text-align:center;font-weight:800;font-size:1.25rem;min-height:52px}
.swatches{display:flex;gap:10px;flex-wrap:wrap}
.swatch{width:42px;height:42px;border-radius:50%;border:3px solid transparent;cursor:pointer;background:var(--c,#888)}
.swatch.on{border-color:var(--text)}
.iconpick{display:flex;gap:8px;flex-wrap:wrap}
.iconpick button{width:50px;height:50px;font-size:1.5rem;border-radius:14px;border:2px solid var(--line);background:var(--surface);cursor:pointer}
.iconpick button.on{border-color:var(--primary);background:var(--primary-s)}
.repeater{border:1.5px dashed var(--line);border-radius:var(--radius-s);padding:10px;margin-bottom:12px}
.repeater .rep-item{background:var(--surface2);border-radius:var(--radius-s);padding:10px;margin-bottom:10px}
.repeater .rep-sub{margin-left:6px;padding-left:10px;border-left:3px solid var(--line)}
.rep-line{display:grid;grid-template-columns:1fr 84px 26px 44px;gap:6px;margin-bottom:6px;align-items:center}
.rep-line .x{width:44px;min-height:44px;padding:0}
.check-group{margin-bottom:10px}
.check-group h3{font-size:.85rem;color:var(--muted);margin:8px 0 4px}
.check-row{display:flex;align-items:center;gap:12px;min-height:48px;border-bottom:1px solid var(--line)}
.check-row input{width:24px;height:24px;min-height:0;flex:none;accent-color:var(--primary)}
.img-field{display:flex;align-items:center;gap:12px}
.img-field img{width:76px;height:76px;object-fit:cover;border-radius:14px;background:var(--surface2)}

/* ---------- hojas (modales) ---------- */
.sheet-wrap{position:fixed;inset:0;z-index:60;display:flex;align-items:flex-end;justify-content:center;background:rgba(30,15,5,.55);opacity:0;pointer-events:none;transition:opacity .18s}
.sheet-wrap.on{opacity:1;pointer-events:auto}
.sheet{background:var(--bg);width:100%;max-width:580px;max-height:94dvh;border-radius:26px 26px 0 0;display:flex;flex-direction:column;transform:translateY(40px);transition:transform .22s cubic-bezier(.3,.8,.3,1);padding-bottom:var(--sab);box-shadow:var(--shadow-l)}
.sheet-wrap.on .sheet{transform:none}
.sheet-head{display:flex;align-items:center;gap:8px;padding:12px 10px 10px 18px}
.sheet-head h2{flex:1;font-size:1.2rem}
.sheet-body{overflow:auto;padding:4px 18px 18px;-webkit-overflow-scrolling:touch}
.sheet-foot{display:flex;gap:10px;padding:12px 18px;border-top:1px solid var(--line);background:var(--surface)}
.sheet-foot .btn{flex:1}
.sheet-foot:empty{display:none}
.sheet-foot .ord-foot-in{flex:1;min-width:0}
.sheet-foot .ord-foot-in .btn{flex:none}
.sheet-foot .ord-foot-in .ord-act .btn.grow{flex:1}
.ord-act .btn.icon{flex:none}
.sheet-foot .ord-foot-in .ord-chips .chip{flex:1}
@media(min-width:768px){.sheet-wrap{align-items:center}.sheet{border-radius:26px;max-height:90vh}}
.sheet.wide{max-width:720px}

/* ---------- avisos ---------- */
#toasts{position:fixed;left:0;right:0;top:calc(var(--sat) + 12px);z-index:100;display:flex;flex-direction:column;align-items:center;gap:8px;pointer-events:none;padding:0 12px}
.toast{pointer-events:auto;max-width:520px;width:fit-content;min-width:200px;padding:12px 18px;border-radius:14px;color:#fff;font-weight:700;box-shadow:var(--shadow-l);animation:tin .22s;display:flex;align-items:center;gap:10px}
.toast.ok{background:#3E7A1B} .toast.err{background:var(--err)} .toast.warn{background:#A86B00} .toast.info{background:var(--info)}
.toast.err,.toast.warn{width:100%}
@keyframes tin{from{opacity:0;transform:translateY(-12px) scale(.96)}}

/* ---------- login ---------- */
.login-body{min-height:100dvh;display:grid;grid-template-columns:1fr}
.login-hero{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:10px;padding:calc(30px + var(--sat)) 24px 30px;color:#fff;background:radial-gradient(120% 90% at 20% 0%,color-mix(in srgb,var(--accent) 55%,var(--primary)) 0%,var(--primary) 55%,var(--primary-d) 100%);position:relative;overflow:hidden}
.login-hero:before,.login-hero:after{content:"";position:absolute;border-radius:50%;border:1.5px solid rgba(255,255,255,.18)}
.login-hero:before{width:360px;height:360px;right:-120px;top:-120px}
.login-hero:after{width:520px;height:520px;left:-220px;bottom:-300px}
.login-hero .mark{width:84px;height:84px;border-radius:26px;background:#fff;color:var(--primary);display:grid;place-items:center;font-size:2.2rem;font-weight:800;overflow:hidden;box-shadow:0 10px 30px rgba(0,0,0,.2);position:relative;z-index:1}
.login-hero .mark img{width:100%;height:100%;object-fit:contain;padding:8px;background:#fff}
.login-hero h1{font-size:1.8rem;letter-spacing:-.02em;position:relative;z-index:1}
.login-hero p{margin:0;opacity:.88;position:relative;z-index:1}
.login-panel{display:flex;flex-direction:column;justify-content:center;align-items:center;padding:26px 22px calc(26px + var(--sab))}
.login{width:100%;max-width:400px}
.login h2{font-size:1.45rem;margin-bottom:4px} .login .muted{margin:0 0 20px}
.login .powered{margin-top:26px;text-align:center;font-size:.78rem;color:var(--muted)}
@media(min-width:900px){
  .login-body{grid-template-columns:1.1fr 1fr}
  .login-hero{padding:40px}
  .login-hero .mark{width:120px;height:120px;border-radius:34px;font-size:3rem}
  .login-hero h1{font-size:2.6rem}
}

/* ---------- inicio / hoy ---------- */
.hero{display:flex;flex-direction:column;gap:2px;padding:18px;border-radius:20px;color:#fff;background:linear-gradient(135deg,var(--primary),color-mix(in srgb,var(--accent) 50%,var(--primary-d)));box-shadow:var(--shadow);margin-bottom:12px}
.hero small{opacity:.85;font-weight:700;letter-spacing:.02em}
.hero b{font-size:2.3rem;letter-spacing:-.02em;font-variant-numeric:tabular-nums}
.hero span{opacity:.85;font-size:.9rem}
.stats{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:12px}
.stat{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:14px;box-shadow:var(--shadow)}
.stat.ic{display:flex;gap:12px;align-items:center}
.stat .si{flex:none;width:44px;height:44px;border-radius:13px;display:grid;place-items:center;background:var(--primary-s);color:var(--primary)}
.stat .si.g{background:var(--ok-s);color:var(--ok)} .stat .si.y{background:var(--warn-s);color:var(--warn)} .stat .si.b{background:var(--info-s);color:var(--info)}
.stat small{color:var(--muted);display:block;font-weight:600;font-size:.8rem} .stat b{font-size:1.45rem;display:block;font-variant-numeric:tabular-nums;line-height:1.1}
.bar-row{margin:12px 0}
.bar-row .lbl{display:flex;justify-content:space-between;font-size:.92rem;margin-bottom:5px}
.bar{height:12px;border-radius:99px;background:var(--surface2);overflow:hidden}
.bar i{display:block;height:100%;background:var(--primary);border-radius:99px}
.cols{display:grid;gap:12px;grid-template-columns:1fr}
@media(min-width:800px){.cols{grid-template-columns:1fr 1fr}.stats{grid-template-columns:repeat(4,1fr)}}
table.mini{width:100%;border-collapse:collapse}
table.mini td,table.mini th{padding:10px 4px;border-bottom:1px solid var(--line);text-align:left;font-size:.93rem}
table.mini th{color:var(--muted);font-size:.74rem;text-transform:uppercase;letter-spacing:.04em}
table.mini td.r,table.mini th.r{text-align:right}
.quick-links{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin-bottom:12px}
.quick-links a{display:flex;flex-direction:column;align-items:center;gap:6px;padding:14px 6px;border-radius:var(--radius);background:var(--surface);border:1px solid var(--line);color:var(--text);font-weight:700;font-size:.88rem;box-shadow:var(--shadow)}
.quick-links a .ico{width:28px;height:28px;color:var(--primary)}
.quick-links a:active{background:var(--surface2)}

/* ---------- mesas ---------- */
.mesas-top{display:flex;gap:10px;align-items:center;justify-content:space-between;flex-wrap:wrap;margin-bottom:6px}
.mesas-sum{display:flex;gap:16px;font-size:.88rem;color:var(--muted);font-weight:600}
.mesas-sum b{color:var(--text);font-variant-numeric:tabular-nums}
.zona{display:flex;align-items:center;gap:8px;margin:18px 2px 10px;font-size:.78rem;font-weight:800;text-transform:uppercase;letter-spacing:.08em;color:var(--muted)}
.zona:after{content:"";flex:1;height:1px;background:var(--line)}
.mesas{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
@media(min-width:560px){.mesas{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(min-width:768px){.mesas{grid-template-columns:repeat(auto-fill,minmax(172px,1fr))}}
.mesa{position:relative;display:flex;flex-direction:column;justify-content:space-between;gap:8px;min-height:128px;padding:14px;border-radius:var(--radius);color:var(--text);background:var(--surface);border:1.5px solid var(--line);box-shadow:var(--shadow);cursor:pointer;text-align:left;font:inherit;overflow:hidden}
.mesa:before{content:"";position:absolute;left:0;top:0;bottom:0;width:6px;background:var(--ok)}
.mesa:active{transform:scale(.97)}
.mesa .top{display:flex;align-items:flex-start;justify-content:space-between;gap:6px}
.mesa .n{font-size:1.3rem;font-weight:800;letter-spacing:-.01em;line-height:1.1}
.mesa .e{font-size:.68rem;font-weight:800;text-transform:uppercase;letter-spacing:.06em;padding:3px 8px;border-radius:99px;background:var(--ok-s);color:var(--ok);white-space:nowrap}
.mesa .c{font-size:.86rem;color:var(--muted);display:flex;align-items:center;gap:5px;min-width:0}
.mesa .c span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mesa .tot{font-weight:800;font-size:1.2rem;font-variant-numeric:tabular-nums}
.mesa .tm{font-size:.82rem;font-weight:700;display:flex;align-items:center;gap:4px;color:var(--muted)}
.mesa.ocupada{background:color-mix(in srgb,var(--accent) 14%,var(--surface));border-color:color-mix(in srgb,var(--accent) 55%,var(--line))}
.mesa.ocupada:before{background:var(--accent)} .mesa.ocupada .e{background:var(--warn-s);color:var(--warn)}
.mesa.larga .tm{color:var(--err)} .mesa.larga:before{background:var(--err)}
.mesa.reservada:before{background:var(--info)} .mesa.reservada .e{background:var(--info-s);color:var(--info)}
.mesa.cerrada:before,.mesa.por_liberar:before{background:var(--muted)} .mesa.cerrada .e,.mesa.por_liberar .e{background:var(--surface2);color:var(--muted)}
.mesa.cerrada,.mesa.por_liberar{opacity:.75}

/* ---------- POS: toma de orden ---------- */
.pos{display:grid;height:100dvh;grid-template-columns:minmax(0,1fr);grid-template-rows:auto auto minmax(0,1fr);grid-template-areas:"h" "c" "l";background:var(--bg)}
.pos-head{grid-area:h;display:flex;align-items:center;gap:8px;padding:calc(8px + var(--sat)) 10px 8px;background:var(--surface);border-bottom:1px solid var(--line)}
.pos-head .info{flex:1;min-width:0}
.pos-head .info b{display:block;font-size:1.15rem;line-height:1.15;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pos-head .info span{display:block;font-size:.82rem;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pos-head .search{position:relative;flex:1;max-width:340px;display:none}
.pos-head .search input{padding-left:40px;min-height:44px;border-radius:99px;background:var(--surface2);border-color:transparent}
.pos-head .search .ico{position:absolute;left:13px;top:50%;margin-top:-10px;width:20px;height:20px;color:var(--muted);pointer-events:none}
.pos-cats{grid-area:c;display:flex;gap:8px;overflow-x:auto;padding:10px 12px;background:var(--surface);border-bottom:1px solid var(--line);scrollbar-width:none}
.pos-cats::-webkit-scrollbar{display:none}
.cat{flex:none;display:flex;align-items:center;gap:8px;min-height:46px;padding:0 16px;border-radius:99px;border:1.5px solid var(--line);background:var(--bg);color:var(--text);font:inherit;font-weight:700;cursor:pointer;white-space:nowrap}
.cat .em{font-size:1.25rem;line-height:1}
.cat.on{background:var(--primary);border-color:var(--primary);color:#fff}
.pos-main{grid-area:l;overflow:auto;-webkit-overflow-scrolling:touch;padding:0 0 calc(86px + var(--sab))}
.pos-search-m{display:block;padding:12px 12px 0;position:relative}
.pos-search-m input{padding-left:42px;border-radius:99px;background:var(--surface);min-height:46px}
.pos-search-m .ico{position:absolute;left:28px;top:35px;transform:translateY(-50%);width:20px;height:20px;color:var(--muted);pointer-events:none}
.pos-subs{display:flex;gap:8px;overflow-x:auto;padding:12px 12px 0;scrollbar-width:none}
.pos-subs::-webkit-scrollbar{display:none}
.pgrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;padding:12px}
@media(min-width:520px){.pgrid{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(min-width:768px){.pgrid{grid-template-columns:repeat(auto-fill,minmax(150px,1fr))}}
.ptile{position:relative;display:flex;flex-direction:column;gap:6px;padding:0 0 12px;background:var(--surface);border:1.5px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);cursor:pointer;text-align:left;font:inherit;color:var(--text);overflow:hidden;min-height:150px;user-select:none;-webkit-user-select:none;touch-action:manipulation}
.ptile:active{transform:scale(.96)}
.ptile .pimg{height:78px;background:color-mix(in srgb,var(--c,var(--accent)) 16%,var(--surface2));display:grid;place-items:center;font-size:2.3rem;overflow:hidden;border-bottom:4px solid var(--c,var(--accent))}
.ptile .pimg img{width:100%;height:100%;object-fit:cover}
.ptile .pn{padding:0 12px;font-weight:800;font-size:.95rem;line-height:1.2;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;min-height:2.4em}
.ptile .pp{padding:0 12px;font-weight:800;color:var(--primary);font-variant-numeric:tabular-nums;margin-top:auto}
.ptile .pd{padding:0 12px;font-size:.74rem;color:var(--muted);margin-top:-4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ptile .qty{position:absolute;top:8px;right:8px;min-width:30px;height:30px;padding:0 8px;border-radius:99px;background:var(--primary);color:#fff;font-weight:800;display:grid;place-items:center;box-shadow:0 3px 10px rgba(0,0,0,.3);animation:pop .22s}
@keyframes pop{from{transform:scale(.5)}60%{transform:scale(1.2)}}
.ptile.sel{border-color:var(--primary)}
.ptile.off{opacity:.45}
.ptile.off .pimg:after{content:"Agotado";position:absolute;inset:auto 0 auto 0;top:30px;text-align:center;font-size:.8rem;font-weight:800;background:rgba(0,0,0,.65);color:#fff;padding:3px}
.pos-bar{position:fixed;left:0;right:0;bottom:0;z-index:25;padding:10px 12px calc(10px + var(--sab));background:var(--surface);border-top:1px solid var(--line);box-shadow:0 -6px 20px rgba(60,35,15,.1)}
.pos-bar .btn{width:100%;justify-content:space-between;padding:0 18px}
.pos-bar .cnt{background:#fff;color:var(--primary);border-radius:99px;min-width:30px;height:30px;display:inline-grid;place-items:center;font-size:.9rem;font-weight:800;padding:0 8px}
.order-col{display:none}

/* orden: panel (tablet) y hoja (celular) */
.ord-head{padding:14px 16px 10px;border-bottom:1px solid var(--line);display:flex;align-items:center;gap:10px}
.ord-head b{font-size:1.15rem;display:block;line-height:1.15} .ord-head span{font-size:.84rem;color:var(--muted)}
.ord-body{flex:1;min-height:0;overflow:auto;padding:6px 14px;-webkit-overflow-scrolling:touch}
.ord-foot{padding:12px 14px calc(12px + var(--sab));border-top:1px solid var(--line);background:var(--surface)}
.ord-group{margin:10px 0 2px;font-size:.72rem;font-weight:800;text-transform:uppercase;letter-spacing:.07em;color:var(--muted);display:flex;align-items:center;gap:6px}
.ord-group.draft{color:var(--primary)}
.ord-empty{text-align:center;color:var(--muted);padding:40px 12px}
.ord-empty .ico{width:44px;height:44px;opacity:.4;margin-bottom:6px}
.line{display:flex;gap:10px;align-items:center;padding:10px 0;border-bottom:1px solid var(--line)}
.line .lm{flex:1;min-width:0} .line .ln{font-weight:700;line-height:1.2} .line .lo{font-size:.8rem;color:var(--muted);line-height:1.3}
.line .lt{font-weight:800;white-space:nowrap;font-variant-numeric:tabular-nums}
.line .qs{flex:none;display:flex;align-items:center;background:var(--surface2);border-radius:99px}
.line .qs button{width:38px;height:38px;border:0;background:none;border-radius:50%;color:var(--text);cursor:pointer;display:grid;place-items:center}
.line .qs button:active{background:var(--line)}
.line .qs button .ico{width:18px;height:18px}
.line .qs span{min-width:22px;text-align:center;font-weight:800;font-variant-numeric:tabular-nums}
.line .qn{flex:none;min-width:34px;font-weight:800;color:var(--muted)}
.line .tools{display:flex;gap:4px;margin-top:4px}
.line .tools button{border:0;background:var(--surface2);color:var(--muted);border-radius:9px;min-height:32px;padding:0 10px;font:inherit;font-size:.78rem;font-weight:700;cursor:pointer;display:inline-flex;align-items:center;gap:5px}
.line .tools button .ico{width:15px;height:15px}
.line .tools button.dng{color:var(--err)}
.line.cancel{opacity:.5} .line.cancel .ln{text-decoration:line-through}
.dot-s{display:inline-block;width:9px;height:9px;border-radius:50%;margin-right:5px;background:var(--warn)}
.dot-s.completado{background:var(--ok)} .dot-s.cancelado{background:var(--err)}
.sum{padding:2px 0 8px}
.sum div{display:flex;justify-content:space-between;align-items:center;padding:3px 0;font-size:.95rem;font-variant-numeric:tabular-nums}
.sum .tot{font-size:1.5rem;font-weight:800;padding-top:6px;letter-spacing:-.01em}
.ord-chips{display:flex;gap:8px;margin-bottom:8px}
.ord-chips .chip{flex:1;justify-content:center;min-height:40px;font-size:.85rem;padding:0 8px}
.ord-chips .chip .ico{width:16px;height:16px}
.ord-act{display:flex;gap:8px}
.ord-act .btn.grow{flex:1}
.ord-act .btn.icon{flex:none}
.sum-box{padding:12px;background:var(--surface2);border-radius:var(--radius-s);margin:12px 0}

/* opciones de producto */
.opt-group{margin-bottom:18px}
.opt-group h3{font-size:.98rem;display:flex;justify-content:space-between;align-items:baseline;gap:8px;margin-bottom:8px}
.opt-row{display:flex;align-items:center;gap:12px;min-height:54px;padding:8px 14px;border:1.5px solid var(--line);border-radius:var(--radius-s);margin-bottom:8px;cursor:pointer;background:var(--surface)}
.opt-row.on{border-color:var(--primary);background:var(--primary-s)}
.opt-row .dot{flex:none;width:24px;height:24px;border-radius:50%;border:2px solid var(--line);display:grid;place-items:center;color:#fff}
.opt-row .dot .ico{width:15px;height:15px;stroke-width:3}
.opt-row.multi .dot{border-radius:7px}
.opt-row.on .dot{background:var(--primary);border-color:var(--primary)}
.opt-row .nm{flex:1;font-weight:600} .opt-row .pr{color:var(--muted);font-size:.9rem;font-weight:600}

/* cobro */
.cb-total{text-align:center;padding:6px 0 14px}
.cb-total small{display:block;color:var(--muted);font-weight:700}
.cb-total b{display:block;font-size:2.7rem;letter-spacing:-.02em;font-variant-numeric:tabular-nums;line-height:1.1}
.cb-title{font-size:.72rem;font-weight:800;text-transform:uppercase;letter-spacing:.07em;color:var(--muted);margin:14px 0 8px}
.tips{display:grid;grid-template-columns:repeat(5,1fr);gap:6px}
.tips button{min-height:50px;border-radius:13px;border:1.5px solid var(--line);background:var(--surface);font:inherit;font-weight:800;font-size:.92rem;color:var(--text);cursor:pointer;line-height:1.1}
.tips button small{display:block;font-size:.66rem;font-weight:700;color:var(--muted)}
.tips button.on{background:var(--primary);border-color:var(--primary);color:#fff} .tips button.on small{color:#fff;opacity:.85}
.fp-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:8px}
.fp{display:flex;flex-direction:column;align-items:center;gap:4px;padding:12px 6px;border-radius:14px;border:1.5px solid var(--line);background:var(--surface);color:var(--text);font:inherit;font-weight:700;font-size:.9rem;cursor:pointer;text-align:center}
.fp .ico{width:26px;height:26px;color:var(--primary)}
.fp:active{background:var(--surface2)}
.fp.used{opacity:.4;pointer-events:none}
.pay-line{padding:12px;border:1.5px solid var(--primary);background:var(--primary-s);border-radius:14px;margin-bottom:10px}
.pay-line .ph{display:flex;align-items:center;gap:10px;margin-bottom:8px}
.pay-line .ph b{flex:1;display:flex;align-items:center;gap:8px}
.pay-line input{font-size:1.4rem;font-weight:800;text-align:right;min-height:54px}
.bills{display:flex;gap:6px;flex-wrap:wrap;margin-top:8px}
.bills button{flex:1;min-width:64px;min-height:46px;border-radius:12px;border:1.5px solid var(--line);background:var(--surface);font:inherit;font-weight:800;color:var(--text);cursor:pointer}
.bills button:active{background:var(--surface2)}
.cb-res{display:flex;justify-content:space-between;align-items:center;padding:14px 16px;border-radius:14px;margin-top:6px;font-weight:800;font-size:1.15rem;font-variant-numeric:tabular-nums}
.cb-res.falta{background:var(--warn-s);color:var(--warn)} .cb-res.cambio{background:var(--ok-s);color:var(--ok)}
.cb-res span:first-child{font-size:.9rem}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:8px}

/* tablet: orden siempre visible */
@media(min-width:768px){
  .pos{grid-template-columns:minmax(0,1fr) 340px;grid-template-areas:"h o" "c o" "l o"}
  .pos-head .search{display:block}
  .pos-search-m{display:none}
  .pos-main{padding-bottom:20px}
  .pos-bar{display:none}
  .pos-head{padding-top:12px}
  .order-col{grid-area:o;display:flex;flex-direction:column;min-height:0;background:var(--surface);border-left:1px solid var(--line)}
  .order-col .ord-head{padding-top:calc(14px + var(--sat))}
}
@media(min-width:1100px){
  .pos{grid-template-columns:148px minmax(0,1fr) 390px;grid-template-rows:auto minmax(0,1fr);grid-template-areas:"h h o" "c l o"}
  .pos-cats{flex-direction:column;overflow-y:auto;overflow-x:hidden;border-bottom:0;border-right:1px solid var(--line);padding:12px 10px}
  .cat{flex-direction:column;justify-content:center;gap:4px;min-height:78px;padding:6px;border-radius:16px;white-space:normal;text-align:center;font-size:.85rem;line-height:1.15}
  .cat .em{font-size:1.9rem}
}

/* ---------- cocina / barra (KDS) ---------- */
.kds-top{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:12px;flex-wrap:wrap}
.kds-count{display:flex;gap:8px;align-items:center;font-weight:700;color:var(--muted)}
.kds-count b{color:var(--text);font-size:1.4rem;font-variant-numeric:tabular-nums}
.kds-legend{display:flex;gap:12px;font-size:.78rem;color:var(--muted);font-weight:600}
.kds-legend i{display:inline-block;width:10px;height:10px;border-radius:50%;margin-right:5px}
.comandas{display:grid;gap:12px;grid-template-columns:1fr;align-items:start}
@media(min-width:700px){.comandas{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(min-width:1100px){.comandas{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(min-width:1500px){.comandas{grid-template-columns:repeat(4,minmax(0,1fr))}}
.comanda{background:var(--surface);border:1.5px solid var(--line);border-radius:var(--radius);overflow:hidden;box-shadow:var(--shadow)}
.comanda.nueva{animation:flash 1s 3}
@keyframes flash{50%{box-shadow:0 0 0 5px color-mix(in srgb,var(--primary) 55%,transparent)}}
.comanda-h{display:flex;align-items:center;gap:10px;padding:12px 14px;background:var(--ok);color:#fff}
.comanda.t-warn .comanda-h{background:#D99100} .comanda.t-late .comanda-h{background:var(--err)}
.comanda-h .mn{font-size:1.3rem;font-weight:800;flex:1;display:flex;align-items:center;gap:8px;min-width:0}
.comanda-h .mn small{font-weight:700;opacity:.85;font-size:.8rem}
.comanda-h .tm{font-weight:800;font-size:1.1rem;display:flex;align-items:center;gap:5px;font-variant-numeric:tabular-nums}
.comanda-h .tm .ico{width:18px;height:18px}
.comanda-sub{padding:8px 14px 0;font-size:.82rem;color:var(--muted);font-weight:600}
.cmd-item{padding:12px 14px;border-top:1px solid var(--line)}
.cmd-item:first-of-type{border-top:0}
.cmd-item .top{display:flex;gap:12px;align-items:baseline}
.cmd-item .q{font-size:1.6rem;font-weight:800;color:var(--primary);min-width:2.2ch}
.cmd-item .nm{flex:1;font-weight:800;font-size:1.2rem;line-height:1.2}
.cmd-item ul{margin:4px 0 0;padding-left:20px;color:var(--text);font-size:.98rem}
.cmd-item .note{margin-top:8px;padding:8px 12px;border-radius:10px;background:var(--warn-s);font-weight:700;font-size:.95rem;display:flex;gap:8px;align-items:flex-start}
.cmd-item .note .ico{width:18px;height:18px;margin-top:2px;color:var(--warn)}
.cmd-item .acts{margin-top:10px}
.cmd-item .acts .btn{width:100%;min-height:54px;font-size:1.05rem}
.cmd-item.done{opacity:.5} .cmd-item.canceled{opacity:.45} .cmd-item.canceled .nm{text-decoration:line-through}
.comanda-f{padding:10px 14px 14px;border-top:1px solid var(--line)}
.kds-empty{text-align:center;padding:70px 16px;color:var(--muted)}
.kds-empty .ico{width:64px;height:64px;opacity:.35;color:var(--ok);margin-bottom:8px}
.kds-empty b{display:block;font-size:1.2rem;color:var(--text)}

/* ---------- varios ---------- */
.imgprev{max-width:100%;max-height:120px;border-radius:8px;background:#fff;padding:4px}
.c-primary{--c:#CC3B13}.c-blue{--c:#3b82f6}.c-indigo{--c:#6366f1}.c-sky{--c:#0ea5e9}.c-cyan{--c:#06b6d4}
.c-emerald{--c:#10b981}.c-lime{--c:#84cc16}.c-yellow{--c:#eab308}.c-amber{--c:#f59e0b}.c-rose{--c:#f43f5e}.c-violet{--c:#8b5cf6}
table.heat{border-collapse:separate;border-spacing:2px;width:100%;font-size:.7rem}
table.heat th{color:var(--muted);font-weight:600;padding:2px 3px;text-align:center}
table.heat td{height:26px;min-width:20px;border-radius:4px;background:var(--surface2)}
.chart{width:100%;height:auto;display:block}
.chart text{fill:var(--muted);font-size:11px;font-family:inherit}
.chart .lbl{fill:var(--text)}
.legend{display:flex;flex-wrap:wrap;gap:6px 14px;margin-top:8px;font-size:.85rem}
.legend i{display:inline-block;width:10px;height:10px;border-radius:3px;margin-right:5px;vertical-align:baseline}
@media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}
.empty .ico{width:56px;height:56px;opacity:.35;margin-bottom:6px}
