:root {
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #232321;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --muted: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255,255,255,0.10);
  --accent: #3987e5;
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --info: #3987e5;
  --offline: #6b6a65;
  --crit-wash: rgba(208,59,59,0.14);
  --warn-wash: rgba(250,178,25,0.10);
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f1f0ec;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6f6d68;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11,11,11,0.10);
  --accent: #2a78d6;
  --offline: #a3a19b;
  --crit-wash: rgba(208,59,59,0.09);
  --warn-wash: rgba(250,178,25,0.12);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page); color: var(--ink); font: 14px/1.45 var(--font);
  font-variant-numeric: tabular-nums; min-height: 100vh;
}
button, input { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 17px; }
h2 { font-size: 15px; }
h3 { font-size: 13px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; margin: 22px 0 8px; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- top ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px; border-bottom: 1px solid var(--border); background: var(--surface);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { width: 26px; height: 26px; fill: none; stroke: var(--accent); stroke-width: 2; flex: none; }
.logo circle { fill: var(--good); stroke: none; }
.sub { font-size: 12px; color: var(--muted); }
.status-line { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); }
.live { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.live.ok .dot { background: var(--good); box-shadow: 0 0 0 3px rgba(12,163,12,.2); }
.live.bad .dot { background: var(--critical); }
.pill { padding: 2px 8px; border-radius: 999px; font-size: 12px; border: 1px solid var(--border); }
.pill.bad { color: var(--critical); border-color: var(--critical); }
.pill.mock { color: var(--warning); border-color: var(--warning); }
.icon-btn { background: none; border: 1px solid transparent; border-radius: 8px; padding: 6px; cursor: pointer; display: inline-flex; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.btn { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; cursor: pointer; }
.btn:hover { border-color: var(--ink-2); }
.settings { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--border); }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.check.small { font-size: 13px; color: var(--ink-2); }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; padding: 16px 20px 0; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; cursor: pointer; text-align: left; position: relative; overflow: hidden;
}
.kpi:hover { border-color: var(--ink-2); }
.kpi .label { font-size: 12px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 28px; font-weight: 600; line-height: 1.15; margin-top: 4px; }
.kpi .value small { font-size: 15px; color: var(--muted); font-weight: 500; }
.kpi .hint { font-size: 12px; color: var(--muted); }
.kpi.is-critical { border-color: var(--critical); background: linear-gradient(var(--crit-wash), var(--crit-wash)), var(--surface); }
.kpi.is-warning { border-color: var(--warning); }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: var(--alerts-w, 360px) minmax(0, 1fr); grid-template-areas: "alerts table"; gap: 16px; padding: 16px 20px 24px; align-items: start; }
.layout > .alerts-panel { grid-area: alerts; }
.layout > .servers-panel { grid-area: table; }
.layout > .sensors-panel { grid-area: sensors; }
.layout.has-sensors { grid-template-columns: var(--alerts-w, 340px) minmax(0, 1fr) var(--sensors-w, 280px); grid-template-areas: "alerts table sensors"; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.alerts-panel { position: sticky; top: 70px; max-height: calc(100vh - 86px); display: flex; flex-direction: column; }
.tabs { display: flex; gap: 2px; background: var(--surface-2); border-radius: 8px; padding: 2px; }
.tab { background: none; border: 0; padding: 4px 10px; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--ink-2); }
.tab.active { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--border); }
.count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--axis); font-size: 11px; text-align: center; color: var(--ink); }

