/* ==========================================================================
   Motiw Design System — CSS til interne apps · v1.0.0
   Samlet fra Motiw Design System (tokens + komponenter) + et app-lag.

   Hostet:   https://motiw.dk/design/v1/motiw.css
   Fonte:    motiw-fonts.css (selvhostet) ELLER Google Fonts (artifacts)
   Klasser:  .motiw-*   ·   Tokens: --motiw-*, --surface-*, --text-*, --space-*, …

   Afsnit 1–5 er kopieret uændret fra designsystemets tokens/.
   Afsnit 6 er komponenternes CSS, 1:1 med React-komponenterne i
   designsystemet, så HTML-apps og React-apps ser ens ud.
   Afsnit 7 er app-laget (shell, tabel, nøgletal, faser …), afledt af
   ui_kits/platform. Ret i designsystemet først, og generér så denne fil.
   ========================================================================== */

/* ======================= 1. Farver ======================= */
/* ==========================================================================
   Motiw — Color tokens
   Source of truth: Visuel identitet & designguide v1.0
   Rule from the guide: secondary colours (Varm ler, Stålblå) must NOT sit
   directly on top of primary colours. Use them in separate elements
   (buttons, icons, info boxes, decorative shapes) over neutral/light grounds.
   ========================================================================== */
:root {
  /* ---- Primary palette ---- */
  --motiw-nordisk-gron: #2D4F47;   /* Nordisk grøn — brand core */
  --motiw-stovet-mint:  #99C0B6;   /* Støvet mint — soft supporting green */
  --motiw-antracit-graa: #3A3A3A;  /* Antracit grå — text / dark neutral */
  --motiw-naesten-hvid: #F5F5F5;   /* Næsten hvid — light ground */

  /* ---- Secondary palette (accents only, on neutral grounds) ---- */
  --motiw-varm-ler:  #E8A892;      /* Varm ler — warm clay */
  --motiw-staalblaa: #768AA7;      /* Stålblå — steel blue */

  /* ---- Extended neutral ramp (derived from Antracit / Næsten hvid) ---- */
  --motiw-white:     #FFFFFF;
  --motiw-gray-50:   #F5F5F5;
  --motiw-gray-100:  #ECECEC;
  --motiw-gray-200:  #DBDBDB;
  --motiw-gray-300:  #C2C2C2;
  --motiw-gray-400:  #9A9A9A;
  --motiw-gray-500:  #6E6E6E;
  --motiw-gray-600:  #545454;
  --motiw-gray-700:  #3A3A3A;
  --motiw-gray-800:  #262626;
  --motiw-gray-900:  #171717;

  /* ---- Green tints/shades (derived from Nordisk grøn) ---- */
  --motiw-green-900: #1B322D;
  --motiw-green-800: #24413A;
  --motiw-green-700: #2D4F47;      /* = Nordisk grøn */
  --motiw-green-600: #3C665C;
  --motiw-green-500: #4E7B70;
  --motiw-green-300: #99C0B6;      /* = Støvet mint */
  --motiw-green-100: #D6E5E0;
  --motiw-green-50:  #EDF3F1;

  /* ---- Semantic status (kept in brand temperature) ---- */
  --motiw-success: #3C665C;
  --motiw-warning: #E8A892;        /* Varm ler doubles as attention/warn */
  --motiw-danger:  #B4544A;
  --motiw-info:    #768AA7;        /* Stålblå */

  /* ---- Gradient pairs (from the "Graduering" page) ---- */
  --motiw-gradient-green:  linear-gradient(135deg, #2D4F47 0%, #99C0B6 100%); /* @kind color */
  --motiw-gradient-fade:   linear-gradient(135deg, #2D4F47 0%, #F5F5F5 100%); /* @kind color */
  --motiw-gradient-mint:   linear-gradient(135deg, #F5F5F5 0%, #99C0B6 100%); /* @kind color */
  --motiw-gradient-accent: linear-gradient(135deg, #E8A892 0%, #768AA7 100%); /* @kind color */

  /* ======================================================================
     Semantic aliases — reference these in components, not the raw values.
     ====================================================================== */
  --surface-page:     var(--motiw-naesten-hvid);
  --surface-card:     var(--motiw-white);
  --surface-sunken:   var(--motiw-gray-100);
  --surface-inverse:  var(--motiw-nordisk-gron);
  --surface-accent:   var(--motiw-green-50);

  --text-strong:  var(--motiw-antracit-graa);
  --text-body:    #454545;
  --text-muted:   var(--motiw-gray-500);
  --text-on-dark: var(--motiw-naesten-hvid);
  --text-brand:   var(--motiw-nordisk-gron);
  --text-link:    var(--motiw-nordisk-gron);

  --border-subtle:  var(--motiw-gray-200);
  --border-default: var(--motiw-gray-300);
  --border-strong:  var(--motiw-gray-400);
  --border-brand:   var(--motiw-nordisk-gron);

  --accent-primary:   var(--motiw-nordisk-gron);
  --accent-secondary: var(--motiw-stovet-mint);
  --accent-clay:      var(--motiw-varm-ler);
  --accent-steel:     var(--motiw-staalblaa);

  --focus-ring: color-mix(in srgb, var(--motiw-nordisk-gron) 45%, transparent);
}


/* ======================= 2. Typografi ======================= */
/* ==========================================================================
   Motiw — Typography tokens
   Display: Rajdhani (headings, labels, numbers — often UPPERCASE w/ tracking)
   Body:    IBM Plex Sans (paragraphs, UI text)
   ========================================================================== */
:root {
  /* ---- Families ---- */
  --font-display: "Rajdhani", "Segoe UI", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Sans", ui-monospace, monospace;

  /* ---- Weights ---- */
  --fw-light: 300;    /* @kind font */
  --fw-regular: 400;  /* @kind font */
  --fw-medium: 500;   /* @kind font */
  --fw-semibold: 600; /* @kind font */
  --fw-bold: 700;     /* @kind font */

  /* ---- Type scale (px) — display uses Rajdhani, tuned for its condensed width ---- */
  --fs-display-2xl: 76px;
  --fs-display-xl: 60px;
  --fs-display-lg: 46px;
  --fs-h1: 38px;
  --fs-h2: 30px;
  --fs-h3: 24px;
  --fs-h4: 20px;
  --fs-body-lg: 18px;
  --fs-body: 16px;
  --fs-body-sm: 14px;
  --fs-caption: 13px;
  --fs-overline: 12px;

  /* ---- Line heights ---- */
  --lh-tight: 1.05;   /* @kind other */
  --lh-heading: 1.15; /* @kind other */
  --lh-snug: 1.35;    /* @kind other */
  --lh-body: 1.6;     /* @kind other */

  /* ---- Letter spacing — Rajdhani reads best with a touch of tracking when set uppercase ---- */
  --ls-display: -0.005em; /* @kind other */
  --ls-heading: 0.01em;   /* @kind other */
  --ls-overline: 0.14em;  /* @kind other */
  --ls-label: 0.04em;     /* @kind other */
  --ls-body: 0;           /* @kind other */
}


/* ======================= 3. Afstand og radier ======================= */
/* ==========================================================================
   Motiw — Spacing & layout tokens (4px base grid)
   ========================================================================== */
:root {
  --space-0: 0;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;
  --space-32: 128px;

  /* ---- Radii — Motiw skews to soft, friendly corners (see brandmark round caps) ---- */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 28px;
  --radius-pill: 999px;

  /* ---- Layout ---- */
  --container-sm: 640px;   /* @kind spacing */
  --container-md: 880px;   /* @kind spacing */
  --container-lg: 1120px;  /* @kind spacing */
  --container-xl: 1280px;  /* @kind spacing */
  --gutter: var(--space-6);
}


/* ======================= 4. Effekter ======================= */
/* ==========================================================================
   Motiw — Effects: shadows, borders, motion
   Restrained, soft shadows tinted with the brand green rather than pure black.
   ========================================================================== */
:root {
  /* ---- Elevation (green-tinted, low-contrast, soft) ---- */
  --shadow-xs: 0 1px 2px rgba(45, 79, 71, 0.06);
  --shadow-sm: 0 1px 3px rgba(45, 79, 71, 0.08), 0 1px 2px rgba(45, 79, 71, 0.06);
  --shadow-md: 0 4px 12px rgba(45, 79, 71, 0.10), 0 2px 4px rgba(45, 79, 71, 0.06);
  --shadow-lg: 0 12px 28px rgba(45, 79, 71, 0.12), 0 4px 8px rgba(45, 79, 71, 0.06);
  --shadow-xl: 0 24px 48px rgba(27, 50, 45, 0.18);
  --shadow-focus: 0 0 0 3px var(--focus-ring);

  /* ---- Borders ---- */
  --border-width: 1px;         /* @kind other */
  --border-width-strong: 1.5px; /* @kind other */

  /* ---- Motion — calm, confident easing; no bounce ---- */
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1); /* @kind other */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);     /* @kind other */
  --ease-in: cubic-bezier(0.4, 0, 1, 1);         /* @kind other */
  --dur-fast: 120ms; /* @kind other */
  --dur-base: 200ms; /* @kind other */
  --dur-slow: 360ms; /* @kind other */
}


/* ======================= 5. Base ======================= */
/* ==========================================================================
   Motiw — Base element defaults
   Applied globally so plain HTML inherits brand type + colour.
   ========================================================================== */
:root {
  color-scheme: light;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: var(--fw-regular);
  color: var(--text-body);
  background: var(--surface-page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--text-strong);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-heading);
  letter-spacing: var(--ls-heading);
  margin: 0 0 0.5em;
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); }

