/* ============================================================
   Restaurant POS — "Service Counter" design system
   Dark chrome above, bright work surface below, one blue accent.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700&family=Inter:wght@400;500;600;700&family=Roboto+Mono:wght@400;500;700&display=swap');
/* Sinhala and Tamil are served from this server, not a font CDN.
   A kitchen ticket is drawn in the browser using these faces - if they
   failed to load, the ticket would print as empty boxes. Too important
   to depend on an outside service or on the till PC happening to have a
   Sinhala font installed. */
@font-face {
  font-family: 'Noto Sans Sinhala';
  src: url('../fonts/NotoSansSinhala-Regular.ttf') format('truetype');
  font-weight: 400 700;
  font-display: block;
}
@font-face {
  font-family: 'Noto Sans Tamil';
  src: url('../fonts/NotoSansTamil-Regular.ttf') format('truetype');
  font-weight: 400 700;
  font-display: block;
}

:root {
  --ink:        #101720;
  --chrome:     #12161D;
  --chrome-2:   #1C222C;
  --bg:         #E8ECF1;
  --surface:    #FFFFFF;
  --line:       #D5DCE5;
  --muted:      #67748A;
  --accent:     #1F4FD8;
  --accent-ink: #143BA8;
  --settle:     #0E7C55;
  --hot:        #DC3A31;
  --amber:      #B26A00;

  --r:      10px;
  --r-sm:   6px;
  --shadow: 0 1px 2px rgba(16,23,32,.08), 0 6px 18px rgba(16,23,32,.06);
  --nav-h:  56px;

  --display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --body:    'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono:    'Roboto Mono', ui-monospace, 'Courier New', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------------------------- top nav ---------------------------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--nav-h);
  background: var(--chrome);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 14px;
  color: #fff;
}

