/*
 * Helsefag – stilark
 * Følger VISUELL-PROFIL.md (nasjonal profil for helseforetakene + FNSP, palett for administrative foretak).
 * Endre farger, avstander og skrift i variablene under – ikke rundt i stilarket.
 */

:root {
  /* --- Profilfarger --- */
  --blue-900: #05092e;
  --blue-800: #001b52;
  --blue-700: #003087; /* Mørk blå – profilfarge */
  --blue-profile: #6cace4; /* Lys blå – profilfarge */
  --blue-300: #9ac2ea;
  --blue-200: #c4dbf3;
  --blue-100: #e6f0fa;
  --blue-50: #f3f7fd;
  --bluegrey-800: #27415a;
  --bluegrey-200: #c1cfd7;
  --bluegrey-100: #e0e7eb;
  --sea-100: #ddf7f2;
  --grey-900: #1a1a1a;
  --grey-800: #333333;
  --grey-700: #4d4d4d;
  --grey-200: #e6e6e6;

  /* Meldingsfarger: 700 = tekst, profil = fylt, 200 = kant, 100 = bakgrunn */
  --danger-700: #a52a32;
  --danger: #cb333b;
  --danger-200: #f8bfc3;
  --danger-100: #fce3e5;
  --info-700: #005199;
  --info-200: #cce0f5;
  --info-100: #dcebf9;
  --warn-700: #664800;
  --warn: #ffc845;
  --warn-200: #ffebad;
  --warn-100: #fff2cc;
  --ok-700: #20602e;
  --ok: #48b760;
  --ok-200: #ccebd2;
  --ok-100: #e8f7eb;

  /* --- Semantiske farger --- */
  --color-bg: var(--blue-50);
  --color-surface: #ffffff;
  --color-surface-alt: var(--blue-50);
  --color-text: var(--grey-900);
  --color-text-muted: var(--grey-700);
  --color-primary: var(--blue-700);
  --color-primary-strong: var(--blue-800);
  --color-primary-soft: var(--blue-100);
  --color-primary-muted: var(--blue-200);
  --color-accent: var(--blue-profile);
  --color-border: var(--bluegrey-100);
  --color-border-strong: var(--bluegrey-200);
  --color-field-border: #7a8c99; /* avledet blågrå, 3,5:1 mot hvit */
  --color-link: var(--blue-700);

  /* --- Typografi (FNSP-skala) --- */
  --font-sans: 'Inter', 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  --font-mono: Consolas, 'Cascadia Mono', ui-monospace, monospace;
  --fs-xs: 14px;
  --fs-sm: 16px;
  --fs-md: 18px;
  --fs-ml: 20px;
  --fs-lg: 24px;
  --fs-xl: 28px;
  --fs-xxl: 32px;
  --fs-3xl: 40px;
  --lh-text: 1.5;
  --lh-heading: 1.2;

  /* --- Avstander (8 px-grid) --- */
  --space-3xs: 2px;
  --space-xxs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-xxl: 48px;
  --space-3xl: 64px;
  --space-4xl: 80px;

  /* --- Former --- */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 999px;
  --hairline: 1px;

  /* --- Skygger (blåtonede, fra mørk blå 800) --- */
  --shadow-sm: 0 1px 2px rgb(0 27 82 / 0.06), 0 1px 1px rgb(0 27 82 / 0.04);
  --shadow-md: 0 2px 4px rgb(0 27 82 / 0.05), 0 8px 24px rgb(0 27 82 / 0.07);
  --shadow-lg: 0 8px 16px rgb(0 27 82 / 0.08), 0 24px 56px rgb(0 27 82 / 0.18);
  --focus-ring: 0 0 0 3px var(--blue-200);

  /* --- Sidemeny --- */
  --sidebar-bg: var(--blue-700);
  --sidebar-text: var(--blue-200);
  --sidebar-hover: rgb(255 255 255 / 0.08);
  --sidebar-active: rgb(255 255 255 / 0.14);

  --control-h: 40px;
  --content-max: 1408px;
}

/* Inter (variabel skrift, SIL Open Font License) – ligger lokalt i public/fonts */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/inter-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/inter-latin-ext-wght-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Hårfine linjer på skjermer med høy pikseltetthet («retina») */
@media (min-resolution: 2dppx), (-webkit-min-device-pixel-ratio: 2) {
  :root { --hairline: 0.5px; }
}

/* --- Grunnlag --- */
*, *::before, *::after { box-sizing: border-box; }
html {
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  line-height: var(--lh-text);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
}
body { margin: 0; background: var(--color-bg); }
a { color: var(--color-link); text-decoration: none; text-underline-offset: 2px; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 var(--space-xs); line-height: var(--lh-heading); font-weight: 650; text-wrap: balance; color: var(--color-text); }
h1 { font-size: var(--fs-xxl); letter-spacing: -0.022em; }
h2, h3 { letter-spacing: -0.01em; }
h2 { font-size: var(--fs-ml); }
h3 { font-size: var(--fs-md); }
p { margin: 0 0 var(--space-sm); }
code { font-family: var(--font-mono); background: var(--color-surface-alt); border: var(--hairline) solid var(--color-border); border-radius: 6px; padding: 0 var(--space-xxs); font-size: 0.88em; }
::selection { background: var(--blue-200); }
.muted { color: var(--color-text-muted); }
.small { font-size: var(--fs-xs); }
.prewrap { white-space: pre-wrap; }
.lead { font-size: var(--fs-md); color: var(--color-text-muted); max-width: 70ch; }
.pad { padding: var(--space-sm) var(--space-md); }
.grow { flex: 1; min-width: 0; }
.icon { flex-shrink: 0; vertical-align: -3px; shape-rendering: geometricPrecision; }
.nowrap { white-space: nowrap; }
[hidden] { display: none !important; }
.loading { padding: var(--space-xxl); text-align: center; color: var(--color-text-muted); }
.num, .stat-num, .table td { font-variant-numeric: tabular-nums; }

/* --- Knapper --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-xs);
  min-height: var(--control-h); padding: 0 var(--space-md);
  border-radius: var(--radius-pill); border: 1px solid var(--color-field-border);
  background: var(--color-surface); color: var(--color-text);
  font: inherit; font-weight: 600; line-height: 1; cursor: pointer;
  text-decoration: none !important; white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.05s;
}
.btn:hover { background: var(--color-surface-alt); border-color: var(--color-primary); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--color-primary); border-color: var(--color-primary); color: #fff; box-shadow: var(--shadow-sm); }
.btn.primary:hover { background: var(--color-primary-strong); border-color: var(--color-primary-strong); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.danger { color: var(--danger-700); }
.btn.ghost.danger:hover { background: var(--danger-100); border-color: transparent; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: var(--control-h); height: var(--control-h);
  border-radius: var(--radius-pill); border: 0; background: transparent; color: var(--color-text-muted);
  cursor: pointer; position: relative; font-size: var(--fs-ml); transition: background-color 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--color-primary-soft); color: var(--color-primary); }
.link { border: 0; background: none; color: var(--color-link); cursor: pointer; font: inherit; padding: 0; display: inline-flex; align-items: center; gap: var(--space-xxs); }
.link:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* --- Skjema --- */
input, select, textarea {
  font: inherit; color: inherit; width: 100%;
  min-height: var(--control-h); padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--color-field-border); border-radius: var(--radius-sm);
  background: var(--color-surface); transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { min-height: auto; resize: vertical; line-height: var(--lh-text); }
