/* Design tokens from demo/index.html (the design guide, see PLAN.md). Move to a shared stylesheet when the real design work starts. */
:root {
  --brand: #3652a3;
  --brand-dark: #263a7a;
  --accent: #3498db;
  --tint: #deeffc;
  --ink: #1c2540;
  --muted: #5d6785;
  --line: #dbe3f0;
  --bg: #f5f8fc;
  --card: #ffffff;
  --ok: #1e8e4e;
  --warn: #b94a48;
  --radius: 12px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
header.main { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; max-height: 100vh; max-height: 100dvh; overflow-y: auto; }
html { scroll-padding-top: 80px; }
header.main .wrap { display: flex; align-items: center; min-height: 64px; }
.brand { color: var(--brand); font-weight: 700; font-size: 18px; }

/* Member bar and main menu (public site), as in demo/index.html */
.topbar { background: var(--brand-dark); color: #fff; font-size: 14px; }
.topbar .wrap { display: flex; justify-content: flex-end; gap: 16px; padding: 6px 16px; align-items: center; flex-wrap: wrap; }
.topbar a, .topbar .btn-link { color: #fff; opacity: .9; }
.topbar a:hover, .topbar .btn-link:hover { opacity: 1; }
.topbar .who { font-weight: 600; opacity: 1; }
.topbar form { margin: 0; }
header.main nav { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
header.main nav a { padding: 8px 12px; border-radius: 8px; color: var(--ink); font-weight: 500; }
header.main nav a:hover, header.main nav a.active { background: var(--tint); color: var(--brand-dark); text-decoration: none; }
.brand { display: flex; align-items: center; gap: 12px; }
.nav-toggle { display: none; flex-direction: column; justify-content: center; gap: 5px; padding: 11px 10px; background: #fff; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--ink); border-radius: 1px; }
.nav-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.brand img { height: 52px; width: auto; }

/* Label/value list, used for the member's own details */
.card-title { margin-top: 0; }
dl.details { display: grid; grid-template-columns: minmax(130px, 220px) 1fr; gap: 6px 16px; margin: 0 0 12px; }
dl.details dt { color: var(--muted); }
dl.details dd { margin: 0; overflow-wrap: anywhere; }

/* Shared pieces: login partial, forms, messages */
header.main .wrap { justify-content: space-between; gap: 16px; }
.account { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.account form { margin: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .55em; line-height: 1.3; vertical-align: middle; padding: 9px 18px; border-radius: 999px; font-weight: 600; border: 2px solid transparent; cursor: pointer; font-size: 15px; background: var(--brand); color: #fff; }
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn-link { background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; font: inherit; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 24px 0; max-width: 460px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; margin-bottom: 4px; }
/* Every kind of text field looks the same, so phone, date, number, search and the filled-in town match the rest */
input:where(:not([type=checkbox], [type=radio], [type=hidden], [type=file], [type=submit], [type=button], [type=range], .cal-native)),
select, textarea { box-sizing: border-box; min-height: 42px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; line-height: 1.4; }
.field input:where(:not([type=checkbox], [type=radio], [type=hidden], [type=file], [type=submit], [type=button], [type=range], .cal-native)) { width: 100%; }
/* Drawn by us rather than the browser, so Safari gives selects the same height and font as the text fields */
select { -webkit-appearance: none; appearance: none; height: 42px; padding-right: 36px; background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235d6785' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; }
input:where(:not([type=checkbox], [type=radio], [type=hidden], [type=file], [type=submit], [type=button], [type=range], .cal-native)) { height: 42px; }
.field-error, .msg-error { color: var(--warn); font-size: 14px; }
.msg-ok { color: var(--ok); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 16px 0; }
.toolbar input[type=text], .toolbar input[type=search] { min-width: 260px; }
.table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.table th, .table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.pager { display: flex; gap: 12px; align-items: center; }
fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.field { border: 1px solid var(--line); border-radius: 8px; }

/* Buttons beyond the primary one */
.btn-light { background: #fff; color: var(--brand); border-color: var(--brand); }
.btn-light:hover { background: var(--tint); }
.btn-outline { background: transparent; border-color: #fff; color: #fff; }
.btn-outline:hover { background: rgba(255,255,255,.15); }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-danger { background: #fff; color: var(--warn); border-color: var(--warn); }
.btn-danger:hover { background: #fbeeee; }

/* Hero with the next event (from demo/index.html) */
.hero { background: linear-gradient(135deg, var(--brand) 0%, var(--accent) 100%); color: #fff; }
.hero .wrap { display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; align-items: center; padding-top: 48px; padding-bottom: 48px; }
.hero h1 { font-size: 38px; line-height: 1.15; margin: 0 0 12px; }
.hero p { font-size: 18px; margin: 0 0 24px; opacity: .95; max-width: 52ch; }
.hero .actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-card { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.35); border-radius: var(--radius); padding: 20px; }
.hero-card h3 { margin: 0 0 4px; font-size: 15px; font-weight: 600; opacity: .9; }
.hero-card .next { font-size: 22px; font-weight: 700; margin: 4px 0; }
.hero-card .meta { opacity: .9; font-size: 15px; margin-bottom: 14px; }
main.wrap.flow { display: block; padding-top: 32px; padding-bottom: 48px; }
h2 { font-size: 22px; margin: 0 0 14px; color: var(--brand-dark); }
h2 small { font-weight: 400; font-size: 14px; margin-left: 8px; }

/* Event list */
.card.flush { padding: 0; max-width: none; margin: 0 0 24px; }
.events { list-style: none; margin: 0; padding: 0; }
.events li { display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.events li:last-child { border-bottom: 0; }
.events li:hover { background: #fafcff; }
.events a.row-link { color: inherit; display: contents; }
.events a.row-link:hover { text-decoration: none; }
.date { background: var(--tint); color: var(--brand-dark); border-radius: 10px; text-align: center; padding: 6px 0; line-height: 1.1; }
.date b { display: block; font-size: 22px; }
.date span { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.ev-title { font-weight: 600; }
.ev-meta { color: var(--muted); font-size: 14px; }
.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; margin-left: 6px; vertical-align: middle; }
.chip.spin { background: #e7ecfa; color: var(--brand-dark); }
.chip.run { background: #dff3e8; color: #17653a; }
.chip.cycle { background: #fdeed9; color: #8a5a12; }
.chip.other { background: #eef0f4; color: #444; }
.spots { text-align: right; font-size: 13px; color: var(--muted); }
.spots strong { display: block; font-size: 16px; color: var(--ok); }
.spots strong.low { color: #c77a00; }
.spots strong.closed { color: var(--warn); }
.joined { color: var(--ok); font-weight: 600; font-size: 13px; margin-left: 6px; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tab { padding: 6px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-size: 14px; color: var(--ink); }
.tab:hover { text-decoration: none; background: var(--tint); }
.tab.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* Event page */
.card.wide { max-width: 720px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 12px 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.notice { background: var(--tint); border-radius: 8px; padding: 10px 14px; margin: 12px 0; }
.notice.ok { background: #e3f4ea; color: #17653a; }
.notice.warn { background: #fbeeee; color: var(--warn); }
.field select, .field textarea { width: 100%; background-color: #fff; }
input:read-only:not([type=file]), input:disabled { background: var(--tint, #f3f6f8); }

@media (max-width: 860px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .hero h1 { font-size: 30px; }
  .events li { grid-template-columns: 56px 1fr; }
  .spots { grid-column: 2; text-align: left; }
  header.main .wrap { flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }

  /* Burger menu: only when JavaScript is there to open it (menu.js sets .js on <html>). */
  .js .nav-toggle { display: inline-flex; }
  .js header.main nav { display: none; flex-basis: 100%; margin-left: 0; flex-direction: column; gap: 0; padding-top: 4px; }
  .js header.main nav.open { display: flex; }
  header.main nav a { padding: 12px; }
}

/* Admin */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.hint { color: var(--muted); font-size: 13px; margin: 2px 0 0; }
.badge { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: #eef0f4; color: #444; }
.badge.ok { background: #e3f4ea; color: #17653a; }
.badge.warn { background: #fbeeee; color: var(--warn); }
.field textarea { min-height: 80px; }
.inline-form { display: inline; }
.table td.num, .table th.num { text-align: right; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } }

/* News, afdeling pages and rendered Markdown */
.news article { padding: 16px; border-bottom: 1px solid var(--line); }
.news article:last-child { border-bottom: 0; }
.news time { color: var(--muted); font-size: 13px; }
.news h3 { margin: 2px 0 4px; font-size: 17px; }
.news p { margin: 0 0 6px; color: var(--muted); font-size: 15px; }
.news-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.news-meta .chip { margin-left: 0; }
.prose { line-height: 1.6; }
.prose h1 { font-size: 28px; margin: 4px 0 8px; color: var(--brand-dark); }
.prose h2, .prose h3 { color: var(--brand-dark); }
.prose .lead { font-size: 18px; color: var(--muted); }
.prose img { max-width: 100%; }
.attachments { padding-left: 20px; }
.sections { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.card.sec { margin: 0; max-width: none; text-align: center; font-weight: 600; color: var(--brand-dark); }
.card.sec:hover { background: var(--tint); text-decoration: none; }

/* Version comparison */
.diff { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 0; margin-bottom: 24px; }
.diff-line { padding: 1px 12px; white-space: pre-wrap; }
.diff-add { background: #e3f4ea; }
.diff-del { background: #fbeeee; text-decoration: line-through; color: var(--warn); }
.diff-mark { display: inline-block; width: 1.5em; color: var(--muted); user-select: none; }

/* Group page: two lists to drag members between */
.mgr { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 12px 0; }
.mgr .panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.mgr .panel.over { outline: 2px dashed var(--accent); background: var(--tint); }
.mgr h3 { margin: 0 0 8px; }
.mgr ul.members { list-style: none; margin: 0 0 12px; padding: 0; max-height: 420px; min-height: 90px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
.mgr li { display: flex; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--line); cursor: grab; }
.mgr li:last-child { border-bottom: 0; }
.mgr li.fixed { cursor: default; color: var(--muted); }
.mgr li.selected { background: var(--tint); }
.mgr li label { display: block; flex: 1; min-width: 0; cursor: inherit; }
.mgr li a.open { margin-left: auto; padding-left: 10px; font-size: 13px; }
.mgr li small { color: var(--muted); margin-left: 6px; }
@media (max-width: 860px) { .mgr { grid-template-columns: 1fr; } }

/* Front page, as in demo/index.html */
.home { display: grid; grid-template-columns: 2fr 1fr; gap: 28px; }
.home section.block { margin-bottom: 32px; }
.home .more { margin: 10px 0 0; }
.home .tabs { margin-bottom: 12px; }
.sec .ico { font-size: 28px; display: block; margin-bottom: 4px; }
.home aside .card { max-width: none; margin: 0 0 20px; padding: 18px; }
.home aside h3 { margin: 0 0 8px; color: var(--brand-dark); }
.home aside .logo { text-align: center; }
.home aside .logo img { max-width: 170px; }
.home aside .note { margin: 0 0 8px; font-size: 14px; color: var(--muted); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.stat { background: var(--tint); border-radius: 10px; padding: 10px; text-align: center; }
.stat b { display: block; font-size: 22px; color: var(--brand-dark); }
.stat span { font-size: 12px; color: var(--muted); }
footer { background: var(--brand-dark); color: #dbe3f0; margin-top: 24px; }
footer .wrap { padding: 28px 16px; display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 24px; font-size: 14px; }
footer a { color: #fff; }
footer h4 { margin: 0 0 6px; color: #fff; }
@media (max-width: 860px) {
  .home, footer .wrap { grid-template-columns: 1fr; }
}

/* Sign-up form: the robot trap is off the page, not hidden with display:none (some robots skip those) */
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
details.terms { margin: 0 0 14px; }
details.terms summary { cursor: pointer; font-weight: 600; }
.notice ul { margin: 6px 0 0; padding-left: 20px; }

/* Who has booked an event, and the member's own groups */
ol.attendees { columns: 2; column-gap: 24px; padding-left: 22px; margin: 0 0 12px; }
ol.attendees li { break-inside: avoid; padding: 2px 0; }
ul.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; }
@media (max-width: 560px) { ol.attendees { columns: 1; } }
ul.afdeling-choices { list-style: none; margin: 0; padding: 0; }
ul.afdeling-choices li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 8px 0; border-top: 1px solid var(--line); }
ul.afdeling-choices li:first-child { border-top: 0; }
ul.afdeling-choices .name { font-weight: 600; min-width: 160px; }
ul.afdeling-choices form { margin: 0; }

/* Alert for approvers in the back office's top bar */
.topbar a.alert-pill { background: #c62828; color: #fff; opacity: 1; font-weight: 700; padding: 3px 12px; border-radius: 999px; margin-right: auto; text-decoration: none; }
.topbar a.alert-pill:hover { background: #b71c1c; text-decoration: none; }

/* A form that is only read until "Rediger" is pressed */
[data-edit-section] fieldset:disabled input:not(.cal-native),
[data-edit-section] fieldset:disabled select { border-color: transparent; background-color: transparent; background-image: none; color: inherit; -webkit-text-fill-color: currentColor; opacity: 1; padding-left: 0; padding-right: 0; }
[data-edit-section] .actions { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
[data-edit-section] [hidden] { display: none; }

/* Min side: tiles that float into as many columns as the width allows */
.account-grid { column-width: 320px; column-gap: 24px; }
/* Spacing is padding, never margin, and nothing in a column starts with a margin: Safari and Chrome treat margins at the top of a
   column differently, which left the columns starting at different heights. */
.account-grid > .tile-col, .account-grid > .card {
  display: inline-block; width: 100%; vertical-align: top; margin: 0;
  -webkit-column-break-inside: avoid; page-break-inside: avoid; break-inside: avoid-column;
}
.account-grid > .tile-col { padding: 0 0 24px; }
.account-grid .card { max-width: none; margin: 0; }
.account-grid .tile-col > :first-child, .account-grid .card > :first-child { margin-top: 0; }

/* Date with a calendar button, and a 24-hour time beside it */
.datetime { display: flex; gap: 8px; align-items: stretch; }
.datetime .date-input { flex: 1 1 auto; }
.datetime .time-input { flex: 0 0 6.5em; }
.date-input { position: relative; display: block; }
.date-input input[data-date-text], .time-input input { width: 100%; }
.date-input input[data-date-text] { padding-right: 44px; }
.cal-btn { position: absolute; top: 0; right: 0; height: 100%; width: 42px; display: flex; align-items: center; justify-content: center; background: none; border: 0; color: var(--brand); cursor: pointer; border-radius: 0 8px 8px 0; }
.cal-btn:hover, .cal-btn:focus-visible { background: var(--tint); }
.cal-btn:disabled { color: var(--muted); cursor: default; background: none; }
.cal-native { position: absolute; right: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; min-height: 0; clip-path: inset(50%); overflow: hidden; }
[data-edit-section] fieldset:disabled .cal-btn { display: none; }
[data-edit-section] fieldset:disabled .date-input input[data-date-text] { padding-right: 0; }

/* A field that has a red notice */
input.input-validation-error, select.input-validation-error, textarea.input-validation-error,
input.invalid, select.invalid, textarea.invalid { border-color: var(--warn); }

/* A choice list with a button beside it */
.inline-row { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.inline-row select { flex: 1 1 220px; width: auto; min-width: 0; }
.inline-row .btn { flex: 0 0 auto; white-space: nowrap; align-self: center; }
.inline-row .btn-light { border-color: var(--brand); }


/* ===== Icons and the top line ===== */
.icon { width: 1.25em; height: 1.25em; flex: none; vertical-align: -.25em; }
/* Anything that has an icon first lines it up with its text */
a:has(> .icon), button:has(> .icon), .ev-meta:has(> .icon), h2:has(> .icon), h3:has(> .icon) { display: inline-flex; align-items: center; gap: .5em; }
a:has(> .icon), button:has(> .icon) { vertical-align: middle; }
.ev-meta:has(> .icon) { display: flex; gap: .4em; }
.ev-meta .icon { width: 1em; height: 1em; opacity: .8; }
.btn:has(> .icon) { gap: .55em; }
.btn .icon { width: 1.15em; height: 1.15em; }
.btn-sm .icon { width: 1.05em; height: 1.05em; }
.tab:has(> .icon) .icon { width: 1em; height: 1em; }
.home .more a .icon { transition: transform .15s; }
.home .more a:hover .icon { transform: translateX(3px); }
@media (prefers-reduced-motion: reduce) { .home .more a:hover .icon { transform: none; } }

/* The strip at the very top: who is signed in, and the quick ways to their own things */
.topbar { font-size: 14px; }
.topbar .wrap { gap: 0; padding: 0 16px; min-height: 40px; }
.topbar .wrap > * { display: inline-flex; align-items: center; gap: .5em; padding: 8px 14px; }
.topbar .wrap > * + * { border-left: 1px solid rgba(255,255,255,.16); }
.topbar .wrap > :last-child { padding-right: 0; }
.topbar .inline-form { padding: 0 0 0 14px; }
.topbar .inline-form .btn-link { padding: 8px 0; }
.topbar a, .topbar .btn-link { opacity: .92; }
.topbar a:hover, .topbar .btn-link:hover { opacity: 1; text-decoration: none; }
.topbar a:hover { background: rgba(255,255,255,.07); }
.topbar .icon { width: 1.15em; height: 1.15em; opacity: .85; }
.topbar .who { font-weight: 600; opacity: 1; }
.avatar { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: rgba(255,255,255,.18); }
.avatar .icon { width: 14px; height: 14px; opacity: 1; }
.topbar a.alert-pill { gap: .5em; }
.topbar a.alert-pill .icon { opacity: 1; animation: bell-ring 1.4s ease-in-out 1 .4s; transform-origin: 50% 0; }
@keyframes bell-ring { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(14deg); } 30% { transform: rotate(-12deg); } 45% { transform: rotate(8deg); } 60% { transform: rotate(-5deg); } }
@media (prefers-reduced-motion: reduce) { .topbar a.alert-pill .icon { animation: none; } }

/* The main menu */
header.main nav a { display: inline-flex; align-items: center; gap: 8px; }
header.main nav a .icon { color: var(--brand); opacity: .75; }
header.main nav a:hover .icon, header.main nav a.active .icon { opacity: 1; }
header.main nav a.active { font-weight: 600; }

/* Back office: icon above the word, so eight places fit on one line */
.admin-nav { gap: 2px; flex-wrap: nowrap; }
.admin-nav a { flex-direction: column; gap: 3px; padding: 9px 11px 8px; min-width: 82px; text-align: center; font-size: 13px; line-height: 1.2; border-radius: 10px; position: relative; }
.admin-nav a .icon { width: 22px; height: 22px; }
.admin-nav a.active { background: var(--tint); }
.admin-nav a.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -9px; height: 3px; border-radius: 3px 3px 0 0; background: var(--brand); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text small { font-size: 12px; font-weight: 500; color: var(--muted); }
header.main .brand img { height: 46px; }

/* The front page of the back office */
.tiles { gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card.tile { margin: 0; max-width: none; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 16px 16px 16px 16px; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.card.tile:hover { border-color: var(--brand); box-shadow: 0 6px 18px rgba(38,58,122,.10); text-decoration: none; }
.card.tile:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.tile-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: var(--tint); color: var(--brand); }
.tile-icon .icon { width: 26px; height: 26px; }
.tile-text { display: block; min-width: 0; }
.tile-text strong { display: block; color: var(--brand-dark); font-size: 17px; margin-bottom: 2px; }
.tile-text span { display: block; color: var(--muted); font-size: 14px; line-height: 1.35; }
.card.tile > .icon { color: var(--muted); opacity: .45; width: 20px; height: 20px; transition: transform .15s, opacity .15s; }
.card.tile:hover > .icon { opacity: 1; color: var(--brand); transform: translateX(2px); }
.card.tile:hover .tile-icon { background: var(--brand); color: #fff; }

/* Messages get an icon that says what kind they are */
.msg-ok, .msg-error { display: flex; align-items: flex-start; gap: .5em; }
.msg-ok::before, .msg-error::before, .notice::before { content: ""; flex: none; width: 1.25em; height: 1.25em; margin-top: .1em; background: currentColor;
  -webkit-mask: var(--glyph) center / contain no-repeat; mask: var(--glyph) center / contain no-repeat; }
.msg-ok { --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m8.5 12.5 2.5 2.5 4.5-5'/%3E%3C/svg%3E"); }
.msg-error { --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3.5 2.5 20h19z'/%3E%3Cpath d='M12 10v4.5M12 17.5h.01'/%3E%3C/svg%3E"); }
.notice { display: flex; align-items: flex-start; gap: .6em; --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5M12 8h.01'/%3E%3C/svg%3E"); }
.notice.ok { --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m8.5 12.5 2.5 2.5 4.5-5'/%3E%3C/svg%3E"); }
.notice.warn { --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3.5 2.5 20h19z'/%3E%3Cpath d='M12 10v4.5M12 17.5h.01'/%3E%3C/svg%3E"); }
.notice > ul { margin: 6px 0 0; }
.notice > strong + ul { display: block; }
.field-error { display: block; }

/* Small screens: the strip keeps only icons for its links, and the menus read as lists */
@media (max-width: 640px) {
  .topbar .wrap > * { padding: 8px 10px; }
  .topbar .wrap > a:not(.who):not(.alert-pill) { font-size: 0; gap: 0; }
  .topbar .wrap > a:not(.who):not(.alert-pill) .icon { width: 20px; height: 20px; }
}
@media (max-width: 860px) {
  .admin-nav { flex-wrap: wrap; }
  .admin-nav a { flex-direction: row; justify-content: flex-start; gap: 10px; min-width: 0; text-align: left; font-size: 16px; }
  .admin-nav a .icon { width: 20px; height: 20px; }
  .admin-nav a.active::after { display: none; }
}

h2:has(> .icon) .icon, h3:has(> .icon) .icon { color: var(--brand); width: 1.15em; height: 1.15em; }
.hero-card h3 .icon { color: inherit; }
.pager.past, #past-pager { flex-wrap: wrap; justify-content: space-between; margin: 12px 0 6px; font-size: 14px; color: var(--muted); }

/* A tile whose list runs edge to edge keeps its heading and footer padded like the other tiles */
.card.flush > .card-head { display: flex; margin: 0; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); }
.card.flush > .card-foot { padding: 12px 20px 16px; border-top: 1px solid var(--line); }
.card.flush > .card-foot > p { margin: 0; max-width: none; }
.card.flush > .card-foot > .pager { margin: 0 0 8px; }
.account-grid .tile-col > .card > h2:first-child, .account-grid .card > h2.card-title { margin-top: 0; }

/* Min side: moving the tiles around */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; margin-bottom: 4px; }
.page-head h1 { margin: 0; }
.tile-controls { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; }
.tile-controls .hint { margin: 0; }
.tile-controls .inline-form { margin: 0; }
.btn-light[aria-pressed="true"] { background: var(--brand); color: #fff; border-color: var(--brand); }
.tile-tools { display: flex; align-items: center; gap: 6px; padding: 5px 8px; margin: 0 0 8px; background: var(--tint); border: 1px dashed var(--brand); border-radius: 10px; color: var(--brand-dark); font-size: 14px; font-weight: 600; }
.tile-tools[hidden] { display: none; }
.tile-tools-title { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.tile-tools button { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; background: #fff; color: var(--brand); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.tile-tools button:hover { border-color: var(--brand); }
.tile-tools button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.tile-grip { cursor: grab; }
.tile-grip:active { cursor: grabbing; }
.arranging .account-grid > [data-tile] { outline: 2px dashed transparent; outline-offset: 6px; transition: outline-color .15s; }
.arranging .account-grid > [data-tile]:hover { outline-color: var(--line); }
.account-grid > [data-tile].dragging { opacity: .45; }
ul.afdeling-choices .motion-price { flex-basis: 100%; margin: 0; }

/* A group of tick boxes laid out in as many columns as fit, instead of one long list */
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px 20px; }
.check-grid label { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 400; }
fieldset.field > legend { font-weight: 600; padding: 0 6px; }

/* File library (back office) and pictures on the public pages */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.media-card { display: flex; flex-direction: column; gap: 4px; padding: 10px; text-align: left; font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
button.media-card:hover { background: var(--tint); }
.media-card img, .media-card .media-ext { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: var(--bg); }
.media-card .media-ext { display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 22px; color: var(--brand-dark); background: var(--tint); }
.media-card .media-name { font-weight: 600; overflow-wrap: anywhere; }
.media-card form { margin: 0; }
.media-card .media-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.media-card input[type=text] { width: 100%; min-height: 36px; padding: 5px 8px; }
.media-card .media-url { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.media-dialog { width: min(920px, calc(100vw - 32px)); max-height: calc(100vh - 48px); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; color: var(--ink); }
.media-dialog::backdrop { background: rgba(28, 37, 64, .45); }
.media-dialog-head { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.media-dialog-head h2 { margin: 0; font-size: 18px; flex: none; }
.media-dialog-head input { flex: 1; min-width: 0; }
.media-field .media-current { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.media-field img { width: 120px; height: 90px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.upload-form { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.hero-image { display: block; width: 100%; max-height: 420px; object-fit: cover; border-radius: var(--radius); margin: 0 0 16px; }
.news article.has-image { display: grid; grid-template-columns: 160px 1fr; gap: 0 14px; }
/* The whole picture is shown (contain), not a cropped part: banners with text on them lose their edges when cropped. */
.news article.has-image > img { grid-row: 1 / span 4; width: 160px; height: 90px; object-fit: contain; background: var(--bg); border-radius: 8px; }
@media (max-width: 560px) { .news article.has-image { grid-template-columns: 112px 1fr; } .news article.has-image > img { width: 112px; height: 63px; } }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.news article.has-image > :not(img) { grid-column: 2; }
.lightbox { width: min(1100px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 12px; border: 0; border-radius: var(--radius); background: #fff; color: var(--ink); overflow: hidden; }
.lightbox::backdrop { background: rgba(15, 20, 40, .8); }
.lightbox img { display: block; max-width: 100%; max-height: calc(100vh - 130px); margin: 0 auto; border-radius: 8px; }
.lightbox-foot { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-top: 10px; }
.lightbox-caption { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.lightbox-close { position: absolute; top: 12px; right: 12px; }
.lightbox-prev, .lightbox-next { position: absolute; top: 50%; transform: translateY(-50%); font-size: 22px; line-height: 1; padding: 8px 14px; }
.lightbox-prev { left: 12px; }
.lightbox-next { right: 12px; }
.lightbox [hidden] { display: none; }

/* The menu inside the Om section */
.subnav { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1rem; }
.subnav a { padding: .35rem .8rem; border: 1px solid var(--border, #ccd); border-radius: 999px; text-decoration: none; }
.subnav a.active { background: var(--accent, #1d4f91); color: #fff; border-color: transparent; }
