:root {
  /* === REITAN brand palette === */
  --reitan-bronze:   #b58763;   /* primary accent */
  --reitan-bronze-d: #8c6647;   /* deeper bronze */
  --reitan-bronze-l: #d5b594;   /* lighter bronze */
  --reitan-blue:     #141432;   /* deep navy — secondary base */
  --reitan-blue-d:   #0a0a1f;
  --reitan-black:    #1a191b;
  --reitan-red:      #ff7376;
  --reitan-grey:     #e4e4e3;
  --reitan-grey-d:   #d2d2d0;
  --reitan-white:    #ffffff;

  /* === Default theme: light/grey (matches brand primary "blue logo on grey") === */
  --bg-page:   #ebebe9;   /* main page bg — warm grey */
  --bg-0:      #f4f4f1;   /* card bg / surface */
  --bg-1:      #fafaf7;   /* elevated surface */
  --bg-2:      #ebebe6;   /* hover */
  --bg-3:      #dedeD9;   /* deeper neutral */
  --bg-deep:   var(--reitan-blue);   /* deep blue accent areas */
  --border:    #cfcfca;
  --border-soft: #dadad5;
  --border-strong: #b5b5b0;

  --text:      var(--reitan-blue);
  --text-mid:  #3a3a4a;
  --text-mute: #6c6c75;
  --text-dim:  #8e8e94;
  --text-on-blue: var(--reitan-grey);

  --accent:       var(--reitan-bronze);
  --accent-deep:  var(--reitan-bronze-d);
  --accent-soft:  rgba(181, 135, 99, 0.14);
  --accent-line:  rgba(181, 135, 99, 0.40);
  --accent-bg:    #f0e6db;

  --amber: #c69248;
  --teal:  #5c8a8f;
  --violet: #6f5d8a;
  --green:  #6d8e63;
  --red:    #c14a4c;
  --amber-soft: rgba(198, 146, 72, 0.14);
  --teal-soft:  rgba(92, 138, 143, 0.14);
  --violet-soft: rgba(111, 93, 138, 0.14);
  --green-soft: rgba(109, 142, 99, 0.14);
  --red-soft:   rgba(193, 74, 76, 0.12);

  --row: 36px;
  --row-roomy: 46px;
  --radius: 6px;
  --radius-sm: 4px;
  --radius-lg: 10px;

  --font-sans:  Arial, "Helvetica Neue", Helvetica, sans-serif;
  --font-mono:  ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --font-serif: Arial, "Helvetica Neue", Helvetica, sans-serif; /* rebranding 2026-08: alt i Arial — var beholdt så gamle regler virker */

  --shadow-sm: 0 1px 1px rgba(20, 20, 50, 0.04), 0 1px 2px rgba(20, 20, 50, 0.05);
  --shadow-md: 0 6px 18px rgba(20, 20, 50, 0.08);
  --shadow-lg: 0 24px 56px rgba(20, 20, 50, 0.12);

  --letter-loose: 0.18em;
  --letter-mid:   0.10em;
}

[data-theme="dark"] {
  --bg-page:   var(--reitan-blue);
  --bg-0:      #1a1a3a;
  --bg-1:      #20203f;
  --bg-2:      #292947;
  --bg-3:      #333354;
  --border:    #3a3a58;
  --border-soft: #2a2a48;
  --border-strong: #4a4a66;
  --text:      #ecebe6;
  --text-mid:  #b8b6ab;
  --text-mute: #8b8a7f;
  --text-dim:  #6a6962;
  --text-on-blue: var(--reitan-grey);
  --accent-soft: rgba(213, 181, 148, 0.14);
  --accent-line: rgba(213, 181, 148, 0.40);
  --accent-bg:   rgba(213, 181, 148, 0.08);
  --accent:      var(--reitan-bronze-l);
  --accent-deep: var(--reitan-bronze);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.30);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.40);
  --shadow-lg: 0 24px 56px rgba(0, 0, 0, 0.55);
}
[data-theme="dark"] .chip { background: transparent; }
[data-theme="dark"] .chip[data-tone="muted"] { color: var(--text-mid); }
[data-theme="dark"] .chip[data-tone="amber"]  { color: #e0b06a; border-color: rgba(198, 146, 72, 0.40); }
[data-theme="dark"] .chip[data-tone="teal"]   { color: #8db5b9; border-color: rgba(92, 138, 143, 0.40); }
[data-theme="dark"] .chip[data-tone="violet"] { color: #a08fc4; border-color: rgba(111, 93, 138, 0.40); }
[data-theme="dark"] .chip[data-tone="green"]  { color: #9cb893; border-color: rgba(109, 142, 99, 0.40); }
[data-theme="dark"] .chip[data-tone="red"]    { color: #e8908b; border-color: rgba(255, 115, 118, 0.45); }

[data-density="roomy"] { --row: 48px; }

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg-page);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body { min-height: 100vh; }
button { font: inherit; color: inherit; }

/* === Typographic hierarchy === */
.serif-display {
  font-family: var(--font-serif);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: var(--letter-mid);
  line-height: 1.05;
}
.serif-display.tight { letter-spacing: 0.04em; }
.serif-display.large { font-size: 40px; line-height: 1.02; letter-spacing: 0.03em; }
.eyebrow {
  font-family: var(--font-sans);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: var(--letter-loose);
  color: var(--text-mute);
  font-weight: 500;
}

/* === Layout === */
.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  background: var(--bg-page);
}
.app[data-nav="icons"] { grid-template-columns: 72px 1fr; }

/* Sidebar mask (mobile) */
.sidebar-mask {
  display: none;
  position: fixed; inset: 0;
  background: rgba(20, 20, 50, 0.5);
  z-index: 40;
  backdrop-filter: blur(2px);
  animation: fade-in 160ms ease-out;
}

/* Mobile menu button — hidden on desktop */
.menu-toggle {
  display: none;
  width: 38px; height: 38px;
  background: transparent;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text);
  flex: none;
}
.menu-toggle:hover { background: var(--bg-2); }

/* Sidebar — calm, paper-like */
.sidebar {
  background: var(--bg-0);
  border-right: 1px solid var(--border-soft);
  padding: 28px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}
.brand {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 8px 8px 26px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border-soft);
}
.brand-mark {
  width: 56px; height: 56px;
  display: grid; place-items: center;
  flex: none;
}
.brand-mark svg { width: 100%; height: 100%; }
.brand-mark .star { fill: var(--reitan-bronze); }
[data-theme="dark"] .brand-mark .star { fill: var(--reitan-bronze-l); }
.brand-name {
  font-family: var(--font-serif);
  font-size: 15.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--text);
  line-height: 1;
  margin-top: 2px;
}
.brand-sub {
  font-family: var(--font-sans);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-top: 2px;
}

.app[data-nav="icons"] .brand-name,
.app[data-nav="icons"] .brand-sub,
.app[data-nav="icons"] .nav-section,
.app[data-nav="icons"] .nav-item span:not(.icon):not(.badge),
.app[data-nav="icons"] .sidebar-footer .pm-info { display: none; }
.app[data-nav="icons"] .brand-mark { width: 40px; height: 40px; }
.app[data-nav="icons"] .nav-item { justify-content: center; padding: 10px; }
.app[data-nav="icons"] .nav-item .badge { display: none; }
/* Kollapset meny: sentrer også bunnen (profil) og fjern den tomme tekstkolonnen. */
.app[data-nav="icons"] .sidebar-footer { justify-content: center; padding-left: 0; padding-right: 0; }
.app[data-nav="icons"] .profile-mini { display: none; }

