
:root {
  --ok: #2f7d4f;
  --ok-soft: #e4f1e8;
  --warn: #b7791f;
  --warn-soft: #fbefd8;
  --bad: #b3372c;
  --bad-soft: #f7e0dc;
  --na-soft: #eef0f2;
  --paper: #fbfaf7;
  --hair: #e7e3db;
  --ink-2: #5b6670;
}

main { display: block; }
.small { font-size: 0.85em; }
.muted { color: var(--ink-2); }
.mono { font-family: var(--mono); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; top: 0; left: 0; margin: -1px; }
.btn-quiet { border-color: var(--border); font-weight: 600; min-height: 36px; padding: 7px 12px; font-size: 13px; }
.small-btn { min-height: 0; padding: 2px 0; font-size: 0.85em; }
.small-add { min-height: 36px; padding: 7px 14px; font-size: 14px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.empty { color: var(--ink-2); font-size: 0.9em; margin: 6px 0; }
.warn-p { color: var(--warn); font-weight: 600; margin: 4px 0; }
.u-h { font-family: var(--mono); font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-2); font-weight: 600; margin: 14px 0 6px; }
.d-src { display: block; font-size: 0.78em; color: var(--ink-2); margin: 2px 0 0; }
.hint { font-size: 0.8em; color: var(--ink-2); margin: 4px 0 8px; max-width: 820px; }
.big-line { font-size: 1.05em; font-weight: 600; max-width: 900px; }


.hero-band {
  background-color: var(--paper);
  background-image:
    linear-gradient(to right, rgba(169, 80, 8, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(169, 80, 8, 0.05) 1px, transparent 1px);
  background-size: 28px 28px;
  border-bottom: 1px solid var(--hair);
}
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); gap: 32px; align-items: end; padding-top: 44px; padding-bottom: 36px; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-top: 28px; padding-bottom: 24px; } }
.hero-grid > * { min-width: 0; }
.hero-grid h1 { max-width: 780px; overflow-wrap: anywhere; }
.how { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.how li { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--hair); border-radius: 10px; padding: 12px 14px; font-size: 0.92em; animation: rise 0.5s ease both; }
.how li:nth-child(2) { animation-delay: 0.08s; }
.how li:nth-child(3) { animation-delay: 0.16s; }
.how-n { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--text); color: #fff; font-family: var(--mono); font-size: 13px; display: inline-flex; align-items: center; justify-content: center; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .how li { animation: none; } }
.badge { max-width: 100%; white-space: normal; }

.topbar-right { display: flex; align-items: center; gap: 10px; }
.lang-pick select { font: inherit; font-size: 13px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.lang-pick[hidden] { display: none; }
.review-notice { margin: 0; padding: 8px 20px; background: var(--warn-soft); color: #6b4410; font-size: 0.88em; font-weight: 600; text-align: center; }
.review-notice[hidden] { display: none; }


.utility { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 16px; align-items: end; padding: 18px 0 6px; border-bottom: 1px dashed var(--hair); }
.utility > * { min-width: 0; }
.util-field { display: flex; flex-direction: column; gap: 4px; font-size: 0.85em; font-weight: 600; }
.util-field select { font: inherit; font-weight: 400; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); min-width: 320px; max-width: 100%; }
.util-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.util-note { grid-column: 1 / -1; font-size: 0.8em; margin: 0; }
.utility .file-info { grid-column: 1 / -1; margin: 0; }
@media (max-width: 700px) { .utility { grid-template-columns: minmax(0, 1fr); } .util-actions { justify-content: flex-start; } .util-field select { min-width: 0; width: 100%; } }
.step-nav { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 0 0; }
.step-nav a { font-family: var(--mono); font-size: 12px; font-weight: 700; text-decoration: none; color: var(--text); border: 1px solid var(--hair); border-radius: 999px; padding: 3px 10px; background: var(--surface); }
.step-nav a:hover { border-color: var(--btn-border); background: #fff8ec; }


.inputs { display: flex; flex-direction: column; gap: 16px; min-width: 0; padding: 16px 0 8px; }
.icard { background: var(--surface); border: 1px solid var(--hair); border-radius: 12px; padding: 16px 18px; min-width: 0; scroll-margin-top: 12px; }
.icard h2 { font-size: 1.2rem; margin: 0 0 6px; }
.step-k { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--brand); font-weight: 700; margin: 0 0 4px; }
.sub-t { font-size: 1rem; margin: 20px 0 4px; }
.igrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 12px 16px; margin: 6px 0; }
.igrid > * { min-width: 0; }
.f { display: flex; flex-direction: column; gap: 4px; font-size: 0.88em; min-width: 0; }
.f-wide { grid-column: 1 / -1; }
.f-lab { display: flex; gap: 6px; align-items: flex-start; font-weight: 600; }
.f select, .f input { font: inherit; font-size: 0.98em; padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); width: 100%; min-width: 0; max-width: 100%; }
.f input.in-num { font-family: var(--mono); }
.f .hint { margin: 0; }
.in-short { max-width: 200px; }
input.in-bad, select.in-bad { border-color: var(--bad) !important; background: var(--bad-soft) !important; }
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.chk { display: flex; gap: 8px; align-items: flex-start; font-size: 0.95em; cursor: pointer; }
.chk input { width: 16px; height: 16px; margin-top: 2px; flex: none; }
.inv-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.inv-head > div:first-child { min-width: 0; flex: 1 1 320px; }
.inv-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.notes-list { margin: 8px 0 12px; padding-left: 18px; font-size: 0.85em; color: var(--muted); max-width: 900px; }
.notes-list li { margin-bottom: 4px; }
.file-info { margin: 10px 0 0; color: var(--muted); font-size: 0.9em; word-break: break-word; }