p { margin: 0 0 1em; text-wrap: pretty; }

a {
  color: var(--text-link);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-standard);
}
a:hover { color: var(--motiw-green-600); text-decoration: underline; }

small { font-size: var(--fs-caption); }

code, kbd {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--surface-sunken);
  padding: 0.1em 0.35em;
  border-radius: var(--radius-xs);
}

::selection {
  background: var(--motiw-stovet-mint);
  color: var(--motiw-green-900);
}

/* Overline / eyebrow helper — a recurring Motiw label treatment */
.motiw-overline {
  font-family: var(--font-display);
  font-size: var(--fs-overline);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-overline);
  text-transform: uppercase;
  color: var(--text-brand);
}

/* ======================= 6. Komponenter ======================= */
/* ---- Komponent: buttons/Button ---- */
.motiw-btn {
  --_bg: var(--motiw-nordisk-gron);
  --_fg: var(--motiw-naesten-hvid);
  --_bd: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-label);
  line-height: 1;
  border: var(--border-width-strong) solid var(--_bd);
  border-radius: var(--radius-pill);
  background: var(--_bg);
  color: var(--_fg);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-standard),
              border-color var(--dur-fast) var(--ease-standard),
              color var(--dur-fast) var(--ease-standard),
              box-shadow var(--dur-fast) var(--ease-standard);
}
.motiw-btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.motiw-btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* sizes */
.motiw-btn--sm { font-size: 13px; padding: 8px 16px; }
.motiw-btn--md { font-size: 15px; padding: 11px 22px; }
.motiw-btn--lg { font-size: 17px; padding: 14px 30px; }

