:root {
  --pink: #e0457b; --pink-dark: #c2306a; --pink-soft: #fde8ef;
  --cream: #fff7f2; --card: #ffffff; --ink: #3b1f2b; --muted: #8a6b77; --line: #f1dce3;
  --green: #1e9e5a; --green-soft: #e3f6ec; --amber: #c97a00; --amber-soft: #fff1d6;
  --blue: #2d6cdf; --blue-soft: #e6eefc; --grey-soft: #f1eef0; --red: #c62f3d;
  --radius: 16px; --shadow: 0 4px 18px rgba(59, 31, 43, .07);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--cream); color: var(--ink); }
body { font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif; padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--pink-dark); }

/* ---------- layout ---------- */
.topbar { position: sticky; top: 0; z-index: 10; background: var(--pink); color: #fff; padding: calc(12px + env(safe-area-inset-top)) 16px 12px; display: flex; align-items: center; gap: 10px; min-height: 60px; }
.topbar h1 { font-size: 21px; flex: 1; }
.topbar .back { background: rgba(255,255,255,.18); border: 0; color: #fff; width: 40px; height: 40px; border-radius: 12px; font-size: 22px; display: grid; place-items: center; }
main { max-width: 680px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card h2 { font-size: 17px; margin-bottom: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.section-title { font-size: 15px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 22px 4px 10px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.big { font-size: 22px; font-weight: 800; }
.center { text-align: center; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.empty .icon { font-size: 40px; }

/* ---------- bottom navigation ---------- */
.nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: #fff; border-top: 1px solid var(--line); display: flex; justify-content: space-around; align-items: flex-end; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
.nav a { flex: 1; text-decoration: none; color: var(--muted); display: flex; flex-direction: column; align-items: center; font-size: 12px; font-weight: 600; gap: 2px; padding: 4px 0; }
.nav a svg { width: 26px; height: 26px; }
.nav a.active { color: var(--pink); }
.nav a.plus { color: var(--pink); }
.nav a.plus span.circle { width: 58px; height: 58px; margin-top: -26px; border-radius: 50%; background: var(--pink); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 16px rgba(224,69,123,.4); border: 4px solid #fff; }
.nav a.plus svg { width: 30px; height: 30px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 14px; padding: 14px 18px; min-height: 52px; font-weight: 700; font-size: 17px; background: var(--pink); color: #fff; cursor: pointer; text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn.block { width: 100%; }
.btn.huge { min-height: 64px; font-size: 20px; border-radius: 18px; }
.btn.green { background: var(--green); }
.btn.light { background: var(--pink-soft); color: var(--pink-dark); }
.btn.outline { background: #fff; color: var(--ink); border: 1.5px solid var(--line); }
.btn.danger { background: #fff; color: var(--red); border: 1.5px solid #f3c9cd; }
.btn.small { min-height: 40px; padding: 8px 12px; font-size: 15px; border-radius: 12px; }
.btn svg { width: 22px; height: 22px; }
.btn[disabled] { opacity: .5; }
.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- forms ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 15px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=tel], input[type=number], input[type=date], input[type=time], input[type=search], input[type=password], textarea, select {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 13px 14px; background: #fff; font-size: 18px; min-height: 52px; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--pink); box-shadow: 0 0 0 3px var(--pink-soft); }
textarea { min-height: 80px; resize: vertical; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 10px 16px; font-weight: 600; font-size: 16px; min-height: 46px; cursor: pointer; }
.chip.on { background: var(--pink); border-color: var(--pink); color: #fff; }
.toggle2 { display: grid; grid-template-columns: 1fr 1fr; background: var(--grey-soft); border-radius: 14px; padding: 4px; gap: 4px; }
.toggle2 button { border: 0; background: transparent; border-radius: 11px; min-height: 48px; font-weight: 700; color: var(--muted); }
.toggle2 button.on { background: #fff; color: var(--pink-dark); box-shadow: 0 1px 6px rgba(0,0,0,.08); }
.hint { font-size: 14px; color: var(--green); font-weight: 600; margin-top: 6px; }

/* product tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.tile { position: relative; border: 1.5px solid var(--line); background: #fff; border-radius: 14px; padding: 12px; text-align: left; min-height: 82px; cursor: pointer; }
.tile b { display: block; font-size: 16px; line-height: 1.25; }
.tile .price { color: var(--muted); font-size: 14px; margin-top: 4px; }
.tile.on { border-color: var(--pink); background: var(--pink-soft); }
.tile .badge { position: absolute; top: -8px; right: -8px; background: var(--pink); color: #fff; border-radius: 999px; min-width: 30px; height: 30px; display: grid; place-items: center; font-weight: 800; font-size: 15px; border: 2px solid #fff; }

/* selected item lines */
.line { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.line:last-child { border-bottom: 0; }
.line .name { font-weight: 700; }
.line input { min-height: 44px; padding: 8px 10px; font-size: 17px; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button { width: 44px; height: 44px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; font-size: 22px; font-weight: 700; color: var(--pink-dark); }
.stepper input { width: 64px; text-align: center; }
.line .meta { display: flex; gap: 8px; align-items: center; grid-column: 1 / -1; }
.line .meta input.price { width: 110px; }

/* totals */
.totals .t { display: flex; justify-content: space-between; padding: 6px 0; }
.totals .t.grand { font-size: 22px; font-weight: 800; border-top: 2px solid var(--ink); margin-top: 6px; padding-top: 10px; }
.totals .t.due { color: var(--pink-dark); font-weight: 800; font-size: 20px; }
.totals .t input { width: 130px; text-align: right; min-height: 44px; padding: 8px 10px; }

.savebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); display: flex; gap: 12px; align-items: center; }
.savebar .sum { flex: 1; }
.savebar .sum small { display: block; color: var(--muted); font-size: 13px; font-weight: 600; }
.savebar .sum b { font-size: 24px; }
.savebar .btn { min-width: 170px; }
body.has-savebar .nav { display: none; }

/* ---------- order cards ---------- */
.ocard { display: block; text-decoration: none; color: inherit; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 10px; border-left: 6px solid var(--line); }
.ocard.s-new { border-left-color: var(--blue); } .ocard.s-baking { border-left-color: var(--amber); }
.ocard.s-ready { border-left-color: var(--pink); } .ocard.s-delivered { border-left-color: var(--green); } .ocard.s-cancelled { opacity: .55; }
.ocard .who { font-weight: 800; font-size: 18px; }
.ocard .what { color: var(--muted); font-size: 15px; margin: 2px 0 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pill { display: inline-block; border-radius: 999px; padding: 4px 10px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.pill.new { background: var(--blue-soft); color: var(--blue); } .pill.baking { background: var(--amber-soft); color: var(--amber); }
.pill.ready { background: var(--pink-soft); color: var(--pink-dark); } .pill.delivered { background: var(--green-soft); color: var(--green); }
.pill.cancelled { background: var(--grey-soft); color: var(--muted); }
.pill.due { background: #fff0f0; color: var(--red); } .pill.paid { background: var(--green-soft); color: var(--green); }
.datehead { font-weight: 800; margin: 18px 4px 8px; font-size: 16px; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; text-decoration: none; color: inherit; }
.stat .v { font-size: 22px; font-weight: 800; }
.stat .l { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat.hl .v { color: var(--pink-dark); }
.hello { margin: 4px 4px 16px; }
.hello h2 { font-size: 24px; }

/* ---------- order detail ---------- */
.status-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.status-steps div { text-align: center; font-size: 13px; font-weight: 700; color: var(--muted); }
.status-steps div i { display: block; height: 8px; border-radius: 4px; background: var(--grey-soft); margin-bottom: 6px; }
.status-steps div.done { color: var(--pink-dark); } .status-steps div.done i { background: var(--pink); }
.note { background: var(--amber-soft); border-radius: 12px; padding: 12px; font-weight: 600; white-space: pre-wrap; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; }
.kv dt { color: var(--muted); font-weight: 600; font-size: 15px; } .kv dd { margin: 0; font-weight: 600; }

/* ---------- list rows ---------- */
.list a, .list .item { display: flex; align-items: center; gap: 12px; padding: 14px 4px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.list a:last-child, .list .item:last-child { border-bottom: 0; }
.list .ico { width: 42px; height: 42px; border-radius: 12px; background: var(--pink-soft); color: var(--pink-dark); display: grid; place-items: center; flex: none; }
.list .ico svg { width: 22px; height: 22px; }
.list .chev { color: var(--muted); font-size: 22px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--pink-soft); color: var(--pink-dark); display: grid; place-items: center; font-weight: 800; flex: none; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 6px; background: var(--grey-soft); padding: 4px; border-radius: 14px; margin-bottom: 12px; }
.tabs a { flex: 1; text-align: center; padding: 11px 4px; border-radius: 11px; text-decoration: none; color: var(--muted); font-weight: 700; font-size: 15px; }
.tabs a.on { background: #fff; color: var(--pink-dark); box-shadow: 0 1px 6px rgba(0,0,0,.08); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; }
.login .logo { font-size: 56px; }
.login h1 { color: var(--pink-dark); font-size: 28px; margin: 6px 0 4px; }
.dots { display: flex; gap: 14px; justify-content: center; margin: 22px 0; }
.dots i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--pink); }
.dots i.on { background: var(--pink); }
.pad { display: grid; grid-template-columns: repeat(3, 76px); gap: 14px; }
.pad button { height: 76px; border-radius: 50%; border: 0; background: #fff; box-shadow: var(--shadow); font-size: 28px; font-weight: 700; }
.pad button.fn { background: transparent; box-shadow: none; font-size: 17px; color: var(--muted); }
.err { color: var(--red); font-weight: 600; min-height: 24px; }

/* ---------- modal & toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(59,31,43,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: #fff; width: 100%; max-width: 680px; border-radius: 22px 22px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); max-height: 90vh; overflow: auto; animation: up .2s ease; }
.sheet h3 { font-size: 21px; margin-bottom: 14px; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-weight: 600; z-index: 60; box-shadow: var(--shadow); max-width: 90vw; text-align: center; }
.spinner { width: 36px; height: 36px; border: 4px solid var(--pink-soft); border-top-color: var(--pink); border-radius: 50%; animation: spin 1s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
table.simple { width: 100%; border-collapse: collapse; font-size: 15px; }
table.simple td, table.simple th { padding: 8px 4px; border-bottom: 1px solid var(--line); text-align: left; }
table.simple .r { text-align: right; }
@media (min-width: 700px) { .stats { gap: 14px; } .stat .v { font-size: 26px; } }
