/* ==========================================================================
   SAMPLE — restaurant till and kitchen display
   ==========================================================================
   Two screens that have to agree with each other and never do in cheap
   systems: the till the waiter taps, and the screen the kitchen reads. They
   are shown side by side here on purpose, because the interesting part is the
   seam between them.

   Warm and high-contrast: this runs on a greasy tablet under kitchen lights,
   operated by someone moving fast with one hand.

   Scoped under .pos.
   ========================================================================== */

.pos {
  --bg:     #12100e;
  --bg-2:   #1b1815;
  --panel:  #221e1a;
  --panel-2:#2b2621;
  --line:   #363029;
  --line-2: #4a4138;
  --ink:    #f7f3ee;
  --ink-2:  #bfb3a5;
  --ink-3:  #a1957f;   /* 5.1:1 on the panel; #948878 was 4.32 and failed */

  --hot:    #f97316;
  --gold:   #fbbf24;
  --green:  #4ade80;
  --red:    #f87171;
  --blue:   #60a5fa;

  --sans: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;

  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
.pos *, .pos *::before, .pos *::after { box-sizing: border-box; }
.pos svg { display: block; }
.pos a { color: var(--hot); }
.pos :focus-visible { outline-color: var(--hot); }

.pos-wrap { width: 100%; max-width: 94rem; margin-inline: auto; padding: 1rem clamp(.75rem, 2.5vw, 1.75rem) 4rem; }

/* ------------------------------------------------------------------ bar --- */

.pos-top {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .7rem clamp(.75rem, 2.5vw, 1.75rem);
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 2.2rem; z-index: 40;
}
.pos-brand {
  display: flex; align-items: center; gap: .6rem;
  margin: 0; font-size: 1rem; font-weight: 700; letter-spacing: -0.01em;
}
.pos-brand i {
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--hot); color: #2b1204;
  display: grid; place-items: center;
  font-style: normal; font-weight: 900; font-size: .8rem;
}
.pos-top .sp { margin-left: auto; }
.pos-meta { display: flex; gap: 1.2rem; font-size: .78rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pos-meta b { color: var(--ink); font-weight: 600; }

/* --------------------------------------------------------------- layout --- */

.pos-cols {
  display: grid; gap: .9rem;
  grid-template-columns: minmax(0, 1fr);
  margin-top: 1rem;
}
@media (min-width: 60rem)  { .pos-cols { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); } }
@media (min-width: 86rem)  { .pos-cols { grid-template-columns: minmax(0, 1.5fr) minmax(0, .95fr) minmax(0, 1.05fr); } }

