/* Utviklingsverket – grunnstiler.
   Layout: mørkt «flomlys»-uttrykk der gressgrønn bane er det eneste store fargefeltet.
   Bevisst ett mørkt tema (samme uttrykk uansett systeminnstilling). */
:root {
  --bg: #0B1120;          /* natt */
  --panel: #0D1426;       /* sidepaneler */
  --surface: #131C31;     /* kort og felt */
  --surface-2: #1A2540;   /* hover / aktiv */
  --line: #1F2B47;        /* skillelinjer */
  --line-strong: #2E3E63;
  --fg: #E6ECF5;
  --fg-2: #C4CEDD;
  --muted: #8F9CB3;
  --accent: #C8F560;      /* kalkmerket lime */
  --accent-ink: #0B1120;
  --accent-soft: rgba(200, 245, 96, 0.14);
  --blue: #2563EB;
  --orange: #F97316;
  --danger: #FCA5B1;
  --danger-bg: #2A1520;
  --ok: #86EFAC;
  --warn: #FCD34D;
  --grass: #2E8C4D;

  --font-display: 'Barlow Condensed', 'Arial Narrow', 'Roboto Condensed', sans-serif;
  --font-body: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --gutter: clamp(16px, 2.2vw, 28px);
  --top-h: 60px;
  color-scheme: dark;
}

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
h1, h2, h3, h4 { margin: 0; text-wrap: balance; }
h1, h2, h3 { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.02em; line-height: 1.05; }
h1 { font-size: clamp(30px, 4vw, 40px); font-weight: 700; }
h2 { font-size: 24px; font-weight: 700; }
h3 { font-size: 21px; font-weight: 700; }
h4 { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
p { margin: 0; }
.muted { color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); line-height: 1.55; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button { font-family: inherit; color: inherit; }
.boot { min-height: 60vh; display: grid; place-content: center; gap: 6px; text-align: center; color: var(--muted); }
.boot strong { font-family: var(--font-display); font-size: 28px; text-transform: uppercase; color: var(--fg); }

/* Knapper */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--fg);
  font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn.primary:hover { background: #D6FA82; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--fg-2); }
.btn.ghost:hover { background: var(--surface); }
.btn.danger { background: var(--danger-bg); border-color: #5B2330; color: var(--danger); }
.btn.danger-text { color: var(--danger); }
.btn.sm { min-height: 34px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn .icon { flex-shrink: 0; }
.link-btn { background: none; border: 0; padding: 0; color: var(--fg-2); font-size: 13px; font-weight: 600; cursor: pointer; text-align: left; }
.link-btn:hover { color: var(--accent); }
.link-btn.strong { color: var(--fg); font-weight: 700; font-size: 14px; }
.row-gap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-gap.spread { justify-content: space-between; }

/* Skjema */
.input {
  width: 100%; min-height: 40px; padding: 8px 12px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--bg); color: var(--fg);
  font: inherit; font-size: 14px;
}
.input::placeholder { color: #5E6B85; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238F9CB3' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 12px; font-weight: 600; color: var(--fg-2); }
.field-hint { font-size: 11px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.form-sub { margin-top: 6px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 1px 0 0; }
.title-input {
  width: 100%; background: transparent; border: 1px solid transparent; border-radius: 10px; color: var(--fg);
  font-family: var(--font-display); font-weight: 700; font-size: 32px; line-height: 1.02; text-transform: uppercase;
  padding: 4px 6px; margin-left: -6px; resize: none;
}
.title-input:hover { border-color: var(--line); }
.title-input:focus { outline: none; border-color: var(--accent); }
.title-input.single { font-size: 36px; }

/* Chips, piller, segmenter */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--fg-2); font-size: 13px; font-weight: 600; cursor: pointer;
}
.chip:hover { border-color: var(--muted); }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.chip-count { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip.on .chip-count { color: var(--accent); }
.pill { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 700; }
.status { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.status.ok { background: rgba(134, 239, 172, 0.12); color: var(--ok); }
.status.warn { background: rgba(252, 211, 77, 0.12); color: var(--warn); }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); }
.seg button { flex: 1; min-height: 32px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--surface-2); color: var(--fg); }
.seg.small button { min-height: 28px; padding: 0 8px; }

/* Tomtilstand */
.empty { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 32px; border: 1px dashed var(--line-strong); border-radius: var(--r-lg); max-width: 640px; }
.empty.small { padding: 18px; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; z-index: 50; background: rgba(4, 8, 18, 0.72); display: grid; place-items: center; padding: 16px; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; border-radius: var(--r-lg); background: var(--panel); border: 1px solid var(--line-strong); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5); }
.modal.wide { width: min(820px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 8px 22px; }
.modal-body { padding: 8px 22px 16px; overflow: auto; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); }
.modal-actions .btn.ghost.danger-text { margin-right: auto; }

/* Toast */
.toast-root { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { padding: 10px 16px; border-radius: 999px; background: var(--fg); color: var(--bg); font-weight: 700; font-size: 13px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); transition: opacity 0.3s, transform 0.3s; }
.toast-err { background: var(--danger); }
.toast.out { opacity: 0; transform: translateY(6px); }

/* Velger (øvelser) */
.picker { display: flex; flex-direction: column; gap: 12px; }
.picker-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.picker-item { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-align: left; min-width: 0; }
.picker-item:hover { border-color: var(--accent); }
.picker-item.new { border-style: dashed; justify-content: center; min-height: 56px; }
.picker-thumb { width: 72px; flex-shrink: 0; border-radius: 6px; overflow: hidden; aspect-ratio: 1.45; }
.picker-thumb svg { width: 100%; height: 100%; display: block; }
.picker-text { display: flex; flex-direction: column; min-width: 0; font-size: 13px; }
.picker-text strong { overflow: hidden; text-overflow: ellipsis; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