/* ---------- alarmer ---------- */
.alert-list { overflow-y: auto; padding: 6px; }
.alert {
  display: grid; grid-template-columns: 4px 1fr auto; gap: 10px; padding: 10px 10px 10px 0;
  border-radius: 8px; align-items: start;
}
.alert + .alert { border-top: 1px solid var(--border); border-radius: 0; }
.alert .bar { align-self: stretch; border-radius: 0 3px 3px 0; background: var(--muted); }
.alert.critical .bar { background: var(--critical); }
.alert.warning .bar { background: var(--warning); }
.alert.info .bar { background: var(--info); }
.alert.snoozed { opacity: .55; }
.alert .who { font-weight: 600; cursor: pointer; }
.alert .who:hover { text-decoration: underline; }
.alert .msg { color: var(--ink-2); font-size: 13px; overflow-wrap: anywhere; }
.alert .when { font-size: 12px; color: var(--muted); margin-top: 2px; }
.alert .actions { display: flex; gap: 4px; }
.group-label { font-size: 12px; color: var(--muted); padding: 10px 10px 4px; display: flex; justify-content: space-between; cursor: pointer; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.empty .ok-big { display: block; font-size: 15px; color: var(--ink); margin-bottom: 4px; }

/* statusmærke: ikon + tekst, aldrig kun farve */
.sev { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.sev svg { width: 14px; height: 14px; flex: none; }
.sev.critical { color: var(--critical); }
.sev.warning { color: var(--warning); }
.sev.info { color: var(--info); }
.sev.ok { color: var(--good); }
.sev.offline { color: var(--muted); }
:root[data-theme="light"] .sev.warning { color: #9a6700; }

/* ---------- tabel ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
input[type=search] {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 5px 10px; width: 200px;
}
input[type=search]:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 2px; }
.seg button { background: none; border: 0; padding: 4px 9px; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--ink-2); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--border); }
.table-wrap { overflow-x: auto; }
table.servers { width: 100%; border-collapse: collapse; }
.servers th {
  text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 8px 10px;
  border-bottom: 1px solid var(--border); cursor: pointer; user-select: none; white-space: nowrap; position: sticky; top: 0; background: var(--surface);
}
.servers th.sorted { color: var(--ink); }
.servers th.sorted::after { content: " ↓"; }
.servers th.sorted.asc::after { content: " ↑"; }
.servers td { padding: 7px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
.servers tbody tr { cursor: pointer; }
.servers tbody tr:hover td { background: var(--surface-2); }
.servers tr.row-critical td { background: var(--crit-wash); }
.servers tr.row-warning td { background: var(--warn-wash); }
.servers tr.row-offline td { color: var(--muted); }
.num { text-align: right; }
.servers th.num { text-align: right; }
.name { font-weight: 600; }
.kind { font-size: 11px; color: var(--muted); margin-left: 6px; font-weight: 400; }
.tag { font-size: 11px; color: var(--ink-2); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; margin-left: 6px; font-weight: 400; }

.meter { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.meter .track { width: 64px; height: 6px; border-radius: 3px; background: var(--grid); overflow: hidden; }
.meter .fill { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.meter .fill.warning { background: var(--warning); }
.meter .fill.critical { background: var(--critical); }
.meter .track { flex: none; }
.meter .v { min-width: 44px; text-align: right; white-space: nowrap; }
.meter .v.wide { min-width: 7.2em; }
.meter .v.warning { color: var(--warning); font-weight: 600; }
.meter .v.critical { color: var(--critical); font-weight: 600; }
:root[data-theme="light"] .meter .v.warning { color: #9a6700; }
.dash { color: var(--muted); }
.foot { padding: 10px 14px; font-size: 12px; }

/* ---------- drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(720px, 100vw); z-index: 50;
  background: var(--surface); border-left: 1px solid var(--border);
  transform: translateX(100%); transition: transform .2s ease; display: flex;
}
.drawer.open { transform: none; }
.drawer-inner { display: flex; flex-direction: column; width: 100%; min-width: 0; }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.drawer-head h2 { font-size: 20px; margin: 2px 0; overflow-wrap: anywhere; }
.drawer-body { overflow-y: auto; padding: 4px 20px 32px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 16px; margin-top: 14px; }
.fact .k { font-size: 12px; color: var(--muted); }
.fact .v { font-weight: 500; overflow-wrap: anywhere; }
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chart { background: var(--page); border: 1px solid var(--border); border-radius: 8px; padding: 10px 10px 4px; }
.chart .ct { font-size: 12px; color: var(--ink-2); display: flex; justify-content: space-between; }
.chart .ct b { color: var(--ink); font-weight: 600; }
.chart svg { width: 100%; height: 120px; display: block; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--accent); opacity: .12; }
.chart .gl { stroke: var(--grid); stroke-width: 1; }
.chart .th { stroke-width: 1; stroke-dasharray: 3 3; }
.chart .th.warning { stroke: var(--warning); }
.chart .th.critical { stroke: var(--critical); }
.chart .ax { fill: var(--muted); font-size: 10px; }
.chart .cross { stroke: var(--ink-2); stroke-width: 1; }
.chart .dotm { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart .nodata { fill: var(--muted); font-size: 12px; }

.list { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; align-items: center; }
.li + .li { border-top: 1px solid var(--border); }
.li .l { min-width: 0; overflow-wrap: anywhere; }
.li .r { text-align: right; white-space: nowrap; }
.drive { display: grid; grid-template-columns: 34px 1fr 110px; gap: 10px; align-items: center; padding: 8px 12px; }
.drive + .drive { border-top: 1px solid var(--border); }
.drive .track { height: 8px; border-radius: 4px; background: var(--grid); overflow: hidden; }
.drive .fill { height: 100%; background: var(--accent); border-radius: 4px; }
.drive .fill.warning { background: var(--warning); }
.drive .fill.critical { background: var(--critical); }
.hist { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.hist span { font-size: 11px; padding: 1px 6px; border-radius: 4px; background: var(--surface-2); color: var(--ink-2); }
.svc-filter { margin-bottom: 8px; width: 100%; }
details.all-services summary { cursor: pointer; color: var(--ink-2); margin: 22px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 16px; font-size: 13px; }
.svc-grid div { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; border-bottom: 1px dashed var(--border); }
.svc-grid .bad { color: var(--critical); }
.svc-grid span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* ---------- tooltip / menu ---------- */
.tooltip {
  position: fixed; z-index: 60; pointer-events: none; background: var(--surface-2); color: var(--ink);
  border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; font-size: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.3);
}
.menu {
  position: fixed; z-index: 70; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 4px; box-shadow: 0 10px 30px rgba(0,0,0,.35); min-width: 160px;
}
.menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 6px 10px; border-radius: 6px; cursor: pointer; }
.menu button:hover { background: var(--surface); }
.menu .sep { height: 1px; background: var(--border); margin: 4px 0; }

/* ---------- responsivt ---------- */
@media (max-width: 1500px) {
  .hide-md { display: none; }
  .meter .track { width: 48px; }
}
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .alerts-panel { position: static; max-height: 420px; }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .topbar, .settings { padding-left: 16px; padding-right: 16px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px 16px 0; gap: 8px; }
  .kpi .value { font-size: 22px; }
  .kpi:last-child { grid-column: span 2; }
  .layout { padding: 12px 16px 20px; }
  .hide-sm { display: none; }
  .meter .track { display: none; }
  input[type=search] { width: 100%; }
  .toolbar { width: 100%; }
  .seg { overflow-x: auto; max-width: 100%; }
  .charts { grid-template-columns: 1fr; }
  .status-line #liveText { display: none; }
  .drawer-body, .drawer-head { padding-left: 16px; padding-right: 16px; }
}

