:root {
  color-scheme: light;
  --bg: #f4f6f3;
  --ink: #17201c;
  --muted: #64716b;
  --line: #d7ddd5;
  --panel: #ffffff;
  --accent: #0f6b5d;
  --accent-2: #315b91;
  --warn: #a45d16;
  --danger: #b33434;
  --ok: #1e7a42;
  --shadow: 0 16px 48px rgba(28, 39, 33, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.import-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  cursor: pointer;
}

button:hover,
.import-button:hover {
  border-color: #9eb0a8;
}

.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.topbar {
  min-height: 190px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 34px clamp(18px, 5vw, 64px);
  background:
    linear-gradient(90deg, rgba(15, 37, 32, 0.9), rgba(15, 82, 72, 0.74)),
    url("https://images.unsplash.com/photo-1503387762-592deb58ef4e?auto=format&fit=crop&w=1800&q=80");
  background-position: center;
  background-size: cover;
  color: #fff;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4.3rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: inherit;
  opacity: 0.75;
  text-transform: uppercase;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.project-mark {
  display: grid;
  gap: 4px;
  text-align: right;
  font-size: 0.95rem;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: -28px auto 56px;
  display: grid;
  gap: 18px;
}

.panel,
.toolbar,
.register {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel,
.register {
  padding: 22px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

h2,
h3 {
  margin: 0;
}

.project-grid,
.entry-grid,
.toolbar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.drop-zone {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  min-height: 116px;
  margin-bottom: 14px;
  padding: 18px;
  border: 2px dashed #9eb0a8;
  border-radius: 8px;
  background: #f8fbf9;
  cursor: pointer;
}

.drop-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop-zone strong {
  display: block;
  color: var(--ink);
  font-size: 1.12rem;
}

.drop-zone p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.drop-zone button {
  pointer-events: none;
}

.drop-zone.is-dragging {
  border-color: var(--accent);
  background: #eaf5f1;
}

.bulk-queue {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.bulk-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.bulk-item img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #e9eee9;
}

.file-icon {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #edf3f0;
  color: var(--accent-2);
  font-weight: 800;
  font-size: 1.4rem;
}

.bulk-item p {
  margin: 0;
  padding: 9px 10px;
  color: var(--muted);
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.ai-actions span {
  color: var(--muted);
  font-size: 0.9rem;
}

.ai-actions .ai-status-success {
  color: var(--ok);
  font-weight: 700;
}

.ai-actions .ai-status-error {
  color: var(--danger);
  font-weight: 700;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--ink);
  padding: 11px 12px;
  min-height: 42px;
}

textarea {
  resize: vertical;
}

.wide {
  grid-column: span 2;
}

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.counter,
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 11px;
  font-size: 0.8rem;
  font-weight: 700;
  background: #edf3f0;
  color: var(--accent);
}

.toolbar {
  box-shadow: none;
  padding: 16px;
  align-items: end;
  grid-template-columns: 2fr 1fr repeat(4, auto);
}

.import-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 400;
}

.import-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.summary article {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.summary span {
  display: block;
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--accent-2);
}

.summary p {
  margin: 4px 0 0;
  color: var(--muted);
}

.report-panel {
  background: #e9eef3;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.report-output {
  counter-reset: report-page;
  display: grid;
  gap: 22px;
  color: #1f2a25;
}

.report-page {
  counter-increment: report-page;
  position: relative;
  width: min(100%, 794px);
  min-height: 1123px;
  margin: 0 auto;
  background: #fff;
  color: #102842;
  box-shadow: 0 12px 28px rgba(31, 45, 58, 0.14);
  overflow: hidden;
}

.report-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 56px;
  padding: 0 48px;
  background: #21557f;
  color: #fff;
  font-size: 0.95rem;
}

.report-page-header::after {
  content: "";
  position: absolute;
  top: 64px;
  left: 48px;
  right: 48px;
  height: 3px;
  background: #60a83b;
}

.report-page-body {
  padding: 34px 48px 90px;
}

.report-page-body h2 {
  margin: 0;
  color: #17304d;
  font-size: 1.85rem;
}

.report-page-body > p {
  margin: 8px 0 24px;
  color: #687386;
  line-height: 1.45;
}

.report-page-footer {
  position: absolute;
  left: 48px;
  right: 48px;
  bottom: 28px;
  display: flex;
  justify-content: space-between;
  color: #687386;
  font-size: 0.82rem;
}

.report-page-footer span:last-child::after {
  content: " " counter(report-page);
}

.report-cover {
  background: #eef2f6;
}

.report-cover-hero {
  display: flex;
  justify-content: space-between;
  min-height: 250px;
  padding: 70px 58px 42px;
  background: #21557f;
  color: #fff;
  border-bottom: 7px solid #60a83b;
}

.report-cover-hero h1 {
  margin: 0 0 10px;
  font-size: 2.9rem;
  line-height: 1.05;
}

.report-cover-hero h2 {
  margin: 0 0 22px;
  font-size: 1.85rem;
}

.report-cover-hero p {
  margin: 0 0 10px;
  font-size: 1.1rem;
}

.report-logo {
  align-self: flex-start;
  margin-top: 20px;
  padding-bottom: 10px;
  border-bottom: 6px solid #60a83b;
  font-size: 1.6rem;
}

.cover-image-frame {
  display: grid;
  place-items: center;
  margin: 115px 48px 90px;
  padding: 12px;
  min-height: 430px;
  background: #fff;
  border: 1px solid #cfd9e2;
  border-radius: 10px;
}

.cover-image-frame img {
  width: 100%;
  max-height: 390px;
  object-fit: contain;
}

.cover-facts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin: 0 58px;
}

