/* ==========================================================================
   Mars Café & Restaurant — design system
   Mobile-first: everything is laid out for a phone held one-handed, then
   allowed to breathe on larger screens.
   ========================================================================== */

:root {
  --ink:        #1f1a17;
  --ink-2:      #4b423c;
  --ink-3:      #7c716a;
  --line:       #e7ded5;
  --paper:      #fffdf9;
  --surface:    #ffffff;
  --surface-2:  #faf5ee;

  --brand:      #9e2a2b;
  --brand-dark: #7a1f20;
  --brand-soft: #fbeeee;
  --accent:     #d98324;
  --accent-soft:#fdf3e3;

  --success:    #1f7a4d;
  --success-soft:#e8f6ee;
  --warn:       #a86612;
  --warn-soft:  #fdf1dd;
  --danger:     #b3261e;
  --danger-soft:#fdecea;
  --info:       #1f5f8b;
  --info-soft:  #e9f2f9;

  --veg:        #1f7a4d;
  --nonveg:     #a13a24;

  --radius:     14px;
  --radius-sm:  10px;
  --radius-lg:  22px;
  --shadow:     0 1px 2px rgba(31,26,23,.06), 0 6px 20px rgba(31,26,23,.06);
  --shadow-lg:  0 12px 40px rgba(31,26,23,.14);

  --bar-h:      66px;   /* the sticky action bar (Add to order, Checkout…) */
  --tab-h:      58px;   /* the bottom tab bar                              */
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p  { margin: 0 0 .8em; }
a  { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
small { font-size: .82rem; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 200;
  background: var(--ink); color: #fff; padding: .7rem 1rem; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

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

.wrap { width: 100%; max-width: 720px; margin: 0 auto; padding: 0 16px; }
.wrap-wide { max-width: 1180px; }

/* Room for the tab bar, and for the action bar stacked above it when a
   screen has one — otherwise the primary button hides behind the tabs. */
main { padding-bottom: calc(var(--tab-h) + 28px); }
main.has-action-bar { padding-bottom: calc(var(--tab-h) + var(--bar-h) + 24px); }
main.no-bar { padding-bottom: 32px; }

.section { margin: 22px 0; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin-bottom: 10px;
}
.section-head h2 { margin: 0; }

.stack   { display: grid; gap: 12px; }
.stack-s { display: grid; gap: 8px; }
.row     { display: flex; gap: 10px; align-items: center; }
.row-between { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.row-wrap { flex-wrap: wrap; }
.grow    { flex: 1 1 auto; min-width: 0; }
.right   { margin-left: auto; }
.center  { text-align: center; }
.muted   { color: var(--ink-3); }
.strong  { font-weight: 650; }
.nowrap  { white-space: nowrap; }
.hidden  { display: none !important; }

.grid-2 { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.grid-auto {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
}

/* ---------- header ------------------------------------------------------ */

.topbar {
  position: sticky; top: 0; z-index: 60;
  background: rgba(255,253,249,.94);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; gap: 12px; min-height: 58px; }
.topbar .logo { height: 34px; width: auto; border-radius: 8px; }
.topbar .brandlink {
  display: flex; align-items: center; gap: 10px;
  min-width: 0; flex: 1 1 auto; color: inherit; text-decoration: none;
}
.topbar .brandlink:hover { text-decoration: none; }
.topbar .brandname { font-weight: 750; font-size: 1rem; letter-spacing: -.02em; }
.topbar .brandsub { font-size: .72rem; color: var(--ink-3); }
/* On a narrow phone the tagline must not push the header into two rows. */
.topbar .brandtext {
  min-width: 0; display: block; overflow: hidden;
}
.topbar .brandname, .topbar .brandsub {
  display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  position: relative; cursor: pointer; flex: none;
}
.icon-btn .count {
  position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px;
  padding: 0 5px; border-radius: 10px; background: var(--brand); color: #fff;
  font-size: .7rem; font-weight: 700; display: grid; place-items: center;
}

/* ---------- context strip (where this order is going) ------------------- */

.context {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin: 12px 0;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius); font-size: .88rem;
}
.context .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); flex: none; }
.context .dot.closed { background: var(--danger); }

/* ---------- cards ------------------------------------------------------- */

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow);
}
.card-flat { box-shadow: none; }
.card-pad-0 { padding: 0; overflow: hidden; }
.card + .card { margin-top: 12px; }
.card-title { font-weight: 700; margin-bottom: 8px; }

