/* Nøkkelportal. The design profile follows Øwre-Johnsen's Driveby app: navy
   titles and primary buttons, white cards with large radii and soft shadows,
   pill-shaped chips, light blue information boxes, green confirmations, and
   small uppercase labels over sections. System fonts only (no external
   fonts: the content security policy allows none). */

:root {
  --bg: #f3f5f8;
  --card: #ffffff;
  --ink: #0f1d2b;
  --muted: #5f6b7a;
  --line: #e3e8ee;
  --soft: #f5f7fa;
  /* Øwre-Johnsen navy, from the logo. */
  --accent: #0b436a;
  --accent-ink: #ffffff;
  --info: #1e5aa8;
  --info-bg: #eaf2fd;
  --ok: #138a52;
  --ok-bg: #e7f6ee;
  --warn: #c2410c;
  --warn-bg: #fff1e6;
  --bad: #b42318;
  --bad-bg: #fdecea;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(15, 29, 43, .04), 0 8px 24px rgba(15, 29, 43, .06);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }

/* ── Header ─────────────────────────────────────────────────────────────── */
header { background: var(--card); box-shadow: 0 1px 0 var(--line); }
header .wrap { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; }
header .logo { height: 24px; width: auto; display: block; }
header span { color: var(--muted); flex: 1; border-left: 1px solid var(--line); padding-left: 14px; font-size: 14px; }

/* main is also .wrap, whose padding would otherwise zero the top: hence main.wrap. */
main.wrap { padding-top: 44px; padding-bottom: 24px; }
footer { color: var(--muted); font-size: 14px; padding-bottom: 32px; }

/* ── Type ───────────────────────────────────────────────────────────────── */
h1 { font-size: 30px; line-height: 1.15; font-weight: 800; letter-spacing: -0.02em; color: var(--accent); margin: 0 0 8px; }
h2 { font-size: 19px; line-height: 1.25; font-weight: 750; letter-spacing: -0.01em; margin: 0 0 8px; }
h2.gap { margin-top: 24px; }
p { margin: 0 0 12px; }
a { color: var(--accent); font-weight: 600; }
.lead { font-size: 17px; color: var(--muted); margin: 0 0 4px; }
.meta { font-size: 14px; color: var(--muted); margin: 0 0 4px; }
.hint { font-size: 14px; color: var(--muted); margin: 6px 0 0; }
.muted { color: var(--muted); }
/* The small uppercase label over a section ("DRIVE COMPLETE" in Driveby). */
.eyebrow { font-size: 12px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.eyebrow.ok { color: var(--ok); }
.eyebrow.ok::before { content: "✓ "; }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-bottom: 16px; }
.card hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.card > .msg { margin-top: 12px; }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.field { margin-bottom: 4px; }
label { display: block; font-weight: 650; margin: 14px 0 6px; }
input, textarea { width: 100%; padding: 12px 14px; font: inherit; font-size: 16px; /* below 16px iOS zooms in */
  color: var(--ink); background: var(--card); border: 1px solid #d5dce4; border-radius: var(--radius-sm); }
textarea { min-height: 112px; font-family: var(--mono); }
input::placeholder, textarea::placeholder { color: #9aa5b1; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(11, 67, 106, .15); }
textarea[aria-invalid="true"] { border-color: var(--bad); }
input#code { font-family: var(--mono); font-size: 22px; letter-spacing: .3em; max-width: 14ch; text-align: center; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
button { font: inherit; font-weight: 700; padding: 12px 20px; min-height: 48px; border-radius: var(--radius-sm);
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); cursor: pointer; }
button:hover { filter: brightness(1.08); }
button:focus-visible { outline: 3px solid rgba(11, 67, 106, .35); outline-offset: 2px; }
button.secondary { background: var(--card); color: var(--ink); border-color: #d5dce4; }
button.danger { background: var(--card); color: var(--bad); border-color: #f1b8b2; }
button.small { min-height: 36px; padding: 6px 12px; font-size: 14px; border-radius: 10px; }
button.wide { width: 100%; }
button.done { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-bg); }
button.link { background: none; border: 0; color: var(--accent); padding: 0; min-height: 0; text-decoration: underline; font-weight: 600; font-size: inherit; }
button.link.small { font-size: 14px; margin-top: 8px; }
button:disabled { opacity: .55; cursor: default; filter: none; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 18px; }

/* ── Messages ───────────────────────────────────────────────────────────── */
.msg { margin-top: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--info-bg); color: var(--info); font-size: 15px; }
.msg.ok { background: var(--ok-bg); color: var(--ok); font-weight: 600; }
.msg.ok::before { content: "✓ "; }
.msg.bad { background: var(--bad-bg); color: var(--bad); }
.msg a { color: inherit; }

/* ── Choosing a path ────────────────────────────────────────────────────── */
.paths { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0; }
.path { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; padding: 16px 18px; min-height: 0;
  background: var(--card); color: var(--ink); border: 2px solid transparent; border-radius: var(--radius); box-shadow: var(--shadow); font-weight: 400; }
.path strong { font-size: 16px; font-weight: 750; }
.path span { font-size: 14px; color: var(--muted); }
.path[aria-pressed="true"] { border-color: var(--accent); }
.path:hover { filter: none; border-color: rgba(11, 67, 106, .45); }

ol.steps { list-style: none; counter-reset: s; padding: 0; margin: 0 0 4px; }
ol.steps li { counter-increment: s; position: relative; padding-left: 36px; margin-bottom: 12px; }
ol.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 750; display: grid; place-items: center; }

/* E-post / SMS as a segmented control. */
fieldset.choice { border: 0; padding: 0; margin: 14px 0 0; }
fieldset.choice legend { font-weight: 650; padding: 0; margin-bottom: 6px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: #e9edf2; border-radius: var(--radius-sm); padding: 4px; }
.segmented label.radio { margin: 0; position: relative; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented span { display: block; text-align: center; padding: 10px; border-radius: 9px; font-weight: 650; color: var(--muted); cursor: pointer; }
.segmented input:checked + span { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(15, 29, 43, .12); }
.segmented input:focus-visible + span { outline: 3px solid rgba(11, 67, 106, .35); }

/* ── Meters and orders ──────────────────────────────────────────────────── */
.search-row { display: flex; gap: 10px; align-items: flex-start; }
.search-row .field { flex: 1; }
.search-row > button { margin-top: 37px; }

.meter-card .serial { font-family: var(--mono); font-size: 24px; letter-spacing: .02em; margin-bottom: 2px; }

.key { background: var(--soft); border-radius: var(--radius-sm); padding: 6px 14px; margin-top: 12px; }
.key-line { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; align-items: center; padding: 8px 0; }
.key-line + .key-line { border-top: 1px solid var(--line); }
.key-label { font-size: 12px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.key code { font-family: var(--mono); font-size: 17px; font-weight: 600; letter-spacing: .03em; overflow-wrap: anywhere; color: var(--ink); }

.deliveries { display: flex; flex-direction: column; }
.delivery { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.delivery:first-child { border-top: 0; }
.delivery .meta { margin: 2px 0 0; }
.deliveries > .card { margin: 8px 0; box-shadow: none; border: 1px solid var(--line); }

.order-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.order-head h2 { margin-bottom: 2px; }
table { width: 100%; border-collapse: collapse; margin-top: 14px; }
th { text-align: left; font-size: 12px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 6px 8px; }
td { text-align: left; padding: 10px 8px; border-top: 1px solid var(--line); font-size: 15px; }
td.sn { font-family: var(--mono); overflow-wrap: anywhere; }
td.act { text-align: right; white-space: nowrap; }
tr.hit td { background: var(--info-bg); }
tr.key-row td { border-top: 0; padding-top: 0; }
tr.blocked td.sn, tr.blocked td.pn { color: var(--muted); text-decoration: line-through; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; background: var(--warn-bg); color: var(--warn); border-radius: 999px; padding: 3px 10px; }

.loading { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.spinner { width: 22px; height: 22px; flex: none; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

/* ── Help ───────────────────────────────────────────────────────────────── */
details summary { cursor: pointer; font-weight: 700; color: var(--accent); min-height: 32px; }
details ul { margin: 8px 0 0; padding-left: 20px; }
details li { margin-bottom: 6px; }
details.help { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; font-size: 15px; }
.access-offer { margin-top: 12px; padding: 14px 16px; background: var(--info-bg); border-radius: var(--radius-sm); }
.access-offer p { margin: 0 0 12px; color: var(--ink); }
.faq { margin: 8px 0 16px; }
.faq h2 { margin: 20px 0 10px; }
.faq-item { background: var(--card); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 12px 16px; margin-bottom: 8px; }
.faq-item p { margin: 8px 0 2px; }

/* About the site, at the foot of every page: the brand navy, smaller text. */
.about { background: var(--accent); color: #dfe8f0; border-radius: var(--radius); padding: 20px 22px; font-size: 14px; line-height: 1.55; margin-top: 8px; }
.about h2 { color: #fff; font-size: 15px; margin: 0 0 8px; }
.about p { margin: 0 0 8px; }
.about p:last-child { margin-bottom: 0; }
.about a { color: #fff; }

.install { margin-top: 14px; padding: 14px 16px; background: var(--card); border-radius: var(--radius-sm); box-shadow: var(--shadow); color: var(--ink); font-size: 15px; }
.install .row { margin-top: 10px; }

/* ── Phones ─────────────────────────────────────────────────────────────── */
@media (max-width: 520px) {
  .wrap { padding: 0 12px; }
  main.wrap { padding-top: 28px; }
  .card { padding: 18px 16px; }
  h1 { font-size: 25px; }
  header .logo { height: 21px; }
  header #logout { order: 2; margin-left: auto; }
  header span { order: 3; border-left: 0; padding-left: 0; flex: 1 1 100%; font-size: 13px; }
  .paths { grid-template-columns: 1fr; }
  .row > button { flex: 1 1 100%; }
  .order-head .row { width: 100%; }
  .order-head .row button { flex: 1; }
  .search-row { flex-direction: column; align-items: stretch; }
  .search-row > button { margin-top: 0; width: 100%; }
  .key-line { grid-template-columns: 1fr auto; }
  .key-label { grid-column: 1 / -1; }
  th.pn, td.pn { display: none; }
  td.act button + button { margin-top: 6px; }
}