.cover-fact {
  min-height: 58px;
  padding: 12px;
  background: #fff;
  border: 1px solid #cfd9e2;
  border-radius: 6px;
}

.cover-fact strong {
  display: block;
  margin-bottom: 6px;
  color: #21557f;
  font-size: 0.8rem;
}

.cover-fact span {
  font-size: 1rem;
}

.ks-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 28px;
  font-size: 0.95rem;
}

.ks-table th {
  padding: 16px 12px;
  background: #21557f;
  color: #fff;
  text-align: left;
}

.ks-table th:first-child {
  border-radius: 6px 0 0 6px;
}

.ks-table th:last-child {
  border-radius: 0 6px 6px 0;
}

.ks-table td {
  padding: 14px 12px;
  border-bottom: 1px solid #d8e1ea;
}

.ks-table tr:nth-child(even) td {
  background: #f5f8fb;
}

.ks-badge {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #5aa441;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
}

.ks-badge.issue {
  background: var(--danger);
}

.report-note {
  margin-top: 260px;
  padding: 20px;
  border: 1px solid #d4dde6;
  border-radius: 8px;
}

.report-note strong {
  display: block;
  margin-bottom: 10px;
  color: #21557f;
}

.report-note p {
  margin: 0;
  line-height: 1.45;
}

.signature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 110px;
  margin: 90px 20px 0;
  color: #687386;
  font-size: 0.82rem;
}

.signature-grid span {
  padding-top: 16px;
  border-top: 1px solid #cfd9e2;
}

.report-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 16px;
  margin: 26px 0;
  padding: 16px;
  background: #f8fbf9;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.report-meta dt {
  color: var(--muted);
  font-weight: 700;
}

.report-meta dd {
  margin: 0;
}

.reference-photo-card {
  margin-top: 26px;
  border: 1px solid #d4dde6;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.reference-photo-card img {
  display: block;
  width: calc(100% - 32px);
  height: 360px;
  margin: 34px auto 18px;
  object-fit: contain;
}

.reference-caption {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: 16px;
  align-items: center;
  min-height: 48px;
  padding: 0 16px;
  background: #f0f4f7;
}