.tile {
  display: block; padding: 16px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface);
  box-shadow: var(--shadow); text-align: left; width: 100%; cursor: pointer;
  color: inherit;
}
.tile:hover { text-decoration: none; border-color: var(--brand); }
.tile h3 { margin-bottom: 2px; }

/* ---------- buttons ----------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: 12px;
  font: inherit; font-weight: 650; cursor: pointer; text-align: center;
  white-space: nowrap;
  border: 1px solid transparent; background: var(--brand); color: #fff;
  transition: background .15s ease, border-color .15s ease, transform .06s ease;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-disabled { opacity: .5; cursor: not-allowed; }

.btn-ghost   { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-accent  { background: var(--accent); color: #26170a; }
.btn-accent:hover { background: #c4741d; }
.btn-danger  { background: var(--danger); }
.btn-danger:hover { background: #8f1e17; }
.btn-success { background: var(--success); }
.btn-success:hover { background: #17603c; }
.btn-block   { display: flex; width: 100%; }
.btn-sm      { min-height: 36px; padding: 0 12px; font-size: .86rem; border-radius: 9px; }
.btn-lg      { min-height: 54px; font-size: 1.05rem; }

.btn-link {
  background: none; border: none; padding: 0; min-height: 0;
  color: var(--brand); font: inherit; font-weight: 600; cursor: pointer;
}

/* ---------- forms ------------------------------------------------------- */

label { display: block; font-size: .86rem; font-weight: 600; margin-bottom: 5px; color: var(--ink-2); }
.hint { font-size: .8rem; color: var(--ink-3); margin-top: 4px; }

input[type=text], input[type=tel], input[type=email], input[type=number],
input[type=password], input[type=search], input[type=date], input[type=time],
input[type=url], input[type=datetime-local], select, textarea {
  width: 100%; padding: 11px 12px; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); min-height: 46px;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline-offset: 1px; }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; accent-color: var(--brand); }

.field { margin-bottom: 12px; }
.field-row { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .field-row { grid-template-columns: 1fr 1fr; } }

.check { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.check label { margin: 0; font-weight: 500; color: var(--ink); }

/* Big tappable radio cards, used for order type and payment method. */
.choice { display: grid; gap: 10px; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice label {
  display: flex; gap: 12px; align-items: flex-start; margin: 0;
  padding: 14px; border: 1.5px solid var(--line); border-radius: var(--radius);
  background: var(--surface); cursor: pointer; font-weight: 500; color: var(--ink);
}
.choice input:checked + label { border-color: var(--brand); background: var(--brand-soft); }
.choice input:focus-visible + label { outline: 3px solid var(--accent); outline-offset: 2px; }
/* An option that cannot be chosen should look like it. */
.choice input:disabled + label {
  opacity: .5; cursor: not-allowed; background: var(--surface-2);
}
.choice input:disabled:checked + label { border-color: var(--line); background: var(--surface-2); }
.choice .choice-title { font-weight: 700; display: block; }
.choice .choice-sub { font-size: .84rem; color: var(--ink-3); }

/* OTP entry */
.otp-input {
  letter-spacing: .5em; text-align: center; font-size: 1.4rem;
  font-weight: 700; padding-left: .5em;
}

/* ---------- maps --------------------------------------------------------- */

.map-shell { position: relative; }
.map-canvas {
  width: 100%; height: 300px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface-2);
}
.map-canvas.tall { height: 420px; }

/* The pin sits still in the middle while the map moves under it — the way
   every delivery app does it, and far easier one-handed than dragging a marker. */
.map-pin {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -100%);
  pointer-events: none; z-index: 2;
  font-size: 2rem; line-height: 1;
  filter: drop-shadow(0 3px 4px rgba(31,26,23,.4));
}
.map-pin::after {
  content: ""; position: absolute; left: 50%; bottom: -5px;
  width: 10px; height: 4px; border-radius: 50%;
  background: rgba(31,26,23,.35); transform: translateX(-50%);
}

.map-search { margin-bottom: 10px; }
.map-search gmp-place-autocomplete { width: 100%; display: block; }
.map-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.map-readout {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .78rem; color: var(--ink-3);
}

