:root {
  --bg: #f6f4ef; --card: #fff; --ink: #2b2b2b; --muted: #7a7468; --line: #e6e1d6;
  --brand: #e2711d; --brand-soft: #fdeedd; --meat: #c0392b; --meat-soft: #fbe9e7;
  --veg: #2e8b57; --veg-soft: #e6f4ec; --danger: #c62828; --ok: #2e7d32; --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
.page { max-width: 560px; margin: 0 auto; padding: 14px 14px 90px; }
.page.wide { max-width: 1180px; }
.center { display: flex; min-height: 90vh; align-items: center; justify-content: center; }
.loading { padding: 40vh 0; text-align: center; color: var(--muted); }
.muted { color: var(--muted); font-size: 13px; }
.err { color: var(--danger); min-height: 1.2em; margin: 6px 0; font-size: 14px; }
.big { font-size: 42px; text-align: center; }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.3; }
h2 { font-size: 19px; } h3 { font-size: 16px; }

.card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.06); margin-bottom: 12px; }
.card.fatal { text-align: center; max-width: 360px; }
.card.bind { width: 100%; max-width: 380px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=time], input[type=month], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }

.btn { border: 0; border-radius: 10px; padding: 10px 16px; background: #eee; cursor: pointer; font-weight: 600; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; margin-top: 14px; padding: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; }
.spacer { flex: 1; }

/* Header & tabs */
.top { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.top .title { font-size: 20px; font-weight: 800; }
.top .who { margin-left: auto; font-size: 13px; color: var(--muted); }
.tabs { display: flex; gap: 6px; background: #ece7dc; padding: 4px; border-radius: 12px; margin-bottom: 12px; overflow-x: auto; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 8px 10px; border-radius: 9px; font-weight: 600; color: var(--muted); white-space: nowrap; cursor: pointer; }
.tabs button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* Date chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; }
.chip { flex: 0 0 auto; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 8px 12px; text-align: center; cursor: pointer; min-width: 74px; }
.chip .d { font-weight: 800; font-size: 16px; }
.chip .s { font-size: 11px; color: var(--muted); }
.chip.on { border-color: var(--brand); background: var(--brand-soft); }
.chip.done .s { color: var(--ok); font-weight: 700; }

.bar { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 10px 12px; border-radius: 10px; background: #fff7ec; margin-bottom: 10px; }
.bar.closed { background: #f1f1f1; color: var(--muted); }
.notice { background: #fffbe6; border-left: 4px solid #f5b400; padding: 8px 12px; border-radius: 8px; margin-bottom: 10px; font-size: 14px; white-space: pre-wrap; }

/* Slot cards */
.slots { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.slot { border: 2px solid var(--line); border-radius: var(--radius); background: #fff; padding: 12px; cursor: pointer; text-align: left; }
.slot .tag { display: inline-block; font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 99px; margin-bottom: 4px; }
.slot.meat .tag { background: var(--meat-soft); color: var(--meat); }
.slot.veg .tag { background: var(--veg-soft); color: var(--veg); }
.slot .name { font-weight: 800; font-size: 16px; }
.slot.on.meat { border-color: var(--meat); background: var(--meat-soft); }
.slot.on.veg { border-color: var(--veg); background: var(--veg-soft); }
.slot.off { opacity: .4; cursor: not-allowed; }

.items { display: flex; flex-direction: column; gap: 8px; }
.item { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fff; cursor: pointer; text-align: left; width: 100%; }
.item .dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #c9c2b4; flex: 0 0 auto; }
.item.on { border-color: var(--brand); background: var(--brand-soft); }
.item.on .dot { border-color: var(--brand); background: radial-gradient(var(--brand) 45%, transparent 50%); }
.item .price { margin-left: auto; font-weight: 700; }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stepper button { border: 0; background: #f5f2ec; width: 38px; height: 38px; font-size: 18px; cursor: pointer; }
.stepper span { width: 44px; text-align: center; font-weight: 700; }
.total { font-size: 18px; font-weight: 800; }

.mine { border: 2px solid var(--ok); }
.mine .k { font-size: 13px; color: var(--muted); }
.pill { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 99px; background: #eee; }
.pill.ok { background: #e6f4ea; color: var(--ok); }
.pill.warn { background: #fff3e0; color: #b45f06; }
.pill.gray { background: #eee; color: #888; }
.pill.meat { background: var(--meat-soft); color: var(--meat); }
.pill.veg { background: var(--veg-soft); color: var(--veg); }

.list { display: flex; flex-direction: column; gap: 8px; }
.li { background: #fff; border-radius: 12px; padding: 12px; display: flex; gap: 10px; align-items: flex-start; }
.li.cancel { opacity: .5; }
.li .main { flex: 1; }

.menu-img { width: 100%; border-radius: 10px; border: 1px solid var(--line); }

/* Toast / modal / busy */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.toast { background: #333; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; transition: opacity .4s; max-width: 90vw; }
.toast.error { background: var(--danger); } .toast.ok { background: var(--ok); } .toast.out { opacity: 0; }
.modal-wrap { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 40; padding: 16px; }
.modal { background: #fff; border-radius: 16px; padding: 18px; width: 100%; max-width: 480px; max-height: 90vh; overflow: auto; }
.modal-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
#busy { position: fixed; inset: 0; background: rgba(255,255,255,.5); display: none; align-items: center; justify-content: center; z-index: 45; }
#busy.show { display: flex; }
.spinner { width: 36px; height: 36px; border: 4px solid var(--brand-soft); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Admin ===== */
.admin-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 900px) { .admin-grid.two { grid-template-columns: 340px 1fr; } .admin-grid.half { grid-template-columns: 1fr 1fr; } }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 700; white-space: nowrap; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.cancel td { color: #aaa; text-decoration: line-through; }
.table-wrap { overflow-x: auto; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .hd { text-align: center; font-size: 12px; color: var(--muted); font-weight: 700; padding: 4px 0; }
.cal .c { min-height: 78px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; font-size: 12px; cursor: pointer; overflow: hidden; }
.cal .c.empty { background: transparent; border: 0; cursor: default; }
.cal .c.on { outline: 2px solid var(--brand); }
.cal .c.off { background: #f3f3f3; color: #999; }
.cal .c .n { font-weight: 800; font-size: 13px; }
.cal .c .m { color: var(--meat); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal .c .v { color: var(--veg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal .c .q { color: var(--brand); font-weight: 700; }
.cal .c.today .n { color: var(--brand); }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.checks label { display: inline-flex; align-items: center; gap: 4px; margin: 0; color: var(--ink); font-size: 14px; }
.sec { border-top: 1px dashed var(--line); margin-top: 12px; padding-top: 12px; }
.sumblock { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.kpis { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.kpi { background: #fff; border-radius: 12px; padding: 10px 14px; min-width: 120px; }
.kpi .v { font-size: 22px; font-weight: 800; }
.kpi .l { font-size: 12px; color: var(--muted); }
.rest-card { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; margin-bottom: 6px; background: #fff; }
.rest-card.on { border-color: var(--brand); background: var(--brand-soft); }
.rest-card.dis { opacity: .5; }
a.btn { text-decoration: none; color: inherit; display: inline-block; }
