@font-face {
  font-family: "Inter";
  src: url("Inter-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("Inter-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("Inter-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  --ink: #111;
  --muted: #444;
  --soft: #555;
  --line: #e2e2e2;
  --line-strong: #c8c8c8;
  --subtle: #f4f4f4;
  --accent: #c8102e;
  --accent-hover: #a50d26;
  --err: #8a0b1e;
  --err-bg: #f8eef0;
  --card-bg: #fff;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --max: 72rem;
  --radius: 10px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: #fff;
  color: var(--ink);
  font: 400 16px/1.45 var(--font);
  overflow-x: hidden;
  max-width: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

img, svg, table, pre { max-width: 100%; }
img { height: auto; }

a { color: var(--ink); }
a:hover { color: var(--accent-hover); }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
}
.skip:focus {
  left: 12px;
  top: 12px;
  z-index: 20;
  background: #fff;
  padding: 8px 12px;
  border: 2px solid var(--ink);
}

.site-header {
  border-bottom: 3px solid var(--accent);
  padding: 12px 16px;
  background: #fff;
}
.site-header-inner {
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.logo { display: block; width: 148px; height: auto; max-width: 60%; }
.header-meta {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: right;
  margin: 0;
}

main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 16px 16px 48px;
  overflow-x: hidden;
  width: 100%;
  flex: 1;
  min-width: 0;
}

h1 {
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 0.4em 0 0.25em;
  overflow-wrap: anywhere;
}
h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 0.5em;
}

.lead {
  color: var(--muted);
  margin: 0 0 1rem;
}

.privatliv {
  border-left: 4px solid var(--ink);
  background: var(--subtle);
  padding: 10px 12px;
  margin: 0 0 1rem;
  overflow-wrap: anywhere;
}

.periode, .note, .status {
  font-size: 0.9rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.status { margin: 0.6rem 0 0; }
.status[hidden] { display: none !important; }

.panel {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 0 0 1rem;
  min-width: 0;
}
.panel h2 { margin-top: 0; }

.btn {
  display: inline-block;
  font: 600 0.95rem/1.3 var(--font);
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--ink);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  min-height: 44px;
}
.btn:hover { background: var(--subtle); }
.btn-primary {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.btn-primary:hover { background: #000; color: #fff; }
.btn-text {
  border: 0;
  background: none;
  text-decoration: underline;
  padding: 8px 4px;
}
.btn:disabled { opacity: 0.6; cursor: default; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0.6em 0 0;
  align-items: center;
}

label, .field-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  min-width: 0;
}

input[type="text"],
input[type="time"],
input[type="number"],
select,
textarea {
  font: 400 16px/1.3 var(--font);
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  width: 100%;
  max-width: 100%;
  min-height: 44px;
}
textarea { min-height: 4.5rem; resize: vertical; }
input.bad { border-color: var(--err); background: var(--err-bg); }

input:focus, select:focus, button:focus-visible, a:focus-visible, textarea:focus {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 0 0 0.5rem;
}

.person {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin: 0 0 12px;
  min-width: 0;
  background: #fff;
}
.person-top {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 0 0 8px;
  align-items: end;
}
.person-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
}
.person-sum {
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  font-size: 0.95rem;
}
.person .fjern { justify-self: start; }

.dage {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.dag {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--subtle);
  min-width: 0;
}
.dag-navn {
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 8px;
  font-size: 0.95rem;
}
.dag-felter {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  min-width: 0;
}
.dag-felter .felt-bred { grid-column: 1 / -1; }
.dag-timer {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
  margin: 8px 0 0;
}

.sum-liste {
  list-style: none;
  margin: 0 0 0.5rem;
  padding: 0;
}
.sum-liste li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.sum-liste .navn { color: var(--muted); min-width: 0; }
.sum-liste .tal { font-weight: 600; text-align: right; white-space: nowrap; }
.sum-ialt {
  font-weight: 700;
  font-size: 1.15rem;
  margin: 0.4rem 0 0;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 16px;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  margin-top: auto;
}
.motto { font-weight: 600; color: var(--ink); margin: 0 0 6px; }

.print-only { display: none; }

@media (min-width: 640px) {
  h1 { font-size: 1.8rem; }
  .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fields .felt-bred { grid-column: 1 / -1; }
  .person-top { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
}

@media (min-width: 900px) {
  main { padding: 24px 24px 64px; }
}

@media (min-width: 700px) {
  .dage {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1100px) {
  .dage {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media print {
  @page {
    size: A4 landscape;
    margin: 10mm 12mm 12mm 12mm;
  }

  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  .skip, .no-print, .site-header, .site-footer, .actions, .btn,
  main, .lead, .privatliv { display: none !important; }

  html, body {
    background: #fff;
    overflow: visible;
    max-width: none;
    height: auto;
    display: block;
    font-size: 9pt;
    margin: 0;
    padding: 0;
  }

  .print-only { display: block !important; }

  #print-ark {
    display: block !important;
    width: 100%;
    color: #111;
  }

  .print-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 3px solid #c8102e;
    padding: 0 0 8px;
    margin: 0 0 8px;
  }
  .print-logo {
    width: 44mm;
    height: auto;
    display: block;
  }
  .print-meta { text-align: right; }
  .print-h {
    font-size: 16pt;
    font-weight: 700;
    margin: 0 0 2px;
  }
  .print-meta p { margin: 0; line-height: 1.35; }
  .print-tabel {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 8pt;
    margin: 0 0 6px;
  }
  .print-tabel th,
  .print-tabel td {
    border: 1px solid #c8c8c8;
    padding: 3px 4px;
    vertical-align: top;
    overflow-wrap: anywhere;
  }
  .print-tabel th {
    background: #f4f4f4;
    font-weight: 700;
    text-align: left;
  }
  .print-tabel .col-navn { width: 18%; }
  .print-tabel .col-timer { width: 7%; text-align: right; font-weight: 700; }
  .print-tabel tfoot td { font-weight: 700; background: #f4f4f4; }
  .print-tabel .celle-tid { font-weight: 600; }
  .print-tabel .celle-pause,
  .print-tabel .celle-note { color: #444; font-weight: 400; }
  .print-note { font-size: 7.5pt; color: #444; margin: 0 0 10mm; }
  .print-sign {
    display: flex;
    justify-content: space-between;
    gap: 16mm;
    margin: 4mm 0 8mm;
  }
  .sign-felt { width: 48%; }
  .sign-felt p { margin: 0; font-size: 8pt; }
  .sign-linje {
    border-bottom: 1px solid #111;
    height: 12mm;
    margin: 0 0 2px;
  }
  .sign-linje.kort {
    width: 45%;
    height: 8mm;
    margin-top: 5mm;
  }
  .print-fod {
    margin: 0;
    font-size: 8pt;
    font-weight: 600;
    border-top: 2px solid #c8102e;
    padding-top: 3mm;
  }
}

.vagter { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.vagt {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  min-width: 0;
}
.vagt-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin: 6px 0 0;
}
.vagt-timer {
  font-weight: 700;
  font-size: 0.9rem;
  margin: 0;
}
.dag-bund {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin: 8px 0 0;
  flex-wrap: wrap;
}
.dag-bund .dag-timer { margin: 0; }
.tilfoej-sag { flex: 0 0 auto; }
@media print {
  .print-tabel .celle-vagt { margin: 0 0 4pt; padding: 0 0 3pt; }
  .print-tabel .celle-vagt + .celle-vagt { border-top: 0.4pt solid #ccc; padding-top: 3pt; }
  .print-tabel .celle-sag { font-weight: 600; }
  .print-tabel .celle-vagt-timer { font-weight: 600; }
  .print-tabel .celle-dag-sum { margin-top: 3pt; font-weight: 700; }
}
