/* ---------------------------------------------------------------------------
   Omnivan – kundportal och admin

   The tokens are the same Nocturne values as apps/web/styles.css, so the two
   surfaces are recognisably one product. Trimmed to the roles these pages use.

   Inter is not loaded here. The website self-hosts it as a 48 kB woff2; putting
   a second copy inside the gw-api binary to style an internal table is not
   worth it, and the system stack is what the pages fall back to anyway.

   No inline styles anywhere: the CSP these pages send forbids them.
   --------------------------------------------------------------------------- */

:root {
  color-scheme: dark;

  --bg: #161826;
  --surface: #232532;
  --surface-2: #292b31;
  --text: #e9e9ed;
  --faint: #b2b6ca;
  --edge: color-mix(in srgb, #e9e9ed 22%, transparent);
  --accent: #9184d9;
  --accent-dim: #2b2741;

  /* The same three colours the website uses for the horizon: sunset, sea,
     forest. Alarm, calm and neutral, so the product speaks one language. */
  --warn: #e8926a;
  --good: #6ea8a8;
  --calm: #7d9a76;

  --radius: 10px;
  --gap: 16px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: #b3a8ea; }

/* --- Frame ---------------------------------------------------------------- */

.top {
  border-bottom: 1px solid var(--edge);
  background: var(--surface);
}
.top-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: var(--gap);
  flex-wrap: wrap;
}
.brand {
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand svg { display: block; }
.badge {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent);
}
nav { display: flex; gap: 14px; flex-wrap: wrap; }
nav a { color: var(--faint); text-decoration: none; font-size: 14px; }
nav a:hover { color: var(--text); }
nav a.on { color: var(--text); font-weight: 600; }
.spacer { flex: 1 1 auto; }

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 16px 64px;
}
.narrow { max-width: 460px; }

h1 { font-size: 24px; font-weight: 600; margin: 0 0 4px; }
h2 { font-size: 17px; font-weight: 600; margin: 32px 0 10px; }
.lede { color: var(--faint); margin: 0 0 24px; }

footer {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px 40px;
  color: var(--faint);
  font-size: 12px;
}

/* --- Messages ------------------------------------------------------------- */

.msg {
  border-radius: var(--radius);
  padding: 10px 14px;
  margin: 0 0 20px;
  border: 1px solid var(--edge);
  background: var(--surface);
}
.msg.ok { border-color: var(--calm); }
.msg.bad { border-color: var(--warn); }

/* --- Cards ---------------------------------------------------------------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--gap);
}
.card {
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: 16px;
  display: block;
  color: inherit;
  text-decoration: none;
}
a.card:hover { border-color: var(--accent); }
.card h3 { margin: 0 0 2px; font-size: 16px; font-weight: 600; }
.card .sub { color: var(--faint); font-size: 13px; margin: 0 0 12px; }

/* Numbers on the overview. */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--gap);
  margin-bottom: 28px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat .n { font-size: 26px; font-weight: 600; line-height: 1.1; }
.stat .k { color: var(--faint); font-size: 13px; }
.stat.alarm { border-color: var(--warn); }
.stat.alarm .n { color: var(--warn); }

/* --- State ---------------------------------------------------------------- */

.dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 7px;
  vertical-align: 1px;
  background: var(--faint);
}
.dot.up { background: var(--good); }
.dot.down { background: var(--warn); }
.dot.idle { background: var(--faint); }

.state { font-size: 13px; }
.state.down { color: var(--warn); }
.muted { color: var(--faint); }

/* --- Tables --------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--edge);
  white-space: nowrap;
}
th { color: var(--faint); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
tbody tr:hover { background: var(--surface); }
td.wrap { white-space: normal; }
tr.quiet td { color: var(--warn); }

code, .mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 13px;
}

/* --- Forms ---------------------------------------------------------------- */

form.stack { display: flex; flex-direction: column; gap: 14px; }
label { display: block; font-size: 13px; color: var(--faint); margin-bottom: 5px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--edge);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
input:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
input.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 18px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.check { display: flex; align-items: center; gap: 9px; color: var(--text); font-size: 14px; }
.check input { width: auto; }
.hint { color: var(--faint); font-size: 13px; margin: 4px 0 0; }

button, .button {
  font: inherit;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #171525;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
button:hover, .button:hover { background: #a396e6; color: #171525; }
button.ghost, .button.ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--edge);
}
button.ghost:hover, .button.ghost:hover { border-color: var(--accent); background: transparent; color: var(--text); }
button.danger { background: transparent; color: var(--warn); border-color: var(--warn); }
button.danger:hover { background: var(--warn); color: #171525; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* --- Claim code ----------------------------------------------------------- */

.claimbox {
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}
.claimcode {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 24px;
  letter-spacing: 0.1em;
  margin: 8px 0 16px;
  word-break: break-all;
}
.claimbox img {
  width: 220px;
  height: 220px;
  image-rendering: pixelated;
  background: #fff;
  padding: 10px;
  border-radius: 8px;
}

/* --- Readings ------------------------------------------------------------- */

.readings { list-style: none; margin: 0; padding: 0; }
.readings li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--edge);
}
.readings li:last-child { border-bottom: 0; }
.readings .v { font-variant-numeric: tabular-nums; }
.readings .stale { color: var(--warn); }

/* --- Light ---------------------------------------------------------------- */

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f3f5fe;
    --surface: #ffffff;
    --surface-2: #e4e7f5;
    --text: #1b1d26;
    --faint: #595d6c;
    --edge: color-mix(in srgb, #1b1d26 20%, transparent);
    --accent: #5d5294;
    --accent-dim: #e7e5fe;
    --warn: #a8502a;
    --good: #35706f;
    --calm: #4a6b43;
  }
  :root:not([data-theme="dark"]) button,
  :root:not([data-theme="dark"]) .button { color: #ffffff; }
  :root:not([data-theme="dark"]) button:hover,
  :root:not([data-theme="dark"]) .button:hover { background: #6d61a8; color: #ffffff; }
}