.nav-section {
  font-size: 9.5px; text-transform: uppercase;
  letter-spacing: var(--letter-loose); color: var(--text-dim);
  padding: 18px 12px 8px; font-weight: 500;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: var(--radius);
  color: var(--text-mid); cursor: pointer;
  font-size: 13px; font-weight: 400;
  transition: background 100ms, color 100ms;
  text-align: left; background: transparent; border: 0;
  width: 100%;
}
.nav-item:hover { background: var(--bg-2); color: var(--text); }
.nav-item > span:not(.icon):not(.badge) {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0; flex: 1;
}
.nav-item[data-active="true"] {
  background: transparent; color: var(--text);
  font-weight: 500;
}
.nav-item[data-active="true"]::before {
  content: ""; position: absolute; margin-left: -18px;
  width: 2px; height: 18px;
  background: var(--accent);
}
.nav-item { position: relative; }
.nav-item .icon { width: 16px; height: 16px; opacity: 0.7; flex: none; }
.nav-item[data-active="true"] .icon { opacity: 1; color: var(--accent); }
.nav-item .badge {
  margin-left: auto; font-size: 10px; font-family: var(--font-mono); color: var(--text-mute);
  font-weight: 500;
}
.nav-item .badge[data-tone="accent"] { color: var(--accent-deep); }
.nav-item .badge[data-tone="red"]    { color: var(--red); }

.sidebar-footer {
  margin-top: auto;
  padding: 16px 12px 4px;
  border-top: 1px solid var(--border-soft);
  display: flex; align-items: center; gap: 11px;
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--reitan-bronze);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 500; color: white;
  font-family: var(--font-sans);
  flex: none;
  letter-spacing: 0.04em;
}
.avatar[data-size="lg"] { width: 64px; height: 64px; font-size: 18px; border-radius: 50%; }
.avatar[data-size="md"] { width: 36px; height: 36px; font-size: 12px; }
.avatar[data-size="sm"] { width: 22px; height: 22px; font-size: 9.5px; }
[data-theme="dark"] .avatar { background: var(--reitan-bronze); color: var(--reitan-blue); }

/* === Main === */
.main { min-width: 0; display: flex; flex-direction: column; background: var(--bg-page); }
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 36px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-page);
  position: sticky; top: 0; z-index: 20;
}
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.14em; font-weight: 500; }
.crumbs .sep { opacity: 0.4; }
.crumbs .current { color: var(--text); }
.crumbs button { background: transparent; border: 0; color: inherit; cursor: pointer; padding: 0; font: inherit; text-transform: inherit; letter-spacing: inherit; }
.crumbs button:hover { color: var(--text); }
.topbar-spacer { flex: 1; }
.topbar-search {
  position: relative; flex: 0 1 380px;
}
.topbar-search input {
  width: 100%;
  background: var(--bg-0); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 8px 12px 8px 34px; font-size: 12.5px; color: var(--text);
  font-family: inherit;
}
.topbar-search input::placeholder { color: var(--text-dim); }
.topbar-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.topbar-search .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-dim); }
.topbar-search .k { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); }

.content { padding: 32px 44px 96px; max-width: 1380px; width: 100%; margin: 0 auto; }

/* Page heading */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin: 8px 0 28px; padding-bottom: 22px; border-bottom: 1px solid var(--border-soft); }
.page-eyebrow {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: var(--letter-loose);
  color: var(--text-mute); font-weight: 500; margin-bottom: 8px;
}
.page-title {
  font-family: var(--font-serif);
  font-size: 27px; font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.04;
  color: var(--text);
}
.page-title .num,
.page-title .accent-num {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 17px;
  color: var(--accent);
  margin-left: 14px;
  text-transform: lowercase;
  letter-spacing: 0;
  font-weight: 300;
}
.page-sub { color: var(--text-mute); font-size: 12.5px; margin-top: 8px; max-width: 64ch; line-height: 1.55; }

/* === Hero (Forside) — editorial, samme paper-palett som resten === */
.hero {
  position: relative;
  border-radius: var(--radius);
  background: var(--bg-0);
  color: var(--text);
  overflow: hidden;
  margin-bottom: 36px;
  min-height: 380px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--border-soft);
}
.hero-photo {
  position: relative;
  background: var(--bg-3);
  overflow: hidden;
}
.hero-photo image-slot {
  width: 100%; height: 100%;
  border-radius: 0;
  border: 0;
}
.hero-photo .photo-credit {
  position: absolute; bottom: 16px; left: 18px;
  font-size: 10px; letter-spacing: var(--letter-mid); text-transform: uppercase;
  color: rgba(228, 228, 227, 0.75);
  z-index: 2;
  font-weight: 500;
}
.hero-content {
  padding: 44px 48px 40px;
  display: flex; flex-direction: column;
  justify-content: space-between;
  position: relative;
  z-index: 1;
}
.hero-stjerna {
  position: absolute;
  top: 28px; right: 32px;
  width: 38px; height: 38px;
  opacity: 0.85;
}
.hero-eyebrow {
  font-size: 10px; text-transform: uppercase;
  letter-spacing: var(--letter-loose);
  color: var(--accent-deep);
  font-weight: 500;
  margin-bottom: 16px;
}
.hero-greeting {
  font-family: var(--font-serif);
  font-style: normal;
  font-weight: 600;
  font-size: 32px;
  letter-spacing: -0.005em;
  line-height: 1.0;
  color: var(--text);
}
.hero-greeting .caps {
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 400;
  display: block;
  margin-top: 6px;
  color: var(--text);
}
.hero-meta {
  margin-top: 28px;
  display: flex; gap: 22px; flex-wrap: wrap; align-items: center;
  font-size: 12px;
  color: var(--text-mute);
  letter-spacing: 0.02em;
}
.hero-meta .sep { opacity: 0.4; }
.hero-meta .weather { color: var(--accent-deep); font-family: var(--font-mono); }

.hero-quick {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-top: 36px;
}
.hero-quick button {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 11px; cursor: pointer;
  font-family: var(--font-sans);
  text-transform: uppercase; letter-spacing: 0.14em;
  font-weight: 500;
  transition: background 120ms, border-color 120ms, color 120ms;
}
.hero-quick button:hover { background: var(--bg-2); border-color: var(--accent); color: var(--accent-deep); }
.hero-quick button[data-variant="strong"] {
  background: var(--reitan-blue);
  border-color: var(--reitan-blue);
  color: var(--reitan-grey);
}
.hero-quick button[data-variant="strong"]:hover {
  background: #232352;
  border-color: #232352;
  color: var(--reitan-grey);
}
[data-theme="dark"] .hero-quick button[data-variant="strong"] {
  background: var(--reitan-bronze);
  border-color: var(--reitan-bronze);
  color: var(--reitan-blue);
}
[data-theme="dark"] .hero-quick button[data-variant="strong"]:hover {
  background: var(--reitan-bronze-l);
  border-color: var(--reitan-bronze-l);
}

