:root {
  --bg: #f6f7f9; --card: #fff; --text: #1d2430; --muted: #687385; --line: #dde1e7;
  --accent: #2457c5; --ok: #1f7a4d; --warn: #9a6200; --err: #b42318;
  --ok-bg: #e7f5ee; --warn-bg: #fdf3e1; --err-bg: #fdecea; --info-bg: #e8effc;
  /* Grafikonok: két kategória-szín (validálva a kártya felületéhez), rács és tengely */
  --series-1: #2a78d6; --series-2: #eb6834; --grid: #e1e0d9; --axis: #c3c2b7; --axis-text: #6b6a66;
  --status-good: #0ca30c; --status-warn: #fab219; --status-crit: #d03b3b; --meter-track: #e4ecf8;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c; --card: #1c2027; --text: #e6e9ee; --muted: #9aa4b2; --line: #2e343e;
    --accent: #7aa2f7; --ok: #5cc596; --warn: #e3b25a; --err: #f28b82;
    --ok-bg: #16302a; --warn-bg: #352a14; --err-bg: #3a1d1b; --info-bg: #1b2740;
    --series-1: #3987e5; --series-2: #d95926; --grid: #2c2f36; --axis: #3a3f48; --axis-text: #9aa4b2;
    --meter-track: #26324a;
  }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); }
