:root {
  --bg: #f4f5f2;
  --card: #ffffff;
  --ink: #26302c;
  --dim: #6b7570;
  --line: #dde2dd;
  --accent: #1d7a5f;
  --accent-dark: #135843;
  --danger: #b23c3c;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: "Yu Gothic UI", "Hiragino Sans", "Meiryo", sans-serif; padding: 20px 12px 60px; }
.wrap { max-width: 860px; margin: 0 auto; }
header { margin-bottom: 18px; }
h1 { font-size: 26px; margin: 0; letter-spacing: 1px; }
.ver { font-size: 13px; color: var(--dim); font-weight: normal; }
.tagline { font-size: 13px; color: var(--dim); margin: 4px 0 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin-bottom: 16px; }
h2 { font-size: 16px; margin: 0 0 12px; border-left: 4px solid var(--accent); padding-left: 8px; }
h3 { font-size: 14px; margin: 0 0 8px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-top: 10px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--dim); }
input, select, textarea { font-size: 15px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); font-family: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.matline { display: flex; gap: 6px; }
button { font-size: 14px; padding: 9px 16px; border-radius: 6px; border: 1px solid var(--accent); background: #fff; color: var(--accent-dark); cursor: pointer; font-family: inherit; }
button:hover { background: #eaf4f0; }
button.primary { background: var(--accent); color: #fff; font-size: 16px; padding: 12px 28px; }
button.primary:hover { background: var(--accent-dark); }
button.ghost { border-color: var(--line); color: var(--dim); }
button.mini { padding: 4px 10px; font-size: 12px; }
.actions { text-align: center; margin: 20px 0; }
.subpanel { background: #f7f9f7; border: 1px dashed var(--line); border-radius: 8px; padding: 12px 14px; margin-top: 12px; }
.hidden { display: none; }
.hint { font-size: 12px; color: var(--dim); margin: 8px 0 0; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; color: var(--dim); font-weight: normal; padding: 6px 6px; border-bottom: 1px solid var(--line); }
td { padding: 5px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td input[type="text"] { width: 100%; min-width: 90px; }
td input[type="number"] { width: 80px; }
td select { width: 84px; }
.chip { display: inline-block; width: 13px; height: 13px; border-radius: 3px; margin-right: 6px; vertical-align: -2px; border: 1px solid rgba(0,0,0,0.2); }
#summary { font-size: 15px; margin-bottom: 10px; }
#summary b { font-size: 20px; color: var(--accent-dark); }
#legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; margin-bottom: 14px; }
.sheetblock { margin-bottom: 20px; }
.sheetblock h3 { font-size: 14px; margin-bottom: 6px; }
.sheetblock .meta { font-size: 12px; color: var(--dim); margin-left: 8px; font-weight: normal; }
.sheetblock svg { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; background: #fff; display: block; }
textarea { width: 100%; font-family: "Consolas", monospace; }
.error { color: var(--danger); font-size: 14px; margin-top: 8px; }
.histlink { color: var(--accent-dark); cursor: pointer; text-decoration: underline; }
.del { color: var(--danger); border-color: var(--line); }
.printonly { display: none; }
.backlink { margin: 0 0 6px; font-size: 12px; }
.backlink a { color: var(--dim); text-decoration: none; }
.backlink a:hover { color: var(--accent-dark); }
.site-foot { text-align: center; font-size: 12px; color: var(--dim); padding: 24px 0 0; line-height: 1.8; }
@media print {
  .backlink, .site-foot { display: none !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { background: #fff; padding: 0; }
  header, .actions, #history-card, .card { display: none !important; }
  #result-card { display: block !important; border: none; padding: 0; margin: 0; }
  #result-card h2, #result-card .row { display: none !important; }
  .printonly { display: block; font-size: 18px; font-weight: bold; margin-bottom: 6px; }
  .printonly small { font-size: 12px; font-weight: normal; color: #555; margin-left: 10px; }
  .sheetblock { break-inside: avoid; }
  .sheetblock svg { border: 1px solid #ccc; }
}