select { padding-right: var(--space-xl); }
input::placeholder, textarea::placeholder { color: #6b7780; }
input:hover, select:hover, textarea:hover { border-color: var(--grey-800); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--color-primary); box-shadow: var(--focus-ring); }
textarea.mono { font-family: var(--font-mono); font-size: var(--fs-xs); }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; min-height: 0; padding: 0; accent-color: var(--color-primary); flex-shrink: 0; }
.field { display: flex; flex-direction: column; gap: var(--space-xxs); margin-bottom: var(--space-md); }
.field > span { font-weight: 600; font-size: var(--fs-xs); }
.field small { color: var(--color-text-muted); font-size: var(--fs-xs); line-height: 1.35; }
.check-field { display: flex; align-items: center; gap: var(--space-xs); margin: var(--space-xs) 0 var(--space-sm); cursor: pointer; }
.box { border: var(--hairline) solid var(--color-border-strong); border-radius: var(--radius-md); padding: var(--space-sm) var(--space-md) var(--space-xxs); margin: 0 0 var(--space-md); }
.box legend { font-weight: 600; font-size: var(--fs-xs); padding: 0 var(--space-xs); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--space-md); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 var(--space-md); }
.grid-2.top { align-items: start; gap: var(--space-md); }

/* --- Innlogging --- */
.auth-page {
  min-height: 100vh; display: grid; place-items: center; padding: var(--space-md);
  background:
    radial-gradient(circle at 12% 18%, var(--blue-200) 0 140px, transparent 141px),
    radial-gradient(circle at 88% 82%, var(--blue-100) 0 220px, transparent 221px),
    radial-gradient(circle at 80% 14%, var(--sea-100) 0 70px, transparent 71px),
    var(--blue-50);
}
.auth-card { width: 100%; max-width: 420px; background: var(--color-surface); border-radius: var(--radius-xl); padding: var(--space-xxl) var(--space-xl); box-shadow: var(--shadow-lg); }
.auth-card h1 { font-size: var(--fs-xl); }
.auth-card .btn.block { margin-bottom: var(--space-sm); }

/* --- Rammeverk: lys sidemeny (desktop), fanemeny nederst (mobil) --- */
.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: #f7f9fc; border-right: var(--hairline) solid var(--color-border);
  display: flex; flex-direction: column; gap: var(--space-md);
  position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: var(--space-md) var(--space-sm);
}
.brand { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-xxs) var(--space-xs); color: var(--color-text); text-decoration: none !important; }
.brand strong { display: block; font-size: var(--fs-sm); font-weight: 650; line-height: 1.25; }
.brand small { display: block; font-size: 12px; color: var(--color-text-muted); line-height: 1.3; }
.brand.big { padding: 0 0 var(--space-lg); }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: var(--color-primary); color: #fff; flex-shrink: 0; --logo-accent: #6CACE4; }
.brand-mark.sm { width: 30px; height: 30px; border-radius: 7px; }
.brand.big .brand-mark { width: 44px; height: 44px; border-radius: 11px; }
/* Ordmerket settes i versaler med litt luft, som i logoen. */
.brand .wordmark { font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.brand.big .wordmark { font-size: 24px; line-height: 1; }
.search-btn {
  display: flex; align-items: center; gap: var(--space-xs); width: 100%; height: 38px; padding: 0 var(--space-sm);
  border: 1px solid var(--color-border-strong); border-radius: 10px; background: #fff; color: var(--color-text-muted);
  font: 500 14px var(--font-sans); cursor: pointer; text-align: left; transition: border-color .15s, box-shadow .15s;
}
.search-btn:hover { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--blue-100); }
kbd { font: 600 11px var(--font-sans); color: var(--color-text-muted); background: #fff; border: 1px solid var(--color-border-strong); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; white-space: nowrap; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 12px; font-weight: 600; color: var(--color-text-muted); padding: 0 var(--space-sm) var(--space-xxs); letter-spacing: .02em; }
.nav-group a {
  display: flex; align-items: center; gap: var(--space-sm); min-height: 36px; padding: 0 var(--space-sm);
  border-radius: 8px; color: var(--grey-800); font-size: 14px; font-weight: 500; text-decoration: none; transition: background-color .12s, color .12s;
}
.nav-group a .icon { color: var(--color-text-muted); }
.nav-group a:hover { background: #eef3fa; color: var(--color-text); text-decoration: none; }
.nav-group a.active { background: var(--blue-100); color: var(--color-primary); font-weight: 600; }
.nav-group a.active .icon { color: var(--color-primary); }
.nav-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-pill); background: var(--color-primary); color: #fff; font-size: 12px; font-weight: 600; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; gap: var(--space-3xs); padding-top: var(--space-sm); border-top: var(--hairline) solid var(--color-border); }
.sidebar-foot .me { display: flex; align-items: center; gap: var(--space-sm); flex: 1; min-width: 0; padding: var(--space-xxs); border-radius: 10px; color: var(--color-text); text-decoration: none; }
.sidebar-foot .me:hover, .sidebar-foot .me.active { background: #eef3fa; text-decoration: none; }
.sidebar-foot .me strong, .sidebar-foot .me small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.sidebar-foot .me strong { font-size: 14px; font-weight: 600; }
.sidebar-foot .me small { color: var(--color-text-muted); font-size: 12px; }
.sidebar-foot .icon-btn { width: 36px; height: 36px; }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--color-primary-soft); color: var(--color-primary); font-weight: 600; font-size: 13px; flex-shrink: 0; }
.sidebar .avatar { background: var(--blue-profile); color: var(--blue-800); }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }

.main-wrap { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
main { padding: var(--space-xl) var(--space-xl) var(--space-xxl); max-width: var(--content-max); width: 100%; outline: none; }
.tabbar, .scrim { display: none; }

/* --- Varsler --- */
.dot { position: absolute; top: 3px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-pill); background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; box-shadow: 0 0 0 2px #f7f9fc; }
.notif-panel { position: fixed; z-index: 60; left: 272px; bottom: 16px; width: min(400px, calc(100vw - 32px)); max-height: min(560px, calc(100vh - 32px)); display: flex; flex-direction: column; background: var(--color-surface); border: var(--hairline) solid var(--color-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; }
.notif-panel:not(.from-bottom) { bottom: auto; top: 64px; right: 12px; left: auto; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: var(--space-sm) var(--space-md); border-bottom: var(--hairline) solid var(--color-border); }
.notif-enable { display: flex; gap: var(--space-xs); align-items: center; width: 100%; border: 0; border-bottom: var(--hairline) solid var(--color-border); background: var(--color-primary-soft); color: var(--color-primary); padding: var(--space-sm) var(--space-md); font: inherit; font-weight: 600; cursor: pointer; }
.notif-list { overflow: auto; }
.notif { display: flex; flex-direction: column; gap: var(--space-3xs); padding: var(--space-sm) var(--space-md); border-bottom: var(--hairline) solid var(--color-border); color: var(--color-text); text-decoration: none !important; }
.notif:hover { background: var(--color-surface-alt); }
.notif span { font-size: var(--fs-xs); color: var(--color-text-muted); }
.notif small { font-size: 12px; color: var(--color-text-muted); }
.notif.unread { background: var(--blue-50); box-shadow: inset 3px 0 0 var(--color-primary); }

/* --- Sider og kort --- */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-md); margin-bottom: var(--space-lg); flex-wrap: wrap; }
.page-head > div:first-child { max-width: 80ch; }
.page-head p.muted { font-size: var(--fs-md); margin: var(--space-xxs) 0 0; }
.page-head .actions { display: flex; gap: var(--space-xs); flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: var(--space-xxs); margin-bottom: var(--space-sm); font-size: var(--fs-xs); font-weight: 600; }
.card { background: var(--color-surface); border: var(--hairline) solid var(--color-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: var(--space-lg); margin-bottom: var(--space-md); }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-head { padding: var(--space-md) var(--space-lg); border-bottom: var(--hairline) solid var(--color-border); margin: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-sm); margin-bottom: var(--space-sm); }
.card-head h2 { margin: 0; display: flex; align-items: center; gap: var(--space-xs); }
.card-head h2 .icon { color: var(--color-primary); }
.empty { padding: var(--space-xl) var(--space-md); text-align: center; color: var(--color-text-muted); }
.empty p { margin: 0; }
.chips { display: flex; gap: var(--space-xs); flex-wrap: wrap; align-items: center; margin-top: var(--space-xs); }
.row { display: flex; gap: var(--space-xs); align-items: center; flex-wrap: wrap; }