/* variants */
.motiw-btn--primary { --_bg: var(--motiw-nordisk-gron); --_fg: var(--motiw-naesten-hvid); }
.motiw-btn--primary:not([disabled]):hover { --_bg: var(--motiw-green-800); }
.motiw-btn--primary:not([disabled]):active { --_bg: var(--motiw-green-900); }

.motiw-btn--secondary { --_bg: var(--motiw-stovet-mint); --_fg: var(--motiw-green-900); }
.motiw-btn--secondary:not([disabled]):hover { --_bg: #86b3a8; }
.motiw-btn--secondary:not([disabled]):active { --_bg: #77a99d; }

.motiw-btn--outline { --_bg: transparent; --_fg: var(--motiw-nordisk-gron); --_bd: var(--motiw-nordisk-gron); }
.motiw-btn--outline:not([disabled]):hover { --_bg: var(--motiw-green-50); }
.motiw-btn--outline:not([disabled]):active { --_bg: var(--motiw-green-100); }

.motiw-btn--ghost { --_bg: transparent; --_fg: var(--motiw-nordisk-gron); --_bd: transparent; }
.motiw-btn--ghost:not([disabled]):hover { --_bg: var(--motiw-green-50); }

.motiw-btn--clay { --_bg: var(--motiw-varm-ler); --_fg: #5c2d20; }
.motiw-btn--clay:not([disabled]):hover { --_bg: #dd977f; }

.motiw-btn--block { width: 100%; }

/* ---- Komponent: data-display/Badge ---- */
.motiw-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-display); font-weight: var(--fw-semibold);
  font-size: 12px; letter-spacing: var(--ls-label);
  padding: 3px 10px; border-radius: var(--radius-pill);
  line-height: 1.4; white-space: nowrap;
}
.motiw-badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.motiw-badge--neutral  { background: var(--motiw-gray-100); color: var(--motiw-gray-700); }
.motiw-badge--brand    { background: var(--motiw-green-100); color: var(--motiw-green-800); }
.motiw-badge--mint     { background: #d6e8e2; color: var(--motiw-green-800); }
.motiw-badge--success  { background: #d7e6e1; color: var(--motiw-success); }
.motiw-badge--warning  { background: #f7ddd2; color: #a85a3f; }
.motiw-badge--danger   { background: #f3d9d6; color: #8f3d35; }
.motiw-badge--info     { background: #dde3ec; color: #435676; }
.motiw-badge--solid    { background: var(--motiw-nordisk-gron); color: var(--motiw-naesten-hvid); }

/* ---- Komponent: data-display/Card ---- */
.motiw-card {
  background: var(--surface-card);
  border: var(--border-width) solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--dur-base) var(--ease-standard),
              transform var(--dur-base) var(--ease-out),
              border-color var(--dur-base) var(--ease-standard);
}
.motiw-card--pad { padding: var(--space-6); }
.motiw-card--interactive { cursor: pointer; }
.motiw-card--interactive:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: var(--border-default); }
.motiw-card--flat { box-shadow: none; }
.motiw-card--brand { background: var(--surface-inverse); color: var(--text-on-dark); border-color: transparent; }
.motiw-card--accent { background: var(--surface-accent); border-color: var(--motiw-green-100); }

/* ---- Komponent: data-display/Tag ---- */
.motiw-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-body); font-size: 13px; font-weight: var(--fw-medium);
  color: var(--text-strong); background: var(--motiw-white);
  border: var(--border-width) solid var(--border-default);
  padding: 4px 10px; border-radius: var(--radius-sm); line-height: 1.3;
}
.motiw-tag--muted { background: var(--surface-sunken); border-color: transparent; color: var(--text-body); }
.motiw-tag__close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border: none; background: transparent;
  color: var(--text-muted); cursor: pointer; border-radius: var(--radius-xs); padding: 0;
  transition: background var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard);
}
.motiw-tag__close:hover { background: var(--motiw-gray-200); color: var(--text-strong); }

/* ---- Komponent: feedback/Dialog ---- */
.motiw-dialog__overlay {
  position: fixed; inset: 0; background: rgba(27, 50, 45, 0.42);
  display: flex; align-items: center; justify-content: center; padding: var(--space-6);
  z-index: 1000; animation: motiw-dialog-fade var(--dur-base) var(--ease-standard);
}
.motiw-dialog {
  background: var(--surface-card); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl); width: 100%; max-width: 480px;
  max-height: 90vh; overflow: auto; position: relative;
  animation: motiw-dialog-rise var(--dur-slow) var(--ease-out);
}
.motiw-dialog__head { padding: var(--space-6) var(--space-6) 0; display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); }
.motiw-dialog__title { font-family: var(--font-display); font-weight: var(--fw-semibold); font-size: var(--fs-h3); color: var(--text-strong); margin: 0; }
.motiw-dialog__body { padding: var(--space-3) var(--space-6) var(--space-6); color: var(--text-body); }
.motiw-dialog__foot { padding: 0 var(--space-6) var(--space-6); display: flex; justify-content: flex-end; gap: var(--space-3); }
@keyframes motiw-dialog-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes motiw-dialog-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .motiw-dialog__overlay, .motiw-dialog { animation: none; }
}