/* === Buttons === */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--bg-0); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 14px; font-size: 12px; cursor: pointer;
  transition: background 100ms, border-color 100ms, color 100ms;
  white-space: nowrap;
  font-family: var(--font-sans);
  letter-spacing: 0.02em;
  font-weight: 500;
}
.btn:hover { background: var(--bg-2); border-color: var(--border-strong); }
.btn[data-variant="primary"] {
  background: var(--reitan-blue); border-color: var(--reitan-blue); color: var(--reitan-grey);
}
.btn[data-variant="primary"]:hover { background: #232352; border-color: #232352; }
[data-theme="dark"] .btn[data-variant="primary"] { background: var(--reitan-bronze); border-color: var(--reitan-bronze); color: var(--reitan-blue); }
[data-theme="dark"] .btn[data-variant="primary"]:hover { background: var(--reitan-bronze-l); border-color: var(--reitan-bronze-l); }

.btn[data-variant="accent"] {
  background: var(--reitan-bronze); border-color: var(--reitan-bronze); color: var(--reitan-blue);
}
.btn[data-variant="accent"]:hover { background: var(--reitan-bronze-l); border-color: var(--reitan-bronze-l); }

.btn[data-variant="ghost"] { background: transparent; border-color: transparent; color: var(--text-mid); }
.btn[data-variant="ghost"]:hover { background: var(--bg-2); color: var(--text); }
.btn[data-variant="danger"] {
  background: transparent; border-color: rgba(193, 74, 76, 0.4); color: var(--red);
}
.btn[data-variant="danger"]:hover { background: var(--red-soft); }
.btn[data-size="sm"] { padding: 6px 11px; font-size: 11.5px; }
.btn[data-size="lg"] { padding: 11px 20px; font-size: 12.5px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* === Cards / Panels — paper-like, calm === */
.panel {
  background: var(--bg-0);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-soft);
}
.panel-head h3 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--text);
}
.panel-head .panel-sub {
  color: var(--text-mute); font-size: 11.5px;
  font-family: var(--font-mono);
  text-transform: lowercase;
}
.panel-head .panel-num {
  font-family: var(--font-serif); font-style: italic;
  font-size: 12px; font-weight: 400;
  color: var(--accent);
  margin-left: 6px;
}
.panel-body { padding: 20px 22px; }
.panel-body.flush { padding: 0; }
.panel[data-emphasis="accent"] {
  border-color: var(--accent-line);
  background: linear-gradient(180deg, var(--accent-bg), var(--bg-0) 70%);
}
.panel[data-emphasis="deep"] {
  background: var(--reitan-blue);
  color: var(--text-on-blue);
  border-color: var(--reitan-blue);
}
.panel[data-emphasis="deep"] .panel-head { border-color: rgba(213, 181, 148, 0.2); }
.panel[data-emphasis="deep"] .panel-head h3 { color: var(--reitan-grey); }
.panel[data-emphasis="deep"] .mute { color: rgba(228, 228, 227, 0.7); }

/* === Widget grid === */
.widget-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-flow: row dense;
  gap: 22px;
}
/* Masonry KUN for tilpassbar forside (CustomDashboard). Krever JS-en der som
   setter grid-row-end per celle. grid-auto-rows:8px uten den JS-en kollapser
   alle celler til 8px – derfor IKKE på delt .widget-grid (Intranett, admin,
   cost, brukerbehandling bruker samme klasse). */
.widget-grid--masonry {
  grid-auto-rows: 8px;
  align-items: start;
}
.widget-grid > * { grid-column: span 6; min-width: 0; }
.widget-grid > [data-span="3"] { grid-column: span 3; }
.widget-grid > [data-span="4"] { grid-column: span 4; }
.widget-grid > [data-span="6"] { grid-column: span 6; }
.widget-grid > [data-span="7"] { grid-column: span 7; }
.widget-grid > [data-span="5"] { grid-column: span 5; }
.widget-grid > [data-span="8"] { grid-column: span 8; }
.widget-grid > [data-span="12"] { grid-column: span 12; }
@media (max-width: 1100px) {
  .widget-grid > * { grid-column: span 12; }
  .widget-grid > [data-span="3"], .widget-grid > [data-span="4"] { grid-column: span 6; }
}

/* === KPI === */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-bottom: 24px; }
.kpi {
  background: var(--bg-0); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 22px 22px 18px; position: relative; overflow: hidden;
}
.kpi-label {
  font-size: 10px; color: var(--text-mute);
  text-transform: uppercase; letter-spacing: var(--letter-loose);
  font-weight: 500;
}
.kpi-value {
  font-family: var(--font-serif);
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: 10px;
  color: var(--text);
  font-feature-settings: "tnum";
  line-height: 1;
}
.kpi-value .unit { color: var(--text-mute); font-size: 14px; font-weight: 300; margin-left: 6px; font-family: var(--font-sans); }
.kpi-meta {
  display: flex; align-items: center; gap: 8px;
  margin-top: 12px; font-size: 11px; color: var(--text-mute);
}
.kpi-delta { font-family: var(--font-mono); }
.kpi-delta[data-dir="up"] { color: var(--green); }
.kpi-delta[data-dir="down"] { color: var(--accent-deep); }
.kpi-spark { position: absolute; right: 16px; top: 18px; opacity: 0.7; }

