:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #17202b;
  --muted: #5d6a7a;
  --line: #e2e6eb;
  --accent: #1f5fa8;
  --accent-soft: #dfeaf7;
  --bar: #2f74c0;
  --green: #1f9d55;
  --amber: #d08a00;
  --red: #c62f2f;
  --radius: 10px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
code { background: #eef1f4; padding: 1px 5px; border-radius: 4px; font-size: 0.9em; }
h1 { font-size: 1.6rem; margin: 0.6rem 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 0.8rem; }
.muted { color: var(--muted); font-weight: normal; }
.small { font-size: 0.85em; color: var(--muted); word-break: break-word; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.top { background: var(--card); border-bottom: 1px solid var(--line); }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; flex-wrap: wrap; }
.brand { font-weight: 700; color: var(--text); text-decoration: none; }
.top nav { display: flex; gap: 16px; flex-wrap: wrap; }
.top nav a { color: var(--muted); text-decoration: none; font-weight: 500; }
.top nav a:hover { color: var(--text); }
main.wrap { padding-top: 16px; padding-bottom: 32px; }
.foot { color: var(--muted); font-size: 0.85em; padding-bottom: 24px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card.narrow { max-width: 440px; margin: 40px auto; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; }
.flash-success { background: #e3f5ea; color: #155d33; }
.flash-error { background: #fbe5e5; color: #8a1f1f; }
.flash-info { background: var(--accent-soft); color: #18406e; }

.form { display: flex; flex-direction: column; gap: 12px; }
.form.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: end; }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; font-size: 0.92em; }
input, select { font: inherit; padding: 8px 10px; border: 1px solid #c8cfd8; border-radius: 7px; background: #fff; width: 100%; }
input:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
button, .btn { font: inherit; font-weight: 600; background: var(--accent); color: #fff; border: 0; border-radius: 7px; padding: 9px 16px; cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .btn:hover { filter: brightness(1.08); }
.btn-danger { background: var(--red); }
details.danger { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
details.danger summary { cursor: pointer; color: var(--red); font-weight: 600; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.8em; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; }
.dot-green { background: var(--green); }
.dot-amber { background: var(--amber); }
.dot-red { background: var(--red); }
.dot-grey { background: #b5bdc7; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat span { display: block; color: var(--muted); font-size: 0.85em; }
.stat strong { font-size: 1.2rem; font-variant-numeric: tabular-nums; }

.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.row-between h2 { margin: 0; }
.tabs { display: flex; gap: 4px; background: #eef1f4; padding: 3px; border-radius: 8px; }
.tabs a { padding: 4px 12px; border-radius: 6px; text-decoration: none; color: var(--muted); font-weight: 500; font-size: 0.9em; }
.tabs a.on { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,0.08); }

.chart { width: 100%; height: auto; display: block; }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .bar { fill: var(--bar); }
.chart .bar:hover { fill: #1d5596; }
.chart .bar-empty { fill: #d5dbe2; }
.chart .lbl { font-size: 11px; fill: var(--muted); }
.chart .val { font-size: 11px; fill: var(--text); }

/* Admin: målere, boards, firmware */
.tabs-big { display: inline-flex; margin-bottom: 14px; flex-wrap: wrap; }
.tabs-big a { padding: 6px 14px; font-size: 0.95em; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.actions-cell form { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.actions-cell button { padding: 6px 10px; font-size: 0.88em; }
.btn-secondary { background: #e8ecf1; color: var(--text); }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.8em; font-weight: 600; background: #e8ecf1; color: var(--muted); }
.pill-ok { background: #e3f5ea; color: #155d33; }
.pill-warn { background: #fdf1d8; color: #7a5200; }
.mono { font-family: ui-monospace, Consolas, monospace; word-break: break-all; }
code.big { display: inline-block; font-size: 1.05em; padding: 8px 10px; word-break: break-all; user-select: all; }
.card.secret { border: 2px solid var(--amber); background: #fffaf0; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
label.check input { width: auto; }

/* Ejendomme */
.chip { display: inline-flex; flex-direction: column; padding: 4px 9px; margin: 2px 4px 2px 0; border-radius: 8px; background: var(--accent-soft); color: #18406e; text-decoration: none; font-size: 0.88em; font-weight: 600; }
.chip-sub { font-weight: 400; font-size: 0.9em; color: var(--muted); }
tr.row-shared td { background: #fafbfc; }
details.inline-edit summary { cursor: pointer; color: var(--accent); font-weight: 500; }
details.inline-edit[open] { min-width: 220px; }
.ok-text { color: var(--green); }
.warn-text { color: var(--red); }
