/* Design sentence (approved 29 Sep 2026): graphite navigation and headings lead; warm paper background carries
   the content; copper is the single accent for actions; yellow/blue/grey appear ONLY as calculation meanings;
   system sans-serif, tabular numbers, dense tables. No external fonts or CDNs (LAN-only). */
:root {
  --graphite: #23272b; --graphite-2: #2e3338; --graphite-3: #3b4147; --on-graphite: #e9e4da; --on-graphite-dim: #a39c8f;
  --paper: #f4f0e7; --surface: #fffdf8; --line: #e1d9c8; --line-strong: #c9bfab;
  --ink: #1f2326; --muted: #6d6558; --copper: #a4552a; --copper-dark: #85441f; --copper-tint: #f3e3d6;
  --ok: #2f6b3f; --ok-bg: #e5f0e3; --bad: #a3322a; --bad-bg: #f6e1dd; --warn-bg: #fbf0d4;
  --c-input: #fff1a8; --c-input-line: #d9c25a; --c-default: #dce8f6; --c-default-line: #97b4d6;
  --c-const: #e7e4dd; --c-const-line: #c7c1b4;
  --radius: 6px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
       color: var(--ink); background: var(--paper); font-variant-numeric: tabular-nums; }
a { color: var(--copper); text-decoration: none; }
a:hover { color: var(--copper-dark); text-decoration: underline; }
h1, h2, h3 { color: var(--graphite); line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- shell */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--graphite); color: var(--on-graphite); display: flex; flex-direction: column;
        position: sticky; top: 0; height: 100vh; }
.brand { padding: 18px 18px 14px; border-bottom: 1px solid var(--graphite-3); }
.brand b { display: block; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: #fff; }
.brand span { font-size: 12px; color: var(--on-graphite-dim); }
.nav { padding: 10px 8px; flex: 1; overflow-y: auto; }
.nav .grp { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--on-graphite-dim);
            padding: 14px 10px 4px; }
.nav a { display: flex; justify-content: space-between; align-items: center; color: var(--on-graphite);
         padding: 7px 10px; border-radius: var(--radius); font-size: 13.5px; }