/* === Lists === */
.list { display: flex; flex-direction: column; }
.list-item {
  display: grid; grid-template-columns: 1fr auto; gap: 14px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border-soft);
  align-items: center;
}
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--bg-2); }
.list-item .li-title { font-size: 13px; color: var(--text); }
.list-item .li-meta { font-size: 11px; color: var(--text-mute); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.list-item .li-amount { font-family: var(--font-mono); font-size: 12px; }

/* Sak row */
.sak-row {
  display: grid;
  grid-template-columns: 80px 1fr auto auto auto;
  gap: 16px;
  padding: 14px 22px;
  align-items: center;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  transition: background 100ms;
}
.sak-row:hover { background: var(--bg-2); }
.sak-row:last-child { border-bottom: 0; }
.sak-num { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-mute); }
.sak-title { font-size: 13px; color: var(--text); }
.sak-meta { font-size: 11px; color: var(--text-mute); margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* === Chips === */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px; height: 22px;
  border-radius: 0; font-size: 10.5px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-mid);
  font-family: var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  font-weight: 500;
  white-space: nowrap;
}
.chip .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: 0.7; }
.chip[data-tone="accent"] { color: var(--accent-deep); border-color: var(--accent-line); }
.chip[data-tone="amber"]  { color: #8a6321; border-color: rgba(198, 146, 72, 0.50); }
.chip[data-tone="teal"]   { color: #355559; border-color: rgba(92, 138, 143, 0.45); }
.chip[data-tone="violet"] { color: #463863; border-color: rgba(111, 93, 138, 0.45); }
.chip[data-tone="green"]  { color: #3d5933; border-color: rgba(109, 142, 99, 0.50); }
.chip[data-tone="red"]    { color: var(--red); border-color: rgba(193, 74, 76, 0.5); }
.chip[data-tone="muted"]  { color: var(--text-mute); }

/* === Filter bar === */
.filterbar { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.input {
  background: var(--bg-0); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 12px; font-size: 12.5px; color: var(--text); min-width: 240px;
  font-family: inherit;
}
.input::placeholder { color: var(--text-dim); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.select {
  background: var(--bg-0); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 12px; font-size: 12.5px; color: var(--text);
  font-family: inherit;
}
textarea.input { font-family: var(--font-sans); min-height: 90px; resize: vertical; }

/* === Segmented switcher === */
.viewswitch {
  display: inline-flex; background: var(--bg-0); border: 1px solid var(--border); border-radius: var(--radius); padding: 2px;
}
.viewswitch button {
  background: transparent; border: 0; color: var(--text-mute);
  padding: 5px 12px; border-radius: 3px; cursor: pointer; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.12em; font-weight: 500;
  font-family: var(--font-sans);
}
.viewswitch button[data-active="true"] { background: var(--reitan-blue); color: var(--reitan-grey); }
[data-theme="dark"] .viewswitch button[data-active="true"] { background: var(--reitan-bronze); color: var(--reitan-blue); }

/* === Tabs === */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border-soft); margin-bottom: 22px; }
.tab {
  padding: 12px 18px 14px; cursor: pointer;
  color: var(--text-mute); font-size: 11.5px;
  border-bottom: 2px solid transparent;
  background: transparent; border-top: 0; border-left: 0; border-right: 0;
  transition: color 100ms, border-color 100ms;
  text-transform: uppercase; letter-spacing: 0.14em; font-weight: 500;
  font-family: var(--font-sans);
}
.tab:hover { color: var(--text); }
.tab[data-active="true"] { color: var(--text); border-bottom-color: var(--accent); }

/* === Tables === */
.pivot-wrap { width: 100%; overflow-x: auto; }
table.pivot {
  width: 100%; border-collapse: collapse; font-size: 12.5px;
  font-feature-settings: "tnum";
}
.pivot th, .pivot td {
  text-align: left; padding: 0 18px; height: var(--row);
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}
.pivot th {
  font-weight: 500; color: var(--text-mute); font-size: 10px;
  text-transform: uppercase; letter-spacing: var(--letter-loose);
  background: transparent; position: sticky; top: 0; z-index: 1;
  padding-top: 14px; padding-bottom: 14px;
  height: auto;
}
.pivot td.num, .pivot th.num { text-align: right; font-family: var(--font-mono); }
.pivot tr.row-user { cursor: pointer; }
.pivot tr.row-user:hover { background: var(--bg-2); }

/* === Drawer === */
.drawer-mask {
  position: fixed; inset: 0; background: rgba(20, 20, 50, 0.55); z-index: 50;
  animation: fade-in 160ms ease-out;
  backdrop-filter: blur(2px);
}
.drawer {
  position: fixed; right: 0; top: 0; bottom: 0;
  width: min(880px, 94vw); background: var(--bg-page);
  border-left: 1px solid var(--border);
  z-index: 51;
  display: flex; flex-direction: column;
  animation: slide-in 200ms ease-out;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.drawer-head {
  display: flex; align-items: center; gap: 14px;
  padding: 22px 30px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-0);
}
.drawer-head .drawer-title {
  font-family: var(--font-serif);
  font-size: 18px; font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1.2;
}
.drawer-body { padding: 30px; overflow: auto; flex: 1; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-in { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 0.8s linear infinite; }

/* === Drift card === */
.drift-card {
  padding: 18px 22px;
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  background: var(--bg-0);
  display: grid; grid-template-columns: 36px 1fr auto; gap: 16px;
  align-items: start;
}
.drift-card[data-severity="critical"] { border-left: 3px solid var(--red); }
.drift-card[data-severity="warning"] { border-left: 3px solid var(--amber); }
.drift-card[data-severity="info"] { border-left: 3px solid var(--accent); }
.drift-card[data-severity="resolved"] { opacity: 0.7; }
.drift-icon {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  color: var(--text-mute);
}
.drift-card[data-severity="critical"] .drift-icon { color: var(--red); }
.drift-card[data-severity="warning"] .drift-icon { color: var(--amber); }
.drift-card[data-severity="info"] .drift-icon { color: var(--accent); }
.drift-card[data-severity="resolved"] .drift-icon { color: var(--green); }
.drift-card .drift-title {
  font-family: var(--font-serif);
  font-size: 17px; font-weight: 400;
  text-transform: uppercase; letter-spacing: 0.06em;
  line-height: 1.2;
}
.drift-card .drift-body { font-size: 12.5px; color: var(--text-mid); margin-top: 8px; max-width: 80ch; line-height: 1.6; }
.drift-card .drift-meta { font-size: 11px; color: var(--text-mute); margin-top: 12px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.drift-card .drift-meta .sep { opacity: 0.4; }

/* Pulse */
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(181, 135, 99, 0.5); }
  100% { box-shadow: 0 0 0 12px rgba(181, 135, 99, 0); }
}
.pulse-dot {
  display: inline-block;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  animation: pulse-ring 1.6s infinite;
}

/* === Quick tile === */
.quick-tile {
  background: var(--bg-0); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 24px 22px 22px;
  display: flex; flex-direction: column; gap: 8px;
  cursor: pointer; text-align: left;
  transition: border-color 120ms, background 120ms;
  width: 100%;
  min-height: 144px;
  position: relative;
  overflow: hidden;
}
.quick-tile:hover {
  border-color: var(--accent);
  background: var(--bg-1);
}
.quick-tile .qt-icon {
  width: 36px; height: 36px;
  color: var(--accent);
  display: grid; place-items: center;
  margin-bottom: 8px;
}
.quick-tile .qt-name {
  font-family: var(--font-serif);
  font-size: 17px; font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text);
}
.quick-tile .qt-desc { font-size: 11.5px; color: var(--text-mute); line-height: 1.5; margin-top: 2px; }
.quick-tile .qt-badge {
  position: absolute; top: 22px; right: 22px;
  font-family: var(--font-mono); font-size: 10px;
  color: var(--accent-deep);
  text-transform: uppercase; letter-spacing: 0.1em;
}

/* === News === */
.news-item { padding: 18px 22px; border-bottom: 1px solid var(--border-soft); display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: start; cursor: pointer; }
.news-item:hover { background: var(--bg-2); }
.news-item:last-child { border-bottom: 0; }
.news-title {
  font-family: var(--font-serif);
  font-size: 16px; font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.2;
}
.news-meta { font-size: 10.5px; color: var(--text-mute); margin-top: 8px; text-transform: uppercase; letter-spacing: 0.10em; font-weight: 500; }
.news-thumb {
  width: 84px; height: 64px;
  background: linear-gradient(135deg, var(--reitan-blue), #232352);
  display: grid; place-items: center;
  font-family: var(--font-serif);
  color: var(--reitan-bronze-l);
  font-size: 13px;
  letter-spacing: 0.10em;
  flex: none;
  text-transform: uppercase;
  overflow: hidden;   /* bilde fyller boksen; gradient er fallback hvis det 403'er */
}
.news-thumb > img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* === Steps === */
.steps {
  display: flex; flex-direction: column;
  background: var(--bg-0);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
}
.step {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-soft);
  align-items: center;
}
.step:last-child { border-bottom: 0; }
.step .step-mark {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  background: transparent; color: var(--text-mute);
  font-family: var(--font-serif); font-size: 13px;
  font-style: italic;
}
.step[data-state="done"] .step-mark { background: var(--reitan-blue); color: var(--reitan-grey); border-color: var(--reitan-blue); }
[data-theme="dark"] .step[data-state="done"] .step-mark { background: var(--reitan-bronze); color: var(--reitan-blue); border-color: var(--reitan-bronze); }
.step[data-state="active"] .step-mark { color: var(--accent); border-color: var(--accent); }
.step[data-state="active"] { background: var(--accent-bg); }
[data-theme="dark"] .step[data-state="active"] { background: rgba(181, 135, 99, 0.08); }
.step .step-title { font-size: 13px; }
.step .step-meta { font-size: 11px; color: var(--text-mute); margin-top: 3px; font-family: var(--font-mono); }

/* === Bar fill === */
.bar-track { width: 100%; height: 3px; background: var(--bg-3); overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); transition: width 300ms; }

/* === Toast === */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: var(--reitan-blue); color: var(--reitan-grey);
  padding: 14px 22px; border-radius: var(--radius); z-index: 100;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 12px;
  animation: fade-in 200ms ease-out;
  font-size: 12.5px;
  letter-spacing: 0.02em;
}
.toast .toast-mark {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  color: var(--reitan-bronze);
}

/* === Approval card === */
.approval-card {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-soft);
  display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center;
}
.approval-card:last-child { border-bottom: 0; }
.approval-icon {
  width: 40px; height: 40px;
  background: var(--accent-bg);
  color: var(--accent-deep);
  display: grid; place-items: center;
  border-radius: 50%;
}
.approval-title {
  font-family: var(--font-serif);
  font-size: 16px; font-weight: 400;
  text-transform: uppercase; letter-spacing: 0.06em;
  line-height: 1.2;
}
.approval-meta { font-size: 11px; color: var(--text-mute); margin-top: 6px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; letter-spacing: 0.02em; }