/* ---------- push-indstillinger ---------- */
.small { font-size: 12px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.1); }
.btn:disabled { opacity: .6; cursor: default; }
.small-btn { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; }
.small-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.nopush { display: inline-flex; margin-left: 6px; color: var(--muted); vertical-align: -2px; }
.nopush svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
select, input[type=number], input[type=time], .modal input:not([type]), .push-sec input:not([type]), .add-row input {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px; min-width: 0; max-width: 100%;
}
select:focus, input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.modal { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.5); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modal-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; width: min(760px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.4); display: flex; flex-direction: column; max-height: calc(100vh - 80px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 4px 18px 18px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); }
.modal-foot .muted { margin-right: auto; font-size: 13px; }
.notice { margin-top: 14px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--warning); background: var(--warn-wash); font-size: 13px; }
.fs h3 { display: flex; align-items: center; gap: 8px; }
.switch-row { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; margin-bottom: 10px; }
.switch-row input { margin-top: 3px; }
.switch-row small { display: block; color: var(--muted); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 14px; align-items: end; margin-bottom: 6px; }
.form-grid > label:not(.check) { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); }
.form-grid.rules3 { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.with-unit { display: flex; align-items: center; gap: 6px; }
.with-unit input { width: 80px; }
.with-unit span { color: var(--muted); }
.lv-table { display: grid; gap: 6px; margin-bottom: 6px; }
.lv-head, .lv-row { display: grid; grid-template-columns: 80px minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.lv-head span { font-size: 12px; color: var(--muted); }
.lv-name { font-weight: 600; font-size: 13px; }
.rule-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px 14px; margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.chip { font-size: 11px; padding: 1px 7px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); color: var(--ink-2); }
.chip.off { color: var(--critical); border-color: var(--critical); }
.add-row { display: flex; gap: 8px; margin-top: 10px; }
.add-row input { flex: 1; }

.push-sec { margin-top: 22px; border: 1px solid var(--border); border-radius: 8px; }
.push-sec > summary { cursor: pointer; padding: 10px 12px; display: flex; justify-content: space-between; gap: 10px; align-items: center; list-style: none; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); font-weight: 600; }
.push-sec > summary::-webkit-details-marker { display: none; }
.push-sec > summary::before { content: "▸"; margin-right: 6px; }
.push-sec[open] > summary::before { content: "▾"; }
.push-sec > summary > span:first-child { margin-right: auto; }
.push-sec > summary .muted { text-transform: none; letter-spacing: 0; font-weight: 400; }
.push-body { padding: 4px 12px 12px; border-top: 1px solid var(--border); }
.sub-h { font-size: 12px; color: var(--muted); margin: 14px 0 6px; text-transform: uppercase; letter-spacing: .04em; }
.note-l { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); margin-top: 12px; }

