/* Gemensam stil för alla sidor (laddas före sidans egen <style>, som bara har specialregler).
   Färger som tokens med egna värden för mörkt läge – kontrastgranskade med axe (WCAG AA):
   --muted #6b7280 klarar 4.5:1 på ljusa ytor men inte på mörka → #9aa3b0 där; länkar likaså. */
:root {
  color-scheme: light dark;
  --bg: #f6f7f9; --ink: #1c2430; --muted: #6b7280; --surface: #fff; --line: #d7dce3;
  --head: #eef1f5; --field: #b8c0cc; --link: #2563eb; --accent: #2563eb; --accent-ink: #fff;
  --hover: #e2e7ee; --focus: #2563eb;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181f; --ink: #e8ebf0; --muted: #9aa3b0; --surface: #1b212b; --line: #323a47;
    --head: #232b37; --field: #475063; --link: #6ea8fe; --hover: #2b3542;
  }
}

* { box-sizing: border-box; }
body { font-family: system-ui, -apple-system, sans-serif; margin: 0; background: var(--bg); color: var(--ink); }
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 24px 16px 64px; }
h1 { font-size: 1.5rem; margin: 0 0 4px; }
.sub { color: var(--muted); margin: 0 0 20px; font-size: .95rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 20px; }
.empty, .hint { color: var(--muted); }

button { padding: 9px 18px; font-size: .95rem; border: none; border-radius: 8px; background: var(--accent); color: var(--accent-ink); cursor: pointer; }
button:disabled { background: #94a3b8; cursor: default; }
.ghost { background: none; border: 1px solid var(--line); border-radius: 8px; padding: 5px 12px; color: inherit; cursor: pointer; font-size: .88rem; text-decoration: none; display: inline-block; }
.ghost:hover { background: var(--hover); }
input[type=text], input[type=email], input[type=password] { padding: 9px 12px; font-size: .95rem; border: 1px solid var(--field); border-radius: 8px; background: transparent; color: inherit; }

/* ————— Toppmeny (renderas av app.js på de inloggade sidorna) ————— */
.topnav { background: var(--surface); border-bottom: 1px solid var(--line); }
.topnav-inner { max-width: 1080px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 6px 16px; flex-wrap: wrap; }
.topnav .brand { font-weight: 650; color: inherit; text-decoration: none; margin-right: 4px; white-space: nowrap; }
.topnav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; flex-wrap: wrap; }
.topnav ul a { display: block; padding: 6px 10px; border-radius: 7px; color: inherit; text-decoration: none; font-size: .92rem; }
.topnav ul a:hover { background: var(--hover); }
.topnav ul a[aria-current="page"] { background: var(--head); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
.topnav .who { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 0; font-size: .88rem; }
.topnav .who .mail { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 26ch; }
@media (max-width: 640px) {
  .topnav-inner { padding: 6px 12px; }
  .topnav .brand { display: none; }
  .topnav ul a { padding: 6px 8px; font-size: .88rem; }
  .topnav .who .mail { display: none; } /* e-postadressen syns i Logga ut-knappens titel */
  .wrap { padding-top: 16px; }
  h1 { font-size: 1.25rem; }
}
