/*
  Mukhtar Partner Console.

  This runs on whatever device the restaurant has at the counter, which in
  practice means an old Android phone with a cracked screen under bright
  lights, held by someone with a queue in front of them. Every choice here
  follows from that:

  - Light, very high contrast. Dark themes look good in an office and wash
    out under restaurant lighting on a cheap panel.
  - Nothing smaller than 16px, and touch targets at 56px and up.
  - No animation that delays an action. The only motion is feedback.
  - One column, always. No layout that depends on width.
*/

:root {
  --navy: #002147;
  --navy-2: #00316B;
  /* The brand emerald that replaced gold, shared with the portal, the
     employee app and the website. */
  --brand-green: #2FA47D;
  --ink: #0B1220;
  --grey: #6B7280;
  --line: #D8DDE4;
  --paper: #F4F6F9;
  --white: #FFFFFF;
  --good: #0A7C3E;
  --bad: #B3261E;
  --warn: #8A5A00;
  --r: 12px;
  font-size: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* ── Cold start ────────────────────────────────────────────────────────
   Two beats, identical in all three Mukhtar apps.

   One: brand green fills the screen and the white falcon wipes in top to
   bottom, the eye pops, MUKHTAR rises.
   Two: the whole thing inverts. Green ground snaps to white, mark and
   wordmark snap to green, held a moment, then the till screen appears.

   The flip is a hard cut, not a fade. Fading it would read as the splash
   petering out; snapping reads as a deliberate signature. `steps(1, end)`
   is what makes it a cut rather than a blend of two greens. */

#splash {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: var(--brand-green);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .40s ease;
  animation: splash-flip-bg .01s steps(1, end) 2.30s forwards;
}
#splash.gone { opacity: 0; pointer-events: none; }
#splash[hidden] { display: none; }

.splash-stack { display: flex; flex-direction: column; align-items: center; }

.splash-mark {
  overflow: visible;
  clip-path: inset(0 0 100% 0);
  transform: scale(1.12);
  animation: splash-wipe 1.25s cubic-bezier(.65,0,.35,1) .04s forwards;
}

/* The falcon body. Starts white on green, snaps to green on white. */
.splash-fill {
  fill: #FFFFFF;
  animation: splash-flip-mark .01s steps(1, end) 2.30s forwards;
}

.splash-eye {
  transform-box: view-box;
  transform-origin: 34px 31px;
  transform: scale(0);
  animation: splash-eye .6s cubic-bezier(.34,1.56,.64,1) 1s forwards;
}

.splash-word {
  display: flex;
  margin-top: 20px;
  font-size: 21px;
  font-weight: 300;
  letter-spacing: .32em;
  padding-left: .32em;
  text-transform: uppercase;
  color: #FFFFFF;
  animation: splash-flip-word .01s steps(1, end) 2.30s forwards;
}
.splash-word span { opacity: 0; animation: splash-letter .5s ease forwards; }
.splash-word span:nth-child(1) { animation-delay: 1.42s; }
.splash-word span:nth-child(2) { animation-delay: 1.47s; }
.splash-word span:nth-child(3) { animation-delay: 1.53s; }
.splash-word span:nth-child(4) { animation-delay: 1.58s; }
.splash-word span:nth-child(5) { animation-delay: 1.64s; }
.splash-word span:nth-child(6) { animation-delay: 1.69s; }
.splash-word span:nth-child(7) { animation-delay: 1.75s; }

@keyframes splash-wipe {
  to { clip-path: inset(0 0 0% 0); transform: scale(1); }
}
@keyframes splash-eye {
  0%   { transform: scale(0); }
  70%  { transform: scale(1.25); }
  100% { transform: scale(1); }
}
@keyframes splash-letter {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
@keyframes splash-flip-bg   { to { background: #FFFFFF; } }
@keyframes splash-flip-mark { to { fill: var(--brand-green); } }
@keyframes splash-flip-word { to { color: var(--brand-green); } }

/* A cashier who has asked their phone to stop animating still gets the
   finished state, in the flipped colours, immediately and without movement. */
@media (prefers-reduced-motion: reduce) {
  #splash { background: #FFFFFF; animation: none; }
  .splash-mark { animation: none; clip-path: none; transform: none; }
  .splash-fill { fill: var(--brand-green); animation: none; }
  .splash-eye  { animation: none; transform: scale(1); }
  .splash-word { color: var(--brand-green); animation: none; }
  .splash-word span { animation: none; opacity: 1; }
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: contain;
}

body { min-height: 100dvh; }

.screen[hidden] { display: none !important; }

/* ── Sign in ──────────────────────────────────────────────────────────── */

#signin {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  background: var(--navy);
}

.signin-box {
  width: 100%;
  max-width: 420px;
  background: var(--white);
  border-radius: 16px;
  padding: 28px 22px 22px;
}

.mark {
  font-size: 12px;
  letter-spacing: .34em;
  color: var(--navy);
  font-weight: 600;
}

.signin-box h1 {
  font-size: 26px;
  margin: 10px 0 6px;
  letter-spacing: -.01em;
}

.lead { margin: 0 0 20px; color: var(--grey); font-size: 15px; line-height: 1.5; }

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--grey);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin: 0 0 6px;
}

