/* ToGoPick — warm bakery storefront + simple seller station.
   Palette (design v3, locked): ivory #FFF9F2, deep green #244D3E,
   terracotta #D96C4A, honey #F4B942, charcoal #252525, sand #E9DED2. */

:root {
  --ivory: #FFF9F2;
  --green: #244D3E;
  --green-dark: #1B3A2F;
  --terra: #D96C4A;
  --terra-dark: #C05A39;
  --honey: #F4B942;
  --ink: #252525;
  --muted: #7A6F63;
  --sand: #E9DED2;
  --card: #FFFFFF;
  --red-bg: #FDECEA;
  --red-ink: #9C2B21;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { overflow-x: clip; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--ivory);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
h1 { font-size: 28px; line-height: 1.25; margin: 0 0 10px; color: var(--green); }
h2 { font-size: 22px; margin: 18px 0 12px; color: var(--green); }
h3 { font-size: 16px; margin: 0 0 10px; color: var(--green); }
.stack { margin-top: 18px; }
.note { font-size: 14px; color: var(--muted); margin: 6px 0 12px; line-height: 1.5; }
.error { font-size: 14px; color: var(--red-ink); margin: 0 0 12px; }
a { color: var(--green); }

/* ---------- chrome ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  max-width: 720px; margin: 0 auto; padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 6px;
}
.brand { font-size: 20px; font-weight: 800; color: var(--green); }
.brand.big { font-size: 30px; text-align: center; }
.topbar-actions { display: flex; gap: 6px; align-items: center; }
.wrap { max-width: 720px; margin: 0 auto; padding: 8px 16px 48px; }
.wrap.has-bottomnav { padding-bottom: 110px; }
.foot { margin-top: 28px; text-align: center; }

.hero-card {
  background: var(--card); border: 1px solid var(--sand); border-radius: var(--radius);
  padding: 24px 20px; margin: 12px 0 8px; text-align: center;
}
.hero-card .tagline { font-size: 18px; font-weight: 600; color: var(--terra-dark); margin: 0 0 10px; }

/* ---------- cards, lists, rows ---------- */
.card {
  background: var(--card); border: 1px solid var(--sand);
  border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
}
.list { display: flex; flex-direction: column; gap: 10px; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--sand); border-radius: var(--radius);
  padding: 12px 14px; min-height: 60px; font: inherit; color: inherit; text-decoration: none;
}
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-name { font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 13px; color: var(--muted); }
.pill {
  flex: none; font-size: 12px; font-weight: 700; border-radius: 999px;
  padding: 3px 9px; background: #FDF0D5; color: #7A5C00; white-space: nowrap;
}
.pill.green { background: #E3EFE8; color: var(--green); }
.pill.closed { background: var(--red-bg); color: var(--red-ink); }

/* ---------- forms & buttons ---------- */
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 14px; font-weight: 600; color: var(--green); margin-bottom: 6px; }
.field input[type="text"], .field input[type="email"], .field input[type="password"],
.field input[type="number"], .field select, .field textarea,
.inline-form input, .inline-form select {
  width: 100%; font: inherit; font-size: 16px; padding: 12px;
  border: 1px solid var(--sand); border-radius: 10px; background: var(--card);
  color: var(--ink); min-height: 52px;
}
.field input[type="file"] { font: inherit; font-size: 15px; margin: 4px 0 8px; }
.field textarea { resize: vertical; }
.checkline { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; margin: 6px 0 10px; }
.checkline input { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.inline-form { display: flex; gap: 8px; align-items: stretch; }
.inline-form input, .inline-form select { flex: 1; min-height: 48px; }

.btn {
  font: inherit; font-size: 16px; border-radius: 10px; border: 1px solid var(--sand);
  background: var(--card); color: var(--ink); padding: 12px 18px; min-height: 52px;
  cursor: pointer; width: 100%; margin-bottom: 10px; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
.btn-accent { background: var(--terra); border-color: var(--terra); color: #fff; font-weight: 700; min-height: 56px; }
.btn-secondary { background: #F4EAD9; }
.btn-quiet { background: transparent; border-color: transparent; color: var(--green); }
.btn-danger { background: transparent; border-color: #F3C6C0; color: var(--red-ink); }
.btn-small { width: auto; min-height: 48px; padding: 9px 14px; margin-bottom: 0; white-space: nowrap; }
.btn.back { width: auto; padding-left: 0; margin-bottom: 4px; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }

.chips { display: flex; gap: 8px; margin: 6px 0 16px; justify-content: center; }
.chip {
  border: 1px solid var(--sand); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 9px 16px; font-size: 15px; min-height: 40px; cursor: pointer; flex: none;
}
.chip.active { background: var(--green); border-color: var(--green); color: #fff; }

/* switches (seller) */
.switchline { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 2px 0 16px; font-size: 15px; cursor: pointer; }
.switch-sub { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.switch { position: relative; flex: none; width: 52px; height: 30px; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch .track { position: absolute; inset: 0; border-radius: 999px; background: #D8CBB8; transition: background 0.15s ease; pointer-events: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: left 0.15s ease; }
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { left: 25px; }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; padding: calc(32px + env(safe-area-inset-top, 0px)) 16px 32px; }
.auth-card { max-width: 420px; width: 100%; }
.auth-card .tagline { color: var(--muted); font-size: 15px; line-height: 1.5; margin: 8px 0 20px; text-align: center; }
.auth-card h1 { text-align: center; }

/* ---------- seller ---------- */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; background: var(--card); border-top: 1px solid var(--sand);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottomnav button {
  flex: 1; font: inherit; font-size: 15px; font-weight: 600; background: none; border: none;
  color: var(--muted); min-height: 58px; cursor: pointer;
}
.bottomnav button.active { color: var(--green); box-shadow: inset 0 3px 0 var(--terra); }
.link-line { font-size: 16px; word-break: break-all; margin: 4px 0 12px; }
.qr-box { display: flex; justify-content: center; padding: 10px 0; }
.qr-box svg { width: 220px; height: 220px; }
.photo-tips {
  background: #FDF0D5; border: 1px solid var(--honey); border-radius: 10px;
  font-size: 13px; line-height: 1.5; padding: 10px 12px; margin-bottom: 10px; color: #5C4A12;
}
.photo-preview { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; border: 1px solid var(--sand); margin-top: 8px; }
.empty-state { text-align: center; padding: 34px 16px; }
.empty-big { font-size: 19px; font-weight: 700; color: var(--green); margin: 0 0 6px; }
.hours-row { display: grid; grid-template-columns: 52px 1fr 1fr 74px; gap: 8px; align-items: center; margin-bottom: 8px; }
.hours-row .day { font-weight: 700; color: var(--green); font-size: 14px; }
.hours-row input[type="time"] { font: inherit; font-size: 15px; padding: 9px; border: 1px solid var(--sand); border-radius: 8px; min-height: 44px; width: 100%; }
.hours-row .closed-lbl { font-size: 13px; display: flex; gap: 5px; align-items: center; }
.menu-item-row { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--sand); }
.menu-item-row img { width: 64px; height: 48px; object-fit: cover; border-radius: 8px; flex: none; background: var(--ivory); }
.menu-item-row .grow { flex: 1; min-width: 0; }
.cat-head { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.cat-head h3 { flex: 1; margin: 0; }
.mini { font: inherit; font-size: 13px; border: 1px solid var(--sand); background: var(--card); border-radius: 8px; padding: 7px 10px; min-height: 36px; cursor: pointer; }
.mini.danger { color: var(--red-ink); border-color: #F3C6C0; }
.opt-row { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--sand); font-size: 15px; }
.opt-row .grow { flex: 1; }

/* ---------- storefront ---------- */
.sf-hero { width: 100%; aspect-ratio: 16 / 7; object-fit: cover; display: block; background: var(--sand); }
.sf-head { max-width: 720px; margin: 0 auto; padding: 0 16px; }
.sf-id { display: flex; gap: 14px; align-items: center; margin-top: -34px; position: relative; }
.sf-logo {
  width: 72px; height: 72px; border-radius: 50%; flex: none; object-fit: cover;
  background: var(--green); color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 800; border: 3px solid var(--ivory);
}
.sf-head h1 { margin: 10px 0 2px; }
.sf-status { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.sf-cats {
  display: flex; gap: 8px; overflow-x: auto; padding: 10px 16px; max-width: 720px; margin: 0 auto;
  scrollbar-width: none;
}
.sf-cats::-webkit-scrollbar { display: none; }
.sf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 720px; margin: 0 auto; padding: 4px 16px 40px; }
@media (max-width: 420px) { .sf-grid { grid-template-columns: 1fr; } }
.sf-card { background: var(--card); border: 1px solid var(--sand); border-radius: var(--radius); overflow: hidden; text-align: left; font: inherit; color: inherit; padding: 0; cursor: pointer; display: flex; flex-direction: column; }
.sf-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--ivory); }
.sf-card .pad { padding: 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sf-card .nm { font-size: 16px; font-weight: 700; }
.sf-card .ds { font-size: 13px; color: var(--muted); line-height: 1.45; flex: 1; }
.sf-card .pr { font-size: 16px; font-weight: 700; color: var(--green); }
.sf-card.soldout { opacity: 0.55; }
.add-btn {
  font: inherit; font-size: 16px; font-weight: 700; border: none; border-radius: 10px;
  background: var(--terra); color: #fff; min-height: 48px; padding: 10px 18px; cursor: pointer; width: 100%;
}
.soldout-btn {
  font: inherit; font-size: 15px; font-weight: 700; border: 1px solid var(--sand); border-radius: 10px;
  background: #EFE7DA; color: var(--muted); min-height: 48px; padding: 10px 18px; width: 100%;
}
.sf-cat-title { max-width: 720px; margin: 14px auto 0; padding: 0 16px; }
.item-hero { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); display: block; background: var(--ivory); }
.opt-group { margin: 14px 0; }
.opt-line { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--sand); font-size: 15px; }
.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 80;
  background: var(--green); color: #fff; font-size: 15px; padding: 12px 18px; border-radius: 999px;
  box-shadow: 0 8px 24px rgba(27, 58, 47, 0.3); max-width: 92vw; text-align: center;
}

/* ---------- ordering (Phase 2) ---------- */
.basket-bar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 60;
  width: min(680px, calc(100vw - 24px)); min-height: 56px;
  font: inherit; font-size: 17px; font-weight: 700; color: #fff;
  background: var(--green); border: none; border-radius: 14px; cursor: pointer;
  box-shadow: 0 10px 28px rgba(27, 58, 47, 0.35); padding: 12px 18px;
}
.qty-stepper { display: inline-flex; align-items: center; gap: 4px; }
.qty-stepper button {
  width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--sand);
  background: var(--card); font-size: 20px; font-weight: 700; cursor: pointer; color: var(--green);
}
.qty-stepper .qty-num { min-width: 34px; text-align: center; font-size: 17px; font-weight: 700; }
.opt-choice {
  display: flex; align-items: center; gap: 10px; padding: 12px;
  border: 1px solid var(--sand); border-radius: 10px; margin-bottom: 8px;
  font-size: 16px; cursor: pointer; background: var(--card); min-height: 52px;
}
.opt-choice input { width: 22px; height: 22px; flex: none; }
.opt-choice .grow { flex: 1; }
.basket-line, .order-line {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 0; border-bottom: 1px solid var(--sand);
}
.basket-line .grow, .order-line .grow { flex: 1; min-width: 0; }
.line-opts { font-size: 13px; color: var(--muted); display: block; margin-top: 2px; }
.total-row { display: flex; justify-content: space-between; font-size: 16px; padding: 6px 0; }
.total-row.grand { font-size: 19px; font-weight: 800; color: var(--green); border-top: 2px solid var(--sand); margin-top: 6px; padding-top: 10px; }
.pill.status-new { background: #FDF0D5; color: #7A5C00; }
.pill.status-accepted { background: #DCE9F7; color: #1D4E79; }
.pill.status-ready { background: #E3EFE8; color: var(--green); }
.pill.status-done { background: #EFE7DA; color: var(--muted); }
.pill.status-pending_payment { background: var(--red-bg); color: var(--red-ink); }
.order-card { background: var(--card); border: 1px solid var(--sand); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.order-card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.order-card-head .num { font-size: 19px; font-weight: 800; color: var(--green); }
.order-card-head .spacer { flex: 1; }
.summary-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.summary-stat { background: var(--card); border: 1px solid var(--sand); border-radius: var(--radius); padding: 12px; text-align: center; }
.summary-stat .big { font-size: 22px; font-weight: 800; color: var(--green); display: block; }
.summary-stat .lbl { font-size: 12px; color: var(--muted); }
.new-order-alert {
  background: var(--honey); color: #4A3600; border-radius: var(--radius);
  padding: 16px; font-size: 19px; font-weight: 800; text-align: center; margin-bottom: 12px;
  animation: alertflash 0.7s ease-in-out infinite alternate;
}
@keyframes alertflash { from { box-shadow: 0 0 0 0 rgba(244, 185, 66, 0.0); } to { box-shadow: 0 0 0 6px rgba(244, 185, 66, 0.55); } }
.nav-badge {
  display: inline-block; min-width: 22px; padding: 1px 6px; border-radius: 999px;
  background: var(--terra); color: #fff; font-size: 12px; font-weight: 800; vertical-align: 2px;
}
.ready-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.test-mode-note {
  background: #FDF0D5; border: 1px solid var(--honey); border-radius: 10px;
  padding: 14px; font-size: 16px; line-height: 1.5; margin-bottom: 14px; color: #5C4A12;
}
.big-status { font-size: 20px; font-weight: 800; margin: 10px 0; }
.field input[type="datetime-local"] {
  width: 100%; font: inherit; font-size: 16px; padding: 12px;
  border: 1px solid var(--sand); border-radius: 10px; background: var(--card); min-height: 52px;
}
.radio-line { display: flex; gap: 10px; align-items: center; font-size: 16px; padding: 10px 0; cursor: pointer; }
.radio-line input { width: 22px; height: 22px; flex: none; }

/* ---------- admin (Phase 3) ---------- */
.admin-table-wrap { overflow-x: auto; }
table.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.admin-table th, table.admin-table td {
  text-align: left; padding: 8px; border-bottom: 1px solid var(--sand); vertical-align: top;
}
.counts-row { display: flex; gap: 14px; flex-wrap: wrap; font-size: 15px; margin: 10px 0 16px; }

/* ---------- print (QR card) ---------- */
.print-only { display: none; }
@media print {
  body * { visibility: hidden; }
  #printCard, #printCard * { visibility: visible; }
  #printCard {
    display: block !important; position: absolute; inset: 0; text-align: center; padding: 48px 24px;
  }
  #printCard h1 { font-size: 34px; }
  #printQr svg { width: 340px; height: 340px; }
  .no-print { display: none !important; }
}