/* ---- Komponent: feedback/Toast ---- */
.motiw-toast {
  display: flex; align-items: flex-start; gap: var(--space-3);
  background: var(--surface-card); border: var(--border-width) solid var(--border-subtle);
  border-left: 4px solid var(--motiw-nordisk-gron);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  padding: var(--space-4) var(--space-5); min-width: 300px; max-width: 420px;
  font-family: var(--font-body);
  animation: motiw-toast-in var(--dur-slow) var(--ease-out);
}
.motiw-toast--success { border-left-color: var(--motiw-success); }
.motiw-toast--warning { border-left-color: var(--motiw-warning); }
.motiw-toast--danger  { border-left-color: var(--motiw-danger); }
.motiw-toast--info    { border-left-color: var(--motiw-info); }
.motiw-toast__icon { flex: none; margin-top: 1px; color: var(--motiw-nordisk-gron); }
.motiw-toast--success .motiw-toast__icon { color: var(--motiw-success); }
.motiw-toast--warning .motiw-toast__icon { color: #a85a3f; }
.motiw-toast--danger .motiw-toast__icon  { color: var(--motiw-danger); }
.motiw-toast--info .motiw-toast__icon    { color: var(--motiw-info); }
.motiw-toast__body { flex: 1; }
.motiw-toast__title { font-family: var(--font-display); font-weight: var(--fw-semibold); font-size: 15px; color: var(--text-strong); }
.motiw-toast__msg { font-size: 14px; color: var(--text-body); margin-top: 2px; }
.motiw-toast__close { border: none; background: transparent; cursor: pointer; color: var(--text-muted); padding: 2px; line-height: 0; border-radius: var(--radius-xs); }
.motiw-toast__close:hover { color: var(--text-strong); background: var(--surface-sunken); }
@keyframes motiw-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .motiw-toast { animation: none; } }

/* ---- Komponent: feedback/Tooltip ---- */
.motiw-tooltip { position: relative; display: inline-flex; }
.motiw-tooltip__bubble {
  position: absolute; z-index: 900; left: 50%; transform: translateX(-50%) translateY(4px);
  background: var(--motiw-antracit-graa); color: var(--motiw-naesten-hvid);
  font-family: var(--font-body); font-size: 13px; line-height: 1.4;
  padding: 6px 10px; border-radius: var(--radius-sm); white-space: nowrap;
  box-shadow: var(--shadow-md); opacity: 0; pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease-standard), transform var(--dur-fast) var(--ease-out);
}
.motiw-tooltip__bubble--top { bottom: calc(100% + 8px); }
.motiw-tooltip__bubble--bottom { top: calc(100% + 8px); }
.motiw-tooltip:hover .motiw-tooltip__bubble,
.motiw-tooltip:focus-within .motiw-tooltip__bubble {
  opacity: 1; transform: translateX(-50%) translateY(0);
}
.motiw-tooltip__bubble::after {
  content: ""; position: absolute; left: 50%; margin-left: -4px;
  border: 4px solid transparent;
}
.motiw-tooltip__bubble--top::after { top: 100%; border-top-color: var(--motiw-antracit-graa); }
.motiw-tooltip__bubble--bottom::after { bottom: 100%; border-bottom-color: var(--motiw-antracit-graa); }

