/* ================================================================
   SPA Portal — Inter Terminals
   Industrielt kontrolrums-design: navy, terminalblå, papirhvide kort
   ================================================================ */

:root {
  --navy-900: #081c2e;
  --navy-800: #0a2438;
  --navy-700: #103450;
  --navy-600: #1a4569;
  --blue: #1467b3;          /* serie C — valideret */
  --amber: #b45309;         /* serie E — valideret */
  --brand: #29abe2;         /* inter terminals lyseblå */
  --bg: #edf1f5;
  --card: #ffffff;
  --ink: #14212e;
  --ink-2: #47586a;
  --ink-3: #7b8a99;
  --line: #d7dfe7;
  --line-2: #c3cedb;

  --ok: #15803d;
  --ok-bg: #e7f5ec;
  --warn: #b45309;
  --warn-bg: #fdf3e4;
  --hot: #c2570b;
  --hot-bg: #fdeede;
  --bad: #b91c1c;
  --bad-bg: #fdecec;
  --done: #1d4ed8;
  --done-bg: #e8eefc;
  --mute: #5b6b7c;
  --mute-bg: #eef1f5;

  --font-display: 'Archivo', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', Consolas, monospace;

  --r: 10px;
  --shadow: 0 1px 2px rgba(8, 28, 46, .06), 0 4px 14px rgba(8, 28, 46, .05);
  --shadow-lg: 0 8px 40px rgba(8, 28, 46, .22);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  font-size: 14.5px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

#app { display: flex; min-height: 100vh; }

/* ---------------- Sidebar ---------------- */
#sidebar {
  width: 232px;
  flex: 0 0 232px;
  /* Lys bjaelke, saa logoet staar i sine egne farver som paa blanketten */
  background: #ffffff;
  border-right: 1px solid var(--line);
  color: var(--ink-2);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
}
/* Virksomhedens officielle logomærke (udtrukket af logo-officielt.png) */
.logo-mark {
  width: 30px; height: 30px; flex: 0 0 30px;
  background: url('/ikoner/logo-maerke.png') center / contain no-repeat;
}
.logo-word { line-height: 1.1; }
.logo-word b { font-family: var(--font-display); font-weight: 700; font-size: 16px; color: #231f20; letter-spacing: -.01em; }
.logo-word b span { color: #0b6cb5; }
.logo-word small { display: block; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: #64748b; margin-top: 2px; }

.nav { padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  color: var(--ink-2);
  text-decoration: none;
  padding: 9px 12px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 13.5px;
  border-left: 3px solid transparent;
}
.nav a svg { width: 17px; height: 17px; flex: 0 0 17px; opacity: .8; }
.nav a:hover { background: #f2f6fa; color: var(--ink); }
.nav a.active {
  background: #eaf3fb;
  color: #0b6cb5;
  font-weight: 600;
  border-left-color: #0b6cb5;
}
.nav a.active svg { opacity: 1; }
.nav .new-btn {
  margin: 12px 12px 4px;
  background: #0b6cb5;
  color: #fff;
  font-weight: 700;
  justify-content: center;
  border-radius: 8px;
  padding: 10px;
  border-left: none;
  font-family: var(--font-display);
  letter-spacing: .01em;
}
.nav .new-btn:hover { background: #0d7cd0; color: #fff; }

.sidebar-foot {
  margin-top: auto;
  padding: 14px 18px;
  font-size: 11px;
  color: #64748b;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  line-height: 1.6;
}

/* ---------------- Main / topbar ---------------- */
#main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  background: rgba(237,241,245,.85);
  backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 40;
  border-bottom: 1px solid var(--line);
}
#crumb { font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
/* Forsidens "Overblik": samme formatering som sideoverskrifterne (fx "SPA-forløbet") */
#crumb.crumb-stor { font-size: 24px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); }
#crumb .kicker { display: block; font-size: 10.5px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); font-family: var(--font-body); }

#userbox { display: flex; align-items: center; gap: 10px; }
#me-name { font-size: 13.5px; font-weight: 600; color: var(--ink); }
#logout { font-size: 12.5px; color: var(--ink-3); text-decoration: none; border-left: 1px solid var(--line-2); padding-left: 10px; }
#logout:hover { color: var(--ink); text-decoration: underline; }
/* Brugeradministration: søgning og redigér-knap pr. bruger */
#user-soeg { width: 100%; margin-bottom: 8px; }
.user-row .ny-bruger { font-size: 10.5px; color: var(--ink-3); margin-left: 6px; }
.role-badge {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 600;
  background: var(--navy-800); color: #9fd9f5;
  border-radius: 5px; padding: 3px 7px; letter-spacing: .06em;
}

#view { padding: 24px 28px 60px; max-width: 1600px; width: 100%; margin: 0 auto; }

/* ---------------- Fælles komponenter ---------------- */
.h-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 4px 0 16px; }
h1 { font-family: var(--font-display); font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
h2 { font-family: var(--font-display); font-size: 16px; font-weight: 700; letter-spacing: -.01em; margin: 0 0 12px; }
.kicker { font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-body); font-size: 13.5px; font-weight: 600;
  padding: 9px 16px; border-radius: 8px; border: 1px solid transparent;
  cursor: pointer; text-decoration: none; color: var(--ink);
  background: #fff; border-color: var(--line-2);
  transition: background .12s, transform .05s;
  white-space: nowrap;
}
.btn:hover { background: #f2f6fa; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--navy-800); color: #fff; border-color: var(--navy-800); }
.btn.primary:hover { background: var(--navy-600); }
.btn.accent { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn.accent:hover { background: #1878cf; }
.btn.good { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn.good:hover { background: #17934a; }
.btn.danger { background: #fff; color: var(--bad); border-color: #e5b6b6; }
.btn.danger:hover { background: var(--bad-bg); }
.btn.sm { padding: 6px 11px; font-size: 12.5px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600;
  padding: 3.5px 10px 3.5px 8px; border-radius: 999px;
  white-space: nowrap;
}
.chip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.draft { background: var(--mute-bg); color: var(--mute); }
.chip.pending_analyst { background: #f0eafc; color: #6d28d9; }
.chip.pending_fd { background: var(--warn-bg); color: var(--warn); }
.chip.pending_md { background: var(--hot-bg); color: var(--hot); }
.chip.pending_tc { background: var(--hot-bg); color: var(--hot); }
.chip.completion_md { background: #e6f0fb; color: #1d4ed8; }
.chip.completion_fd { background: #dfeafb; color: #1e40af; }
.chip.approved { background: var(--ok-bg); color: var(--ok); }
.chip.completed { background: var(--done-bg); color: var(--done); }
.chip.rejected { background: var(--bad-bg); color: var(--bad); }
.chip.cancelled { background: var(--mute-bg); color: var(--ink-3); text-decoration: line-through; }
.chip.imported { background: #eef3f8; color: var(--navy-600); }

.mono { font-family: var(--font-mono); }
.spa-no { font-family: var(--font-mono); font-weight: 600; letter-spacing: .02em; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }

/* ---------------- Dashboard ---------------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); gap: 14px; margin-bottom: 18px; }
@media (max-width: 700px) { .kpi-grid { grid-template-columns: 1fr; } }
.kpi {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 16px 18px 14px;
  position: relative;
  overflow: hidden;
}
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--kpi-accent, var(--blue)); }
.kpi .kicker { margin-bottom: 8px; display: block; }
.kpi .val { font-family: var(--font-mono); font-size: 27px; font-weight: 600; letter-spacing: -.02em; line-height: 1; }
.kpi .val small { font-size: 14px; color: var(--ink-3); font-weight: 500; }
.kpi .sub { font-size: 12px; color: var(--ink-2); margin-top: 7px; }
.kpi.clickable { cursor: pointer; }
.kpi.clickable:hover { border-color: var(--line-2); background: #fbfdff; }

/* Terminal-siden: to lige brede kolonner, hvor kortene også står lige høje */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: stretch; }
.dash-grid .dash-col > .card:last-child { flex: 1; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } }
.dash-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.action-list { display: flex; flex-direction: column; }
.action-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 4px; border-bottom: 1px solid var(--line);
  text-decoration: none; color: inherit;
}
.action-item:last-child { border-bottom: none; }
.action-item:hover { background: #f7fafc; }
.action-item .t { flex: 1; min-width: 0; }
.action-item .spa-no { flex: 0 0 8.5ch; }   /* fast bredde, så titlerne står lige under hinanden (9C2026 / 12C2026) */
.action-item .t b { display: block; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.action-item .t span { font-size: 12px; color: var(--ink-3); }

.feed-item { display: flex; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 12.5px; align-items: baseline; }
.feed-item:last-child { border-bottom: none; }
.feed-item .ts { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); flex: 0 0 78px; }

/* Terminalkort med projektliste */
.term-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.term-card { padding: 14px 16px 10px; display: flex; flex-direction: column; }
.term-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.term-head h2 { margin: 0; font-size: 19px; letter-spacing: .01em; }
.term-count { font-family: var(--font-mono); font-size: 11.5px; font-weight: 600; color: var(--navy-600); background: #eef3f8; border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.term-list { max-height: 305px; overflow-y: auto; }
.proj-row { display: flex; align-items: center; gap: 8px; padding: 5.5px 2px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; font-size: 12.5px; }
.proj-row:last-child { border-bottom: none; }
.proj-row:hover { background: #f4f8fb; }
.proj-row .pr-no { font-family: var(--font-mono); font-size: 11px; color: var(--ink-2); flex: 0 0 56px; }
.proj-row .pr-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.term-empty { color: var(--ink-3); font-size: 12.5px; padding: 14px 2px; }
.term-foot { display: flex; justify-content: space-between; gap: 10px; font-size: 11.5px; color: var(--ink-3); margin-top: 8px; padding-top: 7px; border-top: 1px dashed var(--line); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; display: inline-block; }
.dot.d-pending_analyst { background: #7c3aed; }
.dot.d-pending_fd { background: var(--warn); }
.dot.d-completion_md { background: #1d4ed8; }
.dot.d-completion_fd { background: #1e40af; }
.dot.d-pending_md { background: var(--hot); }
.dot.d-pending_tc { background: var(--hot); }
.dot.d-draft { background: var(--mute); }
.dot.d-approved { background: var(--ok); }
.dot.d-completed { background: var(--done); }
.dot.d-imported { background: #8aa0b5; }
.dot.d-rejected { background: var(--bad); }
.dot.d-cancelled { background: var(--line-2); }
.dot-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 11.5px; color: var(--ink-2); padding: 2px 4px; }
.dot-legend .dot { margin-right: 5px; vertical-align: 0; }

/* ---------------- Register / tabel ---------------- */
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filter-row input[type=search], .filter-row select, .field input, .field select, .field textarea {
  font-family: var(--font-body); font-size: 13.5px;
  padding: 8px 11px; border-radius: 8px; border: 1px solid var(--line-2);
  background: #fff; color: var(--ink);
}
.filter-row input[type=search] { min-width: 240px; flex: 1; max-width: 340px; }
.filter-row select { font-weight: 600; }
/* Årsvælgeren i Overblik — samme udtryk som registrets filtre, blot lidt mere kompakt */
#aar-vaelg {
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
  padding: 5px 9px; border-radius: 8px; border: 1px solid var(--line-2);
  background: #fff; color: var(--ink); cursor: pointer;
}
#aar-vaelg:focus { outline: 2px solid rgba(20,103,179,.25); border-color: var(--blue); }
.filter-row .spacer { flex: 1; }

.tbl-card { padding: 0; overflow: hidden; }
.tbl-scroll { overflow: auto; max-height: calc(100vh - 265px); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600;
  padding: 11px 14px;
  background: #f7f9fb;
  box-shadow: inset 0 -1px 0 var(--line-2);
  position: sticky; top: 0; z-index: 5;
  white-space: nowrap;
}
table.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl tr.row { cursor: pointer; }
table.tbl tr.row:hover td { background: #f4f8fb; }
table.tbl td.num, table.tbl th.num { text-align: right; font-family: var(--font-mono); }
table.tbl .title-cell { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl-foot { display: flex; justify-content: space-between; align-items: center; padding: 11px 16px; font-size: 12.5px; color: var(--ink-2); background: #f7f9fb; }
.tbl-foot b { font-family: var(--font-mono); }

/* ---------------- Formular ---------------- */
.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field label .req { color: var(--bad); }
.field textarea { resize: vertical; min-height: 120px; line-height: 1.55; }
.field input:focus, .field select:focus, .field textarea:focus, .filter-row input:focus, .filter-row select:focus {
  outline: 2px solid rgba(20,103,179,.25); border-color: var(--blue);
}
.col-3 { grid-column: span 3; } .col-4 { grid-column: span 4; } .col-6 { grid-column: span 6; }
.col-8 { grid-column: span 8; } .col-12 { grid-column: span 12; }
@media (max-width: 900px) { .col-3, .col-4, .col-6, .col-8 { grid-column: span 12; } }

.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.seg button {
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
  border: none; background: #fff; color: var(--ink-2); padding: 8px 16px; cursor: pointer;
}
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button.on { background: var(--navy-800); color: #fff; }

.form-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

/* ---------------- Detaljevisning ---------------- */
.detail-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 1000px) { .detail-grid { grid-template-columns: 1fr; } }

.spec { display: grid; grid-template-columns: 170px 1fr; gap: 7px 14px; font-size: 13.5px; }
.spec dt { color: var(--ink-3); font-size: 12.5px; padding-top: 1px; }
.spec dd { margin: 0; font-weight: 500; }
.desc-box { white-space: pre-wrap; line-height: 1.6; font-size: 13.5px; background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin-top: 8px; }

.timeline { display: flex; flex-direction: column; gap: 0; margin: 4px 0; }
/* Prikkerne har samme form og størrelse som trafiklysene under "Evaluering" (.tl-lys).
   Hver tilstand har sit eget SYMBOL, så den kan aflæses uden at kunne se farver (farveblindhed):
   ✓ udført · ✕ mangler/retur · – ikke relevant · ● nuværende trin · ○ ikke nået */
.tl-step { display: flex; gap: 8px; position: relative; padding-bottom: 16px; }
.tl-step::before { content: ''; position: absolute; left: 7px; top: 19px; bottom: -1px; width: 2px; background: var(--line); }
.tl-step:last-child::before { display: none; }
.tl-dot, .tl-lys {
  width: 16px; height: 16px; border-radius: 50%; flex: 0 0 16px; margin-top: 1px; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 800; line-height: 1; color: #fff; font-family: var(--font-body);
  background: #fff; border: 2px solid #b4c1cf; box-sizing: border-box;
}
.tl-step.done .tl-dot { background: var(--ok); border-color: var(--ok); }
.tl-step.done .tl-dot::after { content: '✓'; }
.tl-step.now .tl-dot { background: var(--warn); border-color: var(--warn); box-shadow: 0 0 0 4px var(--warn-bg); }
.tl-step.now .tl-dot::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #fff; }
.tl-step.bad .tl-dot { background: var(--bad); border-color: var(--bad); }
.tl-step.bad .tl-dot::after { content: '✕'; }
.tl-step .b { font-size: 13px; }
.tl-step .b b { display: block; }
.tl-step .b .small { color: var(--ink-3); }
.sig-img { max-height: 46px; max-width: 190px; display: block; margin-top: 4px; }
/* Forhåndsvisning af brugerens egen, gemte underskrift (Indstillinger og underskriftsdialogen) */
.sig-saved-preview {
  min-height: 110px; display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--line-2); border-radius: 8px; background: #fff; padding: 12px;
}
.sig-saved-preview img { max-width: 100%; max-height: 120px; display: block; }

.audit { font-size: 12px; max-height: 260px; overflow-y: auto; }
.audit-row { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.audit-row .ts { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); flex: 0 0 118px; }

.file-line { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 4px 0; }
.file-line code { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-2); word-break: break-all; }

.reject-box { background: var(--bad-bg); border: 1px solid #efc9c9; color: #7f1d1d; border-radius: 8px; padding: 12px 14px; font-size: 13px; margin-bottom: 12px; }

/* ---------------- Modal ---------------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(8,28,46,.55);
  display: flex; align-items: center; justify-content: center; z-index: 200;
  backdrop-filter: blur(2px);
}
.modal {
  background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg);
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  padding: 22px 24px;
  animation: pop .16s ease-out;
}
@keyframes pop { from { transform: scale(.96) translateY(6px); opacity: 0; } }
.modal h2 { margin-bottom: 4px; }
.modal .sub { font-size: 13px; color: var(--ink-2); margin-bottom: 14px; }

.sig-tabs { display: flex; gap: 0; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; margin-bottom: 12px; width: max-content; }
.sig-tabs button { border: none; background: #fff; padding: 8px 18px; font-weight: 600; font-size: 13px; cursor: pointer; color: var(--ink-2); }
.sig-tabs button.on { background: var(--navy-800); color: #fff; }
#sig-canvas {
  border: 1.5px dashed var(--line-2); border-radius: 10px;
  width: 100%; height: 170px; touch-action: none; cursor: crosshair;
  background: repeating-linear-gradient(0deg, transparent 0 128px, #eef2f6 128px 129px, transparent 129px);
}
.sig-typed-preview {
  font-family: 'Segoe Script', 'Brush Script MT', cursive;
  font-size: 34px; min-height: 64px; display: flex; align-items: center;
  border-bottom: 2px solid var(--ink); padding: 8px 4px; color: var(--navy-800);
}
.check-row { display: flex; gap: 9px; align-items: flex-start; font-size: 12.5px; color: var(--ink-2); margin: 14px 0; }
.check-row input { margin-top: 2px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* ---------------- Toast ---------------- */
#toast-root { position: fixed; bottom: 22px; right: 22px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--navy-900); color: #eaf3fa; font-size: 13.5px; font-weight: 500;
  border-radius: 10px; padding: 12px 18px; box-shadow: var(--shadow-lg);
  animation: slidein .2s ease-out;
  max-width: 380px;
}
.toast.err { background: #7f1d1d; }
@keyframes slidein { from { transform: translateX(24px); opacity: 0; } }

/* ---------------- Print-blanket ---------------- */
.sheet-toolbar { display: flex; gap: 10px; margin-bottom: 16px; }
.print-sheet {
  background: #fff; width: 794px; margin: 0 auto; padding: 46px 56px;
  border: 1px solid var(--line); box-shadow: var(--shadow);
  font-family: Arial, 'Helvetica Neue', sans-serif; font-size: 12.5px; color: #000;
}
.ps-head { display: flex; justify-content: flex-end; margin-bottom: 8px; }
/* Tekst-ordmærke i det officielle logos farver: kraftig blå "inter", mørk "terminals" */
.ps-logo { display: flex; align-items: baseline; gap: 5px; font-size: 22px; font-weight: 700; font-family: var(--font-display); letter-spacing: -.02em; }
.ps-logo .in { color: #0b6cb5; }
.ps-logo .te { color: #231f20; font-weight: 400; }
.ps-title { font-size: 17px; font-weight: 700; margin: 6px 0 14px; }
.ps-row { display: flex; align-items: center; gap: 8px; margin: 7px 0; }
.ps-row .lbl { width: 90px; font-weight: 600; }
.ps-blue { color: #1467b3; font-weight: 700; }
/* Uddybning af udbuds-spørgsmålet: i formularen (redigérbar) og på den færdige blanket */
.udbud-uddyb { margin: 2px 0 6px; padding: 8px 10px; border: 1px dashed #b9cfe4; border-radius: 6px; background: #f7fbff; }
.udbud-omfang { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; font-size: 13px; }
.pbf .udbud-uddyb textarea.val-in { min-height: 60px; }
.udbud-vis { font-size: 12.5px; padding: 4px 0 2px; line-height: 1.5; }
.udbud-vis .ps-blue { white-space: pre-wrap; }   /* linjeskift i udbudsteksten skal vises, som de er skrevet */
/* Boks til overskridelsesforklaringen i Project Completion Section */
.ps-forkl { border: 1px solid #000; min-height: 44px; padding: 4px 8px; margin-top: 3px; }
/* Underskrifterne rykkes sammen i completion-afsnittet, så forklaringen får mere plads */
.ps-comp .ps-sig-row { margin: 8px 0 2px; }
.pbf-andres .ps-forkl { border-color: #b9c8d6; }
.ps-box { border: 1px solid #000; padding: 4px 12px; font-weight: 700; color: #1467b3; text-align: center; min-width: 46px; display: inline-block; }
/* En tom boks (fx SPA-nr før tildeling) skal have samme højde som de udfyldte */
.ps-box:empty::before { content: '\00a0'; }
.ps-budget-box { border: 1px solid #000; padding: 5px 16px; font-weight: 700; color: #1467b3; min-width: 130px; text-align: center; }
/* På den færdige blanket (visning og print) vises budgettet uden ramme —
   SPA-nr beholder sin ramme, og i Ny SPA-formularen (.pbf) beholdes alle rammer */
.print-sheet:not(.pbf) .ps-budget-box { border-color: transparent; padding-left: 0; padding-right: 0; min-width: 0; text-align: left; }
.ps-sec { font-size: 14.5px; font-weight: 700; margin: 14px 0 5px; }
.ps-desc { border: 1px solid #000; padding: 10px 12px; min-height: 130px; }
.ps-desc .t { color: #1467b3; font-weight: 700; margin-bottom: 4px; }
.ps-desc .d { color: #1467b3; white-space: pre-wrap; line-height: 1.45; font-size: 12px; }
.ps-moc { border: 1px solid #000; padding: 8px 14px; }
/* Faste kolonner som på papirblanketten: afkrydsning ved 69 % og 82 % */
.ps-moc-row { display: flex; align-items: center; padding: 5.5px 0; }
.ps-moc-row .q { flex: 0 0 69%; }
.ps-moc-row .cb { flex: 0 0 13%; }

/* To lige kolonner — højre kolonne begynder altid samme sted */
.ps-meta { display: grid; grid-template-columns: 52% 48%; margin: 12px 0 4px; row-gap: 8px; }

/* Underskriftslinje: navn 30 %, signatur 28 %, "Date" og datolinje 28 % */
.ps-sig-row { display: flex; align-items: flex-end; margin: 15px 0 4px; }
.ps-sig-row .lbl { flex: 0 0 30%; }
.ps-sig-row .dato-lbl { flex: 0 0 7%; font-weight: 400; }
.ps-sig-line { flex: 0 0 28%; border-bottom: 1px solid #000; min-height: 38px; display: flex; align-items: flex-end; justify-content: center; position: relative; }
.ps-sig-line img { max-height: 40px; max-width: 100%; }
.ps-sig-line .typed { font-family: 'Segoe Script', cursive; font-size: 21px; color: #1a3a63; padding-bottom: 2px; }
.ps-date { flex: 0 0 28%; border-bottom: 1px solid #000; text-align: center; font-family: 'Segoe Script', cursive; font-size: 15px; padding-bottom: 3px; min-height: 20px; }
.ps-date .plain { font-family: Arial; font-size: 12.5px; }
.ps-comp { border: 1.5px solid #000; margin-top: 18px; padding: 12px 16px; }
.ps-comp h3 { text-align: center; font-size: 15px; margin: 2px 0 12px; }
.ps-foot { font-size: 10.5px; margin-top: 10px; }
.ps-digital {
  margin-top: 14px; padding: 9px 12px; background: #f2f7fb; border: 1px solid #c9dcea;
  font-size: 10px; color: #2c4a61; border-radius: 4px; line-height: 1.6;
}
.ps-digital b { font-size: 10.5px; }

/* ---------------- Blanket-formular (Ny SPA ligner papirblanketten) ---------------- */
.pbf .val-in {
  font-family: Arial, 'Helvetica Neue', sans-serif; font-weight: 700; color: #1467b3;
  border: none; background: transparent; border-bottom: 1.5px dashed #b9cfe4;
  padding: 2px 4px; font-size: 13px; outline: none; border-radius: 0;
}
.pbf .val-in:focus { border-bottom: 1.5px solid #1467b3; background: #f2f8fd; }
.pbf .val-in::placeholder { color: #9db8d2; font-weight: 400; font-style: italic; }
.pbf select.val-in { appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%231467b3' stroke-width='1.6' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 4px center; }
.pbf textarea.val-in { width: 100%; resize: vertical; min-height: 110px; line-height: 1.5;
  font-weight: 400; font-size: 12.5px; border-bottom: none; }
.pbf textarea.val-in:focus { border-bottom: none; }
.pbf .ps-desc { padding: 8px 10px; }
.pbf-title-in { width: 100%; font-size: 14px; margin-bottom: 2px; }
.pbf-check { cursor: pointer; user-select: none; border-radius: 4px; padding: 2px 6px 2px 4px; }
.pbf-check:hover { background: #eaf3fb; }
.pbf-check b { font-weight: 400; font-size: 15px; vertical-align: -1px; }
.pbf-box-in { border: none; width: 52px; text-align: center; font: inherit; color: inherit; background: transparent; outline: none; padding: 0; }
.pbf-box-in:focus { background: #f2f8fd; }
.pbf-type-box { cursor: pointer; user-select: none; position: relative; }
.pbf-type-box:hover { background: #eaf3fb; }
.pbf-hint { font-size: 10px; color: #8aa0b5; font-family: var(--font-body); margin-top: 3px; }
/* Områder en anden rolle udfylder: tydeligt markeret, men indholdet forbliver læsbart */
.pbf-andres {
  position: relative;
  background: #f4f7fa;
  border: 1px dashed #c2d0dd;
  border-radius: 8px;
  padding: 8px 14px 12px;
  margin: 16px 0;
}
.pbf-andres-mrk {
  font-family: var(--font-body);
  font-size: 10px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: #52667a;
  display: flex; align-items: center; gap: 6px;
  margin: 0 0 8px; padding-bottom: 6px;
  border-bottom: 1px solid #dde6ee;
}
.pbf-andres-mrk::before { content: '🔒'; font-size: 10px; filter: grayscale(1); opacity: .7; }
.pbf-andres .ps-moc { border-color: #b9c8d6; }
/* YES/NO i FD-boksen skal flugte lodret med rubrikkerne ovenfor.
   Boksens indrykning (14px polstring + 1px kant i hver side) kompenseres:
   69 % / 13 % af den smallere boks + forskellen, så kolonnerne starter samme sted. */
.pbf-andres .ps-moc-row .q { flex-basis: calc(69% + 5.7px); }
.pbf-andres .ps-moc-row .cb { flex-basis: calc(13% + 3.9px); }
.pbf-andres .ps-comp { border-color: #b9c8d6; margin-top: 0; }
.pbf-andres .ps-sig-line, .pbf-andres .ps-date { border-bottom-color: #b9c8d6; }
.pbf-andres .ps-moc, .pbf-andres .ps-comp, .pbf-andres .ps-sig-row { color: #5a6b7c; }
.pbf-andres input, .pbf-andres .cb { pointer-events: none; }
.pbf-static { font-family: Arial, sans-serif; font-weight: 700; color: #1467b3; padding: 2px 4px; }
/* Felter en anden udfylder — samme visuelle sprog som .pbf-andres-blokkene */
.pbf-assign {
  background: #f4f7fa; border: 1px dashed #c2d0dd; color: #52667a;
  font-family: var(--font-body); font-size: 11px; font-weight: 600;
  letter-spacing: .03em;
  padding: 3px 9px; border-radius: 5px; white-space: nowrap;
}
.pbf-assign::before { content: '🔒 '; font-size: 9px; filter: grayscale(1); opacity: .7; }
.pbf-assign-box {
  background: #f4f7fa; color: #5f7488 !important;
  border-color: #c2d0dd !important; border-style: dashed !important;
}

/* Dansk felthjælp: hold musen over et felt med ⓘ */
#help-tip {
  position: fixed; z-index: 400; display: none; pointer-events: none;
  background: var(--navy-900); color: #eaf3fa; font-family: var(--font-body);
  font-size: 12.5px; line-height: 1.55; padding: 9px 12px; border-radius: 8px;
  max-width: 320px; box-shadow: var(--shadow-lg);
}
.pbf [data-help] { cursor: help; }
.pbf div[data-help]::after, .pbf span[data-help]::after {
  content: 'ⓘ'; color: #7fb2d9; font-size: 10.5px; margin-left: 6px;
  font-family: var(--font-body); font-weight: 400; font-style: normal;
}
.sheet-toolbar.sticky { position: sticky; top: 61px; z-index: 30; background: var(--bg); padding: 8px 0; margin: -8px 0 8px; }

@media print {
  body { background: #fff; }
  #sidebar, #topbar, .sheet-toolbar, #toast-root { display: none !important; }
  #view { padding: 0; max-width: none; }
  .print-sheet { border: none; box-shadow: none; width: auto; margin: 0; padding: 10mm 12mm; }
  /* Redigeringsblanketten printes som ren blanket: uden hjælpetekster og felt-markeringer */
  .pbf-hint, .pbf-andres-mrk, #help-tip { display: none !important; }
  .pbf-andres { background: none; border: none; padding: 0; margin: 14px 0; }
  /* uden boks-polstring på print skal kolonnerne ikke kompenseres */
  .pbf-andres .ps-moc-row .q { flex-basis: 69%; }
  .pbf-andres .ps-moc-row .cb { flex-basis: 13%; }
  .pbf-andres .ps-moc, .pbf-andres .ps-comp, .pbf-andres .ps-sig-row { color: #000; }
  .pbf-andres .ps-moc, .pbf-andres .ps-comp, .pbf-andres .ps-forkl { border-color: #000; }
  .pbf-andres .ps-sig-line, .pbf-andres .ps-date { border-bottom-color: #000; }
  .pbf div[data-help]::after, .pbf span[data-help]::after { content: none; }
  .pbf .val-in { border-bottom-color: transparent !important; background-image: none !important; }
  @page { size: A4; margin: 8mm; }
}

/* Trafiklys for dokumentation/overlevering under statuslinjen */
.tl-lys-sek { margin: 10px 0 2px; padding-top: 10px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
/* Samme typografi som kortoverskriften "Status & handlinger" (h2) */
.tl-lys-titel { font-family: var(--font-display); font-size: 16px; font-weight: 700; letter-spacing: -.01em; margin: 0 0 6px; display: flex; align-items: center; gap: 8px; }
.tl-lys-titel .tl-lys { margin-top: 0; }
/* Punkterne følger statuslinjens trin: fed titel på egen linje, grå infolinje under */
.tl-lys-row { display: flex; align-items: flex-start; gap: 8px; }
.tl-lys-row .b { font-size: 13px; }
.tl-lys-row .b b { display: block; }
.tl-lys-row .b .small { color: var(--ink-3); }
.tl-lys.groen { background: var(--ok); border-color: var(--ok); }
.tl-lys.groen::after { content: '✓'; }
.tl-lys.gul { background: #eab308; border-color: #eab308; color: #422006; }
.tl-lys.gul::after { content: '–'; font-size: 13px; }
.tl-lys.roed { background: var(--bad); border-color: var(--bad); }
.tl-lys.roed::after { content: '✕'; }
/* .tl-lys.graa: tom ring (grundstilen ovenfor) = afventer / ikke nået endnu */

/* ---------------- Indstillinger ---------------- */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 1000px) { .settings-grid { grid-template-columns: 1fr; } }
.user-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.user-row:last-child { border-bottom: none; }
.user-row .init { font-family: var(--font-mono); font-weight: 600; background: var(--mute-bg); border-radius: 6px; padding: 3px 8px; font-size: 11.5px; flex: 0 0 auto; }
.user-row .nm { flex: 1; min-width: 0; }
.user-row .nm small { display: block; color: var(--ink-3); }
.user-row.inactive { opacity: .45; }

.import-result { font-family: var(--font-mono); font-size: 12.5px; background: var(--navy-900); color: #9fd9f5; border-radius: 8px; padding: 14px 16px; margin-top: 12px; line-height: 1.7; }

.empty {
  text-align: center; color: var(--ink-3); padding: 40px 20px; font-size: 13.5px;
}
.empty b { display: block; font-family: var(--font-display); font-size: 15px; color: var(--ink-2); margin-bottom: 4px; }

/* ---------------- Bilag ---------------- */
.bilag-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 4px; border-bottom: 1px solid var(--line);
}
.bilag-row:last-child { border-bottom: none; }
.bilag-row:hover { background: #f7fafc; }
.bilag-icon { font-size: 17px; flex: 0 0 auto; line-height: 1; }
.bilag-name {
  flex: 1; min-width: 0; font-size: 13.5px; font-weight: 500; color: var(--ink);
  text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bilag-name:hover { color: var(--blue); text-decoration: underline; }
.bilag-hent { color: var(--ink-3); font-size: 12px; margin-left: 2px; }   /* ⬇ = filen hentes ned i stedet for at blive vist */
.bilag-meta { font-size: 11.5px; color: var(--ink-3); font-family: var(--font-mono); white-space: nowrap; flex: 0 0 auto; }

.drop-zone {
  margin-top: 12px; padding: 18px 14px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--line-2); border-radius: 10px; background: #fafcfe;
  display: flex; flex-direction: column; gap: 3px;
  font-size: 13px; color: var(--ink-2); transition: background .12s, border-color .12s;
}
.drop-zone:hover, .drop-zone:focus-visible { border-color: var(--blue); background: #f1f7fc; outline: none; }
.drop-zone.over { border-color: var(--blue); border-style: solid; background: #e8f2fb; }
.drop-zone b { font-weight: 600; color: var(--ink); }

/* Bilag i "Ny SPA"-blanketten (kø før SPA'en er oprettet) */
.pbf-bilag { border: 1px solid var(--line); border-radius: 8px; padding: 4px 12px; margin-top: 4px; background: #fff; }
.pbf-bilag .bilag-row { font-family: var(--font-body); }

@media print { .drop-zone, #bilag-progress, [data-del-bilag] { display: none !important; } }

/* ---------------- Dokumentationsspørgsmål ---------------- */
.dok-q {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.dok-q:last-of-type { border-bottom: none; }
.dok-tekst { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.5; }
.dok-tekst b { display: block; margin-bottom: 3px; }
.dok-tekst .small { display: block; }
.dok-link {
  display: inline-block; margin-top: 4px; color: var(--blue);
  font-weight: 600; text-decoration: none; font-size: 11.5px;
}
.dok-link:hover { text-decoration: underline; }
.spec .dok-link { margin-left: 6px; }

/* ---------------- Blanketten indlejret på sagsvisningen ---------------- */
.sheet-embedded {
  width: 100%;
  max-width: 794px;
  padding: 34px 38px;
  border-radius: var(--r);
  box-shadow: var(--shadow);
}
/* Skalér skriften en anelse ned, så blanketten er læsbar i den smallere spalte */
@media (max-width: 1100px) {
  .sheet-embedded { padding: 26px 24px; font-size: 11.5px; }
  .sheet-embedded .ps-title { font-size: 15px; }
}

/* Kort der afventer eller mangler handling */
.kort-aabent { border-left: 3px solid var(--warn); }
.kort-advarsel { border-left: 3px solid var(--bad); }
#dokbek-kort h2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dok-celle { text-align: center; font-size: 14px; }

/* ---------------- Startside: flowdiagram ---------------- */
.flow-kort { overflow-x: auto; }
.flow-svg { width: 100%; min-width: 1000px; height: auto; display: block; }
.flow-svg .fl-fase {
  font-family: var(--font-body); font-size: 10px; font-weight: 700;
  letter-spacing: .16em; fill: #ffffff;
}
.flow-svg .fl-nr { font-family: var(--font-mono); font-size: 12px; font-weight: 600; }
.flow-svg .fl-titel { font-family: var(--font-display); font-size: 14px; font-weight: 700; fill: var(--ink); letter-spacing: -.01em; }
.flow-svg .fl-hvem { font-family: var(--font-body); font-size: 11.5px; fill: var(--ink-3); }
.flow-svg .fl-tal { font-family: var(--font-mono); font-size: 21px; font-weight: 600; letter-spacing: -.03em; }
.flow-svg .fl-enhed { font-family: var(--font-body); font-size: 11px; fill: var(--ink-3); }
.flow-svg .flow-node { cursor: pointer; }
.flow-svg .fl-seg { transition: fill-opacity .12s, stroke-width .12s; }
.flow-svg .flow-node:hover .fl-seg,
.flow-svg .flow-node:focus-visible .fl-seg { fill-opacity: .18; stroke-width: 2.2; }
.flow-svg .flow-node:not(.aktiv):hover .fl-seg { fill: #f2f6fa; fill-opacity: 1; }
.flow-svg .flow-node:focus-visible { outline: none; }
.flow-svg .flow-node:not(.aktiv) .fl-titel { fill: #7e8b98; }

/* ---------------- Startside: vælg terminal ---------------- */
.term-vaelg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 14px; }
.term-vaelg {
  position: relative; display: flex; flex-direction: column; gap: 3px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow); padding: 18px 20px 16px;
  text-decoration: none; color: inherit;
  transition: transform .08s, border-color .12s, box-shadow .12s;
}
.term-vaelg:hover { border-color: var(--brand); box-shadow: 0 4px 18px rgba(8,28,46,.10); transform: translateY(-2px); }
.term-vaelg.alle { background: linear-gradient(160deg, var(--navy-800), var(--navy-900)); border-color: var(--navy-700); }
.term-vaelg.alle .term-navn { color: #fff; }
.term-vaelg.alle .term-under, .term-vaelg.alle .term-tal { color: #9fc0d9; }
.term-vaelg.alle .term-tal small { color: #7fa4c4; }
.term-navn { font-family: var(--font-display); font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.term-under { font-size: 12px; color: var(--ink-3); }
.term-tal { font-family: var(--font-mono); font-size: 19px; font-weight: 600; margin-top: 8px; color: var(--ink); }
.term-tal small { font-family: var(--font-body); font-size: 11.5px; font-weight: 400; color: var(--ink-3); }
.term-noeg { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.skift-term {
  font-family: var(--font-body); font-size: 12px; font-weight: 600;
  color: var(--blue); text-decoration: none; margin-left: 10px; vertical-align: 3px;
}
.skift-term:hover { text-decoration: underline; }

/* Tæller på "Overblik" i menuen — antal sager der afventer din handling */
.nav-tal {
  margin-left: auto; min-width: 20px; height: 19px; padding: 0 6px;
  border-radius: 10px; background: #dc2626; color: #fff;
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
}


/* Forsidens bjælke: få beskeder og tal på app-ikonet (vises kun, til det er sat op) */
.besked-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: #eef4fb; border: 1px solid #c9dcf0; border-radius: 10px; padding: 10px 14px; margin: 0 0 18px; font-size: 13.5px; }
.besked-banner-knapper { display: flex; gap: 8px; flex-wrap: wrap; }

/* Papirkurven: bjælke øverst på en slettet sag */
.slettet-bjaelke { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  background: #fdecec; border: 1px solid #f1c0c0; color: #7a1d1d; border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; }

/* "Sådan virker det": procesdiagrammet vist i appen */
.forloeb-ramme { display: block; width: 100%; min-height: 900px; border: 0; background: transparent; }
/* "Sådan virker det" og "Indstillinger" står nederst i menuen, lige over bundteksten */
.nav-bund { margin-top: auto; }
.nav-bund + .sidebar-foot { margin-top: 0; }

/* "Kræver andres handling": status-mærket med en diskret dato under — hvornår projektet kom til trinnet */
.chip-dato { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: 0 0 auto; }
.chip-dato small { font-size: 11px; font-style: italic; color: var(--ink-3); white-space: nowrap; }

/* Kontrol-dialogen: SPA-nr kan rettes (tal-felt + fast type og år) */
.am-nr { display: inline-flex; align-items: baseline; gap: 4px; }
.am-nr input { width: 4.5em; font-size: 20px; padding: 4px 8px; text-align: right; }
.am-nr > .spa-no { font-size: 20px; }

/* Vejledning, når Edge ikke giver lov til beskeder */
.bv-trin { margin: 10px 0 12px 18px; padding: 0; display: grid; gap: 8px; font-size: 13.5px; line-height: 1.45; }
.bv-trin code { font-size: 12px; background: #f1f5f9; padding: 1px 5px; border-radius: 4px; }

/* Tidligere afslutninger (når afslutningen er rettet) */
.tidl-afsl { padding: 10px 0; border-top: 1px solid var(--line); display: grid; gap: 3px; font-size: 13.5px; }
.tidl-afsl:first-of-type { border-top: 0; }

/* "Opret på vegne af" (kun Charlotte) — under værktøjslinjen i Ny SPA */
.paa-vegne { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 0 0 12px; padding: 10px 14px;
  background: #eef4fb; border: 1px solid #c9dcf0; border-radius: 10px; }
.paa-vegne label { font-weight: 600; font-size: 13.5px; }
.paa-vegne select { min-width: 260px; }
.paa-vegne .small { flex-basis: 100%; }
