/* ============================================================
   LARSENPEDERSEN.XYZ — SHARED DESIGN SYSTEM v2.0

   Usage: <link rel="stylesheet" href="/shared.css">

   Layers:
     1. Tokens       — CSS custom properties (rem-baseret typografi)
     2. Reset        — Minimal base reset
     3. Typography   — Font scale + typografiklasser
     4. Ikoner       — MDI-hjælpeklasser (.icon, størrelser, farver)
     5. Layout       — Container, grid, breakpoints
     6. Components   — Header, subnav, tab bar, buttons, forms…
     7. Utilities    — Spacing, display helpers
     8. Responsive   — Breakpoint helpers (600 / 1024 / 1440)
   ============================================================ */


/* ── 1. TOKENS ────────────────────────────────────────────── */
:root {
  /* Surface */
  --bg:           #f5f2ed;
  --surface:      #ffffff;
  --surface-alt:  #faf8f5;
  --border:       #e2ddd6;
  --border-focus: #2d5a3d;

  /* Text */
  --text:         #1a1814;
  --muted:        #8c8680;
  --subtle:       #b5b0a8;

  /* Accent — primary brand green */
  --accent:       #2d5a3d;
  --accent-dark:  #1e3d29;
  --accent-light: #e8f0eb;
  --accent-mid:   #c2d9c9;

  /* Semantic */
  --danger:       #c0392b;
  --danger-light: #fdf0ee;
  --danger-mid:   #f0b8b3;
  --success:      #2d7a4f;
  --success-light:#e8f5ee;
  --warning:      #c47a1e;
  --warning-light:#fdf0dc;

  /* Tag (inverted — dark chip on light bg) */
  --tag-bg:       #1a1814;
  --tag-text:     #f5f2ed;

  /* Typography — rem-baseret (base: 16px browser default)
     Skift html { font-size } for at skalere hele systemet */
  --font:          'DM Mono', monospace;
  --font-size-xs:  0.75rem;    /* 12px  — hævet fra 11px */
  --font-size-sm:  0.8125rem;  /* 13px */
  --font-size-md:  0.9375rem;  /* 15px */
  --font-size-lg:  1.0625rem;  /* 17px */
  --font-size-xl:  1.375rem;   /* 22px */
  --font-size-2xl: 1.625rem;   /* 26px — page-title */

  /* Spacing */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  32px;
  --space-2xl: 48px;

  /* Shape */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* Elevation */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 24px rgba(0,0,0,0.12);
  --shadow-xl: 0 8px 40px rgba(0,0,0,0.15);

  /* Transitions */
  --transition: 0.15s ease;

  /* Layout */
  --header-height:      64px;
  --subnav-height:      44px;
  --tab-bar-height:     0px;   /* sættes til 56px+ via body.has-tab-bar */
  --fab-clearance:      0px;   /* sættes via body.has-fab (kun mobil) */
  --safe-top:           env(safe-area-inset-top, 0px);
  --header-height-full: calc(var(--header-height) + env(safe-area-inset-top, 0px));
  --active-sticky-top:  var(--header-height-full); /* override til calc(header + subnav) ved body.has-subnav */
}

/* Sæt .has-subnav på <body> når subnav bruges —
   sikrer at banner-fixed sidder under både header og subnav */
body.has-subnav {
  --active-sticky-top: calc(var(--header-height-full) + var(--subnav-height));
}

/* Tab-bar offset — tilføj .has-tab-bar på <body> når tab bar bruges */
body.has-tab-bar {
  --tab-bar-height: calc(56px + env(safe-area-inset-bottom, 0px));
}

/* FAB-clearance — tilføj .has-fab på <body> når FAB bruges
   Kun på mobil — FAB vises aldrig på desktop */
@media (max-width: 600px) {
  body.has-fab {
    --fab-clearance: calc(56px + var(--space-md));
  }
}


/* ── 2. RESET ─────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  font-size: var(--font-size-md);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-md) 0;
}

strong { font-weight: 500; }


/* ── 3. TYPOGRAPHY ────────────────────────────────────────── */

