/* Main Street Bagels and Appetizing — order page + staff dashboard.
   Layout: one narrow column for customers on a phone; a wide card board for the shop's desktop. */
:root {
  --cream: #f7f0df;
  --paper: #fffaf0;
  --ink: #192330;
  --muted: #5d6673;
  --blue: #2b78e8;
  --blue-deep: #1c5cc0;
  --red: #c7332c;
  --red-deep: #a32620;
  --green: #1c7c45;
  --amber: #a8650a;
  --line: rgba(25, 35, 48, 0.16);
  --display: Oswald, Impact, 'Arial Narrow', sans-serif;
  --body: 'DM Sans', Arial, sans-serif;
  --accent: Georgia, 'Times New Roman', serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 400 16px/1.5 var(--body);
}
h1, h2, h3, p { margin: 0; }
a { color: var(--blue-deep); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

.display { font-family: var(--display); font-weight: 700; text-transform: uppercase; line-height: 1.02; letter-spacing: 0.01em; }
.blue { color: var(--blue); }
.red { color: var(--red); }
.script { font: italic 700 1.05rem/1.3 var(--accent); color: var(--red); }
.label { font: 600 0.78rem/1.2 var(--display); text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); }

.strip {
  background: var(--blue);
  color: #fff;
  text-align: center;
  padding: 7px 16px;
  font: 600 0.78rem/1.3 var(--display);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.strip.preview { background: var(--ink); }

.wordmark { font: 700 1.25rem/1 var(--display); text-transform: uppercase; letter-spacing: 0.03em; color: var(--blue); text-decoration: none; }
.wordmark b { color: var(--red); font-weight: 700; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 2px solid var(--red); background: var(--red); color: #fff;
  font: 700 1rem/1 var(--display); text-transform: uppercase; letter-spacing: 0.07em;
  padding: 14px 22px; cursor: pointer; text-decoration: none;
  transition: background 0.12s, transform 0.06s;
}
.btn:hover { background: var(--red-deep); border-color: var(--red-deep); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.55; cursor: default; }
.btn.blue-btn { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.blue-btn:hover { background: var(--blue-deep); border-color: var(--blue-deep); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink); background: transparent; }
.btn.small { padding: 9px 14px; font-size: 0.82rem; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field input, .field select, .field textarea {
  width: 100%; background: #fff; border: 2px solid var(--line); border-radius: 0;
  padding: 12px 13px; font-size: 1rem;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue); outline: none; }
.field textarea { min-height: 190px; resize: vertical; line-height: 1.5; }
.error { color: var(--red-deep); font-weight: 700; }

/* ---------- Customer page ---------- */

.customer main { max-width: 600px; margin: 0 auto; padding: 0 18px 48px; display: flex; flex-direction: column; gap: 26px; }
.customer .brand { max-width: 600px; margin: 0 auto; padding: 18px 18px 0; }
.hero { display: flex; flex-direction: column; gap: 10px; padding-top: 8px; }
.hero h1 { font-size: clamp(2.6rem, 13vw, 4.2rem); }
.hero .lede { max-width: 34em; }

.pill { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; font-weight: 700; font-size: 0.9rem; }
.pill::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--red); }
.pill.open::before { background: var(--green); }

.order-form { display: flex; flex-direction: column; gap: 18px; background: var(--paper); border: 2px solid var(--ink); padding: 20px 18px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 460px) { .row2 { grid-template-columns: 1fr; } }

.seg { display: grid; grid-template-columns: 1fr 1fr; border: 2px solid var(--ink); }
.seg label { position: relative; text-align: center; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { display: block; padding: 12px 8px; font: 600 0.92rem/1.1 var(--display); text-transform: uppercase; letter-spacing: 0.06em; }
.seg input:checked + span { background: var(--ink); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: -3px; }
.seg input:disabled + span { opacity: 0.4; cursor: default; }

.optin { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; font-size: 0.92rem; line-height: 1.45; cursor: pointer; }
.optin input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--blue); cursor: pointer; }

