  :root {
    --bg: #0c0e12;
    --surface: #14171c;
    --surface-2: #1a1e25;
    --surface-3: #22272f;
    --surface-4: #2c323c;
    --border: #262b34;
    --border-strong: #333947;
    --text: #e6e8ec;
    --text-muted: #8a92a0;
    --text-dim: #5c6370;
    --accent: #a3e635;
    --accent-dim: #4d6b1a;
    --accent-bg: rgba(163, 230, 53, 0.08);
    --accent-bg-strong: rgba(163, 230, 53, 0.15);
    --danger: #f87171;
    --danger-bg: rgba(248, 113, 113, 0.1);
    --warning: #fbbf24;
    --warning-bg: rgba(251, 191, 36, 0.1);
    --info: #60a5fa;
    --info-bg: rgba(96, 165, 250, 0.1);
    --purple: #c084fc;
    --purple-bg: rgba(192, 132, 252, 0.1);

    --font-display: 'Bricolage Grotesque', sans-serif;
    --font-body: 'Manrope', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
  }

  * { box-sizing: border-box; margin: 0; padding: 0; }

  html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
  }

  body {
    background:
      radial-gradient(1000px 600px at 20% -10%, rgba(163, 230, 53, 0.04), transparent 60%),
      radial-gradient(800px 400px at 100% 100%, rgba(192, 132, 252, 0.03), transparent 60%),
      var(--bg);
  }

  button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
  input, select, textarea { font-family: inherit; }

  .app {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
  }

  /* ===== SIDEBAR ===== */
  .sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
  }

  .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 24px 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent), #65a30d);
    border-radius: 8px;
    display: grid;
    place-items: center;
    color: #0a0c0f;
    font-size: 18px;
  }

  .brand-name {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 16px;
    letter-spacing: -0.02em;
  }

  .brand-sub {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
  }

  .nav-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-dim);
    padding: 16px 12px 6px 12px;
  }

  .nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    user-select: none;
  }

  .nav-item:hover {
    background: var(--surface-2);
    color: var(--text);
  }

  .nav-item.active {
    background: var(--accent-bg);
    color: var(--accent);
    border-color: var(--accent-bg-strong);
  }

  .nav-item i { font-size: 18px; }

  .nav-badge {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 11px;
    background: var(--surface-3);
    color: var(--text-muted);
    padding: 2px 7px;
    border-radius: 999px;
  }

  .nav-item.active .nav-badge {
    background: var(--accent-bg-strong);
    color: var(--accent);
  }

  .sidebar-footer {
    margin-top: auto;
    padding: 12px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #a3e635, #65a30d);
    display: grid;
    place-items: center;
    font-weight: 600;
    font-size: 11px;
    color: #0a0c0f;
  }

  .user-info { flex: 1; min-width: 0; }
  .user-name { font-weight: 600; font-size: 13px; }
  .user-role { font-size: 11px; color: var(--accent); font-family: var(--font-mono); }

  /* ===== MAIN ===== */
  .main {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }

  .topbar {
    height: 64px;
    border-bottom: 1px solid var(--border);
    background: rgba(20, 23, 28, 0.7);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
  }

  .breadcrumb i { font-size: 14px; }
  .breadcrumb-current { color: var(--text); font-weight: 500; }

  .topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    display: grid;
    place-items: center;
    font-size: 18px;
    transition: all 0.15s ease;
    position: relative;
  }

  .icon-btn:hover {
    background: var(--surface-2);
    color: var(--text);
  }

  .status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: var(--accent-bg);
    color: var(--accent);
    border: 1px solid var(--accent-bg-strong);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    font-family: var(--font-mono);
  }

  .pulse {
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    animation: pulse 2s infinite;
  }

  /* Tone-varianter for status-pill (live-poll'es fra /api/system/status). */
  .status-pill-warn {
    background: var(--warning-bg);
    color: var(--warning);
    border-color: var(--warning);
  }
  .status-pill-warn .pulse { background: var(--warning); }
  .status-pill-err {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: var(--danger);
  }
  .status-pill-err .pulse { background: var(--danger); }

  @keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
  }

  /* ===== CONTENT ===== */
  .content {
    padding: 28px;
    max-width: 1400px;
    width: 100%;
  }

  .page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 24px;
    flex-wrap: wrap;
  }

  .page-title {
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 600;
    letter-spacing: -0.025em;
    margin-bottom: 4px;
  }

  .page-subtitle {
    color: var(--text-muted);
    font-size: 13px;
  }

  .header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

  .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s ease;
    white-space: nowrap;
  }

  .btn:hover {
    background: var(--surface-3);
    border-color: var(--text-dim);
  }

  .btn-primary {
    background: var(--accent);
    color: #0a0c0f;
    border-color: var(--accent);
    font-weight: 600;
  }

  .btn-primary:hover {
    background: #b9eb5b;
    border-color: #b9eb5b;
  }

  .btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: rgba(248, 113, 113, 0.2);
  }

  .btn-danger:hover {
    background: rgba(248, 113, 113, 0.15);
    border-color: var(--danger);
  }

  .btn-sm { padding: 6px 10px; font-size: 12px; }
  .btn i { font-size: 16px; }

  /* ===== STATS ===== */
  .stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
  }

  .stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    position: relative;
    overflow: hidden;
  }

  .stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-strong), transparent);
  }

  .stat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
  }

  .stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
  }

  .stat-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--surface-3);
    display: grid;
    place-items: center;
    font-size: 16px;
    color: var(--text-muted);
  }

  .stat-icon.green { color: var(--accent); background: var(--accent-bg); }
  .stat-icon.blue { color: var(--info); background: var(--info-bg); }
  .stat-icon.amber { color: var(--warning); background: var(--warning-bg); }
  .stat-icon.purple { color: var(--purple); background: var(--purple-bg); }
  .stat-icon.red { color: var(--danger); background: var(--danger-bg); }

  .stat-value {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 600;
    letter-spacing: -0.02em;
  }

  .stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-family: var(--font-mono);
    margin-top: 6px;
    color: var(--text-muted);
  }

  .trend-up { color: var(--accent); }
  .trend-down { color: var(--danger); }

  /* ===== PANELS ===== */
  .panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
  }

  .panel-head {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .panel-title {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
  }

  .panel-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
  }

  .panel-body { padding: 20px; }
  .panel-body.tight { padding: 0; }
  .panel-foot {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
  }

  /* ===== TABLE ===== */
  table {
    width: 100%;
    border-collapse: collapse;
  }

  th {
    text-align: left;
    padding: 12px 20px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
  }

  td {
    padding: 13px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    vertical-align: middle;
  }

  tbody tr:last-child td { border-bottom: none; }

  /* Totalrække. */
  tfoot td {
    font-weight: 600;
    background: var(--surface-2);
    border-top: 1px solid var(--border);
    border-bottom: none;
  }

  tbody tr {
    transition: background 0.1s ease;
  }

  tbody tr:hover { background: var(--surface-2); }

  .mono { font-family: var(--font-mono); font-size: 12px; }

  /* ===== TAGS ===== */
  .tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    font-family: var(--font-mono);
    white-space: nowrap;
  }

  .tag-ok { background: var(--accent-bg); color: var(--accent); }
  .tag-warn { background: var(--warning-bg); color: var(--warning); }
  .tag-err { background: var(--danger-bg); color: var(--danger); }
  .tag-info { background: var(--info-bg); color: var(--info); }
  .tag-purple { background: var(--purple-bg); color: var(--purple); }
  .tag-muted { background: var(--surface-3); color: var(--text-muted); }

  /* ===== ROW ICONS ===== */
  .row-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--surface-3);
    display: inline-grid;
    place-items: center;
    font-size: 14px;
    flex-shrink: 0;
  }

  .row-icon.green { color: var(--accent); background: var(--accent-bg); }
  .row-icon.blue { color: var(--info); background: var(--info-bg); }
  .row-icon.purple { color: var(--purple); background: var(--purple-bg); }
  .row-icon.amber { color: var(--warning); background: var(--warning-bg); }
  .row-icon.red { color: var(--danger); background: var(--danger-bg); }

  .cell-flex {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  /* ===== MODAL ===== */
  .modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
  }

  .modal-overlay.active { display: flex; }

  .modal {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  }

  .modal-head {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .modal-title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.02em;
  }

  .modal-body { padding: 24px; }
  .modal-foot {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
  }

  /* ===== FORM ===== */
  .form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .form-row { grid-column: 1 / -1; }

  .field-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  .field-hint {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 4px;
  }

  .input, .select {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s ease;
  }

  .input:focus, .select:focus { border-color: var(--accent-dim); }

  .input.mono { font-family: var(--font-mono); font-size: 12px; }


  /* ===== BACK BUTTON ===== */
  .back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 16px;
    transition: all 0.15s ease;
  }

  .back-btn:hover {
    background: var(--surface-2);
    color: var(--text);
  }

  /* ===== EMPTY ===== */
  .empty {
    padding: 60px 20px;
    text-align: center;
  }

  .empty-icon {
    font-size: 48px;
    color: var(--text-dim);
    margin-bottom: 12px;
  }

  .empty-title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
  }

  .empty-sub {
    font-size: 13px;
    color: var(--text-muted);
  }

  /* ===== UTILITY ===== */
  .two-col {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
  }

  .copy-btn {
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 11px;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s ease;
    flex-shrink: 0;
  }

  .copy-btn:hover {
    background: var(--surface-4);
    color: var(--text);
  }

  .copy-btn.copied {
    background: var(--accent-bg);
    color: var(--accent);
    border-color: var(--accent-dim);
  }

  /* ===== RESPONSIVE ===== */
  @media (max-width: 1100px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .two-col { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .key-info { grid-template-columns: 1fr 1fr; }
  }

  @media (max-width: 760px) {
    .app { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .stats-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
  }


  /* ===== RAZOR-SPECIFIC OVERRIDES =====
     POC brugte <div> for nav-items + .back-btn; vi bruger <a> for at få
     real navigation + accessibility. Browser-defaults for <a> (underline,
     blå :link-farve) skal nulstilles så de matcher POC's design.        */
  .nav-item, .nav-item:link, .nav-item:visited,
  .back-btn, .back-btn:link, .back-btn:visited {
    text-decoration: none;
    color: var(--text-muted);
  }
  .nav-item.active, .nav-item.active:link, .nav-item.active:visited {
    color: var(--accent);
  }

  /* ===== LIGHT THEME =====
     Aktiveres ved at sætte `class="theme-light"` på <html>. ThemeService
     i admin.js håndterer toggle + localStorage-persistence. Default følger
     OS-preference (prefers-color-scheme: light) hvis intet er gemt.

     Inverteret palette: mørke surfaces → lyse, lys tekst → mørk. Accent
     (lime) skiftes til en lidt mørkere variant så den fungerer på lys
     baggrund uden at blende. Status-farver bevares (de er allerede valgt
     for læsbarhed i begge konstaster).                                   */
  :root.theme-light {
    --bg: #f7f8fa;
    --surface: #ffffff;
    --surface-2: #f1f3f6;
    --surface-3: #e8ebef;
    --surface-4: #dde1e6;
    --border: #e1e5ea;
    --border-strong: #cbd1d8;
    --text: #1a1d23;
    --text-muted: #5c6370;
    --text-dim: #8a92a0;
    --accent: #5a7d1a;
    --accent-dim: #3d5715;
    --accent-bg: rgba(90, 125, 26, 0.08);
    --accent-bg-strong: rgba(90, 125, 26, 0.18);
    --danger-bg: rgba(220, 38, 38, 0.08);
    --warning-bg: rgba(202, 138, 4, 0.10);
    --info-bg: rgba(37, 99, 235, 0.08);
    --purple-bg: rgba(124, 58, 237, 0.08);
  }

  :root.theme-light body {
    background:
      radial-gradient(1000px 600px at 20% -10%, rgba(90, 125, 26, 0.05), transparent 60%),
      radial-gradient(800px 400px at 100% 100%, rgba(192, 132, 252, 0.04), transparent 60%),
      var(--bg);
  }

  /* Status-pill grøn-baggrund i header er for skarp på lys; tonet ned. */
  :root.theme-light .status-pill {
    background: rgba(34, 197, 94, 0.12);
    color: #15803d;
  }

  /* Light-theme button-shadow så CTA stadig springer op fra fladen. */
  :root.theme-light .btn-primary {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  }

  /* Topbar bruger hardcoded rgba(20,23,28,0.7) i base-stylesheetet
     (POC antog dark-only). I light skal vi explicit override til lys
     baggrund med samme blur-effekt, ellers fremstår den som "halvgrå". */
  :root.theme-light .topbar {
    background: rgba(255, 255, 255, 0.85);
    border-bottom-color: var(--border);
  }

  /* Brand-mark gradient skal også justeres så den lime-ikon-baggrund
     ikke kollidere med lyst tema. */
  :root.theme-light .brand-mark {
    background: var(--accent-bg-strong);
    color: var(--accent);
  }

  /* Subtle shadow på sidebar-bord så den ser separat ud fra content. */
  :root.theme-light .sidebar {
    box-shadow: 1px 0 0 var(--border);
  }

  /* ===== LOGIN ===== */
  .login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
  }
  .login-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
  }
  .login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
  }
  .login-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
  }
  .login-error {
    background: var(--danger-bg);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  /* `display: flex` ovenfor overskriver browserens UA-default
     `[hidden] { display: none }`. Eksplicit rule så banneret skjules
     indtil AuthService viser det ved fejl (AuthService toggler
     `hidden`-attributten direkte). */
  .login-error[hidden] { display: none; }
  .form-field-inline { display: flex; align-items: center; }
  .checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-muted);
  }
  .field-error {
    color: var(--danger);
    font-size: 12px;
    margin-top: 4px;
  }
  .login-submit {
    width: 100%;
    justify-content: center;
    padding: 12px;
  }

  /* ===== ERROR BANNER (API-fallback) ===== */
  .error-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--warning-bg);
    border: 1px solid var(--warning);
    color: var(--warning);
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 13px;
  }
  .error-banner i { font-size: 16px; }


  /* ============================================================
     PLANTEMPUSADMIN — komponenter til kunde-/kode-/dokument-siderne.
     Bygger på design-tokens ovenfor, så begge temaer virker uden
     egne overrides.
     ============================================================ */

  /* ===== TEKST-UTILITIES ===== */
  .muted { color: var(--text-muted); }
  .strong { font-weight: 600; color: var(--text); }
  .small { font-size: 12px; }
  .right { text-align: right; }
  .nowrap { white-space: nowrap; }
  .num { font-variant-numeric: tabular-nums; }
  .prewrap { white-space: pre-wrap; }
  .hash { font-size: 11px; word-break: break-all; }
  .page-title-mono { font-family: var(--font-mono); font-size: 22px; letter-spacing: 0; word-break: break-all; }

  /* ===== TOPBAR-BRØDKRUMME ===== */
  .breadcrumb-sep { font-size: 11px; }
  .breadcrumb-link, .breadcrumb-link:visited { color: var(--text-muted); text-decoration: none; }
  .breadcrumb-link:hover { color: var(--text); }

  /* ===== SIDEBAR-FOOTER ===== */
  .user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* ===== SEKTIONER ===== */
  .section-head { margin: 28px 0 12px; }
  .section-title {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.02em;
  }

  .grid-2 {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    gap: 16px;
    align-items: start;
  }
  .grid-2 > .panel { margin-bottom: 0; }
  .grid-2 { margin-bottom: 16px; }
  /* Et panel alene (det andet er betinget) fylder hele bredden. */
  .grid-2 > :only-child { grid-column: 1 / -1; }

  /* Stat-tiles inde i et panel: tættere og uden bundmargin. */
  .stats-grid-inline { margin-bottom: 0; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
  .stats-grid-inline .stat-card { background: var(--surface-2); padding: 14px 16px; }
  .stats-grid-inline .stat-value { font-size: 24px; }
  .stat-value-sm { font-size: 20px; }
  .stat-value-of { font-size: 15px; color: var(--text-muted); font-weight: 500; }

  /* ===== KNAPPER ===== */
  .btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
  .btn-ghost:hover { background: var(--surface-3); border-color: transparent; color: var(--text); }
  .btn:disabled, .btn:disabled:hover { opacity: 0.5; cursor: not-allowed; }
  .btn.copied { color: var(--accent); border-color: var(--accent-dim); }

  /* ===== TABEL ===== */
  .table-wrap { overflow-x: auto; }
  th.right, td.right { text-align: right; }
  tbody tr.link { cursor: pointer; }
  .row-link, .row-link:visited { color: inherit; text-decoration: none; }
  .row-link:hover { text-decoration: underline; }
  td a:not(.row-link):not(.btn) { color: var(--info); text-decoration: none; }
  td a:not(.row-link):not(.btn):hover { text-decoration: underline; }

  /* Inline-bekræftelse af tilbagekald (erstatter browserens confirm()). */
  tr.confirm-row td { background: var(--danger-bg); }
  tr.confirm-row:hover { background: transparent; }
  .confirm-inline {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
  }
  .confirm-inline[hidden] { display: none; }
  .confirm-text { font-size: 12px; max-width: 280px; text-align: left; }

  /* ===== PILLS + CHIPS ===== */
  .pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
  }
  .pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
  .pill.ok { color: var(--accent); background: var(--accent-bg); }
  .pill.warn { color: var(--warning); background: var(--warning-bg); }
  .pill.bad { color: var(--danger); background: var(--danger-bg); }
  .pill.info { color: var(--info); background: var(--info-bg); }
  .pill.off { color: var(--text-muted); background: var(--surface-3); }

  .chip {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    background: var(--surface-3);
    border-radius: 6px;
    padding: 2px 7px;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
  }
  .chips { display: flex; flex-wrap: wrap; gap: 4px; }

  /* ===== SØGEFELT ===== */
  .search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-muted);
    min-width: 260px;
  }
  .search:focus-within { border-color: var(--accent-dim); }
  .search input {
    border: 0;
    background: none;
    outline: none;
    width: 100%;
    color: var(--text);
    font-size: 13px;
  }

  /* ===== FAKTA-LISTE (dl) ===== */
  dl.facts {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 10px 18px;
    font-size: 13px;
  }
  dl.facts dt { color: var(--text-muted); }
  dl.facts dd { overflow-wrap: anywhere; }

  /* ===== FORM-TILLÆG ===== */
  .form-field { min-width: 0; }
  .textarea { resize: vertical; min-height: 72px; line-height: 1.5; }
  .select { appearance: auto; }
  .modal-body > .login-error { margin-bottom: 16px; }
  .modal-note { margin-top: 14px; }

  /* ===== EMPTY-TILLÆG ===== */
  .empty-compact { padding: 24px 20px; }
  .empty[hidden] { display: none; }

  /* ===== KODE-REVEAL ===== */
  .code-reveal {
    display: grid;
    gap: 10px;
    justify-items: center;
    text-align: center;
    padding: 22px 16px;
    border-radius: 12px;
    background: var(--surface-2);
    border: 1px dashed var(--border-strong);
    margin-bottom: 16px;
  }
  .code-big {
    font-family: var(--font-mono);
    font-size: 40px;
    font-weight: 600;
    letter-spacing: 0.12em;
    color: var(--accent);
  }
  /* En servernøgle (ptk_…) er for lang til den store kode-skrift. */
  .code-big.is-long {
    font-size: 15px;
    letter-spacing: 0;
    word-break: break-all;
  }
  .code-meta { font-size: 12px; color: var(--text-muted); }

  .callout {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--warning-bg);
    color: var(--warning);
    font-size: 12px;
    font-weight: 600;
  }
  .callout i { font-size: 16px; flex-shrink: 0; }
  .modal-body > .callout + .form-grid { margin-top: 16px; }

  /* ===== DOKUMENT-INDHOLD ===== */
  .code-block {
    margin: 0;
    padding: 16px 20px;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.65;
    background: var(--surface-2);
    color: var(--text);
    overflow: auto;
    max-height: 70vh;
    white-space: pre;
    tab-size: 2;
  }

  /* ===== LOGIN-TILLÆG ===== */
  .login-title {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: -8px;
  }

  /* ===== TOAST =====
     Matcher ToastService: #toast-stack.toast-stack > .toast.toast-{type}. */
  .toast-stack {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .toast {
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    max-width: 420px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    animation: slide-in 0.3s ease;
    transition: opacity 0.2s ease;
  }
  .toast i { font-size: 18px; flex-shrink: 0; }
  .toast-success { border-color: var(--accent-dim); }
  .toast-success i { color: var(--accent); }
  .toast-error { border-color: var(--danger); }
  .toast-error i { color: var(--danger); }
  .toast-info i { color: var(--info); }
  .toast-out { opacity: 0; }

  @keyframes slide-in {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
  }

  @media (max-width: 1100px) {
    .grid-2 { grid-template-columns: minmax(0, 1fr); }
  }

  @media (max-width: 760px) {
    .search { min-width: 0; width: 100%; }
    .code-big { font-size: 32px; }
  }
