/* Nærvær Admin – rolig, klinisk og tett nok til daglig drift. Blått, hvitt og grått. */

/* Admin har sin egen palett oppå base.css (mobil og TV beholder sin). */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f6;
  --text: #0f1b2d;
  --text-2: #334155;
  --muted: #677489;
  --border: #e3e8ef;
  --border-strong: #cdd5df;

  --brand: #1f5fd1;
  --brand-strong: #174bab;
  --brand-soft: #edf3fd;
  --brand-line: #c9dafa;
  --on-brand: #ffffff;
  --navy: #0c1d3a;

  --info: #1f5fd1;
  --info-soft: #edf3fd;
  --success: #17794a;
  --success-soft: #e9f5ef;
  --warning: #9a5a0a;
  --warning-soft: #fcf4e4;
  --danger: #c0302b;
  --danger-strong: #9f2420;
  --danger-soft: #fcefee;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 6px 16px -4px rgba(16, 24, 40, .08);
  --shadow-lg: 0 24px 56px -12px rgba(12, 29, 58, .28);
  --focus: 0 0 0 3px rgba(31, 95, 209, .22);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a111e;
    --surface: #101a2b;
    --surface-2: #132036;
    --surface-3: #192840;
    --text: #e7edf6;
    --text-2: #c3cede;
    --muted: #8a99b0;
    --border: #213049;
    --border-strong: #2d405f;
    --brand: #5b8ff0;
    --brand-strong: #85acf5;
    --brand-soft: #142647;
    --brand-line: #24406f;
    --on-brand: #ffffff;
    --info: #5b8ff0;
    --info-soft: #142647;
    --success: #4cc58a;
    --success-soft: #0f2a1f;
    --danger: #f07a75;
    --danger-soft: #2c1517;
    --warning: #e9b45a;
    --warning-soft: #2a2010;
    --shadow: 0 1px 3px rgba(0, 0, 0, .3), 0 6px 16px -4px rgba(0, 0, 0, .4);
    --shadow-lg: 0 24px 56px -12px rgba(0, 0, 0, .6);
    --focus: 0 0 0 3px rgba(91, 143, 240, .3);
  }
}

body { font-size: 14px; font-feature-settings: "cv11", "ss01"; text-rendering: optimizeLegibility; }
::selection { background: color-mix(in srgb, var(--brand) 22%, transparent); }

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  font: 600 11px/1 var(--font);
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
}

/* ---------- Grunnelementer i admin-tone ---------- */
.btn { font-weight: 550; box-shadow: var(--shadow-sm); transition: background .15s, border-color .15s, box-shadow .15s, color .15s, transform .08s; }
.btn:hover { border-color: color-mix(in srgb, var(--btn-border) 70%, var(--text)); }
.btn.primary {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, 0));
  box-shadow: 0 1px 2px rgba(16, 24, 40, .14), inset 0 -1px 0 rgba(0, 0, 0, .12);
}
.btn.primary:hover { border-color: var(--brand-strong); }
.btn.ghost, .btn.danger-ghost { box-shadow: none; }

.input, .select, .textarea { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.input:hover, .select:hover, .textarea:hover { border-color: color-mix(in srgb, var(--border-strong) 60%, var(--muted)); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: var(--focus); }
.input::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }

.card { border-radius: var(--radius); }
.badge { font-weight: 600; letter-spacing: .005em; border: 1px solid color-mix(in srgb, var(--b-fg) 14%, transparent); }
.badge.brand { --b-fg: var(--brand); --b-bg: var(--brand-soft); }
.badge.info { --b-fg: var(--navy); --b-bg: var(--surface-3); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge.info { --b-fg: var(--text-2); } }