.nav a:hover { background: var(--graphite-2); text-decoration: none; color: #fff; }
.nav a.on { background: var(--graphite-3); color: #fff; box-shadow: inset 3px 0 0 var(--copper); }
.count { background: var(--copper); color: #fff; font-size: 11px; border-radius: 10px; padding: 1px 7px; }
.who { padding: 12px 18px; border-top: 1px solid var(--graphite-3); font-size: 12.5px; }
.who .role { display: inline-block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
             border: 1px solid var(--graphite-3); color: var(--on-graphite-dim); border-radius: 3px; padding: 0 5px; }
.who form { display: inline; }
.who button.link { color: var(--on-graphite-dim); }
.main { padding: 24px 28px 48px; max-width: 1360px; width: 100%; }
.topline { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px;
           flex-wrap: wrap; }
.crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }

/* ---------- surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.card + .card { margin-top: 14px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.tile { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
        padding: 14px 16px; color: var(--ink); }
.tile:hover { border-color: var(--copper); text-decoration: none; color: var(--ink); }
.tile b { display: block; color: var(--graphite); font-size: 14.5px; margin-bottom: 2px; }
.tile .n { font-size: 24px; font-weight: 650; color: var(--graphite); }
.tile.soon { opacity: .55; pointer-events: none; }

/* ---------- controls */
.btn, button.btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 13px; cursor: pointer;
       border-radius: var(--radius); padding: 7px 13px; border: 1px solid var(--copper); background: var(--copper);
       color: #fff; font-weight: 600; white-space: nowrap; }
.btn:hover { background: var(--copper-dark); border-color: var(--copper-dark); color: #fff; text-decoration: none; }
.btn.ghost { background: transparent; color: var(--graphite); border-color: var(--line-strong); font-weight: 500; }
.btn.ghost:hover { border-color: var(--graphite); color: var(--graphite); background: transparent; }
.btn.danger { background: transparent; color: var(--bad); border-color: #d7aaa4; font-weight: 500; }
.btn.danger:hover { background: var(--bad-bg); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
button.link { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; color: var(--copper); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--graphite); margin: 12px 0 4px; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=search], input[type=url], select, textarea {
  font: inherit; width: 100%; padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--copper-tint); border-color: var(--copper); }
textarea { min-height: 80px; resize: vertical; }
.hint { font-size: 12px; color: var(--muted); margin-top: 3px; }
.checks label { display: inline-flex; gap: 6px; align-items: center; font-weight: 400; margin: 4px 14px 4px 0; }
.form-narrow { max-width: 640px; }
.searchbar { display: flex; gap: 8px; }
.searchbar input { max-width: 420px; }

/* ---------- tables */
table.list { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line);
             border-radius: var(--radius); overflow: hidden; }
table.list th { text-align: left; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
                font-weight: 600; background: #f8f4ec; border-bottom: 1px solid var(--line); padding: 8px 10px; }
table.list td { border-bottom: 1px solid #efe8da; padding: 8px 10px; vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
table.list tr:hover td { background: #fbf7ef; }
.nowrap { white-space: nowrap; }
.tag { display: inline-block; font-size: 11px; border: 1px solid var(--line-strong); border-radius: 3px;
       padding: 0 6px; color: var(--muted); margin: 1px 3px 1px 0; background: #fff; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; border-radius: 3px; padding: 1px 7px;
         letter-spacing: .03em; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.pending { background: var(--warn-bg); color: #7a5a12; }
.badge.draft { background: var(--bad-bg); color: var(--bad); }
.badge.neutral { background: #eee9df; color: var(--muted); }

/* ---------- flash */
.flash { padding: 9px 12px; border-radius: var(--radius); margin-bottom: 12px; border: 1px solid; font-size: 13.5px; }
.flash.ok { background: var(--ok-bg); border-color: #b9d3b4; color: #22502f; }
.flash.error { background: var(--bad-bg); border-color: #e0b3ad; color: #7d231d; }
.banner { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; border-left: 4px solid; }
.banner.draft { background: var(--bad-bg); border-color: var(--bad); color: #6e1f19; }
.banner.info { background: #efe9dd; border-color: var(--graphite-3); }

/* ---------- calculation sheet */
.calc-layout { display: grid; grid-template-columns: 1fr 270px; gap: 18px; align-items: start; }
.summary { position: sticky; top: 16px; }
.summary .status { font-weight: 700; padding: 8px 10px; border-radius: var(--radius); margin-bottom: 10px; }
.summary .status.ok { background: var(--ok-bg); color: var(--ok); }
.summary .status.bad { background: var(--bad-bg); color: var(--bad); }
.summary dl { margin: 0; font-size: 13px; }
.summary dt { color: var(--muted); font-size: 12px; line-height: 1.3; }
.summary dd { margin: 1px 0 9px; font-weight: 650; color: var(--graphite); font-size: 15px; }
.summary .fails { margin: 8px 0 0; padding-left: 18px; color: var(--bad); font-size: 12.5px; }
.sec { margin-bottom: 16px; }
.sec h2 { display: flex; gap: 10px; align-items: baseline; }
.sec h2 .num { color: var(--copper); font-variant-numeric: tabular-nums; }
.sec .secnote { font-size: 12.5px; color: var(--muted); margin: -4px 0 6px; }
table.calc { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); }
table.calc th { text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
                background: #f8f4ec; border-bottom: 1px solid var(--line); padding: 6px 8px; font-weight: 600; }
table.calc td { border-bottom: 1px solid #efe8da; padding: 5px 8px; vertical-align: top; font-size: 13px; }
table.calc td.no { color: var(--muted); width: 44px; }
table.calc td.sym { width: 58px; font-style: italic; color: var(--graphite-3); }
table.calc td.val { width: 128px; text-align: right; font-weight: 600; }
table.calc td.unit { width: 64px; color: var(--muted); }
table.calc td.ref { width: 150px; font-size: 12px; color: var(--muted); }
table.calc .note { display: block; font-size: 11.8px; color: var(--muted); margin-top: 2px; }
table.calc td.val input, table.calc td.val select { text-align: right; padding: 4px 7px; font-weight: 600; }
tr.k-input td.val input, tr.k-input td.val select { background: var(--c-input); border-color: var(--c-input-line); }
tr.k-default td.val input, tr.k-default td.val select { background: var(--c-default); border-color: var(--c-default-line); }
tr.k-constant td.val span.v { display: block; background: var(--c-const); border: 1px solid var(--c-const-line);
                              border-radius: 4px; padding: 3px 8px; }
tr.k-calc td.val { color: var(--graphite); }
tr.is-output td { background: #fbf6ec; }
tr.is-output td.val { font-size: 14px; }
tr.has-error td.val { color: var(--bad); }
.err { display: block; font-size: 11.5px; color: var(--bad); font-weight: 500; text-align: right; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin: 6px 0 14px; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -3px; margin-right: 5px;
            border: 1px solid; }
.legend .i1 { background: var(--c-input); border-color: var(--c-input-line); }
.legend .i2 { background: var(--c-default); border-color: var(--c-default-line); }
.legend .i3 { background: var(--c-const); border-color: var(--c-const-line); }
.legend .i4 { background: var(--surface); border-color: var(--line-strong); }
details.method { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 16px; }
details.method summary { cursor: pointer; font-weight: 650; color: var(--graphite); }
details.method p { margin: 8px 0; font-size: 13.2px; max-width: 900px; }
.stickybar { position: sticky; bottom: 0; background: rgba(244,240,231,.96); border-top: 1px solid var(--line);
             padding: 10px 0; margin-top: 10px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- login */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-art { background: var(--graphite); color: var(--on-graphite); padding: 48px; display: flex; flex-direction: column;
             justify-content: space-between; }
.login-art b { letter-spacing: .14em; text-transform: uppercase; font-size: 13px; color: #fff; }
.login-art h1 { color: #fff; font-size: 30px; font-weight: 600; max-width: 420px; }
.login-art .rule { width: 56px; height: 3px; background: var(--copper); margin: 18px 0; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 32px; }
.login-form .card { width: 100%; max-width: 360px; }
.or { text-align: center; color: var(--muted); font-size: 12px; margin: 14px 0 8px; }

/* ---------- viewer */
.viewer { width: 100%; height: 78vh; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 6px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.diff-old { color: var(--muted); text-decoration: line-through; font-size: 12.5px; }

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .side { position: static; height: auto; }
  .nav { display: flex; flex-wrap: wrap; gap: 2px; flex: none; align-items: flex-start; align-content: flex-start; }
  .nav .grp { display: none; }
  .main { padding: 16px; }
  .calc-layout { grid-template-columns: 1fr; }
  .summary { position: static; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { padding: 28px; }
  table.calc td.ref, table.calc th.ref { display: none; }
}
@media print {
  .side, .stickybar, .no-print { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
}
/* same column grid in every section table */
table.calc { table-layout: fixed; }
table.calc th:nth-child(1) { width: 52px; } table.calc th:nth-child(3) { width: 64px; }
table.calc th:nth-child(4) { width: 132px; } table.calc th:nth-child(5) { width: 66px; }
table.calc th:nth-child(6) { width: 160px; }
table.calc td { overflow-wrap: anywhere; }
@media (max-width: 980px) { table.calc th:nth-child(6) { width: 0; } }

/* ---------- v0.2.0 */
/* Logo sentence (30 Sep 2026): the psychrometric-chart mark (logo C) leads at the top-left of the graphite
   navigation, 32 px, frame in paper with the copper process line secondary; the app name sits to its right;
   on the sign-in panel the mark is 96 px above the headline; the favicon is the mark on a graphite square. */
a.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; }
a.brand:hover { text-decoration: none; }
a.brand .logo { flex: none; }
.login-art .logo { display: block; margin-bottom: 18px; }
.tag.int { border-color: var(--line-strong); }
.tag.cli { border-color: var(--graphite-3); color: var(--graphite); font-weight: 600; }
.runhead { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 6px; }
.runhead .grow { flex: 1 1 320px; max-width: 520px; }
.runhead select { min-width: 150px; }
.metagrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; max-width: 760px; margin-bottom: 8px; }
.metagrid label { margin-top: 4px; }
.enter-default { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.tablewrap { overflow-x: auto; margin: 4px 0 8px; }
table.tgrid { border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); min-width: 100%; }
table.tgrid th { text-align: left; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
  background: #f6f1e7; border-bottom: 1px solid var(--line); padding: 6px 8px; vertical-align: bottom; }
table.tgrid th.num { text-align: right; }
table.tgrid th .u { display: block; text-transform: none; letter-spacing: 0; font-weight: 400; }
table.tgrid td { border-bottom: 1px solid #efe8da; padding: 4px 5px; font-size: 13px; vertical-align: top; text-align: right; }
table.tgrid td.no { color: var(--muted); text-align: left; width: 34px; }
table.tgrid td input, table.tgrid td select { padding: 3px 5px; min-width: 56px; width: 100%; text-align: right; font-weight: 600; }
table.tgrid td.k-input input, table.tgrid td.k-input select { background: var(--c-input); border-color: var(--c-input-line); }
table.tgrid td.k-default input, table.tgrid td.k-default select { background: var(--c-default); border-color: var(--c-default-line); }
table.tgrid td.k-constant { background: var(--c-const); }
table.tgrid td .err { display: block; text-align: right; max-width: 200px; margin-left: auto; }
table.tgrid td.has-error { background: var(--bad-bg); }
ol.refs { margin: 4px 0 0; padding-left: 22px; }
ol.refs li { margin: 3px 0; }
.refgroup { margin: 6px 0 10px; }
.checks.col label { display: flex; margin: 3px 0; }
label.pin { display: inline-flex; gap: 6px; align-items: center; font-weight: 400; margin: 0; }
.pinform { margin: 0; }
@media (max-width: 760px) { .metagrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
table.tgrid { width: 100%; }
table.tgrid td.t-text { text-align: left; }
table.tgrid td.t-text input, table.tgrid td.t-text select { text-align: left; }
table.tgrid td select { min-width: 140px; font-size: 12px; padding-left: 3px; padding-right: 2px; }
.widesel { margin-top: 6px; }
.widesel select { width: 100%; font-weight: 600; }
tr.k-input .widesel select { background: var(--c-input); border-color: var(--c-input-line); }
tr.k-default .widesel select { background: var(--c-default); border-color: var(--c-default-line); }

/* v0.3.0: zone IDs, multi-select of zones, rows with a failed check */
table.tgrid td .idv { font-weight: 700; color: var(--graphite); }
table.tgrid td .multi { display: flex; flex-direction: column; gap: 2px; text-align: left; min-width: 120px; }
table.tgrid td .multi label { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 12px; font-weight: 400;
  white-space: nowrap; color: var(--ink, inherit); text-transform: none; letter-spacing: 0; }
table.tgrid td .multi input[type=checkbox] { min-width: 0; width: 16px; height: 16px; margin: 0; padding: 0; }
table.tgrid tr.row-fail td { background-image: linear-gradient(var(--bad-bg), var(--bad-bg)); }
table.tgrid tr.row-fail td.no:first-child { box-shadow: inset 3px 0 0 var(--bad); color: var(--bad); font-weight: 700; }
table.calc tr.row-fail td { background: var(--bad-bg); }
table.tgrid td.t-text input[type=text] { min-width: 100px; text-align: left; }
.calc-layout > * { min-width: 0; }      /* wide tables scroll inside their frame instead of widening the page */
@media (max-width: 700px) {               /* phones: a calculation table scrolls sideways instead of crushing its text */
  .calc-layout .sec { overflow-x: auto; }
  .calc-layout table.calc { min-width: 600px; }
}

/* v0.4.0 code reader: the page leads; the toolbar is one compact row that stays on top */
.reader-bar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--paper); padding: 8px 0; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.reader-bar input[type=number] { width: 72px; padding: 4px 6px; }
.reader-bar .searchbar { margin-left: auto; }
.reader-bar .searchbar input { max-width: 260px; }
.reader-page { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px; text-align: center; }
.reader-page img { max-width: 100%; height: auto; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.reader-page.big { overflow-x: auto; text-align: left; }
.reader-page.big img { max-width: none; }
#hits .hit { display: block; padding: 4px 0; border-bottom: 1px solid var(--line); }
@media (max-width: 700px) { .reader-bar .searchbar { margin-left: 0; width: 100%; } .reader-bar .searchbar input { max-width: none; } }