/* Skala */
.text-xs  { font-size: var(--font-size-xs); }
.text-sm  { font-size: var(--font-size-sm); }
.text-md  { font-size: var(--font-size-md); }
.text-lg  { font-size: var(--font-size-lg); }
.text-xl  { font-size: var(--font-size-xl); }
.text-2xl { font-size: var(--font-size-2xl); }

/* Farver */
.text-muted  { color: var(--muted); }
.text-subtle { color: var(--subtle); }
.text-accent { color: var(--accent); }
.text-danger { color: var(--danger); }
.text-success{ color: var(--success); }

/* Mobil-skalering */
@media (max-width: 600px) {
  :root {
    --font-size-xs:  0.6875rem;  /* 11px */
    --font-size-sm:  0.75rem;    /* 12px */
    --font-size-md:  0.8125rem;  /* 13px */
    --font-size-lg:  0.9375rem;  /* 15px */
    --font-size-xl:  1.25rem;    /* 20px */
    --font-size-2xl: 1.5rem;     /* 24px */
  }
}

/* Typografiklasser */
.label {
  display: block;
  font-size: var(--font-size-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: var(--space-xs);
}

.section-title {
  font-size: var(--font-size-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: var(--space-sm);
}

.page-title {
  font-size: var(--font-size-2xl);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.card-title {
  font-size: var(--font-size-lg);
  font-weight: 500;
}


/* ── 4. IKONER ────────────────────────────────────────────── */
/* Bruges primært med MDI (Material Design Icons) via CDN:
   <link href="https://cdn.jsdelivr.net/npm/@mdi/font@7/css/materialdesignicons.min.css" rel="stylesheet">
   Brug: <span class="mdi mdi-home"></span>

   Ikoner arver farve via currentColor og skalerer med font-size.
   Emojis bruges til dekorative/state-elementer — MDI til interaktive UI-elementer. */

.icon {
  display: inline-flex;
  align-items: center;
  line-height: 1;
  font-size: var(--font-size-lg); /* default ~ 17px */
  flex-shrink: 0;
}

/* Størrelser */
.icon-xs { font-size: var(--font-size-xs); }
.icon-sm { font-size: var(--font-size-md); }
.icon-md { font-size: var(--font-size-xl); }
.icon-lg { font-size: 1.75rem; }
.icon-xl { font-size: 2.5rem; }

/* Farver — arver currentColor, men kan overrides eksplicit */
.icon-muted   { color: var(--muted); }
.icon-subtle  { color: var(--subtle); }
.icon-accent  { color: var(--accent); }
.icon-danger  { color: var(--danger); }
.icon-success { color: var(--success); }
.icon-warning { color: var(--warning); }


/* ── 5. LAYOUT ────────────────────────────────────────────── */

/* Container — responsiv max-bredde */
.container {
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--space-md);
}
@media (min-width: 600px)  { .container { padding: 0 var(--space-lg); } }
@media (min-width: 1024px) { .container { max-width: 1200px; } }
@media (min-width: 1440px) { .container { max-width: 1440px; padding: 0 var(--space-2xl); } }

/* Container til indholdssider (smallere end fuld container) */
.container-narrow {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}
@media (min-width: 600px) { .container-narrow { padding: 0 var(--space-lg); } }

/* Grid — kollapser til 1 kolonne på mobil */
.grid-2,
.grid-3,
.grid-4 {
  display: grid;
  gap: var(--space-md);
  grid-template-columns: 1fr;
}

@media (min-width: 600px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1440px) {
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* Grid gap varianter */
.gap-grid-sm { gap: var(--space-sm); }
.gap-grid-lg { gap: var(--space-lg); }


/* ── 5. COMPONENTS ────────────────────────────────────────── */


/* -- HEADER -- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: env(safe-area-inset-top, 0px) var(--space-lg) 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height-full);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: var(--space-md);
}

.site-logo {
  font-size: var(--font-size-xl);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}
.site-logo:hover { text-decoration: none; }

.site-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--tag-bg);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tag-text);
  font-size: 1rem;
  flex-shrink: 0;
}

/* Primær navigation i header (skjules på mobil — brug tab bar i stedet) */
.header-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 6px var(--space-sm);
  font-size: var(--font-size-sm);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  white-space: nowrap;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
}
.nav-link:hover { color: var(--text); background: var(--bg); text-decoration: none; }
.nav-link.active { color: var(--accent); background: var(--accent-light); }

/* Actions-gruppe til højre i header */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

/* Avatar / profilknap */
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
  cursor: pointer;
  border: none;
  font-family: var(--font);
  transition: opacity var(--transition);
}
.avatar:hover { opacity: 0.85; }
.avatar-sm { width: 26px; height: 26px; }

@media (max-width: 600px) {
  .site-header { padding: env(safe-area-inset-top, 0px) var(--space-md) 0; }
  .header-nav  { display: none; }
}


/* -- SUBNAV -- */
/* Sekundær navigation — sticky under headeren */
.subnav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 var(--space-lg);
  display: flex;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  position: sticky;
  top: var(--header-height-full);
  z-index: 90;
  height: var(--subnav-height);
  align-items: stretch;
}
.subnav::-webkit-scrollbar { display: none; }