.table-scroll { overflow-x: auto; max-width: 100%; position: relative; }
.inv { width: 100%; border-collapse: collapse; font-size: 0.9em; margin: 4px 0 8px; }
.inv th { text-align: left; font-size: 0.8em; color: var(--ink-2); font-weight: 600; padding: 6px; border-bottom: 2px solid var(--text); vertical-align: bottom; }
.inv td, .inv tbody th { padding: 6px; vertical-align: top; border-bottom: 1px solid var(--hair); text-align: left; }
.inv tbody th { font-weight: 600; font-size: 0.95em; min-width: 180px; }
.inv input, .inv select { font: inherit; font-size: 0.95em; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); width: 100%; min-width: 0; }
.inv input.in-num { font-family: var(--mono); min-width: 90px; }
.inv input.in-label { min-width: 170px; }
.inv tfoot td { font-weight: 700; border-top: 2px solid var(--text); border-bottom: 0; }
.inv .ln { font-family: var(--mono); color: var(--ink-2); padding-top: 12px; }
.goods { min-width: 460px; max-width: 760px; }
.streams { min-width: 1060px; }
.streams select { min-width: 140px; }
.energy { min-width: 980px; }
.elsrc { min-width: 560px; max-width: 820px; }
.chain-t { min-width: 460px; max-width: 820px; }
.num-out { font-family: var(--mono); font-weight: 700; white-space: nowrap; text-align: right; padding-top: 12px !important; }
.chk-cell { text-align: center; padding-top: 12px !important; }
.chk-cell input { width: 16px; height: 16px; }
.row-actions { white-space: nowrap; }
.row-actions .danger, .danger { color: var(--bad); }
.row-actions .danger { font-size: 1.2em; padding: 0 6px; }
.facs { display: flex; flex-wrap: wrap; gap: 6px 10px; min-width: 250px; }
.fac { display: flex; flex-direction: column; gap: 2px; font-size: 0.82em; color: var(--ink-2); flex: 1 1 110px; }
.fac input { font-size: 1.05em; }
.std-tag { margin: 6px 0 0; font-size: 0.8em; color: var(--ink-2); }
.std-tag[hidden] { display: none; }
.std-pill { display: inline-block; font-family: var(--mono); font-size: 0.85em; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); }
.chain-m { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chain-m input { max-width: 130px; }
.chain-m .unit { font-size: 0.85em; color: var(--ink-2); }


.combo { position: relative; }
.combo-list { margin: 4px 0 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 18px rgba(35, 40, 44, 0.12); max-height: 240px; overflow-y: auto; }
.combo-list[hidden] { display: none; }
.combo-list li { padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: 0.85em; line-height: 1.3; }
.combo-list li span { color: var(--ink-2); font-size: 0.9em; }
.combo-list li[aria-selected="true"] { background: #fff1d9; }
.combo-list li.combo-note { cursor: default; color: var(--ink-2); font-style: italic; }
.code-cell { min-width: 240px; }
.code-cell .in-code { font-family: var(--mono); }
.code-lab { display: block; font-size: 0.78em; color: var(--ink-2); line-height: 1.3; margin-top: 3px; font-family: var(--font); }
.code-f { grid-column: span 2; }
@media (max-width: 560px) { .code-f { grid-column: 1 / -1; } }
.code-f .code-cell { min-width: 0; }


.add-proc { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 10px 0 4px; }
.add-proc .f { flex: 1 1 280px; max-width: 520px; }
.proc-list { display: flex; flex-direction: column; gap: 14px; margin-top: 10px; }
.pcard { border: 1px solid var(--hair); border-left: 4px solid var(--btn); border-radius: 10px; padding: 12px 14px; background: var(--paper); min-width: 0; }
.pc-head { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.pc-head .pc-fields { flex: 1 1 360px; margin: 0; }
.pc-head .danger { align-self: center; }
.pc-id { display: inline-block; font-size: 0.8em; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--text); color: #fff; align-self: flex-start; }
.pcard .pc-head > .pc-id { margin-top: 26px; }
.pblock { margin: 10px 0 16px; min-width: 0; }
.pb-title { font-size: 1rem; margin: 0 0 6px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.add-stream { max-width: 460px; margin-top: 6px; }


.grid-box { border: 1px solid var(--hair); border-left: 4px solid var(--text); border-radius: 10px; padding: 10px 14px; background: var(--paper); font-size: 0.9em; max-width: 960px; }
.grid-box p { margin: 0 0 6px; }
.gb-v { font-weight: 700; }
.iea { font-size: 0.78em; color: var(--ink-2); border-top: 1px dotted var(--hair); padding-top: 6px; margin: 6px 0 0; max-width: 960px; overflow-wrap: anywhere; }
.icard, .card, .op-report, .gate-box { overflow-wrap: break-word; }
.method .iea { max-width: 900px; }


.prow { border: 1px solid var(--hair); border-radius: 10px; padding: 10px 12px; margin: 8px 0; background: var(--surface); min-width: 0; }
.prow-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.prow-head .u-h { margin: 0; }
.sup { border: 1px dashed var(--border); border-radius: 8px; padding: 6px 12px 10px; margin: 4px 0 0; min-width: 0; }
.sup legend { font-weight: 600; font-size: 0.95em; padding: 0 4px; }
.sup .hint { margin: 0 0 4px; }
.pv { margin: 8px 0 0; font-size: 0.85em; font-weight: 600; color: var(--ok); }
.pv.pv-none { color: var(--ink-2); font-weight: 400; }


.err-box { border: 1px solid var(--bad); border-left-width: 4px; border-radius: 10px; padding: 8px 14px; background: var(--bad-soft); margin: 10px 0; }
.err-box[hidden] { display: none; }
.err-box .u-h { color: var(--bad); margin-top: 4px; }
.flags { margin: 0; padding-left: 18px; font-size: 0.9em; }
.in-errors li.error { color: var(--bad); }
.dtable { border-collapse: collapse; font-size: 0.9em; margin: 8px 0 12px; min-width: 560px; width: 100%; }
.dtable th, .dtable td { text-align: left; padding: 7px 12px 7px 0; border-bottom: 1px solid var(--hair); vertical-align: top; }
.dtable thead th { color: var(--ink-2); font-weight: 600; font-size: 0.85em; border-bottom: 2px solid var(--text); }
.dtable tbody th { font-weight: 600; }
.dtable td { font-family: var(--mono); }
.dtable td.txt, .dtable td.code-td .code-lab { font-family: var(--font); }
.dtable tr.tot td, .dtable tr.tot th { font-weight: 700; border-top: 2px solid var(--text); }
.dtable tr.grp th { padding-top: 14px; font-size: 0.95em; color: var(--brand); border-bottom: 1px solid var(--hair); }
.dtable .code-td { min-width: 200px; max-width: 360px; }
.dtable tr.exp-row td { font-family: var(--font); background: var(--paper); padding: 8px 12px; }
.interp-list { margin: 0; padding-left: 20px; font-size: 0.9em; }
.interp-list li { margin-bottom: 6px; max-width: 900px; }
.note-box { border-left: 3px solid var(--btn); background: var(--paper); padding: 8px 12px; border-radius: 4px; font-size: 0.9em; max-width: 900px; margin: 6px 0 8px; }
.note-box p { margin: 0 0 4px; }


.ver-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 12px; }
.ver-item, .sp-block { border: 1px solid var(--hair); border-radius: 10px; padding: 10px 12px; background: var(--surface); min-width: 0; }
.sp-block { margin: 8px 0; }
.vi-head { margin: 0 0 6px; font-weight: 600; font-size: 0.92em; }
.facts { list-style: none; margin: 0; padding: 0; font-size: 0.9em; }
.facts li { padding: 5px 0; border-bottom: 1px dotted var(--hair); }
.out-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0; }
.dl-warn { padding: 8px 12px; border-radius: 8px; background: var(--warn-soft); color: #6b4410; font-weight: 600; font-size: 0.88em; max-width: 900px; }
.dl-warn[hidden] { display: none; }
.file-info.msg-ok { color: var(--ok); }
.file-info.msg-error { color: var(--bad); font-weight: 600; }


.log-card { margin-top: 24px; }
.register { margin: 0; padding-left: 20px; font-size: 0.92em; }
.register > li { margin-bottom: 12px; max-width: 920px; }
.register .r-text { margin: 0; }
.register .r-meta { margin: 2px 0 0; font-size: 0.82em; color: var(--ink-2); }
.terms summary { cursor: pointer; font-size: 0.82em; color: var(--brand); font-weight: 600; margin-top: 4px; }
.terms dl { margin: 6px 0 0; font-size: 0.88em; }
.terms dt { font-weight: 700; }
.terms dd { margin: 0 0 6px; }


.op-report { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin: 16px 0; min-width: 0; }
.op-report[hidden] { display: none; }
.op-report h2 { font-size: 1.35rem; }
.q-lead { margin: 0 0 12px; color: var(--ink-2); font-size: 0.92em; max-width: 880px; }
.print-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; margin: 0 0 12px; flex-wrap: wrap; }
.print-brand .brand-logo { height: 22px; }
.rep-head { border-bottom: 2px solid var(--text); padding-bottom: 10px; margin-bottom: 8px; }
.rep-kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 14px; font-size: 0.9em; margin: 6px 0; }
.rep-kv dt { color: var(--ink-2); }
.rep-kv dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 480px) { .rep-kv { grid-template-columns: minmax(0, 1fr); } .rep-kv dd { margin-bottom: 4px; } }
.rep-item { padding: 12px 0; border-bottom: 1px solid var(--hair); min-width: 0; }
.rep-item h3 { font-size: 1rem; margin: 0 0 6px; }
.rep-n { font-family: var(--mono); color: var(--brand); }
.rep-sub { margin: 8px 0 0 12px; min-width: 0; }
.rep-sub h4 { font-size: 0.92em; margin: 6px 0 4px; }
.todo { font-size: 0.88em; color: var(--warn); font-style: italic; margin: 4px 0; }
.dtable.wide { min-width: 980px; }
.rep-annex { padding-top: 16px; }
.rep-annex h3 { font-size: 1.1rem; }


