/* Watermon – technikai adminisztrációs felület */
:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f6;
  --border: #dde3ea;
  --border-strong: #c5ced9;
  --text: #0f1b2a;
  --text-2: #4a5a6d;
  --text-3: #7a8899;
  --accent: #0b7fab;
  --accent-strong: #08668a;
  --accent-soft: #e2f3fa;
  --ok: #138a52;
  --ok-soft: #e3f5ec;
  --alarm: #c8312b;
  --alarm-soft: #fce9e8;
  --warn: #b26a00;
  --warn-soft: #fdf1dc;
  --off: #5b6b8c;
  --off-soft: #e9edf5;
  --band-ok: #b9e5cf;
  --band-alarm: #f4c4c1;
  --side-bg: #0d1622;
  --side-text: #b7c3d1;
  --side-text-strong: #ffffff;
  --side-hover: #172334;
  --side-active: #1c2c41;
  --focus: 0 0 0 3px rgba(11, 127, 171, .28);
  --radius: 8px;
  --radius-sm: 5px;
  --shadow: 0 1px 2px rgba(15, 27, 42, .06), 0 1px 1px rgba(15, 27, 42, .04);
  --shadow-lg: 0 10px 30px rgba(15, 27, 42, .12);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b121b; --surface: #121b27; --surface-2: #162130; --surface-3: #1c2939;
    --border: #243245; --border-strong: #31435a; --text: #e6edf5; --text-2: #a7b4c4; --text-3: #7b8a9c;
    --accent: #3fb3e0; --accent-strong: #6cc6ea; --accent-soft: #0f2c3b;
    --ok: #3cc985; --ok-soft: #0f2b20; --alarm: #ff6b63; --alarm-soft: #3a1717;
    --warn: #f0a83a; --warn-soft: #33250c; --off: #93a3c4; --off-soft: #1c2536;
    --band-ok: #1d4a35; --band-alarm: #5a2422;
    --side-bg: #080e16; --side-hover: #111b28; --side-active: #16243a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 10px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b121b; --surface: #121b27; --surface-2: #162130; --surface-3: #1c2939;
  --border: #243245; --border-strong: #31435a; --text: #e6edf5; --text-2: #a7b4c4; --text-3: #7b8a9c;
  --accent: #3fb3e0; --accent-strong: #6cc6ea; --accent-soft: #0f2c3b;
  --ok: #3cc985; --ok-soft: #0f2b20; --alarm: #ff6b63; --alarm-soft: #3a1717;
  --warn: #f0a83a; --warn-soft: #33250c; --off: #93a3c4; --off-soft: #1c2536;
  --band-ok: #1d4a35; --band-alarm: #5a2422;
  --side-bg: #080e16; --side-hover: #111b28; --side-active: #16243a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 10px 30px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 20px; }