/* ---- Komponent: forms/Checkbox ---- */
.motiw-choice { display: inline-flex; align-items: flex-start; gap: 10px; cursor: pointer; font-family: var(--font-body); font-size: 15px; color: var(--text-strong); }
.motiw-choice[data-disabled="true"] { cursor: not-allowed; opacity: 0.5; }
.motiw-choice__input { position: absolute; opacity: 0; width: 0; height: 0; }
.motiw-choice__box {
  flex: none; width: 20px; height: 20px; margin-top: 1px;
  border: var(--border-width-strong) solid var(--border-strong);
  background: var(--motiw-white);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--dur-fast) var(--ease-standard), border-color var(--dur-fast) var(--ease-standard);
}
.motiw-choice__box--check { border-radius: var(--radius-xs); }
.motiw-choice__box--radio { border-radius: var(--radius-pill); }
.motiw-choice:hover .motiw-choice__box { border-color: var(--motiw-nordisk-gron); }
.motiw-choice__input:focus-visible + .motiw-choice__box { box-shadow: var(--shadow-focus); border-color: var(--motiw-nordisk-gron); }
.motiw-choice__input:checked + .motiw-choice__box { background: var(--motiw-nordisk-gron); border-color: var(--motiw-nordisk-gron); }
.motiw-choice__tick { width: 12px; height: 12px; color: var(--motiw-naesten-hvid); opacity: 0; transition: opacity var(--dur-fast) var(--ease-standard); }
.motiw-choice__input:checked + .motiw-choice__box .motiw-choice__tick { opacity: 1; }
.motiw-choice__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--motiw-naesten-hvid); transform: scale(0); transition: transform var(--dur-fast) var(--ease-out); }
.motiw-choice__input:checked + .motiw-choice__box .motiw-choice__dot { transform: scale(1); }
.motiw-choice__label { line-height: 1.4; }
.motiw-choice__desc { display:block; font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ---- Komponent: forms/Input ---- */
.motiw-field { display: flex; flex-direction: column; gap: 6px; font-family: var(--font-body); }
.motiw-field__label {
  font-family: var(--font-display);
  font-size: 13px; font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-label); color: var(--text-strong);
}
.motiw-field__req { color: var(--motiw-danger); margin-left: 2px; }
.motiw-field__control {
  font-family: var(--font-body); font-size: 15px; color: var(--text-strong);
  background: var(--motiw-white);
  border: var(--border-width) solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 10px 14px; width: 100%; box-sizing: border-box;
  transition: border-color var(--dur-fast) var(--ease-standard),
              box-shadow var(--dur-fast) var(--ease-standard);
}
.motiw-field__control::placeholder { color: var(--motiw-gray-400); }
.motiw-field__control:hover:not(:disabled):not([aria-invalid="true"]) { border-color: var(--border-strong); }
.motiw-field__control:focus { outline: none; border-color: var(--motiw-nordisk-gron); box-shadow: var(--shadow-focus); }
.motiw-field__control:disabled { background: var(--surface-sunken); color: var(--text-muted); cursor: not-allowed; }
.motiw-field__control[aria-invalid="true"] { border-color: var(--motiw-danger); }
.motiw-field__hint { font-size: 13px; color: var(--text-muted); }
.motiw-field__hint--error { color: var(--motiw-danger); }
textarea.motiw-field__control { resize: vertical; min-height: 96px; line-height: var(--lh-snug); }

/* ---- Komponent: forms/Radio — deler .motiw-choice med Checkbox (se ovenfor) ---- */

/* ---- Komponent: forms/Switch ---- */
.motiw-switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-family: var(--font-body); font-size: 15px; color: var(--text-strong); }
.motiw-switch[data-disabled="true"] { cursor: not-allowed; opacity: 0.5; }
.motiw-switch__input { position: absolute; opacity: 0; width: 0; height: 0; }
.motiw-switch__track {
  flex: none; width: 42px; height: 24px; border-radius: var(--radius-pill);
  background: var(--motiw-gray-300); position: relative;
  transition: background var(--dur-base) var(--ease-standard);
}
.motiw-switch__thumb {
  position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: var(--motiw-white); box-shadow: var(--shadow-sm);
  transition: transform var(--dur-base) var(--ease-out);
}
.motiw-switch__input:checked + .motiw-switch__track { background: var(--motiw-nordisk-gron); }
.motiw-switch__input:checked + .motiw-switch__track .motiw-switch__thumb { transform: translateX(18px); }
.motiw-switch__input:focus-visible + .motiw-switch__track { box-shadow: var(--shadow-focus); }