header.top { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; justify-content: space-between; padding: 12px 24px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; text-decoration: none; color: var(--text); }
/* A logó fehér alapon készült: sötét témában egy fehér, lekerekített alapon jelenik meg */
.logo { display: block; height: auto; background: #fff; border-radius: 6px; }
.logo { width: 105px; padding: 2px 6px; }

nav { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; }
nav a { text-decoration: none; }
main { max-width: 1200px; margin: 0 auto; padding: 16px 24px 48px; }
h1 { font-size: 1.5rem; margin: 8px 0 16px; }
h2 { font-size: 1.15rem; margin: 32px 0 12px; }
.card, fieldset { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin: 0 0 16px; }
.narrow { max-width: 440px; }
fieldset legend { font-weight: 600; padding: 0 6px; }
.settings { max-width: 720px; }
label { display: block; margin: 12px 0 4px; font-weight: 500; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
input, select { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); font: inherit; }
input[type=checkbox] { width: auto; }
select[multiple] { min-height: 220px; }
button { margin-top: 16px; padding: 9px 18px; border: 0; border-radius: 6px; background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
button.link { margin: 0; padding: 0; background: none; color: var(--accent); font-weight: 400; text-decoration: underline; }
button.link.danger { color: var(--err); }
button.danger:not(.link) { background: var(--err); }
a.danger { color: var(--err); }
.confirm-box .cancel { margin-left: 12px; }
button.secondary { background: none; color: var(--text); border: 1px solid var(--line); }
.danger-zone { max-width: 720px; border-color: var(--err); margin-top: 32px; }
.danger-zone h2 { margin-top: 0; color: var(--err); }
.confirm-box { max-width: 640px; border-color: var(--err); }
.confirm-box h2 { margin-top: 0; }
form.inline { display: inline; }
.row-form { display: flex; flex-wrap: wrap; gap: 0 12px; align-items: flex-end; }
.row-form label { flex: 1 1 200px; }
.row-form button { flex: 0 0 auto; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 16px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .85rem; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td.actions { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.nowrap { white-space: nowrap; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.err { background: var(--err-bg); color: var(--err); }
.badge.muted { background: var(--line); color: var(--muted); }
.flash { padding: 10px 14px; border-radius: 8px; margin: 0 0 16px; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.err { background: var(--err-bg); color: var(--err); }
.flash.info { background: var(--info-bg); }
.flash ul { margin: 0; padding-left: 18px; }
.error { color: var(--err); }
.muted, .hint { color: var(--muted); }
.hint { font-size: .9rem; margin: 8px 0 0; }
.center { text-align: center; }
img.qr { display: inline-block; background: #fff; padding: 8px; border-radius: 8px; }
code { font-size: .9em; }
code.secret { display: inline-block; padding: 2px 6px; background: var(--bg); border-radius: 4px; letter-spacing: .05em; }
.error-box pre { white-space: pre-wrap; background: var(--err-bg); padding: 10px; border-radius: 6px; max-height: 240px; overflow: auto; }
@media (max-width: 600px) { main, header.top { padding-left: 16px; padding-right: 16px; } }

/* --- Monitoring --- */
.filters { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: 0 0 8px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--card); }
.seg a { padding: 7px 14px; text-decoration: none; color: var(--text); border-right: 1px solid var(--line); font-size: .92rem; }
.seg a:last-child { border-right: 0; }
.seg a:hover { background: var(--bg); }
.seg a.active { background: var(--accent); color: var(--card); font-weight: 600; }
.inline-label { display: flex; gap: 8px; align-items: center; margin: 0; font-weight: 500; }
.inline-label select { width: auto; min-width: 200px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin: 0 0 16px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.tile-label { font-size: .85rem; color: var(--muted); }
.tile-value { font-size: 1.45rem; font-weight: 600; }
.tile-sub { font-size: .82rem; color: var(--muted); }
.meter { width: 100%; height: 8px; margin: 6px 0 2px; }
.meter-track { fill: var(--meter-track); }
.meter-fill.ok { fill: var(--series-1); }
.meter-fill.warn { fill: var(--status-warn); }
.meter-fill.crit { fill: var(--status-crit); }
.services { list-style: none; padding: 0; margin: 0 0 20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 16px; }
.services li { display: flex; gap: 8px; align-items: baseline; }
.svc-icon { display: inline-flex; width: 18px; height: 18px; border-radius: 50%; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; color: #fff; flex: none; transform: translateY(3px); }
.services li.ok .svc-icon { background: var(--status-good); }
.services li.bad .svc-icon { background: var(--status-crit); }
.services li.bad strong { color: var(--err); }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 16px; margin: 0 0 16px; }
.chart { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 14px 14px 8px; min-width: 0; }
.chart figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; align-items: baseline; margin: 0 0 6px; }
.chart-title { font-weight: 600; }
.chart-now { font-size: .88rem; color: var(--muted); }
.chart-now strong { color: var(--text); }
.legend { list-style: none; padding: 0; margin: 0 0 6px; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .88rem; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend strong { color: var(--text); }
.chart-plot { position: relative; }
.chart-svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.chart-svg:focus { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.chart-svg .grid { stroke: var(--grid); stroke-width: 1; }
.chart-svg .grid.base { stroke: var(--axis); }
.chart-svg .axis { fill: var(--axis-text); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart-svg .axis.empty { font-size: 13px; }
.chart-svg .ln, .legend .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ln.s1, .dot.s1, .hover-dot.s1 { stroke: var(--series-1); }
.ln.s2, .dot.s2, .hover-dot.s2 { stroke: var(--series-2); }
.dot.s1, .hover-dot.s1 { fill: var(--series-1); }
.dot.s2, .hover-dot.s2 { fill: var(--series-2); }
.hover-dot { stroke: var(--card) !important; stroke-width: 2; }
.area.s1 { fill: var(--series-1); fill-opacity: .1; stroke: none; }
.cross { stroke: var(--axis); stroke-width: 1; pointer-events: none; }
.chart-tip { position: absolute; pointer-events: none; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: .85rem; box-shadow: 0 4px 14px rgba(0,0,0,.12); white-space: nowrap; z-index: 2; }
.tip-time { color: var(--muted); margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 8px; }
.tip-key { display: inline-block; width: 12px; height: 2px; border-radius: 1px; }
.tip-key.s1 { background: var(--series-1); }
.tip-key.s2 { background: var(--series-2); }
.tip-name { color: var(--muted); }
.chart-table { margin-top: 6px; font-size: .88rem; }
.chart-table summary { cursor: pointer; color: var(--muted); }
.chart-table .table-wrap { max-height: 260px; overflow: auto; margin: 8px 0 4px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Aktív riasztások a monitoring oldal tetején */
.alert-box { border: 1px solid var(--warn); background: var(--warn-bg); color: var(--text); border-radius: 8px; padding: 12px 16px; margin: 0 0 16px; }
.alert-box strong { color: var(--warn); }
.alert-box ul { margin: 6px 0 0; padding-left: 20px; }
.alert-box li { margin: 2px 0; overflow-wrap: anywhere; }
.alert-box li.crit::marker { color: var(--err); }
.alert-box li.crit { font-weight: 600; }
.card-title { margin-top: 0; }
.actions-col { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.pfx-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pfx-form input { width: 230px; padding: 4px 8px; }
.config pre { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; overflow-x: auto; font-size: .85rem; }
.config h3 { font-size: 1rem; margin: 18px 0 6px; }
.card > p:first-child { margin-top: 0; }
