/* The customer's page. Works from 360 px width. No external fonts or images. */
:root {
  --fg: #1d1d1f;
  --muted: #5f6368;
  --bg: #fafaf7;
  --card: #ffffff;
  --line: #d9d9d4;
  --accent: #0b6e4f;
  --warn: #9a3412;
  --warn-bg: #fff4e5;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "PingFang TC", "Noto Sans TC", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
  max-width: 640px;
  margin: 0 auto;
  /* Space below the last button, so it can be scrolled above a toolbar that floats over the bottom of the window
     (Safari on newer iPhones, about 50 px of bar above the home indicator). env() is 0 here: the page is not drawn
     under the screen edges (no viewport-fit=cover in index.html), so the fixed 112 px is what clears the bar; env()
     only adds the home indicator's inset should viewport-fit=cover be set one day. */
  padding: 0 16px calc(112px + env(safe-area-inset-bottom, 0px));
  overflow-wrap: anywhere;
}
[hidden] { display: none !important; }
.top { padding: 12px 0 8px; border-bottom: 1px solid var(--line); }
.top h1 { font-size: 1.25rem; margin: 0; }
.address { margin: 2px 0; color: var(--muted); font-size: 0.9rem; }
.beta { margin: 6px 0 0; font-size: 0.8rem; color: var(--warn); }
.lock { margin: 2px 0; font-size: 0.8rem; color: var(--muted); }
.state-line { margin: 4px 0 0; font-size: 0.9rem; }
#conn[data-state="connected"] { color: var(--accent); font-weight: 600; }
#conn[data-state^="fail"] { color: var(--warn); font-weight: 600; }
.slow-line { margin: 2px 0 0; font-size: 0.85rem; color: var(--muted); }
.reply-wait { display: block; font-size: 0.75rem; color: var(--muted); text-align: right; }
.reply-wait[data-reply-wait="late"] { color: var(--warn); }
.small { font-size: 0.75rem; color: var(--muted); margin: 2px 0; }
#screen { padding: 32px 0; text-align: center; }
.screen-text { font-size: 1.15rem; font-weight: 600; }
.notice { background: var(--warn-bg); padding: 8px; border-radius: 6px; font-size: 0.85rem; }
.banner { background: var(--warn-bg); border: 1px solid #f3c79b; padding: 8px 10px; border-radius: 6px; margin: 10px 0; }
.banner-text { margin: 0; font-weight: 600; color: var(--warn); }
.banner-kept { margin: 2px 0; font-size: 0.85rem; }
.conversation { margin: 12px 0; }
.empty { color: var(--muted); font-size: 0.9rem; }
#log { list-style: none; margin: 0; padding: 0; }
.entry { margin: 8px 0; padding: 8px 10px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); }
.entry.me { margin-left: 15%; background: #eef6f2; }
.entry.shop { margin-right: 10%; }
.entry .text { margin: 0; white-space: pre-wrap; }
.status { display: block; font-size: 0.75rem; color: var(--muted); text-align: right; }
.status[data-status="undelivered"] { color: var(--warn); }
.hold { display: inline-block; font-size: 0.75rem; color: var(--warn); margin-top: 2px; }
.who { font-size: 0.75rem; color: var(--muted); }
.quote-head { font-weight: 600; }
.quote-reply { margin: 2px 0; }
.offers { list-style: none; margin: 6px 0; padding: 0; }
.offer { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 4px 0; border-top: 1px dashed var(--line); }
.offer .price { font-weight: 600; }
.offer .left { font-size: 0.85rem; color: var(--muted); }
.expires, .quote-date { font-size: 0.8rem; color: var(--muted); }
.confirm-state { font-size: 0.85rem; margin-top: 4px; }
.confirm-state.late { color: var(--warn); }
.order { font-weight: 600; color: var(--accent); }
.decline { color: var(--warn); }
.chat, .quote { border-top: 1px solid var(--line); padding: 10px 0; display: flex; flex-direction: column; gap: 4px; }
.quote h2 { font-size: 1rem; margin: 0 0 4px; }
textarea, select, input, button { font: inherit; width: 100%; max-width: 100%; }
textarea, select, input { padding: 6px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
button { padding: 8px 12px; border: 0; border-radius: 6px; background: var(--accent); color: #fff; cursor: pointer; }
button:disabled { background: #9db8ad; cursor: default; }
.offer button.confirm { width: auto; padding: 4px 10px; }
#banner-retry { width: auto; }
#chat-note:not(:empty), #q-note:not(:empty), .confirm-note { color: var(--warn); }
.confirm-note { font-size: 0.85rem; margin-top: 4px; }
#screen-action { margin-top: 12px; }
/* M5-A: the contact form, a sheet over the bottom of the page (from 360 px width). Its bottom padding keeps the send button
   (#contact-send) above a toolbar floating over the bottom of the window (see body). */
.contact { position: fixed; left: 0; right: 0; bottom: 0; top: 0; background: rgba(0, 0, 0, 0.35); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.contact-card { width: 100%; max-width: 640px; max-height: 100%; overflow-y: auto; background: var(--card); border-radius: 12px 12px 0 0; padding: 14px 16px calc(96px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 4px; }
.contact-card h2 { font-size: 1rem; margin: 0; }
.contact-why { margin: 2px 0 6px; font-size: 0.85rem; }
.contact-note:not(:empty) { color: var(--warn); font-size: 0.85rem; }
.contact input[aria-invalid="true"] { border-color: var(--warn); }
.contact-actions { display: flex; gap: 8px; margin-top: 6px; }
.contact-actions button { flex: 1 1 0; }
button.secondary { background: var(--card); color: var(--fg); border: 1px solid var(--line); }
/* M3: the language button (zh <-> en), top right of the header */
.top { position: relative; }
.top h1 { padding-right: 88px; }
.lang-toggle { position: absolute; top: 10px; right: 0; font-size: 0.85rem; padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--fg); }
/* M7: the button keeps its own width (the rule for every button above gives 100%, which made it span the header) */
#lang-toggle.lang-toggle { width: auto; max-width: 84px; white-space: nowrap; }
/* M7: the order book's state on the order line, and a message from a person at the shop */
.order-status { margin: 2px 0 0; font-size: 0.85rem; color: var(--muted); }
.order-status[data-status="confirmed"] { color: var(--accent); font-weight: 600; }
.order-status[data-status="failed"], .order-status[data-status="declined"], .order-status[data-status="cancelled"] { color: var(--warn); font-weight: 600; }
.entry.staff { background: #fff8e8; border-color: #e7c873; border-left: 4px solid #b7791f; }
/* SPEC_A A2: an order with status: neutral until the order book confirmed it, green only when confirmed, warning colour
   when not made (an order without status keeps .order above, as before) */
.order[data-line="sent"] { color: var(--fg); }
.order[data-line="confirmed"] { color: var(--accent); }
.order[data-line="not_placed"] { color: var(--warn); }
.order-note { margin: 2px 0 0; font-size: 0.8rem; color: var(--muted); }
.quote button.requote, .entry button.requote { width: auto; margin-top: 6px; padding: 4px 10px; }