/* ---- Komponent: navigation/Tabs ---- */
.motiw-tabs { font-family: var(--font-display); }
.motiw-tabs__list { display: flex; gap: 4px; border-bottom: var(--border-width) solid var(--border-subtle); }
.motiw-tabs__tab {
  appearance: none; border: none; background: transparent; cursor: pointer;
  font-family: var(--font-display); font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-label); font-size: 15px;
  color: var(--text-muted); padding: 12px 16px; position: relative;
  transition: color var(--dur-fast) var(--ease-standard);
}
.motiw-tabs__tab:hover { color: var(--text-strong); }
.motiw-tabs__tab[aria-selected="true"] { color: var(--motiw-nordisk-gron); }
.motiw-tabs__tab::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2.5px;
  background: var(--motiw-nordisk-gron); border-radius: 2px;
  transform: scaleX(0); transform-origin: center;
  transition: transform var(--dur-base) var(--ease-out);
}
.motiw-tabs__tab[aria-selected="true"]::after { transform: scaleX(1); }
.motiw-tabs__tab:focus-visible { outline: none; box-shadow: var(--shadow-focus); border-radius: var(--radius-sm); }
.motiw-tabs__panel { padding-top: var(--space-5); }

/* ======================= 7. App-lag ======================= */
/* Komponenter, der i designsystemet kun findes som React-props eller inline
   styles, her gjort til klasser, så de kan bruges i ren HTML. */

*, *::before, *::after { box-sizing: border-box; }
img, svg { max-width: 100%; }

/* ---- IconButton (samme mål som React: sm 34 / md 42 / lg 50) ---- */
.motiw-iconbtn { width: 42px; height: 42px; padding: 0; border-radius: var(--radius-md); }
.motiw-iconbtn.motiw-btn--sm { width: 34px; height: 34px; }
.motiw-iconbtn.motiw-btn--lg { width: 50px; height: 50px; }
.motiw-btn svg { flex: none; }

/* ---- Select (chevron som i React-komponenten) ---- */
select.motiw-field__control {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%232D4F47' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}

/* ---- Avatar (samme palet som React; vælg variant 1–5 ud fra navnet) ---- */
.motiw-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; user-select: none;
  font-family: var(--font-display); font-weight: 600; font-size: 15px; letter-spacing: 0.02em;
  background: #2D4F47; color: #F5F5F5;
}
.motiw-avatar--sm { width: 28px; height: 28px; font-size: 11px; }
.motiw-avatar--2 { background: #99C0B6; color: #1B322D; }
.motiw-avatar--3 { background: #768AA7; color: #F5F5F5; }
.motiw-avatar--4 { background: #E8A892; color: #5c2d20; }
.motiw-avatar--5 { background: #3C665C; color: #F5F5F5; }
.motiw-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---- App-shell: mørkegrøn sidebar + hvid topbar ---- */
.motiw-app { display: flex; min-height: 100vh; background: var(--surface-page); }
.motiw-app__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.motiw-sidebar {
  width: 236px; flex-shrink: 0; display: flex; flex-direction: column;
  padding: 20px 14px; background: var(--motiw-green-900); color: var(--text-on-dark);
}
.motiw-sidebar__brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; text-decoration: none; }
.motiw-sidebar__brand img { height: 22px; width: auto; }
.motiw-sidebar__brand .motiw-brandmark { height: 24px; }
.motiw-sidebar__app {
  margin: -12px 8px 18px; font-family: var(--font-display); font-weight: var(--fw-semibold);
  font-size: var(--fs-overline); letter-spacing: var(--ls-overline); text-transform: uppercase;
  color: var(--motiw-stovet-mint);
}
.motiw-sidebar__foot { margin-top: auto; padding-top: var(--space-4); }
.motiw-nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.motiw-nav__item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; border: 0; border-radius: var(--radius-sm); cursor: pointer; text-align: left;
  background: transparent; color: var(--motiw-stovet-mint); text-decoration: none;
  font-family: var(--font-display); font-weight: var(--fw-medium); font-size: 15px; letter-spacing: 0.02em;
  transition: background var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard);
}
.motiw-nav__item svg { width: 19px; height: 19px; flex: none; }
.motiw-nav__item:hover { background: rgba(153, 192, 182, 0.10); color: #fff; text-decoration: none; }
.motiw-nav__item[aria-current="page"] { background: rgba(153, 192, 182, 0.18); color: #fff; }
.motiw-nav__item:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(153, 192, 182, 0.5); }

.motiw-topbar {
  height: 66px; flex-shrink: 0; position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--space-4); padding: 0 28px;
  background: var(--surface-card); border-bottom: 1px solid var(--border-subtle);
}
.motiw-topbar__title { font-size: 24px; margin: 0; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.motiw-topbar__end { margin-left: auto; display: flex; align-items: center; gap: var(--space-3); }

.motiw-search { position: relative; }
.motiw-search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--text-muted); pointer-events: none; }
.motiw-search input {
  height: 40px; width: 240px; padding: 0 14px 0 36px;
  border: 1px solid var(--border-default); border-radius: var(--radius-pill);
  background: var(--surface-page); font-family: var(--font-body); font-size: 14px; color: var(--text-strong);
  transition: border-color var(--dur-fast) var(--ease-standard), box-shadow var(--dur-fast) var(--ease-standard);
}
.motiw-search input:focus { outline: none; border-color: var(--motiw-nordisk-gron); box-shadow: var(--shadow-focus); }