/* === Embed banner === */
.embed-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 22px;
  background: transparent;
  border: 0;
  border-left: 2px solid var(--accent);
  margin-bottom: 24px;
  font-size: 12px; color: var(--text-mute);
  font-style: italic;
  font-family: var(--font-serif);
  font-size: 14px;
}
.embed-banner .eb-link { color: var(--accent-deep); cursor: pointer; font-family: var(--font-sans); font-style: normal; font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; font-weight: 500; }
.embed-banner .eb-link:hover { color: var(--accent); }

/* === Profile mini === */
.profile-mini { display: flex; gap: 12px; align-items: center; flex: 1; min-width: 0; }
.profile-mini .pm-info { flex: 1; min-width: 0; }
.profile-mini .pm-name { font-size: 12.5px; font-weight: 500; }
.profile-mini .pm-sub { font-size: 11px; color: var(--text-mute); letter-spacing: 0.02em; }

/* === Meter === */
.meter { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.meter .meter-track { height: 3px; background: var(--bg-3); overflow: hidden; }
.meter .meter-fill { height: 100%; background: var(--accent); transition: width 300ms; }
.meter .meter-fill[data-tone="over"] { background: var(--red); }
.meter .meter-fill[data-tone="warn"] { background: var(--amber); }
.meter .meter-fill[data-tone="ok"] { background: var(--green); }
.meter .meter-val { font-family: var(--font-mono); font-size: 11px; color: var(--text-mid); min-width: 60px; text-align: right; }

/* === Empty === */
.empty {
  padding: 56px 20px; text-align: center; color: var(--text-mute);
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.empty .empty-icon { width: 48px; height: 48px; color: var(--accent); display: grid; place-items: center; }

/* === Misc === */
.kbd {
  font-family: var(--font-mono); font-size: 10px;
  background: var(--bg-2); border: 1px solid var(--border-soft);
  padding: 1px 6px; border-radius: 3px; color: var(--text-mute);
}
.divider { height: 1px; background: var(--border-soft); margin: 22px 0; }
.row { display: flex; align-items: center; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 10px; }
.mute { color: var(--text-mute); }
.dim { color: var(--text-dim); }
.mono { font-family: var(--font-mono); }
.serif { font-family: var(--font-serif); }
.italic { font-style: italic; }
.right { text-align: right; }
.tnum { font-feature-settings: "tnum"; }
.hairline { height: 1px; background: var(--border-soft); }

/* Section title */
.section-title {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 32px 0 16px;
}
.section-title .st-eyebrow {
  font-size: 10px; text-transform: uppercase; letter-spacing: var(--letter-loose);
  color: var(--text-mute); font-weight: 500; margin-bottom: 6px;
}
.section-title .st-title {
  font-family: var(--font-serif);
  font-size: 22px; font-weight: 400;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text); line-height: 1.1;
}

/* Field */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 10px; color: var(--text-mute);
  text-transform: uppercase; letter-spacing: var(--letter-loose);
  font-weight: 500;
}
.field input, .field select, .field textarea {
  background: var(--bg-0); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 9px 12px; font: inherit; color: var(--text);
  font-family: var(--font-sans);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 22px; }
@media (max-width: 1100px) { .two-col { grid-template-columns: 1fr; } }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 1100px) { .three-col { grid-template-columns: 1fr 1fr; } }
@media (max-width: 720px) { .three-col { grid-template-columns: 1fr; } }

/* Tag pill */
.tag-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; font-size: 10.5px;
  background: transparent; border: 1px solid var(--border-soft);
  color: var(--text-mute);
  font-family: var(--font-mono);
}

/* Status pulse */
.status-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--green);
  margin-right: 6px;
}
.status-dot[data-state="warn"] { background: var(--amber); }
.status-dot[data-state="down"] { background: var(--red); }

/* Sparkline */
svg.sparkline { display: block; }

/* Lade Gaard image placeholder */
.lade-placeholder {
  width: 100%; height: 100%;
  background:
    linear-gradient(180deg, rgba(20, 20, 50, 0.35) 0%, rgba(20, 20, 50, 0.65) 100%),
    linear-gradient(180deg, #4a4a5e 0%, #2a2a3e 70%, #1a1a2e 100%);
  position: relative;
  display: grid;
  place-items: end center;
  color: rgba(213, 181, 148, 0.8);
}
.lade-placeholder::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 600'%3E%3Cdefs%3E%3ClinearGradient id='sky' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0%25' stop-color='%23535a6e'/%3E%3Cstop offset='100%25' stop-color='%232a2c3e'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect fill='url(%23sky)' width='1200' height='600'/%3E%3Cg fill='%23161628' opacity='0.95'%3E%3C!-- ground --%3E%3Crect x='0' y='420' width='1200' height='180'/%3E%3C!-- main manor building --%3E%3Crect x='340' y='280' width='520' height='180'/%3E%3C!-- roof --%3E%3Cpolygon points='320,280 880,280 820,220 380,220'/%3E%3C!-- center gable --%3E%3Cpolygon points='540,280 660,280 660,200 600,160 540,200'/%3E%3C!-- chimneys --%3E%3Crect x='420' y='200' width='18' height='40'/%3E%3Crect x='760' y='200' width='18' height='40'/%3E%3C!-- side wings --%3E%3Crect x='240' y='310' width='100' height='150'/%3E%3Cpolygon points='220,310 360,310 320,270 260,270'/%3E%3Crect x='860' y='310' width='100' height='150'/%3E%3Cpolygon points='840,310 980,310 940,270 880,270'/%3E%3C/g%3E%3C!-- windows --%3E%3Cg fill='%23d5b594' opacity='0.55'%3E%3Crect x='380' y='320' width='20' height='40'/%3E%3Crect x='430' y='320' width='20' height='40'/%3E%3Crect x='480' y='320' width='20' height='40'/%3E%3Crect x='700' y='320' width='20' height='40'/%3E%3Crect x='750' y='320' width='20' height='40'/%3E%3Crect x='800' y='320' width='20' height='40'/%3E%3Crect x='580' y='230' width='20' height='30'/%3E%3Crect x='608' y='230' width='20' height='30'/%3E%3Crect x='250' y='350' width='18' height='30'/%3E%3Crect x='282' y='350' width='18' height='30'/%3E%3Crect x='312' y='350' width='18' height='30'/%3E%3Crect x='870' y='350' width='18' height='30'/%3E%3Crect x='902' y='350' width='18' height='30'/%3E%3Crect x='932' y='350' width='18' height='30'/%3E%3C/g%3E%3C!-- door --%3E%3Crect x='590' y='380' width='30' height='80' fill='%23d5b594' opacity='0.4'/%3E%3C!-- trees --%3E%3Cg fill='%23161628' opacity='0.9'%3E%3Cellipse cx='100' cy='400' rx='80' ry='50'/%3E%3Cellipse cx='160' cy='420' rx='90' ry='40'/%3E%3Cellipse cx='1080' cy='400' rx='80' ry='50'/%3E%3Cellipse cx='1140' cy='420' rx='90' ry='40'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
  background-position: center;
  opacity: 0.92;
}
.lade-placeholder .lade-caption {
  position: relative;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 300;
  font-size: 14px;
  color: rgba(213, 181, 148, 0.85);
  text-align: center;
  padding: 0 20px 28px;
  letter-spacing: 0.04em;
}