.subnav-link {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0 var(--space-md);
  font-size: var(--font-size-sm);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color var(--transition), border-color var(--transition);
  cursor: pointer;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  border-bottom: 2px solid transparent;
  font-family: var(--font);
}
.subnav-link:hover { color: var(--text); text-decoration: none; }
.subnav-link.active { color: var(--accent); border-bottom-color: var(--accent); }

@media (max-width: 600px) {
  .subnav { padding: 0; top: var(--header-height-full); }
}


/* -- BOTTOM TAB BAR (mobil) -- */
/* Vis kun på mobil — tilføj .has-tab-bar på <body> */
.tab-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(56px + env(safe-area-inset-bottom, 0px));
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 150;
  align-items: stretch;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}

.tab-bar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  font-family: var(--font);
  font-size: 0.625rem;  /* 10px — bevidst lille til tab-labels */
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  cursor: pointer;
  transition: color var(--transition);
  text-decoration: none;
  padding: 0;
  min-width: 0;
}
.tab-bar-item:hover  { color: var(--text); }
.tab-bar-item.active { color: var(--accent); }

.tab-icon  { font-size: 1.375rem; line-height: 1; }
.tab-label { line-height: 1; }

@media (max-width: 600px) {
  .tab-bar { display: flex; }

  /* Skub indhold op så tab-bar ikke dækker */
  .fab   { bottom: calc(var(--tab-bar-height) + var(--space-md)); }
  #toast { bottom: calc(var(--tab-bar-height) + var(--space-lg)); right: var(--space-md); }
}


/* -- BUTTONS -- */
button {
  font-family: var(--font);
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: 0 var(--space-md);
  height: 38px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: var(--font-size-md);
  font-weight: 500;
  white-space: nowrap;
  border: none;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition),
              background var(--transition), border-color var(--transition),
              color var(--transition);
  text-decoration: none;
  line-height: 1;
  vertical-align: middle;
  box-sizing: border-box;
}

.btn:active    { transform: scale(0.97); }
.btn:disabled  { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--tag-bg); color: var(--tag-text); }
.btn-primary:hover:not(:disabled) { opacity: 0.82; }

.btn-accent  { background: var(--accent); color: #fff; }
.btn-accent:hover:not(:disabled)  { background: var(--accent-dark); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.btn-ghost {
  background: none;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg); color: var(--text); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { opacity: 0.85; }

.btn-danger-ghost {
  background: none;
  color: var(--danger);
  border: 1px solid var(--border);
}
.btn-danger-ghost:hover:not(:disabled) {
  background: var(--danger-light);
  border-color: var(--danger);
}

/* Størrelser */
.btn-sm   { padding: 0 12px; height: 30px; font-size: var(--font-size-sm); }
.btn-lg   { padding: 0 22px; height: 46px; font-size: var(--font-size-lg); }
.btn-full { width: 100%; }

/* Ikon-only */
.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: var(--font-size-md);
}
.btn-icon:hover { background: var(--bg); color: var(--text); }


/* -- BADGE / CHIP -- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: var(--font-size-xs);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.badge-dark    { background: var(--tag-bg);       color: var(--tag-text); }
.badge-accent  { background: var(--accent-light);  color: var(--accent); }
.badge-danger  { background: var(--danger-light);  color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-muted   { background: var(--border);        color: var(--muted); }


/* -- FORM ELEMENTS -- */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
.field + .field { margin-top: var(--space-md); }

.input,
.select,
.textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: var(--font-size-md);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), background var(--transition);
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--border-focus);
  background: var(--surface);
}

