/* Funktionsfordeling - clinical instrument. IBM Plex Sans (labels) + Plex Mono (data). */
@font-face { font-family: 'Plex Sans'; src: url('vendor/fonts/plex-sans-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Plex Sans'; src: url('vendor/fonts/plex-sans-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Plex Mono'; src: url('vendor/fonts/plex-mono-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Plex Mono'; src: url('vendor/fonts/plex-mono-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }

:root {
  --sans: 'Plex Sans', system-ui, -apple-system, sans-serif;
  --mono: 'Plex Mono', ui-monospace, "SF Mono", Menlo, monospace;
  --paper: #f8fafa;
  --surface: #ffffff;
  --surface-2: #eef3f3;
  --ink: #16242a;
  --muted: #5d6c71;
  --line: #dde6e6;
  --line-faint: #eef2f3;
  --accent: #246b63;          /* desaturated surgical petrol, used sparingly */
  --accent-ink: #ffffff;
  --tint-weekend: rgba(120,132,135,.10);
  --tint-holiday: rgba(36,107,99,.22);    /* helligdag - stronger so it reads vs the petrol-faint missing tint */
  --tint-missing: rgba(36,107,99,.055);   /* mangler data - faint petrol wash (was warm beige) */
  --missing-line: rgba(36,107,99,.24);
  --missing-ink: #2c6f67;
  --cell-ink: #16242a;
  --shadow: 0 1px 2px rgba(20,36,42,.05);
}
html[data-theme="dark"] {
  --paper: #0e1417;
  --surface: #141d20;
  --surface-2: #1a262a;
  --ink: #e2eaeb;
  --muted: #8a989c;
  --line: #233135;
  --line-faint: #1a242a;
  --accent: #57a79c;
  --accent-ink: #0c1416;
  --tint-weekend: rgba(150,162,165,.06);
  --tint-holiday: rgba(87,167,156,.26);   /* helligdag - stronger so it reads vs the faint teal missing tint */
  --tint-missing: rgba(87,167,156,.075);  /* mangler data - faint teal wash (was warm amber) */
  --missing-line: rgba(87,167,156,.30);
  --missing-ink: #84c4ba;
  --shadow: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { font: 14px/1.5 var(--sans); color: var(--ink); margin: 0; background: var(--paper); -webkit-font-smoothing: antialiased; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- app bar ---------- */
.appbar { display: flex; align-items: center; gap: 22px; padding: 0 20px; height: 56px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; }
.brand { font-family: var(--mono); font-weight: 600; font-size: 14.5px; letter-spacing: .005em; display: flex; align-items: center; }
.brand .mark { width: 10px; height: 10px; background: var(--accent); border-radius: 2px; margin-right: 10px; }

.tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; }
.tab { border: 0; background: transparent; color: var(--muted); padding: 6px 15px; border-radius: 6px; cursor: pointer; font: inherit; font-size: 13px; font-weight: 500; }
.tab:hover { color: var(--ink); }
.tab.active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); font-weight: 600; }

.actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.menu { position: relative; }
.btn-primary { display: inline-flex; align-items: center; gap: 6px; background: var(--accent); color: var(--accent-ink); border: 0; padding: 8px 13px; border-radius: 8px; cursor: pointer; font: inherit; font-size: 13.5px; font-weight: 600; }
.btn-primary:hover { filter: brightness(1.07); }
.btn-primary .plus { font-size: 16px; line-height: 1; }
.icon-btn { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; color: var(--ink); }
.icon-btn:hover { background: var(--surface-2); }
.dropdown { position: absolute; top: calc(100% + 6px); left: 0; min-width: 158px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 28px rgba(16,28,34,.16); padding: 6px; z-index: 50; }
.dropdown.right { left: auto; right: 0; }
.dropdown button { display: block; width: 100%; text-align: left; background: transparent; border: 0; padding: 9px 11px; border-radius: 7px; cursor: pointer; color: var(--ink); font: inherit; font-size: 14px; }
.dropdown button:hover { background: var(--surface-2); }

/* ---------- content ---------- */
.content { max-width: 1720px; margin: 0 auto; padding: 80px 40px 72px; }
.muted { color: var(--muted); }
.status { color: var(--muted); margin: 16px 0 0; min-height: 18px; font-size: 13px; }
.eyebrow { font-family: var(--mono); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }

/* ---------- calendar ---------- */
.cal-head { display: flex; align-items: center; gap: 12px; margin: 2px 0 16px; }
.cal-head strong { font-size: 18px; display: inline-block; width: 150px; text-align: center; }
.nav-btn { width: 34px; height: 34px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; cursor: pointer; font-size: 18px; line-height: 1; color: var(--ink); }
.nav-btn:hover { background: var(--surface-2); }
.coverage-text { font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: .01em; margin-left: 12px; }
.coverage-text b { color: var(--ink); font-weight: 500; }
.cov-dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-left: 6px; vertical-align: middle; }
.cal-legend { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.cal-legend > span { display: inline-flex; align-items: center; }
.swatch { width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--line); margin-right: 6px; }
.sw-missing { background: var(--tint-missing); border-color: var(--missing-line); }
.sw-holiday { background: var(--tint-holiday); }
.sw-weekend { background: var(--tint-weekend); }
.cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 6px; }
.cal-dow span { font-family: var(--mono); text-align: center; font-weight: 500; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.cal-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cell { min-height: 110px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: var(--surface); font-size: 11px; overflow: hidden; box-shadow: var(--shadow); }
.cal-cell.cal-empty { background: transparent; border: none; box-shadow: none; }
.cal-cell[data-date] { cursor: pointer; }
.cal-cell[data-date]:hover { border-color: var(--accent); }
.cal-date { font-family: var(--mono); font-weight: 500; font-size: 13px; }
.cal-cell.cal-weekend { background: var(--tint-weekend); box-shadow: none; }
.cal-cell.cal-holiday { background: var(--tint-holiday); box-shadow: none; }
.cal-cell.cal-missing { background: var(--tint-missing); border-color: var(--missing-line); box-shadow: none; }
.cal-note { margin-top: 4px; color: var(--muted); }
.cal-cell.cal-missing .cal-note { color: var(--missing-ink); font-weight: 500; }
.cal-assign { margin-top: 4px; font-family: var(--mono); }
.cal-assign div { line-height: 1.45; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-assign b { display: inline-block; min-width: 18px; color: var(--accent); font-weight: 500; }
.cal-file { margin-top: 5px; color: var(--muted); opacity: .75; font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- dækningsoversigt ---------- */
.sub { display: flex; align-items: center; gap: 18px; margin-bottom: 14px; flex-wrap: wrap; }
.period { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.pgroup { display: inline-flex; align-items: center; gap: 6px; }
.plabel { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.dateinput { font-family: var(--mono); font-size: 13px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); }
.per-title { font-size: 15px; min-width: 124px; text-align: center; font-weight: 600; }
.dash { color: var(--muted); }
.chip { font: inherit; font-size: 12px; padding: 6px 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); cursor: pointer; }
.chip:hover { background: var(--surface-2); }
.note { font-size: 12px; color: var(--muted); margin-left: 2px; }
.views { margin-left: auto; display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; }
.vbtn { border: 0; background: transparent; color: var(--muted); padding: 6px 13px; border-radius: 6px; cursor: pointer; font: inherit; font-size: 13px; }
.vbtn:hover { color: var(--ink); }
.vbtn.active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); font-weight: 600; }

.tableWrap { overflow-x: auto; }
table.dist { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); }
table.dist th, table.dist td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 7px 9px; text-align: center; }
table.dist thead th { background: var(--surface-2); }
table.dist th.corner { text-align: left; color: var(--muted); font-family: var(--mono); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; position: sticky; left: 0; z-index: 2; }
table.dist th.dochead { font-family: var(--mono); font-weight: 500; font-size: 12px; color: var(--ink); min-width: 54px; }
table.dist th.dochead .pct { font-weight: 400; }
table.dist th.rowh { text-align: left; background: var(--surface-2); font-family: var(--mono); font-weight: 500; color: var(--ink); position: sticky; left: 0; z-index: 1; white-space: nowrap; }
table.dist td { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--ink); min-width: 54px; }
table.dist td.hm { color: var(--cell-ink); }
.pct { color: var(--muted); font-size: 11px; }
table.dist td.hm .pct { color: rgba(22,36,42,.6); }
table.dist td.total, table.dist th.total { background: var(--surface-2); color: var(--muted); font-weight: 500; }
table.dist tr.totalrow th, table.dist tr.totalrow td { border-top: 2px solid var(--line); }