@media (max-width: 640px) {
  .lv-head { display: none; }
  .lv-row { grid-template-columns: 1fr 1fr; }
  .lv-name { grid-column: 1 / -1; }
  .lv-test { grid-column: 1 / -1; }
  .small-btn span { display: none; }
  .modal { padding: 0; }
  .modal-card { max-height: 100vh; border-radius: 0; min-height: 100vh; }
}

/* ---------- kaldenavne / banner ---------- */
.realname { font-size: 11px; color: var(--muted); margin-left: 6px; }
.alias-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto auto; gap: 8px; align-items: end; margin-top: 16px; }
.alias-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); }
.alias-form input { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }
.banner { display: flex; align-items: center; gap: 10px; padding: 8px 20px; background: var(--warn-wash); border-bottom: 1px solid var(--warning); font-size: 13px; }
.banner a { color: var(--accent); }
.banner .icon-btn { margin-left: auto; }
a.btn, a.icon-btn { text-decoration: none; color: inherit; }
@media (max-width: 640px) { .alias-form { grid-template-columns: 1fr; } }

.mono-ip { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

/* ---------- storskærm (kun visning) ---------- */
body.kiosk #settingsBtn, body.kiosk #pushBtn, body.kiosk .alert .actions, body.kiosk [data-snooze],
body.kiosk #notifyBanner, body.kiosk .tabs .tab[data-tab="log"] { display: none !important; }
body.kiosk .kiosk-pill { display: inline-flex; }

/* ---------- popup ved nye alarmer ---------- */
.popups { position: fixed; top: 84px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 12px; width: min(720px, calc(100vw - 32px)); pointer-events: none; }
.popup {
  pointer-events: auto; position: relative; overflow: hidden; cursor: pointer;
  display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: start;
  padding: 18px 20px 22px; border-radius: 14px; color: #fff;
  box-shadow: 0 18px 50px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.15) inset;
  animation: popIn .35s cubic-bezier(.2,.9,.3,1.2);
}
.popup.critical { background: #d03b3b; animation: popIn .35s cubic-bezier(.2,.9,.3,1.2), popPulse 1.6s ease-in-out .35s 3; }
.popup.warning { background: #fab219; color: #1a1a19; }
.popup.info { background: #3987e5; }
.popup.out { animation: popOut .3s ease forwards; }
.pop-icon svg { width: clamp(32px, 3vw, 48px); height: clamp(32px, 3vw, 48px); }
.popup .pop-icon { color: #fff; }
.popup.warning .pop-icon { color: #1a1a19; }
.pop-sev { font-size: 13px; font-weight: 800; letter-spacing: .12em; opacity: .9; }
.pop-name { font-size: clamp(22px, 2.2vw, 34px); font-weight: 800; line-height: 1.15; margin-top: 2px; }
.pop-name span { font-size: .5em; font-weight: 600; opacity: .8; margin-left: 6px; }
.pop-msg { font-size: clamp(15px, 1.3vw, 20px); margin-top: 4px; }
.pop-time { font-size: 12px; opacity: .8; margin-top: 6px; }
.pop-x { background: rgba(0,0,0,.15); border: 0; color: inherit; font-size: 22px; line-height: 1; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; }
.pop-x:hover { background: rgba(0,0,0,.3); }
.pop-bar { position: absolute; left: 0; bottom: 0; height: 5px; width: 100%; background: rgba(255,255,255,.7); transform-origin: left; animation-name: popBar; animation-timing-function: linear; animation-fill-mode: forwards; }
.popup.warning .pop-bar { background: rgba(0,0,0,.45); }
.popup.paused .pop-bar { animation-play-state: paused; }
@keyframes popBar { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes popIn { from { opacity: 0; transform: translateY(-24px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes popOut { to { opacity: 0; transform: translateY(-16px) scale(.97); } }
@keyframes popPulse { 0%, 100% { box-shadow: 0 18px 50px rgba(0,0,0,.45), 0 0 0 0 rgba(208,59,59,.7); } 50% { box-shadow: 0 18px 50px rgba(0,0,0,.45), 0 0 0 14px rgba(208,59,59,0); } }
@media (prefers-reduced-motion: reduce) { .popup, .popup.critical, .popup.out { animation: none; } }
@media (max-width: 640px) { .popups { top: 64px; } .popup { padding: 14px 14px 18px; gap: 10px; } }
.popup.warning .pop-icon { --surface: #fab219; }
.popup.info .pop-icon { --surface: #3987e5; }

/* ---------- temperaturmålere ---------- */
.sensors-panel { position: sticky; top: 70px; max-height: calc(100vh - 86px); display: flex; flex-direction: column; }
.sensor-list { overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.sensor { text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px 10px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; }
.sensor:hover { border-color: var(--ink-2); }
.sensor::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--good); }
.sensor.warning::before { background: var(--warning); }
.sensor.critical::before { background: var(--critical); }
.sensor.critical { border-color: var(--critical); background: linear-gradient(var(--crit-wash), var(--crit-wash)), var(--surface); }
.sensor.warning { border-color: var(--warning); }
.sensor.stale { opacity: .7; }
.sensor.flash { box-shadow: 0 0 0 3px var(--accent); }
.s-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-size: 13px; color: var(--ink-2); }
.s-name { font-weight: 600; color: var(--ink); }
.s-main { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.s-temp { font-size: 30px; font-weight: 650; line-height: 1.1; }
.s-temp small { font-size: 15px; color: var(--muted); font-weight: 500; margin-left: 2px; }
.sensor.warning .s-temp { color: var(--warning); }
.sensor.critical .s-temp { color: var(--critical); }
:root[data-theme="light"] .sensor.warning .s-temp { color: #9a6700; }
.s-side { display: flex; flex-direction: column; align-items: flex-end; font-size: 12px; color: var(--ink-2); }
.s-side .bad { color: var(--critical); font-weight: 600; }
.s-chart svg { width: 100%; height: 44px; display: block; }
.sensor.open .s-chart svg { height: 140px; }
.s-chart .line { fill: none; stroke: var(--accent); stroke-width: 2; }
.s-chart .th { stroke-width: 1; stroke-dasharray: 3 3; }
.s-chart .th.warning { stroke: var(--warning); }
.s-chart .th.critical { stroke: var(--critical); }
.s-chart .ax { fill: var(--muted); font-size: 10px; }
.empty-chart { height: 20px; font-size: 12px; color: var(--muted); }
.s-foot { font-size: 12px; color: var(--muted); }
.s-foot .bad { color: var(--critical); }


.menu-check { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.menu-check:hover { background: var(--surface); }
/* 3 kolonner kun på brede skærme; ellers ryger temperatur ned under alarmerne */
@media (max-width: 1500px) {
  .layout.has-sensors { grid-template-columns: var(--alerts-w, 340px) minmax(0, 1fr); grid-template-rows: auto 1fr; grid-template-areas: "sensors table" "alerts table"; }
  .layout.has-sensors > .alerts-panel { position: relative; top: auto; max-height: 60vh; }
  .layout.has-sensors > .sensors-panel { position: relative; top: auto; max-height: none; }
}
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; grid-template-areas: "alerts" "table"; }
  .layout.has-sensors { grid-template-columns: 1fr; grid-template-areas: "sensors" "alerts" "table"; }
  .sensor-list { flex-direction: row; overflow-x: auto; }
  .sensor-list .sensor { min-width: 220px; }
}

/* ---------- justerbare bredder ---------- */
.panel-resize { position: absolute; top: 0; bottom: 0; width: 10px; cursor: col-resize; z-index: 5; touch-action: none; }
.alerts-panel .panel-resize { right: -13px; }
.sensors-panel .panel-resize { left: -13px; }
.panel-resize::after { content: ""; position: absolute; top: 50%; left: 4px; width: 2px; height: 40px; margin-top: -20px; border-radius: 2px; background: var(--axis); opacity: 0; transition: opacity .15s; }
.panel-resize:hover::after, .panel-resize.active::after { opacity: 1; background: var(--accent); }
body.resizing, body.resizing * { cursor: col-resize !important; user-select: none !important; }
.servers th { position: sticky; }
.col-resize { position: absolute; top: 0; right: 0; width: 8px; height: 100%; cursor: col-resize; z-index: 2; touch-action: none; }
.col-resize::after { content: ""; position: absolute; top: 25%; bottom: 25%; right: 0; width: 1px; background: var(--border); }
.col-resize:hover::after, .col-resize.active::after { background: var(--accent); width: 2px; }
table.servers.fixed { table-layout: fixed; }
table.servers.fixed td, table.servers.fixed th { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 980px) { .panel-resize { display: none; } }
@media (max-width: 1500px) { .sensors-panel .panel-resize { display: none; } }
table.servers.fixed .meter { display: flex; width: 100%; justify-content: flex-end; }
table.servers.fixed .meter .track { flex: 1 1 64px; max-width: 64px; min-width: 0; }
table.servers.fixed .meter .v { flex: none; }

/* ---------- tjek / ignoreret ---------- */
.check-row .name::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 7px; vertical-align: 1px; }
.ignored-list { opacity: .6; }
.ignored-list:hover { opacity: .9; }
.menu .danger-item { color: var(--critical); }
.chart .miss { stroke: var(--critical); stroke-width: 1; opacity: .5; }
.menu-check.pin { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 8px; }

/* ---------- brugermenu, tema og version ---------- */
.brand h1 .ver { font-size: 11px; font-weight: 500; color: var(--muted); text-decoration: none; margin-left: 4px; padding: 1px 6px; border: 1px solid var(--border); border-radius: 999px; vertical-align: 2px; }
.brand h1 .ver:hover { color: var(--ink); border-color: var(--ink-2); }
.theme-btn { color: var(--ink-2); }
.user-btn { display: inline-flex; align-items: center; gap: 8px; background: none; border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px 3px 3px; cursor: pointer; color: var(--ink); font-size: 13px; max-width: 200px; }
.user-btn:hover { background: var(--surface-2); }
.user-btn .un { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; flex: none; }
.avatar.lg { width: 36px; height: 36px; font-size: 13px; }
.user-menu { min-width: 250px; padding: 6px; }
.user-menu .um-head { display: flex; gap: 10px; align-items: center; padding: 6px 8px; }
.user-menu .um-label { font-size: 12px; color: var(--muted); padding: 2px 10px 4px; }
.user-menu .um-theme { display: flex; margin: 0 6px 4px; }
.user-menu .um-theme button { flex: 1; text-align: center; width: auto; }
.user-menu a { display: block; padding: 6px 10px; border-radius: 6px; color: var(--ink); text-decoration: none; }
.user-menu a:hover { background: var(--surface); }
.user-menu .um-foot { font-size: 11px; color: var(--muted); padding: 6px 10px 2px; border-top: 1px solid var(--border); margin-top: 4px; }
body.viewer #settingsBtn, body.viewer #pushBtn, body.viewer .tabs .tab[data-tab="log"] { display: none !important; }
@media (max-width: 760px) { .user-btn .un { display: none; } .user-btn { padding: 3px; } }
@media (max-width: 640px) { .brand h1 .ver { display: none; } }

/* certifikater i sidepanelet */
.cert-life { margin: 4px 0 16px; }
.cert-days { font-size: 14px; color: var(--ink-2); margin-bottom: 8px; }
.cert-days b { font-size: 28px; color: var(--ink); margin-right: 2px; }
.cert-days.warning b { color: var(--warning); } .cert-days.critical b { color: var(--critical); } .cert-days.ok b { color: var(--good); }
:root[data-theme="light"] .cert-days.warning b { color: #9a6700; }
.cert-bar { position: relative; height: 8px; border-radius: 4px; background: var(--surface-2); }
.cert-bar > span { display: block; height: 100%; border-radius: 4px; background: var(--good); }
.cert-bar > span.warning { background: var(--warning); } .cert-bar > span.critical { background: var(--critical); }
.cert-bar > i { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--warning); opacity: .8; }
.cert-bar > i.c { background: var(--critical); }
.cert-ends { display: flex; justify-content: space-between; margin-top: 5px; }
.san-list { display: flex; flex-wrap: wrap; gap: 5px; }
.san-list span { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; padding: 2px 7px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); }
.san-list span.on { color: var(--ink); box-shadow: 0 0 0 1px var(--accent) inset; }
.fp { margin-top: 10px; word-break: break-all; }
