:root {
  color-scheme: light;
  font-family: "Yu Gothic UI", Meiryo, system-ui, sans-serif;
  color: #1d2928;
  background: #f1f3ed;
  --ink: #173c35;
  --border: #cfd9d1;
  --muted: #4d6259;
  --accent: #195e4d;
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.55; }
button, input, select, textarea { font: inherit; }
button, .file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .58rem .83rem;
  min-height: 2.7rem;
  border: 1px solid #8ea79b;
  border-radius: .45rem;
  background: #fff;
  color: var(--ink);
  font-weight: 650;
  cursor: pointer;
}
button:disabled { background: #edf0ee; color: #56655e; border-color: #d2dad4; cursor: default; }
button:not(:disabled):hover, .file-button:hover { background: #e8f2ea; }
button.primary:not(:disabled) { color: #fff; background: var(--accent); border-color: var(--accent); }
button.primary:not(:disabled):hover { background: #124939; }
:focus-visible { outline: 3px solid #1568b0; outline-offset: 3px; }
a { color: #135b49; }
summary { cursor: pointer; font-weight: 650; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: .02em; }
h2 { font-size: 1.25rem; }
.app-header { background: var(--ink); color: #fff; border-bottom: 4px solid #b4c893; }
.frame { width: min(1240px, calc(100% - 2.5rem)); margin-inline: auto; }
.heading { display: flex; align-items: center; justify-content: space-between; gap: .65rem 1rem; flex-wrap: wrap; min-height: 5.5rem; padding-block: .65rem; }
.trial { color: #e0eed8; font-size: .88rem; }
main.frame { padding-block: 1.45rem 2.5rem; }
.panel { min-width: 0; padding: 1.25rem; border: 1px solid var(--border); border-radius: .75rem; background: #fff; }
.panel > * + * { margin-top: .85rem; }
.controls { align-self: start; }
.pop-workspace { display: grid; grid-template-columns: minmax(315px, 4fr) minmax(0, 7fr); gap: 1.2rem; }
.pop-output { display: grid; align-content: start; gap: 1rem; min-width: 0; }
.section-heading, .button-row { display: flex; align-items: center; gap: .65rem; flex-wrap: wrap; }
.section-heading { justify-content: space-between; }
.file-button { position: relative; }
.file-button:focus-within { outline: 3px solid #1568b0; outline-offset: 3px; }
.file-button input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.field { display: grid; gap: .3rem; font-weight: 650; }
.field input, .field select, .field textarea {
  min-width: 0;
  width: 100%;
  min-height: 2.65rem;
  border: 1px solid #9fb0a5;
  background: #fff;
  border-radius: .4rem;
  padding: .4rem .6rem;
  color: #1d2928;
  font-weight: 450;
}
.field :disabled { background: #edf0ee; }
.notice { padding: .65rem .8rem; background: #edf4ec; border-left: 3px solid #509276; color: #224336; overflow-wrap: anywhere; }
.notice.warning { color: #6e3310; background: #fff1da; border-color: #a65a20; }
.small { color: var(--muted); font-size: .9rem; }
.target-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .25rem .5rem; margin-top: .55rem; }
.target-grid label { display: flex; gap: .4rem; align-items: center; }
.target-grid input { width: 1.06rem; height: 1.06rem; accent-color: var(--accent); }
.preview { min-height: 15rem; padding: clamp(.7rem, 3vw, 1.6rem); display: grid; place-items: center; background: #eef1eb; border: 1px dashed #afbeb3; border-radius: .55rem; }
.pop-card {
  --theme: #974660;
  --tint: #f8e9ed;
  text-align: center;
  background: linear-gradient(145deg, var(--tint) 0%, #fff 49%);
  border: 1px solid var(--theme);
  border-inline: .65rem solid var(--theme);
  border-radius: .3rem;
  padding: .8rem 1.1rem 1.1rem;
  width: min(100%, 30rem);
  color: #202826;
  min-height: 13rem;
  overflow-wrap: anywhere;
}
.pop-card.summer { --theme: #146d68; --tint: #e2f2ed; }
.pop-card.autumn { --theme: #8d5026; --tint: #f8ecdc; }
.pop-card.winter { --theme: #415784; --tint: #e7edf9; }
.pop-stamp { color: #7a2233; font-size: .85rem; font-weight: 750; margin-bottom: .55rem; }
.pop-card h3 { font-size: clamp(1.35rem, 4vw, 1.9rem); }
.english-name { color: #36463f; padding: .22rem 0 .5rem; }
.allergen-icons { display: flex; justify-content: center; align-items: start; gap: .45rem .7rem; flex-wrap: wrap; padding-top: .65rem; border-top: 1px solid var(--theme); }
.allergen-icon { display: grid; justify-items: center; font-size: .8rem; line-height: 1.35; }
.allergen-icon small { font-size: .73rem; }
.allergen-symbol { background: var(--theme); color: #fff; min-width: 2rem; padding: .25rem; border-radius: .35rem; margin-bottom: .23rem; font-size: 1.1rem; }
.count { font-size: .85rem; color: var(--muted); font-weight: 500; margin-left: .3rem; }
.queue { list-style: none; padding: 0; }
.queue:empty { display: none; }
.queue li { display: flex; justify-content: space-between; align-items: center; gap: .6rem; border-top: 1px solid var(--border); padding: .45rem 0; overflow-wrap: anywhere; }
#print-sheet { display: none; }
.fax-workspace { display: grid; gap: 1rem; }
.language { display: flex; flex-wrap: wrap; align-items: center; margin-left: auto; gap: .55rem; }
.language select { width: auto; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .94rem; }
th, td { padding: .52rem .56rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { background: #edf4ec; white-space: nowrap; color: var(--ink); }
td:first-child, td:nth-child(2), td:nth-child(3) { white-space: nowrap; }
td button { min-height: 2.1rem; padding: .3rem .5rem; }
.active-row { background: #edf5ef; }
.attention { color: #743b14; font-weight: 650; }
.complete { color: #145545; font-weight: 650; }
.review-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.16fr); gap: 1.3rem; align-items: start; }
.review-grid > div { min-width: 0; }
.review-grid .section-heading p { overflow-wrap: anywhere; }
#fax-image { display: block; width: 100%; max-height: 66vh; object-fit: contain; object-position: left top; border: 1px solid var(--border); margin-top: .6rem; }
.edit-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem .8rem; margin-block: .9rem; }
.edit-fields .wide, .edit-fields label:has(textarea) { grid-column: 1 / -1; }
.raw-lines { margin-block: .65rem; }
.raw-lines pre { color: var(--muted); background: #f1f4f1; padding: .6rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.ocr-original { font-weight: 450; overflow-wrap: anywhere; }
.check-row { display: flex; gap: .45rem; align-items: center; }
.check-row input { min-width: 1.05rem; width: 1.05rem; min-height: 1.05rem; accent-color: var(--accent); }
.file-errors { color: #743b14; }
.file-errors:empty { display: none; }
@media screen and (max-width: 780px) {
  .pop-workspace, .review-grid { grid-template-columns: minmax(0, 1fr); }
  .language { margin-left: 0; }
}
@page { size: A4; margin: 12mm; }
@media print {
  body:has(#print-sheet) > :not(#print-sheet) { display: none; }
  #print-sheet { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7mm; }
  #print-sheet .pop-card { width: 100%; min-height: 54mm; break-inside: avoid; print-color-adjust: exact; }
  #print-sheet .pop-card h3 { font-size: 18pt; }
}