/* Axis emphasis. Pr. læge: read down doctor columns. Pr. stue: read across room rows. */
table.dist.emph-col td, table.dist.emph-col th { border-bottom-color: var(--line-faint); }
table.dist.emph-col tbody td:nth-child(2n):not(.hm):not(.total) { background: var(--surface-2); }
table.dist.emph-row td, table.dist.emph-row th { border-right-color: var(--line-faint); }
table.dist.emph-row tbody tr:nth-child(2n) td:not(.hm):not(.total) { background: var(--surface-2); }

.bottombar { display: flex; justify-content: space-between; align-items: baseline; gap: 24px; margin-top: 14px; }
.bottombar .coverage-text { white-space: nowrap; margin-left: 0; }
.legend { margin: 0; font-size: 12.5px; max-width: 880px; color: var(--muted); line-height: 1.6; }
.flags { margin-top: 22px; }
.flags h3 { margin-bottom: 6px; font-size: 14px; }
.flags ul { margin: 0; padding-left: 18px; color: var(--missing-ink); }

/* Pr. Læge: utilisation bars */
.laege-list { max-width: 760px; }
.laege-row { display: grid; grid-template-columns: 84px 1fr 168px; align-items: center; gap: 14px; padding: 5px 0; }
.laege-name { font-family: var(--mono); font-weight: 500; }
.laege-bar { height: 11px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.laege-fill { height: 100%; background: var(--accent); }
.laege-val { font-family: var(--mono); font-size: 13px; text-align: right; }

/* ---------- drop overlay ---------- */
.dropmask { position: fixed; inset: 0; background: rgba(36,107,99,.08); display: flex; align-items: center; justify-content: center; z-index: 80; }
.dropmask span { background: var(--surface); border: 2px dashed var(--accent); color: var(--accent); font-size: 19px; font-weight: 600; padding: 22px 34px; border-radius: 14px; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(10,18,22,.5); display: flex; align-items: center; justify-content: center; z-index: 90; }
.modal-box { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 22px; max-width: 720px; width: 92%; box-shadow: 0 24px 70px rgba(0,0,0,.4); }
.modal-box h2 { font-size: 17px; margin: 0 0 6px; }
.modal-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 14px 0; }
.modal-cols h3 { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.filename { font-family: var(--mono); font-weight: 500; margin-bottom: 6px; word-break: break-all; font-size: 12.5px; }
table.mini { border-collapse: collapse; width: 100%; font-size: 12.5px; font-family: var(--mono); }
table.mini td { border: 1px solid var(--line); padding: 3px 7px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.modal-actions button { padding: 8px 15px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; }
.modal-actions button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.modal-actions button.danger { background: #cf5a4e; color: #fff; border-color: #cf5a4e; }
#day-modal .modal-actions { justify-content: space-between; margin-top: 22px; }
.day-sec { margin-top: 12px; }
.day-sec > div { margin-top: 3px; font-family: var(--mono); }
.day-file { margin-top: 12px; color: var(--muted); font-family: var(--mono); font-size: 12px; word-break: break-all; }

/* ---------- login (split: text left, form right) ---------- */
.login-body { margin: 0; }
.login { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.login-hero { background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; padding: 48px 6vw; }
.login-hero-inner { max-width: 460px; }
.login-brand { font-family: var(--mono); font-weight: 600; font-size: 15px; color: var(--accent-ink); margin-bottom: 40px; }
.login-brand .mark { background: var(--accent-ink); opacity: .85; }
.login-headline { font-size: 30px; line-height: 1.18; font-weight: 600; letter-spacing: -.01em; margin: 0 0 16px; }
.login-sub { font-size: 15px; line-height: 1.6; opacity: .82; margin: 0; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 48px 6vw; background: var(--paper); }
.login-card { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 18px; }
.login-title { font-size: 20px; font-weight: 600; margin: 0 0 4px; }
.login-field { display: flex; flex-direction: column; gap: 7px; }
.login-field span { font-family: var(--mono); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.login-field input { font: inherit; font-size: 15px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); }
.login-field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.login-submit { justify-content: center; padding: 12px; font-size: 15px; margin-top: 6px; }
.login-error { color: #c0392b; font-size: 13px; margin: -4px 0 0; }
html[data-theme="dark"] .login-error { color: #f08a7e; }
@media (max-width: 760px) {
  .login { grid-template-columns: 1fr; min-height: 0; }
  .login-hero { padding: 40px 8vw; }
  .login-brand { margin-bottom: 22px; }
  .login-headline { font-size: 24px; }
  .login-panel { padding: 36px 8vw 56px; }
}
