@font-face { font-family: Outfit; src: url(/fonts/outfit-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: Outfit; src: url(/fonts/outfit-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: Outfit; src: url(/fonts/outfit-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --bg: #f7f2eb; --surface: #fffdfb; --ink: #2a2420; --muted: #6a5f57; --line: #eadfd3;
  --accent: #e85a32; --accent-ink: #ffffff; --accent-soft: #fde6dc; --ok: #2f7a4f; --danger: #b3261e;
  --sans: Outfit, "Avenir Next", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #171412; --surface: #221d1a; --ink: #f3ece5; --muted: #b5a99f; --line: #3a322d;
    --accent: #ff7a55; --accent-ink: #1b1411; --accent-soft: #3e241b; --ok: #82d3a3; --danger: #ff8a80; color-scheme: dark; }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 400 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 22px; font-weight: 700; }
h3 { font-size: 17px; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.screen { min-height: 100%; }
.center { display: grid; place-items: center; padding: max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 24px max(16px, env(safe-area-inset-left)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 20px; }
.auth { width: 100%; max-width: 400px; display: grid; gap: 14px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--accent); }
.flame { width: 14px; height: 18px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: linear-gradient(180deg, #ffc15a, var(--accent)); display: inline-block; transform: rotate(8deg); }

form { display: grid; gap: 8px; }
label { font-size: 14px; font-weight: 600; margin-top: 6px; }
input { font: inherit; color: var(--ink); background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px; padding: 13px 14px; min-height: 48px; width: 100%; }
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.btn { font: 600 16px/1 var(--sans); border-radius: 999px; border: 0; padding: 15px 20px; min-height: 48px; cursor: pointer; text-align: center; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.btn.primary { background: var(--accent); color: var(--accent-ink); margin-top: 8px; }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn:disabled { opacity: .6; cursor: default; }
.btn:focus-visible, .tabs button:focus-visible, .msg:focus-visible, .toplink:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.error { color: var(--danger); font-size: 14px; }
.ok-note { background: var(--accent-soft); border-radius: 12px; padding: 12px 14px; }
.dev { font-size: 13px; word-break: break-all; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Signed-in layout: top bar, scrolling views, bottom tabs */
#main { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--ink); color: var(--bg); padding: calc(12px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left)); }
@media (prefers-color-scheme: dark) { .topbar { background: #0e0c0b; color: var(--ink); } }
.shopname { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; min-width: 0; }
.shopname span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toplink { color: inherit; font-weight: 600; font-size: 15px; text-decoration: none; border: 1.5px solid currentColor; border-radius: 999px; padding: 8px 14px; white-space: nowrap; opacity: .9; }
.demo-note { background: var(--accent-soft); font-size: 14px; padding: 10px max(16px, env(safe-area-inset-left)); }
.views { max-width: 720px; margin: 0 auto; padding: 20px max(16px, env(safe-area-inset-right)) 20px max(16px, env(safe-area-inset-left)); }
.view { display: grid; gap: 14px; }
.view-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }

.msg-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.msg { width: 100%; text-align: left; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; cursor: pointer; display: grid; gap: 4px; }
.msg-top { display: flex; align-items: center; gap: 8px; }
.msg-name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-time { color: var(--muted); font-size: 13px; white-space: nowrap; }
.msg-preview { color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.msg.unread { border-color: var(--accent); }
.msg.unread .msg-name::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); margin-right: 8px; vertical-align: 1px; }
.empty { text-align: center; padding: 40px 16px; display: grid; gap: 8px; }

.form { gap: 6px; }
.hours { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 6px; font-variant-numeric: tabular-nums; }
.hours li { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--line); padding-bottom: 6px; }
.hours li.today { font-weight: 600; }
.account { display: grid; gap: 12px; }
.soon { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.soon li { display: grid; gap: 6px; position: relative; }
.chip { justify-self: start; font-size: 12px; font-weight: 600; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 4px 10px; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--surface); border-top: 1px solid var(--line); padding: 6px max(8px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); }
.tabs button { font: 600 13px/1.2 var(--sans); color: var(--muted); background: none; border: 0; padding: 8px 4px; min-height: 56px; display: grid; justify-items: center; gap: 4px; position: relative; cursor: pointer; border-radius: 12px; }
.tabs button[aria-current="page"] { color: var(--accent); }
.ico { width: 22px; height: 22px; background: currentColor; -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; }
.ico-msg { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 4h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H9l-5 4v-4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z'/%3E%3C/svg%3E"); }
.ico-shop { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 9l2-5h14l2 5v1a3 3 0 0 1-6 0 3 3 0 0 1-6 0 3 3 0 0 1-6 0zm2 4.5V21h14v-7.5a5 5 0 0 1-3.5-.8A5 5 0 0 1 12 14a5 5 0 0 1-3.5-1.3 5 5 0 0 1-3.5.8z'/%3E%3C/svg%3E"); }
.ico-soon { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2l2.6 6.4L21 9l-5 4.4L17.5 20 12 16.6 6.5 20 8 13.4 3 9l6.4-.6z'/%3E%3C/svg%3E"); }
.badge { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 20px; height: 20px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: 12px; line-height: 20px; padding: 0 6px; }

.sheet-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(20, 16, 14, .5); display: flex; align-items: flex-end; justify-content: center; }
.sheet { position: relative; width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; background: var(--surface); border-radius: 22px 22px 0 0; padding: 24px max(20px, env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); display: grid; gap: 10px; }
@media (min-width: 640px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 22px; } }
.sheet-close { position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--bg); color: var(--ink); font-size: 24px; cursor: pointer; }
.sheet-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 17px; padding: 6px 0; }
.contact { margin: 0; display: grid; gap: 6px; }
.contact div { display: flex; gap: 10px; }
.contact dt { color: var(--muted); width: 56px; flex: none; }
.contact dd { margin: 0; overflow-wrap: anywhere; user-select: all; }
.sheet-actions { display: grid; gap: 8px; margin-top: 8px; }
.toast { position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30; background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 999px; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }

/* Phase 02: menu editor, hours editor */
.tabs { grid-template-columns: repeat(4, 1fr); }
.ico-menu { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 3h14a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zm3 4v2h8V7zm0 4v2h8v-2zm0 4v2h5v-2z'/%3E%3C/svg%3E"); }
.menu-sections { display: grid; gap: 14px; }
.msec { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 6px 0 10px; }
.msec-head { display: flex; align-items: center; gap: 8px; padding: 10px 16px; }
.msec-head h3 { flex: 1; min-width: 0; }
.msec-note { color: var(--muted); font-size: 14px; padding: 0 16px 6px; }
.linkbtn { font: 600 14px/1 var(--sans); color: var(--accent); background: none; border: 0; padding: 12px 8px; min-height: 44px; cursor: pointer; border-radius: 10px; }
.mitems { list-style: none; margin: 0; padding: 0; }
.mitem { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 16px; border-top: 1px solid var(--line); }
.mitem-main { flex: 1; min-width: 0; text-align: left; font: inherit; color: inherit; background: none; border: 0; padding: 10px 0; cursor: pointer; display: grid; gap: 2px; min-height: 52px; }
.mitem-name { font-weight: 600; overflow-wrap: anywhere; }
.mitem-desc { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.mitem-price { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.mitem.out .mitem-name, .mitem.out .mitem-price { color: var(--muted); text-decoration: line-through; }
.soldout { font: 600 13px/1 var(--sans); border-radius: 999px; padding: 9px 12px; min-height: 40px; min-width: 88px; cursor: pointer; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); white-space: nowrap; }
.soldout[aria-pressed="true"] { background: var(--danger); border-color: var(--danger); color: #fff; }
.add-item { margin: 6px 8px 0; }
.btn.danger { background: transparent; color: var(--danger); border: 1.5px solid currentColor; }
.ed-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.price { display: flex; align-items: center; gap: 8px; }
.price span { font-weight: 600; color: var(--muted); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; margin-top: 12px; min-height: 44px; }
.check input { width: 22px; height: 22px; min-height: 0; accent-color: var(--accent); }
.mt { margin-top: 18px; }
.hours-form { gap: 8px; }
.days { display: grid; gap: 4px; margin-top: 6px; }
.day { display: grid; grid-template-columns: 92px 1fr; gap: 6px 10px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.day-name { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.day-name input { width: 22px; height: 22px; min-height: 0; accent-color: var(--accent); }
.ranges { display: grid; gap: 6px; }
.range { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.range input { width: auto; min-width: 0; flex: 1 1 110px; padding: 10px; min-height: 44px; }
.range .to { color: var(--muted); }
.closed-label { color: var(--muted); }
.closures { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 6px; }
.closures li { display: flex; align-items: center; gap: 10px; background: var(--bg); border-radius: 12px; padding: 6px 6px 6px 14px; }
.closures li span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.add-closure { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; }
.add-closure > div { display: grid; gap: 6px; min-width: 0; }
@media (max-width: 480px) { .add-closure { grid-template-columns: 1fr; } .day { grid-template-columns: 1fr; } }
.start { justify-self: start; }