.pcard { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.pcard__head {
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem .9rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}
.pcard__head h2 { margin: 0; font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.pcard__head .sp { margin-left: auto; }
.pcard__body { padding: .9rem; }
.pcard__body--flush { padding: 0; }

/* ----------------------------------------------------------------- menu --- */

.pos-cats { display: flex; gap: .4rem; flex-wrap: wrap; padding: .7rem .9rem; border-bottom: 1px solid var(--line); }
.pos-cat {
  font: inherit; font-size: .76rem; font-weight: 600;
  padding: .35rem .8rem; border-radius: 99px;
  border: 1px solid var(--line-2); background: transparent; color: var(--ink-2);
  cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.pos-cat:hover { color: var(--ink); border-color: var(--ink-3); }
.pos-cat[aria-pressed="true"] { background: var(--hot); border-color: var(--hot); color: #2b1204; }

.pos-menu { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); padding: .9rem; }
.pos-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: .2rem;
  padding: .7rem .8rem;
  min-height: 4.6rem;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel-2);
  color: inherit; font: inherit; text-align: left;
  cursor: pointer;
  transition: border-color .15s, transform .1s, background .15s;
}
.pos-item:hover { border-color: var(--hot); background: #322b24; }
.pos-item:active { transform: scale(.97); }
.pos-item b { font-size: .88rem; font-weight: 600; line-height: 1.25; }
.pos-item span { margin-top: auto; font-family: var(--mono); font-size: .82rem; color: var(--gold); }
.pos-item u { text-decoration: none; font-size: .68rem; color: var(--ink-3); }

/* --------------------------------------------------------------- ticket --- */

.pos-lines { display: grid; }
.pos-line {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: .1rem .7rem;
  align-items: center;
  padding: .55rem .9rem;
  border-bottom: 1px solid var(--line);
  font-size: .85rem;
}
.pos-line__q {
  grid-row: span 2;
  min-width: 1.8rem; height: 1.8rem;
  display: grid; place-items: center;
  border-radius: 6px;
  background: var(--panel-2);
  font-family: var(--mono); font-size: .78rem; font-weight: 700;
}
.pos-line__n { font-weight: 600; }
.pos-line__m { grid-column: 2; font-size: .72rem; color: var(--hot); }
.pos-line__p { grid-row: span 2; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.pos-line__x {
  grid-row: span 2;
  width: 24px; height: 24px; border: 0; border-radius: 6px;
  background: none; color: var(--ink-3); cursor: pointer;
  display: grid; place-items: center;
}
.pos-line__x:hover { background: #3a2420; color: var(--red); }

.pos-empty { padding: 2.4rem 1rem; text-align: center; color: var(--ink-3); font-size: .85rem; }

.pos-tot { padding: .9rem; border-top: 1px solid var(--line); display: grid; gap: .3rem; font-size: .85rem; }
.pos-tot div { display: flex; justify-content: space-between; }
.pos-tot dt { color: var(--ink-2); }
.pos-tot dd { margin: 0; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.pos-tot .big { margin-top: .35rem; padding-top: .5rem; border-top: 1px solid var(--line); font-size: 1.15rem; font-weight: 700; }
.pos-tot .big dd { color: var(--gold); }

.pbtn {
  font: inherit; font-size: .82rem; font-weight: 600;
  padding: .55rem 1rem; border-radius: 9px;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--ink);
  cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s;
}
.pbtn:hover { background: #332c25; border-color: var(--ink-3); }
.pbtn:active { transform: scale(.97); }
.pbtn[disabled] { opacity: .4; cursor: not-allowed; }
.pbtn--go { background: var(--hot); border-color: var(--hot); color: #2b1204; }
.pbtn--go:hover { background: #fb8b3a; border-color: #fb8b3a; }
.pbtn--sm { font-size: .72rem; padding: .3rem .65rem; }

/* -------------------------------------------------------------- kitchen --- */

.kds { display: grid; gap: .7rem; padding: .9rem; }
.kds-ticket {
  border: 1px solid var(--line-2);
  border-left: 4px solid var(--c, var(--blue));
  border-radius: 10px;
  background: var(--panel-2);
  padding: .7rem .8rem;
  animation: kds-in .3s cubic-bezier(.16,1,.3,1);
}
@keyframes kds-in { from { opacity: 0; transform: translateY(-6px); } }
.kds-ticket[data-age="warn"] { --c: var(--gold); }
.kds-ticket[data-age="late"] { --c: var(--red); }
.kds-ticket[data-age="late"] .kds-clock { color: var(--red); }
.kds-ticket[data-s="ready"]  { --c: var(--green); opacity: .72; }

.kds-head { display: flex; align-items: baseline; gap: .5rem; margin-bottom: .5rem; }
.kds-head b { font-size: .9rem; }
.kds-head .sp { margin-left: auto; }
.kds-clock { font-family: var(--mono); font-size: .82rem; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.kds-list { margin: 0 0 .6rem; padding: 0; list-style: none; display: grid; gap: .25rem; font-size: .82rem; }
.kds-list li { display: flex; gap: .5rem; }
.kds-list em { font-style: normal; font-family: var(--mono); color: var(--ink-3); min-width: 1.4rem; }
.kds-list span { color: var(--hot); font-size: .74rem; }
.kds-empty { padding: 2rem 1rem; text-align: center; color: var(--ink-3); font-size: .85rem; }

/* ---------------------------------------------------------------- toasts --- */

.pos-toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 90; display: grid; gap: .5rem; justify-items: end; }
.pos-toast {
  background: var(--panel); border: 1px solid var(--line-2);
  border-left: 3px solid var(--hot);
  border-radius: 8px; padding: .55rem .85rem; font-size: .8rem; max-width: 22rem;
  box-shadow: 0 16px 34px -18px #000;
  animation: pos-in .25s cubic-bezier(.16,1,.3,1);
}
.pos-toast[data-k="ok"] { border-left-color: var(--green); }
@keyframes pos-in { from { opacity: 0; transform: translateY(8px); } }

/* ------------------------------------------------------------ the notes --- */

.pos-note {
  margin-top: 1.5rem;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: clamp(1.1rem, 3vw, 2rem);
}
.pos-note h2 { margin: 0 0 .8rem; font-size: 1.25rem; letter-spacing: -0.02em; }
.pos-note h3 { margin: 1.6rem 0 .4rem; font-size: .95rem; }
.pos-note p  { margin: 0 0 .7rem; color: var(--ink-2); line-height: 1.7; max-width: 46rem; }
.pos-note code {
  font-family: var(--mono); font-size: .86em;
  background: #191512; border-radius: 4px; padding: .1em .35em; color: var(--gold);
}

/* The float-vs-integer demonstration runs live rather than being typed out. */
.pos-proof {
  display: grid; gap: .5rem;
  margin: 1rem 0;
  padding: .9rem 1rem;
  background: #191512;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: var(--mono); font-size: .82rem;
}
.pos-proof div { display: flex; gap: .8rem; align-items: baseline; flex-wrap: wrap; }
.pos-proof dt { color: var(--ink-3); min-width: 11rem; }
.pos-proof dd { margin: 0; }
.pos-proof .bad  { color: var(--red); }
.pos-proof .good { color: var(--green); }

@media (prefers-reduced-motion: reduce) {
  .pos *, .pos *::before, .pos *::after {
    transition-duration: .01ms !important; animation-duration: .01ms !important;
  }
}
