/* Same palette and type as the prototype Željko saw: steel blue for the system, brass for
   highlights. Colours live in variables so a JUMAG re-skin changes only this block. */
:root {
  --bg: #f5f7f9; --surface: #fff; --ink: #15202b; --muted: #56636f; --line: #d5dde4;
  --steel: #1f5f8b; --steel-soft: #e3eef6; --brass: #b7791f; --brass-soft: #fbf1e0;
  --warn: #b4442f; --warn-soft: #fbe9e5; --ok: #2f7d4f;
  --gas: #b4442f; --water: #1f5f8b; --comp: #8a96a1;
  --f-display: "Archivo", "Arial Narrow", Arial, sans-serif;
  --f-body: "Source Sans 3", "Segoe UI", Arial, sans-serif;
  --f-mono: "IBM Plex Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.5 var(--f-body); }
h1, h2, h3 { font-family: var(--f-display); margin: 0; line-height: 1.2; }
h2 { font-size: 22px; } h3 { font-size: 16.5px; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.num, .v { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 14.5px; max-width: 75ch; }

.app { max-width: 1320px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; min-height: 100vh; display: flex; flex-direction: column; }
body.embedded .app { min-height: 0; border: 0; border-radius: 0; }
@media (min-width: 1360px) { body:not(.embedded) { padding: 24px 0; } body:not(.embedded) .app { min-height: 0; } }

.app-top { display: flex; flex-wrap: wrap; gap: 10px 16px; justify-content: space-between; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.brand { display: flex; flex-direction: column; }
.brand b { font-family: var(--f-display); font-size: 20px; }
.brand span { font-family: var(--f-mono); font-size: 12px; color: var(--muted); }
.tools { display: flex; gap: 8px; align-items: center; }
.lang { display: flex; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.lang button { border: 0; background: none; padding: 5px 10px; font-size: 13px; font-family: var(--f-mono); color: var(--muted); }
.lang button[aria-pressed="true"] { background: var(--steel); color: #fff; }
.btn { border: 1px solid var(--steel); color: var(--steel); background: var(--surface); padding: 7px 14px; border-radius: 4px; font-weight: 600; font-size: 15px; }
.btn.primary { background: var(--steel); color: #fff; }
.btn.ghost { border-color: var(--line); color: var(--muted); font-weight: 400; font-size: 14px; padding: 5px 10px; }
.btn:disabled { opacity: .4; cursor: default; }

.steps { display: flex; overflow-x: auto; border-bottom: 1px solid var(--line); }
.steps button { background: none; border: 0; border-bottom: 3px solid transparent; padding: 12px 16px; white-space: nowrap; color: var(--muted); font-size: 15.5px; display: flex; gap: 8px; align-items: baseline; }
.steps button .n { font-family: var(--f-mono); font-size: 12px; }
.steps button[aria-current="step"] { color: var(--ink); border-bottom-color: var(--steel); font-weight: 600; }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--bg); }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile span { font-size: 13.5px; color: var(--muted); line-height: 1.3; }
.tile b { font-family: var(--f-display); font-size: 26px; font-variant-numeric: tabular-nums; }
.tile small { font-size: 12.5px; color: var(--muted); }
.tile.hl { border: 2px solid var(--steel); padding: 9px 11px; background: var(--steel-soft); }
.tile.neg b { color: var(--warn); }
@media (max-width: 900px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.body { display: grid; grid-template-columns: 360px minmax(0, 1fr); flex: 1; }
.left { background: var(--bg); border-right: 1px solid var(--line); padding: 18px 20px; display: flex; flex-direction: column; gap: 18px; }
.right { padding: 20px 24px 28px; display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.body.full { grid-template-columns: minmax(0, 1fr); }
.body.full .left { display: none; }
@media (max-width: 1000px) { .body { grid-template-columns: minmax(0, 1fr); } .left { border-right: 0; border-bottom: 1px solid var(--line); } }

.grp { display: flex; flex-direction: column; gap: 10px; }
.grp + .grp { border-top: 1px solid var(--line); padding-top: 16px; }
.grp > h3 { font-size: 13px; font-family: var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--steel); font-weight: 500; }
.fld { display: grid; grid-template-columns: minmax(0, 1fr) 138px; gap: 2px 10px; align-items: center; }
.fld > label { font-size: 14.5px; line-height: 1.3; }
.fld .unit-in { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); }
.fld .unit-in:focus-within { border-color: var(--steel); }
.fld input, .fld select { width: 100%; min-width: 0; border: 0; background: none; padding: 6px 8px; font-family: var(--f-mono); font-size: 14px; text-align: right; }
.fld select { text-align: left; }
.fld input:focus, .fld select:focus { outline: none; }
.fld .u { font-size: 12px; color: var(--muted); padding-right: 8px; white-space: nowrap; min-width: 44px; }
.fld small { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); }
.fld.bad .unit-in { border-color: var(--warn); }

.acc { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.acc button { text-align: left; display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 2px 10px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--surface); }
.acc .box { grid-row: span 3; width: 18px; height: 18px; border: 2px solid var(--muted); border-radius: 4px; margin-top: 2px; display: grid; place-items: center; }
.acc button[aria-pressed="true"] { border: 2px solid var(--steel); padding: 9px 11px; background: var(--steel-soft); }
.acc button[aria-pressed="true"] .box { background: var(--steel); border-color: var(--steel); }
.acc button[aria-pressed="true"] .box::after { content: ""; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }
.acc b { font-size: 14.5px; line-height: 1.3; }
.acc span { font-size: 13px; color: var(--muted); line-height: 1.35; }
.acc .val { font-family: var(--f-mono); font-size: 12.5px; color: var(--muted); }
.acc button[aria-pressed="true"] .val { color: var(--steel); font-weight: 500; }
.acc button:disabled { opacity: .5; cursor: default; }

table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
td.v, th.v { text-align: right; white-space: nowrap; }
tr.tot td { font-weight: 700; border-top: 2px solid var(--ink); }
tr.off td { color: var(--muted); }
tr.sub td { color: var(--muted); font-size: 13.5px; }
.scroll { overflow-x: auto; }
.cell-in { width: 110px; border: 1px solid var(--line); border-radius: 4px; padding: 4px 6px; font-family: var(--f-mono); font-size: 13.5px; text-align: right; background: var(--surface); }
.cell-in:focus { outline: none; border-color: var(--steel); }

.card { border: 1px solid var(--line); border-radius: 8px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.kv { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; font-size: 14.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; text-align: right; font-family: var(--f-mono); }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 800px) { .two { grid-template-columns: minmax(0, 1fr); } }

.bars { display: flex; flex-direction: column; gap: 8px; }
.bar { display: grid; grid-template-columns: 170px minmax(0, 1fr) 110px; gap: 10px; align-items: center; font-size: 14px; }
.bar .track { height: 16px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.bar .track i { display: block; height: 100%; background: var(--steel); }
.bar .track i.c { background: var(--comp); }
.bar b { text-align: right; font-family: var(--f-mono); font-weight: 500; }
@media (max-width: 600px) { .bar { grid-template-columns: 110px minmax(0, 1fr) 90px; } }

.chain { display: flex; flex-wrap: wrap; align-items: stretch; gap: 6px; }
.node { border: 1px solid var(--line); border-left: 4px solid var(--steel); border-radius: 6px; padding: 7px 10px; background: var(--surface); display: flex; flex-direction: column; min-width: 120px; max-width: 190px; }
.node.gas { border-left-color: var(--gas); }
.node.off { opacity: .45; border-left-color: var(--line); }
.node span { font-size: 12.5px; color: var(--muted); line-height: 1.25; }
.node b { font-family: var(--f-mono); font-size: 17px; font-weight: 500; }
.arrow { align-self: center; color: var(--muted); font-size: 18px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart text { font-family: var(--f-body); fill: var(--muted); font-size: 12px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 3px; vertical-align: middle; margin-right: 6px; }

.note { font-size: 14px; background: var(--brass-soft); border-left: 3px solid var(--brass); padding: 8px 12px; border-radius: 0 4px 4px 0; }
.note.warn { background: var(--warn-soft); border-left-color: var(--warn); }

.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; max-width: 760px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 14.5px; }
.form label.wide { grid-column: 1 / -1; }
.form input, .form select, .form textarea { border: 1px solid var(--line); border-radius: 4px; padding: 7px 9px; background: var(--surface); }
.form textarea { min-height: 80px; resize: vertical; }
.form .check { flex-direction: row; gap: 8px; align-items: baseline; }
@media (max-width: 600px) { .form { grid-template-columns: minmax(0, 1fr); } }
pre.summary { white-space: pre-wrap; font-family: var(--f-mono); font-size: 12.5px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 12px; margin: 0; }

.app-nav { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 20px; border-top: 1px solid var(--line); }
.disc { font-size: 12.5px; color: var(--muted); text-align: center; max-width: 70ch; }
.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 4px; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.on { opacity: 1; }

@media print {
  body { background: #fff; font-size: 12px; }
  .app { border: 0; max-width: none; }
  .steps, .tools, .app-nav button, .left, #form-wrap { display: none !important; }
  .body { grid-template-columns: minmax(0, 1fr); }
  .print-all .page-print { break-before: page; }
  .tiles { background: #fff; }
  @page { size: A4; margin: 14mm; }
}
@media (max-width: 600px) { .cell-in { width: 84px; } .card { padding: 12px; } .right { padding: 16px 14px 24px; } .left { padding: 16px 14px; } }