input[type="text"], input[type="password"] {
  width: 100%;
  height: 56px;
  padding: 0 14px;
  font-size: 19px;
  font-family: inherit;
  color: var(--ink);
  background: var(--white);
  border: 2px solid var(--line);
  border-radius: var(--r);
  margin: 0 0 16px;
}

input:focus { outline: none; border-color: var(--navy); }

#code { text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
#pin  { letter-spacing: .5em; font-size: 24px; }

.btn-primary {
  width: 100%;
  min-height: 56px;
  border: 0;
  border-radius: var(--r);
  background: var(--navy);
  color: var(--white);
  font-size: 17px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.btn-primary:active { background: var(--navy-2); }
.btn-primary[disabled] { opacity: .55; }
.btn-primary.big { min-height: 64px; font-size: 19px; }

.btn-quiet {
  border: 0;
  background: none;
  color: var(--grey);
  font-family: inherit;
  font-size: 15px;
  padding: 12px 8px;
  cursor: pointer;
}
.btn-quiet.danger { color: var(--bad); width: 100%; margin-top: 6px; }

.error {
  background: #FDECEA;
  color: var(--bad);
  border-radius: var(--r);
  padding: 12px 14px;
  font-size: 15px;
  margin: 0 0 14px;
  line-height: 1.45;
}

.help { color: var(--grey); font-size: 13px; text-align: center; margin: 18px 0 0; }

/* ── The counter ──────────────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--navy);
  color: var(--white);
}

.who { min-width: 0; line-height: 1.25; }
.who strong { display: block; font-size: 16px; }
.who span { font-size: 13px; opacity: .75; }

.topbar-right { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.topbar-right .btn-quiet { color: rgba(255,255,255,.8); }

.net { font-size: 11px; color: #6EE7A8; }
.net.off { color: #FFB4AE; }

.today {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 18px;
  padding: 12px 16px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}
.today span { font-weight: 700; }
.today .muted { color: var(--grey); font-size: 12px; width: 100%; }

.queue-wrap { padding: 16px 16px calc(28px + env(safe-area-inset-bottom)); }

.queue-head {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--grey);
  margin: 4px 0 12px;
}

/* A waiting guest. The whole card is the target, because a thumb on a
   cracked screen is not precise. */
.row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  background: var(--white);
  border: 2px solid var(--line);
  border-radius: var(--r);
  padding: 16px 14px;
  margin: 0 0 10px;
  font-family: inherit;
  cursor: pointer;
}
.row:active { border-color: var(--navy); }

.code-chip {
  font-family: "SF Mono", Consolas, "Roboto Mono", monospace;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--navy);
  background: #EAF0F7;
  border-radius: 8px;
  padding: 8px 12px;
  flex-shrink: 0;
}

.row-body { min-width: 0; flex: 1; }
.row-name { font-size: 17px; font-weight: 600; }
.row-meta { font-size: 13px; color: var(--grey); margin-top: 2px; }
.row-go { color: var(--grey); font-size: 22px; flex-shrink: 0; }

.empty { text-align: center; padding: 44px 20px; color: var(--grey); }
.empty-mark { font-size: 34px; color: var(--line); }
.empty p { margin: 6px 0; font-size: 15px; }
.empty strong { color: var(--ink); }
.muted { color: var(--grey); }

/* ── Bill entry ───────────────────────────────────────────────────────── */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: var(--paper);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.sheet-inner {
  max-width: 460px;
  margin: 0 auto;
  padding: calc(10px + env(safe-area-inset-top)) 16px calc(28px + env(safe-area-inset-bottom));
}

.back { padding-left: 0; }

.bill-who { display: flex; align-items: center; gap: 12px; margin: 4px 0 20px; font-size: 17px; }

.amount-label {
  text-align: center;
  margin-bottom: 4px;
}

.amount {
  text-align: center;
  font-size: 46px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--navy);
  padding: 6px 0 2px;
  font-variant-numeric: tabular-nums;
}

.offer-line {
  text-align: center;
  color: var(--grey);
  font-size: 14px;
  margin: 0 0 18px;
  min-height: 20px;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 0 0 22px;
}

.keypad button {
  min-height: 62px;
  font-size: 26px;
  font-weight: 600;
  font-family: inherit;
  color: var(--ink);
  background: var(--white);
  border: 2px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
}
.keypad button:active { background: #E8EDF4; border-color: var(--navy); }
.keypad .del { color: var(--bad); font-size: 22px; }

.final-note {
  text-align: center;
  color: var(--grey);
  font-size: 13px;
  line-height: 1.5;
  margin: 14px 0 0;
}

/* ── Done ─────────────────────────────────────────────────────────────── */

#done {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
}

.done-inner { width: 100%; max-width: 400px; text-align: center; }

.tick {
  width: 76px;
  height: 76px;
  line-height: 76px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--good);
  color: var(--white);
  font-size: 40px;
}

.done-lead { font-size: 21px; font-weight: 700; margin: 0 0 22px; }

.done-rows {
  text-align: left;
  border: 2px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  margin: 0 0 22px;
}
.done-rows > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
}
.done-rows > div:last-child { border-bottom: 0; }
.done-rows span { color: var(--grey); }
.done-rows strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.done-rows .off strong { color: var(--good); }
.done-rows .pay { background: #EAF0F7; }
.done-rows .pay strong { font-size: 24px; color: var(--navy); }

@media (prefers-reduced-motion: no-preference) {
  .row, .keypad button, .btn-primary { transition: background-color .12s, border-color .12s; }
}
