/* EDB-på-123 AS – grunnstil */
:root {
  color-scheme: light;
  --navy: #0b1f3a;
  --navy-2: #14305a;
  --accent: #e0a526;
  --text: #1c2430;
  --muted: #5b6676;
  --bg: #ffffff;
  --bg-alt: #f3f5f8;
  /* Colours that change in dark mode (see the dark blocks below) */
  --surface: #ffffff;        /* cards, messages, tables */
  --strong: var(--navy);     /* navy used as text */
  --link: var(--navy-2);     /* links, link buttons, status text */
  --bar: var(--navy);        /* bars in the charts */
  --border: #dde2ea;
  --border-input: #c5ccd6;
  --line: #e3e7ee;
  --track: #e6eaf0;
  --faint: #9aa5b5;
  --danger: #b3261e;
  --danger-bg: #fdecea;
  --danger-text: #8c1d18;
  --ok: #2e7d32;
  --ok-bg: #e8f5e9;
  --ok-text: #1b5e20;
  --info-bg: #e8eef7;
  --warn-text: #8a5a00;
  --warn-bg: #fff8e6;
  --own-bg: #fff8e8;
  --bot: #6b4fbb;
  --bot-bg: #f6f3fd;
  --radius: 8px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Consolas", "Courier New", monospace;
}

/* Dark mode: follows the system unless the user has chosen light or dark
   (data-theme on <html>, see inc/theme.php). The two blocks must stay identical. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --navy: #132a4d; --navy-2: #1f4277; --bar: #8fb6ee; --text: #e3e8ef; --muted: #9ba7b9; --bg: #0e1522; --bg-alt: #151f31;
    --surface: #1b2639; --strong: #dbe5f5; --link: #8fb6ee; --border: #2b3850; --border-input: #3e4e6b;
    --line: #29364d; --track: #26324a; --faint: #6f7d94; --danger: #f28b82; --danger-bg: #3b1d1c;
    --danger-text: #f6b4ae; --ok: #81c995; --ok-bg: #16301e; --ok-text: #a8dbb3; --info-bg: #1a2a45;
    --warn-text: #e5b45a; --warn-bg: #2d2615; --own-bg: #2a2516; --bot: #b6a1f2; --bot-bg: #231d39;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --navy: #132a4d; --navy-2: #1f4277; --bar: #8fb6ee; --text: #e3e8ef; --muted: #9ba7b9; --bg: #0e1522; --bg-alt: #151f31;
  --surface: #1b2639; --strong: #dbe5f5; --link: #8fb6ee; --border: #2b3850; --border-input: #3e4e6b;
  --line: #29364d; --track: #26324a; --faint: #6f7d94; --danger: #f28b82; --danger-bg: #3b1d1c;
  --danger-text: #f6b4ae; --ok: #81c995; --ok-bg: #16301e; --ok-text: #a8dbb3; --info-bg: #1a2a45;
  --warn-text: #e5b45a; --warn-bg: #2d2615; --own-bg: #2a2516; --bot: #b6a1f2; --bot-bg: #231d39;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.6; }
h1, h2, h3 { line-height: 1.2; }
a { color: inherit; }

.container { width: min(1100px, 92%); margin-inline: auto; }
.narrow { width: min(640px, 92%); }
.muted { color: var(--muted); }

/* Header */
.site-header { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 10; }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 0.9rem 0; }
.logo { font-family: var(--mono); font-weight: 700; font-size: 1.3rem; text-decoration: none; }
.logo span { color: var(--accent); }
.logo small { font-size: 0.7em; opacity: 0.7; }
.nav { display: flex; gap: 1.5rem; }
.nav a { text-decoration: none; opacity: 0.85; }
.nav a:hover { opacity: 1; color: var(--accent); }
.nav-toggle { display: none; background: none; border: 1px solid #fff5; color: #fff; padding: 0.4rem 0.8rem; border-radius: var(--radius); }

/* Hero */
.hero { background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #fff; padding: 6rem 0; }
.eyebrow { font-family: var(--mono); color: var(--accent); text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.85rem; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.5rem); margin: 0.5rem 0 1rem; }
.lead { font-size: 1.2rem; max-width: 60ch; opacity: 0.9; }
.cta { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 2rem; }

.btn { display: inline-block; padding: 0.75rem 1.4rem; border-radius: var(--radius); font-weight: 600; text-decoration: none; border: 2px solid transparent; cursor: pointer; font-size: 1rem; transition: transform 0.15s, background 0.15s; }
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--accent); color: var(--navy); }
.btn-ghost { border-color: #fff8; color: #fff; }

/* Seksjoner */
.section { padding: 4.5rem 0; }
.section-alt { background: var(--bg-alt); }
.grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; border-top: 4px solid var(--navy); }
.card h3 { margin-top: 0; }
.card .tittel { color: var(--muted); font-size: 0.9rem; }

/* Søylediagram */
.bars { display: grid; gap: 0.75rem; max-width: 600px; }
.bar-row { display: grid; grid-template-columns: 80px 1fr 2rem; align-items: center; gap: 0.75rem; }
.bar-row { grid-template-columns: 90px 1fr 2.5rem; }
.bar-track { background: var(--track); border-radius: 4px; }
.bar { height: 1.4rem; background: var(--bar); border-radius: 4px; width: 0; transition: width 1s ease-out; }