h2 { font-size: 15px; }
h3 { font-size: 13px; }
p { margin: 0 0 .75em; }
code, .mono { font-family: var(--mono); font-size: .92em; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.ico.lg { width: 20px; height: 20px; }

/* ---------------------------------------------------------------- shell */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side-bg); color: var(--side-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: var(--side-text-strong); font-weight: 700; font-size: 16px; letter-spacing: .01em; }
.brand:hover { text-decoration: none; }
.brand img { width: 28px; height: 28px; }
.brand small { display: block; font-weight: 500; font-size: 11px; color: var(--side-text); letter-spacing: .04em; text-transform: uppercase; }
.nav { padding: 6px 10px 12px; }
.nav-label { padding: 14px 10px 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: #6f7f93; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px; color: var(--side-text); font-weight: 500; }
.nav a:hover { background: var(--side-hover); color: var(--side-text-strong); text-decoration: none; }
.nav a.is-active { background: var(--side-active); color: var(--side-text-strong); box-shadow: inset 2px 0 0 #3fb3e0; }
.nav a .count { margin-left: auto; font-size: 11px; font-family: var(--mono); padding: 0 6px; border-radius: 10px; background: #c8312b; color: #fff; }
.side-foot { margin-top: auto; padding: 12px 10px 16px; border-top: 1px solid #1a2636; }
.whoami { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #1f3550; color: #cfe7f5; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.whoami b { display: block; color: var(--side-text-strong); font-weight: 600; font-size: 13px; line-height: 1.2; }
.whoami span { font-size: 12px; color: #7f8fa3; }
.side-foot form { margin: 0; }
.side-foot button.linklike { width: 100%; }
.linklike { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px; color: var(--side-text); background: none; border: 0; font: inherit; font-weight: 500; cursor: pointer; text-align: left; }
.linklike:hover { background: var(--side-hover); color: var(--side-text-strong); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.topbar .crumbs { font-size: 12px; color: var(--text-3); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.topbar .crumbs a { color: var(--text-2); }
.topbar h1 { font-size: 18px; }
.topbar .spacer { flex: 1; }
.icon-btn.menu-btn { display: none; }
.content { padding: 20px 24px 40px; max-width: 1600px; width: 100%; }
.content.narrow { max-width: 980px; }

.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer; }
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }

/* ---------------------------------------------------------------- generic UI */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card, .card + .grid, .grid + .card, .stack > * + * { margin-top: 16px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card-head .spacer { flex: 1; }
.card-body { padding: 16px; }
.card-foot { padding: 12px 16px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.side-layout { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); align-items: start; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 7px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.btn:hover { border-color: var(--text-3); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .icon-btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.danger { color: var(--alarm); border-color: color-mix(in srgb, var(--alarm) 45%, var(--border)); }
.btn.danger:hover { background: var(--alarm-soft); }
.btn.danger.solid { background: var(--alarm); color: #fff; border-color: var(--alarm); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.sm { height: 28px; padding: 0 9px; font-size: 13px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 20px; font-size: 12px; font-weight: 600; line-height: 20px; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.alarm { background: var(--alarm-soft); color: var(--alarm); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.offline { background: var(--off-soft); color: var(--off); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.tag { display: inline-block; padding: 0 6px; border-radius: 4px; background: var(--surface-3); color: var(--text-2); font-size: 12px; line-height: 20px; margin: 1px 2px 1px 0; white-space: nowrap; }

.flash { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--radius); border: 1px solid; margin-bottom: 16px; }
.flash.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, transparent); color: var(--ok); }
.flash.error { background: var(--alarm-soft); border-color: color-mix(in srgb, var(--alarm) 35%, transparent); color: var(--alarm); }
.flash.info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--accent-strong); }
.flash p { margin: 0; color: var(--text); }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table.data th { position: sticky; top: 0; background: var(--surface-2); color: var(--text-2); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: var(--surface-2); }
table.data tr.row-link { cursor: pointer; }
table.data tr.is-muted td { color: var(--text-3); }
table.data td.actions { text-align: right; white-space: nowrap; }
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable::after { content: " ↕"; color: var(--text-3); font-size: 10px; }
table.data th[data-dir="asc"]::after { content: " ↑"; color: var(--accent); }
table.data th[data-dir="desc"]::after { content: " ↓"; color: var(--accent); }
.cell-title { font-weight: 600; color: var(--text); }
.cell-sub { font-size: 12px; color: var(--text-3); }
.empty { padding: 36px 16px; text-align: center; color: var(--text-3); }

/* ---------------------------------------------------------------- toolbar & forms */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
.search { position: relative; }
.search .ico { position: absolute; left: 10px; top: 9px; color: var(--text-3); }
.search input[type=search] { padding-left: 32px; width: 260px; }

input[type=text], input[type=password], input[type=email], input[type=date], input[type=number], input[type=search], select, textarea {
  height: 34px; padding: 0 10px; border-radius: 7px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; min-width: 0;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.45; }
select { padding-right: 28px; }
input.is-invalid, select.is-invalid, textarea.is-invalid { border-color: var(--alarm); }
input[readonly] { background: var(--surface-2); color: var(--text-2); }
.field-error { color: var(--alarm); font-size: 12.5px; margin: 4px 0 0; }

.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px 16px; }
.field { grid-column: span 6; display: flex; flex-direction: column; gap: 5px; }
.field.w3 { grid-column: span 3; } .field.w4 { grid-column: span 4; } .field.w8 { grid-column: span 8; } .field.w12 { grid-column: span 12; }
.field > label, .field > .label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .req { color: var(--alarm); margin-left: 2px; }
.field .hint { font-size: 12px; color: var(--text-3); }
.field input, .field select, .field textarea { width: 100%; }
.input-unit { display: flex; }
.input-unit input { border-radius: 7px 0 0 7px; }
.input-unit span { display: grid; place-items: center; padding: 0 10px; border: 1px solid var(--border-strong); border-left: 0; border-radius: 0 7px 7px 0; background: var(--surface-2); color: var(--text-2); font-size: 12.5px; white-space: nowrap; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.section-title { grid-column: 1 / -1; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding-top: 6px; border-top: 1px dashed var(--border); margin-top: 4px; }
.section-title:first-child { border-top: 0; padding-top: 0; margin-top: 0; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-weight: 500; }
.switch input { appearance: none; width: 36px; height: 20px; border-radius: 20px; background: var(--border-strong); position: relative; cursor: pointer; transition: background .15s; margin: 0; flex: none; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { transform: translateX(16px); }

.checklist { border: 1px solid var(--border); border-radius: 7px; background: var(--surface); }
.checklist .cl-head { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-bottom: 1px solid var(--border); background: var(--surface-2); border-radius: 7px 7px 0 0; }
.checklist .cl-head input { height: 28px; flex: 1; }
.checklist .cl-body { max-height: 260px; overflow-y: auto; padding: 4px; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.checklist label { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 5px; cursor: pointer; font-size: 13.5px; }
.checklist label:hover { background: var(--surface-2); }
.checklist label small { color: var(--text-3); }
.checklist input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--accent); flex: none; }
.checklist .cl-count { font-size: 12px; color: var(--text-3); white-space: nowrap; }

.rights { display: grid; gap: 8px; }
.right-opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 7px; cursor: pointer; }
.right-opt:hover { border-color: var(--border-strong); }
.right-opt input { margin-top: 3px; accent-color: var(--accent); }
.right-opt b { display: block; font-weight: 600; }
.right-opt span { font-size: 12.5px; color: var(--text-3); }
.right-opt.is-disabled { opacity: .55; cursor: not-allowed; }

.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 7px; overflow: hidden; background: var(--surface); }
.seg button, .seg a { border: 0; background: none; padding: 0 11px; height: 32px; font: inherit; font-size: 13px; color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; border-right: 1px solid var(--border); }
.seg > :last-child { border-right: 0; }
.seg .is-on { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }

.danger-zone { border-color: color-mix(in srgb, var(--alarm) 35%, var(--border)); }
.danger-zone .card-head { color: var(--alarm); }

dialog { border: 1px solid var(--border); border-radius: 10px; padding: 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); width: min(480px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(8, 14, 22, .55); }
dialog .card-head { border-radius: 10px 10px 0 0; }

/* ---------------------------------------------------------------- KPI */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); text-align: left; font: inherit; color: inherit; cursor: pointer; position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--kc, var(--accent)); }
.kpi:hover { border-color: var(--border-strong); }
.kpi.is-on { outline: 2px solid var(--kc, var(--accent)); outline-offset: -2px; }
.kpi .k-label { font-size: 12px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.kpi .k-value { font: 650 26px/1.1 var(--mono); margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi.ok { --kc: var(--ok); } .kpi.alarm { --kc: var(--alarm); } .kpi.warn { --kc: var(--warn); } .kpi.offline { --kc: var(--off); }
.kpi.ok .k-value { color: var(--ok); } .kpi.alarm .k-value { color: var(--alarm); } .kpi.warn .k-value { color: var(--warn); } .kpi.offline .k-value { color: var(--off); }

/* ---------------------------------------------------------------- dashboard */
.site-group { margin-bottom: 22px; }
.site-head { display: flex; align-items: baseline; gap: 10px; margin: 0 0 10px; }
.site-head h2 { font-size: 14px; }
.site-head .faint { font-size: 12px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px 12px 16px; position: relative; color: inherit; display: flex; flex-direction: column; gap: 8px; text-decoration: none !important; transition: border-color .12s, transform .12s; }
.tile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; border-radius: var(--radius) 0 0 var(--radius); background: var(--sc); }
.tile:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.tile.ok { --sc: var(--ok); } .tile.alarm { --sc: var(--alarm); } .tile.warn { --sc: var(--warn); } .tile.offline { --sc: var(--off); }
.tile.alarm { background: linear-gradient(0deg, var(--surface), var(--surface)) padding-box; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--alarm) 30%, transparent), var(--shadow); }
.tile-top { display: flex; align-items: flex-start; gap: 8px; }
.tile-name { font-weight: 650; line-height: 1.3; }
.tile-type { font-size: 12px; color: var(--text-3); }
.tile-top .badge { margin-left: auto; }
.tile-value { display: flex; align-items: baseline; gap: 6px; }
.tile-value b { font: 650 30px/1 var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.tile-value span { color: var(--text-2); font-size: 13px; }
.tile.offline .tile-value b { color: var(--text-3); }
.tile.alarm .tile-value b { color: var(--alarm); }
.tile-msg { font-size: 12.5px; color: var(--sc); font-weight: 550; }
.tile-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--text-3); border-top: 1px dashed var(--border); padding-top: 8px; }
.tile-meta span { display: inline-flex; align-items: center; gap: 4px; }