.input::placeholder,
.textarea::placeholder { color: var(--subtle); }

.input-lg { padding: 12px 14px; font-size: var(--font-size-md); border-radius: var(--radius-md); }
.textarea  { resize: vertical; min-height: 80px; }

/* 2-kolonne form grid */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}
.form-grid .field { margin-top: 0; }

@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* Input med ikon */
.input-wrap { position: relative; }
.input-wrap .input { padding-left: 36px; }
.input-wrap .input-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: var(--font-size-md);
  pointer-events: none;
}

/* Toggle / Switch */
.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border);
  border-radius: 22px;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }


/* -- CARD -- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-md);
}
.card-sm    { padding: var(--space-md); border-radius: var(--radius-md); }
.card-flush { padding: 0; overflow: hidden; }


/* -- STAT CARD -- */
/* Bruges i dashboards — viser et nøgletal med label og valgfri trend */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.stat-value {
  font-size: 2rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--text);
}

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

.stat-trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: var(--font-size-xs);
  font-weight: 500;
  margin-top: var(--space-xs);
}
.stat-trend.up   { color: var(--success); }
.stat-trend.down { color: var(--danger); }
.stat-trend.flat { color: var(--muted); }


/* -- CHART CONTAINER -- */
/* Wrapper til eksterne graf-biblioteker (Chart.js, ApexCharts m.fl.) */
.chart-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-md);
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  gap: var(--space-sm);
}