/* Avatarer i én rolig tone i stedet for regnbuen. */
.avatar {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 650;
  box-shadow: inset 0 0 0 1px var(--brand-line);
}
.avatar .presence.on { background: #22a06b; }

dialog.modal { border-radius: var(--radius-lg); }
dialog.modal::backdrop { background: rgba(12, 29, 58, .38); backdrop-filter: blur(3px); }
.modal-head { padding: 18px 22px 14px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; font-weight: 650; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* Toast: mørk, med en tynn linje som viser hvor lenge den står. */
.toast { position: relative; overflow: hidden; background: var(--navy); border: 1px solid rgba(255, 255, 255, .08); animation: toast-in .28s var(--ease); }
.toast::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: #7aa5f5; transform-origin: left; animation: toast-time var(--ms, 3800ms) linear forwards; opacity: .7; }
.toast.success .icon { color: #6fd3a0; }
.toast.error::after { background: #f08a85; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes toast-time { to { transform: scaleX(0); } }

/* ---------- Innlogging ---------- */
.login-page { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: var(--surface); }
.login-brand {
  position: relative;
  overflow: hidden;
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  color: #c8d6ee;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(76, 132, 235, .35), transparent 60%),
    radial-gradient(600px 400px at -10% 110%, rgba(31, 95, 209, .3), transparent 60%),
    linear-gradient(165deg, #0f2850, #0a1730 70%);
}
/* Fint rutenett som tones ut mot kantene. */
.login-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 75%);
  pointer-events: none;
}
.login-brand > * { position: relative; }
.login-brand .logo { display: flex; align-items: center; gap: 12px; font-size: 17px; font-weight: 650; color: #fff; letter-spacing: -.01em; }
.login-brand .logo img { width: 34px; height: 34px; border-radius: 9px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .15), 0 8px 20px rgba(0, 0, 0, .3); }
.login-brand .logo small { margin-left: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #a9c2ee; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); }
.login-brand h1 { font-size: 36px; font-weight: 650; color: #fff; max-width: 480px; line-height: 1.15; letter-spacing: -.025em; }
.login-brand .lead { margin-top: 16px; max-width: 440px; color: #a9bbd9; font-size: 15.5px; line-height: 1.6; }
.login-features { display: grid; gap: 14px; margin: 32px 0 0; padding: 0; list-style: none; max-width: 440px; }
.login-features li { display: flex; gap: 14px; align-items: flex-start; }
.login-features .icon-box { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; color: #9cc0ff; background: rgba(91, 143, 240, .14); border: 1px solid rgba(124, 165, 245, .22); }
.login-features strong { display: block; color: #fff; font-weight: 600; font-size: 14px; }
.login-features span { font-size: 13px; color: #94a8c9; }
.login-brand .foot { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: #7e93b6; }

.login-form-wrap { display: grid; place-items: center; padding: 40px 20px; background: var(--surface); }
.login-form { width: min(380px, 100%); display: grid; gap: 18px; }
.login-form h2 { font-size: 26px; font-weight: 650; letter-spacing: -.02em; }
.login-form .lg { min-height: 44px; font-size: 15px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 44px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); --btn-fg: var(--muted); }
.pw-toggle:hover { --btn-fg: var(--text); }
.caps-hint { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--warning); }
.form-error { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--danger-soft); border: 1px solid color-mix(in srgb, var(--danger) 20%, transparent); }
.form-error[hidden] { display: none; }
.shake { animation: shake .4s var(--ease); }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.btn .spinner { width: 16px; height: 16px; border-width: 2px; border-color: rgba(255, 255, 255, .35); border-top-color: #fff; }
.login-legal { font-size: 12px; color: var(--muted); text-align: center; }

@media (max-width: 900px) {
  .login-page { grid-template-columns: 1fr; }
  .login-brand { padding: 28px 24px; gap: 20px; }
  .login-brand h1 { font-size: 24px; }
  .login-features, .login-brand .lead { display: none; }
}

/* ---------- Skall ---------- */
.layout { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100dvh; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 12px 12px;
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--border);
  color: var(--text-2);
}
.sidebar .logo { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; font-weight: 650; font-size: 15px; color: var(--text); letter-spacing: -.01em; }
.sidebar .logo img { width: 30px; height: 30px; border-radius: 8px; box-shadow: var(--shadow-sm); }
.sidebar .logo small { display: block; font-weight: 550; font-size: 11px; color: var(--muted); letter-spacing: .02em; }

.cmdk-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 0 0 12px;
  padding: 0 6px 0 10px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.cmdk-trigger:hover { border-color: var(--border-strong); background: var(--surface); box-shadow: var(--shadow-sm); }
.cmdk-trigger:focus-visible { outline: none; box-shadow: var(--focus); }
.cmdk-trigger .label { flex: 1; text-align: left; }
.cmdk-trigger kbd { background: var(--surface); }

.nav-section { margin: 16px 10px 6px; font-size: 11px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-radius: 7px;
  color: var(--text-2);
  text-decoration: none;
  font-weight: 550;
  transition: background .15s, color .15s;
}
.nav-item .icon { color: var(--muted); transition: color .15s; }
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item:hover .icon { color: var(--text-2); }
.nav-item:focus-visible { outline: none; box-shadow: var(--focus); }
.nav-item::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--brand);
  transform: scaleY(0);
  transition: transform .25s var(--ease);
}
.nav-item[aria-current="page"] { background: var(--brand-soft); color: var(--brand); }
.nav-item[aria-current="page"] .icon { color: var(--brand); }
.nav-item[aria-current="page"]::before { transform: scaleY(1); }
.nav-item .count {
  margin-left: auto;
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  background: var(--surface-3);
}
.nav-item[aria-current="page"] .count { background: var(--surface); color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand-line); }
.nav-item .count.live { color: #fff; background: var(--brand); box-shadow: 0 0 0 0 rgba(31, 95, 209, .45); animation: ring 2s infinite; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(31, 95, 209, .45); } 70%, 100% { box-shadow: 0 0 0 6px rgba(31, 95, 209, 0); } }
.sidebar .spacer { flex: 1; min-height: 12px; }

.sys-status { display: grid; gap: 7px; padding: 12px; margin: 0 0 10px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; }
.sys-status div { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); }
.sys-status .on, .sys-status .off { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.sys-status .on { color: var(--text-2); }
.sys-status .off { color: var(--muted); }
.sys-status .on::before, .sys-status .off::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--border-strong); }
.sys-status .on::before { background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

.me-box { display: flex; align-items: center; gap: 8px; padding: 10px 4px 2px; border-top: 1px solid var(--border); }
.me-box .avatar { --size: 32px; }
.me-box .name { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; color: var(--text); transition: color .15s; }
.me-box .name small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 500; }
.me-box .btn { --btn-fg: var(--muted); }
.me-box .btn:hover { --btn-fg: var(--text); background: var(--surface-3); }
.me-button { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 4px; margin: -4px; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: 8px; transition: background .15s; }
.me-button:hover { background: var(--surface-3); }
.me-button:focus-visible { outline: none; box-shadow: var(--focus); }

.scope-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 550;
}
.scope-pill .icon { color: var(--brand); }

.main { min-width: 0; display: flex; flex-direction: column; }
.page-head {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 20px 32px 18px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.page-head.scrolled { border-bottom-color: var(--border); box-shadow: 0 6px 20px -12px rgba(16, 24, 40, .18); background: color-mix(in srgb, var(--surface) 88%, transparent); }
.page-head h1 { font-size: 22px; font-weight: 650; letter-spacing: -.02em; }
.page-head .crumbs { display: flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.page-head .crumbs a { color: var(--muted); text-decoration: none; font-weight: 550; border-radius: 4px; transition: color .15s; }
.page-head .crumbs a:hover { color: var(--brand); }
.page-head .crumbs .sep { color: var(--border-strong); }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.page-body { width: 100%; max-width: 1480px; padding: 8px 32px 56px; display: grid; gap: 20px; align-content: start; }
.page-body > *, .grid > *, .card { min-width: 0; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: sticky; z-index: 6; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 2px; padding: 8px 10px; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar .logo { padding: 4px 6px; }
  .sidebar .logo small { display: none; }
  .sidebar .spacer, .sys-status, .scope-pill, .nav-section { display: none; }
  .cmdk-trigger { width: auto; margin: 0; }
  .cmdk-trigger .label, .cmdk-trigger kbd { display: none; }
  .me-box { border: 0; padding: 0; margin-left: auto; }
  .me-box .name { display: none; }
  .nav-item { padding: 7px 9px; }
  .nav-item::before { display: none; }
  .nav-item .label { display: none; }
  .page-head { position: static; padding: 16px 16px 12px; }
  .page-body { padding: 4px 16px 40px; }
}

/* ---------- Kort og rutenett ---------- */
.grid { display: grid; gap: 20px; }
.grid.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.grid.detail { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1100px) { .grid.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.two, .grid.detail { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .grid.kpis { grid-template-columns: 1fr; } }

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 20px; border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: 14.5px; font-weight: 650; letter-spacing: -.005em; }
.card-head .sub { margin-top: 1px; font-size: 12.5px; color: var(--muted); }
.card-body { padding: 18px 20px; }
.card-body.flush { padding: 0; }

.kpi { position: relative; padding: 18px 20px 16px; display: grid; gap: 8px; overflow: hidden; transition: box-shadow .2s, border-color .2s, transform .2s var(--ease); }
.kpi:hover { box-shadow: var(--shadow); border-color: var(--border-strong); transform: translateY(-1px); }
.kpi::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: linear-gradient(90deg, var(--brand), transparent 70%); opacity: 0; transition: opacity .2s; }
.kpi:hover::after { opacity: 1; }
.kpi .label { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); font-weight: 550; }
.kpi .label .icon { box-sizing: content-box; width: 16px; height: 16px; padding: 7px; border-radius: 8px; color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand-line); }
.kpi .value { font-size: 30px; font-weight: 650; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .value small { font-size: 16px; font-weight: 550; color: var(--muted); letter-spacing: 0; }
.kpi .foot { font-size: 12.5px; color: var(--muted); }

/* ---------- Tabeller ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table.data th {
  position: sticky;
  top: 0;
  text-align: left;
  font-weight: 650;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
}
table.data td { white-space: nowrap; padding: 12px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; transition: background .12s; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover td { background: color-mix(in srgb, var(--brand-soft) 55%, var(--surface)); }
table.data tbody tr.clickable td:first-child { box-shadow: inset 0 0 0 var(--brand); transition: background .12s, box-shadow .15s var(--ease); }
table.data tbody tr.clickable:hover td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
table.data tbody tr.clickable td:last-child .icon { transition: transform .2s var(--ease), color .15s; }
table.data tbody tr.clickable:hover td:last-child .icon { transform: translateX(3px); color: var(--brand); }
table.data td:first-child, table.data th:first-child { padding-left: 20px; }
table.data td:last-child, table.data th:last-child { padding-right: 16px; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data code { padding: 2px 6px; border-radius: 5px; background: var(--surface-3); color: var(--text-2); font-size: 12px; }
.cell-person { display: flex; align-items: center; gap: 12px; min-width: 150px; }
.cell-person .avatar { --size: 34px; }
.cell-person strong { display: block; font-weight: 600; color: var(--text); }
.cell-person small { color: var(--muted); font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.flow { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.flow .icon { color: var(--muted); width: 14px; height: 14px; }

.secret { display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 12.5px; white-space: nowrap; color: var(--text-2); }

.icon.copied { color: var(--success); animation: pop .3s var(--ease); }
@keyframes pop { 0% { transform: scale(.5); } 60% { transform: scale(1.2); } }
.secret .btn { --btn-fg: var(--muted); width: 26px; min-height: 26px; }
.secret .btn:hover { --btn-fg: var(--brand); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar .search { position: relative; flex: 1; min-width: 200px; max-width: 340px; }
.toolbar .search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; transition: color .15s; }
.toolbar .search:focus-within .icon { color: var(--brand); }
.toolbar .search .input { padding-left: 35px; }
.toolbar .select { width: auto; min-width: 150px; }
.summary-line { margin-left: auto; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Liste i kort ---------- */
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 20px; }
.list-row + .list-row { border-top: 1px solid var(--border); }
.list-row .grow { flex: 1; min-width: 0; }
.list-row small { color: var(--muted); }

.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 11px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; font-weight: 500; }