/* Cost summary */
.summary-tile {
  border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 20px 22px; background: var(--bg-0);
  display: flex; flex-direction: column; gap: 6px;
}
.summary-tile .st-label { font-size: 10px; color: var(--text-mute); text-transform: uppercase; letter-spacing: var(--letter-loose); }
.summary-tile .st-value { font-family: var(--font-serif); font-size: 28px; font-weight: 400; line-height: 1.05; font-feature-settings: "tnum"; }

/* Hide deep theme badge if not used */
[data-theme="dark"] .topbar { background: var(--bg-page); }

/* Sparkline color tweak */
svg.sparkline polyline { stroke: var(--accent); }

/* === Responsive — mobile/tablet === */
@media (max-width: 920px) {
  .app, .app[data-nav="icons"] {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    width: min(300px, 84vw);
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 220ms ease-out;
    box-shadow: 8px 0 32px rgba(20, 20, 50, 0.20);
    height: 100vh;
    padding-top: 20px;
  }
  .app[data-mobile-open="true"] .sidebar { transform: translateX(0); }
  .app[data-mobile-open="true"] .sidebar-mask { display: block; }

  .menu-toggle { display: inline-flex; }

  .topbar {
    padding: 10px 16px;
    gap: 10px;
  }
  .topbar-search {
    flex: 1;
    max-width: none;
  }
  .topbar-search .k { display: none; }

  .content {
    padding: 18px 18px 80px;
  }

  /* Page head — stack on small screens */
  .page-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding-bottom: 18px;
    margin-bottom: 22px;
  }
  .page-title { font-size: 30px; }
  .page-title .num,
  .page-title .accent-num { font-size: 22px; margin-left: 8px; }
  .page-sub { font-size: 12px; }

  /* Hero — stack */
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .hero-photo {
    height: 200px;
    min-height: 200px;
  }
  .hero-content {
    padding: 28px 24px;
  }
  .hero-greeting { font-size: 36px; }
  .hero-stjerna { top: 18px; right: 20px; width: 32px; height: 32px; }
  .hero-quick { margin-top: 24px; }
  .hero-quick button { padding: 10px 14px; font-size: 10.5px; letter-spacing: 0.10em; }

  /* Widget grid → single column */
  .widget-grid { gap: 14px; }
  .widget-grid > *,
  .widget-grid > [data-span="3"],
  .widget-grid > [data-span="4"],
  .widget-grid > [data-span="5"],
  .widget-grid > [data-span="6"],
  .widget-grid > [data-span="7"],
  .widget-grid > [data-span="8"],
  .widget-grid > [data-span="12"] {
    grid-column: span 12;
  }

  /* KPI grid — 2 cols on tablet */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .kpi { padding: 16px 18px 14px; }
  .kpi-value { font-size: 28px; }

  /* Panels — smaller padding */
  .panel-head { padding: 14px 16px; }
  .panel-head h3 { font-size: 15px; }
  .panel-body { padding: 14px 16px; }

  /* Tables — denser */
  .pivot th, .pivot td { padding: 0 12px; }

  /* Tabs — horizontal scroll */
  .tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab {
    white-space: nowrap;
    flex: none;
    padding: 10px 14px;
    font-size: 10.5px;
  }

  /* Filter bar — wrap nicely */
  .filterbar { gap: 8px; }
  .filterbar .input,
  .filterbar input.input { min-width: 0; flex: 1 1 200px; }

  /* Drawer — full width */
  .drawer {
    width: 100vw !important;
    max-width: 100vw;
    border-left: 0;
  }
  .drawer-head { padding: 16px 20px; }
  .drawer-body { padding: 20px; }
  .drawer-head .drawer-title { font-size: 16px; }

  /* Approval cards — reflow */
  .approval-card {
    grid-template-columns: auto 1fr;
    gap: 10px 14px;
    padding: 14px 16px !important;
  }
  .approval-card > div:last-child {
    grid-column: 1 / -1;
    justify-content: flex-end;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
  }

  /* Sak row — show less */
  .sak-row {
    grid-template-columns: 1fr auto;
    padding: 12px 16px;
    gap: 10px;
  }
  .sak-row .sak-num,
  .sak-row > svg:last-child { display: none; }

  /* Lists */
  .list-item { padding: 12px 16px; }

  /* Quick tiles */
  .quick-tile { padding: 20px 18px 18px; min-height: 124px; }
  .quick-tile .qt-name { font-size: 14px; }

  /* Intranett — featured news stacks */
  .panel[data-span="8"] > div > div > div > div[style*="grid"][style*="1fr 1.2fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* === Modal (popup-redigering) === */
.modal-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(20, 20, 50, 0.55);
  backdrop-filter: blur(2px);
  display: grid; place-items: center;
  padding: 24px;
  animation: fade-in 140ms ease-out;
}
.modal-box {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: min(620px, 96vw);
  max-height: 90vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: slide-in 160ms ease-out;
}
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-0);
}
.modal-body { padding: 22px 24px; overflow: auto; }
.modal-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 14px 24px;
  border-top: 1px solid var(--border-soft);
  background: var(--bg-0);
}

/* Stor redigeringsboks: mer PLASS (bredere boks), ikke større tekst. Innholdet
   legges i to kolonner (.modal-cols) for å utnytte bredden og redusere scrolling. */
.modal-box.lg { width: min(1040px, 96vw); max-height: 92vh; }
.modal-box.lg .modal-head { padding: 20px 28px; }
.modal-box.lg .modal-body { padding: 24px 28px; }
.modal-box.lg .modal-foot { padding: 16px 28px; }
.modal-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 28px; align-items: start; }
@media (max-width: 760px) { .modal-cols { grid-template-columns: 1fr; } }