.badge, .status, .prio {
  display: inline-flex; align-items: center; gap: var(--space-xxs);
  padding: 2px 10px; border-radius: var(--radius-pill);
  font-size: var(--fs-xs); font-weight: 600; line-height: 1.45; white-space: nowrap; text-decoration: none !important;
  background: var(--color-primary-soft); color: var(--color-primary);
}
.badge.muted, .status.s-avsluttet { background: var(--grey-200); color: var(--grey-800); }
.badge.warn, .status.s-venter { background: var(--warn-100); color: var(--warn-700); }
.badge.danger { background: var(--danger-100); color: var(--danger-700); }
.badge.ok, .status.s-bekreftet { background: var(--ok-100); color: var(--ok-700); }
.badge.info, .status.s-ny { background: var(--info-100); color: var(--info-700); }
.status.s-under_behandling { background: var(--blue-100); color: var(--blue-700); }
.prio { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; padding: 1px 8px; }
.p-hoy { background: var(--danger-100); color: var(--danger-700); }
.p-lav { background: var(--grey-200); color: var(--grey-800); }

/* --- Verktøylinje --- */
.toolbar { display: flex; gap: var(--space-sm); margin-bottom: var(--space-md); flex-wrap: wrap; align-items: center; }
.toolbar select { width: auto; min-width: 170px; }
.search { position: relative; flex: 1; min-width: 240px; max-width: 440px; }
.search .icon { position: absolute; left: var(--space-sm); top: 50%; transform: translateY(-50%); color: var(--color-text-muted); }
.search input { padding-left: 38px; border-radius: var(--radius-pill); }
.segmented { display: inline-flex; padding: 3px; gap: 2px; border: var(--hairline) solid var(--color-border-strong); border-radius: var(--radius-pill); background: var(--color-surface); }
.segmented button { border: 0; background: none; min-height: 34px; padding: 0 var(--space-md); border-radius: var(--radius-pill); font: inherit; font-size: var(--fs-xs); font-weight: 600; cursor: pointer; color: var(--color-text-muted); transition: background-color 0.15s, color 0.15s; }
.segmented button:hover { color: var(--color-primary); }
.segmented button.on { background: var(--color-primary); color: #fff; }

/* --- Tabeller --- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: var(--fs-xs); color: var(--color-text-muted); font-weight: 600; padding: var(--space-sm) var(--space-md); background: var(--color-surface-alt); border-bottom: var(--hairline) solid var(--color-border-strong); }
.table td { padding: var(--space-sm) var(--space-md); border-bottom: var(--hairline) solid var(--color-border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr[data-href], .table tr[data-event], .table tr[data-appr], .table tr[data-need] { cursor: pointer; }
.table tbody tr { transition: background-color 0.12s; }
.table tbody tr:hover { background: var(--blue-50); }
.table tr.inactive { opacity: 0.55; }
.row-actions { text-align: right; white-space: nowrap; }
.person { display: flex; align-items: center; gap: var(--space-sm); }
.person small { display: block; }

/* --- Nøkkeltall --- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-md); margin-bottom: var(--space-md); }
.stat { background: var(--color-surface); border: var(--hairline) solid var(--color-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: var(--space-md) var(--space-lg); color: var(--color-text-muted); text-decoration: none !important; display: flex; flex-direction: column; gap: var(--space-xxs); transition: border-color 0.15s, box-shadow 0.15s; }
a.stat:hover { border-color: var(--color-primary); box-shadow: var(--shadow-md); }
.stat-num { font-size: var(--fs-3xl); font-weight: 600; color: var(--color-primary); line-height: 1; }
.stat.alert .stat-num { color: var(--danger-700); }
.cleanup-box { display: flex; gap: var(--space-md); align-items: flex-start; padding: var(--space-md); margin-bottom: var(--space-md); border-radius: var(--radius-md, 8px); background: var(--warn-100); color: var(--warn-700); }
.cleanup-box > .grow { flex: 1; min-width: 0; }
.cleanup-box p { margin: 4px 0 0; }
@media (max-width: 767px) { .cleanup-box { flex-direction: column; } }

/* --- Lister --- */
.simple-list, .occ-list, .people, .checklist, .edit-list, .contact-list, .session-list { list-style: none; margin: 0; padding: 0; }
.simple-list li { display: flex; justify-content: space-between; gap: var(--space-sm); align-items: center; padding: var(--space-sm) 0; border-bottom: var(--hairline) solid var(--color-border); flex-wrap: wrap; }
.simple-list li:last-child { border-bottom: 0; }
.occ-list li { display: flex; gap: var(--space-sm); align-items: flex-start; padding: var(--space-sm) 0; border-bottom: var(--hairline) solid var(--color-border); }
.occ-list li:last-child { border-bottom: 0; }
.occ-list .occ-body { display: flex; flex-direction: column; gap: var(--space-3xs); cursor: pointer; flex: 1; min-width: 0; }
.occ-list .occ-body:hover strong { color: var(--color-primary); }
.occ-list li.done .occ-body strong { text-decoration: line-through; color: var(--color-text-muted); }
.occ-list li.overdue .occ-body strong { color: var(--danger-700); }
.check { display: grid; place-items: center; width: 24px; height: 24px; margin-top: 1px; border-radius: 50%; border: 1.5px solid var(--color-field-border); background: var(--color-surface); color: transparent; cursor: pointer; flex-shrink: 0; transition: all 0.15s; }
.check:hover { border-color: var(--ok-700); color: var(--ok-700); background: var(--ok-100); }
.check.on { background: var(--ok-700); border-color: var(--ok-700); color: #fff; }
.cat-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: var(--space-xs); vertical-align: 0; box-shadow: 0 0 0 2px #fff; }

.people li { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-sm) var(--space-lg); border-bottom: var(--hairline) solid var(--color-border); }
.card:not(.flush) .people li { padding: var(--space-sm) 0; }
.people li:last-child { border-bottom: 0; }
.people .grow { display: flex; flex-direction: column; }
.progress { display: inline-block; width: 120px; height: 8px; border-radius: var(--radius-pill); background: var(--blue-100); overflow: hidden; flex-shrink: 0; }
.progress span { display: block; height: 100%; background: var(--color-primary); border-radius: var(--radius-pill); }
.progress.big { width: 100%; height: 10px; margin-top: var(--space-xs); display: block; }

/* --- Detaljsider (saker, kurs) --- */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--space-md); align-items: start; }
.detail-grid.wide-aside { grid-template-columns: minmax(0, 1fr) 360px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: var(--space-xs) var(--space-md); margin: 0; align-items: center; }
.facts dt { color: var(--color-text-muted); font-size: var(--fs-xs); }
.facts dd { margin: 0; }
.facts.inline { margin: var(--space-sm) 0; }
.facts select { min-height: 34px; padding: var(--space-xxs) var(--space-xs); }
.comment-form { display: flex; flex-direction: column; gap: var(--space-xs); align-items: flex-end; margin-bottom: var(--space-md); }
.timeline { list-style: none; margin: 0; padding: 0 0 0 var(--space-md); border-left: 2px solid var(--color-border); }
.timeline li { position: relative; padding: 0 0 var(--space-md) var(--space-md); }
.timeline li::before { content: ''; position: absolute; left: -24px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--color-primary); box-shadow: 0 0 0 3px var(--color-surface); }
.timeline li.hendelse::before { background: var(--color-border-strong); }
.timeline li.hendelse .prewrap { color: var(--color-text-muted); font-size: var(--fs-xs); }
.tl-meta { font-size: var(--fs-xs); color: var(--color-text-muted); margin-bottom: var(--space-3xs); }
.resource { display: flex; align-items: center; gap: var(--space-sm); width: 100%; padding: var(--space-sm) var(--space-md); margin-top: var(--space-xs); border: var(--hairline) solid var(--color-border-strong); border-radius: var(--radius-md); background: var(--color-surface); color: var(--color-text); font: inherit; font-weight: 600; text-align: left; cursor: pointer; text-decoration: none !important; flex-wrap: wrap; transition: border-color 0.15s, background-color 0.15s; }
.resource:hover { border-color: var(--color-primary); background: var(--blue-50); }
.resource .icon { color: var(--color-primary); }
.resource small { width: 100%; color: var(--color-text-muted); font-weight: 400; padding-left: 30px; margin-top: calc(-1 * var(--space-xxs)); }
.resources { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--space-sm); }
.history { padding-left: var(--space-md); }
.history li { margin-bottom: var(--space-xs); }
.link-list { display: flex; flex-direction: column; gap: var(--space-xs); }
.link-list a { display: flex; gap: var(--space-xs); align-items: center; }

