/* Sebastian Melgaard Oversigt — Beyond Vision design (Inter + JetBrains Mono, Vision Green) */
:root {
  --green: #76BA1B;
  --green-text: #3D7210;
  --green-soft: rgba(118, 186, 27, 0.12);
  --cyan: #0A6F8A;
  --cyan-soft: rgba(0, 210, 255, 0.12);
  --danger: #E5484D;
  --danger-text: #C22A30;
  --danger-soft: rgba(229, 72, 77, 0.10);
  --yellow: #F5B800;
  --yellow-text: #8A6400;
  --yellow-soft: rgba(245, 184, 0, 0.14);
  --bg: #F4F6F3;
  --surface: #FFFFFF;
  --surface-2: #F5F7F4;
  --text: #0E0E0E;
  --text-muted: #5A6057;
  --border: #E6E9E3;
  --shadow: 0 18px 40px rgba(14, 20, 8, 0.07), 0 2px 8px rgba(14, 20, 8, 0.04);
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --green-text: #8FD724;
    --cyan: #4CC3E0;
    --danger-text: #FF6B70;
    --yellow-text: #F5C842;
    --bg: #050505;
    --surface: #111311;
    --surface-2: #181B17;
    --text: #F2F4F0;
    --text-muted: #9AA294;
    --border: #23271F;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-family: var(--font-ui); -webkit-font-smoothing: antialiased; }
main { max-width: 1240px; margin: 0 auto; padding: 40px 16px 64px; }
h1 { margin: 0; font-size: clamp(26px, 4vw, 40px); font-weight: 900; letter-spacing: -0.03em; line-height: 1.05; }
h1 span { color: var(--green); }
.sub { margin: 6px 0 0; color: var(--text-muted); font-size: 15px; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--text-muted); }
code { font-family: var(--font-mono); font-size: .9em; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 5px; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* ---------- Login ---------- */
#login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 24px; box-shadow: var(--shadow); padding: 32px 28px; display: flex; flex-direction: column; gap: 14px; }
.login-card .mark { width: 40px; height: 40px; color: var(--green); }
.login-card h1 { font-size: 28px; }
.login-card .sub { margin: -8px 0 6px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-muted); }
input { font: 15px var(--font-ui); color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px; }
input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.form-error { margin: 0; color: var(--danger-text); font-size: 14px; }
.form-error:empty { display: none; }
.btn { font: 600 15px var(--font-ui); border: 0; border-radius: 999px; padding: 12px 18px; cursor: pointer; }
.btn.primary { background: var(--green); color: #0A1400; }

/* ---------- Topbjælke ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--text-muted); }
.chip-btn { font: 600 13px var(--font-ui); color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 8px 14px; cursor: pointer; }
.chip-btn:hover { border-color: var(--green); }
.chip-btn[disabled] { opacity: .6; cursor: progress; }

/* ---------- Nøgletal ---------- */
.kpis { display: flex; flex-direction: column; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); margin-bottom: 18px; }
.kpi-row { display: grid; gap: 1px; }
.kpi-row.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi-row.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi-row.five .value { font-size: clamp(18px, 1.9vw, 24px); white-space: nowrap; }
.kpi { background: var(--surface); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi .label { font: 500 11px var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.kpi .value { font-size: 24px; font-weight: 900; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi .value.good { color: var(--green-text); }
.kpi .value.bad { color: var(--danger-text); }
.kpi .note { font-size: 12px; color: var(--text-muted); }

/* ---------- Advarsler ---------- */
.warnings { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.warn-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 12px; font-size: 14px; border: 1px solid transparent; }
.warn-item.danger { background: var(--danger-soft); color: var(--danger-text); border-color: rgba(229, 72, 77, .25); }
.warn-item.warn { background: var(--yellow-soft); color: var(--yellow-text); border-color: rgba(245, 184, 0, .3); }
.warn-item.info { background: var(--cyan-soft); color: var(--cyan); border-color: rgba(0, 210, 255, .25); }
.warn-item.ok { background: var(--green-soft); color: var(--green-text); }
.warn-item b { font-weight: 700; }

/* ---------- Sektioner ---------- */
.section-title { font-size: 20px; font-weight: 900; letter-spacing: -0.02em; margin: 34px 0 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sub-title { font-size: 15px; margin: 18px 0 8px; }
.section-sub { margin: -6px 0 12px; color: var(--text-muted); font-size: 14px; }
.title-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.title-row .section-sub { margin: 0 0 12px; }
.count { font: 500 12px var(--font-mono); color: var(--text-muted); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 3px 9px; letter-spacing: 0; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.grid { display: grid; gap: 14px; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
footer { margin-top: 40px; color: var(--text-muted); font-size: 13px; text-align: center; }
.empty { color: var(--text-muted); font-size: 14px; margin: 0; }

/* ---------- Status ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; font: 600 11px var(--font-ui); padding: 4px 9px; border-radius: 999px; white-space: nowrap; border: 1px solid var(--border); color: var(--text-muted); background: var(--surface-2); }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.up { color: var(--green-text); background: var(--green-soft); border-color: transparent; }
.pill.down { color: var(--danger-text); background: var(--danger-soft); border-color: transparent; }
.pill.warn { color: var(--yellow-text); background: var(--yellow-soft); border-color: transparent; }
.pill.new { color: var(--cyan); background: var(--cyan-soft); border-color: transparent; }
.pill.status { font-family: var(--font-mono); font-weight: 500; text-transform: uppercase; letter-spacing: .05em; font-size: 10px; }
.live-dot::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--green); margin-right: 6px; vertical-align: 1px; }

/* ---------- Brugt af ---------- */
.usage { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 18px 22px; }
.usage .stat b { display: block; font-size: 28px; font-weight: 900; letter-spacing: -0.02em; color: var(--green-text); font-variant-numeric: tabular-nums; line-height: 1.1; }
.usage .stat span { font-size: 13px; color: var(--text-muted); }
.usage .stat small { display: block; font: 500 10.5px var(--font-mono); color: var(--text-muted); margin-top: 2px; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- Filtre ---------- */
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font: 600 12px var(--font-ui); border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); border-radius: 999px; padding: 6px 11px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.filters input { padding: 7px 12px; font-size: 13px; border-radius: 999px; min-width: 0; width: 200px; }

/* ---------- Produkter ---------- */
.products { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); padding: 18px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card.is-down { border-color: rgba(229, 72, 77, .45); }
.card-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.card-head h3 { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -0.01em; }
.card-head .cat { font: 500 10.5px var(--font-mono); color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; display: block; margin-bottom: 3px; }
.card p.desc { margin: 0; font-size: 14px; color: var(--text-muted); line-height: 1.5; }
.stats { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.stats li { font-size: 12.5px; padding: 4px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.stats li b { font-variant-numeric: tabular-nums; }
.stats li span { color: var(--text-muted); }
.stats.live li { border-color: rgba(118, 186, 27, .35); }
.hosts { display: flex; flex-direction: column; gap: 6px; }
.host { display: flex; align-items: center; gap: 8px; font-size: 13px; flex-wrap: wrap; }
.host a { font-family: var(--font-mono); font-size: 12.5px; text-decoration: none; border-bottom: 1px solid var(--border); }
.host a:hover { border-color: var(--green); }
.host .small { font-size: 12px; color: var(--text-muted); }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; border-top: 1px solid var(--border); padding-top: 10px; margin-top: auto; }
.facts div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.facts dt { font: 500 10px var(--font-mono); text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); }
.facts dd { margin: 0; font-size: 13.5px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.dd-note { display: block; font-size: 11px; font-weight: 500; color: var(--text-muted); margin-top: 2px; }
.small-line { margin: 0; font-size: 12.5px; color: var(--text-muted); }
.links { display: flex; gap: 6px; flex-wrap: wrap; }
.links a, .links span { font: 600 12px var(--font-ui); text-decoration: none; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border); color: var(--text); }
.links span { color: var(--text-muted); }
.links a:hover { border-color: var(--green); }

/* ---------- Nye sider ---------- */
.sites-new { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.card.new { border-color: rgba(0, 210, 255, .45); }

/* ---------- Tabel over sider ---------- */
.table-wrap { padding: 0; overflow-x: auto; }
table.sites { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 1060px; }
.sites th, .sites td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.sites th { font: 500 10.5px var(--font-mono); text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); background: var(--surface-2); position: sticky; top: 0; cursor: pointer; user-select: none; white-space: nowrap; }
.sites th[aria-sort="ascending"]::after { content: " ↑"; }
.sites th[aria-sort="descending"]::after { content: " ↓"; }
.sites td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sites tr:last-child td { border-bottom: 0; }
.sites .h { font-family: var(--font-mono); font-size: 12.5px; font-weight: 500; text-decoration: none; }
.sites .h:hover { color: var(--green-text); }
.sites .t { display: block; color: var(--text-muted); font-size: 12px; margin-top: 2px; max-width: 280px; }
.sites .alias { display: block; color: var(--text-muted); font-size: 11px; font-family: var(--font-mono); }
.spark { display: block; }
.good { color: var(--green-text); }
.warnc { color: var(--yellow-text); }
.badc { color: var(--danger-text); }

/* ---------- Server og tjenester ---------- */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; margin: 0; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; }
.bar { height: 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; margin-top: 4px; }
.bar span { display: block; height: 100%; background: var(--green); }
.bar.warn span { background: var(--yellow); }
.bar.bad span { background: var(--danger); }
.units { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.units li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; align-items: baseline; }
.units li:last-child { border-bottom: 0; }
.units .u { font-family: var(--font-mono); font-size: 12.5px; }
.units .d { color: var(--text-muted); font-size: 12px; display: block; }

/* ---------- Tidslinje, indtjening, person ---------- */
.tl { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--green-soft); display: flex; flex-direction: column; gap: 12px; }
.tl li { position: relative; font-size: 14px; }
.tl li::before { content: ""; position: absolute; left: -22px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--green); }
.tl .when { display: block; font: 500 11px var(--font-mono); color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.income { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.income td { padding: 7px 0; border-bottom: 1px solid var(--border); }
.income td:last-child { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.income tr.total td { font-weight: 800; border-bottom: 0; }
.person p { margin: 0 0 10px; font-size: 14px; line-height: 1.55; color: var(--text-muted); }
.person b { color: var(--text); }

@media (max-width: 860px) {
  .two { grid-template-columns: 1fr; }
  .kpi-row.four, .kpi-row.five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-row.five .kpi:last-child { grid-column: span 2; }
  .products, .sites-new { grid-template-columns: 1fr; }
  .filters input { width: 100%; }
  .filters { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
