/* Interfjord Portal – farver og typografi følger Interfjords designsystem. */
:root {
  --fjord-950: #050708;
  --fjord-900: #161A1D;
  --fjord-800: #2C2D31;
  --mist-300: #BCC4E0;
  --mist-100: #DFE4F7;
  --white: #FFFFFF;

  --surface: var(--white);
  --surface-raised: var(--mist-100);
  --surface-inverse: var(--fjord-900);
  --ink: var(--fjord-900);
  --ink-muted: var(--fjord-800);
  --ink-inverse: var(--white);
  --link: var(--fjord-900);
  --line: var(--mist-300);
  --border-control: var(--fjord-800);
  --focus: var(--fjord-900);
  --error-bg: #FBE9E9;
  --error-ink: #7A1616;

  --font-sans: "Sarabun", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius-sm: 4px;
  --sidebar-width: 248px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --surface: var(--fjord-900);
    --surface-raised: var(--fjord-800);
    --surface-inverse: var(--mist-100);
    --ink: var(--white);
    --ink-muted: var(--mist-300);
    --ink-inverse: var(--fjord-900);
    --link: var(--mist-300);
    --line: var(--fjord-800);
    --border-control: var(--mist-300);
    --focus: var(--mist-100);
    --error-bg: #3A1B1B;
    --error-ink: #F6CACA;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 26px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-weight: 600; margin: 0 0 16px; }
h1 { font-size: 32px; line-height: 40px; }
h2 { font-size: 24px; line-height: 32px; }
p { margin: 0 0 16px; }

a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.muted { color: var(--ink-muted); }
.small { font-size: 13px; line-height: 18px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* Knapper */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid var(--surface-inverse);
  border-radius: var(--radius-sm);
  background: var(--surface-inverse);
  color: var(--ink-inverse);
  font: inherit;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { opacity: 0.9; }
.btn[disabled] { opacity: 0.6; cursor: progress; }

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--border-control);
}

.link-button {
  background: none;
  border: 0;
  padding: 0;
  color: var(--link);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

/* Centrerede skærme: indlæsning, login, ingen adgang */
.center-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
}

.card {
  width: 100%;
  max-width: 440px;
  padding: 32px;
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
}

.wordmark {
  font-weight: 600;
  font-size: 24px;
  line-height: 32px;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
}

.wordmark-sub {
  margin: 0 0 32px;
  color: var(--ink-muted);
  font-size: 14px;
  line-height: 20px;
  letter-spacing: 0.02em;
}

.alert {
  padding: 12px 16px;
  margin: 0 0 16px;
  border-radius: var(--radius-sm);
  background: var(--error-bg);
  color: var(--error-ink);
}

/* Portal-layout */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: var(--fjord-900);
  color: var(--white);
  border-bottom: 1px solid var(--line);
}
.topbar .wordmark { font-size: 20px; line-height: 28px; margin: 0; color: var(--white); }
.topbar .wordmark a { color: inherit; text-decoration: none; }
.topbar-user {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  line-height: 20px;
  min-width: 0;
}
.topbar-user .name {
  color: var(--mist-300);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar .link-button { color: var(--white); }
.topbar :focus-visible { outline-color: var(--mist-100); }

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: calc(100vh - 52px);
}

.sidebar {
  border-right: 1px solid var(--line);
  padding: 24px 16px;
}
.sidebar h2 {
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 24px 8px 8px;
}
.sidebar h2:first-child { margin-top: 0; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar a {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.sidebar a:hover { background: var(--surface-raised); }
.sidebar a[aria-current="page"] {
  background: var(--surface-inverse);
  color: var(--ink-inverse);
}
.sidebar .empty { padding: 8px 12px; font-size: 14px; line-height: 20px; color: var(--ink-muted); }

.content {
  padding: 48px;
  max-width: 1280px;
}
.content h1:focus { outline: none; }

.panel {
  padding: 24px;
  margin: 0 0 24px;
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
}
.panel > :last-child { margin-bottom: 0; }

.tag {
  display: inline-block;
  padding: 2px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-control);
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
}

/* Admin-tabel */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 20px; }
th, td { text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-weight: 600; }
td.email { word-break: break-all; }

select {
  min-height: 40px;
  padding: 6px 8px;
  border: 1px solid var(--border-control);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
select[disabled] { opacity: 0.6; }

.row-status { display: block; font-size: 13px; line-height: 18px; color: var(--ink-muted); margin-top: 4px; }
.row-status.error { color: var(--error-ink); }

@media (max-width: 767px) {
  .topbar { padding: 12px 16px; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); padding: 16px; }
  .content { padding: 24px 16px 48px; }
  .card { padding: 24px; }
  h1 { font-size: 28px; line-height: 36px; }
}

/* Miljømærke (DEV/TEST) – vises ikke i produktion */
.env-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--mist-300);
  color: var(--fjord-900);
  font-size: 11px;
  line-height: 18px;
  font-weight: 600;
  letter-spacing: 0.08em;
  vertical-align: 4px;
}