/* --- Årshjul: én ring per fagområde --- */
.wheel-layout { display: grid; grid-template-columns: minmax(340px, 600px) minmax(0, 1fr); gap: var(--space-md); align-items: start; }
.wheel-card { text-align: center; }
.year-nav { display: flex; align-items: center; justify-content: center; gap: var(--space-sm); font-size: var(--fs-ml); margin-bottom: var(--space-xxs); }
.year-nav strong { min-width: 70px; font-weight: 650; }
.wheel { width: 100%; max-width: 560px; display: block; margin: 0 auto; overflow: visible; font-family: var(--font-sans); }
.wheel-seps line { stroke: #fff; stroke-width: 3; }
.wheel-seg { fill: transparent; cursor: pointer; outline: none; transition: fill .15s; }
.wheel-seg:hover, .wheel-seg:focus-visible { fill: rgb(0 48 135 / 0.05); }
.wheel-seg.selected { fill: rgb(0 48 135 / 0.08); stroke: var(--color-primary); stroke-opacity: .45; stroke-width: 1.5; }
.wheel-seg:focus-visible { stroke: var(--color-primary); stroke-width: 2; }
.wheel-labels text { text-anchor: middle; dominant-baseline: middle; pointer-events: none; font-size: 13px; font-weight: 600; fill: var(--color-text-muted); letter-spacing: .03em; }
.wheel-labels text.now { fill: var(--color-primary); font-weight: 700; }
.m-alert { fill: var(--danger); }
.wheel-dot { fill: var(--c); stroke: #fff; stroke-width: 2; cursor: pointer; transition: r .12s; }
.wheel-dot:hover { r: 9; }
.wheel-dot.done { fill: #fff; stroke: var(--c); stroke-width: 2.5; }
.wheel-dot.overdue { stroke: var(--danger); stroke-width: 2.5; }
.wheel-dot.course { stroke: var(--blue-800); stroke-width: 1.75; }
.today-line { stroke: var(--danger); stroke-width: 2.5; stroke-linecap: round; pointer-events: none; }
.today-cap { fill: var(--danger); pointer-events: none; }
.wheel-center { fill: var(--color-surface); stroke: var(--color-border); stroke-width: 1; filter: drop-shadow(0 2px 8px rgb(0 27 82 / 0.08)); }
.c-year { font-size: 38px; font-weight: 700; text-anchor: middle; fill: var(--color-primary); letter-spacing: -.02em; }
.c-sub { font-size: 14px; text-anchor: middle; fill: var(--color-text-muted); }
.legend { display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-md); justify-content: center; margin-top: var(--space-sm); font-size: var(--fs-xs); color: var(--grey-800); }
.legend.left { justify-content: flex-start; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: var(--space-xxs); vertical-align: -1px; }
.legend i.today-key { width: 14px; height: 3px; border-radius: 2px; background: var(--danger); vertical-align: 3px; }
.month-card { min-height: 320px; }
.course-occ .course-mark { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--color-primary-soft); color: var(--color-primary); flex-shrink: 0; }
.course-occ a.occ-body { color: var(--color-text); text-decoration: none; }

/* --- E-postmaler --- */
.group-title { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-text-muted); margin: var(--space-xs) 0 var(--space-sm); }
.tpl-group { margin-bottom: var(--space-lg); }
.tpl-grid, .guide-grid, .course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--space-md); }
.tpl-card { background: var(--color-surface); border: var(--hairline) solid var(--color-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: var(--space-md) var(--space-lg); display: flex; flex-direction: column; transition: box-shadow 0.15s; }
.tpl-card:hover { box-shadow: var(--shadow-md); }
.tpl-top { display: flex; justify-content: space-between; gap: var(--space-sm); align-items: flex-start; }
.tpl-top h3 { margin: var(--space-xxs) 0 var(--space-xs); }
.outlook-btn { display: grid; place-items: center; width: 48px; height: 48px; border-radius: var(--radius-md); border: 0; background: var(--color-primary); color: #fff; cursor: pointer; flex-shrink: 0; box-shadow: var(--shadow-md); transition: background-color 0.15s, transform 0.1s; }
.outlook-btn:hover { background: var(--color-primary-strong); transform: translateY(-1px); }
.tpl-subject { font-size: var(--fs-xs); margin-bottom: var(--space-xs); }
.tpl-preview { font-size: var(--fs-xs); color: var(--color-text-muted); white-space: pre-wrap; flex: 1; border-left: 3px solid var(--blue-200); padding-left: var(--space-sm); }
.tpl-foot { display: flex; justify-content: space-between; align-items: center; gap: var(--space-xs); border-top: var(--hairline) solid var(--color-border); padding-top: var(--space-xs); margin-top: var(--space-xs); }
.mail-preview { border: var(--hairline) solid var(--color-border-strong); border-radius: var(--radius-md); padding: var(--space-md); background: var(--color-surface-alt); display: flex; flex-direction: column; gap: var(--space-xxs); }
.mail-body { margin-top: var(--space-sm); padding-top: var(--space-sm); border-top: var(--hairline) solid var(--color-border-strong); font-family: Aptos, Calibri, 'Segoe UI', sans-serif; }
mark { background: var(--warn-200); border-radius: 4px; padding: 0 var(--space-3xs); }
.help summary { cursor: pointer; font-weight: 600; }
.help p { margin-top: var(--space-xs); }

/* --- Rutiner --- */
.guide-card { display: flex; gap: var(--space-sm); align-items: flex-start; padding: var(--space-md) var(--space-lg); background: var(--color-surface); border: var(--hairline) solid var(--color-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); color: var(--color-text); text-decoration: none !important; transition: border-color 0.15s, box-shadow 0.15s; }
.guide-card:hover { border-color: var(--color-primary); box-shadow: var(--shadow-md); }
.guide-card > span:last-child { display: flex; flex-direction: column; gap: var(--space-xxs); }
.guide-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--color-primary-soft); color: var(--color-primary); flex-shrink: 0; }
.prose { font-size: var(--fs-md); line-height: var(--lh-text); max-width: 72ch; }
.prose h2 { font-size: var(--fs-lg); margin-top: 1.4em; }
.prose h3 { font-size: var(--fs-ml); margin-top: 1.2em; }
.prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin-bottom: var(--space-xxs); }
.prose a { text-decoration: underline; }
.prose blockquote { margin: var(--space-md) 0; padding: var(--space-sm) var(--space-md); background: var(--color-primary-soft); border-left: 4px solid var(--color-primary); border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.editor { margin-bottom: var(--space-xs); }
.editor-tabs { display: flex; gap: var(--space-3xs); margin-bottom: -1px; }
.editor-tabs button { border: 1px solid var(--color-field-border); border-bottom: 0; background: var(--color-surface-alt); padding: var(--space-xs) var(--space-md); border-radius: var(--radius-sm) var(--radius-sm) 0 0; font: inherit; font-size: var(--fs-xs); cursor: pointer; color: var(--color-text-muted); }
.editor-tabs button.on { background: var(--color-surface); color: var(--color-text); font-weight: 600; }
.editor textarea { border-top-left-radius: 0; }
.editor-preview { border: 1px solid var(--color-field-border); border-radius: 0 var(--radius-sm) var(--radius-sm) var(--radius-sm); padding: var(--space-md); min-height: 320px; max-width: none; }

/* --- Opplæring --- */
.onboard-card { border-left: 4px solid var(--color-primary); }
.onboard-row { display: grid; grid-template-columns: 220px 1fr; gap: var(--space-lg); align-items: center; }
.onboard-pct strong { font-size: var(--fs-xl); }
.next-steps { margin: 0; padding-left: var(--space-md); }
.next-steps li { margin-bottom: var(--space-xxs); }
.onboard-summary { display: flex; gap: var(--space-lg); align-items: center; justify-content: space-between; flex-wrap: wrap; }
.onboard-summary > div:first-child { flex: 1; min-width: 200px; }
.mentor { display: flex; gap: var(--space-sm); align-items: center; }
.mentor > span:last-child { display: flex; flex-direction: column; }
.phase h3 { margin-bottom: var(--space-xs); display: flex; align-items: center; gap: var(--space-xs); }
.area-checks { display: flex; flex-wrap: wrap; gap: 0 var(--space-lg); }
.area-checks .check-field { margin: var(--space-xxs) 0; }
.area-line { margin: var(--space-xs) 0 0; }
.newcomer { align-items: flex-start !important; }
.newcomer .progress { margin-top: var(--space-xs); }
.next-ticks { display: flex; flex-direction: column; gap: var(--space-xxs); margin-top: var(--space-xs); }
.next-ticks label { display: flex; align-items: center; gap: var(--space-xs); cursor: pointer; }
.done-by { text-align: right; white-space: nowrap; }
.readonly .phase { margin-bottom: var(--space-sm); }
.checklist li { display: flex; gap: var(--space-sm); align-items: flex-start; padding: var(--space-sm) 0; border-bottom: var(--hairline) solid var(--color-border); }
.checklist li:last-child { border-bottom: 0; }
.checklist li > div { flex: 1; }
.checklist li.done strong { text-decoration: line-through; color: var(--color-text-muted); }
.checklist p { margin: var(--space-3xs) 0 0; }
.checklist input { margin-top: 2px; }
.bullet { width: 8px; height: 8px; border-radius: 50%; background: var(--color-primary); margin-top: 8px; flex-shrink: 0; }
.item-links { display: flex; gap: var(--space-md); flex-wrap: wrap; margin-top: var(--space-xxs); font-size: var(--fs-xs); }
.item-links a, .item-links .link { display: inline-flex; align-items: center; gap: var(--space-xxs); font-size: var(--fs-xs); }
.edit-list li { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-xs) 0; border-bottom: var(--hairline) solid var(--color-border); }
.edit-list .grow { display: flex; flex-direction: column; }
.password-box { display: flex; gap: var(--space-sm); align-items: center; margin: var(--space-sm) 0; }
.password-box code { font-size: var(--fs-lg); padding: var(--space-xs) var(--space-md); letter-spacing: 0.05em; }