/* FAQ-forslag i Meld sak */
.faq-suggest {
  margin: 4px 0 18px;
  padding: 16px;
  border: 1px solid var(--accent-line);
  border-radius: var(--radius);
  background: var(--accent-bg);
}
.faq-spark {
  display: grid; place-items: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: white;
}
.faq-card {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--bg-0);
  overflow: hidden;
}
.faq-card-head {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 12px;
  background: transparent; border: 0; cursor: pointer;
  text-align: left;
}
.faq-card-head:hover { background: var(--bg-2); }
.faq-card-head .faq-title { flex: 1; font-size: 12.5px; font-weight: 500; }
.faq-body { padding: 0 14px 14px 34px; }
.faq-body ol { margin: 4px 0 0; padding-left: 18px; }
.faq-body li { font-size: 12.5px; color: var(--text-mid); line-height: 1.6; margin-bottom: 4px; }

/* Saker sub-nav (onboarding/offboarding flyttet under Saker) */
.saker-subnav {
  display: flex; gap: 4px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--border-soft);
}
.viewswitch-tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 12px 18px 14px;
  background: transparent; border: 0;
  border-bottom: 2px solid transparent;
  color: var(--text-mute);
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.12em; font-weight: 500;
  cursor: pointer;
  font-family: var(--font-sans);
}
.viewswitch-tab:hover { color: var(--text); }
.viewswitch-tab[data-active="true"] { color: var(--text); border-bottom-color: var(--accent); }
.viewswitch-tab .icon, .viewswitch-tab svg { opacity: 0.8; }

/* === Tilpassbar forside === */
.dash-bar { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 16px; }
.dash-cell { position: relative; }
.dash-cell--edit { outline: 1px dashed var(--border-strong); outline-offset: 4px; border-radius: var(--radius); }
.dash-cell--over { outline: 2px solid var(--accent); outline-offset: 4px; }
.dash-cell--dragging { opacity: 0.4; }
.dash-resize {
  position: absolute; right: 3px; bottom: 3px; z-index: 6;
  width: 18px; height: 18px; cursor: nwse-resize;
  border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent);
  border-bottom-right-radius: 5px; opacity: 0.6;
}
.dash-resize:hover { opacity: 1; }
.dash-cell--edit .dash-resize { pointer-events: auto; }
/* Masonry: cellen får høyde fra innholdet (eller minHeight for H>1), IKKE fra
   grid-sporet. Derfor ingen height:100% her – det ville kollapset til 8px-sporet
   før JS rekker å sette rad-spennet. Panelet fyller cellen via flex. */
.dash-cell { transition: transform 160ms ease; display: flex; flex-direction: column; }
.dash-cell > .panel { flex: 1 1 auto; min-height: 0; }
.dash-cell--edit .panel { pointer-events: none; }
.dash-cell--edit .dash-tools { pointer-events: auto; }
.dash-tools {
  position: absolute; top: -12px; left: 8px; z-index: 5;
  display: flex; align-items: center; gap: 2px;
  background: var(--reitan-blue); color: var(--reitan-grey);
  border-radius: 999px; padding: 3px 5px;
  box-shadow: var(--shadow-md);
}
[data-theme="dark"] .dash-tools { background: var(--bg-3); }
.dash-tool {
  background: transparent; border: 0; color: inherit; cursor: pointer;
  font-size: 10.5px; font-weight: 600; font-family: var(--font-mono);
  padding: 3px 6px; border-radius: 999px; min-width: 22px;
  display: inline-flex; align-items: center; justify-content: center;
}
.dash-tool:hover { background: oklch(1 0 0 / 0.15); }
.dash-tool[data-active="true"] { background: var(--reitan-bronze); color: var(--reitan-blue); }
.dash-sep { width: 1px; height: 14px; background: oklch(1 0 0 / 0.25); margin: 0 3px; }
.dash-tray { margin-top: 18px; padding: 16px 18px; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--bg-0); }

/* === IT-saksbehandling (fullskjerm, Incident/Request) === */
.case { padding: 4px 0 24px; }
.case-head { padding-bottom: 20px; margin-bottom: 22px; border-bottom: 1px solid var(--border-soft); }
.case-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; align-items: start; }
.case-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.case-side { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 90px; }
.case-side-foot { padding: 14px 16px; border-top: 1px solid var(--border-soft); }
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 24px; }
.info-line { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border: 1px solid var(--border-soft); border-radius: var(--radius-sm); background: var(--bg-2); }
@media (max-width: 1040px) {
  .case-grid { grid-template-columns: 1fr; }
  .case-side { position: static; }
}

.warn-banner {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px;
  border: 1px solid oklch(0.80 0.14 75 / 0.45);
  border-left: 3px solid var(--amber);
  border-radius: var(--radius-sm);
  background: var(--amber-soft);
  color: var(--text-mid);
}
.warn-banner svg { color: var(--amber); flex: none; margin-top: 1px; }

/* Sidemenyen følger meny-toggelen (data-nav) også i wizard/sak — den gamle
   tvangs-kollapsen (.app:has(.wizard) → 72px) låste grid-kolonnen slik at
   «Utvid meny» byttet data-nav uten at bredden fulgte med. */

/* === Onboarding-wizard (fullside) === */
.wizard {
  background: var(--bg-0);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 4px 0 24px;
  display: flex;
  flex-direction: column;
  /* Ingen min-height: korte steg skal ikke strekkes så Neste-knappen havner
     under folden — foten er sticky og håndterer lange steg uansett. */
}
.wizard-head {
  padding: 22px 28px 0;
  border-bottom: 1px solid var(--border-soft);
}
.wizard-stepper {
  display: flex; gap: 0; flex-wrap: wrap;
  margin-top: 20px;
}
.wizard-step {
  display: flex; align-items: center; gap: 9px;
  padding: 12px 22px 14px 0;
  background: none; border: 0; cursor: default;
  border-bottom: 2px solid transparent;
}
.wizard-step[data-state="done"] { cursor: pointer; }
.wizard-step[data-state="active"] { border-bottom-color: var(--accent); }
.wizard-step .ws-num {
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-family: var(--font-serif); font-style: italic;
  background: transparent; border: 1px solid var(--border);
  color: var(--text-mute);
}
.wizard-step[data-state="done"] .ws-num { background: var(--reitan-blue); color: white; border-color: var(--reitan-blue); }
[data-theme="dark"] .wizard-step[data-state="done"] .ws-num { background: var(--reitan-bronze); color: var(--reitan-blue); border-color: var(--reitan-bronze); }
.wizard-step[data-state="active"] .ws-num { background: var(--accent); color: white; border-color: var(--accent); }
.wizard-step .ws-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.10em; font-weight: 500;
  color: var(--text-mute);
}
.wizard-step[data-state="active"] .ws-label { color: var(--text); }
.wizard-body {
  padding: 8px 28px 28px;
  flex: 1;
  width: 100%;
  position: relative;
  max-width: 1180px;
  /* Oppsummerings-panelet er position:absolute og bidrar ikke til høyden —
     uten denne klippes det av overflow:hidden på korte steg. */
  min-height: 430px;
}
@media (max-width: 1040px) { .wizard-body { min-height: 0; } }
.wizard-main { margin-right: 324px; min-width: 0; }
.wizard-summary {
  position: absolute; top: 8px; right: 28px;
  width: 296px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--bg-0);
  overflow: hidden;
}
.wizard-summary .ws-hd {
  padding: 14px 18px; border-bottom: 1px solid var(--border-soft);
  font-family: var(--font-serif); font-size: 15px; text-transform: uppercase; letter-spacing: 0.08em;
}
.wizard-summary .ws-body { padding: 16px 18px; }
.wizard-summary .ws-row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: 12px; }
.wizard-summary .ws-row .ws-label { color: var(--text-mute); }
.wizard-summary .ws-row .ws-val { font-family: var(--font-mono); text-align: right; }
.wizard-summary .ws-row--total { border-top: 1px solid var(--border-soft); margin-top: 6px; padding-top: 10px; font-weight: 600; }
@media (max-width: 1040px) {
  .wizard-main { margin-right: 0; }
  .wizard-summary { display: none; }
}
.wizard-foot {
  position: sticky; bottom: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  border-top: 1px solid var(--border-soft);
  background: oklch(from var(--bg-0) l c h / 0.92);
  backdrop-filter: blur(8px);
}
@media (max-width: 920px) {
  .wizard-head { padding: 16px 16px 0; }
  .wizard-body { padding: 8px 16px 24px; }
  .wizard-foot { padding: 12px 16px; }
  .wizard-stepper { gap: 0; }
  .wizard-step { padding: 10px 14px 12px 0; }
  .wizard-step .ws-label { display: none; }
  .wizard-step[data-state="active"] .ws-label { display: inline; }
}