.chart-title {
  font-size: var(--font-size-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.chart-area {
  width: 100%;
  min-height: 200px;
  position: relative;
}
.chart-area canvas { width: 100% !important; }

/* Placeholder — vises mens data hentes eller som demo */
.chart-placeholder {
  width: 100%;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-radius: var(--radius-md);
  color: var(--subtle);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px dashed var(--border);
}


/* -- KALENDER-SKAL -- */
/* Ren CSS-struktur, ingen logik — projekter fylder data i selv */
.cal-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  gap: var(--space-sm);
}

.cal-title {
  font-size: var(--font-size-md);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.cal-day-name {
  padding: var(--space-sm);
  text-align: center;
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.cal-day {
  padding: var(--space-sm);
  min-height: 52px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: background var(--transition);
  position: relative;
}
.cal-day:nth-child(7n)        { border-right: none; }
.cal-day:hover                { background: var(--surface-alt); }
.cal-day.today                { background: var(--accent-light); }
.cal-day.today .cal-day-num   { color: var(--accent); font-weight: 500; }
.cal-day.other-month .cal-day-num { color: var(--subtle); }
.cal-day.selected             { background: var(--accent); }
.cal-day.selected .cal-day-num { color: #fff; }
.cal-day.has-event::after {
  content: '';
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
.cal-day.selected.has-event::after { background: rgba(255,255,255,0.7); }

.cal-day-num {
  font-size: var(--font-size-sm);
  line-height: 1;
  margin-bottom: 2px;
}

/* Kompakt kalender til mobil */
@media (max-width: 600px) {
  .cal-day     { min-height: 40px; padding: var(--space-xs); }
  .cal-header  { padding: var(--space-sm) var(--space-md); }
}


/* -- PULL TO REFRESH -- */
/* Kræver: <div class="ptr" id="ptr"><div class="ptr-content">
             <span class="ptr-icon">↓</span>
             <span class="ptr-text">Træk for at opdatere</span>
           </div></div>
   Initialisér med: LP.ptr.init({ onRefresh: () => fetchAll() }) */

.ptr {
  position: fixed;
  top: var(--active-sticky-top);
  left: 0;
  right: 0;
  z-index: 85;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 0;
  overflow: hidden;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: height 0.25s ease, border-color 0.25s ease;
}

.ptr.ptr-visible  { border-bottom-color: var(--border); }
.ptr.ptr-pulling  { transition: none; } /* følger fingeren uden forsinkelse */

.ptr-content {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--font-size-sm);
  color: var(--muted);
  user-select: none;
}

.ptr-icon {
  display: inline-block;
  font-size: var(--font-size-lg);
  transition: transform 0.2s ease;
  line-height: 1;
}

.ptr-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ptr-spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes ptr-spin {
  to { transform: rotate(360deg); }
}


/* -- BANNER / ALERT -- */
/* Persistent, dismissible notifikation — bruges til API-fejl, offline,
   import-fejl og andre vigtige tilstande brugeren selv skal lukke.
   Brug toast til kortvarige bekræftelser — banner til vedvarende tilstande. */

.banner {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  font-size: var(--font-size-sm);
  line-height: 1.4;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}

.banner-icon  { flex-shrink: 0; font-size: var(--font-size-md); }
.banner-text  { flex: 1; }

.banner-actions {
  display: flex;
  gap: var(--space-xs);
  align-items: center;
  flex-shrink: 0;
}

.banner-btn {
  background: none;
  border: none;
  font-family: var(--font);
  font-size: var(--font-size-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  padding: 3px var(--space-xs);
  border-radius: var(--radius-sm);
  text-decoration: underline;
  transition: opacity var(--transition);
}
.banner-btn:hover { opacity: 0.7; }

.banner-close {
  background: none;
  border: none;
  font-family: var(--font);
  font-size: var(--font-size-md);
  cursor: pointer;
  padding: 2px var(--space-xs);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  transition: opacity var(--transition);
  line-height: 1;
  opacity: 0.6;
}
.banner-close:hover { opacity: 1; }

/* Varianter */
.banner-danger  {
  background: var(--danger-light);
  border-color: var(--danger-mid);
  color: var(--danger);
}
.banner-danger  .banner-btn,
.banner-danger  .banner-close { color: var(--danger); }

.banner-warning {
  background: var(--warning-light);
  border-color: #e8c890;
  color: var(--warning);
}
.banner-warning .banner-btn,
.banner-warning .banner-close { color: var(--warning); }

.banner-success {
  background: var(--success-light);
  border-color: var(--accent-mid);
  color: var(--success);
}
.banner-success .banner-btn,
.banner-success .banner-close { color: var(--success); }

.banner-info {
  background: var(--accent-light);
  border-color: var(--accent-mid);
  color: var(--accent);
}
.banner-info .banner-btn,
.banner-info .banner-close { color: var(--accent); }

/* Fast banner — sticky under headeren (og subnavigationen hvis til stede)
   Placér altid i DOM lige efter .subnav eller .site-header.
   Tilføj .has-subnav på <body> hvis siden bruger subnav. */
.banner-fixed {
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
  position: sticky;
  top: var(--active-sticky-top);
  z-index: 95;
  padding: var(--space-sm) var(--space-lg);
}

@media (max-width: 600px) {
  .banner-fixed { padding: var(--space-sm) var(--space-md); }
}


/* -- SETUP / CONFIG OVERLAY -- */
.setup-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-lg);
  overflow-y: auto;
}
.setup-overlay.hidden { display: none; }

.setup-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-md);
  margin-top: var(--space-xl);
}

.setup-box h1 {
  font-size: var(--font-size-xl);
  font-weight: 800;
  margin-bottom: var(--space-xs);
}

.setup-box > p {
  color: var(--muted);
  font-size: var(--font-size-md);
  margin-bottom: var(--space-xl);
  line-height: 1.6;
}

.setup-hint {
  margin-top: var(--space-sm);
  font-size: var(--font-size-xs);
  color: var(--muted);
  line-height: 1.6;
  padding: var(--space-sm) var(--space-md);
  background: var(--accent-light);
  border-radius: var(--radius-sm);
}

.setup-section {
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--border);
}
.setup-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.setup-section-title {
  font-size: var(--font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}


/* -- MODAL (centered) -- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 24, 20, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: var(--space-lg);
}
.modal-overlay.hidden { display: none; }

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-xl);
}

.modal h3 {
  font-size: var(--font-size-lg);
  font-weight: 500;
  margin-bottom: var(--space-xs);
}

.modal p {
  color: var(--muted);
  font-size: var(--font-size-md);
  margin-bottom: var(--space-lg);
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
}


/* -- SLIDE-UP MODAL (mobil-first) -- */
.slideup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 24, 20, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
}
.slideup-overlay.hidden { display: none; }

