/* Manualportal – Sport Holding.
   Farger fra logoen (marine #002d59, rød #d0043c). Ingen eksterne fonter (NF-21).
   Tema: html[data-tema="lys"|"mork"] overstyrer systemvalget (N-02). */

:root {
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 12px;
  --wrap: 1120px;
  --header-h: 64px;
  --test-h: 0px;

  --bg: #ffffff;
  --bg-soft: #f3f6f9;
  --surface: #ffffff;
  --ink: #0d1b2a;
  --ink-2: #33475b;
  --muted: #56687a;
  --line: #d9e1e8;
  --brand: #002d59;
  --brand-ink: #ffffff;
  --brand-hover: #001f3f;
  --brand-tint: #e6eef7;
  --link: #00427f;
  --accent: #d0043c;
  --focus: #d0043c;
  --ok-bg: #e7f5ec;
  --ok-ink: #14532d;
  --feil-bg: #fdecef;
  --feil-ink: #8a0a2a;
  --info-bg: #fff5d6;
  --info-ink: #5c4300;
  --test-bg: #ffd84d;
  --test-ink: #1a1400;
  --shadow: 0 1px 2px rgba(13, 27, 42, .06), 0 6px 20px rgba(13, 27, 42, .06);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-tema="lys"]) {
    --bg: #0b1520;
    --bg-soft: #111e2b;
    --surface: #142334;
    --ink: #e8eef4;
    --ink-2: #c3cfdb;
    --muted: #9db0c2;
    --line: #2a3d52;
    --brand: #6fa8e6;
    --brand-ink: #0b1520;
    --brand-hover: #94c0ef;
    --brand-tint: #17304a;
    --link: #8fbdf0;
    --accent: #ff6b8b;
    --focus: #ffb3c4;
    --ok-bg: #12301f;
    --ok-ink: #a7e3bd;
    --feil-bg: #3a1420;
    --feil-ink: #ffc2cf;
    --info-bg: #362a05;
    --info-ink: #ffe28a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
:root[data-tema="mork"] {
  --bg: #0b1520;
  --bg-soft: #111e2b;
  --surface: #142334;
  --ink: #e8eef4;
  --ink-2: #c3cfdb;
  --muted: #9db0c2;
  --line: #2a3d52;
  --brand: #6fa8e6;
  --brand-ink: #0b1520;
  --brand-hover: #94c0ef;
  --brand-tint: #17304a;
  --link: #8fbdf0;
  --accent: #ff6b8b;
  --focus: #ffb3c4;
  --ok-bg: #12301f;
  --ok-ink: #a7e3bd;
  --feil-bg: #3a1420;
  --feil-ink: #ffc2cf;
  --info-bg: #362a05;
  --info-ink: #ffe28a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 1rem; line-height: 1.55;
  color: var(--ink); background: var(--bg); min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; }
img { max-width: 100%; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; color: var(--ink); }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.visuelt-skjult {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.hopp-til-innhold { position: absolute; left: 8px; top: -60px; z-index: 2000; background: var(--surface);
  padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); }
.hopp-til-innhold:focus { top: 8px; }
.dempet { color: var(--muted); }
.liten { font-size: .875rem; }
.ingen-skjerm { display: none; }
.mt { margin-top: 12px; }

/* --- Testmiljø-linje: sticky over alt annet, også headeren --- */
body.testmiljo { --test-h: 36px; }
.testlinje {
  position: sticky; top: 0; z-index: 1100; height: var(--test-h);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: repeating-linear-gradient(-45deg, var(--test-bg), var(--test-bg) 14px, #ffe27a 14px, #ffe27a 28px);
  color: var(--test-ink); font-weight: 700; font-size: .875rem; text-align: center; padding: 0 12px;
  border-bottom: 1px solid #b38f00;
}

/* --- Header --- */
.topp {
  position: sticky; top: var(--test-h); z-index: 1000; background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topp__rad { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--header-h); }
.logo { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }
.logo img { height: 22px; width: auto; display: block; }
.logo__mork { display: none !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-tema="lys"]) .logo__lys { display: none !important; }
  :root:not([data-tema="lys"]) .logo__mork { display: block !important; }
}
:root[data-tema="mork"] .logo__lys { display: none !important; }
:root[data-tema="mork"] .logo__mork { display: block !important; }
.logo__tekst { margin-left: 10px; padding-left: 10px; border-left: 1px solid var(--line); color: var(--muted);
  font-weight: 600; font-size: .95rem; white-space: nowrap; }
