:root{
  --bg:#F4F5F7; --surface:#FFFFFF; --soft:#F4F5F7; --ink:#1B2430; --ink-2:#3D4652; --muted:#5B6573;
  --line:#DDE2E8; --line-2:#C3CAD3; --accent:#1D5FD1; --accent-h:#164AA3; --accent-soft:#EEF4FE; --on-accent:#FFFFFF;
  --nav:#1B2430; --nav-ink:#C9D2DD; --nav-muted:#A9B4C2; --nav-active:#2B3A50; --nav-line:#2E3A4B; --nav-link:#9CC0FF;
  --ok:#1A6B3C; --ok-bg:#E6F4EC; --err:#A3241A; --err-bg:#FDECEA; --warn:#7A3E00; --warn-bg:#FFF3E0;
  --overlay:rgba(15,23,42,.45); --shadow:0 16px 40px rgba(15,23,42,.22);
  --sans:'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono:'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;
  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#12161C; --surface:#1A2029; --soft:#151A21; --ink:#E6EAF0; --ink-2:#C9D2DD; --muted:#9AA6B4;
    --line:#2A323D; --line-2:#3A4452; --accent:#3D74E0; --accent-h:#5585E6; --accent-soft:#1B2A45; --on-accent:#FFFFFF;
    --nav:#0E1217; --nav-ink:#C9D2DD; --nav-muted:#9AA6B4; --nav-active:#223047; --nav-line:#232B36; --nav-link:#9CC0FF;
    --ok:#7AD9A2; --ok-bg:#12301F; --err:#FF9C92; --err-bg:#3A1714; --warn:#F2B36B; --warn-bg:#33240E;
    --overlay:rgba(0,0,0,.6); --shadow:0 16px 40px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"]{
  --bg:#12161C; --surface:#1A2029; --soft:#151A21; --ink:#E6EAF0; --ink-2:#C9D2DD; --muted:#9AA6B4;
  --line:#2A323D; --line-2:#3A4452; --accent:#3D74E0; --accent-h:#5585E6; --accent-soft:#1B2A45; --on-accent:#FFFFFF;
  --nav:#0E1217; --nav-ink:#C9D2DD; --nav-muted:#9AA6B4; --nav-active:#223047; --nav-line:#232B36; --nav-link:#9CC0FF;
  --ok:#7AD9A2; --ok-bg:#12301F; --err:#FF9C92; --err-bg:#3A1714; --warn:#F2B36B; --warn-bg:#33240E;
  --overlay:rgba(0,0,0,.6); --shadow:0 16px 40px rgba(0,0,0,.5);
  color-scheme: dark;
}
*,*::before,*::after{box-sizing:inherit}
html{height:100%; scroll-padding-top:env(safe-area-inset-top,0px)}
body{margin:0; min-height:100%; background:var(--bg); color:var(--ink); font-family:var(--sans); font-size:15px; line-height:1.45}
input,select,button,textarea{font:inherit; color:inherit}
a{color:var(--accent)} a:hover{color:var(--accent-h)}
:focus-visible{outline:3px solid var(--accent); outline-offset:2px}
.sr{position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap}
.mono{font-family:var(--mono)}
.muted{color:var(--muted)}
.right{text-align:right}