/* ---------- badges and pills -------------------------------------------- */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: .74rem; font-weight: 700; letter-spacing: .01em;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
}
.badge-success { background: var(--success-soft); color: var(--success); border-color: #c6e5d4; }
.badge-warn    { background: var(--warn-soft);    color: var(--warn);    border-color: #f0dcb8; }
.badge-danger  { background: var(--danger-soft);  color: var(--danger);  border-color: #f3cdc9; }
.badge-info    { background: var(--info-soft);    color: var(--info);    border-color: #cbdfee; }
.badge-muted   { background: var(--surface-2);    color: var(--ink-3); }
.badge-brand   { background: var(--brand-soft);   color: var(--brand);   border-color: #f0d2d2; }

.pill-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; -webkit-overflow-scrolling: touch; }
.pill-row::-webkit-scrollbar { height: 0; }
.pill {
  flex: none; padding: 7px 14px; border-radius: 999px; font-size: .86rem; font-weight: 600;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  cursor: pointer; white-space: nowrap;
}
.pill:hover { text-decoration: none; }
.pill.is-on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Veg / non-veg mark */
.dietmark {
  width: 15px; height: 15px; flex: none; border-radius: 3px;
  border: 1.5px solid var(--veg); display: grid; place-items: center;
}
.dietmark::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--veg); }
.dietmark.nonveg { border-color: var(--nonveg); }
.dietmark.nonveg::after { background: var(--nonveg); }

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

.catnav { position: sticky; top: 58px; z-index: 40; background: var(--paper); padding-top: 8px; }

.menu-item {
  display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line);
}
.menu-item:last-child { border-bottom: 0; }
.menu-item .body { flex: 1 1 auto; min-width: 0; }
.menu-item h3 { margin: 3px 0 2px; font-size: 1rem; }
.menu-item .desc {
  font-size: .86rem; color: var(--ink-3); margin: 4px 0 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.menu-item .price { font-weight: 700; }
.menu-item .thumb {
  width: 96px; height: 96px; flex: none; border-radius: var(--radius-sm);
  object-fit: cover; background: var(--surface-2);
}
.menu-item .thumb-wrap { position: relative; flex: none; }
.menu-item .thumb-wrap .btn { position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%); }
.menu-item.sold-out { opacity: .55; }

.stepper {
  display: inline-flex; align-items: center; border: 1px solid var(--brand);
  border-radius: 10px; overflow: hidden; background: var(--surface);
}
.stepper button {
  width: 36px; height: 36px; border: 0; background: none; color: var(--brand);
  font-size: 1.15rem; font-weight: 700; cursor: pointer;
}
.stepper .n { min-width: 30px; text-align: center; font-weight: 700; color: var(--brand); }

/* ---------- price summary ----------------------------------------------- */

.summary { display: grid; gap: 7px; }
.summary .line { display: flex; justify-content: space-between; gap: 12px; font-size: .92rem; }
.summary .line.discount { color: var(--success); }
.summary .rule { height: 1px; background: var(--line); margin: 4px 0; }
.summary .total { font-size: 1.12rem; font-weight: 750; }

/* ---------- bottom bars ------------------------------------------------- */

.bottombar {
  position: fixed; left: 0; right: 0; z-index: 75;
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
  min-height: var(--bar-h);
  display: flex; align-items: center;
  background: var(--paper); border-top: 1px solid var(--line);
  box-shadow: 0 -6px 20px rgba(31,26,23,.06);
  padding: 10px 0;
}
.bottombar .wrap { display: flex; gap: 12px; align-items: center; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(255,253,249,.97); border-top: 1px solid var(--line);
  backdrop-filter: blur(10px); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  display: grid; gap: 2px; justify-items: center; padding: 9px 4px 8px;
  font-size: .7rem; font-weight: 600; color: var(--ink-3);
}
.tabbar a:hover { text-decoration: none; }
.tabbar a.is-on { color: var(--brand); }
.tabbar .tabicon { font-size: 1.15rem; line-height: 1; }
.tabbar .count {
  position: absolute; transform: translate(12px, -4px);
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--brand); color: #fff; font-size: .65rem; display: grid; place-items: center;
}

/* ---------- order tracking ---------------------------------------------- */