/* === Brukerbehandling responsive === */
@media (max-width: 920px) {
  .bb-card-grid {
    grid-template-columns: auto 1fr !important;
    gap: 12px !important;
  }
  .bb-card-grid > .bb-progress {
    grid-column: 1 / -1;
    width: 100% !important;
  }
  .bb-card-grid > .row:last-child {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
  .bb-drawer-head { flex-wrap: wrap; }
  .bb-drawer-head > div:last-child { text-align: left !important; }
}

@media (max-width: 480px) {
  .topbar-search { display: none; }
  .menu-toggle { width: 36px; height: 36px; }
  .content { padding: 14px 12px 80px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .hero-content { padding: 24px 18px; }
  .hero-greeting { font-size: 28px; }
  .page-title { font-size: 24px; }
  .page-title .num,
  .page-title .accent-num { display: block; margin-left: 0; margin-top: 4px; font-size: 18px; }
  .crumbs { font-size: 10px; }
  .news-thumb { display: none; }
  .news-item { grid-template-columns: 1fr; }
  /* Stack steps */
  .step { grid-template-columns: 30px 1fr; }
  .step > :last-child { grid-column: 1 / -1; justify-self: end; }
}

/* ── Organisasjonskart: top-down tre med forbindelseslinjer ───────────────── */
.orgchart-scroll { overflow-x: auto; padding: 18px 8px 10px; }
.orgchart { display: inline-block; min-width: 100%; }
.orgchart ul { display: flex; justify-content: center; list-style: none; margin: 0; padding: 24px 0 0; position: relative; }
.orgchart li { list-style: none; text-align: center; position: relative; padding: 24px 12px 0; }
/* forbindelseslinjer (klassisk CSS-tre) */
.orgchart li::before, .orgchart li::after {
  content: ""; position: absolute; top: 0; right: 50%;
  width: 50%; height: 24px; border-top: 1px solid var(--border);
}
.orgchart li::after { right: auto; left: 50%; border-left: 1px solid var(--border); }
.orgchart li:only-child::before, .orgchart li:only-child::after { display: none; }
.orgchart li:only-child { padding-top: 0; }
.orgchart li:first-child::before, .orgchart li:last-child::after { border: 0 none; }
.orgchart li:last-child::before { border-right: 1px solid var(--border); border-radius: 0 6px 0 0; }
.orgchart li:first-child::after { border-radius: 6px 0 0 0; }
.orgchart ul ul::before {
  content: ""; position: absolute; top: 0; left: 50%;
  width: 0; height: 24px; border-left: 1px solid var(--border);
}
/* rot-nivå: ingen linjer over toppnoden(e) */
.orgchart-root { padding-top: 0; }
.orgchart-root > li { padding-top: 0; }
.orgchart-root > li::before, .orgchart-root > li::after { display: none; }

.org-card {
  display: inline-flex; flex-direction: column; align-items: center; gap: 3px;
  position: relative; min-width: 158px; max-width: 210px;
  padding: 12px 14px; border: 1px solid var(--border-soft); border-radius: 12px;
  background: var(--bg-1);
}
.org-card.is-me { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.org-card-name { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.25; }
.org-card-title { font-size: 11px; color: var(--text-mute); line-height: 1.2; }
.org-card-dept { font-size: 10.5px; color: var(--text-dim); }
.org-toggle {
  margin-top: 7px; font-size: 11px; font-weight: 600; line-height: 1;
  padding: 3px 10px; border: 1px solid var(--border-soft); border-radius: 999px;
  background: var(--bg-0); color: var(--text-mute); cursor: pointer;
}
.org-toggle:hover { background: var(--bg-2); color: var(--text); }

/* ── Splash / loading-skjerm (Reitan-emblem: sveipende bue + ringer + drivende lys) ── */
@keyframes re-spin-rev { to { transform: rotate(-360deg); } }
@keyframes re-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.045); } }
@keyframes re-bigripple {
  0%   { transform: translate(-50%, -50%) scale(0.32); opacity: 0.5; }
  70%  { opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(2.6); opacity: 0; }
}
@keyframes re-drift1 { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(60px, -44px); } }
@keyframes re-drift2 { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-52px, 40px); } }

.re-splash {
  position: fixed; inset: 0; width: 100%; height: 100%; z-index: 9999;
  background: #F6F1E9; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.re-splash-blob1 { position: absolute; width: 42vw; height: 42vw; left: 8%; top: 10%; border-radius: 50%; background: radial-gradient(circle, rgba(182,134,98,0.16), transparent 68%); filter: blur(8px); animation: re-drift1 13s ease-in-out infinite; }
.re-splash-blob2 { position: absolute; width: 38vw; height: 38vw; right: 6%; bottom: 8%; border-radius: 50%; background: radial-gradient(circle, rgba(172,123,80,0.13), transparent 68%); filter: blur(8px); animation: re-drift2 16s ease-in-out infinite; }
.re-splash-core { position: relative; width: 204px; height: 204px; display: flex; align-items: center; justify-content: center; }
.re-splash-ring { position: absolute; left: 50%; top: 50%; width: 300px; height: 300px; border-radius: 50%; border: 1px solid rgba(172,123,80,0.4); transform: translate(-50%,-50%) scale(0.32); animation: re-bigripple 7.8s ease-out infinite both; }
.re-splash-arc { position: absolute; animation: re-spin-rev 2.6s cubic-bezier(0.55,0.1,0.4,0.95) infinite; }
.re-splash-emblem { width: 120px; height: 120px; animation: re-breathe 4s ease-in-out infinite; }
.re-splash-wordmark { width: 196px; height: auto; margin-top: -8px; }
@media (max-width: 480px) {
  .re-splash-core { width: 170px; height: 170px; }
  .re-splash-ring { width: 250px; height: 250px; }
  .re-splash-emblem { width: 100px; height: 100px; }
  .re-splash-wordmark { width: 168px; }
}
@media (prefers-reduced-motion: reduce) {
  .re-splash-blob1, .re-splash-blob2, .re-splash-arc, .re-splash-emblem { animation: none !important; }
  .re-splash-ring { animation: none !important; opacity: 0; }
}