.detail-head { display: flex; align-items: center; gap: 16px; }
.detail-head .avatar { --size: 48px; }

.add-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
@media (max-width: 560px) { .add-row { grid-template-columns: 1fr; } }

.credentials { display: grid; gap: 10px; padding: 16px; border-radius: var(--radius); background: var(--surface-2); border: 1px dashed var(--border-strong); }
.credentials div { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.credentials strong { font-family: var(--mono); font-size: 15px; }

.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 0 rgba(31, 95, 209, .5); animation: ring 2s infinite; }

/* ---------- Aktivitetsdiagram ---------- */
.viz-root {
  --series-1: var(--brand);
  --series-2: #c3cfdf;
  --viz-surface: var(--surface);
  --viz-grid: var(--border);
  position: relative;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .viz-root { --series-2: #3a4b68; }
}
.viz-legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-2); }
.viz-legend span { display: inline-flex; align-items: center; gap: 6px; }
.viz-legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.viz-root svg { display: block; width: 100%; height: auto; overflow: visible; }
.viz-root .axis-label { font-size: 11px; fill: var(--muted); }
.viz-root .total-label { font-size: 11px; fill: var(--text-2); font-weight: 650; }
.viz-root .grid-line { stroke: var(--viz-grid); stroke-width: 1; stroke-dasharray: 2 4; }
.viz-root .hit { fill: transparent; cursor: default; }
.viz-root .hit:hover { fill: color-mix(in srgb, var(--brand) 6%, transparent); }
.viz-tip {
  position: absolute;
  pointer-events: none;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--navy);
  color: #e5ecf7;
  box-shadow: var(--shadow-lg);
  font-size: 12px;
  display: grid;
  gap: 4px;
  min-width: 170px;
  transform: translate(-50%, calc(-100% - 8px));
  z-index: 3;
  animation: tip-in .15s var(--ease);
}
@keyframes tip-in { from { opacity: 0; transform: translate(-50%, calc(-100% - 2px)); } }
.viz-tip strong { font-size: 12px; color: #fff; margin-bottom: 2px; }
.viz-tip div { display: flex; justify-content: space-between; gap: 12px; color: #b4c3da; }
.viz-tip b { color: #fff; font-variant-numeric: tabular-nums; }
.viz-tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; background: var(--c); }

/* ---------- Organisasjon ---------- */
.badge .icon { width: 12px; height: 12px; }

.demo-accounts { display: grid; gap: 12px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.demo-accounts > .label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.demo-role { display: grid; gap: 6px; }
.demo-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 10px 3px 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s, transform .15s var(--ease);
}
.demo-chip:hover { border-color: var(--brand-line); box-shadow: var(--shadow); transform: translateY(-1px); }
.demo-chip:focus-visible { outline: none; box-shadow: var(--focus); }
.demo-chip .avatar { --size: 24px; }
.demo-chip small { margin-left: 5px; color: var(--muted); font-weight: 500; }

.dept-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.dept-card { display: grid; gap: 16px; padding: 20px; color: inherit; text-decoration: none; transition: border-color .2s, box-shadow .2s, transform .2s var(--ease); }
.dept-card:hover { border-color: var(--brand-line); box-shadow: var(--shadow); transform: translateY(-2px); }
.dept-card-head { display: flex; gap: 14px; align-items: center; min-width: 0; }
.dept-card-head h2 { font-size: 15.5px; font-weight: 650; }
.dept-icon { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--brand-soft); color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand-line); }
.dept-icon .icon { width: 22px; height: 22px; }
.dept-leader { display: flex; align-items: center; gap: 10px; min-height: 30px; }
.dept-leader small { display: block; font-size: 11px; line-height: 1.2; }
.dept-leader strong { font-weight: 600; }
.dept-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding-top: 14px; border-top: 1px solid var(--border); }
.stat { display: grid; gap: 2px; }
.stat span { font-size: 18px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat small { font-size: 11.5px; color: var(--muted); }

.stack-actions { display: grid; gap: 8px; margin-top: 18px; justify-items: start; }

.online-list { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 20px; }
.online-person {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 320px;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: inherit;
  text-decoration: none;
  background: var(--surface-2);
  transition: border-color .15s, background .15s;
}
.online-person:hover { border-color: var(--brand-line); background: var(--brand-soft); }
.online-person strong { display: block; font-size: 13px; font-weight: 600; }
.online-person small { display: block; font-size: 11.5px; color: var(--muted); }

.profile-summary { display: flex; gap: 14px; align-items: center; padding-bottom: 6px; }
.divider { border: 0; border-top: 1px solid var(--border); margin: 6px 0; width: 100%; }

/* ---------- Eier og abonnement ---------- */
.sub-block { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); display: grid; gap: 10px; justify-items: start; }
.sub-block h3 { font-size: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.invite-row { display: flex; align-items: center; gap: 6px; width: 100%; }
.invite-row .grow { flex: 1; min-width: 0; }
.invite-row small { color: var(--muted); }
.pay-table { width: 100%; display: grid; }
.pay-line { display: flex; align-items: center; gap: 12px; padding: 8px 0; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.pay-line + .pay-line { border-top: 1px solid var(--border); }
.pay-line .grow { flex: 1; min-width: 0; }
.pay-line small { color: var(--muted); }
.callout { display: flex; gap: 10px; align-items: flex-start; margin-top: 16px; padding: 12px 14px; border-radius: var(--radius); background: var(--brand-soft); border: 1px solid var(--brand-line); }
.callout > .icon { color: var(--brand); }
.callout.danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 22%, transparent); }
.callout.danger > .icon { color: var(--danger); }
.secret-box { padding: 12px; border-radius: var(--radius-sm); background: var(--surface-3); word-break: break-all; font-size: 13px; }
.owner-set { margin: 4px 0 0; padding: 14px 16px 16px; border: 1px solid var(--border); border-radius: var(--radius); display: grid; gap: 12px; }
.owner-set legend { padding: 0 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }

