:root {
  color-scheme: light;
  --ink: #182b27;
  --muted: #50655d;
  --green: #17664e;
  --deep: #103b31;
  --paper: #f7f1e5;
  --line: #c9d2c5;
  --wash: #ebf2e7;
  background: var(--paper);
  color: var(--ink);
  font-family: "PingFang TC", "Microsoft JhengHei", sans-serif;
  line-height: 1.55;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
.masthead { background: var(--deep); color: #fff8e7; border-bottom: 5px solid #ce9c54; }
.masthead-inner { max-width: 46rem; margin: auto; padding: 1rem 1rem 1.3rem; display: flex; justify-content: space-between; align-items: end; gap: 1rem; }
.restaurant { margin: 0; font-size: .85rem; letter-spacing: .14em; color: #e8c890; }
h1, h2 { font-family: Georgia, "Songti TC", serif; }
h1 { margin: 0; font-size: clamp(2rem, 6vw, 3.1rem); line-height: 1.15; }
h2 { margin: 0 0 1rem; font-size: 1.6rem; line-height: 1.25; }
h3 { margin: 1.4rem 0 .65rem; font-size: 1rem; }
main { width: min(100% - 1.5rem, 44rem); margin: 1.25rem auto 2rem; }
.session { display: flex; align-items: center; gap: .35rem; text-align: right; }
.session span { overflow-wrap: anywhere; }
.panel { background: #fffcf5; border: 1px solid #d8d9c7; padding: clamp(.9rem, 4vw, 1.55rem); border-radius: .75rem; }
.login { max-width: 27rem; margin: clamp(1rem, 7vw, 4rem) auto; }
nav { display: flex; gap: .5rem; margin-bottom: .7rem; }
nav button { color: var(--green); background: transparent; width: auto; }
nav [aria-current="page"] { background: var(--green); color: #fff; }
form { display: grid; gap: .7rem; }
label { display: grid; gap: .35rem; font-weight: 700; }
input, textarea { font: inherit; color: var(--ink); width: 100%; min-height: 3rem; border: 1px solid #879c90; border-radius: .35rem; padding: .5rem .7rem; background: #fff; }
input:disabled { color: var(--ink); background: var(--wash); opacity: 1; }
textarea { resize: vertical; }
button { width: 100%; min-height: 3rem; border: 1px solid transparent; border-radius: .4rem; padding: .45rem .75rem; background: var(--green); color: white; font: inherit; font-weight: 700; cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 3px solid #a35b14; outline-offset: 3px; }
.secondary { color: var(--green); background: #fff; border-color: #98b0a4; }
.subtle { width: auto; color: var(--green); background: transparent; text-decoration: underline; text-underline-offset: .2em; }
.inverse { color: #fff8e7; white-space: nowrap; }
.inline { display: flex; align-items: stretch; gap: .6rem; }
.inline button, .heading-row button { width: auto; flex-shrink: 0; }
.heading-row { display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.heading-row h2, .heading-row p { margin-bottom: 0; }
.viewfinder { position: relative; aspect-ratio: 16 / 9; max-height: 20rem; overflow: hidden; background: #102f27; border-radius: .6rem; display: grid; place-items: center; }
video { position: absolute; width: 100%; height: 100%; object-fit: contain; }
.frame { position: relative; height: 66%; aspect-ratio: 1; border: 2px solid #a7f3ca; border-radius: .65rem; pointer-events: none; }
#camera-placeholder { position: absolute; bottom: .35rem; color: #e0eee6; font-size: .82rem; }
#camera, #order-form, #reload-order { margin-top: .8rem; }
.status { color: var(--muted); font-size: .9rem; margin: .6rem 0; }
.status:empty { margin: 0; }
.error { color: #842e20; background: #fce8df; font-weight: 600; padding: .55rem .75rem; border-radius: .35rem; margin: .55rem 0; overflow-wrap: anywhere; }
.manual { border-top: 1px solid var(--line); margin-top: .95rem; padding-top: .85rem; }
#manual-code, .code { font-family: ui-monospace, monospace; letter-spacing: .13em; }
#manual-code { text-transform: uppercase; }
.code { margin: 0; font-size: 1rem; font-weight: 700; color: var(--green); }
.state { font-size: .84rem; padding: .3rem .55rem; background: var(--wash); border: 1px solid var(--line); border-radius: .35rem; }
.field-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .55rem; }
.action-grid { display: grid; gap: .55rem; margin-top: .85rem; }
details, .export { margin-top: 1rem; padding-top: .85rem; border-top: 1px solid var(--line); }
summary { cursor: pointer; font-weight: 700; }
.history-list, .batch-list, .print-grid { list-style: none; padding: 0; }
.history-list li { border-bottom: 1px solid var(--line); padding: .55rem 0; overflow-wrap: anywhere; }
.history-list p { margin: .15rem 0; }
.batch-list button { text-align: left; margin-bottom: .35rem; }
.print-actions { margin: .9rem 0; }
.print-actions p { margin: 0; }
.print-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(6rem, 1fr)); gap: .3rem; }
.print-grid li { display: grid; justify-items: center; border: 1px solid var(--line); background: white; color: black; padding: .3rem; break-inside: avoid; }
.print-grid svg { display: block; width: min(100%, 5rem); height: auto; }
.print-grid code { font-size: 1rem; letter-spacing: .12em; }
dialog { width: min(100% - 2rem, 26rem); color: var(--ink); background: #fffcf5; border: 1px solid var(--line); border-radius: .6rem; padding: 1rem; }
dialog::backdrop { background: #122b25a8; }
dialog .inline button { flex: 1; }
@media (max-width: 24rem) { .field-grid { grid-template-columns: 1fr; } }
@media print {
  :root, .panel { background: white; color: black; }
  .masthead, main > :not(#workspace), #workspace > :not(#batch-panel), #batch-panel > :not(#print-sheet), dialog { display: none !important; }
  main, .panel { width: auto; max-width: none; margin: 0; padding: 0; border: 0; }
  .print-grid { grid-template-columns: repeat(4, 1fr); }
}