.tip { border-left: 5px solid var(--red); background: #fff; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.tip p { font-size: 0.95rem; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.order-form .btn { width: 100%; font-size: 1.2rem; padding: 18px; }
.fineprint { font-size: 0.85rem; color: var(--muted); text-align: center; }

.status-card { background: var(--paper); border: 2px solid var(--ink); padding: 24px 18px; display: flex; flex-direction: column; gap: 18px; }
.status-card h1 { font-size: clamp(2.2rem, 11vw, 3.4rem); }
.ready-time { font: 700 clamp(3rem, 17vw, 5rem)/1 var(--display); color: var(--red); font-variant-numeric: tabular-nums; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.steps li { display: grid; grid-template-columns: 26px 1fr; gap: 12px; align-items: start; color: var(--muted); }
.steps li::before { content: ''; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); margin-top: 1px; }
.steps li.done { color: var(--ink); font-weight: 700; }
.steps li.done::before { background: var(--green); border-color: var(--green); }
.steps li.now { color: var(--ink); font-weight: 700; }
.steps li.now::before { border-color: var(--blue); background: var(--blue); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(0.6); opacity: 0.5; } }
@media (prefers-reduced-motion: reduce) { .steps li.now::before { animation: none; } }
.receipt { background: #fff; border: 1px dashed var(--ink); padding: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.code { font: 700 1.1rem/1 var(--display); letter-spacing: 0.08em; }

.store-info { border-top: 2px solid var(--ink); padding-top: 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 460px) { .store-info { grid-template-columns: 1fr; } }
.store-info h2 { font-size: 1.5rem; grid-column: 1 / -1; }
.store-info > div { display: flex; flex-direction: column; gap: 4px; }
.store-info .big { font-weight: 700; font-size: 1.05rem; }
.hours { display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; font-variant-numeric: tabular-nums; }

/* ---------- Install as an app ---------- */

.install { position: relative; display: grid; grid-template-columns: 56px 1fr; gap: 12px 14px; align-items: center; background: #fff; border: 2px solid var(--blue); padding: 14px 40px 14px 14px; }
.install img { border-radius: 14px; }
.install-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.install-text b { font: 700 1.1rem/1.15 var(--display); text-transform: uppercase; color: var(--blue); }
.install-text span { font-size: 0.92rem; }
.install .btn { grid-column: 1 / -1; }
.install-x { position: absolute; top: 4px; right: 6px; border: 0; background: transparent; font-size: 1.6rem; line-height: 1; padding: 6px 8px; cursor: pointer; color: var(--muted); }

.sheet-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(25, 35, 48, 0.55); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; background: var(--paper); border-top: 4px solid var(--blue); padding: 22px 20px calc(22px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 16px; animation: sheet-up 0.25s ease-out; }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
.sheet h2 { font-size: 1.7rem; }
.sheet-steps { margin: 0; padding-left: 1.3em; display: flex; flex-direction: column; gap: 10px; font-size: 1.02rem; }
.share-icon { display: inline-block; width: 16px; height: 18px; vertical-align: -3px; border: 2px solid var(--blue); border-top: 0; border-radius: 0 0 3px 3px; position: relative; margin: 0 2px; }
.share-icon::before { content: ''; position: absolute; left: 5px; top: -8px; width: 2px; height: 12px; background: var(--blue); }
.share-icon::after { content: ''; position: absolute; left: 2px; top: -8px; width: 6px; height: 6px; border-left: 2px solid var(--blue); border-top: 2px solid var(--blue); transform: rotate(45deg); }

/* When opened from the home screen icon: feel like a native app. */
html.standalone body { overscroll-behavior-y: none; -webkit-tap-highlight-color: transparent; }
html.standalone .strip { padding-top: calc(7px + env(safe-area-inset-top, 0px)); }
html.standalone .btn, html.standalone .seg span, html.standalone .label { -webkit-user-select: none; user-select: none; }
html.standalone .customer main { padding-bottom: calc(48px + env(safe-area-inset-bottom, 0px)); }

/* ---------- Dashboard ---------- */

.dash { min-height: 100vh; }
.dash-top { background: var(--paper); border-bottom: 2px solid var(--ink); padding: 12px 22px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; }
.dash-top .when { margin-left: auto; text-align: right; }
.dash-top .clock { font: 700 1.5rem/1 var(--display); font-variant-numeric: tabular-nums; }
.dash-top .tools { display: flex; gap: 8px; flex-wrap: wrap; }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px 22px 0; }
.tab { border: 2px solid var(--ink); background: transparent; padding: 11px 18px; cursor: pointer; font: 700 1.05rem/1 var(--display); text-transform: uppercase; letter-spacing: 0.06em; display: inline-flex; align-items: center; gap: 10px; }
.tab[aria-selected='true'] { background: var(--ink); color: #fff; }
.tab .count { min-width: 26px; padding: 3px 7px; background: var(--line); font-size: 0.9rem; text-align: center; font-variant-numeric: tabular-nums; }
.tab[aria-selected='true'] .count { background: rgba(255, 255, 255, 0.22); }
.tab.alert .count { background: var(--red); color: #fff; animation: pulse 1.4s ease-in-out infinite; }

.panel { padding: 18px 22px 60px; display: flex; flex-direction: column; gap: 16px; }
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 16px; align-items: start; }
.empty { border: 2px dashed var(--line); padding: 44px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; font: 700 1.5rem/1.1 var(--display); text-transform: uppercase; color: var(--ink); margin-bottom: 6px; }

.card { background: var(--paper); border: 2px solid var(--ink); display: flex; flex-direction: column; min-width: 0; }
.card.fresh { animation: arrive 0.5s ease-out; }
@keyframes arrive { from { transform: translateY(-10px); opacity: 0; } }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 12px 14px; border-bottom: 2px solid var(--ink); }
.card-head .who { font: 700 1.45rem/1.1 var(--display); text-transform: uppercase; overflow-wrap: anywhere; }
.card-head .code { margin-left: auto; color: var(--muted); }
.card-body { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 0.93rem; color: var(--muted); }
.meta b { color: var(--ink); }
.badge { display: inline-block; padding: 5px 10px; font: 700 0.85rem/1 var(--display); text-transform: uppercase; letter-spacing: 0.07em; color: #fff; background: var(--red); align-self: flex-start; }
.badge.sched { background: var(--blue); }
.badge.done { background: var(--green); }
.badge.off { background: var(--muted); }
.order-text { background: #fff; border: 1px solid var(--line); padding: 12px 14px; font-size: 1.12rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { border: 2px solid var(--ink); background: #fff; min-width: 50px; padding: 9px 8px; cursor: pointer; font: 700 1rem/1 var(--display); font-variant-numeric: tabular-nums; }
.chip[aria-pressed='true'] { background: var(--blue); border-color: var(--blue); color: #fff; }
.chips input { width: 78px; border: 2px solid var(--ink); background: #fff; padding: 7px 8px; font: 700 1rem/1.1 var(--display); }
.plan { font-weight: 700; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions .btn { flex: 1 1 auto; }
.actions .btn.ghost { flex: 0 0 auto; }
.countdown { font: 700 2rem/1 var(--display); text-transform: uppercase; font-variant-numeric: tabular-nums; }
.countdown.late { color: var(--red); }
.decline-box { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }

.rows { display: flex; flex-direction: column; border: 2px solid var(--ink); background: var(--paper); }
.rowitem { display: grid; grid-template-columns: 150px 210px 1fr auto; gap: 8px 18px; padding: 12px 14px; border-top: 1px solid var(--line); align-items: start; }
.rowitem:first-child { border-top: 0; }
.rowitem > * { min-width: 0; }
.rowitem .who { font-weight: 700; overflow-wrap: anywhere; }
.rowitem .txt { white-space: pre-wrap; overflow-wrap: anywhere; }
.rowitem .sub { font-size: 0.88rem; color: var(--muted); }
@media (max-width: 900px) { .rowitem { grid-template-columns: 1fr 1fr; } .rowitem .txt { grid-column: 1 / -1; } }
.histbar { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: end; }
.histbar .field { flex: 0 0 auto; }
.histbar .summary { font-weight: 700; padding-bottom: 12px; }

/* Kitchen ticket for an 80 mm receipt printer. Only the ticket prints; it stays hidden on screen. */
#ticket { display: none; }
@media print {
  @page { margin: 0; }
  body.dash { background: #fff; min-height: 0; }
  body.dash > *:not(#ticket) { display: none !important; }
  #ticket { display: block; width: 72mm; padding: 2mm 3mm 10mm; color: #000; font: 11pt/1.3 Arial, Helvetica, sans-serif; }
  #ticket .t-shop { text-align: center; font-weight: 700; font-size: 10pt; letter-spacing: 0.05em; }
  #ticket .t-code { text-align: center; font-weight: 700; font-size: 22pt; line-height: 1.1; margin-top: 1mm; }
  #ticket .t-name { font-weight: 700; font-size: 16pt; line-height: 1.15; overflow-wrap: anywhere; }
  #ticket .t-when { border: 2px solid #000; padding: 1.5mm 2mm; margin: 2mm 0; font-weight: 700; font-size: 13pt; text-align: center; }
  #ticket .t-rule { border-top: 2px dashed #000; margin: 2.5mm 0; }
  #ticket .t-order { font-size: 13pt; font-weight: 700; white-space: pre-wrap; overflow-wrap: anywhere; }
  #ticket .t-small { font-size: 9pt; }
}

.banner { background: var(--red); color: #fff; padding: 10px 22px; font-weight: 700; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; cursor: pointer; }
.printer-alert { cursor: default; font-size: 1.1rem; }
.printer-chip { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border: 2px solid var(--line); font: 700 0.82rem/1 var(--display); text-transform: uppercase; letter-spacing: 0.07em; }
.printer-chip::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--green); }
.printer-chip.bad { border-color: var(--red); color: var(--red); }
.printer-chip.bad::before { background: var(--red); }
.print-note { font-size: 0.9rem; font-weight: 700; color: var(--green); }
.print-note.waiting { color: var(--amber); }
.print-note.failed { color: var(--red); }

.login { max-width: 420px; margin: 8vh auto 0; padding: 0 18px; }
.login form { background: var(--paper); border: 2px solid var(--ink); padding: 24px 20px; display: flex; flex-direction: column; gap: 16px; }
.login h1 { font-size: 2.2rem; }