.reference-caption strong {
  color: #21557f;
}

.reference-caption small {
  color: #687386;
}

.attachment-preview {
  display: grid;
  place-items: center;
  width: calc(100% - 32px);
  height: 360px;
  margin: 34px auto 18px;
  background: #eef4f0;
  color: #21557f;
  font-size: 3rem;
  font-weight: 800;
}

.entry-list {
  display: grid;
  gap: 14px;
}

.review-card {
  display: grid;
  grid-template-columns: minmax(180px, 300px) 1fr;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.review-media {
  display: grid;
  min-height: 210px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #eef3f0;
}

.review-media img {
  width: 100%;
  height: 100%;
  min-height: 210px;
  object-fit: cover;
}

.review-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-content: start;
}

.review-header {
  grid-column: 1 / -1;
  display: grid;
  gap: 3px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.review-header strong {
  color: var(--accent);
  text-transform: uppercase;
  font-size: 0.78rem;
}

.review-header span {
  color: var(--ink);
  font-weight: 700;
}

.review-header small {
  color: var(--muted);
}

.entry-card {
  display: grid;
  grid-template-columns: minmax(170px, 260px) 1fr;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.photo-strip {
  min-height: 190px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  background: #e9eee9;
}

.photo-strip img {
  width: 100%;
  height: 100%;
  min-height: 95px;
  object-fit: cover;
  border-right: 1px solid rgba(255, 255, 255, 0.75);
  border-bottom: 1px solid rgba(255, 255, 255, 0.75);
}

.photo-empty {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 190px;
  color: var(--muted);
  text-align: center;
  padding: 18px;
}

.entry-body {
  padding: 18px;
  display: grid;
  gap: 12px;
}

.entry-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.meta,
.checkpoint,
.notes {
  margin: 0;
}

.meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.checkpoint {
  font-weight: 700;
}

.notes {
  color: #38433e;
  white-space: pre-wrap;
}

.entry-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.status-godkendt {
  background: #e6f3eb;
  color: var(--ok);
}

.status-afventer {
  background: #fff2dc;
  color: var(--warn);
}

.status-afvigelse {
  background: #fde8e8;
  color: var(--danger);
}

.empty {
  margin: 0;
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  text-align: center;
  color: var(--muted);
  background: #fbfcfb;
}

@media (max-width: 860px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    justify-content: flex-end;
  }

  .project-mark {
    text-align: left;
  }

  .project-grid,
  .entry-grid,
  .toolbar,
  .summary {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: auto;
  }

  .toolbar {
    align-items: stretch;
  }

  .drop-zone {
    grid-template-columns: 1fr;
  }

  .entry-card {
    grid-template-columns: 1fr;
  }

  .review-card,
  .review-fields {
    grid-template-columns: 1fr;
  }

  .report-page {
    min-height: auto;
  }

  .report-page-header,
  .report-page-body,
  .report-cover-hero {
    padding-left: 20px;
    padding-right: 20px;
  }

  .cover-facts {
    grid-template-columns: 1fr;
    margin: 0 20px;
  }

  .cover-image-frame {
    margin: 40px 20px;
  }

  .reference-caption {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 10px 14px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .topbar {
    min-height: auto;
    color: #111;
    background: #fff;
    border-bottom: 2px solid #111;
  }

  .toolbar,
  .actions,
  .entry-actions,
  .icon-button,
  #seedDemo,
  .capture-panel,
  .register {
    display: none !important;
  }

  .shell {
    width: 100%;
    margin: 0;
  }

  .report-output {
    display: block;
  }

  .report-page {
    width: 210mm;
    min-height: 297mm;
    box-shadow: none;
    page-break-after: always;
  }

  .panel,
  .report-panel,
  .register,
  .summary article {
    box-shadow: none;
    break-inside: avoid;
  }

  .reference-photo-card,
  .summary article {
    break-inside: avoid;
  }
}