.motiw-page { padding: 28px; display: flex; flex-direction: column; gap: 20px; }
.motiw-page--narrow { max-width: var(--container-md); }
.motiw-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.motiw-page-head h2 { margin: 0; font-size: 28px; }
.motiw-page-head p { margin: 6px 0 0; }
.motiw-back {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 8px;
  background: transparent; border: 0; padding: 0; cursor: pointer; color: var(--text-brand);
  font-family: var(--font-display); font-weight: var(--fw-semibold); font-size: 14px; letter-spacing: 0.02em;
}

/* ---- Layout-hjælpere ---- */
.motiw-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.motiw-row--end { justify-content: flex-end; }
.motiw-row__push { margin-left: auto; }
.motiw-stack { display: flex; flex-direction: column; gap: var(--space-4); }
.motiw-stack > * { min-width: 0; }
.motiw-grid-kpi { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.motiw-split { display: grid; gap: 20px; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
.motiw-form { display: flex; flex-direction: column; gap: var(--space-5); max-width: var(--container-sm); }
.motiw-form__row { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.motiw-card__title { margin: 0 0 16px; font-size: 19px; color: var(--text-strong); }
.motiw-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.motiw-card__head .motiw-card__title { margin: 0; }
.motiw-muted { color: var(--text-muted); }
.motiw-small { font-size: var(--fs-body-sm); }
.motiw-num { font-variant-numeric: tabular-nums; }
.motiw-sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---- Nøgletal ---- */
.motiw-kpi { display: flex; flex-direction: column; gap: 10px; }
.motiw-kpi__top { display: flex; align-items: center; justify-content: space-between; }
.motiw-kpi__icon {
  width: 40px; height: 40px; border-radius: var(--radius-md);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--motiw-green-50); color: var(--text-brand);
}
.motiw-kpi__icon svg { width: 20px; height: 20px; }
.motiw-kpi__value { font-family: var(--font-display); font-weight: var(--fw-bold); font-size: 38px; line-height: 1; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.motiw-kpi__label { font-size: 13.5px; color: var(--text-muted); }

/* ---- Tabel (lægges i .motiw-card uden padding: .motiw-card--flush) ---- */
.motiw-card--flush { padding: 0; }
.motiw-table-scroll { overflow-x: auto; position: relative; }
.motiw-table { width: 100%; border-collapse: collapse; }
.motiw-table th {
  text-align: left; padding: 16px 16px 12px; white-space: nowrap;
  font-family: var(--font-display); font-weight: var(--fw-semibold); font-size: 12px;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted);
}
.motiw-table td { padding: 14px 16px; font-size: 14px; color: var(--text-strong); border-top: 1px solid var(--border-subtle); vertical-align: middle; }
.motiw-table tbody tr { transition: background var(--dur-fast) var(--ease-standard); }
.motiw-table tbody tr:hover, .motiw-table tbody tr[aria-selected="true"] { background: var(--motiw-green-50); }
.motiw-table tr[data-href], .motiw-table tr.is-clickable { cursor: pointer; }
.motiw-table .motiw-num, .motiw-table th.motiw-num { text-align: right; }
.motiw-table__sub { display: block; font-size: 12.5px; color: var(--text-muted); }
.motiw-table__primary { font-weight: 500; }
.motiw-table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border-subtle); font-size: 13.5px; color: var(--text-muted); }

