/* Matches the Vending Manager palette: warm neutrals, school navy, deep teal accent. */
:root {
  color-scheme: light;
  --bg: #f6f5f2;
  --surface: #ffffff;
  --hover: #f1efea;
  --line: #e5e2db;
  --line-strong: #c9c4b8;
  --ink: #1c1b19;
  --ink-2: #4a4843;
  --muted: #76736b;
  --navy: #1b2a5c;
  --navy-ink: #131f47;
  --navy-soft: #e6e9f2;
  --accent: #0f6e66;
  --accent-ink: #0b524c;
  --accent-soft: #e3f1ef;
  --ok: #1f8a4c;
  --ok-soft: #e4f4ea;
  --warn: #a86400;
  --warn-soft: #fbf0dc;
  --bad: #c0392b;
  --bad-soft: #fbe7e4;
  --r: 12px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  accent-color: var(--navy);
  font-variant-numeric: tabular-nums;
}

a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }

.page {
  max-width: 640px;
  margin-inline: auto;
  padding: 0 16px 48px;
}
.page-wide { max-width: 920px; }

/* ---------- Header & Footer ---------- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  margin-block-end: 24px;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-name { display: block; font-weight: 700; font-size: 16px; line-height: 1.2; letter-spacing: -0.01em; }
.brand-sub { display: block; font-size: 12px; color: var(--muted); }

.userbar {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}
.userbar-name { font-weight: 600; color: var(--ink-2); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.userbar form { margin: 0; }

.adminnav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.adminnav a {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
}
.adminnav a:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.adminnav a.is-on { background: var(--navy); color: #fff; }

.foot {
  margin-block-start: 40px;
  padding-block-start: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-size: 13px;
  color: var(--muted);
}
.foot a { color: var(--ink-2); }

/* ---------- Typography & Utility ---------- */

