/* ==========================================================================
   Oasis Lounge — staff screens (kitchen POS + admin dashboard)
   Loads on top of oasis.css. Built for a busy kitchen: big type, thumb-sized
   buttons, high contrast, and nothing that needs a mouse.
   ========================================================================== */

/* ---------- shared staff shell ---------- */

.staff-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 1.1rem 4rem;
}

.staff-bar {
  border-bottom: 2px solid var(--orange);
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .8rem;
  padding: .75rem 1.1rem;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.staff-bar h1 { font-size: 1.15rem; margin: 0; }
.staff-bar .spacer { flex: 1; }
.staff-clock {
  font-family: var(--sans);
  font-size: 1.35rem;
  letter-spacing: -.02em;
}

.gate {
  max-width: 420px;
  margin: 12vh auto;
  padding: 2rem;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* ==========================================================================
   Kitchen POS
   ========================================================================== */

.pos-banner {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .7rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: .92rem;
  background: rgba(233,166,60,.12);
  border: 1px solid rgba(233,166,60,.4);
  color: var(--orange);
}
.pos-banner.is-bad {
  background: rgba(224,89,107,.12);
  border-color: rgba(224,89,107,.45);
  color: #f3a8b2;
}
.pos-banner.is-good {
  background: rgba(47,169,138,.12);
  border-color: rgba(47,169,138,.4);
  color: var(--green);
}

.pos-columns {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  align-items: start;
}

.pos-ticket {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  border-left: 5px solid var(--line);
}
.pos-ticket[data-status="new"] {
  border-left-color: var(--orange);
  animation: pos-arrive .5s ease;
}
.pos-ticket[data-status="accepted"],
.pos-ticket[data-status="preparing"] { border-left-color: var(--orange-text); }
.pos-ticket[data-status="ready"],
.pos-ticket[data-status="out_for_delivery"] { border-left-color: var(--green); }
.pos-ticket[data-status="cancelled"] { border-left-color: #97202f; opacity: .6; }

@keyframes pos-arrive {
  from { transform: translateY(-8px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.pos-ticket-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .6rem;
  padding-bottom: .6rem;
  border-bottom: 1px dashed var(--line);
}
.pos-number {
  font-family: var(--sans);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -.03em;
}
.pos-type {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  padding: .2rem .5rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink-2);
}
.pos-type.delivery { color: var(--orange); border-color: rgba(233,166,60,.4); }
.pos-type.collection { color: var(--green); border-color: rgba(47,169,138,.4); }

.pos-timer {
  font-family: var(--sans);
  font-size: .85rem;
  color: var(--ink-2);
}
.pos-timer.is-late { color: #97202f; font-weight: 600; }

.pos-customer {
  margin: .7rem 0;
  font-size: .9rem;
  line-height: 1.45;
}
.pos-customer strong { display: block; font-size: 1rem; }
.pos-customer a { color: var(--orange); text-decoration: none; }

.pos-items { margin: .8rem 0; }
.pos-items li {
  display: flex;
  gap: .6rem;
  padding: .35rem 0;
  border-bottom: 1px dotted var(--line);
  font-size: 1.02rem;
  list-style: none;
}
.pos-items { padding: 0; }
.pos-items .qty {
  font-family: var(--sans);
  font-weight: 600;
  color: var(--orange);
  min-width: 2.2rem;
}
.pos-items .opt {
  display: block;
  font-size: .82rem;
  color: var(--ink-2);
}

.pos-allergy,
.pos-note {
  margin: .6rem 0;
  padding: .55rem .7rem;
  border-radius: 6px;
  font-size: .88rem;
}
.pos-allergy {
  background: rgba(224,89,107,.14);
  border: 1px solid rgba(224,89,107,.5);
  color: #f3a8b2;
  font-weight: 600;
}
.pos-note {
  background: var(--orange-line);
  border: 1px solid var(--line);
  color: var(--ink);
}

.pos-money {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--sans);
  font-size: 1.15rem;
  padding-top: .6rem;
  border-top: 1px dashed var(--line);
}
.pos-pay {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .1em;
}
.pos-pay.paid { color: var(--green); }
.pos-pay.cash { color: var(--orange); }

.pos-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-top: .9rem;
}
.pos-actions .btn { flex: 1 1 auto; min-height: 46px; }

.pos-empty {
  grid-column: 1 / -1;
  padding: 3.5rem 1rem;
  text-align: center;
  color: var(--ink-2);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.pos-recent-row {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .5rem 0;
  border-bottom: 1px solid var(--line);
  font-size: .88rem;
}
.pos-recent-row .data { margin-left: auto; }

/* Printer panel */
.printer-status {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-size: .85rem;
  color: var(--ink-2);
}
.printer-status::before {
  content: '';
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ink-2);
}
.printer-status.is-connected { color: var(--green); }
.printer-status.is-connected::before { background: var(--green); }
.printer-status.is-error { color: #97202f; }
.printer-status.is-error::before { background: #97202f; }

/* ==========================================================================
   Admin dashboard
   ========================================================================== */

.tabs {
  display: flex;
  gap: .35rem;
  overflow-x: auto;
  padding-bottom: .4rem;
  margin-bottom: 1.4rem;
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}
.tabs button {
  flex: 0 0 auto;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: .92rem;
  padding: .6rem .85rem;
  cursor: pointer;
}
.tabs button[aria-pressed="true"] {
  color: var(--ink);
  border-bottom-color: var(--orange);
}

.stat-grid {
  display: grid;
  gap: .8rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-bottom: 1.6rem;
}
.stat {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
}
.stat .label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--ink-2);
}
.stat .value {
  font-family: var(--sans);
  font-size: 1.8rem;
  letter-spacing: -.03em;
  margin-top: .3rem;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}
table.admin {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
  min-width: 720px;
}
table.admin th {
  text-align: left;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-2);
  padding: .75rem .8rem;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--white);
}
table.admin td {
  padding: .7rem .8rem;
  border-bottom: 1px solid rgba(28,73,111,.55);
  vertical-align: top;
}
table.admin tr:last-child td { border-bottom: 0; }
table.admin select { min-width: 140px; }

.kv {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .4rem 0;
  border-bottom: 1px dotted var(--line);
  font-size: .9rem;
}

.form-grid {
  display: grid;
  gap: .9rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.form-grid .full { grid-column: 1 / -1; }

.check {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-size: .9rem;
  color: var(--ink-2);
}
.check input { width: 18px; height: 18px; accent-color: var(--orange); }

.hours-row {
  display: grid;
  grid-template-columns: 110px 1fr 1fr auto;
  gap: .6rem;
  align-items: center;
  padding: .45rem 0;
  border-bottom: 1px dotted var(--line);
  font-size: .9rem;
}
@media (max-width: 620px) {
  .hours-row { grid-template-columns: 1fr 1fr; }
  .hours-row > span { grid-column: 1 / -1; font-weight: 600; }
}

.fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
  margin-bottom: 1.2rem;
  background: var(--white);
}
.fieldset > h3 {
  margin: 0 0 .2rem;
  font-size: 1.05rem;
}
.fieldset > .hint {
  color: var(--ink-2);
  font-size: .85rem;
  margin: 0 0 1rem;
}

/* ---------- Payments panel ---------- */

.pay-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .7rem;
  margin-bottom: 1rem;
}

