:root {
  --bg: #f3f4f2; --card: #fff; --ink: #1d211f; --muted: #6b716d; --line: #e2e5e1;
  --accent: #116149; --accent-soft: #e5f1ec; --warn: #b42318; --warn-soft: #fdecea;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.top { max-width: 1200px; margin: 0 auto; padding: 14px 16px 0; display: flex; align-items: center; gap: 10px; }
.toplogo { height: 36px; width: auto; display: block; }
.top .brand { font-weight: 700; }
.top .muted { margin-left: auto; }
main { max-width: 1200px; margin: 0 auto; padding: 16px; }
h1 { font-size: 28px; line-height: 1.2; margin: 2px 0 0; }
h2 { font-size: 17px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 14px 0 4px; color: var(--muted); font-weight: 600; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 24px; flex-wrap: wrap; margin-bottom: 16px; }
.label { color: var(--muted); font-size: 14px; }
.badge { display: inline-block; margin-left: 10px; vertical-align: middle; font-size: 13px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
select, input, textarea, button { font: inherit; }
select, input, textarea { font-size: 16px; }  /* 手機：小於 16px 的輸入框一點就會自動放大 */
select, input[type=text], input[type=number], input[type=date], input[type=password], textarea {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; color: var(--ink); width: 100%;
}
button { border: 0; border-radius: 8px; padding: 9px 16px; background: var(--ink); color: #fff; cursor: pointer; font-weight: 600; }
button.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
button.ghost:hover { border-color: var(--ink); }
button:disabled { opacity: .45; cursor: not-allowed; }
input:disabled { background: #eef0f3; color: #8a8f98; cursor: not-allowed; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); font-size: 14px; }
.cols { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); column-gap: 24px; align-items: start; }
.cat + .cat { margin-top: 18px; }
@media (max-width: 759px) { .col + .col { margin-top: 18px; } }
.cat h3:first-child { margin-top: 0; }
.item { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-bottom: 1px solid var(--line); cursor: pointer; }
.item input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.item .nm { flex: 1; }
.item .pr { white-space: nowrap; color: var(--muted); }
.item.sel { background: var(--accent-soft); border-radius: 8px; border-bottom-color: transparent; }
.item.sel .pr { color: var(--accent); font-weight: 600; }
.qty { display: none; align-items: center; gap: 4px; }
.item.sel .qty { display: flex; }
.qty button { padding: 1px 9px; background: #fff; color: var(--accent); border: 1px solid var(--accent); }
.qty span { min-width: 20px; text-align: center; font-weight: 600; }
.bar { position: sticky; bottom: 0; background: var(--ink); color: #fff; padding: 12px 16px; }
.bar .in { max-width: 680px; margin: 0 auto; display: flex; gap: 20px; align-items: center; justify-content: center; }
.bar .sum { min-width: 0; flex: 0 1 auto; }
.bar .big { font-size: 22px; font-weight: 700; }
.bar .formula { font-size: 13px; color: #b9c0bb; word-break: break-all; }
.bar button { background: #fff; color: var(--ink); flex: none; padding: 10px 22px; }
.extra { color: #ffb4a8; font-weight: 700; }
.bar .remind { font-size: 15px; line-height: 1.6; }
.bar .remind .extra { white-space: nowrap; }
.bar .remind b:first-child { color: #ffd166; margin-right: 6px; }
.toast { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); background: var(--accent); color: #fff; padding: 10px 18px; border-radius: 8px; display: none; z-index: 9; }
.toast.err { background: var(--warn); }
dialog.lb { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 94vh; overflow: visible; }
dialog.lb::backdrop { background: rgba(0, 0, 0, .82); }
dialog.lb img { display: block; max-width: 96vw; max-height: 94vh; border-radius: 6px; }
.x { position: fixed; top: 12px; right: 12px; width: 44px; height: 44px; padding: 0; border-radius: 50%; background: #fff; color: var(--ink); font-size: 26px; line-height: 44px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 400; white-space: nowrap; }
td.n, th.n { text-align: right; white-space: nowrap; }
.tablewrap { overflow-x: auto; }
.stat { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 10px; margin: 14px 0; }
.stat div { padding: 10px 14px; color: var(--muted); font-size: 14px; }
.stat div + div { border-left: 1px solid var(--line); }
.stat b { display: block; font-size: 24px; color: var(--ink); }
@media (max-width: 600px) { .stat { grid-template-columns: 1fr 1fr; } .stat div:nth-child(3) { border-left: 0; } .stat div:nth-child(n+3) { border-top: 1px solid var(--line); } }
details.card > summary { cursor: pointer; font-weight: 700; font-size: 17px; list-style: none; display: flex; justify-content: space-between; }
details.card > summary::after { content: "展開"; color: var(--muted); font-weight: 400; font-size: 14px; }
details.card[open] > summary::after { content: "收起"; }
details.card[open] > summary { margin-bottom: 12px; }
.hide { display: none !important; }

/* 搜尋列：右側灰色 X 清除搜尋＋「清除」重來 */
.searchrow { display: flex; gap: 10px; margin-bottom: 14px; }
.search { position: relative; flex: 1; }
.search input { padding-right: 40px; }
.clr { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; padding: 0; border-radius: 50%; background: #d5d9dd; color: #fff; font-size: 18px; line-height: 28px; }
.clr:hover { background: #aeb4ba; }
mark { background: #ffe066; color: inherit; border-radius: 3px; padding: 0 1px; }
.item.hit { background: #fff1c7; outline: 2px solid #f2c200; border-radius: 8px; }

/* 後台：菜單分類標題明顯一點；用餐紀錄每列 */
#prices .cat h3 { font-size: 16px; font-weight: 700; color: #2b2f33; background: #eceef1; padding: 6px 12px; border-radius: 8px; margin: 0 0 6px; }
.hrow .dt { width: 9.5em; flex: none; color: var(--muted); }
.hrow .badge { margin-left: 0; }

/* 前台：輕鬆一點的配色（後台維持原樣） */
body.front { --bg: #eef5f9; --line: #e3e9ee; --accent: #17936a; --accent-soft: #dcf4e9; }
.front .card { border-radius: 16px; border-color: #e6edf2; }
.front h1 { color: #1f2a44; }
.front .badge { background: #ffe8a3; color: #8a5a00; }
.front .cat h3 { display: inline-block; padding: 2px 12px; border-radius: 999px; font-size: 13px; color: var(--c); background: var(--cs); }
.front .cat.c0 { --c: #d9532f; --cs: #ffe7df; }
.front .cat.c1 { --c: #1f78c1; --cs: #dcefff; }
.front .cat.c2 { --c: #9a6a00; --cs: #fff1c7; }
.front .cat.c3 { --c: #7a4fc4; --cs: #eee6fb; }
.front .cat.c4 { --c: #17936a; --cs: #dcf4e9; }
.front .bar { background: #1f2a44; }
.front .bar button { background: #ff7a59; color: #fff; }
.front .bar .formula, .front .okx { color: #b7c3dc; }
.front button.ghost { border-radius: 999px; }
button.link, a.link { background: none; border: 0; padding: 0; color: var(--muted); font-weight: 400; font-size: 14px; text-decoration: underline; cursor: pointer; }
button.link:hover, a.link:hover { color: var(--ink); }

/* 後台分頁 */
.tabs { display: flex; gap: 4px; margin-left: 12px; }
.tabs a { padding: 5px 12px; border-radius: 999px; color: var(--muted); text-decoration: none; font-size: 14px; }
.tabs a.on { background: var(--ink); color: #fff; }
@media (max-width: 600px) { .top { flex-wrap: wrap; } .tabs { order: 9; width: 100%; margin: 6px 0 0; } }

/* 登入視窗：關不掉，登入後才離開 */
dialog.login { border: 0; border-radius: 16px; padding: 28px 24px 22px; width: min(380px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog.login::backdrop { background: rgba(20, 30, 50, .55); backdrop-filter: blur(3px); }
dialog.login form { display: grid; gap: 14px; }
dialog.login .logo { width: 220px; max-width: 80%; margin: 0 auto 4px; display: block; }
dialog.login label { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
dialog.login .muted:empty { display: none; }
dialog.login #lgHint { margin: -4px 0 0; }
dialog.login .err { color: #b42318; }
dialog.login #lgGo, dialog.login #pwGo { padding: 11px; background: #1f2a44; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: #eef1f4; border-radius: 999px; padding: 4px; }
.seg button { background: none; color: var(--muted); border-radius: 999px; padding: 8px; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.seg button:disabled { opacity: .4; }