/* ---------- API-nøkler og rettigheter (innhold.js) ---------- */
.scope-badges { display: flex; flex-wrap: wrap; gap: 4px; max-width: 360px; }
.badge.scope { padding: 1px 7px; font: 500 11px/1.5 var(--mono); }
.scope-list { margin: 0; padding: 0; border: 0; display: grid; gap: 6px; min-width: 0; }
.scope-list legend { padding: 0; margin-bottom: 6px; font-size: 13px; font-weight: 550; color: var(--text-2); }
.scope-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.scope-option:hover { border-color: var(--border-strong); }
.scope-option:has(input:checked) { border-color: var(--brand-line); background: var(--brand-soft); }
.scope-option input { flex: none; width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--brand); }
.scope-option span { display: grid; gap: 1px; min-width: 0; }
.scope-option strong { font-size: 13.5px; font-weight: 600; }
.scope-option code { font-size: 11.5px; color: var(--muted); }
.scope-option small { font-size: 12.5px; color: var(--muted); }
/* ---------- Innhold og profil på TV-siden (innhold.js) ---------- */
.card-head:has(.seg) { flex-wrap: wrap; }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 8px; background: var(--surface-3); }
.seg-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  font: 550 12.5px var(--font);
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.seg-btn:hover { color: var(--text); }
.seg-btn[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg-btn:focus-visible { outline: none; box-shadow: var(--focus); }
.seg-count { min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: 11px; font-weight: 650; text-align: center; }
.profile-facts { margin-bottom: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.profile-facts .provider-select { width: auto; min-width: 220px; max-width: 100%; }
.consent-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.lineup-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.lineup-head .field { width: 170px; }
.lineup-head .grow { flex: 1; min-width: 220px; }
.lineup-rows { display: grid; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.lineup-row { display: grid; grid-template-columns: 30px minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: center; padding: 6px 10px; }
.lineup-row + .lineup-row { border-top: 1px solid var(--border); }
.lineup-row.head { padding-block: 8px; background: var(--surface-2); font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.lineup-row .slot-no { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--text-2); }
.lineup-row .select, .lineup-row .input { min-height: 32px; padding: 5px 9px; font-size: 13px; }
.lineup-row .input:disabled { background: var(--surface-2); box-shadow: none; }
.lineup-now { display: grid; min-width: 0; font-size: 13px; }
.lineup-now strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.lineup-now small { font-size: 11.5px; color: var(--muted); }
.lineup-now.warn small { color: var(--warning); }
.lineup-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.lineup-actions { display: inline-flex; align-items: center; gap: 12px; }
.warning-text { color: var(--warning); font-weight: 550; }
@media (max-width: 640px) {
  .lineup-row { grid-template-columns: 26px minmax(0, 1fr); }
  .lineup-row > :nth-child(n+3) { grid-column: 2; }
  .lineup-row.head, .lineup-row .input:disabled { display: none; }
}
.wide { grid-column: 1 / -1; }
.check-set { margin: 0; padding: 0; border: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; min-width: 0; }
.check-set legend { padding: 0; margin-bottom: 8px; font-size: 13px; font-weight: 550; color: var(--text-2); }
.check-row { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.check-row input { width: 16px; height: 16px; margin: 0; accent-color: var(--brand); }
.family-list { display: grid; }
.family-item { display: flex; gap: 14px; align-items: flex-start; padding: 12px 0; }
.family-item:first-child { padding-top: 0; }
.family-item + .family-item { border-top: 1px solid var(--border); }
.family-item .grow { flex: 1; min-width: 0; display: grid; gap: 4px; }
.family-item p { white-space: pre-wrap; overflow-wrap: anywhere; }
.family-item small { font-size: 12px; color: var(--muted); }
.family-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.family-icon { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: var(--brand-soft); color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand-line); }
.family-thumb { flex: none; display: block; width: 96px; height: 72px; overflow: hidden; border-radius: var(--radius-sm); background: var(--surface-3); border: 1px solid var(--border); }
.family-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* ---------- Lasting: skjelett i stedet for spinner ---------- */
.skeleton { display: grid; gap: 20px; }
.skeleton .bone {
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--surface-3) 0%, color-mix(in srgb, var(--surface-3) 40%, var(--surface)) 50%, var(--surface-3) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}
.skeleton .row { display: grid; gap: 20px; grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .skeleton .row { grid-template-columns: repeat(2, 1fr); } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Inngang: innholdet glir rolig inn når man bytter side ---------- */
.page-body.enter > *,
.page-body.enter .grid > * { animation: rise .5s var(--ease) both; }
.page-body.enter > :nth-child(2) { animation-delay: .06s; }
.page-body.enter > :nth-child(3) { animation-delay: .12s; }
.page-body.enter > :nth-child(n+4) { animation-delay: .18s; }
.page-body.enter .grid > :nth-child(2) { animation-delay: .05s; }
.page-body.enter .grid > :nth-child(3) { animation-delay: .1s; }
.page-body.enter .grid > :nth-child(4) { animation-delay: .15s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.page-body.enter .viz-root .bar { transform-box: fill-box; transform-origin: 50% 100%; animation: grow .7s var(--ease) both; }
@keyframes grow { from { transform: scaleY(0); } }

/* ---------- Kommandopalett (Ctrl/⌘ + K) ---------- */
dialog.cmdk {
  width: min(640px, calc(100% - 32px));
  margin: 12vh auto auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
dialog.cmdk[open] { animation: cmdk-in .18s var(--ease); }
dialog.cmdk::backdrop { background: rgba(12, 29, 58, .32); backdrop-filter: blur(4px); }
@keyframes cmdk-in { from { opacity: 0; transform: translateY(-6px) scale(.985); } }
.cmdk-search { display: flex; align-items: center; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--border); }
.cmdk-search > .icon { color: var(--brand); width: 18px; height: 18px; }
.cmdk-search input { flex: 1; height: 56px; border: 0; outline: 0; background: none; color: var(--text); font: 400 16px/1 var(--font); }
.cmdk-search input::placeholder { color: var(--muted); }
.cmdk-list { max-height: min(420px, 56vh); overflow-y: auto; padding: 6px; scroll-padding: 8px; }
.cmdk-group { padding: 10px 12px 6px; font-size: 11px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.cmdk-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.cmdk-item > .icon { color: var(--muted); }
.cmdk-item .avatar { --size: 26px; font-size: 10px; }
.cmdk-item .text { flex: 1; min-width: 0; }
.cmdk-item .text strong { display: block; font-weight: 550; }
.cmdk-item .text small { display: block; font-size: 12px; color: var(--muted); }
.cmdk-item .go { opacity: 0; color: var(--brand); transform: translateX(-4px); transition: opacity .12s, transform .15s var(--ease); }
.cmdk-item[aria-selected="true"] { background: var(--brand-soft); }
.cmdk-item[aria-selected="true"] > .icon { color: var(--brand); }
.cmdk-item[aria-selected="true"] .go { opacity: 1; transform: none; }
.cmdk-item mark { background: none; color: var(--brand); font-weight: 650; }
.cmdk-empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.cmdk-foot { display: flex; align-items: center; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--border); background: var(--surface-2); font-size: 12px; color: var(--muted); }
.cmdk-foot span { display: inline-flex; align-items: center; gap: 6px; }
.cmdk-foot .spacer { flex: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
