:root {
  --red: #C81626; --red-deep: #9E0F1C; --ink: #141010; --muted: #5F5354; --ivory: #F7F1E8; --rule: #EADFD5; --white: #fff;
  --ok: #1F7A3A; --ok-bg: #E4F3E8; --warn: #8A5A00; --warn-bg: #FFF1D6; --bad: #B3121F; --bad-bg: #FDE4E6; --wait-bg: #ECE7F5; --wait: #4B3A86;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ivory); color: var(--ink); }
body { font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; padding-bottom: env(safe-area-inset-bottom); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

/* header */
.top { background: var(--red); color: var(--white); position: sticky; top: 0; z-index: 5; }
.top .bar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; max-width: 760px; margin: 0 auto; }
.brand { font-weight: 900; letter-spacing: .04em; font-size: 20px; }
.brand small { font-weight: 600; letter-spacing: 0; opacity: .85; font-size: 14px; margin-left: 4px; }
.pill { margin-left: auto; font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 99px; background: rgba(255,255,255,.18); white-space: nowrap; }
.pill .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: #9ff0b5; }
.pill.bad .dot { background: #ffd0d0; animation: blink 1s infinite; }
.pill.warn .dot { background: #ffd66b; }
@keyframes blink { 50% { opacity: .2; } }
.tabs { display: flex; max-width: 760px; margin: 0 auto; }
.tabs button { flex: 1; background: none; border: 0; color: var(--white); padding: 10px 4px 12px; font-weight: 700; opacity: .75; border-bottom: 3px solid transparent; }
.tabs button.on { opacity: 1; border-bottom-color: var(--white); }

main { max-width: 760px; margin: 0 auto; padding: 12px 16px 120px; }
h2 { font-size: 17px; margin: 18px 0 8px; }
.card { background: var(--white); border: 1px solid var(--rule); border-radius: 12px; padding: 12px; margin: 10px 0; overflow-wrap: break-word; min-width: 0; }
.muted { color: var(--muted); font-size: 14px; }
.err { background: var(--bad-bg); color: var(--bad); border-radius: 10px; padding: 10px 12px; margin: 10px 0; font-weight: 600; }
.note { background: var(--ok-bg); color: var(--ok); border-radius: 10px; padding: 10px 12px; margin: 10px 0; font-weight: 600; }
.offline { background: var(--bad); color: var(--white); border-radius: 12px; padding: 14px; margin: 10px 0; font-weight: 700; font-size: 17px; }
.offline span { display: block; font-weight: 500; font-size: 15px; margin-top: 4px; }
.warnbox { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 10px 12px; margin: 10px 0; font-weight: 600; }

/* login */
.login { max-width: 380px; margin: 40px auto; padding: 0 16px; }
.login .logo { text-align: center; color: var(--red); font-weight: 900; font-size: 44px; letter-spacing: .05em; margin-bottom: 4px; }
.login p { text-align: center; color: var(--muted); margin-top: 0; }
label { display: block; font-weight: 600; font-size: 14px; margin: 12px 0 4px; }
input[type=text], input[type=password], input[type=tel], textarea {
  width: 100%; padding: 12px; border: 1px solid #d9cbbf; border-radius: 10px; background: var(--white); font-size: 16px; }
textarea { min-height: 64px; resize: vertical; }
input:focus, textarea:focus, button:focus-visible { outline: 3px solid rgba(200,22,38,.35); outline-offset: 1px; }
.big { width: 100%; padding: 15px; border: 0; border-radius: 12px; background: var(--red); color: var(--white); font-weight: 800; font-size: 17px; margin-top: 16px; }
.big:disabled { background: #b9a9a9; }
.big.dark { background: var(--ink); }

/* menu */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid #d9cbbf; background: var(--white); border-radius: 99px; padding: 9px 14px; font-weight: 600; font-size: 15px; }
.chip.on { background: var(--ink); color: var(--white); border-color: var(--ink); }
.item { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--rule); }
.item:first-child { border-top: 0; }
.item .name { font-weight: 700; }
.item .desc { color: var(--muted); font-size: 13px; }
.item .price { margin-left: auto; font-weight: 700; white-space: nowrap; }
.add { border: 0; background: var(--red); color: var(--white); border-radius: 10px; min-width: 44px; height: 44px; font-size: 22px; font-weight: 800; }
.opts { background: var(--ivory); border-radius: 10px; padding: 10px; margin: 0 0 10px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.opt { border: 1px solid #d9cbbf; background: var(--white); border-radius: 10px; padding: 10px 12px; min-height: 44px; font-size: 15px; }
.opt.on { background: var(--ink); color: var(--white); border-color: var(--ink); }
.qty { display: inline-flex; align-items: center; gap: 4px; }
.qty button { width: 40px; height: 40px; border: 1px solid #d9cbbf; background: var(--white); border-radius: 10px; font-size: 20px; font-weight: 700; }
.qty span { min-width: 30px; text-align: center; font-weight: 800; }

/* cart */
.line { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--rule); }
.line:first-child { border-top: 0; }
.line .what { flex: 1; }
.line .what div { font-size: 14px; color: var(--muted); }
.line .amt { font-weight: 700; white-space: nowrap; }
.x { border: 0; background: none; color: var(--bad); font-weight: 700; padding: 6px; }
.totals > div { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.totals .grand { font-size: 22px; font-weight: 900; border-top: 2px solid var(--ink); margin-top: 6px; padding-top: 8px; }
.totals .lbp { font-size: 20px; font-weight: 800; color: var(--red-deep); }

/* orders */
.order h3 { margin: 0; font-size: 17px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.status { font-size: 13px; font-weight: 800; padding: 3px 10px; border-radius: 99px; }
.s-waiting { background: var(--wait-bg); color: var(--wait); }
.s-sent { background: var(--warn-bg); color: var(--warn); }
.s-printed { background: var(--ok-bg); color: var(--ok); }
.s-failed { background: var(--bad-bg); color: var(--bad); }
.s-cancelled { background: #eee; color: #555; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.actions button { border: 1px solid #d9cbbf; background: var(--white); border-radius: 10px; padding: 9px 12px; font-weight: 700; font-size: 14px; min-height: 40px; }
.actions button.danger { color: var(--bad); border-color: #f0b8bd; }
.cmd { font-size: 13px; color: var(--muted); margin-top: 4px; }
dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; font-weight: 700; }
.foot { position: fixed; left: 0; right: 0; bottom: 0; background: var(--white); border-top: 1px solid var(--rule); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); z-index: 4; }
.foot .in { max-width: 760px; margin: 0 auto; display: flex; gap: 12px; align-items: center; }
.foot .sum { font-weight: 900; font-size: 18px; line-height: 1.15; }
.foot .sum small { display: block; font-weight: 700; font-size: 14px; color: var(--red-deep); }
.foot .big { margin: 0; width: auto; flex: 1; }