h1 { font-size: 28px; line-height: 1.18; letter-spacing: -0.02em; margin: 0 0 10px; }
h2 { font-size: 18px; line-height: 1.25; letter-spacing: -0.01em; margin: 0 0 12px; }
h3 { font-size: 15px; font-weight: 600; margin: 0 0 8px; }
.h-page { font-size: 24px; margin-block-end: 16px; }
.lead { margin: 0 0 16px; color: var(--ink-2); font-size: 16px; }
.hint { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.small { font-size: 12px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-weight: 600; letter-spacing: 0.04em; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.center-block { text-align: center; padding: 32px 0; }
.big-status { font-family: var(--mono); font-size: 40px; font-weight: 700; color: var(--muted); margin: 0 0 8px; }
.empty { color: var(--muted); margin: 8px 0; }
.narrow { max-width: 420px; }

.link {
  background: none;
  border: none;
  padding: 4px 2px;
  font: inherit;
  font-size: 14px;
  color: var(--navy);
  cursor: pointer;
  text-decoration: none;
}
.link:hover { text-decoration: underline; }

/* ---------- Banknote chips ---------- */

.note {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 7px;
  font-weight: 700;
  font-size: 13px;
  line-height: 1.25;
  border: 1px solid transparent;
  white-space: nowrap;
}
.note-lg { padding: 5px 11px; font-size: 15px; border-radius: 8px; }
.note-2000 { background: #fbe8ee; color: #9c2448; border-color: #f0c2d0; }
.note-5000 { background: #e3f3ea; color: #17673d; border-color: #b7e2c9; }
.note-10000 { background: #e5effb; color: #194d8c; border-color: #bdd6f5; }
.note-count { font-weight: 600; opacity: 0.9; }
.notes { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* ---------- Keypad Request ID ---------- */

.keys {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 38px;
  padding: 0 6px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 17px;
  color: var(--ink);
  box-shadow: inset 0 -2px 0 rgba(28, 27, 25, 0.09);
}
.keys-lg { gap: 8px; margin: 12px 0 8px; }
.keys-lg .key {
  min-width: 48px;
  height: 54px;
  font-size: 26px;
  border-radius: 10px;
  box-shadow: inset 0 -3px 0 rgba(28, 27, 25, 0.11);
}

/* ---------- Status pills ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.pill-wait { background: var(--warn-soft); color: var(--warn); }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-bad { background: var(--bad-soft); color: var(--bad); }
.pill-mute { background: var(--hover); color: var(--muted); }

/* ---------- Cards, Flash, Buttons, Forms ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px;
  margin-block-end: 16px;
}

.flash {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  margin: 0 0 14px;
  border: 1px solid transparent;
}
.flash-error { background: var(--bad-soft); color: var(--bad); border-color: #f2c0ba; }
.flash-ok { background: var(--ok-soft); color: var(--ok); border-color: #b7e2c9; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s, opacity 0.12s;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 13px; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--navy-ink); }
.btn-done { background: var(--ok); color: #fff; }
.btn-done:hover:not(:disabled) { background: #18723e; }
.btn-quiet { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-quiet:hover:not(:disabled) { background: var(--hover); }

.form .field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-block-end: 14px;
}
.form .field > span { font-size: 14px; font-weight: 600; color: var(--ink-2); }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input:not([type]) {
  font: inherit;
  font-size: max(1rem, 1em);
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  width: 100%;
}
input:user-invalid {
  border-color: var(--bad);
  background: #fff8f7;
}
/* Hide native spinners on numeric steppers */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

/* ---------- Landing / Login ---------- */

.hero { margin-block-end: 20px; }
.avail {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.avail li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 13px;
}
.avail-n { color: var(--ink-2); font-weight: 500; }

.steps {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
  display: grid;
  gap: 8px;
}
.steps li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--ink-2);
}
.step-n {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--navy-soft);
  color: var(--navy);
  font-weight: 700;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Student Request Form ---------- */

.pickers {
  display: grid;
  gap: 10px;
}
.picker {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}
.picker.is-empty { opacity: 0.55; }
.picker-left { font-size: 13px; color: var(--muted); }

.stepper {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.stepper input {
  width: 56px;
  min-height: 44px;
  padding: 6px 4px;
  text-align: center;
  font-weight: 700;
}
.step {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 20px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.step:hover:not(:disabled) { background: var(--hover); }
.step:disabled { opacity: 0.4; cursor: not-allowed; }

.sum {
  margin-block-start: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 14px;
  color: var(--ink-2);
}
.sum p { margin: 0; }
.sum.is-ok { background: var(--accent-soft); border-color: #b7dcd8; color: var(--accent-ink); }
.sum.is-bad { background: var(--warn-soft); border-color: #edd09a; color: var(--warn); }
.sum strong { color: var(--ink); }

.days { display: grid; gap: 16px; margin-block-start: 14px; }
.day {
  border: none;
  padding: 0;
  margin: 0;
}
.day legend {
  font-size: 14px;
  margin-block-end: 8px;
  padding: 0;
}
.day-rel { font-weight: 700; color: var(--ink); }

.slots {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.slot {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: border-color 0.12s, background 0.12s;
}
.slot:hover:not(.is-off) { background: var(--hover); }
.slot:has(input:checked) {
  border-color: var(--navy);
  background: var(--navy-soft);
  color: var(--navy-ink);
  font-weight: 600;
}
.slot.is-off {
  opacity: 0.45;
  background: var(--bg);
  cursor: not-allowed;
}
.slot input { margin: 0; flex: none; width: 18px; height: 18px; }
.slot-time { flex: 1; }
.slot-note { font-size: 12px; color: var(--muted); }

.submit-bar { margin-block-start: 4px; }

/* ---------- Ticket & Facts ---------- */

.ticket {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--navy);
  border-radius: var(--r);
  padding: 20px;
  margin-block-end: 16px;
}
.ticket-done { border-top-color: var(--ok); }
.ticket-expired { border-top-color: var(--bad); }
.ticket-cancelled { border-top-color: var(--muted); }

.ticket-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.ticket-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.ticket-say { margin: 4px 0 16px; font-size: 15px; color: var(--ink-2); }

.facts {
  margin: 0;
  border-top: 1px solid var(--line);
}
.facts > div {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}
.facts dt { font-size: 13px; color: var(--muted); font-weight: 500; }
.facts dd { margin: 0; font-size: 15px; }
.countdown { display: block; font-size: 13px; color: var(--accent); font-weight: 600; margin-block-start: 2px; }
.ticket-warn {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 13px;
}
.ticket-actions { margin-block-start: 16px; }

.history { margin-block-start: 28px; }
.rows { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.row-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
}
.row-link:hover { background: var(--hover); text-decoration: none; }
.row-main { flex: 1; min-width: 0; }

/* ---------- Admin ---------- */

.find {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px 18px;
  margin-block-end: 16px;
}
.find-label { display: block; font-size: 14px; font-weight: 600; color: var(--ink-2); margin-block-end: 8px; }
.find-row { display: flex; gap: 8px; }
.find-row input {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.find-row .btn { flex: none; padding-inline: 22px; }
.find .flash { margin: 10px 0 0; }

.alerts-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-block-end: 14px;
}

.cash {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.cash-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px;
}
.cash-card.is-low { border-color: #f0c2d0; background: #fff9fa; }
.cash-n { font-size: 26px; font-weight: 700; margin: 8px 0 2px; line-height: 1.1; }
.cash-n span { font-size: 13px; font-weight: 400; color: var(--muted); }
.cash-sub { font-size: 13px; color: var(--muted); }
.cash-sub strong { color: var(--ink); }
.cash-link { margin: 8px 0 22px; text-align: right; }

.block { margin-block-end: 28px; }
.count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--navy-soft);
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
  vertical-align: middle;
  margin-inline-start: 4px;
}

.dayblock { margin-block-end: 18px; }
.slotblock { margin-block-end: 12px; }
.slotblock-time {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-block-end: 6px;
}
.orows { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.orow-link {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
}
.orow-link:hover { border-color: var(--navy); background: #faf9f6; text-decoration: none; }
.orow-id { font-size: 16px; color: var(--navy); }
.orow-who { display: flex; flex-direction: column; min-width: 0; }
.orow-who strong { font-size: 15px; }
.orow-who .muted { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.orow-total { font-weight: 700; font-size: 14px; white-space: nowrap; }

.adorder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-block-start: 18px;
}
.adorder-actions form { margin: 0; }

.cash-edit {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0 18px;
}
.cash-field {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}
.cash-field input { font-size: 22px; font-weight: 700; text-align: center; }

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  font-size: 14px;
}
.table th, .table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); background: var(--bg); }
.table tr:last-child td { border-bottom: none; }

.toast {
  position: fixed;
  bottom: 18px;
  right: 18px;
  background: var(--navy);
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  z-index: 20;
}

@media (max-width: 600px) {
  .slots { grid-template-columns: 1fr; }
  .cash, .cash-edit { grid-template-columns: 1fr; }
  .orow-link { grid-template-columns: auto 1fr; }
  .orow-notes { grid-column: 1 / -1; }
  .orow-total { grid-column: 1 / -1; }
  .table { display: block; overflow-x: auto; }
  .keys-lg .key { min-width: 42px; height: 48px; font-size: 22px; }
}
