:root { --fg: #1f2328; --muted: #59636e; --bg: #ffffff; --accent: #1a73e8; --line: #d1d9e0; --warn: #b42318; --soft: #f6f8fa; }
@media (prefers-color-scheme: dark) { :root { --fg: #e6edf3; --muted: #9198a1; --bg: #0d1117; --accent: #4493f8; --line: #3d444d; --warn: #ff7b72; --soft: #161b22; } }
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif; color: var(--fg); background: var(--bg); line-height: 1.75; }
main { max-width: 860px; margin: 0 auto; padding: 32px 16px 64px; }
h1 { font-size: 1.8rem; line-height: 1.4; } h2 { margin-top: 2.5rem; font-size: 1.25rem; } h3 { font-size: 1.05rem; margin: 1.5rem 0 .25rem; }
a { color: var(--accent); }
.lead { color: var(--muted); font-size: 1.05rem; }
.note { padding: 10px 12px; border-left: 4px solid var(--warn); background: var(--soft); font-size: .92rem; }
.small { color: var(--muted); font-size: .9rem; }
.cta { display: inline-block; margin-top: 8px; padding: 12px 20px; border-radius: 8px; background: var(--accent); color: #fff; text-decoration: none; font-weight: 600; }
table { width: 100%; border-collapse: collapse; } th, td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
th { width: 30%; } .key { font-family: ui-monospace, monospace; font-size: 1.4rem; letter-spacing: .05em; }
footer { margin-top: 48px; color: var(--muted); font-size: .9rem; }
/* ツールの画面 */
.tool { margin-top: 24px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; }
.tool h2 { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.pro-badge { color: var(--muted); font-size: .9rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 16px; align-items: end; }
.grid .wide, .grid fieldset, .grid details { grid-column: 1 / -1; }
.grid p { margin: 4px 0; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; }
label.check { flex-direction: row; align-items: center; grid-column: 1 / -1; }
label.file { display: inline-flex; flex-direction: row; gap: 8px; align-items: center; }
input, select { width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg); font: inherit; }
input[type="checkbox"] { width: auto; }
input[type="file"] { width: auto; border: 0; padding: 0; }
fieldset { border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px 12px; }
.item { display: grid; grid-template-columns: 2fr 1fr auto; gap: 8px; margin-bottom: 8px; }
button { padding: 10px 16px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
button.small-btn { padding: 4px 10px; font-size: .85rem; }
button:active { transform: scale(.98); }
button:disabled { opacity: .5; cursor: default; }
.message { color: var(--warn); font-size: .92rem; min-height: 1em; }
.panel { margin: 16px 0; padding: 12px 16px; border: 2px solid var(--accent); border-radius: 8px; }
.panel h2 { margin-top: 0; padding-top: 0; border-top: 0; }
.scroll { overflow-x: auto; }
.list th { width: auto; white-space: nowrap; }
.list td.actions { white-space: nowrap; }
.product-card { margin: 12px 0; padding: 12px 16px; border: 1px solid var(--line); border-radius: 8px; }
.product-card h3 { margin-top: 0; }
.cost th { width: 45%; font-weight: normal; }
.cost .total, .cost .suggested { font-weight: 700; }
.ingredients { margin-bottom: 0; }
.flag { display: inline-block; margin-left: 8px; padding: 0 8px; border-radius: 4px; background: var(--warn); color: #fff; font-size: .82rem; }
tr.raise td { background: var(--soft); }
/* ラベルの面付け（画面では確認用に表示し、印刷ではこれだけを出す） */
.sheet-wrap { margin-top: 12px; max-height: 520px; overflow: auto; border: 1px solid var(--line); background: #e9ecef; padding: 8px; }
.sheet-page { position: relative; width: 210mm; height: 297mm; margin: 0 auto 8px; background: #fff; color: #000; overflow: hidden; }
.sheet-note { position: absolute; top: 6mm; left: 18.6mm; right: 18.6mm; margin: 0; font-size: 8pt; line-height: 1.4; color: #000; }
.label { position: absolute; padding: 2.5mm 3mm; outline: 1px dashed #adb5bd; }
.label-body { width: 100%; height: 100%; overflow: hidden; font-size: 7pt; line-height: 1.3; }
.label-body p { margin: 0; }
.label-body b { display: inline-block; min-width: 4.5em; margin-right: .5em; }
@media print {
  @page { size: A4; margin: 0; }
  body { background: #fff; }
  main { max-width: none; margin: 0; padding: 0; }
  main > *:not(#tool), #tool > *:not(#sheet-wrap) { display: none !important; }
  #tool { margin: 0; padding: 0; border: 0; }
  .sheet-wrap { display: block !important; max-height: none; overflow: visible; border: 0; padding: 0; margin: 0; background: #fff; }
  .sheet-page { margin: 0; break-after: page; }
  .sheet-page:last-child { break-after: auto; }
  .label { outline: 0; }
}