/* ---- Detaljer ---- */
.motiw-details { display: flex; flex-direction: column; gap: 12px; }
.motiw-details__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.motiw-details__row > :first-child { font-size: 13.5px; color: var(--text-muted); }
.motiw-details__row > :last-child { font-size: 14px; color: var(--text-strong); text-align: right; }
.motiw-facts { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.motiw-fact { background: var(--surface-sunken); border-radius: var(--radius-sm); padding: 12px 14px; }
.motiw-fact__label { font-size: 12px; color: var(--text-muted); margin-bottom: 3px; }
.motiw-fact__value { font-size: 14.5px; font-weight: 500; color: var(--text-strong); }

/* ---- Leverancemodel / faseforløb (det mest Motiw-specifikke mønster) ---- */
.motiw-stages { display: flex; align-items: flex-start; list-style: none; margin: 0; padding: 0; }
.motiw-stage { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: none; }
.motiw-stage__node {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: var(--fw-bold); font-size: 13px;
  background: var(--motiw-white); color: var(--text-muted); border: 2px solid var(--border-default);
}
.motiw-stage__node svg { width: 16px; height: 16px; }
.motiw-stage__label { font-family: var(--font-display); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }
.motiw-stage__line { flex: 1; height: 2.5px; margin: 16px 6px 0; border-radius: 2px; background: var(--border-default); }
.motiw-stage.is-done .motiw-stage__node, .motiw-stage.is-current .motiw-stage__node { background: var(--motiw-nordisk-gron); color: #fff; border-color: var(--motiw-nordisk-gron); }
.motiw-stage.is-done .motiw-stage__label, .motiw-stage.is-current .motiw-stage__label { color: var(--text-strong); }
.motiw-stage__line.is-done { background: var(--motiw-nordisk-gron); }

/* ---- Infoboks (sekundærfarver må bruges her, på neutral baggrund) ---- */
.motiw-alert {
  display: flex; gap: var(--space-3); align-items: flex-start;
  padding: var(--space-4) var(--space-5); border-radius: var(--radius-md);
  background: var(--surface-accent); border: 1px solid var(--motiw-green-100);
  color: var(--text-body); font-size: 14px;
}
.motiw-alert svg { width: 20px; height: 20px; flex: none; margin-top: 1px; color: var(--motiw-nordisk-gron); }
.motiw-alert__title { display: block; font-family: var(--font-display); font-weight: var(--fw-semibold); font-size: 15px; color: var(--text-strong); }
.motiw-alert { border-left: 4px solid var(--motiw-nordisk-gron); }
.motiw-alert--info    { background: #eef1f6; border-color: #dde3ec; border-left-color: var(--motiw-info); } .motiw-alert--info svg { color: #435676; }
.motiw-alert--warning { background: #fbeee8; border-color: #f7ddd2; border-left-color: var(--motiw-warning); } .motiw-alert--warning svg { color: #a85a3f; }
.motiw-alert--danger  { background: #f9ecea; border-color: #f3d9d6; border-left-color: var(--motiw-danger); } .motiw-alert--danger svg  { color: #8f3d35; }

/* ---- Tom tilstand ---- */
.motiw-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 64px 24px; text-align: center; }
.motiw-empty__icon { width: 60px; height: 60px; border-radius: var(--radius-lg); background: var(--motiw-green-50); color: var(--text-brand); display: inline-flex; align-items: center; justify-content: center; }
.motiw-empty__icon svg { width: 26px; height: 26px; }
.motiw-empty h3 { margin: 0; font-size: 22px; }
.motiw-empty p { margin: 0; max-width: 46ch; color: var(--text-body); }

/* ---- Toast-placering + dialog via <dialog> ---- */
.motiw-toasts { position: fixed; right: 24px; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 1100; display: flex; flex-direction: column; gap: 10px; }
dialog.motiw-dialog { border: 0; padding: 0; }
dialog.motiw-dialog::backdrop { background: rgba(27, 50, 45, 0.42); }

/* ---- Indlæsning ---- */
.motiw-spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--motiw-green-100); border-top-color: var(--motiw-nordisk-gron); animation: motiw-spin .8s linear infinite; }
@keyframes motiw-spin { to { transform: rotate(360deg); } }
.motiw-skeleton { background: var(--surface-sunken); border-radius: var(--radius-sm); min-height: 1em; }

/* ---- Responsiv ---- */
.motiw-menu-btn { display: none; }
@media (max-width: 900px) {
  .motiw-sidebar { display: none; }
  .motiw-sidebar[data-open="true"] { display: flex; position: fixed; inset: 0 auto 0 0; z-index: 50; box-shadow: var(--shadow-xl); }
  .motiw-menu-btn { display: inline-flex; }
  .motiw-topbar { padding: 0 16px; }
  .motiw-search { display: none; }
  .motiw-page { padding: 20px 16px; }
  .motiw-split { grid-template-columns: minmax(0, 1fr); }
  .motiw-stage__label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media print {
  .motiw-sidebar, .motiw-topbar, .motiw-toasts { display: none !important; }
  body { background: #fff; }
}