.track { display: grid; gap: 0; }
.track .step {
  display: grid; grid-template-columns: 26px 1fr; gap: 12px;
  padding-bottom: 16px; position: relative;
}
.track .step:last-child { padding-bottom: 0; }
.track .step::before {
  content: ""; position: absolute; left: 12px; top: 24px; bottom: 0;
  width: 2px; background: var(--line);
}
.track .step:last-child::before { display: none; }
.track .bullet {
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line);
  background: var(--surface); display: grid; place-items: center;
  font-size: .78rem; color: var(--ink-3); z-index: 1;
}
.track .step.done .bullet { background: var(--success); border-color: var(--success); color: #fff; }
.track .step.now .bullet  { background: var(--brand); border-color: var(--brand); color: #fff; }
.track .step.done::before { background: var(--success); }
.track .label { font-weight: 650; }
.track .step.pending .label { color: var(--ink-3); font-weight: 500; }
.track .when { font-size: .8rem; color: var(--ink-3); }

/* ---------- alerts ------------------------------------------------------ */

.alert {
  padding: 11px 13px; border-radius: var(--radius-sm); font-size: .9rem;
  border: 1px solid var(--line); background: var(--surface-2); margin-bottom: 12px;
}
.alert-success { background: var(--success-soft); border-color: #c6e5d4; color: #145537; }
.alert-warn    { background: var(--warn-soft);    border-color: #f0dcb8; color: #7d4b0c; }
.alert-danger  { background: var(--danger-soft);  border-color: #f3cdc9; color: #8f1e17; }
.alert-info    { background: var(--info-soft);    border-color: #cbdfee; color: #164a6d; }

.demo-banner {
  background: repeating-linear-gradient(45deg, #fff4d6, #fff4d6 12px, #ffedc2 12px, #ffedc2 24px);
  border: 1px solid #e8cf95; color: #6d4c07;
  padding: 9px 13px; border-radius: var(--radius-sm); font-size: .84rem;
  margin: 12px 0; font-weight: 600;
}

.empty { text-align: center; padding: 40px 16px; color: var(--ink-3); }
.empty .big { font-size: 2.2rem; margin-bottom: 8px; }

/* ---------- staff panels ------------------------------------------------ */

.staffbar {
  background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 60;
}
.staffbar .wrap { display: flex; align-items: center; gap: 12px; min-height: 54px; }
.staffbar a { color: #fff; }
.staffbar .who { font-size: .8rem; opacity: .75; }

.staffnav { display: flex; gap: 4px; overflow-x: auto; padding: 0 0 8px; }
.staffnav a {
  flex: none; padding: 7px 13px; border-radius: 999px; font-size: .85rem; font-weight: 600;
  background: rgba(255,255,255,.1); color: #fff;
}
.staffnav a:hover { text-decoration: none; background: rgba(255,255,255,.2); }
.staffnav a.is-on { background: #fff; color: var(--ink); }

.kds { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 780px)  { .kds { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1180px) { .kds { grid-template-columns: repeat(4, 1fr); } }

.kds-col h2 {
  font-size: .82rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-3); margin-bottom: 8px;
}
.ticket {
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--brand);
  border-radius: var(--radius-sm); padding: 12px; margin-bottom: 10px; box-shadow: var(--shadow);
}
.ticket.late { border-left-color: var(--danger); background: #fffafa; }
.ticket .no { font-weight: 750; }
.ticket .items { font-size: .9rem; margin: 6px 0; }
.ticket .note {
  font-size: .84rem; background: var(--warn-soft); border-radius: 8px;
  padding: 6px 8px; margin: 6px 0; color: #7d4b0c;
}

.stat-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
}
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px; }
.stat .k { font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.stat .v { font-size: 1.45rem; font-weight: 750; margin-top: 3px; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: .89rem; min-width: 560px; }
table.data th, table.data td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); }
table.data th { font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
table.data tbody tr:hover { background: var(--surface-2); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

.bar { height: 7px; border-radius: 4px; background: var(--brand-soft); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--brand); }

details.panel {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); padding: 0; margin-bottom: 12px;
}
details.panel > summary {
  padding: 13px 14px; font-weight: 650; cursor: pointer; list-style: none;
}
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::after { content: " +"; color: var(--ink-3); float: right; }
details.panel[open] > summary::after { content: " −"; }
details.panel > .panel-body { padding: 0 14px 14px; }

/* ---------- QR sheet & receipt (print) ---------------------------------- */

.qr-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.qr-card {
  border: 1px dashed var(--ink-3); border-radius: var(--radius);
  padding: 14px; text-align: center; background: #fff; break-inside: avoid;
}
.qr-card canvas, .qr-card img { margin: 8px auto; }
.qr-card .tno { font-weight: 750; font-size: 1.1rem; }

.receipt { max-width: 420px; margin: 20px auto; background: #fff; padding: 22px; }
.receipt .rule { border-top: 1px dashed var(--ink-3); margin: 10px 0; }

@media print {
  .no-print, .topbar, .tabbar, .bottombar, .staffbar { display: none !important; }
  body { background: #fff; }
  main { padding-bottom: 0 !important; }
  .card, .qr-card { box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