/* layout */
.app{display:flex; min-height:100vh}
.side{flex:0 0 236px; background:var(--nav); color:var(--nav-ink); padding:20px 14px; display:flex; flex-direction:column; gap:4px}
.brand{display:flex; flex-direction:column; align-items:flex-start; gap:6px; padding:4px 10px 18px}
.brand-logo{display:block; width:100%; height:auto}
.brand span{padding-left:2px}
.logo{width:36px; height:36px; border-radius:8px; background:#1D5FD1; color:#fff; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:15px; flex:none}
.brand b{display:block; color:#fff; font-size:15px; font-weight:600}
.brand span{display:block; color:var(--nav-muted); font-size:12px}
.navlink{display:flex; align-items:center; gap:10px; min-height:44px; padding:0 12px; border-radius:8px; border:0; background:transparent; color:var(--nav-ink); font-size:14px; font-weight:500; text-align:left; cursor:pointer; width:100%}
.navlink:hover{background:var(--nav-active); color:#fff}
.navlink[aria-current="page"]{background:var(--nav-active); color:#fff; font-weight:600}
.navlink svg{flex:none; opacity:.85}
.side-foot{margin-top:auto; padding:14px 10px 0; border-top:1px solid var(--nav-line); display:flex; flex-direction:column; gap:2px}
.side-foot b{color:#fff; font-size:13px; font-weight:500}
.side-foot span{color:var(--nav-muted); font-size:12px}
.side-foot button{background:none; border:0; padding:0; min-height:36px; text-align:left; color:var(--nav-link); font-size:13px; cursor:pointer}
.main-col{flex:1 1 auto; min-width:0; display:flex; flex-direction:column}
.userbar{display:flex; justify-content:space-between; align-items:center; gap:14px; padding:14px 32px 0}
.star{color:#D99A00; margin-right:4px; font-size:1.05em}
.userbar .ub-right{display:flex; align-items:center; gap:14px; margin-left:auto}
.userbar .nav-toggle{width:40px; min-height:40px; padding:0}
/* ocultar/mostrar menú: se anima el ancho (o el alto en móvil); visibility espera a que termine al ocultar */
.side{overflow:hidden; transition:flex-basis .35s ease, padding .35s ease, max-height .35s ease, opacity .35s ease, visibility 0s}
.side > *{min-width:208px; transition:transform .35s ease}
.app.nav-hidden .side{flex-basis:0; padding-left:0; padding-right:0; opacity:0; visibility:hidden; transition:flex-basis .35s ease, padding .35s ease, max-height .35s ease, opacity .35s ease, visibility 0s linear .35s}
.app.nav-hidden .side > *{transform:translateX(-40px)}
.userbar .who{display:flex; flex-direction:column; align-items:flex-end; line-height:1.25}
.userbar .who b{font-size:14px; font-weight:600; color:var(--ink)}
.userbar .who span{font-size:12px; color:var(--muted)}
.userbar .btn{min-height:38px; padding:0 14px; font-size:14px}
.main{flex:1 1 auto; min-width:0; padding:24px 32px 40px; display:flex; flex-direction:column; gap:20px}
@media (max-width: 860px){
  .userbar{padding:12px 16px 0}
  .app{flex-direction:column}
  .side{flex:none; flex-direction:row; align-items:center; overflow-x:auto; padding:10px; gap:6px; max-height:80px}
  .side > *{min-width:0}
  .app.nav-hidden .side{flex-basis:auto; max-height:0; padding:0 10px}
  .app.nav-hidden .side > *{transform:translateY(-20px)}
  .brand{padding:0 8px 0 0}
  .brand{flex:none}
  .brand-logo{width:auto; height:32px}
  .brand span{display:none}
  .navlink{width:auto; white-space:nowrap; flex:none}
  .navlink svg{display:none}
  .side-foot{margin:0 0 0 auto; border:0; padding:0 0 0 8px; flex-direction:row; align-items:center; gap:10px; flex:none}
  .side-foot b,.side-foot span.role{display:none}
  .main{padding:18px 16px 32px}
}

/* headings */
.vh{display:flex; flex-wrap:wrap; justify-content:space-between; align-items:flex-end; gap:12px}
.vh h1{margin:0; font-size:24px; font-weight:600; line-height:1.2}
.vh p{margin:2px 0 0; color:var(--muted); font-size:14px}
.tools{display:flex; flex-wrap:wrap; gap:8px; align-items:flex-end}
h2{margin:0; font-size:16px; font-weight:600}

/* components */
.card{background:var(--surface); border:1px solid var(--line); border-radius:12px; padding:18px 20px; display:flex; flex-direction:column; gap:14px; min-width:0}
.btn{display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:44px; padding:0 16px; border-radius:10px; border:1px solid var(--line-2); background:var(--surface); color:var(--ink); font-weight:500; cursor:pointer; text-decoration:none; white-space:nowrap}
.btn:hover{border-color:var(--muted)}
.btn[disabled]{opacity:.55; cursor:not-allowed}
.btn-primary{background:var(--accent); border-color:var(--accent); color:var(--on-accent); font-weight:600}
.btn-primary:hover{background:var(--accent-h); border-color:var(--accent-h)}
.btn-lg{min-height:52px; font-size:16px}
.btn-link{background:none; border:0; padding:0 8px; min-height:40px; color:var(--accent); font-size:13px; font-weight:500; cursor:pointer}
.btn-link.danger{color:var(--err)}
.btn-link[disabled]{color:var(--muted); cursor:not-allowed}
.field{display:flex; flex-direction:column; gap:6px; min-width:0}
form[data-form="saveRef"] #form-err:empty{display:none}
.field label,.lbl{font-size:13px; font-weight:500}
.input,select.input,textarea.input{min-height:44px; padding:0 12px; border:1px solid var(--line-2); border-radius:8px; background:var(--surface); width:100%}
textarea.input{padding:10px 12px; min-height:80px; resize:vertical}
.input[readonly],.input[disabled]{background:var(--soft); color:var(--muted)}
.pw-wrap{position:relative}
.pw-wrap .input{padding-right:44px}
.pw-eye{position:absolute; top:0; right:0; width:44px; height:100%; display:flex; align-items:center; justify-content:center; border:0; background:none; color:var(--muted); cursor:pointer; border-radius:0 8px 8px 0}
.pw-eye[hidden]{display:none}
.pw-eye:hover{color:var(--accent)}
input::-ms-reveal,input::-ms-clear{display:none}
.in-wrap{position:relative}
.in-wrap .input{padding-left:56px}
.in-ico{position:absolute; top:10px; bottom:10px; left:0; width:44px; display:flex; align-items:center; justify-content:center; border-right:1px solid var(--line-2); color:var(--muted); pointer-events:none; transition:color .15s}
.in-wrap:focus-within .in-ico,.in-wrap:focus-within .pw-eye{color:var(--accent)}
.help{font-size:12px; color:var(--muted)}
.check{display:flex; align-items:center; gap:10px; min-height:40px; font-size:14px; cursor:pointer}
.check input{width:18px; height:18px; accent-color:var(--accent)}
.grid-form{display:grid; grid-template-columns:repeat(auto-fit, minmax(180px, 1fr)); gap:14px; align-items:end}
.badge{display:inline-block; padding:3px 10px; border-radius:999px; font-size:12px; font-weight:500; white-space:nowrap}
.b-ok{background:var(--ok-bg); color:var(--ok)} .b-err{background:var(--err-bg); color:var(--err)} .b-mute{background:var(--soft); color:var(--ink-2); border:1px solid var(--line)} .b-warn{background:var(--warn-bg); color:var(--warn)}
.note{display:flex; gap:10px; align-items:flex-start; padding:10px 12px; border-radius:8px; font-size:13px}
.note.err{background:var(--err-bg); color:var(--err)} .note.warn{background:var(--warn-bg); color:var(--warn)} .note.ok{background:var(--ok-bg); color:var(--ok)} .note.info{background:var(--accent-soft); color:var(--ink)}
.empty{padding:28px 16px; text-align:center; color:var(--muted); border:1px dashed var(--line-2); border-radius:10px; font-size:14px; display:flex; flex-direction:column; gap:10px; align-items:center}
.tbl-wrap{overflow-x:auto; border:1px solid var(--line); border-radius:8px}
table.tbl{width:100%; border-collapse:collapse; font-size:14px}
.tbl th{background:var(--soft); text-align:left; font-size:13px; font-weight:600; padding:10px 12px; white-space:nowrap}
.tbl td{padding:8px 12px; border-top:1px solid var(--line); vertical-align:middle}
.tbl td.num,.tbl th.num{text-align:right; font-family:var(--mono); white-space:nowrap}
.tbl tr.row-err td{background:var(--err-bg)}
.tbl tfoot td{font-weight:600; border-top:2px solid var(--line-2)}
.acts{display:flex; flex-wrap:wrap; gap:2px}
.acts.nowrap{flex-wrap:nowrap; gap:4px}
.ico-btn{display:inline-flex; align-items:center; justify-content:center; width:36px; height:36px; border:0; border-radius:8px; background:none; color:var(--accent); cursor:pointer}
.ico-btn:hover{background:var(--accent-soft)}
.ico-btn.danger{color:var(--err)}
.ico-btn.danger:hover{background:var(--err-bg)}
.ico-btn[disabled]{color:var(--muted); background:none; cursor:not-allowed}
.btn-grp{display:inline-flex; vertical-align:middle}
.pos-chk{width:20px; height:20px; margin:0; accent-color:#1A7F43; cursor:pointer; vertical-align:middle}
.pos-chk[disabled]{cursor:not-allowed; opacity:.5}
tr.row-ok > td{animation:rowok 1.6s ease-out}
@keyframes rowok{0%,25%{background-color:rgba(26,127,67,.28)}100%{background-color:transparent}}
@media (prefers-reduced-motion: reduce){ tr.row-ok > td{animation:none; background-color:rgba(26,127,67,.18)} }
.btn-grp .gb{display:inline-flex; align-items:center; justify-content:center; width:32px; height:30px; padding:0; border:1px solid var(--line-2); background:var(--surface); color:var(--muted); cursor:pointer; position:relative}
.btn-grp .gb + .gb{margin-left:-1px}
.btn-grp .gb:first-child{border-radius:6px 0 0 6px}
.btn-grp .gb:last-child{border-radius:0 6px 6px 0}
.btn-grp .gb:only-child{border-radius:6px}
.btn-grp .gb:hover{color:var(--ink); background:var(--soft); z-index:1}
.btn-grp .gb:focus-visible{z-index:2}
.btn-grp .gb.danger{background:#C62828; border-color:#C62828; color:#FFFFFF; z-index:1}
.btn-grp .gb.danger:hover{background:#A51F1F; border-color:#A51F1F}
.btn-grp .gb.info{background:#1D5FD1; border-color:#1D5FD1; color:#FFFFFF}
.btn-grp .gb.info:hover{background:#164AA3; border-color:#164AA3; color:#FFFFFF}
.btn-grp .gb.ok{background:#1A7F43; border-color:#1A7F43; color:#FFFFFF}
.btn-grp .gb.ok:hover{background:#146534; border-color:#146534; color:#FFFFFF}
.btn-grp .gb.info + .gb, .btn-grp .gb.ok + .gb{border-left-color:rgba(255,255,255,.35)}
.btn-grp .gb[disabled]{cursor:not-allowed; opacity:.5}
.cat-wrap .tbl td{padding:6px 12px}
.pager{display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center; gap:10px; margin-top:12px}
.pg-info{font-size:13px; color:var(--muted)}
.pg-ctl{display:flex; flex-wrap:wrap; align-items:center; gap:4px}
.pg-size-l{display:flex; align-items:center; gap:6px; font-size:13px; color:var(--muted); margin-right:10px}
select.input.pg-size{width:auto; min-height:36px; padding:0 8px}
.pg-btn{min-width:36px; height:36px; padding:0 8px; border:1px solid var(--line-2); border-radius:8px; background:var(--surface); font-size:13px; cursor:pointer}
.pg-btn:hover:not([disabled]):not([aria-current]){border-color:var(--accent)}
.pg-btn[aria-current="page"]{background:var(--accent); border-color:var(--accent); color:var(--on-accent); cursor:default}
.pg-btn[disabled]{opacity:.45; cursor:not-allowed}
.pg-gap{padding:0 4px; color:var(--muted)}

/* venta */
.split{display:flex; flex-wrap:wrap; gap:20px; align-items:flex-start}
.split > .grow{flex:999 1 480px; min-width:0}
.split > .side-panel{flex:1 1 380px; min-width:0}
.searchbar{display:flex; gap:8px}
.searchbox{position:relative; flex:1 1 auto; display:flex; min-width:0}
.searchbox svg{position:absolute; left:14px; top:15px; pointer-events:none; color:var(--muted)}
.searchbox input{flex:1 1 auto; min-width:0; min-height:48px; padding:0 14px 0 42px; border:1px solid var(--line-2); border-radius:10px; font-size:16px; background:var(--surface)}
.results{display:grid; grid-template-columns:repeat(auto-fill, minmax(200px, 1fr)); gap:12px}
.pcard{background:var(--surface); border:1px solid var(--line); border-radius:10px; padding:14px; display:flex; flex-direction:column; gap:8px}
.pcard .code{font-family:var(--mono); font-size:12px; color:var(--muted); word-break:break-all}
.pcard .name{font-weight:600; font-size:15px; min-height:40px}
.pcard .row{display:flex; justify-content:space-between; align-items:baseline; gap:8px}
.pcard .price{font-family:var(--mono); font-weight:600; font-size:17px}
.plist{border:1px solid var(--line); border-radius:10px; overflow:hidden; background:var(--surface)}
.prow{display:grid; grid-template-columns:minmax(0,1fr) auto auto; align-items:center; gap:16px; padding:8px 12px 8px 14px; border-top:1px solid var(--line)}
.prow:first-child{border-top:0}
.prow:hover{background:var(--soft)}
.prow .pinfo{display:flex; flex-direction:column; min-width:0}
.prow .name{font-weight:600; font-size:14px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.prow .code{font-family:var(--mono); font-size:12px; color:var(--muted)}
.prow .price{font-family:var(--mono); font-weight:600; font-size:15px; text-align:right; min-width:70px}
.prow .btn{min-height:36px; padding:0 14px; font-size:13px}
@media (max-width: 560px){ .prow{gap:10px} .prow .price{min-width:0} .prow .name{white-space:normal; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; line-height:1.3} }
.mbar{display:none}
@media (max-width: 900px){
  .mbar:not(:empty){display:flex; position:sticky; bottom:calc(8px + env(safe-area-inset-bottom,0px)); z-index:5; align-items:center; justify-content:space-between; gap:12px; padding:10px 10px 10px 16px; background:var(--surface); border:1px solid var(--line-2); border-radius:12px; box-shadow:var(--shadow)}
  .mbar .mb-info{display:flex; flex-direction:column; min-width:0; background:none; border:0; padding:0; text-align:left; cursor:pointer}
  .mbar .mb-info span{font-size:12px; color:var(--muted)}
  .mbar .mb-info b{font-family:var(--mono); font-size:20px; font-weight:600}
  .mbar .btn{flex:none}
}
.cart-line{display:flex; flex-direction:column; gap:8px; padding:12px 0; border-bottom:1px solid var(--line)}
.cart-line .top{display:flex; justify-content:space-between; gap:12px}
.cart-line .nm{font-weight:600; font-size:14px}
.cart-line .sub{font-size:12px; color:var(--muted)}
.cart-line .ctrl{display:flex; justify-content:space-between; align-items:center; gap:8px}
.stepper{display:flex; align-items:center; gap:6px}
.stepper button{width:44px; height:44px; border-radius:8px; border:1px solid var(--line-2); background:var(--surface); font-size:20px; cursor:pointer}
.stepper button[disabled]{opacity:.4; cursor:not-allowed}
.stepper input{width:68px; height:44px; text-align:center; border:1px solid var(--line-2); border-radius:8px; font-family:var(--mono); font-size:16px; background:var(--surface)}
.totals{display:flex; flex-direction:column; gap:8px; padding-top:6px}
.totals .r{display:flex; justify-content:space-between; font-size:14px; color:var(--ink-2)}
.totals .r span:last-child{font-family:var(--mono)}
.totals .grand{display:flex; justify-content:space-between; align-items:baseline; padding-top:10px; border-top:1px solid var(--line)}
.totals .grand span:first-child{font-size:16px; font-weight:600}
.totals .grand span:last-child{font-family:var(--mono); font-size:28px; font-weight:600}
.cart-actions{display:flex; gap:8px}
.cart-actions .btn{flex:1 1 0}
.cart-actions .btn-primary{flex:2 1 0}

/* modal */
.overlay{position:fixed; inset:0; background:var(--overlay); display:flex; align-items:flex-start; justify-content:center; padding:calc(24px + env(safe-area-inset-top,0px)) 16px calc(24px + env(safe-area-inset-bottom,0px)); overflow-y:auto; z-index:50}
.modal{background:var(--surface); border-radius:14px; box-shadow:var(--shadow); width:100%; max-width:560px; padding:22px 24px; display:flex; flex-direction:column; gap:16px; max-height:calc(100vh - 48px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)); max-height:calc(100dvh - 48px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)); overflow-y:auto; overscroll-behavior:contain}
.modal > .modal-head, .modal > form > .modal-head{position:sticky; top:-22px; margin-top:-22px; padding:22px 0 10px; background:var(--surface); z-index:2}
.modal > .modal-foot, .modal > form > .modal-foot{position:sticky; bottom:-22px; margin-bottom:-22px; padding:12px 0 22px; background:var(--surface); border-top:1px solid var(--line); z-index:2}
.modal.wide{max-width:880px}
.modal-head{display:flex; justify-content:space-between; align-items:center; gap:12px}
.modal-head h2{font-size:19px}
.x{width:44px; height:44px; border-radius:8px; border:0; background:transparent; cursor:pointer; font-size:20px; color:var(--muted)}
.modal-foot{display:flex; flex-wrap:wrap; gap:8px; justify-content:flex-end}
.methods{display:grid; grid-template-columns:repeat(auto-fit, minmax(140px, 1fr)); gap:10px; border:0; margin:0; padding:0}
.method{display:flex; align-items:center; gap:10px; min-height:52px; padding:0 14px; border:1px solid var(--line-2); border-radius:10px; cursor:pointer; font-weight:500}
.method:has(input:checked){border:2px solid var(--accent); background:var(--accent-soft); font-weight:600}
.method input{width:18px; height:18px; flex:none; margin:0; accent-color:var(--accent)}
@media (max-width: 560px){
  .overlay{padding:env(safe-area-inset-top,0px) 0 env(safe-area-inset-bottom,0px); align-items:stretch}
  .modal, .modal.wide{max-width:none; border-radius:0; padding:16px; min-height:100%; max-height:calc(100vh - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)); max-height:calc(100dvh - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)); box-shadow:none}
  .modal > .modal-head, .modal > form > .modal-head{top:-16px; margin-top:-16px; padding:16px 0 8px}
  .modal > .modal-foot, .modal > form > .modal-foot{bottom:-16px; margin-bottom:-16px; padding:10px 0 16px; display:grid; grid-auto-flow:column; grid-auto-columns:1fr}
  .modal-foot .btn{width:100%; white-space:normal; padding:0 10px; line-height:1.2}
  .methods{grid-template-columns:repeat(3, minmax(0,1fr)); gap:8px}
  .method{flex-direction:column; justify-content:center; gap:6px; min-height:64px; padding:8px 6px; font-size:13px; line-height:1.2; text-align:center}
  .totals .grand span:last-child{font-size:24px}
}
.bigval{min-height:52px; display:flex; align-items:center; padding:0 14px; border:1px solid transparent; border-radius:10px; font-family:var(--mono); font-size:22px; font-weight:600}
.bigin{min-height:52px; font-family:var(--mono); font-size:22px}
.quick{display:flex; flex-wrap:wrap; gap:8px; align-items:center}
.quick .btn{font-family:var(--mono); min-height:40px; padding:0 12px}

/* auth */
.app-footer{padding:12px 32px; border-top:1px solid var(--line); color:var(--muted); font-size:12px; text-align:center}
/* pantallas previas (login, configuración inicial…): paleta oscura fija (el logo es blanco) y card en vidrio */
.auth{
  --login-bg:#0B1220; --login-bg-2:#131C2E; --login-card:rgba(24,34,51,.55); --login-field:rgba(15,23,38,.6);
  --login-line:#2A3850; --login-glow:rgba(53,106,216,.35); --login-glow-2:rgba(38,160,200,.18);
  --surface:var(--login-field); --soft:var(--login-field); --line:var(--login-line); --line-2:var(--login-line);
  --ink:#DCE3EC; --muted:#93A1B3; --accent:#356AD8; --accent-h:#4A7BE0; --on-accent:#FFFFFF;
  --err:#FF9C92; --err-bg:#3A1714; --warn:#F2B36B; --warn-bg:#33240E;
  color-scheme:dark; color:var(--ink); min-height:100vh;
  display:flex; align-items:center; justify-content:center; padding:32px 16px;
  background:
    radial-gradient(520px circle at 32% 22%, var(--login-glow), transparent 65%),
    radial-gradient(460px circle at 70% 78%, var(--login-glow-2), transparent 65%),
    linear-gradient(160deg, var(--login-bg), var(--login-bg-2));
}
.auth .card{
  width:100%; max-width:374px; padding:27px 26px; gap:17px;
  background:linear-gradient(155deg, rgba(255,255,255,.10), rgba(255,255,255,.02) 55%), var(--login-card);
  border:1px solid rgba(255,255,255,.12); border-radius:20px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.18), inset 0 -1px 0 rgba(255,255,255,.04), 0 24px 60px rgba(0,0,0,.45);
  -webkit-backdrop-filter:blur(24px) saturate(160%); backdrop-filter:blur(24px) saturate(160%);
}
.auth .card.wide{max-width:540px; padding:28px 30px; gap:20px}
.auth-logo{display:block; max-width:100%; max-height:102px; margin:0 auto; object-fit:contain}
.auth .card.wide .auth-logo{max-height:76px}
.auth-head{text-align:center}
.auth-head h1{margin:0; font-size:20px; font-weight:600}
.auth-head p{margin:4px 0 0; font-size:14px; color:var(--muted)}
.auth-sec{display:flex; flex-direction:column; gap:12px}
.auth-sec h2{display:flex; align-items:center; gap:10px; margin:0; font-size:12px; font-weight:600; letter-spacing:.06em; text-transform:uppercase; color:var(--muted)}
.auth-sec h2::after{content:""; flex:1; height:1px; background:var(--login-line)}
.auth-grid{display:grid; grid-template-columns:1fr 1fr; gap:14px; align-items:start}
.auth-grid .full{grid-column:1/-1}
@media (max-width:520px){ .auth-grid{grid-template-columns:1fr} .auth .card.wide{padding:24px 20px} }
.auth .input{transition:border-color .15s, box-shadow .15s}
.auth .input:focus{outline:none; border-color:var(--accent); box-shadow:0 0 0 3px rgba(53,106,216,.25)}
.auth select.input option{background:var(--login-bg-2); color:var(--ink)}
@supports not ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))){
  .auth .card{background:#182233}
}
@media (prefers-reduced-transparency: reduce){
  .auth .card{background:#182233; -webkit-backdrop-filter:none; backdrop-filter:none}
}

/* kpis & bars */
.kpis{display:grid; grid-template-columns:repeat(auto-fit, minmax(190px, 1fr)); gap:14px}
.kpi{background:var(--surface); border:1px solid var(--line); border-radius:12px; padding:16px 18px; display:flex; flex-direction:column; gap:4px}
.kpi .k{font-size:13px; color:var(--muted)}
.kpi .v{font-family:var(--mono); font-size:26px; font-weight:600}
.kpi .s{font-size:12px; color:var(--muted)}
.bar{height:10px; border-radius:5px; background:var(--soft); border:1px solid var(--line); overflow:hidden}
.bar i{display:block; height:100%; background:var(--accent)}
.duo{display:flex; flex-wrap:wrap; gap:20px; align-items:stretch}
.duo > *{flex:1 1 420px}
.daynav{display:flex; gap:6px; align-items:center}
.daynav .btn{padding-left:12px; padding-right:12px}
.delta{font-size:12px; color:var(--muted); font-weight:500}
.delta.up{color:var(--ok)} .delta.down{color:var(--err)}
.kpi.alert{border-color:var(--err)}
.hours-wrap{overflow-x:auto}
.hours{display:flex; align-items:flex-end; gap:6px; height:170px; min-width:min-content; padding-top:4px}
.hours .h{flex:1 0 34px; display:flex; flex-direction:column; align-items:center; justify-content:flex-end; height:100%; gap:4px}
.hours .h i{display:block; width:100%; max-width:44px; min-height:2px; background:var(--accent); opacity:.55; border-radius:4px 4px 0 0}
.hours .h.peak i{opacity:1}
.hours .h b{font-size:11px; font-family:var(--mono); font-weight:600}
.hours .h span{font-size:11px; color:var(--muted)}
.drop{display:flex; flex-direction:column; align-items:center; justify-content:center; gap:8px; min-height:140px; padding:16px; border:2px dashed var(--line-2); border-radius:10px; background:var(--soft); text-align:center; cursor:pointer}
.drop.over{border-color:var(--accent); background:var(--accent-soft)}
.progress{height:8px; border-radius:4px; background:var(--soft); border:1px solid var(--line); overflow:hidden}
.progress i{display:block; height:100%; background:var(--accent); transition:width .2s}

/* toast */
#toast{position:fixed; left:50%; bottom:calc(20px + env(safe-area-inset-bottom,0px)); transform:translateX(-50%); z-index:80; display:flex; flex-direction:column; gap:8px; align-items:center; pointer-events:none; width:min(92vw, 480px)}
.toast{pointer-events:auto; padding:12px 16px; border-radius:10px; box-shadow:var(--shadow); font-size:14px; font-weight:500; background:var(--ink); color:var(--bg)}
.toast.err{background:var(--err-bg); color:var(--err); border:1px solid var(--err)}
.toast.ok{background:var(--ok-bg); color:var(--ok); border:1px solid var(--ok)}
.toast.warn{background:var(--warn-bg); color:var(--warn); border:1px solid var(--warn)}

/* receipt */
.ticket-wrap{display:flex; justify-content:center; padding:20px; background:var(--soft); border-radius:12px; border:1px solid var(--line)}
.ticket{width:300px; background:#FFFFFF; color:#111111; padding:20px 16px; font-family:var(--mono); font-size:12px; line-height:1.5; display:flex; flex-direction:column; gap:8px; box-shadow:0 2px 8px rgba(0,0,0,.12)}
.ticket .c{text-align:center; display:flex; flex-direction:column}
.ticket .c b{font-size:14px}
.ticket hr{border:0; border-top:1px dashed #555; margin:2px 0; width:100%}
.ticket .lr{display:flex; justify-content:space-between; gap:8px}
.ticket .tot{font-weight:600; font-size:15px}
.ticket .void{text-align:center; font-weight:600; border:1px solid #111; padding:4px}
#print-area{display:none}
.pr-pill{display:inline-flex; align-items:center; gap:6px; min-height:34px; max-width:260px; padding:0 12px; border-radius:999px; border:1px solid var(--line); background:var(--surface); color:var(--ink-2); font-size:13px; font-weight:500; cursor:pointer}
.pr-pill:hover{border-color:var(--muted)}
.pr-pill span.t{overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.pr-pill .dot{flex:none; width:8px; height:8px; border-radius:50%; background:var(--muted)}
.pr-pill.ok .dot{background:var(--ok)} .pr-pill.warn .dot{background:var(--warn)} .pr-pill.warn{color:var(--warn); border-color:var(--warn)}
@media (max-width: 560px){ .pr-pill span.t{display:none} }
@media print{
  @page{size:80mm auto; margin:3mm}
  body{background:#fff}
  #app,#toast,#modal-root{display:none !important}
  #print-area{display:block !important}
  #print-area .ticket{box-shadow:none; width:72mm; padding:0}
}
@media (prefers-reduced-motion: reduce){ *:not(.side):not(.side > *){transition:none !important; animation:none !important} }
