:root {
  --bg: #f7faf6;
  --surface: #ffffff;
  --ink: #14201a;
  --muted: #566259;
  --brand: #0a7a28;
  --brand-ink: #ffffff;
  --good: #15803d;
  --good-bg: #dcfce7;
  --warn: #92400e;
  --warn-bg: #fef3c7;
  --bad: #b91c1c;
  --bad-bg: #fee2e2;
  --line: #dce6dc;
  --shadow: 0 1px 2px rgba(20, 32, 26, 0.06), 0 4px 14px rgba(20, 32, 26, 0.06);
  --radius: 16px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1410;
    --surface: #17201a;
    --ink: #eef5ef;
    --muted: #a9b8ad;
    --brand: #4ade80;
    --brand-ink: #052e12;
    --good: #86efac;
    --good-bg: #14301f;
    --warn: #fcd34d;
    --warn-bg: #3a2a0c;
    --bad: #fca5a5;
    --bad-bg: #3b1515;
    --line: #26332b;
    --shadow: none;
  }
}

* {
  box-sizing: border-box;
}

/* The hidden attribute must always win over a component's display value. */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

main {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 96px;
}

h1 {
  font-size: 1.7rem;
  line-height: 1.15;
  margin: 8px 0 8px;
}
h2 {
  font-size: 1.1rem;
  margin: 0 0 8px;
}
p {
  margin: 0 0 12px;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 0.875rem;
}
.center {
  text-align: center;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

a {
  color: var(--brand);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0 8px;
}
.brand {
  font-weight: 700;
  letter-spacing: 0.01em;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 0 0 14px;
  box-shadow: var(--shadow);
}
.card.hero {
  background: var(--brand);
  color: var(--brand-ink);
  border-color: transparent;
}
.card.hero .muted {
  color: inherit;
  opacity: 0.85;
}

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 18px;
  border: 2px solid var(--brand);
  border-radius: 12px;
  background: var(--brand);
  color: var(--brand-ink);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
}
.btn.block {
  display: flex;
  width: 100%;
}
.btn.secondary {
  background: transparent;
  color: var(--brand);
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--brand);
  min-height: 40px;
  padding: 6px 10px;
}
.btn.danger {
  background: transparent;
  border-color: var(--bad);
  color: var(--bad);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}
.stack > * + * {
  margin-top: 10px;
}

.field {
  display: block;
  margin: 0 0 14px;
}
.field > span {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
}
.field small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}
input[type='text'],
input[type='email'],
input[type='tel'],
input[type='password'],
input[type='search'],
select {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
input.code {
  font-size: 1.8rem;
  letter-spacing: 0.4em;
  text-align: center;
}
.row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.row > .grow {
  flex: 1;
}
.check {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 0 0 14px;
}
.check input {
  width: 24px;
  height: 24px;
  margin: 2px 0 0;
  flex: none;
  accent-color: var(--brand);
}

.error {
  background: var(--bad-bg);
  color: var(--bad);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 0 0 12px;
  font-weight: 600;
}
.notice {
  background: var(--warn-bg);
  color: var(--warn);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 0 0 12px;
}

.big {
  font-size: 3rem;
  line-height: 1;
  font-weight: 800;
}
.progress {
  height: 10px;
  border-radius: 999px;
  background: rgba(127, 127, 127, 0.25);
  overflow: hidden;
  margin: 12px 0 6px;
}
.progress > i {
  display: block;
  height: 100%;
  width: 0;
  background: currentColor;
  border-radius: 999px;
}

.qr {
  display: block;
  width: min(280px, 100%);
  aspect-ratio: 1;
  margin: 8px auto;
  background: #fff;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.list > li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.list > li:first-child {
  border-top: 0;
}
.list .title {
  font-weight: 650;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  background: var(--line);
  color: var(--muted);
}
.badge.good {
  background: var(--good-bg);
  color: var(--good);
}
.badge.warn {
  background: var(--warn-bg);
  color: var(--warn);
}
.badge.bad {
  background: var(--bad-bg);
  color: var(--bad);
}

ol.steps {
  padding-left: 0;
  list-style: none;
  counter-reset: step;
  margin: 0 0 12px;
}
ol.steps > li {
  counter-increment: step;
  position: relative;
  padding: 0 0 14px 44px;
}
ol.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 800;
  display: grid;
  place-items: center;
}

details.settings > summary {
  cursor: pointer;
  font-weight: 650;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  max-width: 448px;
  margin: 0 auto;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 50;
}
.toast.show {
  opacity: 1;
  transform: none;
}
.toast.error {
  background: var(--bad);
  color: #fff;
}
.toast.good {
  background: var(--good);
  color: #fff;
}

/* Staff */
.stepper {
  display: flex;
  align-items: center;
  gap: 6px;
}
.stepper button {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 1.4rem;
  font-weight: 700;
}
.stepper output {
  min-width: 26px;
  text-align: center;
  font-weight: 700;
}
.sticky-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
.sticky-bar > div {
  max-width: 448px;
  margin: 0 auto;
}
.scanner {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 40;
  display: flex;
  flex-direction: column;
}
.scanner video {
  flex: 1;
  width: 100%;
  object-fit: cover;
}
.scanner .bar {
  padding: 16px;
  background: #000;
  color: #fff;
  text-align: center;
}
.option {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 56px;
  padding: 10px 14px;
  margin: 0 0 8px;
  text-align: left;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.option[aria-pressed='true'] {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
}
.option:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.option .grow {
  flex: 1;
}

/* Install button (header) and the how-to sheet */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.btn.install-btn {
  border: 2px solid var(--brand);
  border-radius: 999px;
  min-height: 36px;
  padding: 4px 14px;
  font-weight: 600;
}
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
}
.sheet {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  background: var(--surface);
  color: var(--ink);
  border-radius: 16px 16px 0 0;
}

/* Order type picker (till) */
.segmented {
  display: flex;
  gap: 6px;
  margin: 8px 0 12px;
}
.segmented button {
  flex: 1;
  min-height: 44px;
  border: 2px solid var(--brand);
  border-radius: 10px;
  background: transparent;
  color: var(--brand);
  font: inherit;
  font-weight: 600;
}
.segmented button[aria-pressed='true'] {
  background: var(--brand);
  color: var(--brand-ink);
}
.segmented button:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

/* Order history */
.history-order.cancelled .title,
.history-order.cancelled .lines {
  text-decoration: line-through;
  color: var(--muted);
}
.history-order.cancelled .badge {
  text-decoration: none;
}
.lines {
  list-style: none;
  margin: 4px 0 2px;
  padding: 0;
}
.lines li {
  display: block;
  padding: 0;
  border: 0;
}

/* Till: searchable menu in sections, and veg / non-veg markers */
.menu-search {
  width: 100%;
  min-height: 48px;
  margin: 4px 0 12px;
  padding: 10px 14px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
.menu-section {
  padding: 0 14px;
}
.menu-section > summary {
  cursor: pointer;
  padding: 14px 0;
  list-style: revert;
}
.menu-section[open] > summary {
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}
.menu-section .list {
  margin-bottom: 8px;
}
.diet {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  vertical-align: -1px;
}
.diet.veg {
  border: 2px solid #15803d;
  border-radius: 2px;
  background: radial-gradient(circle, #15803d 38%, transparent 42%);
}
.diet.non_veg {
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 12px solid #b91c1c;
}