.slideup {
  background: var(--bg);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: var(--space-lg) var(--space-lg) calc(var(--space-xl) + env(safe-area-inset-bottom, 0px));
  width: 100%;
  max-width: 600px;
  box-shadow: 0 -4px 32px rgba(0,0,0,0.14);
  border-top: 1px solid var(--border);
  max-height: 92vh;
  overflow-y: auto;
}

.slideup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
}

.slideup-title {
  font-size: var(--font-size-lg);
  font-weight: 500;
}

.slideup .input, .slideup .select, .slideup .textarea { background: var(--surface); }

.btn-close {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 11px;
  font-size: var(--font-size-sm);
  cursor: pointer;
  color: var(--muted);
  font-family: var(--font);
  transition: all var(--transition);
}
.btn-close:hover { background: var(--bg); color: var(--text); }


/* -- TOAST -- */
#toast {
  position: fixed;
  bottom: calc(var(--tab-bar-height) + var(--fab-clearance) + var(--space-lg));
  right: var(--space-lg);
  background: var(--tag-bg);
  color: var(--tag-text);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: var(--font-size-md);
  font-family: var(--font);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 500;
  max-width: 300px;
  line-height: 1.4;
}
#toast.show          { opacity: 1; transform: translateY(0); }
#toast.toast-error   { background: var(--danger); }
#toast.toast-success { background: var(--success); }
#toast.toast-warning { background: var(--warning); }


/* -- FLOATING ACTION BUTTON -- */
.fab {
  display: none;
  position: fixed;
  bottom: calc(var(--tab-bar-height) + var(--space-lg));
  right: var(--space-lg);
  width: 56px;
  height: 56px;
  background: var(--tag-bg);
  color: var(--tag-text);
  border: none;
  border-radius: 50%;
  font-size: var(--font-size-xl);
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  z-index: 150;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition);
}
.fab:active { transform: scale(0.92); }

.fab-wide {
  width: auto;
  border-radius: 40px;
  padding: 14px 28px;
  font-size: var(--font-size-lg);
  font-weight: 500;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
}
.fab-wide:active { transform: translateX(-50%) scale(0.97); }

@media (max-width: 600px) {
  .fab { display: flex; }
}


/* -- DROPDOWN ACTION MENU -- */
.action-menu {
  display: none;
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 400;
  min-width: 172px;
  overflow: hidden;
}
.action-menu.open { display: block; }

.action-menu button {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  padding: 13px var(--space-md);
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  font-family: var(--font);
  font-size: var(--font-size-md);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background var(--transition);
}
.action-menu button:last-child { border-bottom: none; }
.action-menu button:hover  { background: var(--bg); }
.action-menu button.danger { color: var(--danger); }
.action-menu button.danger:hover { background: var(--danger-light); }


/* -- EMPTY / LOADING STATE -- */
.state-msg {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  color: var(--muted);
  font-size: var(--font-size-md);
}
.state-msg .state-icon {
  display: block;
  font-size: 2rem;
  margin-bottom: var(--space-sm);
}

.state-row td {
  text-align: center;
  padding: 48px;
  color: var(--muted);
  font-size: var(--font-size-md);
}
.state-row .state-icon {
  display: block;
  font-size: 2rem;
  margin-bottom: var(--space-sm);
}


/* -- TABLE -- */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

table { width: 100%; border-collapse: collapse; }

thead th {
  text-align: left;
  padding: 12px var(--space-md);
  font-size: var(--font-size-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover      { background: var(--surface-alt); }
tbody td {
  padding: 12px var(--space-sm);
  font-size: var(--font-size-md);
  vertical-align: middle;
}

/* Responsiv tabel — kollapser til kortliste på mobil
   Brug: tilføj .table-responsive på .table-wrap
         tilføj data-label="Kolonnenavn" på hver <td> */
@media (max-width: 600px) {
  .table-responsive table,
  .table-responsive thead,
  .table-responsive tbody,
  .table-responsive th,
  .table-responsive td,
  .table-responsive tr { display: block; }

  .table-responsive thead { display: none; }

  .table-responsive tbody tr {
    padding: var(--space-md);
    border-bottom: 1px solid var(--border);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xs) var(--space-md);
  }
  .table-responsive tbody tr:last-child { border-bottom: none; }
  .table-responsive tbody tr:hover { background: var(--surface-alt); }

  .table-responsive tbody td {
    padding: 0;
    font-size: var(--font-size-sm);
    border: none;
  }

  .table-responsive tbody td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-weight: 500;
    margin-bottom: 2px;
  }

  /* Handlingskolonne fylder hele bredden */
  .table-responsive tbody td.td-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: var(--space-xs);
    justify-content: flex-end;
    padding-top: var(--space-xs);
    border-top: 1px solid var(--border);
    margin-top: var(--space-xs);
  }

  /* Fuld bredde celle (fx status/badge rækker) */
  .table-responsive tbody td.td-full {
    grid-column: 1 / -1;
  }
}