.topp__meny { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

/* Temaveksler */
.tema { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; background: var(--bg-soft); }
.tema button {
  border: 0; background: transparent; color: var(--ink-2); font: inherit; font-size: .8125rem; font-weight: 600;
  min-height: 36px; min-width: 44px; padding: 0 10px; border-radius: 999px; cursor: pointer;
}
.tema button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
@media (max-width: 520px) {
  .logo__tekst { display: none; }
  .tema button { padding: 0 8px; min-width: 40px; }
}

/* --- Knapper og skjema --- */
.knapp {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1.5px solid transparent;
  font: inherit; font-weight: 700; font-size: .95rem; text-decoration: none; cursor: pointer;
  background: var(--brand); color: var(--brand-ink);
}
.knapp:hover { background: var(--brand-hover); }
.knapp--sekundar { background: var(--surface); color: var(--ink); border-color: var(--line); }
.knapp--sekundar:hover { background: var(--bg-soft); border-color: var(--ink-2); }
.knapp--fare { background: var(--feil-bg); color: var(--feil-ink); border-color: var(--feil-ink); }
.knapp--fare:hover { background: var(--feil-ink); color: var(--feil-bg); }
.knapp--liten { min-height: 36px; padding: 0 12px; font-size: .85rem; }
.knapp:disabled { opacity: .5; cursor: not-allowed; }
.lenkeknapp { background: none; border: 0; padding: 0; font: inherit; color: var(--link); text-decoration: underline; cursor: pointer; min-height: 44px; }

label { display: block; font-weight: 600; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; min-height: 44px; padding: 8px 12px; font: inherit; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 8px;
}
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--brand); }
textarea { min-height: 72px; }
input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--brand); margin: 0; flex: none; }
.felt { margin-bottom: 16px; }
.felt .hjelp { font-size: .85rem; color: var(--muted); margin-top: 4px; }
.felt .feil, .feiltekst { color: var(--feil-ink); font-size: .9rem; margin-top: 4px; font-weight: 600; }
.avkryss { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; min-height: 44px; padding-top: 10px; }
.rutenett { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* --- Meldinger --- */
.melding { padding: 12px 16px; border-radius: 8px; margin: 0 0 16px; border-left: 4px solid; }
.melding--ok, .melding--success { background: var(--ok-bg); color: var(--ok-ink); }
.melding--feil, .melding--error { background: var(--feil-bg); color: var(--feil-ink); }
.melding--info, .melding--warning { background: var(--info-bg); color: var(--info-ink); }
.melding p:last-child { margin: 0; }

/* --- Offentlige sider --- */
.helt { background: var(--brand-tint); padding: 40px 0 32px; border-bottom: 1px solid var(--line); }
.helt p { color: var(--ink-2); max-width: 60ch; }
.sidenav { display: flex; gap: 8px; justify-content: center; margin-top: 20px; flex-wrap: wrap; align-items: center; }

/* Footer */
.bunn { background: var(--bg-soft); border-top: 1px solid var(--line); padding: 28px 0; font-size: .9rem; color: var(--ink-2); margin-top: 32px; }
.bunn__rad { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; align-items: center; }
.bunn img { height: 18px; width: auto; }
.bunn a { color: var(--link); }

/* --- Admin --- */
.admin .topp { background: var(--brand); border-bottom: 0; }
.admin .topp a, .admin .topp .logo__tekst { color: #fff; }
.admin .topp .logo__tekst { border-color: rgba(255,255,255,.35); }
.admin .topp .logo__lys { display: none !important; }
.admin .topp .logo__mork { display: block !important; }
.admin .topp .tema { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.3); }
.admin .topp .tema button { color: #fff; }
.admin .topp .tema button[aria-pressed="true"] { background: #fff; color: #002d59; }
:root[data-tema="mork"] .admin .topp { background: #08223f; }
@media (prefers-color-scheme: dark) { :root:not([data-tema="lys"]) .admin .topp { background: #08223f; } }
.adminmeny { background: var(--surface); border-bottom: 1px solid var(--line); }
.adminmeny ul { display: flex; gap: 2px; list-style: none; margin: 0; padding: 0; overflow-x: auto; }
.adminmeny a { display: inline-flex; align-items: center; min-height: 48px; padding: 0 14px; text-decoration: none; color: var(--ink-2); font-weight: 600; white-space: nowrap; border-bottom: 3px solid transparent; }
.adminmeny a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.adminmeny a:hover { color: var(--ink); background: var(--bg-soft); }
.side { padding-top: 24px; padding-bottom: 40px; }
.sidehode { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.sidehode h1 { margin: 0; }
.boks { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.boks > h2:first-child { margin-top: 0; }
.tabell-ramme { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .925rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--bg-soft); font-weight: 700; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.tall, th.tall { text-align: right; white-space: nowrap; }
.status { display: inline-block; border-radius: 999px; padding: 1px 10px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.status--publisert { background: var(--ok-bg); color: var(--ok-ink); }
.status--upublisert, .status--arkivert { background: var(--info-bg); color: var(--info-ink); }
.status--papirkurv { background: var(--feil-bg); color: var(--feil-ink); }
.filterrad { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 16px; }
.filterrad .felt { margin: 0; flex: 1 1 160px; }
.filterrad .felt--bred { flex: 2 1 260px; }
.knapperad { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.knapperad form { margin: 0; }
.slipp {
  border: 2px dashed var(--muted); border-radius: var(--radius); padding: 28px 16px; text-align: center; background: var(--bg-soft);
}
.slipp.aktiv { border-color: var(--brand); background: var(--brand-tint); }
.slipp input[type=file] { margin-top: 8px; max-width: 100%; }
.fremdrift { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 12px; }
.fremdrift > span { display: block; height: 100%; width: 0; background: var(--brand); transition: width .2s; }
.filinfo { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.kopier { display: flex; gap: 8px; }
.kopier input { font-family: ui-monospace, monospace; font-size: .9rem; }
.innlogging { max-width: 420px; margin: 48px auto; }
.passord { font-family: ui-monospace, monospace; font-size: 1.3rem; letter-spacing: .05em; padding: 12px 16px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px; user-select: all; }
.qr svg { width: 220px; height: 220px; background: #fff; padding: 8px; border-radius: 8px; }
.to-kol { display: grid; gap: 20px; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 900px) { .to-kol { grid-template-columns: 1fr; } }
dl.fakta { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.fakta dt { color: var(--muted); }
dl.fakta dd { margin: 0; overflow-wrap: anywhere; }

@media print {
  .testlinje, .topp, .bunn, .adminmeny { display: none; }
}