.pay-keys {
  display: grid;
  gap: .7rem;
  margin-bottom: 1.2rem;
}
.pay-key-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem;
  padding: .7rem .9rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--orange-line);
}
.pay-key-row .label {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-2);
}
.key-preview {
  font-family: var(--sans);
  font-size: .95rem;
  color: #8f4700;
  word-break: break-all;
}

.pay-input {
  display: flex;
  gap: .4rem;
}
.pay-input input { flex: 1; font-family: var(--sans); letter-spacing: -.01em; }

.pay-messages {
  margin: 1rem 0 0;
  padding-left: 1.1rem;
  color: var(--ink-2);
  font-size: .87rem;
}
.pay-messages li { margin-bottom: .3rem; }

.pay-warning {
  margin-top: 1rem;
  padding: .8rem .95rem;
  border-radius: 6px;
  border: 1px solid rgba(224,89,107,.45);
  background: rgba(224,89,107,.1);
  color: #f3a8b2;
  font-size: .88rem;
}

.pay-steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: .89rem;
  color: var(--ink-2);
}
.pay-steps li {
  counter-increment: step;
  position: relative;
  padding: .35rem 0 .35rem 2rem;
}
.pay-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: .3rem;
  width: 1.4rem;
  height: 1.4rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--orange-line);
  border: 1px solid var(--line);
  font-family: var(--sans);
  font-size: .75rem;
  color: var(--orange);
}
.pay-steps code {
  font-family: var(--sans);
  font-size: .85em;
  color: var(--ink);
}

/* ==========================================================================
   Receipt printing fallback (browser print, when Bluetooth is unavailable)
   ========================================================================== */