/* Forside */
.mt { margin-top: 3rem; }
.two-col { display: grid; gap: 3rem; grid-template-columns: 3fr 2fr; align-items: start; }
.fakta { margin: 0; background: var(--bg-alt); border-radius: var(--radius); padding: 1.5rem; display: grid; gap: 0.9rem; }
.fakta div { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px dashed var(--border-input); padding-bottom: 0.5rem; }
.fakta dt { color: var(--muted); }
.fakta dd { margin: 0; font-weight: 600; text-align: right; }
.fakta dd ul { list-style: none; margin: 0.3rem 0 0; padding: 0; font-weight: 400; font-size: 0.85rem; color: var(--muted); }
.nr { font-family: var(--mono); color: var(--accent); font-weight: 700; font-size: 0.85rem; }
.stats { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stat { border-left: 4px solid var(--accent); padding: 0.5rem 1rem; display: grid; }
.stat-verdi { font-size: 2.4rem; font-weight: 700; color: var(--strong); line-height: 1.1; }
.stat-tekst { color: var(--muted); }
.steg { padding-left: 1.4rem; display: grid; gap: 0.75rem; }
.card-link { text-decoration: none; display: block; transition: transform 0.15s, box-shadow 0.15s; }
.card-link:hover { transform: translateY(-3px); box-shadow: 0 8px 20px #0b1f3a1a; }
.les-mer { color: var(--link); font-weight: 600; }
.breadcrumb { font-size: 0.9rem; opacity: 0.8; }
.breadcrumb a { color: #fff; }

/* Skjema */
.form { display: grid; gap: 1rem; }
.form label { display: grid; gap: 0.35rem; font-weight: 600; }
.form select, .form textarea { font: inherit; padding: 0.6rem; border: 1px solid var(--border-input); border-radius: var(--radius); }
.form input { font: inherit; padding: 0.6rem; border: 1px solid var(--border-input); border-radius: var(--radius); }
.form-status { min-height: 1.5em; color: var(--link); font-weight: 600; }
.form-status.feil { color: var(--danger); }
.form button:disabled { opacity: 0.6; cursor: wait; }
.honningkrukke { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Footer */
.site-footer { background: var(--navy); color: #fffc; padding: 1.5rem 0; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.badge { font-family: var(--mono); border: 1px solid var(--accent); color: var(--accent); padding: 0.3rem 0.7rem; border-radius: 4px; font-size: 0.85rem; }

/* Innlogging, NDA og admin */
.nav { align-items: center; }
.nav-skjema { margin: 0; }
.nav .sprak-lenke { border: 1px solid #fff5; border-radius: var(--radius); padding: 0.15rem 0.6rem; font-size: 0.9rem; }
.nav-knapp { background: none; border: 1px solid #fff5; color: #fff; padding: 0.3rem 0.7rem; border-radius: var(--radius); font: inherit; font-size: 0.9rem; cursor: pointer; }
.nav-knapp:hover { border-color: var(--accent); color: var(--accent); }
.eyebrow-mork { color: var(--link); }
.liten { font-size: 0.85rem; margin: 0.2rem 0 0.5rem; }
.varsel { padding: 0.8rem 1rem; border-radius: var(--radius); border-left: 4px solid var(--link); background: var(--info-bg); font-weight: 600; }
.varsel-ok { border-color: var(--ok); background: var(--ok-bg); color: var(--ok-text); }
.varsel-feil { border-color: var(--danger); background: var(--danger-bg); color: var(--danger-text); }
.btn-sekundaer { background: var(--surface); color: var(--strong); border-color: var(--border-input); padding: 0.4rem 0.9rem; font-size: 0.9rem; margin-top: 0.5rem; }
.form input[type=checkbox] { width: 1.1rem; height: 1.1rem; margin: 0.2rem 0 0; accent-color: var(--navy); }
.avkryssing { display: flex !important; gap: 0.6rem; align-items: flex-start; font-weight: 400 !important; }
.felt-tittel { font-weight: 600; }
.valg { border: 0; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.valg legend { padding: 0; }
.valg legend h2 { margin: 0 0 0.3rem; }

.dokument { position: relative; background: var(--surface); border: 1px solid var(--border); border-top: 6px solid var(--navy); border-radius: var(--radius); padding: 2rem 2.2rem; margin: 1.5rem 0 2.5rem; box-shadow: 0 4px 18px #0b1f3a12; overflow: hidden; }
.dokument h2 { margin-top: 0; font-size: 1.3rem; padding-right: 7rem; }
.dokument h3 { font-size: 1rem; margin: 1.4rem 0 0.3rem; font-family: var(--mono); }
.dokument p { margin: 0; }
.dokument .muted { margin-top: 1.5rem; font-size: 0.8rem; }
.stempel { position: absolute; top: 1.4rem; right: -2.6rem; transform: rotate(18deg); border: 3px solid var(--danger); color: var(--danger); font-family: var(--mono); font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase; padding: 0.2rem 3rem; opacity: 0.55; pointer-events: none; }

.signering { background: var(--bg-alt); border-radius: var(--radius); padding: 1.5rem; }
.signering h2 { margin: 0; }
.signatur-ramme { position: relative; border: 2px dashed var(--faint); border-radius: var(--radius); background: #fff; }
#signatur { display: block; width: 100%; height: 200px; touch-action: none; cursor: crosshair; border-radius: var(--radius); }
.signatur-linje { position: absolute; left: 1rem; right: 1rem; bottom: 2.6rem; border-bottom: 1px solid #c5ccd6; color: #9aa5b5; font-size: 0.9rem; pointer-events: none; }

.tabell-ramme { overflow-x: auto; }
.tabell { width: 100%; border-collapse: collapse; font-size: 0.9rem; background: var(--surface); }
.tabell th, .tabell td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tabell th { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); text-transform: uppercase; }
.tabell tr.inaktiv td { color: var(--faint); }
.handlinger form { display: flex; flex-wrap: wrap; gap: 0.4rem 0.8rem; margin: 0; }
.lenkeknapp { background: none; border: none; padding: 0; color: var(--link); text-decoration: underline; cursor: pointer; font: inherit; white-space: nowrap; }
.lenkeknapp-fare { color: var(--danger); }
.btn-fare { background: #b3261e; color: #fff; padding: 0.4rem 0.9rem; font-size: 0.9rem; margin-top: 0.5rem; }
.bekreft-slett { font-weight: 400; }
.bekreft-slett p { margin: 0 0 0.3rem; font-weight: 600; }
.bekreft-slett .btn-sekundaer { margin-left: 0.5rem; }
.bekreft-sms .btn-sekundaer { margin-left: 0.5rem; }
.sms-forhandsvisning { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.6rem 0.8rem; font-weight: 400; font-family: var(--mono); white-space: normal; max-width: 32rem; }
.sms-skjema { max-width: 36rem; }
.mobil-skjema { display: flex; gap: 0.5rem; align-items: center; margin: 0; }
.mobil-skjema select { font: inherit; font-size: 0.85rem; padding: 0.2rem 0.3rem; border: 1px solid var(--border-input); border-radius: 4px; }
.mobil-skjema input { font: inherit; font-size: 0.85rem; width: 9.5rem; padding: 0.25rem 0.4rem; border: 1px solid var(--border-input); border-radius: 4px; }
.skjult { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.aktiver-skjema { background: var(--warn-bg); border: 1px solid #e0a52666; border-left: 4px solid var(--accent); border-radius: var(--radius); padding: 1rem 1.2rem; margin: 0 0 1rem; }
.aktiver-skjema p { margin: 0 0 0.6rem; }
.aktiver-skjema .btn { margin: 0.3rem 0.5rem 0 0; padding: 0.5rem 1rem; font-size: 0.95rem; }
.tabell input[type=checkbox] { width: 1.1rem; height: 1.1rem; accent-color: var(--navy); }
.signatur-miniatyr { height: 40px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }

/* Tidslinje */
.tidslinje { list-style: none; margin: 2.5rem 0 0; padding: 0 0 0 2.2rem; position: relative; display: grid; gap: 2.2rem; }
.tidslinje::before { content: ""; position: absolute; left: 0.5rem; top: 0.4rem; bottom: 0.4rem; width: 3px; margin-left: -1.5px; border-radius: 2px; background: linear-gradient(var(--accent), var(--navy-2)); }
.tl-hendelse { position: relative; }
.tl-hendelse::before { content: ""; position: absolute; left: -2.2rem; top: 0.25rem; width: 1rem; height: 1rem; border-radius: 50%; background: var(--accent); border: 3px solid var(--bg); box-shadow: 0 0 0 2px var(--navy); }
.tl-topp { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 1rem; margin-bottom: 0.6rem; }
.tl-dato { font-family: var(--mono); font-weight: 700; color: var(--link); }
.tl-sak { font-family: var(--mono); font-size: 0.85rem; color: var(--muted); }
.tl-hendelse .card h3 { margin-bottom: 0.6rem; }
.tl-utfall { margin-bottom: 0; }
.tl-status { display: inline-block; margin-top: 0.8rem; padding: 0.15rem 0.6rem; border: 1px solid currentColor; border-radius: 4px; font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; }
.tl-status-avsluttet { color: var(--ok); }
.tl-status-pagar { color: var(--warn-text); }
.tl-status-anke { color: var(--danger); }
.sitat { margin: 1rem 0; padding: 0.7rem 1rem; border-left: 4px solid var(--accent); background: var(--bg-alt); font-style: italic; }
.sitat cite { display: block; margin-top: 0.4rem; font-style: normal; font-size: 0.9rem; color: var(--muted); }

/* Chat (innloggede). The chat fills the screen under the header, and only the message list
   scrolls (#153; on phones: #111 below). Flex, not grids with percentage heights (Safari). */
.visuelt-skjult { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
body:has(.chat-app) { display: flex; flex-direction: column; height: var(--chat-vh, 100dvh); }
body:has(.chat-app) .site-footer { display: none; }
main:has(.chat-app) { flex: 1 1 auto; min-height: 30rem; padding: 1.2rem 0; display: flex; flex-direction: column; }
main:has(.chat-app) > .container { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
main:has(.chat-app) > .container > .eyebrow { margin: 0; }
main:has(.chat-app) > .container > h1 { margin: 0.2rem 0 0; }
main:has(.chat-app) > .container > p.muted { margin: 0.2rem 0 0.9rem; }
.chat-app { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 16rem minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 1rem; }

/* The conversation list */
.chat-samtaler { min-height: 0; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 0.5rem; }
.chat-samtaler ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.1rem; }
.chat-seksjon { margin: 0.7rem 0.6rem 0.15rem; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.chat-samtaler button { width: 100%; display: flex; align-items: center; gap: 0.6rem; text-align: left; font: inherit; font-size: 0.95rem; background: none; border: 0; border-radius: 8px; padding: 0.4rem 0.55rem; cursor: pointer; color: var(--text); }
.chat-samtaler button:hover { background: var(--bg-alt); }
.chat-samtaler button[aria-current="true"] { background: var(--navy); color: #fff; }
.chat-samtale-navn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Round initials; the hue comes from the name (js/chat.js), the green dot is «pålogget» */
.chat-avatar { position: relative; flex: none; width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; font-size: 0.8rem; font-weight: 700; line-height: 1; color: #fff; background: hsl(var(--hue, 215) 42% 44%); }
.chat-avatar.rom { background: var(--navy-2); font-family: var(--mono); }
.chat-avatar.gruppe { background: var(--bg-alt); color: var(--text); border: 1px solid var(--border); font-size: 0.9rem; }
.chat-avatar.palogget::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--ok); border: 2px solid var(--surface); }
[aria-current="true"] > .chat-avatar.gruppe { background: #ffffff1f; color: #fff; border-color: #fff4; }
[aria-current="true"] > .chat-avatar.palogget::after { border-color: var(--navy); }
.chat-ulest { background: var(--accent); color: var(--navy); border-radius: 999px; font-size: 0.75rem; font-weight: 700; padding: 0 0.45rem; }

/* The open conversation: header, messages, «… skriver», the message field */
.chat { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--bg-alt); border: 1px solid var(--border); border-radius: 12px; }
.chat-hode { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; padding: 0.6rem 1rem; background: var(--surface); border-bottom: 1px solid var(--border); border-radius: 12px 12px 0 0; }
.chat-hode h2 { margin: 0; font-size: 1.15rem; }
.chat-hode .btn { padding: 0.35rem 0.8rem; font-size: 0.9rem; }
.chat-ring { display: flex; gap: 0.5rem; }
.chat-ring .btn-sekundaer { margin-top: 0; }
.chat-ring[hidden], .samtale[hidden], .innkommende[hidden], .samtale-knapp[hidden] { display: none; }
.chat-liste { flex: 1 1 auto; min-height: 0; list-style: none; margin: 0; padding: 1.1rem 1rem 0.6rem; overflow-y: auto; display: flex; flex-direction: column; gap: 0.15rem; }
.chat-tom { margin: auto; text-align: center; max-width: 40ch; }

/* A message. Several in a row from the same person within a few minutes are a «run»: only the
   first shows the name and time (.fortsettelse, js/chat.js) */
.chat-melding { position: relative; align-self: flex-start; max-width: min(85%, 44rem); margin-top: 0.6rem; padding: 0.4rem 0.8rem 0.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: 4px 14px 14px 14px; box-shadow: 0 1px 2px #0b1f3a0f; }
.chat-melding.egen { align-self: flex-end; background: var(--own-bg); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); border-radius: 14px 4px 14px 14px; }
.chat-melding.fortsettelse { margin-top: 0; border-radius: 4px 14px 14px 4px; }
.chat-melding.egen.fortsettelse { border-radius: 14px 4px 4px 14px; }
.chat-melding.bot { background: var(--bot-bg); border-color: color-mix(in srgb, var(--bot) 35%, var(--border)); }
.chat-melding.slettet { background: none; box-shadow: none; border-style: dashed; }
.chat-melding.slettet p { font-style: italic; color: var(--muted); }
.chat-topp { display: flex; flex-wrap: wrap; column-gap: 0.6rem; align-items: baseline; font-size: 0.85rem; }
.chat-topp time { white-space: nowrap; }
.chat-topp strong { color: var(--strong); color: light-dark(hsl(var(--hue, 215) 50% 34%), hsl(var(--hue, 215) 70% 76%)); }
.chat-melding.egen .chat-topp strong { color: var(--strong); }
.chat-topp time { color: var(--muted); font-family: var(--mono); font-size: 0.75rem; }
.fortsettelse .chat-topp > :is(strong, time) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.chat-melding p { margin: 0.1rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.chat-redigert { color: var(--muted); font-size: 0.75rem; }
.chat-ai { font-family: var(--mono); font-size: 0.7rem; font-weight: 700; color: var(--bot); border: 1px solid var(--bot); border-radius: 4px; padding: 0 0.3rem; }
[aria-current] > .chat-ai { color: #fff; border-color: #fff9; }
.chat-skriver { align-self: flex-start; margin-top: 0.6rem; font-style: italic; font-size: 0.9rem; }

/* The actions of a message (Svar, Reager, Rediger, Slett): a small bar on the top edge of the
   message, shown on hover and keyboard focus. On touch screens: when the message is tapped (.valgt). */
.chat-handlinger { position: absolute; top: -0.95rem; left: 0.6rem; z-index: 2; display: flex; gap: 0.1rem; padding: 0.15rem; background: var(--surface); border: 1px solid var(--border-input); border-radius: 999px; box-shadow: 0 2px 10px #0b1f3a40; opacity: 0; pointer-events: none; transition: opacity 0.12s; }
.chat-melding.egen .chat-handlinger { left: auto; right: 0.6rem; } /* grows into the message, never off the edge */
.chat-melding:hover .chat-handlinger, .chat-melding:focus-within .chat-handlinger { opacity: 1; pointer-events: auto; }
.chat-handlinger button { font: inherit; font-size: 0.78rem; font-weight: 600; line-height: 1.2; background: none; border: 0; border-radius: 999px; padding: 0.2rem 0.6rem; color: var(--link); cursor: pointer; }
.chat-handlinger button:hover, .chat-handlinger button:focus-visible { background: var(--bg-alt); }
.chat-handlinger button[data-action="delete"] { color: var(--danger); }
@media (hover: none) and (pointer: coarse) {
  .chat-melding:hover .chat-handlinger, .chat-melding:focus-within .chat-handlinger { opacity: 0; pointer-events: none; }
  .chat-melding.valgt .chat-handlinger { opacity: 1; pointer-events: auto; }
  .chat-melding.valgt { border-color: var(--link); }
  .chat-handlinger { top: -2rem; }
  /* Large enough for a thumb (#111) */
  .chat-handlinger button { padding: 0.45rem 0.7rem; font-size: 0.85rem; }
  .chat-svar-avbryt { padding: 0.3rem 0.6rem; }
}
@media (prefers-reduced-motion: reduce) { .chat-handlinger { transition: none; } }

/* Edit in place */
.chat-rediger-felt { display: block; width: 100%; font: inherit; padding: 0.4rem; margin-top: 0.3rem; border: 1px solid var(--border-input); border-radius: var(--radius); background: var(--surface); color: var(--text); resize: vertical; }
.chat-rediger-knapper { display: flex; gap: 0.4rem; margin-top: 0.35rem; }
.btn-liten { padding: 0.25rem 0.7rem; font-size: 0.85rem; margin-top: 0; }
.chat-melding.redigerer { max-width: 100%; width: 100%; }

/* The message field: attachment, GIF, text and Send in one box */
.chat-skjema { position: relative; flex: none; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.3rem; margin: 0.2rem 0.8rem 0; padding: 0.3rem; background: var(--surface); border: 1px solid var(--border-input); border-radius: 14px; }
.chat-skjema:focus-within { border-color: var(--link); box-shadow: 0 0 0 3px color-mix(in srgb, var(--link) 22%, transparent); }
.chat-skjema textarea { flex: 1 1 10rem; min-width: 0; font: inherit; line-height: 1.4; padding: 0.45rem 0.4rem; border: 0; border-radius: 8px; background: none; color: var(--text); resize: none; min-height: 2.3rem; max-height: 10rem; outline: none; }
.chat-skjema .btn { margin-top: 0; padding: 0.45rem 1.1rem; border-radius: 10px; }
.chat-skjema button:disabled { opacity: 0.6; cursor: wait; }
.chat > .form-status { flex: none; min-height: 1.3em; margin: 0.15rem 1rem 0.3rem; font-size: 0.85rem; }
.chat-skriver-linje { flex: none; min-height: 1.3em; margin: 0 1rem 0.15rem; font-size: 0.85rem; font-style: italic; }

/* Replies (#25, js/chat-replies.js) */
.chat-svar-pa { flex: 1 0 100%; display: flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0.6rem; border-left: 3px solid var(--accent); background: var(--bg-alt); border-radius: 8px; font-size: 0.85rem; }
.chat-svar-pa[hidden] { display: none; }
.chat-svar-pa span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-svar-avbryt { font: inherit; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0 0.3rem; }
.chat-sitat { display: block; width: 100%; text-align: left; font: inherit; font-size: 0.85rem; margin: 0.3rem 0 0.1rem; padding: 0.25rem 0.6rem; border: 0; border-left: 3px solid var(--border-input); border-radius: 6px; background: var(--bg-alt); color: var(--muted); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-sitat strong { margin-right: 0.4rem; color: var(--text); }
.chat-sitat:hover, .chat-sitat:focus-visible { border-left-color: var(--accent); }

/* Reactions (#24, js/chat-reactions.js): pills under the message; yours are marked, + adds one */
.chat-reaksjoner { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.4rem; }
.chat-reaksjon { display: inline-flex; align-items: center; gap: 0.3rem; font: inherit; line-height: 1; padding: 0.2rem 0.55rem 0.2rem 0.45rem; min-height: 1.75rem; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-alt); color: var(--text); cursor: pointer; transition: border-color 0.12s, background 0.12s; }
.chat-reaksjon:hover, .chat-reaksjon:focus-visible { border-color: var(--border-input); background: var(--surface); }
.chat-reaksjon-emoji { font-size: 1rem; }
.chat-reaksjon-antall { font-size: 0.8rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.chat-reaksjon.min { background: color-mix(in srgb, var(--accent) 20%, var(--surface)); border-color: var(--accent); }
.chat-reaksjon.min .chat-reaksjon-antall { color: var(--text); }
.chat-reaksjon-ny { padding-inline: 0.5rem; color: var(--muted); font-weight: 700; opacity: 0; transition: opacity 0.12s; }
.chat-melding:hover .chat-reaksjon-ny, .chat-reaksjon-ny:focus-visible, .chat-melding:has(.chat-reaksjonsvelger) .chat-reaksjon-ny { opacity: 1; }
@media (hover: none) and (pointer: coarse) { .chat-reaksjon-ny { opacity: 1; } }
.chat-reaksjonsvelger { width: max-content; max-width: 100%; margin-top: 0.4rem; padding: 0.3rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: 0 4px 16px #0b1f3a2e; }
.chat-reaksjonsvalg { display: flex; flex-wrap: wrap; gap: 0.1rem; }
.chat-reaksjonsvalg button { font-size: 1.35rem; line-height: 1; padding: 0.3rem 0.35rem; border: 1px solid transparent; border-radius: 8px; background: none; cursor: pointer; transition: transform 0.1s; }
.chat-reaksjonsvalg button:hover, .chat-reaksjonsvalg button:focus-visible { background: var(--bg-alt); transform: scale(1.15); }
.chat-reaksjonsvalg button.min { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 20%, var(--surface)); }
.chat-reaksjon-hvem { list-style: none; display: grid; gap: 0.1rem; margin: 0.3rem 0 0; padding: 0.35rem 0.35rem 0.1rem; border-top: 1px solid var(--border); font-size: 0.8rem; color: var(--muted); }
@media (prefers-reduced-motion: reduce) {
  .chat-reaksjon, .chat-reaksjon-ny, .chat-reaksjonsvalg button { transition: none; }
  .chat-reaksjonsvalg button:hover, .chat-reaksjonsvalg button:focus-visible { transform: none; }
}
.chat-melding.uthevet { animation: chat-uthevet 2s ease-out; }
@keyframes chat-uthevet { from { box-shadow: 0 0 0 3px var(--accent); } to { box-shadow: 0 0 0 3px transparent; } }
@media (prefers-reduced-motion: reduce) { .chat-melding.uthevet { animation: none; outline: 3px solid var(--accent); } }

/* Images and files (#28, js/chat-files.js) */
.chat-vedlegg-knapp { flex: none; display: inline-grid; place-items: center; height: 2.3rem; min-width: 2.3rem; padding: 0 0.45rem; font-size: 1.15rem; color: var(--muted); background: none; border: 0; border-radius: 10px; cursor: pointer; }
.chat-vedlegg-knapp:hover, .chat-vedlegg-knapp:focus-visible, .chat-vedlegg-knapp[aria-expanded="true"] { background: var(--bg-alt); color: var(--text); }
.chat-vedlegg-knapp[hidden], .chat-vedlegg[hidden], .chat-vedlegg img[hidden] { display: none; }
/* GIFs (#58): a fixed maximum size in the messages, so they never push everything else away */
.chat-gif-knapp { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.04em; }
.chat-gif { display: block; margin-top: 0.35rem; padding: 0; border: 0; background: none; line-height: 0; max-width: min(100%, 200px); }
.chat-gif img { max-width: 100%; height: auto; max-height: 220px; width: auto; border-radius: 6px; background: var(--bg-alt); }
button.chat-gif { cursor: pointer; }
.chat-gif-velger { position: absolute; left: 0; right: 0; bottom: calc(100% + 0.4rem); z-index: 6; display: flex; flex-direction: column; gap: 0.4rem; max-height: min(60vh, 26rem); padding: 0.6rem; border: 1px solid var(--border-input); border-radius: var(--radius); background: var(--bg); box-shadow: 0 6px 24px #0003; }
.chat-gif-velger[hidden] { display: none; }
.chat-gif-sok { font: inherit; font-size: 16px; padding: 0.45rem 0.6rem; border: 1px solid var(--border-input); border-radius: var(--radius); background: var(--surface); color: var(--text); }
.chat-gif-treff { flex: 1 1 auto; min-height: 6rem; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr)); gap: 0.35rem; align-content: start; }
.chat-gif-treff button { padding: 0; border: 2px solid transparent; border-radius: 6px; background: var(--bg-alt); cursor: pointer; line-height: 0; aspect-ratio: 1; overflow: hidden; }
.chat-gif-treff button:hover, .chat-gif-treff button:focus-visible { border-color: var(--accent); }
.chat-gif-treff img { width: 100%; height: 100%; object-fit: cover; }
.chat-gif-merknad { grid-column: 1 / -1; margin: 0.5rem 0; line-height: 1.4; }
.chat-gif-kilde { margin: 0; font-size: 0.7rem; color: var(--muted); text-align: right; }
.chat-vedlegg { flex: 1 0 100%; display: flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0.6rem; border-left: 3px solid var(--link); background: var(--bg-alt); border-radius: 8px; font-size: 0.85rem; }
.chat-vedlegg span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-vedlegg img { width: 2.5rem; height: 2.5rem; object-fit: cover; border-radius: 4px; }
.chat-bilde { display: block; margin-top: 0.4rem; max-width: 100%; }
.chat-bilde img { display: block; max-width: 100%; height: auto; max-height: 18rem; border-radius: 6px; background: var(--bg-alt); }
.chat-fil { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.4rem; padding: 0.45rem 0.7rem; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-alt); color: var(--link); text-decoration: none; max-width: 100%; }
.chat-fil:hover, .chat-fil:focus-visible { border-color: var(--link); }
.chat-fil-navn { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: underline; }
.chat-fil small { flex: none; color: var(--muted); }
.chat.slipp-her { outline: 3px dashed var(--accent); outline-offset: -3px; }

/* Calls in groups (#118, js/chat-groupcall.js). Like the 1-1 call window: fixed, dark, buttons at the bottom. */
.gruppesamtale { position: fixed; inset: 0; z-index: 40; background: #07152a; color: #fff; display: flex; }
.gs-hoved { position: relative; flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.gruppesamtale[hidden], .gs-rute video[hidden] { display: none; }
.gs-topp { flex: none; padding: 0.8rem 1rem 0.4rem; }
.gs-navn { margin: 0; font-size: 1.2rem; color: #fff; }
.gs-tekst { margin: 0; font-family: var(--mono); font-size: 0.85rem; opacity: 0.85; }
/* Rows as tall as the tiles, and «safe» centring: when the tiles do not fit (narrow window, the
   chat panel open), they scroll instead of overlapping */
.gs-ruter { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: grid; gap: 0.5rem; padding: 0.5rem; align-content: safe center; grid-auto-rows: max-content;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); }
.gs-ruter[data-antall="1"], .gs-ruter[data-antall="2"] { grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
.gs-rute { position: relative; margin: 0; aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden; background: #0b1f3a; border: 2px solid #fff3; }
.gs-rute video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.gs-rute video.speilet { transform: scaleX(-1); }
.gs-rute.uten-bilde video { visibility: hidden; }
.gs-initial { position: absolute; inset: 0; display: none; place-items: center; font-size: 3rem; font-weight: 700; color: #fffc; }
.gs-rute.uten-bilde .gs-initial { display: grid; }
.gs-rute figcaption { position: absolute; left: 0.5rem; right: 0.5rem; bottom: 0.35rem; display: flex; gap: 0.4rem; align-items: baseline; font-size: 0.85rem; font-weight: 600; text-shadow: 0 1px 3px #000; }
.gs-rute figcaption small { font-weight: 400; opacity: 0.9; }
/* Shared screens (#133): a row above the tiles, 60 % of the height; the whole screen is visible */
.gs-skjermer { flex: 0 0 60%; min-height: 0; display: flex; justify-content: center; gap: 0.5rem; padding: 0.5rem 0.5rem 0; }
.gs-skjermer[hidden] { display: none; }
.gs-rute.gs-skjerm { flex: 0 1 auto; height: 100%; max-width: 100%; aspect-ratio: 16 / 9; }
.gs-rute.gs-skjerm video { object-fit: contain; }
.gruppesamtale.med-skjerm .gs-ruter { align-content: start; justify-content: center; grid-template-columns: repeat(auto-fit, minmax(8rem, 11rem)); }
.gs-melding { margin: 0 auto 0.4rem; background: #b3261e; border-radius: var(--radius); padding: 0.4rem 0.9rem; font-weight: 600; max-width: 90vw; }
.gs-melding:empty { display: none; }
@media (max-width: 720px) {
  .gs-ruter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gs-ruter[data-antall="1"], .gs-ruter[data-antall="2"] { grid-template-columns: minmax(0, 1fr); }
}

/* Back to the conversation list: mobile only (#111, js/chat-mobile.js) */
.chat-tilbake { display: none; }

/* «Sett» (#22) and «… skriver» (#23), js/chat-status.js */
.chat-sett { display: block; text-align: right; font-size: 0.75rem; color: var(--muted); margin-top: 0.15rem; }
.chat-skriver-linje { min-height: 1.3em; margin: 0.3rem 0 0; font-size: 0.85rem; font-style: italic; }

/* Group chats */
.chat-gruppe-ikon { flex: none; font-size: 0.85rem; }
.chat-samtaler .chat-ny-gruppe { margin-top: 0.4rem; border-top: 1px solid var(--border); border-radius: 0; color: var(--link); font-size: 0.9rem; }
.chat-gruppe-knapp { margin-top: 0; }
.chat-gruppe-knapp[hidden], .gruppe-dialog [hidden] { display: none; }
.gruppe-dialog { width: min(28rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); border: 0; background: var(--surface); color: var(--text); border-radius: var(--radius); padding: 1.2rem; box-shadow: 0 10px 40px #0005; }
.gruppe-dialog::backdrop { background: #0006; }
.gruppe-dialog h2 { margin: 0 0 0.8rem; font-size: 1.2rem; }
.gruppe-dialog h3 { margin: 1rem 0 0.3rem; font-size: 1rem; }
.gruppe-dialog label[for] { display: block; font-weight: 600; margin-bottom: 0.25rem; }
.gruppe-dialog input:not([type]) { width: 100%; box-sizing: border-box; font: inherit; padding: 0.5rem; border: 1px solid var(--border-input); border-radius: var(--radius); }
.gruppe-medlemmer { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.2rem; }
.gruppe-medlemmer li { display: flex; align-items: baseline; gap: 0.3rem; }
.gruppe-fjern { margin-left: auto; font: inherit; font-size: 0.8rem; background: none; border: 0; color: var(--link); text-decoration: underline; cursor: pointer; }
.gruppe-velg-boks { border: 1px solid var(--border); border-radius: var(--radius); margin: 1rem 0 0; padding: 0.5rem 0.8rem; }
.gruppe-velg { display: grid; gap: 0.25rem; max-height: 14rem; overflow-y: auto; }
.gruppe-knapper { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.8rem; }
.gruppe-knapper .btn { margin-top: 0; }
.gruppe-farlig { color: var(--danger); border-color: var(--danger); }

/* Chat panel in the call window */
.samtale-chat { flex: 0 0 min(22rem, 40vw); display: flex; flex-direction: column; min-height: 0; background: var(--bg-alt); color: var(--text); border-left: 1px solid #0004; }
.samtale-chat[hidden] { display: none; }
.samtale-chat-hode { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.6rem 0.8rem; background: var(--surface); border-bottom: 1px solid var(--border); }
.samtale-chat-hode h2 { margin: 0; font-size: 1rem; }
.samtale-chat-lukk { font: inherit; background: none; border: 0; font-size: 1.1rem; cursor: pointer; color: var(--strong); padding: 0.2rem 0.4rem; }
.samtale-chat .chat-liste { padding: 1.1rem 0.6rem 0.5rem; }
.samtale-chat .chat-melding { max-width: 92%; }
.samtale-chat .chat-skjema { margin: 0 0.5rem 0.5rem; }
.samtale-knapp.har-ulest { background: var(--accent); border-color: var(--accent); color: var(--navy); }

/* Innkommende anrop og samtale */
.innkommende { position: fixed; top: 5rem; left: 50%; transform: translateX(-50%); z-index: 30; background: var(--surface); border: 1px solid var(--border); border-top: 6px solid var(--accent); border-radius: var(--radius); box-shadow: 0 10px 30px #0b1f3a40; padding: 1rem 1.4rem; width: min(26rem, 92vw); }
.innkommende p { margin: 0 0 0.8rem; font-weight: 600; }
.innkommende-knapper { display: flex; gap: 0.6rem; }
.innkommende-knapper .btn-sekundaer { margin-top: 0; }
.samtale { position: fixed; inset: 0; z-index: 40; background: #07152a; color: #fff; display: flex; }
.samtale-hoved { position: relative; flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.samtale-scene { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.samtale-fjern { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.samtale-info { position: absolute; top: 1rem; left: 1rem; right: 1rem; z-index: 2; text-shadow: 0 1px 3px #000; pointer-events: none; }
.samtale-navn { margin: 0; font-size: 1.4rem; font-weight: 700; }
.samtale-tekst { margin: 0; font-family: var(--mono); opacity: 0.85; }
.samtale.bare-lyd .samtale-fjern { visibility: hidden; }
.samtale.bare-lyd .samtale-info { top: 40%; text-align: center; }
.samtale.bare-lyd .samtale-navn { font-size: 2rem; }
.samtale-fjern-status { margin: 0.3rem 0 0; font-size: 0.95rem; opacity: 0.9; }
.samtale-fjern-status:empty { display: none; }
.samtale-bokser { position: absolute; right: 1rem; bottom: 1rem; z-index: 2; width: min(26vw, 220px); display: flex; flex-direction: column; gap: 0.5rem; }
.samtale-boks { position: relative; margin: 0; border-radius: var(--radius); overflow: hidden; border: 2px solid #fff6; background: #000; aspect-ratio: 16 / 10; }
.samtale-boks[hidden] { display: none; }
.samtale-boks video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.samtale-boks video.speilet { transform: scaleX(-1); }
.samtale-boks figcaption { position: absolute; left: 0.4rem; bottom: 0.25rem; font-size: 0.75rem; font-weight: 600; text-shadow: 0 1px 2px #000; }
.samtale-boks figcaption { pointer-events: none; }
/* Two screens (#64): the small one is a button that shows it large, ↗ opens it in its own window */
.samtale-boks-bytt { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: pointer; }
.samtale-boks-bytt:focus-visible, .samtale-boks-vindu:focus-visible, .samtale-verktoy-knapp:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.samtale-boks-vindu { position: absolute; top: 0.25rem; right: 0.25rem; font: inherit; font-size: 0.85rem; line-height: 1; color: #fff; background: #0009; border: 1px solid #fff6; border-radius: 6px; padding: 0.25rem 0.4rem; cursor: pointer; }
.samtale-skjermverktoy { position: absolute; top: 1rem; right: 1rem; z-index: 3; display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; font-weight: 600; text-shadow: 0 1px 2px #000; }
.samtale-skjermverktoy[hidden] { display: none; }
.samtale-verktoy-knapp { font: inherit; color: #fff; background: #0009; border: 1px solid #fff6; border-radius: 999px; padding: 0.35rem 0.8rem; cursor: pointer; text-shadow: none; }
.samtale-melding { position: absolute; left: 50%; bottom: 1rem; z-index: 3; transform: translateX(-50%); margin: 0; background: #b3261e; border-radius: var(--radius); padding: 0.4rem 0.9rem; font-weight: 600; max-width: 90vw; }
.samtale-melding:empty { display: none; }
.samtale-knapper { flex: none; position: relative; z-index: 3; display: flex; justify-content: center; gap: 0.8rem; padding: 1.2rem; background: #0b1f3a; }
.samtale-knapp { font: inherit; font-weight: 600; border: 1px solid #fff6; background: #ffffff1a; color: #fff; border-radius: 999px; padding: 0.7rem 1.2rem; cursor: pointer; }
.samtale-knapp[aria-pressed="true"] { background: #fff; color: var(--navy); }
.samtale-knapp.legg-paa { background: #b3261e; border-color: #b3261e; }
.samtale-knapp:disabled { opacity: 0.45; cursor: not-allowed; }
.samtale-knapper { flex-wrap: wrap; }

/* Mobil */
@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; background: var(--navy); padding: 1rem 4%; gap: 0.75rem; }
  .nav.open { display: flex; }
  .two-col { grid-template-columns: 1fr; }
  /* Chat (#111): fills the visible screen under the header (--chat-vh follows the keyboard), and the
     list and the conversation are two views (#chat[data-visning], js/chat-mobile.js). */
  body:has(.chat-app) { overflow: hidden; }
  main:has(.chat-app) { min-height: 0; padding: 0; }
  main:has(.chat-app) > .container { width: 100%; }
  main:has(.chat-app) > .container > :is(.eyebrow, p.muted) { display: none; }
  main:has(.chat-app) > .container > h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .chat-app { display: block; }
  .chat-app[data-visning="liste"] .chat, .chat-app[data-visning="samtale"] .chat-samtaler { display: none; }
  .chat-samtaler { height: 100%; border: 0; border-radius: 0; padding: 0.5rem 4% calc(0.5rem + env(safe-area-inset-bottom)); }
  .chat-samtaler button { padding: 0.65rem 0.6rem; font-size: 1.05rem; }
  .chat-avatar { width: 2.4rem; height: 2.4rem; font-size: 0.9rem; }
  .chat { height: 100%; border: 0; border-radius: 0; padding-bottom: env(safe-area-inset-bottom); }
  .chat-hode { flex-wrap: nowrap; padding: 0.35rem 0.75rem; border-radius: 0; }
  .chat-hode h2 { flex: 1; min-width: 0; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chat-tilbake { display: inline-block; flex: none; font: inherit; font-weight: 600; background: none; border: 0; color: var(--link); padding: 0.5rem 0.4rem 0.5rem 0; cursor: pointer; }
  .chat-hode .btn { padding: 0.35rem 0.7rem; font-size: 0.85rem; }
  .chat-liste { padding: 0.8rem 0.6rem 0.4rem; }
  .chat-melding { max-width: 90%; }
  .chat-skriver-linje { margin: 0 0.75rem; }
  .chat .chat-skjema { margin: 0.1rem 0.5rem 0.4rem; }
  /* 16 px: smaller text makes iOS zoom in when the field gets focus */
  .chat-skjema textarea, .chat-rediger-felt { font-size: 16px; resize: none; }
  .chat-skjema .btn { padding: 0.5rem 0.9rem; }
  #chat-status { min-height: 0; margin: 0 0.75rem; }
  #chat-status:empty { display: none; }
  .samtale-bokser { width: 34vw; right: 0.6rem; bottom: 0.6rem; }
  /* Mobile: slides up over the video, above the call buttons (which stay usable) */
  .samtale-chat { position: absolute; left: 0; right: 0; top: 22%; bottom: var(--knapper-hoyde, 4.2rem); z-index: 5; border-left: 0; border-radius: 12px 12px 0 0; overflow: hidden; box-shadow: 0 -8px 24px #0006; }
  .samtale-knapper { gap: 0.4rem; padding: 0.8rem 0.5rem; }
  .samtale-knapp { font-size: 0.85rem; padding: 0.55rem 0.8rem; }
  .dokument { padding: 1.4rem 1.2rem; }
  .dokument h2 { padding-right: 0; }
  .stempel { position: static; display: inline-block; transform: rotate(-3deg); padding: 0.15rem 1rem; margin-bottom: 1rem; font-size: 0.85rem; }
}

@media (prefers-reduced-motion: reduce) {
  .bar, .btn { transition: none; }
}

/* Events (arrangementer.php) */
.arrangement-fakta { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1.2rem; margin: 1rem 0; }
.arrangement-fakta dt { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); text-transform: uppercase; padding-top: 0.15rem; }
.arrangement-fakta dd { margin: 0; }
.arrangement-beskrivelse { background: var(--surface); border-left: 4px solid var(--bar); padding: 0.8rem 1rem; }
.svarvalg { border: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.svaroversikt { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 1rem; }
.svaroversikt h3 { font-size: 1rem; margin: 0 0 0.4rem; }
.svaroversikt ul { margin: 0; padding-left: 1.1rem; }
.inviter-liste { list-style: none; padding: 0.4rem 0.8rem; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: 0.4rem 1rem; max-height: 18rem; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.inviter-liste li[hidden] { display: none; }
.inviter-sok input { width: 100%; max-width: 24rem; }
.radhandlinger { display: flex; gap: 0.8rem; flex-wrap: wrap; margin: 0; }
.tabell tr.ubesvart td { background: var(--warn-bg); }
.merkelapp { font-family: var(--mono); font-size: 0.75rem; border: 1px solid var(--danger); color: var(--danger); padding: 0.05rem 0.4rem; border-radius: 4px; }
@media (max-width: 480px) { .arrangement-fakta { grid-template-columns: 1fr; gap: 0.1rem; } .arrangement-fakta dd { margin-bottom: 0.5rem; } }

/* Date polls (#68) */
.datoforslag { border: 1px solid var(--border); border-radius: var(--radius); padding: 0.8rem 1rem; display: grid; gap: 0.6rem; }
.datoforslag legend { font-weight: 600; padding: 0 0.3rem; }
.datoforslag-rad { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.stemmevalg { border: none; padding: 0; margin: 0; display: grid; gap: 0.2rem; }
.tabell.datoavstemning tr.best td { background: var(--ok-bg); }
.merkelapp-ok { border-color: var(--ok); color: var(--ok-text); }
.mt-liten { margin-top: 1rem; }
@media (max-width: 480px) { .datoforslag-rad { grid-template-columns: 1fr; } }
/* On phones the poll table becomes one card per suggestion, so the choices fit */
@media (max-width: 600px) {
  .tabell.datoavstemning thead { display: none; }
  .tabell.datoavstemning, .tabell.datoavstemning tbody, .tabell.datoavstemning tr, .tabell.datoavstemning td { display: block; }
  .tabell.datoavstemning tr { border-bottom: 1px solid var(--line); padding: 0.4rem 0; }
  .tabell.datoavstemning td { border: none; padding: 0.2rem 0.6rem; }
  .tabell.datoavstemning td:first-child { font-weight: 600; }
  .tabell.datoavstemning td[data-label]::before { content: attr(data-label) ": "; font-family: var(--mono); font-size: 0.75rem; color: var(--muted); text-transform: uppercase; }
  .tabell.datoavstemning .stemmevalg { grid-auto-flow: column; justify-content: start; gap: 0.9rem; margin-top: 0.2rem; }
}

/* Bring list and costs (#69) */
.medbringliste { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: 0.4rem; }
.medbringliste li { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; align-items: baseline; padding: 0.5rem 0.8rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.medbringliste li > span:first-child { font-weight: 600; }
.medbringliste .radhandlinger { margin-left: auto; }
.inline-skjema { max-width: 32rem; }
.kostnadsskjema { margin-top: 1rem; }
.kostnadsskjema summary { cursor: pointer; font-weight: 600; color: var(--link); }
.kostnadsskjema .form { margin-top: 0.8rem; max-width: 32rem; }

/* Calendar subscription (#71) */
.kalenderlenke input { width: 100%; font: inherit; font-family: var(--mono); font-size: 0.85rem; padding: 0.5rem; border: 1px solid var(--border-input); border-radius: var(--radius); background: var(--surface); color: var(--text); }
.kalenderlenke p { margin: 0.4rem 0; }

/* Events, new layout (arrangementer.php): cards, date blocks, answer buttons, side column */
.arr { max-width: 1040px; margin-inline: auto; }
.arr h1 { margin: 0.1rem 0 0; }
.arr h2 { font-size: 1.05rem; margin: 0 0 0.8rem; color: var(--strong); }
.arr .eyebrow { margin: 0; font-size: 0.72rem; }
.arr-kort { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1.1rem 1.25rem; }
.arr-tilbake { margin: 0 0 0.8rem; font-size: 0.92rem; }
.arr-tilbake a { text-decoration: none; }
.arr-knapper { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.arr .btn { border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; }
.arr .btn-sekundaer { margin-top: 0; }

/* Overview */
.arr-hode { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.arr-velger { display: inline-flex; flex-wrap: wrap; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 3px; margin-bottom: 1.2rem; }
.arr-velger a { text-decoration: none; color: var(--muted); padding: 0.35rem 0.9rem; border-radius: 999px; font-size: 0.9rem; }
.arr-velger a.på { background: var(--navy); color: #fff; }
.antall { font-size: 0.75rem; opacity: 0.75; margin-left: 0.15rem; }
.arr-gruppe { font-family: var(--mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 1.2rem 0 0.5rem; }
.arr-liste { display: grid; gap: 0.6rem; }
.arr-rad { display: grid; grid-template-columns: 64px 1fr auto; gap: 1rem; align-items: center; text-decoration: none; color: inherit; padding: 0.85rem 1rem; transition: border-color 0.15s; }
.arr-rad:hover { border-color: var(--border-input); }
.arr-rad.venter { border-left: 4px solid var(--accent); }
.arr-rad.avlyst { opacity: 0.65; }
.arr-rad.avlyst h3 { text-decoration: line-through; }
.arr-rad h3 { margin: 0 0 0.15rem; font-size: 1.05rem; color: var(--strong); }
.arr-meta { margin: 0; font-size: 0.88rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 0.2rem 0.9rem; }
.arr-rad-side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.45rem; }
.arr-folk { display: flex; align-items: center; gap: 0.4rem; font-size: 0.82rem; }
.avatarer { display: flex; padding-left: 7px; }
.avatarer .av { margin-left: -7px; border: 2px solid var(--surface); }
.arr-tom { padding: 1.5rem 0; }
.arr-fot { margin-top: 1.5rem; }
@media (max-width: 560px) {
  .arr-rad { grid-template-columns: 52px 1fr; gap: 0.8rem; }
  .arr-rad-side { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; }
}

/* Date block */
.arr-dato { display: grid; text-align: center; background: var(--info-bg); border-radius: 10px; padding: 0.35rem 0 0.45rem; line-height: 1.1; }
.arr-dato .m { font-family: var(--mono); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.arr-dato .d { font-size: 1.5rem; font-weight: 700; color: var(--strong); }
.arr-dato .w { font-size: 0.7rem; color: var(--muted); }
.arr-dato.stor { padding: 0.55rem 0 0.7rem; } .arr-dato.stor .d { font-size: 2rem; }

/* Pills and name badges */
.pill { display: inline-block; font-size: 0.78rem; font-weight: 600; padding: 0.15rem 0.65rem; border-radius: 999px; white-space: nowrap; }
.pill-ok { background: var(--ok-bg); color: var(--ok-text); }
.pill-vent { background: var(--warn-bg); color: var(--warn-text); }
.pill-info { background: var(--info-bg); color: var(--link); }
.pill-av, .pill-off { background: var(--danger-bg); color: var(--danger-text); }
.av { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-size: 0.66rem; font-weight: 700; color: #fff; flex: none; letter-spacing: 0; }
.av-1 { background: #5b7bd5; } .av-2 { background: #c97a52; } .av-3 { background: #3f9a70; }
.av-4 { background: #9a5bd0; } .av-5 { background: #b8932c; } .av-6 { background: #cc5577; }

/* Event page */
.arr-oppsett { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 1.2rem; align-items: start; }
.arr-hoved, .arr-side { display: grid; gap: 1rem; min-width: 0; }
@media (max-width: 860px) { .arr-oppsett { grid-template-columns: minmax(0, 1fr); } }
.arr-topp { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 1.1rem; }
.arr-topp.avlyst h1 { text-decoration: line-through; }
.arr-fakta { display: flex; flex-wrap: wrap; gap: 0.3rem 1.4rem; margin: 0.6rem 0 0; }
.arr-fakta dt { font-family: var(--mono); font-size: 0.7rem; text-transform: uppercase; color: var(--muted); }
.arr-fakta dd { margin: 0; font-weight: 600; }
.arr-beskrivelse { grid-column: 1 / -1; margin: 0; padding-top: 0.9rem; border-top: 1px solid var(--line); }
@media (max-width: 560px) { .arr-topp { grid-template-columns: 1fr; } .arr-topp .arr-dato { width: 76px; } }

.svarknapper { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.svarknapp { display: grid !important; justify-items: center; gap: 0.1rem !important; padding: 0.75rem 0.4rem; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-alt); cursor: pointer; font-weight: 600 !important; text-align: center; transition: border-color 0.15s, background 0.15s; }
.svarknapp input { position: absolute; opacity: 0; pointer-events: none; }
.svarknapp .ikon { font-size: 1.2rem; line-height: 1; }
.svarknapp small { color: var(--muted); font-weight: 400; font-size: 0.75rem; }
.svarknapp:hover { border-color: var(--border-input); }
.svarknapp:focus-within { outline: 2px solid var(--link); outline-offset: 2px; }
.svar-yes:has(input:checked) { background: var(--ok-bg); border-color: var(--ok); color: var(--ok-text); }
.svar-maybe:has(input:checked) { background: var(--info-bg); border-color: var(--link); }
.svar-no:has(input:checked) { background: var(--danger-bg); border-color: var(--danger); color: var(--danger-text); }
.svar-begrunnelse[hidden], .svar-gjester[hidden] { display: none !important; }
@media (max-width: 420px) { .svarknapp small { display: none; } }

.arr-fanerad { display: flex; gap: 0.2rem; margin: -0.4rem -1.25rem 1rem; padding: 0 1rem; border-bottom: 1px solid var(--line); overflow-x: auto; }
.arr-fanerad a { padding: 0.6rem 0.7rem; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-size: 0.92rem; }
.arr-fanerad a.på { color: var(--strong); border-color: var(--accent); font-weight: 600; }
.arr-faner.js .arr-panel-tittel { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.arr-faner.js .arr-panel[hidden] { display: none; }
.arr-panel + .arr-panel { margin-top: 1.5rem; }
.arr-faner.js .arr-panel + .arr-panel { margin-top: 0; }
.arr .svaroversikt { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.arr .svaroversikt h3 { font-family: var(--mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 0 0 0.4rem; }
.navnebrikker { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.brikke { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; padding: 0.2rem 0.75rem 0.2rem 0.2rem; border-radius: 999px; background: var(--bg-alt); border: 1px solid var(--line); font-size: 0.9rem; }
.brikke .av { width: 24px; height: 24px; }
.brikke q { color: var(--muted); font-size: 0.82rem; quotes: none; }
.arr .medbringliste li { background: var(--bg-alt); border-color: var(--line); }
.arr-legg-til { display: flex; gap: 0.5rem; margin-top: 0.8rem; max-width: none; }
.arr-legg-til input { flex: 1; min-width: 0; }

.arr-stolpe { display: flex; height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; margin-bottom: 0.6rem; }
.arr-stolpe i { display: block; height: 100%; }
.arr-stolpe .ja { background: var(--ok); } .arr-stolpe .kanskje { background: var(--link); opacity: 0.55; } .arr-stolpe .nei { background: var(--danger); opacity: 0.55; }
.arr-tall { margin: 0; }
.arr-tall div { display: flex; justify-content: space-between; gap: 0.8rem; padding: 0.35rem 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.arr-tall div:last-child { border-bottom: 0; }
.arr-tall dd { margin: 0; font-weight: 600; text-align: right; }
.arr-lenker { display: grid; gap: 0.5rem; }
.arr-lenker .btn { justify-content: center; text-align: center; }
.arr-lenker p { margin: 0; }
.arr-verktoy summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.arr-verktoy summary::-webkit-details-marker { display: none; }
.arr-verktoy summary::after { content: "▾"; color: var(--muted); }
.arr-verktoy summary h2 { margin: 0; }
.arr-meny { display: grid; gap: 2px; margin-top: 0.7rem; }
.arr-meny a { display: flex; gap: 0.55rem; align-items: baseline; padding: 0.45rem 0.5rem; border-radius: 8px; text-decoration: none; color: var(--text); font-size: 0.92rem; }
.arr-meny a:hover { background: var(--bg-alt); }
.arr-meny-skjema { display: grid; gap: 0.4rem; justify-items: start; margin-top: 0.5rem; padding: 0.5rem 0.5rem 0; border-top: 1px solid var(--line); }

.arr-verktoy-skjema { margin-top: 1.2rem; display: grid; gap: 0; padding: 0; }
.arr-verktoy-skjema > details { padding: 0.9rem 1.25rem; border-top: 1px solid var(--line); }
.arr-verktoy-skjema > details:first-child { border-top: 0; }
.arr-verktoy-skjema > details > summary { cursor: pointer; font-weight: 600; color: var(--strong); }
.arr-verktoy-skjema > details[open] > summary { margin-bottom: 0.8rem; }
.arr-verktoy-skjema .inviter-liste .av { width: 22px; height: 22px; }

.arr-skjema { max-width: 640px; }
.arr-mer summary { cursor: pointer; font-weight: 600; color: var(--link); }
.arr-mer-innhold { display: grid; gap: 1rem; margin-top: 0.8rem; }
.arr-kalender { max-width: 640px; }

/* Bring list: assigned items and «Kjøpt/ordnet» */
.arr .medbringliste li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.4rem 1rem; align-items: center; }
.arr .medbringliste .ting { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.8rem; }
.arr .medbringliste .ting-navn { font-weight: 600; }
.arr .medbringliste .ting-hvem { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--muted); font-size: 0.88rem; }
.arr .medbringliste .ting-hvem .av { width: 22px; height: 22px; }
.arr .medbringliste .radhandlinger { margin-left: 0; justify-content: flex-end; align-items: center; }
.arr .medbringliste li.ordnet .ting-navn { color: var(--muted); }
.arr .medbringliste .hake { color: var(--ok); }
.ting-fordel { grid-column: 1 / -1; display: flex; gap: 0.5rem; align-items: center; font-size: 0.88rem; }
.ting-fordel select { font: inherit; font-size: 0.88rem; padding: 0.25rem 0.4rem; border: 1px solid var(--border-input); border-radius: 8px; background: var(--surface); color: var(--text); max-width: 60%; }
@media (max-width: 560px) { .arr .medbringliste li { grid-template-columns: 1fr; } .arr .medbringliste .radhandlinger { justify-content: flex-start; } }