.nav__brand {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #fff;
  margin-right: 18px;
  white-space: nowrap;
}
.nav__brand:hover { text-decoration: none; }
.nav__brand b { color: #6E9BFF; }

.nav__links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.nav__link {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #AEBACB;
  padding: 8px 13px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  background: none;
  border: 0;
  cursor: pointer;
}
.nav__link:hover { background: var(--chrome-2); color: #fff; text-decoration: none; }
.nav__link.is-active { background: var(--accent); color: #fff; }

/* dropdown */
.nav__group { position: relative; }
.nav__menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 210px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: 0 14px 34px rgba(10,16,26,.22);
  padding: 6px;
  display: none;
}
.nav__group.is-open .nav__menu { display: block; }
.nav__menu a {
  display: block;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}
.nav__menu a:hover { background: #EDF1F8; color: var(--accent-ink); text-decoration: none; }

.nav__right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.nav__who {
  font-size: 12px;
  color: #93A1B5;
  text-align: right;
  line-height: 1.25;
  white-space: nowrap;
}
.nav__who strong { display: block; color: #fff; font-size: 13px; }

.nav__burger {
  display: none;
  background: var(--chrome-2);
  border: 0;
  color: #fff;
  width: 40px;
  height: 38px;
  border-radius: var(--r-sm);
  font-size: 19px;
  cursor: pointer;
}

@media (max-width: 1024px) {
  .nav__burger { display: block; }
  .nav__links {
    position: fixed;
    inset: var(--nav-h) auto 0 0;
    width: min(300px, 84vw);
    background: var(--chrome);
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 12px;
    overflow-y: auto;
    transform: translateX(-104%);
    transition: transform .22s ease;
    box-shadow: 12px 0 34px rgba(0,0,0,.3);
  }
  .nav__links.is-open { transform: none; }
  .nav__link { font-size: 19px; padding: 12px 14px; }
  .nav__menu {
    position: static;
    display: block;
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0 0 8px 14px;
    min-width: 0;
  }
  .nav__menu a { color: #AEBACB; }
  .nav__menu a:hover { background: var(--chrome-2); color: #fff; }
  .nav__who { display: none; }
}

/* ---------------------------- page shell -------------------------- */

.page { padding: 20px; max-width: 1400px; margin: 0 auto; }

.page__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

h1.title {
  font-family: var(--display);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin: 0;
}
.subtitle { color: var(--muted); font-size: 13px; margin: 4px 0 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}
.card__title {
  font-family: var(--display);
  font-size: 18px;
  letter-spacing: .05em;
  text-transform: uppercase;
  margin: 0 0 12px;
  color: var(--ink);
}

/* ---------------------------- forms ------------------------------- */

.field { margin-bottom: 12px; }
.label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 5px;
}

.input, .select, .textarea {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: #fff;
  font: inherit;
  color: var(--ink);
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(31,79,216,.15);
}
.input--num { font-family: var(--mono); text-align: right; }

/* The browser's little up/down arrows eat the right-hand side of a narrow
   box and hide the digits. Numbers are typed or tapped here, never nudged. */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.textarea { min-height: 78px; resize: vertical; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: #fff;
  font-family: var(--display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  cursor: pointer;
  line-height: 1.2;
}
.btn:hover { background: var(--accent-ink); text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn--ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { background: #F1F4F9; }
.btn--settle { background: var(--settle); }
.btn--settle:hover { background: #0A6244; }
.btn--hot { background: var(--hot); }
.btn--hot:hover { background: #B92F27; }
.btn--sm { padding: 6px 11px; font-size: 14px; }
.btn--block { width: 100%; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------- tables ------------------------------ */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Paging under (and over) long lists. */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; margin: 10px 0 2px; font-size: 13px; }
.pager__info { color: var(--muted); }
.pager__pages, .pager__per { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.pager__btn { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 34px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 600; }
a.pager__btn:hover { border-color: var(--accent); color: var(--accent); }
.pager__btn.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.pager__btn.is-off { opacity: .35; }
.pager__gap { color: var(--muted); padding: 0 2px; }
.pager__per .pager__btn { min-width: 30px; height: 28px; font-size: 12px; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.data th {
  text-align: left;
  font-family: var(--display);
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 2px solid var(--line);
  padding: 9px 10px;
  white-space: nowrap;
}
table.data td {
  padding: 10px;
  border-bottom: 1px solid #EDF1F5;
  vertical-align: middle;
}
table.data tbody tr:hover { background: #F7F9FC; }
table.data .num { font-family: var(--mono); text-align: right; white-space: nowrap; }
table.data tfoot td {
  font-family: var(--mono);
  font-weight: 700;
  border-top: 2px solid var(--line);
  border-bottom: 0;
}

.empty {
  padding: 34px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  background: #EDF1F8;
  color: var(--accent-ink);
}
.pill--void { background: #FCEBEA; color: var(--hot); }
.pill--ok   { background: #E6F4EE; color: var(--settle); }

.flash {
  padding: 11px 14px;
  border-radius: var(--r-sm);
  margin-bottom: 14px;
  font-size: 14px;
  border: 1px solid;
}
.flash--ok  { background: #E6F4EE; border-color: #B6DFCD; color: #0A5B3F; }
.flash--err { background: #FCEBEA; border-color: #F4C4C0; color: #8E251E; }

/* ============================================================
   POS SCREEN
   ============================================================ */

.pos {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 384px;
  gap: 16px;
  padding: 16px;
  align-items: start;
  max-width: 1600px;
  margin: 0 auto;
}

.pos__main { min-width: 0; }

/* ---- category bar ---- */
/* A tidy block of equal tiles, three lines deep. Ragged rows of
   different-width chips read as clutter on a busy till, so every
   category gets the same box and they line up in columns. Three lines
   is the whole budget: anything past that scrolls inside the block
   rather than pushing the food down the screen. */
.catbar {
  --cat-row: 54px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  grid-auto-rows: var(--cat-row);
  gap: 8px;
  padding-bottom: 8px;
  margin-bottom: 12px;
  max-height: calc(var(--cat-row) * 3 + 16px + 8px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.catbar::-webkit-scrollbar { width: 6px; }
.catbar::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }

.cat {
  --c: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom: 3px solid var(--c);
  border-radius: var(--r-sm);
  padding: 4px 6px;
  font-family: var(--display);
  font-size: 14px;
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--ink);
  cursor: pointer;
  overflow: hidden;
}

@media (max-width: 760px) {
  .catbar { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .cat { font-size: 12px; letter-spacing: 0; padding: 4px 4px; }
}
@media (max-width: 460px) {
  .catbar { gap: 6px; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); }
  .cat { font-size: 11px; padding: 3px 4px; letter-spacing: 0; }
}
.cat:hover { background: #F3F6FB; }
.cat.is-active { background: var(--c); color: #fff; border-color: var(--c); }

.posbar {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.posbar .input { flex: 1 1 220px; }

/* ---- item grid ---- */
.items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px;
}

.item {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 0;
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  transition: transform .1s ease, box-shadow .1s ease;
  display: flex;
  flex-direction: column;
}
.item:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(16,23,32,.14); }
.item:active { transform: translateY(0); }

.item__img {
  aspect-ratio: 4 / 3;
  width: 100%;
  object-fit: cover;
  background: #EDF1F6;
  display: block;
}
.item__noimg {
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: 30px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .05em;
}
.item__body { padding: 9px 10px 11px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.item__name {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--ink);
}
.item__price {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-ink);
  margin-top: auto;
}
.item__tag {
  position: absolute;
  top: 7px;
  right: 7px;
  background: rgba(16,23,32,.78);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

/* ============================================================
   THE DOCKET  (signature element — the cart is a live bill slip)
   ============================================================ */

.docket {
  position: sticky;
  top: calc(var(--nav-h) + 16px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 3px var(--r) var(--r) 3px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - var(--nav-h) - 32px);
}

/* torn top edge */
.docket::before {
  content: '';
  display: block;
  height: 7px;
  background:
    repeating-linear-gradient(-45deg, var(--chrome) 0 5px, transparent 5px 10px);
  opacity: .85;
  border-radius: 3px 3px 0 0;
}

.docket__head {
  padding: 11px 14px 10px;
  border-bottom: 1px dashed var(--line);
}
.docket__title {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  margin: 0 0 9px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.docket__count { font-family: var(--mono); font-size: 13px; color: var(--muted); letter-spacing: 0; }

.types { display: flex; gap: 5px; }
.type {
  flex: 1;
  padding: 7px 4px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: #fff;
  font-family: var(--display);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
}
.type.is-active { background: var(--chrome); border-color: var(--chrome); color: #fff; }

.docket__meta { display: flex; gap: 6px; padding: 9px 14px 0; }
.docket__meta .input { padding: 7px 9px; font-size: 13px; }

/* Delivery address: two lines of room, grows with what is typed, and
   never sideways - a long street name should wrap, not scroll. */
.addrbox {
  width: 100%;
  resize: vertical;
  min-height: 46px;
  line-height: 1.35;
  font-family: inherit;
}

.docket__lines {
  flex: 1;
  overflow-y: auto;
  padding: 9px 14px;
  min-height: 90px;
}

.line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 8px;
  padding: 9px 0;
  border-bottom: 1px dashed #E4EAF1;
}
.line__name { font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.line__total { font-family: var(--mono); font-size: 14px; font-weight: 700; text-align: right; }
.line__ctl { display: flex; align-items: center; gap: 6px; grid-column: 1 / -1; }

.step {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--r-sm);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  color: var(--ink);
}
.step:hover { background: #EDF1F8; border-color: var(--accent); }
.qty {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  min-width: 30px;
  text-align: center;
}
.line__unit { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-left: 2px; }
.line__act {
  margin-left: auto;
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  padding: 4px 6px;
  border-radius: 4px;
}
.line__act:hover { background: #F1F4F9; color: var(--ink); }
.line__act--del:hover { background: #FCEBEA; color: var(--hot); }
.line__note {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--amber);
  background: #FFF6E6;
  border-radius: 4px;
  padding: 3px 7px;
}

.docket__empty {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 34px 10px;
  line-height: 1.6;
}

.docket__sums { padding: 10px 14px; border-top: 1px dashed var(--line); }
.sum {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding: 3px 0;
  color: var(--muted);
}
.sum span:last-child { font-family: var(--mono); color: var(--ink); }
.sum input {
  width: 92px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 13px;
  text-align: right;
}
/* The service row carries a small editable percentage, so the figure can
   be changed on the bill in front of the cashier. */
.sum--svc input {
  width: 58px;
  margin: 0 2px 0 4px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: #fff;
  font: inherit;
  font-family: var(--mono);
  font-size: 15px;
  text-align: right;
  color: var(--ink);
}
.sum--svc input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(31,79,216,.15); }

.sum--total {
  margin-top: 7px;
  padding-top: 9px;
  border-top: 2px solid var(--ink);
  font-family: var(--display);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink);
}
.sum--total span:last-child { font-family: var(--mono); font-size: 23px; font-weight: 700; letter-spacing: -.01em; }

.docket__foot { padding: 10px 14px 14px; display: grid; gap: 7px; }
.docket__foot .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }

/* printer status dot */
.prndot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #93A1B5;
  font-weight: 500;
}
.prndot i {
  width: 8px; height: 8px; border-radius: 50%;
  background: #7A889D; display: inline-block;
}
.prndot.is-on i  { background: #35D08B; }
.prndot.is-off i { background: var(--hot); }

/* mobile cart bar */
.cartbar {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 55;
  background: var(--chrome);
  color: #fff;
  padding: 10px 14px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 -6px 20px rgba(0,0,0,.22);
}
.cartbar__sum { font-family: var(--mono); font-size: 17px; font-weight: 700; }
.cartbar__lbl { font-size: 11px; color: #93A1B5; letter-spacing: .06em; text-transform: uppercase; }

@media (max-width: 1080px) {
  .pos { grid-template-columns: minmax(0, 1fr); padding: 12px; }
  .docket {
    position: fixed;
    inset: auto 0 0 0;
    max-height: 88vh;
    border-radius: var(--r) var(--r) 0 0;
    z-index: 58;
    transform: translateY(102%);
    transition: transform .24s ease;
  }
  .docket.is-open { transform: none; }
  .cartbar { display: flex; }
  .pos__main { padding-bottom: 74px; }
  .items { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
}

/* ---------------------------- modal ------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(12,18,28,.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 90;
}
.modal.is-open { display: flex; }
.modal__box {
  background: var(--surface);
  border-radius: var(--r);
  width: 100%;
  max-width: 430px;
  padding: 20px;
  box-shadow: 0 22px 60px rgba(0,0,0,.35);
  max-height: 92vh;
  overflow-y: auto;
}
.modal__title {
  font-family: var(--display);
  font-size: 23px;
  letter-spacing: .05em;
  text-transform: uppercase;
  margin: 0 0 14px;
}
.modal__due {
  font-family: var(--mono);
  font-size: 32px;
  font-weight: 700;
  text-align: center;
  padding: 12px;
  background: #F2F5FA;
  border-radius: var(--r-sm);
  margin-bottom: 14px;
}
.tender { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.tender button {
  padding: 9px 4px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--r-sm);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.tender button:hover { border-color: var(--accent); background: #EDF1F8; }
.change {
  font-family: var(--mono);
  font-size: 15px;
  text-align: center;
  padding: 9px;
  border-radius: var(--r-sm);
  margin-bottom: 12px;
  background: #E6F4EE;
  color: var(--settle);
  font-weight: 700;
}
.change.is-short { background: #FCEBEA; color: var(--hot); }

/* ---------------------------- login ------------------------------- */

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(1100px 650px at 12% -8%, rgba(196,120,52,.20) 0%, transparent 55%),
    radial-gradient(900px 600px at 88% 108%, rgba(178,68,50,.16) 0%, transparent 55%),
    linear-gradient(160deg, #10161F 0%, #171016 100%);
}
/* A faint repeating tile of dining line-art - fork & knife, a plate, a
   cup with steam - so the page reads as "restaurant" at a glance without
   a photo, which would need real licensed imagery to look right instead
   of generic stock. Kept dim enough to never compete with the card. */
.login::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220' viewBox='0 0 220 220'%3E%3Cg fill='none' stroke='%23E8A15C' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cg transform='translate(28,28)'%3E%3Cpath d='M0 0v20M0 0c-4 0-6 3-6 7s2 6 6 8M0 0c4 0 6 3 6 7s-2 6-6 8'/%3E%3Cpath d='M22 0v34'/%3E%3Cpath d='M22 0c-5 0-8 3-8 9s3 8 8 8'/%3E%3C/g%3E%3Cg transform='translate(150,46)'%3E%3Ccircle cx='0' cy='16' r='16'/%3E%3Ccircle cx='0' cy='16' r='7'/%3E%3C/g%3E%3Cg transform='translate(52,140)'%3E%3Cpath d='M-14 20h34a15 15 0 0 1-15 15h-4a15 15 0 0 1-15-15z'/%3E%3Cpath d='M20 22c8-1 8-13 0-14'/%3E%3Cpath d='M-4-4c1 4-3 5-3 9M6-4c1 4-3 5-3 9'/%3E%3C/g%3E%3Cg transform='translate(168,160)'%3E%3Cpath d='M-16-4h32l-4 22a4 4 0 0 1-4 3h-16a4 4 0 0 1-4-3z'/%3E%3Cpath d='M-18-4h36'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  background-size: 220px 220px;
  pointer-events: none;
}
.login__box {
  width: 100%;
  max-width: 370px;
  background: var(--surface);
  border-radius: var(--r);
  padding: 28px 26px 26px;
  box-shadow: 0 24px 60px rgba(0,0,0,.4);
  position: relative;
  z-index: 1;
}
.login__brand {
  font-family: var(--display);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  text-align: center;
  margin: 0 0 4px;
}
.login__sub { text-align: center; color: var(--muted); font-size: 13px; margin: 0 0 20px; }

/* ---------------------------- reports ----------------------------- */

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.section-head {
  font-family: var(--display); font-size: 15px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); margin: 22px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line);
}
.section-head:first-of-type { margin-top: 4px; }

/* Customer flag banner on the POS docket */
.custflag {
  margin: 0 0 8px; padding: 9px 12px; border-radius: var(--r-sm);
  font-size: 13px; line-height: 1.35; border: 1px solid transparent;
}
.custflag strong { display: block; font-size: 14px; }
.custflag--green { background: #E7F6EC; border-color: #A9DCBB; color: #14532D; }
.custflag--red   { background: #FDECEC; border-color: #F3B4B4; color: #7F1D1D; }
.custflag--plain { background: #EEF1F6; border-color: var(--line); color: var(--muted); }
.custflag__meta  { opacity: .85; margin-top: 2px; }
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--r);
  padding: 14px 15px;
  box-shadow: var(--shadow);
}
.kpi__lbl {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.kpi__val { font-family: var(--mono); font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.kpi__sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi--settle { border-left-color: var(--settle); }
.kpi--settle .kpi__val { color: var(--settle); }
.kpi--hot { border-left-color: var(--hot); }
.kpi--hot .kpi__val { color: var(--hot); }
.kpi--amber { border-left-color: var(--amber); }

.filters {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.filters .field { margin: 0; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }

/* ---------------------------- print pages ------------------------- */

.slip {
  font-family: var(--mono);
  /* A receipt line is a fixed number of characters wide. Scale the type
     so all 42 of them fit the screen instead of folding in half, but never
     go below readable or above the real paper size. */
  font-size: clamp(8px, 2.7vw, 12px);
  line-height: 1.45;
  /* pre, not pre-wrap: a wrapped receipt line is a broken receipt line.
     If it cannot fit, let it scroll sideways instead. */
  white-space: pre;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 78mm;
  max-width: 100%;
  margin: 0 auto;
  padding: 6mm 3mm;
  background: #fff;
  color: #000;
  tab-size: 4;
}

@media print {
  .noprint { display: none !important; }
  /* The navigation bar is for working in, never for paper. It was coming
     out at the top of every printed card sheet and report. */
  .nav { display: none !important; }
  body { background: #fff; }
  /* On paper the printer decides the width, so drop the screen scaling
     and go back to a plain fixed size. */
  .slip {
    width: auto;
    max-width: none;
    padding: 0;
    font-size: 12px;
    overflow: visible;
    white-space: pre;
  }
  @page { margin: 4mm; }
}

/* ============================================================
   TOUCH LAYER
   Everything below adapts the interface for finger input on a
   POS terminal or tablet. Loaded last so it wins the cascade.
   ============================================================ */

/* Kill the 300ms tap delay, double-tap zoom on controls, and the
   grey flash Android paints over anything tappable. */
.btn, .cat, .item, .step, .type, .line__act, .nav__link,
.tender button, .nav__menu a, .input, .select, select, button {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Stop long-press from selecting label text or popping the
   "copy / define" menu when a cashier holds a button. */
.item, .cat, .step, .type, .btn, .line__act, .tender button {
  -webkit-user-select: none;
  user-select: none;
}

/* Momentum scrolling in the panels that scroll. */
.docket__lines, .catbar, .table-wrap, .modal__box {
  -webkit-overflow-scrolling: touch;
}

/* ---- finger-sized tap targets (44px is the comfortable floor) ---- */

.step {
  width: 44px;
  height: 44px;
  font-size: 22px;
  font-weight: 600;
}

.qty {
  font-size: 17px;
  min-width: 42px;
}

.line__act {
  min-height: 40px;
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid var(--line);
  background: #fff;
}

.line__ctl { gap: 8px; flex-wrap: wrap; }

.type {
  padding: 12px 6px;
  font-size: 15px;
  min-height: 46px;
}

.cat {
  min-height: 46px;   /* padding stays with the grid rules above */
}

.tender button { min-height: 46px; font-size: 15px; }

.btn { min-height: 46px; }
.btn--sm { min-height: 40px; padding: 9px 14px; }

.docket__meta .input,
.sum input { min-height: 42px; font-size: 15px; }

/* 16px stops iOS/Android auto-zooming when a field is focused. */
.input, .select, .textarea { font-size: 16px; }

/* Checkboxes are hard to hit at their default size. */
input[type="checkbox"] { width: 22px; height: 22px; }

/* ---- press feedback replaces hover on touch ---- */

.item:active   { transform: scale(.97); background: #EDF1F8; }
.cat:active,
.step:active,
.type:active,
.btn:active,
.tender button:active { filter: brightness(.92); }

/* ---- devices with no real pointer: drop sticky hover states ---- */

@media (hover: none) {
  .item:hover {
    transform: none;
    box-shadow: var(--shadow);
  }
  .cat:hover,
  .step:hover,
  .btn--ghost:hover,
  .line__act:hover,
  .tender button:hover,
  table.data tbody tr:hover {
    background: inherit;
  }
  .step:hover { border-color: var(--line); }
}

/* ============================================================
   POS TERMINAL SIZES
   A fixed till is usually 1024x768 or 1366x768 landscape. Keep
   the cart as a right-hand column on those rather than dropping
   it to a bottom sheet - on a mounted screen the side cart is
   what the cashier expects.
   ============================================================ */

@media (min-width: 901px) and (max-width: 1280px) {
  .pos { grid-template-columns: minmax(0, 1fr) 336px; gap: 12px; padding: 12px; }
  .items { grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); }
  .docket { position: sticky; transform: none; }
  .cartbar { display: none; }
  .pos__main { padding-bottom: 0; }
}

/* Below 900px (phones, small tablets held upright) the cart
   becomes a bottom sheet, as before. */
@media (max-width: 900px) {
  .pos { grid-template-columns: minmax(0, 1fr); padding: 12px; }
  .docket {
    position: fixed;
    inset: auto 0 0 0;
    max-height: 88vh;
    border-radius: var(--r) var(--r) 0 0;
    z-index: 58;
    transform: translateY(102%);
  }
  .docket.is-open { transform: none; }
  .cartbar { display: flex; }
  .pos__main { padding-bottom: 78px; }
}

/* Landscape tablet: shorter screen, so trim vertical padding. */
@media (max-height: 820px) and (orientation: landscape) {
  .item__body { padding: 7px 9px 9px; }
  .docket__head { padding: 9px 12px 8px; }
  .line { padding: 7px 0; }
}

/* ---- item thumbnail: photo layers over the initials tile, so a photo
       that fails to load reveals the coloured fallback instead of a
       broken-image icon ---- */
.item__thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}
.item__thumb .item__noimg,
.item__thumb .item__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
}

/* ---- toasts: confirmations and print problems that must not block
       the till the way an alert() does ---- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  z-index: 120;
  max-width: min(460px, calc(100vw - 32px));
  background: var(--chrome);
  color: #fff;
  padding: 13px 17px;
  border-radius: var(--r);
  box-shadow: 0 12px 34px rgba(0,0,0,.34);
  font-size: 14px;
  line-height: 1.5;
  opacity: 0;
  transition: opacity .22s ease, transform .22s ease;
}
.toast.is-in { opacity: 1; transform: translate(-50%, 0); }
.toast--warn { background: #7A2B25; border-left: 4px solid var(--hot); }
.toast a {
  color: #9FC0FF;
  font-weight: 600;
  text-decoration: underline;
  display: inline-block;
  padding: 6px 2px;
}
.toast button {
  background: none;
  border: 0;
  color: #E3B7B3;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
  padding: 6px 2px;
}
@media (max-width: 900px) {
  .toast { bottom: 92px; }   /* clear of the mobile cart bar */
}

/* ---- filtering ----
   .item sets display:flex, which outranks the browser's built-in
   [hidden] { display: none }. Both rules below are needed: the class
   for the category/search filter, and the attribute guard so any
   future use of `hidden` on a flex/grid element behaves as expected. */
.is-filtered { display: none !important; }
[hidden] { display: none !important; }

/* ---- portion sizes ---- */
.item__from {
  font-family: var(--body);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.item__tag--size { background: var(--accent); }

.sizes { display: grid; gap: 8px; }
.size {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: #fff;
  cursor: pointer;
  text-align: left;
}
.size:active { filter: brightness(.94); }
.size__name {
  font-family: var(--display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink);
}
.size__price {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-ink);
}
@media (hover: hover) {
  .size:hover { border-color: var(--accent); background: #EDF1F8; }
}

.line__size {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  vertical-align: 1px;
}

/* ---- edit mode ----
   Tapping Edit reloads the page and the browser often restores the old
   scroll position, so the filled-in form above goes unnoticed and the
   button looks broken. Mark it clearly and scroll to it. */
.card.is-editing {
  border-color: var(--accent);
  border-left: 4px solid var(--accent);
  scroll-margin-top: calc(var(--nav-h) + 12px);
}
.card.is-editing .card__title { color: var(--accent-ink); }

@keyframes editflash {
  0%   { background: #E4EBFB; }
  100% { background: var(--surface); }
}
.card.is-editing { animation: editflash 1.1s ease-out 1; }

/* ---- collapsible submenus in the mobile drawer ----
   The drawer previously showed every Reports/Settings link at once, which
   made the menu long and hid the fact that the parent is tappable. Collapse
   them and open on tap instead. */
@media (max-width: 1024px) {
  .nav__menu { display: none; }
  .nav__group.is-open .nav__menu { display: block; }

  .nav__group > [data-drop] {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    text-align: left;
  }
  .nav__group.is-open > [data-drop] {
    background: var(--chrome-2);
    color: #fff;
  }
  .nav__menu a {
    font-size: 16px;
    padding: 11px 14px;
    border-left: 2px solid #2C3646;
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
  }
}

.nav__caret {
  display: inline-block;
  font-size: 12px;
  transition: transform .18s ease;
}
.nav__group.is-open .nav__caret { transform: rotate(180deg); }

/* ---- item codes ----
   The code is what a cashier calls out and types, so it is set large and
   dark enough to read at arm's length on a mounted till screen. */
.item__code {
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  background: #E4E9F2;
  border-radius: 5px;
  padding: 2px 9px;
  align-self: flex-start;
  letter-spacing: .01em;
  line-height: 1.35;
}
.item--out .item__code { opacity: .7; }
.pill--code {
  font-family: var(--mono);
  background: #EEF1F6;
  color: var(--muted);
  letter-spacing: .02em;
  text-transform: none;
}


/* ---- Sinhala / Tamil ----
   These scripts stack vowel signs above and below the line, so they need
   more room than Latin at the same nominal size. */
[lang="si"], [lang="ta"], .altname {
  font-family: 'Noto Sans Sinhala', 'Noto Sans Tamil', 'Iskoola Pota', 'Latha', var(--body);
  line-height: 1.85;
}
.altname {
  display: block;
  font-size: 13px;
  color: var(--accent-ink);
  font-weight: 600;
}
.line__alt {
  grid-column: 1 / -1;
  font-family: 'Noto Sans Sinhala', 'Noto Sans Tamil', var(--body);
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--muted);
}

/* ---- out of stock ---- */
.item--out { opacity: .45; cursor: not-allowed; }
.item--out .item__price { text-decoration: line-through; }
.item__tag--out { background: var(--hot); }

/* How many are left to sell. It sits on the left so it never covers the
   "sizes" or "out of stock" tag on the right, and it turns colour as the
   shelf empties, because a number nobody notices is no warning at all. */
.item__tag--left {
  right: auto;
  left: 7px;
  background: rgba(16,23,32,.72);
}
.item__tag--low  { background: #B26B00; }
.item__tag--none { background: var(--hot); }
@media (hover: hover) { .item--out:hover { transform: none; box-shadow: var(--shadow); } }

/* ---- "Show more" bar under the item grid ---- */
.showmore {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 16px 12px 4px;
}
.showmore__count {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ============================================================
   ORDER DOCKET SCROLLING

   The docket is a column: a fixed head, a scrolling list of lines, then
   totals and the Pay button pinned at the bottom. However long the order
   gets, the buttons stay reachable and the lines scroll inside.
   ============================================================ */
.docket {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - var(--nav-h) - 32px);
  overflow: hidden;                 /* the lines scroll, not the whole panel */
}
.docket__head,
.docket__meta,
.docket__sums,
.docket__foot { flex: 0 0 auto; }

.docket__lines {
  flex: 1 1 auto;
  min-height: 72px;                 /* without this, flex refuses to shrink */
  overflow-y: auto;
  overscroll-behavior: contain;     /* stop the page scrolling behind it */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.docket__lines::-webkit-scrollbar { width: 8px; }
.docket__lines::-webkit-scrollbar-thumb { background: #C3CCDA; border-radius: 4px; }
.docket__lines::-webkit-scrollbar-track { background: transparent; }

/* A soft edge at the top and bottom of the list, so a part-scrolled order
   reads as "there is more above/below" rather than as the end of it. */
.docket__lines {
  background:
    linear-gradient(var(--surface) 30%, rgba(255,255,255,0)) top / 100% 22px no-repeat,
    linear-gradient(rgba(255,255,255,0), var(--surface) 70%) bottom / 100% 22px no-repeat,
    radial-gradient(farthest-side at 50% 0, rgba(16,23,32,.13), rgba(0,0,0,0)) top / 100% 9px no-repeat,
    radial-gradient(farthest-side at 50% 100%, rgba(16,23,32,.13), rgba(0,0,0,0)) bottom / 100% 9px no-repeat;
  background-attachment: local, local, scroll, scroll;
}

@media (max-width: 900px) {
  .docket { max-height: 86vh; }
  .docket__lines { max-height: 46vh; }
}

/* Landscape tablet: little vertical room, so cap the list harder. */
@media (max-height: 760px) and (orientation: landscape) {
  .docket__lines { max-height: 38vh; }
}

/* ---- payment dialog: stacked charge choices ---- */
.paychoice { display: grid; gap: 8px; }
.paychoice .btn { width: 100%; }

/* ============================================================
   ON-SCREEN NUMPAD & KEYBOARD - popup style

   Both are a centered dialog over a dimmed backdrop, exactly the same
   wherever they open: a field low in the order list, a field inside a
   payment dialog, a dynamically added portion-size row. Sitting on top
   like any other dialog avoids the whole question of what is underneath -
   nothing to dock, squeeze, or reposition around.
   ============================================================ */

.numpad-backdrop,
.kb-backdrop {
  position: fixed;
  inset: 0;
  z-index: 130;
  background: rgba(10, 14, 20, .55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.numpad-backdrop.is-open,
.kb-backdrop.is-open { display: flex; }

.numpad,
.kb {
  background: var(--chrome);
  border-radius: var(--r);
  padding: 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,.4);
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

/* ---- shared context header: shows what is being typed ---- */
.numpad__context,
.kb__context {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 6px 10px;
  border-bottom: 1px solid #2C3646;
}
.numpad__label,
.kb__label {
  font-family: var(--display);
  font-size: clamp(13px, 1.6vw, 17px);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #93A1B5;
  white-space: nowrap;
}
.numpad__value {
  font-family: var(--mono);
  font-size: clamp(20px, 2.6vw, 30px);
  font-weight: 700;
  color: #fff;
}
.kb__value {
  font-size: clamp(14px, 1.8vw, 19px);
  font-weight: 600;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  direction: rtl;
  text-align: left;
  max-width: 60%;
}

/* ---------------------------- numpad ---------------------------- */

.numpad { width: clamp(300px, 30vw, 420px); }

.numpad__keys {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.numpad__actions { display: flex; gap: 10px; }
.numpad__actions .numpad__key--clear { flex: 1; }
.numpad__actions .numpad__key--done  { flex: 2; }

.numpad__key {
  min-height: clamp(50px, 6vw, 72px);
  border: 0;
  border-radius: var(--r-sm);
  background: var(--chrome-2);
  color: #fff;
  font-family: var(--mono);
  font-size: clamp(22px, 2.4vw, 30px);
  font-weight: 700;
  cursor: pointer;
}
.numpad__key:active { background: #333E4E; }
.numpad__key--del { font-size: clamp(20px, 2.2vw, 26px); }
.numpad__key--clear,
.numpad__key--done {
  font-family: var(--display);
  font-size: 15px;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.numpad__key--clear { background: #5A2622; color: #FCC; }
.numpad__key--done  { background: var(--settle); }

/* ---------------------------- keyboard --------------------------- */

.kb { width: clamp(420px, 44vw, 720px); }

.kb__keys { display: flex; flex-direction: column; gap: 8px; }
.kb__row { display: flex; gap: 6px; }
.kb__row:not(:last-child) { justify-content: center; }

.kb__key {
  flex: 1;
  min-width: 0;
  min-height: clamp(46px, 5.6vw, 64px);
  border: 0;
  border-radius: 8px;
  background: var(--chrome-2);
  color: #fff;
  font-family: var(--body);
  font-size: clamp(16px, 1.9vw, 23px);
  font-weight: 600;
  cursor: pointer;
  text-transform: none;
}
.kb__key:active { background: #333E4E; }

.kb__key--shift { flex: 0 0 clamp(52px, 7vw, 78px); font-size: clamp(18px, 2.1vw, 24px); }
.kb__key--shift.is-active { background: var(--accent); }
.kb__key--del   { flex: 0 0 clamp(52px, 7vw, 78px); font-size: clamp(18px, 2.1vw, 24px); }
.kb__key--sym   { flex: 0 0 clamp(62px, 7vw, 90px); font-size: clamp(13px, 1.4vw, 16px); letter-spacing: .04em; }
.kb__key--space { flex: 4 1 auto; }
.kb__key--enter { flex: 0 0 clamp(110px, 12vw, 155px); font-size: clamp(13px, 1.4vw, 16px); }
.kb__key--done  {
  flex: 0 0 clamp(90px, 11vw, 135px);
  background: var(--settle);
  font-family: var(--display);
  letter-spacing: .05em;
  text-transform: uppercase;
}

@media (max-width: 480px) {
  .numpad, .kb { width: min(360px, 100%); }
  .kb__key { min-height: 42px; font-size: 15px; }
}

/* ---- drawer backdrop ----
   Absorbs the tap used to close the drawer, so that tap does not also
   land on whatever item tile or button was showing through behind it. */
.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 59;   /* above the page, below .nav (z-index: 60) and its drawer */
  background: rgba(10, 14, 20, .45);
}
.nav-backdrop.is-open { display: block; }

@media (min-width: 1025px) {
  /* Desktop has no drawer to close. */
  .nav-backdrop { display: none !important; }
}

/* ---- ongoing orders ---- */
.ongoing__card { padding: 16px 18px; }
.ongoing__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.ongoing__table {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-right: 10px;
}
.ongoing__total { font-family: var(--mono); font-size: 22px; font-weight: 700; color: var(--accent-ink); }
.ongoing__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 13px;
  color: var(--muted);
}
.ongoing__meta strong { color: var(--ink); font-weight: 600; }

/* ---- waiter picker ---- */
.waiterpick {
  text-align: left;
  color: var(--muted);
  cursor: pointer;
  background: #fff;
}
.waiterpick--set { color: var(--ink); font-weight: 600; }
.waiterlist { max-height: 320px; overflow-y: auto; display: grid; gap: 6px; }
.waiteropt {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: #fff;
  cursor: pointer;
  text-align: left;
}
.waiteropt:active { background: #EDF1F8; }
.waiteropt__code {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  background: #EEF1F6;
  color: var(--muted);
  padding: 2px 7px;
  border-radius: 4px;
}
.waiteropt__name { font-size: 14px; font-weight: 600; }

/* ---- collapsible expense categories ---- */
.cats-card { padding: 0; overflow: hidden; }
.cats-card summary { padding: 18px 20px; }
.cats-card[open] summary { padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.cats-card__body { padding: 12px 20px 20px; }

.cats-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  user-select: none;
}
.cats-summary::-webkit-details-marker { display: none; }
.cats-summary::before {
  content: '\25B8';
  font-size: 14px;
  color: var(--muted);
  transition: transform .15s ease;
  margin-right: 2px;
}
.cats-card[open] .cats-summary::before { transform: rotate(90deg); }
.cats-summary__hint {
  font-family: var(--body);
  font-size: 12px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
}

/* ---- ongoing order: view items ---- */
.ongoing__items { margin-top: 10px; }
.ongoing__items summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--display);
  font-size: 13px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--accent-ink);
  user-select: none;
}
.ongoing__items summary::-webkit-details-marker { display: none; }
.ongoing__items summary::before {
  content: '\25B8';
  font-size: 12px;
  transition: transform .15s ease;
}
.ongoing__items[open] summary::before { transform: rotate(90deg); }
.ongoing__items table.data { font-size: 13px; }

/* ---- item lookup: search suggestions ---- */
.itemsuggest {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 40;
  margin-top: 4px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: 0 12px 28px rgba(16,23,32,.16);
  max-height: 260px;
  overflow-y: auto;
}
.itemsuggest.is-open { display: block; }
.itemsuggest__opt {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  font-size: 14px;
  cursor: pointer;
}
.itemsuggest__opt:last-child { border-bottom: 0; }
.itemsuggest__opt:hover,
.itemsuggest__opt.is-active { background: #EEF1F6; }
.itemsuggest__opt mark {
  background: none;
  color: var(--accent-ink);
  font-weight: 700;
}
.itemsuggest__empty { padding: 10px 14px; font-size: 13px; color: var(--muted); }

/* ---- menu that does not fit on one line ----
   How much room the top menu needs depends on who is logged in (an admin
   sees far more links than a cashier) and on the business name, so no
   fixed screen width can say when it stops fitting. footer.php measures
   it instead and adds .nav--compact when the links would run off the
   screen; these rules then turn it into the same drawer used on tablets,
   so every link stays reachable on a 1366px or 1440px laptop. */
.nav--compact .nav__burger { display: block; }
.nav--compact .nav__links {
  position: fixed;
  inset: var(--nav-h) auto 0 0;
  width: min(300px, 84vw);
  background: var(--chrome);
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  padding: 12px;
  overflow-y: auto;
  transform: translateX(-104%);
  transition: transform .22s ease;
  box-shadow: 12px 0 34px rgba(0,0,0,.3);
}
.nav--compact .nav__links.is-open { transform: none; }
.nav--compact .nav__link { font-size: 19px; padding: 12px 14px; }
.nav--compact .nav__menu {
  position: static;
  display: none;
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0 0 8px 14px;
  min-width: 0;
}
.nav--compact .nav__group.is-open .nav__menu { display: block; }
.nav--compact .nav__menu a {
  color: #AEBACB;
  font-size: 16px;
  padding: 11px 14px;
  border-left: 2px solid #2C3646;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.nav--compact .nav__menu a:hover { background: var(--chrome-2); color: #fff; }
.nav--compact .nav__group > [data-drop] {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
}
.nav--compact .nav__group.is-open > [data-drop] { background: var(--chrome-2); color: #fff; }

/* ---- cash drawer: the counting grid ---- */
/* A cashier counts a drawer in one pass, biggest note down, so the rows
   are in that order and each one shows what that pile is worth as it is
   typed - the running total is the point, not the arithmetic. */
.cashgrid {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
  max-width: 460px;
}
.cashgrid__head {
  background: #F3F6FB;
  padding: 9px 12px;
  font-family: var(--display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}
.cashrow {
  display: grid;
  grid-template-columns: 1fr 92px 110px;
  gap: 10px;
  align-items: center;
  padding: 5px 12px;
  border-bottom: 1px solid #EEF2F7;
}
.cashrow:last-of-type { border-bottom: 0; }
.cashrow__face { font-weight: 600; }
.cashrow__n { text-align: right; }
.cashrow__sub { text-align: right; color: var(--muted); font-size: 13px; }
.cashgrid__total {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  background: #F8FAFC;
  border-top: 1px solid var(--line);
  font-size: 16px;
}

/* The verdict line under the count: silent until something is typed. */
.cashdiff {
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: #F3F6FB;
  font-size: 15px;
  max-width: 460px;
}
.cashdiff.is-ok  { background: #E8F6EE; }
.cashdiff.is-off { background: #FDECEC; }

@media (max-width: 520px) {
  .cashgrid { max-width: none; }
  .cashrow { grid-template-columns: 1fr 76px 90px; gap: 6px; padding: 5px 9px; }
  .cashrow__sub { font-size: 12px; }
}

/* ---- attendance ID cards ---- */
/* Credit-card size, 85.6 x 54mm, so a printed sheet can be cut up and the
   cards slipped into the lanyard holders every shop already has. Sized in
   millimetres rather than pixels: what comes out of the printer has to be
   the real thing, not an approximation of it. */
/* ---- attendance cards ----------------------------------------------
   One card per direction, not one card with two codes on it. A cook
   coming in points the camera at their IN card; the OUT card stays in
   the locker until home time. Mixing both on one card is how somebody
   scans OUT on arrival.

   Card stock is 85.6 x 54mm - a bank card - so a printed sheet cuts into
   something that fits a lanyard holder or a wallet. Two to a row across
   an A4 sheet, four rows to a page. */
.attcards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86mm, 1fr));
  gap: 8mm 6mm;
  justify-items: center;
}
.attcard {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 3mm;
  width: 85.6mm;
  height: 54mm;
  border: 1px solid var(--line);
  border-radius: 3.5mm;
  background: #fff;
  padding: 3.5mm 4mm 3.5mm 5.5mm;
  break-inside: avoid;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(16, 23, 32, .08);
}
/* The band down the left edge is the card's direction at a glance, before
   anybody reads a word of it. */
.attcard::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3mm;
  background: #101720;
}
.attcard--out::before { background: #B26B00; }

.attcard__qr {
  flex: 0 0 auto;
  width: 26mm;
  align-self: center;
}
.attcard__qr svg { width: 26mm; height: 26mm; display: block; }

.attcard__body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1mm;
  padding: 1mm 0;
}
.attcard__shop {
  font-family: var(--display);
  font-size: 6.5pt;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.attcard__name {
  font-family: var(--display);
  font-size: 13pt;
  font-weight: 700;
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.attcard__role {
  font-size: 8.5pt;
  color: var(--muted);
  line-height: 1.25;
}
/* The whole point of the card, so it is the biggest thing on it. */
.attcard__dir {
  margin-top: auto;
  align-self: flex-start;
  font-family: var(--display);
  font-size: 15pt;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #fff;
  background: #101720;
  border-radius: 1.5mm;
  padding: 1mm 4mm;
  line-height: 1.2;
}
.attcard--out .attcard__dir { background: #B26B00; }

/* Buttons under a person's pair of cards. Off the printed version - a card
   with "New codes" printed on it would only confuse whoever is handed it. */
.attcard__acts {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 8px;
}
/* One person: their two cards side by side, then the buttons under both. */
.attwrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  grid-column: span 2;
}
.attpair {
  display: grid;
  grid-template-columns: repeat(2, 85.6mm);
  gap: 6mm;
  justify-content: center;
}

/* The two-step on reissuing: the warning is on the page, not in a dialog
   box somebody taps through without reading. */
.attconfirm {
  display: none;
  margin-top: 8px;
  max-width: 177mm;
  background: #FDECEC;
  border-radius: var(--r-sm);
  padding: 9px 11px;
  font-size: 13px;
  line-height: 1.4;
}
.attconfirm.is-on { display: block; }
.attconfirm .actions { margin-top: 8px; }

@media (max-width: 820px) {
  .attpair { grid-template-columns: 85.6mm; gap: 5mm; }
}

@media print {
  /* A real A4 sheet: 2 cards across, 4 down, nothing else on the page. */
  @page { size: A4 portrait; margin: 10mm; }
  .attcards {
    display: block;
    gap: 0;
  }
  .attwrap { display: contents; }
  .attpair {
    display: grid;
    grid-template-columns: repeat(2, 85.6mm);
    gap: 4mm;
    justify-content: center;
    margin: 0 0 4mm;
    break-inside: avoid;
  }
  .attcard {
    border: 1px dashed #9AA6B6;
    box-shadow: none;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ---- pay row: settle with or without a printed bill ---- */
/* The two ways of finishing a sale sit side by side, the usual one taking
   the width it had before so nobody has to re-learn where it is. */
.payrow { display: flex; gap: 8px; }
.payrow .btn { min-height: 46px; }
.payrow #btnPay { flex: 1 1 auto; }
.btn--icon {
  flex: 0 0 auto;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 6px 12px;
  line-height: 1;
}
.payrow__lbl { font-size: 10px; letter-spacing: .06em; }

/* ---- "working on it" ---- */
/* A backup of a year's trading takes a few seconds, and a restore longer.
   Nothing is more alarming than a button that goes quiet, so the button
   says what it is doing and a bar underneath keeps moving while it does. */
.btn.is-busy {
  position: relative;
  pointer-events: none;
  opacity: .92;
  padding-left: 34px;
}
.btn.is-busy::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.btn--ghost.is-busy::before {
  border-color: rgba(16, 23, 32, .25);
  border-top-color: var(--ink);
}
@keyframes spin { to { transform: rotate(360deg); } }

.proc {
  display: none;
  margin-top: 12px;
  border-radius: var(--r-sm);
  background: #F3F6FB;
  padding: 11px 14px;
  font-size: 14px;
}
.proc.is-on { display: block; }
.proc__bar {
  position: relative;
  height: 5px;
  margin-top: 8px;
  border-radius: 3px;
  background: #DDE4EE;
  overflow: hidden;
}
.proc__bar::after {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 38%;
  border-radius: 3px;
  background: var(--accent);
  animation: proc 1.1s ease-in-out infinite;
}
.proc--hot .proc__bar::after { background: var(--hot); }
@keyframes proc {
  0%   { left: -40%; }
  100% { left: 102%; }
}

/* Buttons under an attendance card. Off the printed version - a card with
   "New codes" printed on it would only confuse whoever is handed it. */
.attcard__acts {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #EEF2F7;
}

/* ---- roster sheet ---------------------------------------------------
   Seven days across and everybody down the side. Each cell carries more
   than a tick, so it gets room to breathe and a background that says at
   a glance whether somebody is on that day. */
.data.roster th,
.data.roster td { vertical-align: top; }
.roster__cell {
  background: #F7F8FA;
  padding: 7px 8px !important;
}
.roster__cell.is-on { background: #EDF4FF; }
.roster__today { box-shadow: inset 0 2px 0 var(--accent); }
.roster__on {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 5px;
}
.roster__cell.is-on .roster__on { color: var(--accent); }
.roster__times { display: flex; flex-direction: column; gap: 4px; }
/* Dimmed until the day is ticked on: an off day's times are not deleted,
   just put out of the way, so turning a day back on brings them back. */
.roster__cell:not(.is-on) .roster__times { opacity: .45; }
.roster__t { padding: 5px 6px; font-size: 13px; min-height: 0; }
.roster__brk {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--muted);
}
.roster__brk span { flex: 0 0 auto; }
.roster__b { padding: 5px 6px; font-size: 13px; min-height: 0; width: 100%; }

@media print {
  .roster__cell { background: #fff !important; }
  .roster__cell.is-on { background: #EDF4FF !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .roster__t, .roster__b { border: 0; padding: 0; background: transparent; }
}

/* ---- overview: a bar beside each day -------------------------------
   Drawn against the best day in the range, so the shape of the week is
   read at a glance instead of counted out of a column of numbers. */
.ovbar {
  display: block;
  height: 10px;
  background: #EDF0F4;
  border-radius: 5px;
  overflow: hidden;
}
.ovbar__fill { display: block; height: 100%; background: var(--accent); border-radius: 5px; }
@media print {
  .ovbar { border: 1px solid var(--line); }
  .ovbar__fill { background: #9AA6B6; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