/* Lineáris skála: 4–20 mA tartomány, zöld sáv = riasztási határokon belül */
.scale { position: relative; height: 26px; }
.scale-track { position: absolute; left: 0; right: 0; top: 7px; height: 8px; border-radius: 4px; background: var(--band-alarm); overflow: hidden; }
.scale-band { position: absolute; top: 0; bottom: 0; background: var(--band-ok); }
.scale-marker { position: absolute; top: 2px; width: 3px; height: 18px; margin-left: -1.5px; border-radius: 2px; background: var(--text); box-shadow: 0 0 0 2px var(--surface); }
.tile.offline .scale-marker { background: var(--text-3); }
.scale-labels { position: absolute; left: 0; right: 0; top: 17px; display: flex; justify-content: space-between; font: 10.5px/1 var(--mono); color: var(--text-3); }
.scale-labels i { font-style: normal; position: absolute; transform: translateX(-50%); }

.dash-table td .scale { width: 160px; }
.refresh-state { font-size: 12px; color: var(--text-3); display: inline-flex; align-items: center; gap: 6px; }
.refresh-state .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.refresh-state.stale .dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }

/* ---------------------------------------------------------------- trend */
.range-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.range-bar label { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.chart-box { position: relative; min-height: 440px; }
.chart-box .u-legend { font-size: 12.5px; }
.chart-box .loading, .chart-box .nodata { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); }
.stat-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 1px solid var(--border); }
.stat { padding: 12px 16px; border-right: 1px solid var(--border); }
.stat:last-child { border-right: 0; }
.stat .s-label { font-size: 12px; color: var(--text-2); font-weight: 600; }
.stat .s-value { font: 600 16px/1.35 var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .s-sub { font-size: 12px; color: var(--text-3); font-family: var(--mono); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }
.u-select { background: color-mix(in srgb, var(--accent) 18%, transparent) !important; }
.uplot, .uplot * { font-family: var(--font); }
.u-axis { color: var(--text-2); }
.u-legend .u-marker { border-radius: 2px; }
.u-legend th, .u-legend td { color: var(--text-2); }

/* ---------------------------------------------------------------- availability */
.meter { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.meter-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.meter-bar i { display: block; height: 100%; background: var(--ok); }
.meter.bad .meter-bar i { background: var(--alarm); }

/* ---------------------------------------------------------------- log */
.log-table td { font-family: var(--mono); font-size: 12.5px; }

/* ---------------------------------------------------------------- public pages */
.pub { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.pub-nav { display: flex; align-items: center; gap: 16px; padding: 16px 32px; max-width: 1200px; width: 100%; margin: 0 auto; }
.pub-nav .brand { padding: 0; color: var(--text); }
.pub-nav .brand small { color: var(--text-3); }
.pub-nav .spacer { flex: 1; }
.pub-main { flex: 1; }
.pub-foot { border-top: 1px solid var(--border); padding: 18px 32px; color: var(--text-3); font-size: 12.5px; }
.pub-foot-in { max-width: 1200px; margin: 0 auto; display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.pub-foot-in .spacer { flex: 1; }

.hero { max-width: 1200px; margin: 0 auto; padding: 48px 32px 32px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 48px; align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 14px; }
.hero h1 { font-size: 40px; line-height: 1.1; letter-spacing: -.025em; margin-bottom: 16px; }
.hero h1 span { color: var(--accent); }
.hero p.lead { font-size: 16.5px; color: var(--text-2); max-width: 520px; margin-bottom: 24px; }
.hero .cta { display: flex; gap: 10px; flex-wrap: wrap; }
.hero .btn { height: 40px; padding: 0 18px; font-size: 14.5px; }
.hero-art { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); overflow: hidden; }
.hero-art svg { display: block; width: 100%; height: auto; }

.features { max-width: 1200px; margin: 0 auto; padding: 16px 32px 56px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.feature .f-ico { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 12px; }
.feature h3 { font-size: 14.5px; margin-bottom: 6px; }
.feature p { color: var(--text-2); margin: 0; font-size: 13.5px; }
.specs { max-width: 1200px; margin: 0 auto 56px; padding: 0 32px; }
.specs .card-body { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.spec b { display: block; font: 650 22px/1.2 var(--mono); }
.spec span { color: var(--text-2); font-size: 13px; }

.auth-wrap { display: grid; place-items: center; padding: 48px 16px; }
.auth { width: min(400px, 100%); }
.auth .card-body { padding: 24px; }
.auth h1 { font-size: 20px; margin-bottom: 4px; }
.auth .field { margin-bottom: 14px; }
.auth .btn { width: 100%; height: 40px; }

.prose { max-width: 820px; margin: 0 auto; padding: 32px; }
.prose h1 { font-size: 26px; margin-bottom: 18px; }
.prose h2 { font-size: 17px; margin: 28px 0 10px; }
.prose h3 { font-size: 14.5px; margin: 18px 0 8px; }
.prose p, .prose li { color: var(--text-2); line-height: 1.65; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .app.nav-open .side { transform: none; box-shadow: var(--shadow-lg); }
  .app.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(8, 14, 22, .45); z-index: 40; }
  .icon-btn.menu-btn { display: inline-grid; }
  .grid.cols-2, .grid.cols-3, .grid.side-layout { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; padding-top: 24px; }
  .features { grid-template-columns: 1fr 1fr; }
  .specs .card-body { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field, .field.w3, .field.w4, .field.w8 { grid-column: span 12; }
  .search input[type=search] { width: 100%; }
  .search { flex: 1 1 100%; }
  .features { grid-template-columns: 1fr; padding: 16px; }
  .hero { padding: 24px 16px; }
  .hero h1 { font-size: 30px; }
  .pub-nav, .pub-foot, .specs { padding-left: 16px; padding-right: 16px; }
  .prose { padding: 20px 16px; }
  .tiles { grid-template-columns: 1fr; }
}
@media print {
  .side, .topbar .actions, .toolbar, .menu-btn { display: none !important; }
  .app { display: block; }
  .card { box-shadow: none; }
}

/* Lista-navigáció kártyán belül (pl. a mérőhely többi műszere) */
.list-nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px; color: var(--text-2); }
.list-nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.list-nav a.is-active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