/* -- PROGRESS BAR -- */
.progress-wrap {
  height: 5px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: var(--space-xs);
}
.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.4s ease;
}


/* -- TABS -- */
.tabs {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}
.tab-btn {
  flex: 1;
  padding: 9px var(--space-sm);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  font-size: var(--font-size-md);
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: all var(--transition);
}
.tab-btn.active {
  background: var(--tag-bg);
  border-color: var(--tag-bg);
  color: var(--tag-text);
}
.tab-btn:not(.active):hover {
  border-color: var(--accent);
  color: var(--accent);
}


/* -- INLINE EDIT INPUT -- */
.edit-input {
  padding: 5px 8px;
  border: 1.5px solid var(--border-focus);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: var(--font-size-md);
  background: var(--surface);
  color: var(--text);
  outline: none;
  width: 100%;
}


/* ── 6. UTILITIES ─────────────────────────────────────────── */
.hidden          { display: none !important; }
.flex            { display: flex; }
.flex-col        { display: flex; flex-direction: column; }
.items-center    { align-items: center; }
.items-start     { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end     { justify-content: flex-end; }
.flex-wrap       { flex-wrap: wrap; }
.flex-1          { flex: 1; }
.gap-xs          { gap: var(--space-xs); }
.gap-sm          { gap: var(--space-sm); }
.gap-md          { gap: var(--space-md); }
.gap-lg          { gap: var(--space-lg); }
.mt-xs           { margin-top: var(--space-xs); }
.mt-sm           { margin-top: var(--space-sm); }
.mt-md           { margin-top: var(--space-md); }
.mt-lg           { margin-top: var(--space-lg); }
.mt-xl           { margin-top: var(--space-xl); }
.mb-xs           { margin-bottom: var(--space-xs); }
.mb-sm           { margin-bottom: var(--space-sm); }
.mb-md           { margin-bottom: var(--space-md); }
.mb-lg           { margin-bottom: var(--space-lg); }
.w-full          { width: 100%; }
.text-right      { text-align: right; }
.text-center     { text-align: center; }
.truncate        { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.font-bold       { font-weight: 500; }
.font-medium     { font-weight: 400; }
.uppercase       { text-transform: uppercase; letter-spacing: 0.08em; }
.rounded         { border-radius: var(--radius-md); }
.border          { border: 1px solid var(--border); }
.bg-surface      { background: var(--surface); }
.bg-bg           { background: var(--bg); }
.p-md            { padding: var(--space-md); }
.p-lg            { padding: var(--space-lg); }
.px-md           { padding-left: var(--space-md); padding-right: var(--space-md); }
.py-md           { padding-top: var(--space-md); padding-bottom: var(--space-md); }


/* ── 7. RESPONSIVE HELPERS ────────────────────────────────── */

/* Skjul / vis på mobil */
@media (max-width: 600px) {
  .hide-mobile { display: none !important; }
  .setup-box   { padding: var(--space-xl) var(--space-lg); margin-top: var(--space-sm); }
  .modal       { margin: var(--space-md); }
}

@media (min-width: 601px) {
  .show-mobile { display: none !important; }
}

/* Skjul / vis på tablet og under */
@media (max-width: 1023px) {
  .hide-tablet { display: none !important; }
}

@media (min-width: 1024px) {
  .show-tablet { display: none !important; }
}

/* Skjul / vis kun på desktop (≥1024px) */
@media (max-width: 1023px) {
  .desktop-only { display: none !important; }
}

@media (min-width: 1024px) {
  .mobile-only { display: none !important; }
}
