:root {
  --ink: #0c1730;
  --muted: #5a6b86;
  --paper: #e8eefb;
  --card: #f6f8ff;
  --line: #c5d2ee;
  --accent: #1a4cff;
  --accent-2: #6eb4ff;
  --danger: #c81e3a;
  --ok: #1a4cff;
  --shadow: 0 10px 30px rgba(12, 28, 72, 0.1);
  --sans: "IBM Plex Sans", "Segoe UI", sans-serif;
  --serif: "IBM Plex Serif", Georgia, serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  display: grid;
  grid-template-columns: 14.5rem 1fr;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
}
[hidden] { display: none !important; }
.nav {
  background: #050d22;
  color: #e8f0ff;
  padding: 1.2rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  align-self: start;
  height: 100dvh;
  max-height: 100dvh;
  position: sticky;
  top: 0;
}
.brand { color: inherit; text-decoration: none; display: flex; flex-direction: column; gap: 0.1rem; }
.nav-logo {
  display: block; width: 100%; max-height: 3.4rem; object-fit: contain;
  margin-bottom: 0.4rem; background: #fff; border-radius: 6px; padding: 0.2rem;
}
.logo-box { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; }
.logo-preview {
  height: 3.2rem; width: auto; max-width: 8rem; object-fit: contain;
  background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 0.2rem;
}
.brand span { font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase; opacity: 0.55; }
.brand strong { font-family: var(--serif); font-size: 1.45rem; font-weight: 600; }
.co { color: var(--accent-2); font-size: 0.88rem; margin: 0.4rem 0 1rem; }
.nav nav { display: flex; flex-direction: column; gap: 0.2rem; }
.nav nav button {
  appearance: none; background: transparent; border: 0; color: inherit;
  text-align: left; padding: 0.48rem 0.55rem; border-radius: 6px;
  cursor: pointer; font: inherit; opacity: 0.78;
  display: flex; justify-content: space-between; align-items: center; gap: 0.4rem;
}
.nav nav button:hover { background: rgba(255,255,255,0.06); }
.nav nav button.on { background: var(--accent); opacity: 1; }
.nav-badge {
  background: var(--danger); color: #fff; font-size: 0.68rem; font-weight: 700;
  min-width: 1.15rem; text-align: center; border-radius: 99px;
  padding: 0.08rem 0.34rem; line-height: 1.2;
}
.nav nav button.on .nav-badge { background: #fff; color: var(--danger); }
.nav-foot { margin-top: auto; display: flex; flex-direction: column; gap: 0.4rem; padding-top: 1rem; }
.nav-foot a { text-decoration: none; text-align: center; }
.nav-foot .ghost,
.nav-foot a.ghost,
.nav-foot a:link,
.nav-foot a:visited,
.nav-foot button.ghost {
  color: #e8f0ff;
  border-color: rgba(232, 240, 255, 0.4);
  background: transparent;
}
.nav-foot .ghost:hover,
.nav-foot a.ghost:hover,
.nav-foot button.ghost:hover {
  background: rgba(26, 76, 255, 0.45);
  border-color: #6eb4ff;
  color: #fff;
}
.main { min-width: 0; padding: 1.1rem 1.4rem 2.4rem; }
header.bar { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-end; margin-bottom: 1rem; flex-wrap: wrap; }
.eyebrow { font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
header.bar h1 { font-family: var(--serif); font-size: 1.85rem; font-weight: 600; }
.bar-actions { display: flex; gap: 0.4rem; align-items: center; }
.chip { font-size: 0.78rem; padding: 0.28rem 0.55rem; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.chip.ok { color: var(--ok); border-color: #9db6ff; }
.chip.bad { color: var(--danger); border-color: #e0b4b8; }

button, .ghost, a.ghost {
  appearance: none; font: inherit; cursor: pointer; border-radius: 6px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 0.42rem 0.7rem;
}
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
button.ghost, a.ghost, label.file { background: transparent; }
label.file { display: inline-flex; align-items: center; cursor: pointer; }
button.danger { color: var(--danger); }
button.pay { min-height: 3rem; font-weight: 600; }
button.pay.cb { background: #0a2ec4; color: #fff; border-color: #0a2ec4; }
button.pay.cash { background: var(--accent); color: #fff; border-color: var(--accent); }

.pos {
  display: grid;
  grid-template-columns: 1fr min(22rem, 38vw);
  gap: 0.9rem;
  min-height: calc(100dvh - 8rem);
}
.catalog { min-width: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.7rem; }
.filters button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.search { min-width: 12rem; flex: 1; font: inherit; padding: 0.42rem 0.55rem; border: 1px solid var(--line); border-radius: 6px; }
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.4rem, 1fr));
  gap: 0.5rem;
}
.tile {
  appearance: none; border: 1px solid var(--line); background: var(--card);
  border-radius: 10px; padding: 0.7rem 0.65rem 0.75rem; text-align: left;
  cursor: pointer; min-height: 7.2rem; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 0.2rem; font: inherit; color: inherit;
}
.tile:hover { border-color: var(--accent); }
.tile.off { opacity: 0.45; cursor: not-allowed; }
.tile .ic { font-size: 1.6rem; line-height: 1; }
.tile-photo, .thumb {
  display: block;
  object-fit: cover;
  background: #dce6f7;
}
.tile-photo { width: 100%; height: 4.6rem; border-radius: 7px; margin-bottom: 0.25rem; }
.thumb { width: 2.4rem; height: 2.4rem; border-radius: 6px; }
.tile-media { position: relative; }
.tile-media .g-n {
  position: absolute; right: 0.3rem; bottom: 0.45rem;
  background: rgba(5, 13, 34, 0.72); color: #fff;
  font-size: 0.65rem; padding: 0.08rem 0.32rem; border-radius: 99px;
}
.allergen-field { display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.8rem; color: var(--muted); }
.allergen-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.28rem 0.7rem;
}
.al-pick {
  display: flex !important; flex-direction: row !important; align-items: center;
  gap: 0.4rem; color: var(--ink); font-size: 0.84rem;
}
.al-pick input { margin: 0; }
.al-chips { display: flex; flex-wrap: wrap; gap: 0.22rem; margin-top: 0.18rem; }
.al-chips span {
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.01em;
  background: #f3e4d2; color: #7a3f12; border-radius: 99px;
  padding: 0.08rem 0.38rem;
}
.al-chips .al-note { background: #dce6f7; color: var(--muted); font-weight: 500; }
.tile .al-chips { margin-top: 0.15rem; }
.tile .al-chips span { font-size: 0.62rem; padding: 0.04rem 0.3rem; }
.gallery-field { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.8rem; color: var(--muted); }
.gallery-hint { font-size: 0.78rem; line-height: 1.35; }
.gallery-box {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
}
.g-item {
  width: 6.4rem; border: 1px solid var(--line); border-radius: 8px;
  background: #e8eefb; overflow: hidden; position: relative;
}
.g-item.cover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.g-item img, .g-item video {
  display: block; width: 100%; height: 4.6rem; object-fit: cover; background: #dce6f7;
}
.g-kind, .g-badge {
  position: absolute; top: 0.28rem; left: 0.28rem;
  background: rgba(5, 13, 34, 0.72); color: #fff;
  font-size: 0.62rem; padding: 0.08rem 0.3rem; border-radius: 99px;
}
.g-item.cover .g-badge { background: var(--accent); }
.g-item figcaption {
  display: flex; flex-direction: column; gap: 0.15rem;
  padding: 0.28rem;
}
.g-item figcaption button {
  font-size: 0.7rem; padding: 0.18rem 0.3rem;
}
.g-add {
  width: 6.4rem; min-height: 7.4rem;
  border: 1px dashed var(--line); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; background: #f6f8ff; color: var(--ink);
  font-size: 0.82rem; font-weight: 600;
}
.g-add input { display: none; }
.g-add:hover { border-color: var(--accent); color: var(--accent); }
.tile strong { font-size: 0.92rem; }
.tile small { color: var(--muted); }
.tile .st { margin-top: auto; font-size: 0.75rem; color: var(--muted); }
.tile .st.low { color: #b45309; font-weight: 600; }

.ticket {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.ticket h2 { font-family: var(--serif); font-size: 1.15rem; margin-bottom: 0.6rem; }
.cli-box { display: flex; flex-direction: column; gap: 0.22rem; font-size: 0.78rem; color: var(--muted); margin-bottom: 0.65rem; }
.cli-box input { font: inherit; padding: 0.38rem 0.5rem; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); }
.t-line { display: grid; grid-template-columns: 1fr auto auto; gap: 0.35rem; align-items: center; padding: 0.35rem 0; border-bottom: 1px solid var(--line); }
.t-line button { padding: 0.15rem 0.4rem; }
.qty { display: flex; gap: 0.2rem; align-items: center; }
.ticket .sum { margin-top: auto; padding-top: 0.7rem; }
.ticket .sum p { display: flex; justify-content: space-between; margin-bottom: 0.25rem; }
.ticket .sum .ttc { font-family: var(--serif); font-size: 1.35rem; font-weight: 600; }
.pays { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; margin-top: 0.7rem; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 0.9rem 1rem; box-shadow: var(--shadow); margin-bottom: 0.8rem; }
.panel h2 { font-family: var(--serif); font-size: 1.15rem; margin-bottom: 0.7rem; }
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.7rem; margin-bottom: 1rem; }
.cards-8 { grid-template-columns: repeat(4, 1fr); }
.stats-split { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.bars {
  display: flex; align-items: flex-end; gap: 0.22rem; height: 8.6rem;
}
.chart-bar {
  flex: 1; min-width: 0; height: 100%;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 0.2rem;
}
.chart-bar i {
  display: block; width: 100%; max-width: 1.6rem;
  background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px;
}
.chart-bar small { font-size: 0.62rem; color: var(--muted); line-height: 1; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 0.85rem 0.95rem; box-shadow: var(--shadow); }
.card small { color: var(--muted); display: block; margin-bottom: 0.25rem; }
.card strong { font-family: var(--serif); font-size: 1.3rem; }
.card.bad strong { color: var(--danger); }
.card.go { cursor: pointer; }
.card.go:hover { border-color: var(--accent); }

.alert-strip {
  width: 100%; margin-bottom: 0.7rem; text-align: left;
  background: #fff3e6; border-color: #f0c48a; color: #7a3f12; font-weight: 600;
}
.alert-banner {
  display: flex; justify-content: space-between; align-items: center; gap: 0.8rem;
  flex-wrap: wrap; margin-bottom: 0.8rem; padding: 0.85rem 1rem;
  background: #fff3e6; border: 1px solid #f0c48a; border-radius: 10px;
}
.alert-banner.ok { background: #e8f0ff; border-color: #9db6ff; }
.alert-banner.ok strong { color: var(--accent); }
.alert-banner strong { color: #7a3f12; display: block; margin-bottom: 0.15rem; }
.alert-list { display: flex; flex-direction: column; gap: 0.55rem; }
.alert-item {
  display: grid; grid-template-columns: auto 1fr auto; gap: 0.75rem; align-items: center;
  padding: 0.65rem 0.7rem; border-radius: 10px; border: 1px solid #f0c48a; background: #fffaf3;
}
.alert-item.crit { border-color: #e0b4b8; background: #fff1f3; }
.alert-media { width: 2.6rem; }
.alert-media .thumb, .alert-media .ic { width: 2.6rem; height: 2.6rem; border-radius: 6px; display: grid; place-items: center; font-size: 1.3rem; background: #dce6f7; }
.alert-top { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.alert-meter { height: 6px; background: #e8d7c0; border-radius: 99px; overflow: hidden; margin: 0.35rem 0 0.3rem; }
.alert-item.crit .alert-meter { background: #f0d4d8; }
.alert-meter i { display: block; height: 100%; background: #c27a1a; border-radius: 99px; }
.alert-item.crit .alert-meter i { background: var(--danger); width: 8% !important; }
.alert-actions { display: flex; flex-direction: column; gap: 0.3rem; }

@media (max-width: 720px) {
  .alert-item { grid-template-columns: auto 1fr; }
  .alert-actions { grid-column: 1 / -1; flex-direction: row; }
}
.tools { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.7rem; align-items: center; }
.tools .hint { flex: 1 1 100%; font-size: 0.82rem; }
.till-date { display: flex; align-items: center; gap: 0.4rem; font-size: 0.82rem; color: var(--muted); }
.form-grid .wide { grid-column: 1 / -1; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 0.42rem 0.45rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
td.num, th.num { text-align: right; }
.muted { color: var(--muted); }
.low { color: #b45309; font-weight: 600; }
tr.need td { background: #fff6e8; }
.bc-row { display: flex; gap: 0.4rem; align-items: center; }
.bc-row input { flex: 1; }
.bc-preview { margin-top: 0.35rem; min-height: 2.6rem; }
.bc-cell { min-width: 8.5rem; max-width: 11rem; }
.barcode { width: 100%; height: 3.1rem; display: block; }
.barcode rect { fill: #0c1730; }
.barcode text { font: 9px ui-monospace, SFMono-Regular, monospace; fill: #0c1730; }

dialog {
  border: 1px solid var(--line); border-radius: 12px; padding: 1.1rem;
  width: min(42rem, 94vw); max-height: 92vh; overflow: auto; background: var(--card);
}
dialog.print-ask {
  width: min(22rem, 94vw);
  text-align: center;
}
dialog.print-ask .hint { margin-bottom: 0.15rem; }
dialog.print-ask .print-ask-amt {
  font-family: var(--serif); font-size: 1.45rem; font-weight: 600;
  margin: 0.15rem 0 0.9rem;
}
dialog.print-ask menu { justify-content: center; }
dialog::backdrop { background: rgba(5, 13, 34, 0.5); }
dialog h2 { font-family: var(--serif); margin-bottom: 0.7rem; }
.dlg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.dlg-grid .wide { grid-column: 1 / -1; }
.prod-margin {
  margin: 0.15rem 0 0;
  background: #e8f0ff; border: 1px solid #9db6ff; border-radius: 8px;
  padding: 0.5rem 0.7rem; font-size: 0.82rem; color: var(--ink);
}
.prod-margin strong { display: block; font-size: 1rem; margin-bottom: 0.12rem; }
.prod-margin.bad { background: #fff1f3; border-color: #e0b4b8; }
.prod-margin.bad strong { color: var(--danger); }
.dlg-grid label, #form-product label { display: flex; flex-direction: column; gap: 0.22rem; font-size: 0.8rem; color: var(--muted); }
input, select, textarea {
  font: inherit; padding: 0.42rem 0.5rem; border: 1px solid var(--line);
  border-radius: 6px; background: #fff; color: var(--ink);
}
.check-row { display: flex; gap: 1rem; margin: 0.7rem 0; font-size: 0.9rem; color: var(--ink); }
.check-row label { display: inline-flex; align-items: center; gap: 0.35rem; }
dialog menu { display: flex; gap: 0.4rem; margin-top: 0.5rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.form-grid label { display: flex; flex-direction: column; gap: 0.22rem; font-size: 0.8rem; color: var(--muted); }

.toast {
  position: fixed; bottom: 1rem; right: 1rem; background: #050d22; color: #fff;
  padding: 0.65rem 0.9rem; border-radius: 8px; z-index: 20;
}
.auth-gate {
  position: fixed; inset: 0; z-index: 40;
  background: #050d22;
  display: flex; align-items: center; justify-content: center;
  padding: 1.2rem;
}
.auth-card {
  width: min(22rem, 100%);
  background: #0c1730;
  border: 1px solid #1a4cff;
  border-radius: 14px;
  padding: 1.4rem 1.3rem 1.2rem;
  color: #e8f0ff;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}
.auth-card h1 { font-family: var(--serif); font-size: 1.7rem; margin-bottom: 0.25rem; }
.auth-card .hint { color: #9db6ff; font-size: 0.88rem; margin-bottom: 0.9rem; line-height: 1.4; }
.auth-card label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.8rem; color: #9db6ff; margin-bottom: 0.55rem; }
.auth-card input {
  font: inherit; padding: 0.55rem 0.6rem; border-radius: 8px;
  border: 1px solid #3d5cb8; background: #050d22; color: #fff;
}
.auth-card .pin-in {
  font-size: 1.55rem; letter-spacing: 0.42em; text-align: center;
  font-variant-numeric: tabular-nums;
}
.auth-card .primary { width: 100%; margin-top: 0.35rem; padding: 0.7rem; }
.auth-err { color: #ff8fa0; font-size: 0.86rem; margin: 0.2rem 0 0.5rem; }
.nav-user { font-size: 0.8rem; color: #9db6ff; text-align: center; }

@media (max-width: 960px) {
  body { grid-template-columns: 1fr; }
  .nav { height: auto; max-height: none; min-height: 0; position: relative; }
  .nav nav { flex-direction: row; flex-wrap: wrap; }
  .pos { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr 1fr; }
  .stats-split { grid-template-columns: 1fr; }
}

@media print {
  .nav, header.bar, .filters, .tiles, .pays, .toast { display: none !important; }
  body { display: block; }
  .ticket { box-shadow: none; border: 0; }
}
