:root {
  color-scheme: light;
  --ink: #2c2025;
  --muted: #64565d;
  --background: #f6f4f3;
  --surface: #fff;
  --line: #dfd5d9;
  --wine: #491e30;
  --accent: #803455;
  --light: #f5e9ef;
  --danger: #8d213c;
  --green: #285f46;
  font: 1rem/1.5 "Aptos", Inter, system-ui, sans-serif;
  color: var(--ink);
  background: var(--background);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
[hidden] { display: none !important; }
a { color: var(--accent); }
a, button, input, select { touch-action: manipulation; }
button, input, select, textarea { font: inherit; }
button, .link-button {
  min-height: 2.75rem;
  border: 1px solid transparent;
  border-radius: .55rem;
  cursor: pointer;
  padding: .55rem .85rem;
  font-weight: 650;
}
button { background: var(--wine); color: white; }
button:hover { background: var(--accent); }
button:disabled { opacity: .5; cursor: default; }
button.subtle, .link-button { background: transparent; color: var(--wine); border-color: var(--line); }
button.subtle:hover, .link-button:hover { background: var(--light); }
button.danger { background: var(--danger); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #a25772;
  outline-offset: 2px;
}
input, select, textarea {
  min-width: 0;
  min-height: 2.75rem;
  padding: .55rem .7rem;
  color: var(--ink);
  background: white;
  border: 1px solid #b9aab1;
  border-radius: .5rem;
  width: 100%;
}
input[type=file] { padding: .45rem; }
input[type=checkbox] { width: auto; min-height: 0; }
label { display: grid; gap: .25rem; font-size: .9375rem; font-weight: 650; }
label.check { display: flex; align-items: center; gap: .5rem; }
h1, h2, h3, p { margin: 0; }
h1, h2, .brand { font-family: Georgia, "Times New Roman", serif; }
h1 { font-size: clamp(2.15rem, 5vw, 3.2rem); line-height: 1.08; color: var(--wine); font-weight: 600; }
h2 { font-size: 1.5rem; line-height: 1.25; color: var(--wine); }
h3 { font-size: 1.06rem; line-height: 1.35; }
.site-header {
  min-height: 4.4rem; padding: .6rem clamp(.85rem, 4vw, 2.25rem);
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  color: white; background: var(--wine);
}
.site-header .subtle { color: white; border-color: #a38391; }
.site-header .subtle:hover { background: #63324a; }
.brand {
  display: inline-flex; align-items: center; gap: .55rem; color: white;
  text-decoration: none; font-size: 1.6rem; letter-spacing: .025em;
}
.brand-symbol { display: grid; place-items: center; color: #f5d4a0; width: 2rem; height: 2rem;
  border: 1px solid #a38391; border-radius: 50%; font-size: 1.3rem; }
.header-meta { display: flex; align-items: center; gap: .7rem; }
.connection { font-size: .875rem; color: #f3dce6; }
main { width: min(100% - 2rem, 68rem); margin: 0 auto; padding: clamp(1.3rem, 4vw, 3rem) 0 7rem; }
.navigation {
  position: fixed; z-index: 2; inset: auto 0 0; display: flex; justify-content: center; gap: .25rem;
  background: var(--surface); border-top: 1px solid var(--line); padding: .45rem .35rem max(.45rem, env(safe-area-inset-bottom));
}
.navigation button { color: var(--muted); background: transparent; font-size: .92rem; border-radius: .45rem; }
.navigation button[aria-current=true] { color: var(--wine); background: var(--light); }
.hero { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.35rem; }
.hero p { color: var(--muted); margin-top: .45rem; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .65rem; margin: 0 0 1.3rem; }
.stat { padding: .75rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: .75rem; }
.stat strong { display: block; font-family: Georgia, serif; font-size: 1.8rem; color: var(--wine); font-weight: 500; line-height: 1.2; }
.stat span { color: var(--muted); font-size: .9rem; }
.panel, .group, .history-row {
  border: 1px solid var(--line); border-radius: .75rem; background: var(--surface); padding: 1rem;
}
.panel { max-width: 48rem; }
.panel + .panel { margin-top: .8rem; }
.narrow { max-width: 26rem; margin: 1.8rem auto; }
.stack { display: grid; gap: .75rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.full { grid-column: 1/-1; }
.toolbar, .actions { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.toolbar { margin-bottom: .7rem; }
.toolbar label { flex: 1 1 12rem; }
.group-list { display: grid; gap: .55rem; }
.group, .history-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.group-meta { color: var(--muted); font-size: .9375rem; margin-top: .18rem; }
.group-main { display: grid; gap: .15rem; }
.quantity { color: var(--wine); font-weight: 700; white-space: nowrap; }
.badge { width: fit-content; border-radius: .35rem; padding: .1rem .45rem; background: var(--light); color: var(--wine); font-size: .875rem; }
.badge.past, .badge.soon { background: #f7e9dd; color: #76391c; }
.badge.wait, .badge.unknown { background: #efecee; color: var(--muted); }
.notice {
  width: min(100% - 2rem, 68rem); margin: .65rem auto 0; padding: .65rem .8rem;
  border: 1px solid #b6d1bf; border-radius: .5rem; color: var(--green); background: #edf7ef;
}
.notice.error { color: var(--danger); border-color: #e2b8c4; background: #fff1f5; }
.empty { color: var(--muted); padding: 1rem; border: 1px dashed #c5b7bd; border-radius: .75rem; }
.muted { color: var(--muted); }
.error-text { color: var(--danger); }
.status { min-height: 1.4rem; color: var(--muted); }
dialog { width: min(36rem, calc(100% - 1.25rem)); max-height: calc(100% - 1.5rem);
  border: 1px solid var(--line); border-radius: .85rem; padding: 1rem; color: var(--ink); }
dialog::backdrop { background: #29142494; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .8rem; }
video { width: 100%; max-height: 50vh; background: #22171c; border-radius: .6rem; }
.qr { display: block; width: min(12rem, 100%); background: white; }
.code { overflow-wrap: anywhere; }
.ocr-text { white-space: pre-wrap; padding: .65rem; max-height: 10rem; overflow: auto; font-size: .9rem; background: var(--background); }
@media (max-width: 38rem) {
  .hero { align-items: flex-start; flex-direction: column; }
  .header-meta { gap: .45rem; }
  .navigation button { flex: 1; padding-inline: .22rem; font-size: .88rem; }
  .stat { padding: .65rem .55rem; }
  .stat strong { font-size: 1.6rem; }
  .stat span { font-size: .85rem; }
  .group { align-items: flex-start; }
}
@media print {
  body > :not(dialog) { display: none !important; }
  dialog { display: block; position: static; border: 0; max-height: none; width: 100%; }
  dialog button, dialog::backdrop { display: none; }
}