/* --- Registre --- */
.stats-4 { grid-template-columns: repeat(4, 1fr); }
.num { text-align: right; }
.neg { color: var(--danger-700); font-weight: 600; }
.table.compact td, .table.compact th { padding: var(--space-xs) var(--space-sm); }
.inst-summary summary { cursor: pointer; }
.inst-summary .table { margin-top: var(--space-sm); }
.form-section { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-text-muted); margin: var(--space-xs) 0 var(--space-sm); padding-top: var(--space-sm); border-top: var(--hairline) solid var(--color-border); }
.form-section:first-child { border-top: 0; padding-top: 0; }
.org-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: var(--space-md); }
.org-card { background: var(--color-surface); border: var(--hairline) solid var(--color-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: var(--space-md) var(--space-lg); display: flex; flex-direction: column; gap: var(--space-xs); }
.org-head { display: flex; justify-content: space-between; gap: var(--space-xs); align-items: flex-start; }
.org-head h3 { margin: 0 0 var(--space-3xs); }
.org-card p { margin: 0; }
.contact-list { margin-top: var(--space-xxs); }
.contact-list li { display: flex; gap: var(--space-sm); align-items: flex-start; padding: var(--space-xs) 0; border-top: var(--hairline) solid var(--color-border); }
.contact-list .grow { display: flex; flex-direction: column; gap: var(--space-3xs); }
.add-contact { align-self: flex-start; margin-top: var(--space-xxs); }

/* --- Filter i årshjulet --- */
.chip-filter { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.chip-filter button { display: inline-flex; align-items: center; gap: var(--space-xs); border: var(--hairline) solid var(--color-field-border); background: var(--color-surface); border-radius: var(--radius-pill); min-height: 36px; padding: 0 var(--space-md); font: inherit; font-size: var(--fs-xs); font-weight: 600; cursor: pointer; color: var(--color-text); transition: background-color 0.15s, border-color 0.15s; }
.chip-filter button:hover { border-color: var(--color-primary); }
.chip-filter button i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 1.5px #fff; }
.chip-filter button.on { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.check-field.inline { margin: 0 0 0 auto; font-size: var(--fs-xs); }

/* --- Sjekkliste på sak --- */
.case-checks li { align-items: center; }
.case-checks .icon-btn { width: 32px; height: 32px; opacity: 0.55; }
.case-checks li:hover .icon-btn { opacity: 1; }
.checklist-add { display: flex; gap: var(--space-xs); margin-top: var(--space-sm); flex-wrap: wrap; }
.checklist-add form { flex: 1; min-width: 240px; gap: var(--space-xs); flex-wrap: nowrap; }
.checklist-add input[type=date] { width: auto; }

/* --- Import --- */
.req { color: var(--danger-700); }
.error-text { color: var(--danger-700); }
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; gap: var(--space-xxs); padding: var(--space-xl) var(--space-md); margin: var(--space-sm) 0; border: 2px dashed var(--blue-300); border-radius: var(--radius-lg); background: var(--blue-50); cursor: pointer; text-align: center; color: var(--color-primary); transition: background-color 0.15s, border-color 0.15s; }
.dropzone:hover, .dropzone.over { border-color: var(--color-primary); background: var(--blue-100); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.import-file { display: flex; justify-content: space-between; align-items: center; gap: var(--space-sm); flex-wrap: wrap; margin-bottom: var(--space-sm); }
.import-file select { width: auto; }
.map-table select { min-height: 34px; padding: var(--space-xxs) var(--space-xs); min-width: 180px; }
.map-table td { vertical-align: top; }
.import-options { margin: var(--space-sm) 0 var(--space-xxs); }
.import-options .check-field { margin: var(--space-xxs) 0; }
.import-preview .chips { margin-bottom: var(--space-xs); }

/* --- Kurs --- */
.course-card { display: flex; flex-direction: column; gap: var(--space-xs); background: var(--color-surface); border: var(--hairline) solid var(--color-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: var(--space-md) var(--space-lg); color: var(--color-text); text-decoration: none !important; transition: border-color 0.15s, box-shadow 0.15s; }
.course-card:hover { border-color: var(--color-primary); box-shadow: var(--shadow-md); }
.course-card h3 { margin: 0; font-size: var(--fs-ml); }
.course-card p { margin: 0; }
.course-top { display: flex; justify-content: space-between; align-items: center; gap: var(--space-xs); }
.course-dates { display: flex; align-items: center; gap: var(--space-xs); font-weight: 600; color: var(--color-primary); }
.next-task { color: var(--color-text-muted); }
.task-group { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-text-muted); margin: var(--space-md) 0 var(--space-3xs); }
.task-group.overdue { color: var(--danger-700); }
.course-tasks li { align-items: flex-start; }
.course-tasks p { margin: var(--space-3xs) 0 0; }
.task-note { background: var(--warn-100); color: var(--warn-700); border-radius: var(--radius-sm); padding: var(--space-3xs) var(--space-xs); display: inline-block; }
.task-actions { display: flex; gap: var(--space-3xs); flex-shrink: 0; }
.outlook-mini { color: var(--color-primary); }
.done-tasks { margin-top: var(--space-sm); }
.done-tasks summary { cursor: pointer; color: var(--color-text-muted); font-weight: 600; }
.session-list li { padding: var(--space-xs) 0; border-bottom: var(--hairline) solid var(--color-border); display: flex; flex-direction: column; gap: var(--space-xxs); }
.session-list li:last-child { border-bottom: 0; }
.notes { margin-top: var(--space-sm); padding-top: var(--space-sm); border-top: var(--hairline) solid var(--color-border); }
.table-scroll { overflow-x: auto; }
.session-table td { padding: var(--space-xxs); border-bottom: 0; }
.session-table input, .session-table select { min-height: 36px; padding: var(--space-xxs) var(--space-xs); font-size: var(--fs-xs); }
.session-table input[type=date] { min-width: 150px; }
.session-table input[type=time] { min-width: 96px; }
.session-table .short { max-width: 120px; }
.session-notes td { padding-top: 0; padding-bottom: var(--space-sm); border-bottom: var(--hairline) solid var(--color-border) !important; }
.session-notes input { font-size: var(--fs-xs); }
.card.inactive { opacity: 0.6; }

/* --- Felles: faner, nedtrekksmeny, små knapper --- */
.eyebrow { font-size: 13px; font-weight: 500; color: var(--color-text-muted); margin: 0 0 var(--space-3xs); }
.eyebrow::first-letter { text-transform: uppercase; }
.text-danger { color: var(--danger-700); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-xs); }
.btn.sm { min-height: 30px; padding: 0 var(--space-sm); font-size: 13px; border-radius: 8px; gap: 6px; }
.icon-btn.bordered { border: 1px solid var(--color-border-strong); background: #fff; color: var(--grey-800); border-radius: 10px; }
.icon-btn.primary-icon { background: var(--color-primary); color: #fff; border-radius: 10px; }
.icon-btn.primary-icon:hover { background: var(--color-primary-strong); color: #fff; }
.tabs { display: flex; gap: var(--space-3xs); border-bottom: var(--hairline) solid var(--color-border-strong); margin-bottom: var(--space-md); overflow-x: auto; scrollbar-width: none; }
.tabs button { position: relative; display: inline-flex; align-items: center; gap: var(--space-xs); border: 0; background: none; padding: var(--space-sm) var(--space-sm); font: 500 14px var(--font-sans); color: var(--grey-800); cursor: pointer; white-space: nowrap; }
.tabs button:hover { color: var(--color-primary); }
.tabs button.on { color: var(--color-primary); font-weight: 600; }
.tabs button.on::after { content: ''; position: absolute; left: var(--space-xs); right: var(--space-xs); bottom: -1px; height: 2px; border-radius: 2px; background: var(--color-primary); }
.tab-count { font-size: 12px; font-weight: 600; color: var(--color-text-muted); background: var(--grey-200); border-radius: var(--radius-pill); padding: 0 7px; font-variant-numeric: tabular-nums; }
.tabs button.on .tab-count { background: var(--blue-100); color: var(--color-primary); }
.pill-tabs { display: flex; gap: var(--space-xxs); flex-wrap: wrap; }
.pill-tabs button { height: 30px; padding: 0 var(--space-sm); border-radius: var(--radius-pill); border: 1px solid var(--color-border-strong); background: #fff; color: var(--grey-800); font: 600 12px var(--font-sans); cursor: pointer; }
.pill-tabs button.on { background: var(--grey-900); border-color: var(--grey-900); color: #fff; }
.menu-btn-wrap { position: relative; }
.menu-btn-wrap > summary { list-style: none; cursor: pointer; }
.menu-btn-wrap > summary::-webkit-details-marker { display: none; }
.dropdown { position: absolute; z-index: 40; top: calc(100% + 6px); right: 0; min-width: 240px; padding: var(--space-xxs); background: #fff; border: var(--hairline) solid var(--color-border); border-radius: 12px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; }
.dropdown a, .dropdown button { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-xs) var(--space-sm); border: 0; background: none; border-radius: 8px; color: var(--color-text); font: 500 14px var(--font-sans); text-align: left; cursor: pointer; text-decoration: none; }
.dropdown a:hover, .dropdown button:hover { background: var(--blue-50); text-decoration: none; }
.dropdown .icon { color: var(--color-text-muted); }
.dropdown .danger { color: var(--danger-700); }
.dropdown .danger .icon { color: var(--danger-700); }
.date-tile { width: 46px; flex-shrink: 0; text-align: center; border-radius: 10px; background: var(--blue-100); color: var(--color-primary); padding: 4px 0; line-height: 1.1; }
.date-tile small { display: block; font-size: 11px; font-weight: 600; }
.date-tile strong { display: block; font-size: 18px; font-weight: 700; color: var(--color-text); }
.date-tile.past { background: var(--grey-200); color: var(--color-text-muted); }
.date-tile.past strong { color: var(--grey-800); }
.progress.thin { width: 72px; height: 6px; }
.progress-row { margin-bottom: var(--space-xs); flex-wrap: nowrap; }
.progress-row .progress.big { flex: 1; width: auto; margin-top: 0; min-width: 0; }

/* --- Innboks (forsiden) --- */
.inbox-head h1 { font-size: 28px; }
.inbox-head p { margin-top: var(--space-xxs); font-size: var(--fs-sm) !important; }
.inbox-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--space-lg); align-items: start; }
.inbox-aside { display: flex; flex-direction: column; gap: var(--space-md); }
.inbox-aside .card { margin: 0; padding: var(--space-md) var(--space-lg); }
.inbox-aside h2 { font-size: var(--fs-sm); }
.inbox-group { display: flex; align-items: center; gap: var(--space-xs); padding: var(--space-xs) var(--space-md); background: var(--blue-50); color: var(--color-text-muted); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; border-bottom: var(--hairline) solid var(--color-border); }
.inbox-group.g-forfalt { background: var(--danger-100); color: var(--danger-700); }
.inbox-list { list-style: none; margin: 0; padding: 0; }
.inbox-row { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-sm) var(--space-md); border-bottom: var(--hairline) solid var(--color-border); transition: background-color .12s, opacity .25s, transform .25s; }
.inbox-row:hover { background: #f7f9fc; }
.inbox-row.leaving { opacity: 0; transform: translateX(12px); }
.inbox-row input[type=checkbox] { width: 18px; height: 18px; }
.check-spacer { width: 18px; flex-shrink: 0; }
.inbox-main { flex: 1; min-width: 0; display: flex; flex-direction: column; color: var(--color-text); text-decoration: none !important; }
.inbox-main strong { font-weight: 600; }
.inbox-main:hover strong { color: var(--color-primary); }
.inbox-main span { font-size: 13px; color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kchip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.k-kurs { background: #fff0e6; color: #8a3a10; }
.k-arshjul { background: var(--sea-100); color: #206054; }
.k-sak { background: var(--blue-100); color: var(--color-primary); }
.k-laerling { background: #ebf5d6; color: #4a6020; }
.due-chip { flex-shrink: 0; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: var(--radius-pill); background: #f1f4f7; color: var(--grey-800); white-space: nowrap; font-variant-numeric: tabular-nums; }
.due-chip.d-forfalt { background: var(--danger-100); color: var(--danger-700); }
.due-chip.d-idag, .due-chip.d-uke { background: var(--warn-100); color: var(--warn-700); }
.due-chip.d-neste { background: var(--blue-100); color: var(--color-primary); }
.inbox-empty { padding: var(--space-3xl) var(--space-md); color: var(--ok-700); }
.inbox-empty p { color: var(--color-text); }
.course-days { list-style: none; margin: 0; padding: 0; }
.course-days li + li { border-top: var(--hairline) solid var(--color-border); }
.course-days a { display: flex; gap: var(--space-sm); align-items: flex-start; padding: var(--space-xs) 0; color: var(--color-text); text-decoration: none !important; }
.course-days a .grow { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.course-days a:hover strong { color: var(--color-primary); }
.mini-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; text-align: center; font-size: 12px; font-variant-numeric: tabular-nums; }
.mini-cal b { color: var(--color-text-muted); font-weight: 600; padding-bottom: 2px; }
.mini-cal span { padding: 5px 0; border-radius: 8px; }
.mini-cal .c-frist, .legend i.c-frist { background: var(--sea-100); color: #206054; font-weight: 700; }
.mini-cal .c-kurs, .legend i.c-kurs { background: #fff0e6; color: #8a3a10; font-weight: 700; }
.mini-cal .c-kursdag, .legend i.c-kursdag { background: var(--color-primary); color: #fff; font-weight: 700; }
.mini-cal .c-today { box-shadow: inset 0 0 0 1.5px var(--danger); }
.legend i.c-frist { background: #00c19f; }
.legend i.c-kurs { background: #ff671f; }

/* --- Tre paneler (Kurs og Saker) --- */
main:has(.split) { max-width: none; padding: 0; }
.split { display: grid; grid-template-columns: 340px minmax(0, 1fr); min-height: 100vh; }
.split-list { background: #fff; border-right: var(--hairline) solid var(--color-border); display: flex; flex-direction: column; min-width: 0; }
.split-list-head { display: flex; flex-direction: column; gap: var(--space-sm); padding: var(--space-lg) var(--space-md) var(--space-sm); position: sticky; top: 0; background: #fff; z-index: 2; }
.split-list-head h1 { font-size: 22px; margin: 0; }
.split-list-head .search { max-width: none; min-width: 0; }
.split-list-head .search input { border-radius: 10px; background: var(--blue-50); border-color: transparent; }
.split-list-head select { min-height: 34px; padding: 0 var(--space-lg) 0 var(--space-xs); font-size: 13px; }
.filter-row { flex-wrap: nowrap; }
.filter-row select { flex: 1; }
.split-items { padding: 0 var(--space-xs) var(--space-lg); display: flex; flex-direction: column; gap: 2px; }
.split-item { display: flex; gap: var(--space-sm); padding: var(--space-sm); border-radius: 12px; color: var(--color-text); text-decoration: none !important; transition: background-color .12s; }
.split-item:hover { background: #f7f9fc; }
.split-item.on { background: var(--blue-100); box-shadow: inset 3px 0 0 var(--color-primary); }
.split-item .grow { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.split-item strong { font-weight: 600; line-height: 1.3; }
.split-item small { font-size: 12px; }
.split-detail { min-width: 0; padding: var(--space-lg) var(--space-xl) var(--space-xxl); container-type: inline-size; }
.split-detail > * { max-width: 1040px; }
.split-back { display: none; }
.split-empty { padding-top: 20vh; color: var(--color-text-muted); }
.split-empty p { color: var(--color-text); }
.detail-head { display: flex; gap: var(--space-md); align-items: flex-start; flex-wrap: wrap; margin-bottom: var(--space-md); }
.detail-title { font-size: 28px; font-weight: 700; letter-spacing: -.022em; margin: 0 0 var(--space-xs); }
.detail-head .chips { margin: 0; }
.detail-head .meta { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--grey-800); }
.detail-head .actions { display: flex; gap: var(--space-xs); align-items: center; }
.tab-panel { animation: fade-in .15s ease-out; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.session-list li { flex-direction: row !important; align-items: flex-start; gap: var(--space-sm) !important; }
.session-list .grow { display: flex; flex-direction: column; gap: 2px; }
.contact-list .avatar { margin-top: 2px; }
@container (max-width: 860px) {
  .detail-grid, .detail-grid.wide-aside { grid-template-columns: 1fr; }
}

/* --- Kommandopalett (Ctrl+K) --- */
dialog.palette { border: 0; padding: 0; margin: 12vh auto auto; width: min(660px, calc(100vw - 24px)); max-height: 72vh; border-radius: 16px; box-shadow: 0 24px 64px rgb(0 27 82 / .30), 0 2px 6px rgb(0 27 82 / .12); background: #fff; color: var(--color-text); overflow: hidden; display: flex; flex-direction: column; }
dialog.palette:not([open]) { display: none; }
dialog.palette::backdrop { background: rgb(0 27 82 / .30); backdrop-filter: blur(2px); }
dialog.palette[open] { animation: modal-in .14s ease-out; }
.palette-search { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-md) var(--space-md); border-bottom: var(--hairline) solid var(--color-border); color: var(--color-primary); }
.palette-search input { flex: 1; border: 0; box-shadow: none !important; padding: 0; min-height: 32px; font-size: 18px; font-weight: 500; background: none; }
.palette-search input::-webkit-search-cancel-button { display: none; }
.palette-results { overflow: auto; padding: var(--space-xxs) var(--space-xs) var(--space-xs); }
.palette-group { font-size: 12px; font-weight: 600; color: var(--color-text-muted); letter-spacing: .04em; text-transform: uppercase; padding: var(--space-sm) var(--space-sm) var(--space-xxs); }
.palette-item { display: flex; align-items: center; gap: var(--space-sm); width: 100%; padding: var(--space-xs) var(--space-sm); border: 0; border-radius: 10px; background: none; text-align: left; font: inherit; color: var(--color-text); cursor: pointer; }
.palette-item.on { background: var(--blue-50); }
.palette-item .grow { display: flex; flex-direction: column; min-width: 0; }
.palette-item strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-item small { font-size: 13px; color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-item > .icon { color: var(--color-text-muted); }
.palette-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.t-kurs { background: #fff0e6; color: #8a3a10; }
.t-oppgave, .t-sak { background: var(--blue-100); color: var(--color-primary); }
.t-arshjul { background: var(--sea-100); color: #206054; }
.t-mal { background: var(--info-100); color: var(--info-700); }
.t-rutine { background: #ebf5d6; color: #4a6020; }
.t-kontakt { background: #f2e5d9; color: #603520; }
.t-laerling { background: #ebf5d6; color: #4a6020; }
.t-handling { background: var(--color-primary); color: #fff; }
.t-side { background: var(--grey-200); color: var(--grey-800); }
.palette-hint { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--color-text-muted); white-space: nowrap; }
.palette-empty { padding: var(--space-lg); text-align: center; color: var(--color-text-muted); margin: 0; }
.palette-foot { display: flex; gap: var(--space-md); flex-wrap: wrap; padding: var(--space-xs) var(--space-md); border-top: var(--hairline) solid var(--color-border); background: #f7f9fc; font-size: 12px; color: var(--color-text-muted); }

/* --- Dialog --- */
dialog.modal { border: 0; border-radius: var(--radius-xl); padding: 0; width: min(580px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: var(--shadow-lg); color: var(--color-text); background: var(--color-surface); }
dialog.modal.wide { width: min(820px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgb(0 27 82 / 0.45); backdrop-filter: blur(2px); }
dialog.modal[open] { animation: modal-in 0.18s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(0.99); } to { opacity: 1; transform: none; } }
dialog.modal form { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
dialog.modal header { display: flex; justify-content: space-between; align-items: center; padding: var(--space-md) var(--space-lg); border-bottom: var(--hairline) solid var(--color-border); }
dialog.modal header h2 { margin: 0; font-size: var(--fs-ml); }
.modal-body { padding: var(--space-lg); overflow: auto; }
dialog.modal footer { display: flex; gap: var(--space-xs); align-items: center; padding: var(--space-sm) var(--space-lg); border-top: var(--hairline) solid var(--color-border); background: var(--color-surface-alt); flex-wrap: wrap; }
.spacer { flex: 1; }

/* --- Toast --- */
#toasts { position: fixed; bottom: var(--space-lg); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: var(--space-xs); z-index: 1000; align-items: center; pointer-events: none; }
.toast { background: var(--blue-800); color: #fff; padding: var(--space-sm) var(--space-lg); border-radius: var(--radius-pill); box-shadow: var(--shadow-lg); transition: opacity 0.4s, transform 0.4s; max-width: calc(100vw - 32px); font-weight: 600; animation: toast-in 0.2s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.toast.error { background: var(--danger-700); }
.toast.warn { background: var(--warn-700); }
.toast.hide { opacity: 0; transform: translateY(8px); }

/* --- Redusert bevegelse --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* --- Brekkpunkter (FNSP: 768 / 992 / 1080 / 1408) --- */
@media (max-width: 1240px) {
  .inbox-layout { grid-template-columns: 1fr; }
  .inbox-aside { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
}
@media (max-width: 1100px) {
  .split { grid-template-columns: 300px minmax(0, 1fr); }
  .split-detail { padding: var(--space-lg); }
}
@media (max-width: 991px) {
  .wheel-layout, .detail-grid, .detail-grid.wide-aside { grid-template-columns: 1fr; }
  .stats-4 { grid-template-columns: repeat(2, 1fr); }
  main { padding: var(--space-lg); }
  /* Tre paneler blir liste → detalj */
  .split { grid-template-columns: 1fr; min-height: 0; }
  .split:not(.has-detail) .split-detail { display: none; }
  .split.has-detail .split-list { display: none; }
  .split-list { border-right: 0; }
  .split-back { display: inline-flex; }
}
@media (max-width: 767px) {
  h1 { font-size: var(--fs-xl); }
  .shell { grid-template-columns: 1fr; padding-bottom: 72px; }
  /* Sidemenyen blir en skuff bak «Mer» */
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); z-index: 50; transform: translateX(-102%); transition: transform .22s ease; box-shadow: none; }
  .shell.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .shell.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 45; background: rgb(0 27 82 / .35); }
  .topbar { display: flex; position: sticky; top: 0; z-index: 30; align-items: center; gap: var(--space-sm); height: 56px; padding: 0 var(--space-md); background: rgb(255 255 255 / .92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: var(--hairline) solid var(--color-border); }
  .topbar-title { flex: 1; font-weight: 600; font-size: 17px; }
  .topbar .icon-btn { width: 44px; height: 44px; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: rgb(255 255 255 / .96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: var(--hairline) solid var(--color-border); padding: 4px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a, .tabbar button { flex: 1; min-height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 0; background: none; color: var(--color-text-muted); font: 600 11px var(--font-sans); text-decoration: none; cursor: pointer; border-radius: 12px; }
  .tabbar a.active { color: var(--color-primary); }
  .tabbar a.active .icon { stroke-width: 2.1; }
  main { padding: var(--space-md); }
  .card { padding: var(--space-md); }
  .grid-2, .grid-3, .stats, .stats-4, .resources, .onboard-row, .org-grid, .inbox-aside { grid-template-columns: 1fr; }
  .check-field.inline { margin-left: 0; }
  .table th:nth-child(n+4), .table td:nth-child(n+4) { display: none; }
  .table .row-actions { display: table-cell !important; }
  .search { max-width: none; }
  .auth-card { padding: var(--space-xl) var(--space-lg); }
  .notif-panel, .notif-panel.from-bottom { top: 64px; bottom: auto; left: 12px; right: 12px; width: auto; }
  /* Innboks: større trykkflater, e-post og kategori under tittelen */
  .inbox-row { flex-wrap: wrap; padding: var(--space-sm); gap: var(--space-xs) var(--space-sm); }
  .inbox-row .kchip { order: 3; }
  .inbox-row .inbox-main { flex-basis: calc(100% - 40px); order: 2; }
  .inbox-row input, .inbox-row .check-spacer { order: 1; width: 22px; height: 22px; }
  .inbox-row .btn.sm { order: 5; min-height: 36px; }
  .inbox-row .due-chip { order: 4; }
  .inbox-row .kchip, .inbox-row .due-chip { margin-left: 30px; }
  .inbox-row .due-chip { margin-left: 0; }
  .inbox-main span { white-space: normal; }
  .split-list-head { padding: var(--space-md); position: static; }
  .split-detail { padding: var(--space-md); }
  .detail-title { font-size: 22px; }
  dialog.palette { margin-top: 8px; max-height: calc(100vh - 16px); }
  .palette-foot { display: none; }
}