#printFrame { display: none; }

@media print {
  body > *:not(#printFrame) { display: none !important; }
  #printFrame {
    display: block !important;
    font-family: ui-monospace, Menlo, monospace;
    font-size: 11px;
    line-height: 1.35;
    color: #000;
    background: #fff;
    width: 100%;
    white-space: pre-wrap;
  }
  @page { margin: 3mm; size: 58mm auto; }
  body.receipt-80 #printFrame { font-size: 12px; }
}

/* ==========================================================================
   Kitchen stock
   ========================================================================== */

.stock-alarm {
  display: flex; flex-wrap: wrap; align-items: center; gap: .7rem;
  padding: .9rem 1.1rem; margin-bottom: 1rem;
  border-radius: var(--radius);
  background: #fff4e2; border: 2px solid var(--orange); color: #8a4500;
  font-size: .95rem;
}
/* something has actually run out — this needs to shout */
.stock-alarm.is-out {
  background: #fdecec; border-color: #c62828; color: #97202f;
  animation: stock-pulse 2.2s ease-in-out infinite;
}
@keyframes stock-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(198,40,40,.35); }
  50%      { box-shadow: 0 0 0 7px rgba(198,40,40,0); }
}
.stock-alarm strong { font-weight: 700; }
.stock-alarm .btn { margin-left: auto; }

.stock-panel-wrap {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.1rem 1.2rem; margin-bottom: 1.4rem;
}
.stock-head { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; }
.stock-head h2 { margin: 0; font-size: 1.15rem; }
.stock-head .spacer { flex: 1; }

.stock-panel { margin-top: 1rem; }
.stock-group { margin-bottom: 1.3rem; }
.stock-group h4 {
  margin: 0 0 .4rem; font-size: .78rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; color: var(--orange-text);
}

.stock-row {
  display: flex; align-items: center; gap: .8rem;
  padding: .55rem .7rem; border-radius: 8px;
  border: 1px solid var(--line); margin-bottom: .35rem;
  background: var(--paper);
}
.stock-name { flex: 1; min-width: 0; font-size: .93rem; font-weight: 600; }
.stock-name small {
  display: block; font-weight: 400; font-size: .76rem; color: var(--ink-2);
}
.stock-count {
  font-size: 1.35rem; font-weight: 700; min-width: 2.6rem; text-align: right;
  font-variant-numeric: tabular-nums;
}
.stock-actions { display: flex; gap: .3rem; }
.stock-actions button {
  min-width: 34px; height: 34px; padding: 0 .55rem;
  border: 1px solid var(--line); border-radius: 7px;
  background: var(--white); color: var(--ink);
  font-size: 1rem; font-weight: 600; cursor: pointer;
}
.stock-actions button:hover { background: var(--orange); border-color: var(--orange); }
.stock-actions button[data-stock-set] { font-size: .82rem; }

/* amber at the low mark, red at zero */
.stock-row.is-low {
  border-color: var(--orange); background: #fff6ea;
}
.stock-row.is-low .stock-count { color: #8a4500; }
.stock-row.is-out {
  border-color: #c62828; background: #fdecec;
}
.stock-row.is-out .stock-count { color: #97202f; }
.stock-row.is-out .stock-name::after {
  content: ' — SOLD OUT';
  font-size: .72rem; font-weight: 700; letter-spacing: .08em; color: #97202f;
}

/* allergen codes on the kitchen ticket — small, but impossible to miss */
.pos-allergen-codes {
  display: inline-block; margin-left: .4rem;
  font-size: .72rem; font-weight: 700; letter-spacing: .06em;
  padding: .1rem .35rem; border-radius: 4px;
  background: #fdecec; border: 1px solid #e8b4bb; color: #97202f;
}

/* --- staff screens on a tablet ------------------------------------------ */
@media (max-width: 1024px), (pointer: coarse) {
  .staff-bar { flex-wrap: wrap; gap: .5rem; }
  .staff-bar .btn { min-height: 44px; }
  .pos-actions .btn { min-height: 52px; flex: 1 1 46%; }  /* gloves and wet hands */
  .stock-actions button { min-width: 44px; height: 44px; }
  .stock-row { padding: .7rem; gap: .6rem; }
  .stock-count { font-size: 1.5rem; }
  .tabs button { min-height: 46px; }
  table.admin { font-size: .92rem; }
  table.admin select, table.admin .btn { min-height: 42px; }
  .gate { margin: 6vh auto; padding: 1.5rem; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .pos-columns { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}
