:root {
  --bg: #fbf7f1; --card: #fff; --text: #1f2937; --muted: #6b7280; --line: #e5ddd1;
  --accent: #e8590c; --accent-text: #fff; --soft: #fff1e6; --ok: #2f9e44; --err: #c92a2a;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171c; --card: #1f232b; --text: #e8e6e3; --muted: #9ca3af; --line: #343a46;
    --accent: #ff8a3d; --accent-text: #1b1b1b; --soft: #2c2620; --ok: #69db7c; --err: #ff8787;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15171c; --card: #1f232b; --text: #e8e6e3; --muted: #9ca3af; --line: #343a46;
  --accent: #ff8a3d; --accent-text: #1b1b1b; --soft: #2c2620; --ok: #69db7c; --err: #ff8787;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.55;
  font-family: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", sans-serif;
  overflow-wrap: anywhere;
}
a { color: var(--accent); }
h2 { font-size: 1.05rem; margin: 6px 0 8px; }
.top { display: flex; gap: 10px; justify-content: space-between; align-items: flex-start; padding: 14px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.top h1 { margin: 0; font-size: 1.45rem; }
.shop { min-width: 0; }
.shop-name { font-weight: bold; color: var(--accent); }
.shop-info { color: var(--muted); font-size: .9em; display: flex; flex-wrap: wrap; gap: 4px 12px; }
main { max-width: 760px; margin: 0 auto; padding: 14px 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 14px; min-width: 0; }
summary { cursor: pointer; font-weight: bold; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; min-width: 0; }
.field span { font-size: .9em; color: var(--muted); }
input, select, textarea, button { font: inherit; color: inherit; }
input[type=text], input[type=number], select, textarea {
  width: 100%; max-width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
}
textarea { font-family: ui-monospace, Consolas, monospace; font-size: 14px; }
button, .file {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; cursor: pointer;
  display: inline-block; text-decoration: none; color: inherit;
}
button:hover, .file:hover { border-color: var(--accent); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.ghost { flex: none; }
.link { border: 0; background: none; padding: 0 4px; color: var(--accent); font-size: .85em; }
.big { width: 100%; padding: 14px; font-size: 1.25rem; font-weight: bold; background: var(--accent); color: var(--accent-text); border-color: var(--accent); border-radius: 12px; }
.big:hover { filter: brightness(1.05); }
.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.file input { display: none; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.row input[type=text] { flex: 1 1 12em; width: auto; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; }
.tab { padding: 9px; }
.tab.active { background: var(--soft); border-color: var(--accent); color: var(--accent); font-weight: bold; }
.chips-box { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px 10px; margin: 0 0 10px; min-width: 0; }
.chips-box legend { font-size: .9em; color: var(--muted); padding: 0 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.chip { cursor: pointer; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip span { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 3px 11px; font-size: .92em; background: var(--bg); }
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.chips-box.exclude .chip input:checked + span { background: var(--err); border-color: var(--err); color: #fff; text-decoration: line-through; }
.result { border: 2px solid var(--accent); background: var(--soft); }
.result h2 { font-size: 1.3rem; margin: 0 0 8px; }
.result .repeat { color: var(--muted); font-size: .85em; }
.breakdown { width: 100%; border-collapse: collapse; margin: 6px 0 10px; }
.breakdown td { padding: 5px 4px; border-bottom: 1px dashed var(--line); vertical-align: top; }
.breakdown td.num { text-align: right; white-space: nowrap; }
.breakdown tr.sum td { font-weight: bold; border-bottom: 0; font-size: 1.1em; }
.breakdown .kind { color: var(--muted); white-space: nowrap; width: 3.5em; }
.extras { color: var(--muted); font-size: .88em; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.msg { margin-top: 8px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); }
.msg.err { border-color: var(--err); color: var(--err); }
.msg.ok { border-color: var(--ok); color: var(--ok); }
.msg ul { margin: 4px 0 0; padding-left: 1.2em; }
.list { list-style: none; margin: 0 0 12px; padding: 0; }
.list li { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.list li .txt { flex: 1; min-width: 0; }
.list li .price { white-space: nowrap; font-weight: bold; }
.list li button { padding: 3px 8px; font-size: .85em; }
.list .empty { color: var(--muted); border: 0; }
.menu-cat { margin: 10px 0 4px; font-weight: bold; }
.menu-items { list-style: none; margin: 0; padding: 0; }
.menu-items li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; border-bottom: 1px dotted var(--line); }
.menu-items .tags { color: var(--muted); font-size: .82em; }
.hint { color: var(--muted); font-size: .9em; }
code { background: var(--bg); padding: 0 4px; border-radius: 4px; }
footer { text-align: center; color: var(--muted); padding: 10px 16px 28px; font-size: .9em; }

/* 客製化服務資訊：頁尾低調小字，不擋操作；顏色沿用父層，深淺色都看得清；列印時隱藏 */
.custom-ad { margin: 6px auto 0; padding: 0 12px; max-width: 60em; font-size: 12px; line-height: 1.6; color: inherit; text-align: center; overflow-wrap: anywhere; }
.custom-ad a { color: inherit; text-decoration: underline; }
@media print { .custom-ad { display: none !important; } }