.method { margin-top: 28px; }
.disclaimer-notice { margin: 12px 0 0; font-size: 0.85em; color: var(--muted); }


@media print {
  .gate, .topbar, .footer, .hero-band, .utility, .step-nav, .inputs, .log-card, .method, .disclaimer, .review-notice, .no-print { display: none !important; }
  .op-report, .op-report[hidden] { display: block !important; border: 0; box-shadow: none; padding: 0; margin: 0; }
  .table-scroll { overflow: visible; }
  .dtable, .dtable.wide { min-width: 0; font-size: 8.5pt; }
  .rep-item, .rep-sub, .register > li { break-inside: avoid; }
  .terms { display: none; }
}

.rep-lang { display: inline-flex; gap: 6px; align-items: center; font-size: 0.88em; }
.rep-lang select { font: inherit; padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px; }
.sector-pick { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.sector-btn[aria-pressed="true"] { background: var(--text); color: #fff; border-color: var(--text); }
.good-row { border: 1px solid var(--hair); border-radius: 10px; padding: 8px 12px; margin: 8px 0; background: var(--surface); min-width: 0; }
.good-row .prow-head .u-h { margin: 0; }
.calc-row { margin-top: 6px; align-items: flex-end; }
.pfc-box { margin-top: 6px; min-width: 300px; }
.chp-box { margin-top: 12px; }
.operator-box { margin: 8px 0 12px; }
.f-checks { display: flex; flex-direction: column; gap: 6px; }
#routeSel[disabled] { opacity: 0.8; }
@media (max-width: 480px) {
  .topbar-inner { gap: 8px; }
  .topbar .brand-logo { height: 22px; }
  .topbar-right { min-width: 0; flex-shrink: 1; }
  .lang-pick select { max-width: 96px; }
}

/* Let explanatory text use the available card width. */
@media screen {
  .icard .hint,
  .icard .notes-list,
  .icard .note-box,
  .icard .grid-box,
  .icard .iea,
  .icard .dl-warn,
  .icard .interp-list li,
  .log-card .hint,
  .log-card .register > li {
    max-width: none;
  }
}
