:root {
  color-scheme: light;
  --body-font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --heading-font: var(--body-font);
  --bg: #f4f6f3;
  --panel: #ffffff;
  --ink: #17201b;
  --muted: #5f6f67;
  --line: #dce5df;
  --brand: #0f766e;
  --brand-strong: #0b4f4a;
  --brand-border: rgba(15, 118, 110, .55);
  --brand-card-border: rgba(15, 118, 110, .42);
  --brand-score-border: rgba(15, 118, 110, .2);
  --brand-score-tint: rgba(15, 118, 110, .08);
  --brand-tint: rgba(15, 118, 110, .09);
  --brand-focus: rgba(15, 118, 110, .13);
  --header-accent: #0f766e;
  --header-bg: #edf5f2;
  --header-ink: #17201b;
  --header-muted: #5f6f67;
  --header-border: rgba(15, 118, 110, .18);
  --header-control-bg: #ffffff;
  --header-control-border: #cbd8d1;
  --header-control-hover: #f2faf7;
  --brand-mark-bg: #ffffff;
  --brand-mark-border: rgba(15, 118, 110, .25);
  --brand-mark-surface: #e8f7f2;
  --brand-mark-shadow: 0 8px 22px rgba(15, 118, 110, .12);
  --mark-accent-a: #a23a52;
  --mark-accent-b: #2458a6;
  --surface-soft: #fafcfb;
  --surface-card: #ffffff;
  --field-bg: #ffffff;
  --field-border: #cbd8d1;
  --body-copy: #26362f;
  --secondary-copy: #405148;
  --chip-bg: #f8faf9;
  --chip-ink: #34443c;
  --about-bg: #e9eeeb;
  --source-line: #cbd8d1;
  --amber: #9b5b08;
  --blue: #2458a6;
  --rose: #a23a52;
  --green: #24704b;
  --shadow: 0 14px 38px rgba(20, 36, 32, .08);
  --radius: 8px;
  font-family: var(--body-font);
}

:root[data-theme="ouh"] {
  --body-font: Arial, Helvetica, sans-serif;
  --heading-font: "Arial Narrow", Arial, Helvetica, sans-serif;
  --bg: #f3f5f5;
  --ink: #111111;
  --muted: #66757e;
  --line: #d7dde0;
  --brand: #1d7d45;
  --brand-strong: #125a32;
  --brand-border: rgba(29, 125, 69, .62);
  --brand-card-border: rgba(29, 125, 69, .42);
  --brand-score-border: rgba(29, 125, 69, .22);
  --brand-score-tint: rgba(29, 125, 69, .08);
  --brand-tint: rgba(29, 125, 69, .1);
  --brand-focus: rgba(29, 125, 69, .16);
  --header-accent: #1d7d45;
  --header-bg: #ffffff;
  --header-ink: #111111;
  --header-muted: #66757e;
  --header-border: #111111;
  --header-control-hover: #f3f5f5;
  --brand-mark-border: #c9d1d5;
  --brand-mark-surface: #edf6f0;
  --brand-mark-shadow: none;
  --mark-accent-a: #111111;
  --mark-accent-b: #0076c9;
  --surface-soft: #f3f5f5;
  --field-border: #c2ccd1;
  --body-copy: #252a2d;
  --secondary-copy: #4f5f68;
  --chip-bg: #f3f5f5;
  --chip-ink: #334047;
  --about-bg: #e0e3e5;
  --source-line: #bcc5ca;
  --shadow: 0 4px 0 rgba(0, 0, 0, .06);
  --radius: 2px;
}

:root[data-theme="rigshospitalet"] {
  --body-font: Arial, Helvetica, sans-serif;
  --heading-font: Arial, Helvetica, sans-serif;
  --bg: #eef4f7;
  --ink: #172a36;
  --muted: #536b78;
  --line: #cadbe3;
  --brand: #007fad;
  --brand-strong: #004d71;
  --brand-border: rgba(0, 127, 173, .65);
  --brand-card-border: rgba(0, 127, 173, .42);
  --brand-score-border: rgba(0, 127, 173, .22);
  --brand-score-tint: rgba(0, 127, 173, .08);
  --brand-tint: rgba(0, 127, 173, .1);
  --brand-focus: rgba(0, 127, 173, .16);
  --header-accent: #78c8e8;
  --header-bg: #003b5c;
  --header-ink: #ffffff;
  --header-muted: #d7ebf5;
  --header-border: #78c8e8;
  --header-control-bg: #124f70;
  --header-control-border: #83cbe7;
  --header-control-hover: #1d607f;
  --brand-mark-border: #8fd0e8;
  --brand-mark-surface: #e2f4fb;
  --brand-mark-shadow: none;
  --mark-accent-a: #c63e58;
  --mark-accent-b: #003b5c;
  --surface-soft: #f3f8fa;
  --field-border: #b8ced8;
  --body-copy: #243b47;
  --secondary-copy: #405e6d;
  --chip-bg: #f3f8fa;
  --chip-ink: #345363;
  --about-bg: #dcecf3;
  --source-line: #b9d1dc;
  --shadow: 0 8px 22px rgba(0, 59, 92, .08);
  --radius: 4px;
}

:root[data-theme="auh"] {
  --body-font: "Source Sans 3", "Segoe UI", Arial, sans-serif;
  --heading-font: "Source Sans 3", "Segoe UI", Arial, sans-serif;
  --bg: #f3f2ef;
  --ink: #212121;
  --muted: #5c5b58;
  --line: #d4d0c7;
  --brand: #256575;
  --brand-strong: #174653;
  --brand-border: rgba(37, 101, 117, .64);
  --brand-card-border: rgba(37, 101, 117, .42);
  --brand-score-border: rgba(37, 101, 117, .22);
  --brand-score-tint: rgba(37, 101, 117, .08);
  --brand-tint: rgba(37, 101, 117, .1);
  --brand-focus: rgba(37, 101, 117, .16);
  --header-accent: #a6192e;
  --header-bg: #ece8df;
  --header-ink: #212121;
  --header-muted: #5c5b58;
  --header-border: #b7afa0;
  --header-control-bg: #ffffff;
  --header-control-border: #b7afa0;
  --header-control-hover: #f8f6f1;
  --brand-mark-border: #a9a294;
  --brand-mark-surface: #edf4f3;
  --brand-mark-shadow: none;
  --mark-accent-a: #a6192e;
  --mark-accent-b: #ffc72e;
  --surface-soft: #f5f3ee;
  --field-border: #bdb6aa;
  --body-copy: #302f2d;
  --secondary-copy: #56534e;
  --chip-bg: #f5f3ee;
  --chip-ink: #4f4b44;
  --about-bg: #ddd8cc;
  --source-line: #bcb5a8;
  --shadow: none;
  --radius: 0px;
}

:root[data-theme="aalborg"] {
  --body-font: "Source Sans 3", "Segoe UI", Arial, sans-serif;
  --heading-font: "Source Sans 3", "Segoe UI", Arial, sans-serif;
  --bg: #f5f3f4;
  --ink: #182a35;
  --muted: #5e6970;
  --line: #d3d1d3;
  --brand: #005f83;
  --brand-strong: #002138;
  --brand-border: rgba(0, 95, 131, .65);
  --brand-card-border: rgba(0, 95, 131, .42);
  --brand-score-border: rgba(0, 95, 131, .22);
  --brand-score-tint: rgba(0, 95, 131, .08);
  --brand-tint: rgba(0, 95, 131, .1);
  --brand-focus: rgba(0, 95, 131, .16);
  --header-accent: #bdbec2;
  --header-bg: #002138;
  --header-ink: #ffffff;
  --header-muted: #e8e5e7;
  --header-border: #bdbec2;
  --header-control-bg: #12394f;
  --header-control-border: #8fa4b0;
  --header-control-hover: #1d485e;
  --brand-mark-border: #9aadb8;
  --brand-mark-surface: #e8eef2;
  --brand-mark-shadow: none;
  --mark-accent-a: #ffffff;
  --mark-accent-b: #7fb4c9;
  --surface-soft: #f5f3f4;
  --field-border: #bdbec2;
  --body-copy: #293a44;
  --secondary-copy: #4c5e68;
  --chip-bg: #f5f3f4;
  --chip-ink: #3f515b;
  --about-bg: #e8e5e7;
  --source-line: #bdbec2;
  --shadow: none;
  --radius: 0px;
}

:root[data-theme="sjaelland"] {
  --body-font: Inter, ui-sans-serif, system-ui, sans-serif;
  --heading-font: Inter, ui-sans-serif, system-ui, sans-serif;
  --bg: #f3f7f7;
  --ink: #243338;
  --muted: #595959;
  --line: #cddfe3;
  --brand: #00809c;
  --brand-strong: #005c70;
  --brand-border: rgba(0, 128, 156, .65);
  --brand-card-border: rgba(0, 128, 156, .42);
  --brand-score-border: rgba(0, 128, 156, .22);
  --brand-score-tint: rgba(0, 128, 156, .08);
  --brand-tint: rgba(0, 128, 156, .1);
  --brand-focus: rgba(0, 128, 156, .16);
  --header-accent: #00809c;
  --header-bg: #ffffff;
  --header-ink: #243338;
  --header-muted: #595959;
  --header-border: #93cbd6;
  --header-control-bg: #ffffff;
  --header-control-border: #95bfc7;
  --header-control-hover: #e6f2f5;
  --brand-mark-border: #86bfca;
  --brand-mark-surface: #e6f2f5;
  --brand-mark-shadow: none;
  --mark-accent-a: #8a5fb5;
  --mark-accent-b: #00809c;
  --surface-soft: #eef6f7;
  --field-border: #a8cbd2;
  --body-copy: #2e4147;
  --secondary-copy: #4a6066;
  --chip-bg: #eef6f7;
  --chip-ink: #3d555b;
  --about-bg: #e6f2f5;
  --source-line: #afd1d8;
  --shadow: 0 6px 18px rgba(0, 92, 112, .06);
  --radius: 4px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body-font);
}

.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.app-status-rail { position: relative; height: 5px; }
.app-freshness-strip { position: relative; display: block; width: 100%; height: 5px; overflow: hidden; background: var(--amber); }
.app-freshness-strip:hover { text-decoration: none; }
.app-freshness-strip:focus-visible { height: 9px; outline: 3px solid var(--blue); outline-offset: -3px; }
.app-freshness-strip.freshness-current { background: var(--green); }
.app-freshness-strip.freshness-unknown { background: var(--amber); }
.app-freshness-strip.freshness-outdated { background: var(--rose); }
.app-connection-indicator {
  position: absolute;
  z-index: 5;
  top: 7px;
  right: 10px;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--header-control-border);
  border-radius: 50%;
  background: var(--header-control-bg);
  color: var(--header-ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .16);
  pointer-events: none;
}
.app-connection-indicator svg { width: 15px; height: 15px; }
.app-connection-indicator[hidden] { display: none; }

button, input, textarea { font: inherit; }
a { color: var(--brand-strong); text-decoration: none; }
a:hover { text-decoration: underline; }

.app-header {
  display: grid;
  gap: 18px;
  padding: 26px clamp(16px, 3vw, 36px) 20px;
  border-top: 5px solid var(--header-accent);
  border-bottom: 1px solid var(--header-border);
  background: var(--header-bg);
  color: var(--header-ink);
}

.topline, .brand, .notice, .panel-head, .med-head, .clean-main,
.interaction-heading, .interaction-item-head, .toolbar, .card-actions,
.meta-row, .chips, .manual-suggestions, .suggestion-actions, .header-actions {
  display: flex;
}

.topline, .panel-head, .med-head, .clean-main, .interaction-heading,
.interaction-item-head {
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.topline, .toolbar, .card-actions, .meta-row, .chips,
.manual-suggestions, .suggestion-actions { flex-wrap: wrap; }

.header-actions {
  align-items: flex-start;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  flex: 0 0 auto;
  max-width: min(100%, 720px);
}
.theme-picker { position: relative; }

.pwa-action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.pwa-action svg { width: 17px; height: 17px; flex: 0 0 auto; }
.pwa-update { border-color: var(--header-accent) !important; }
.pwa-action[hidden] { display: none; }

.brand { align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--brand-mark-border);
  border-radius: var(--radius);
  background: var(--brand-mark-bg);
  color: var(--brand);
  box-shadow: var(--brand-mark-shadow);
}
.brand-mark svg { width: 28px; height: 28px; }
.brand-mark-surface { fill: var(--brand-mark-surface); }
.brand-mark-accent-a { fill: var(--mark-accent-a); }
.brand-mark-accent-b { fill: var(--mark-accent-b); }

h1, h2, h3 { font-family: var(--heading-font); }
h1 { margin: 0; font-size: clamp(27px, 4vw, 42px); line-height: 1; letter-spacing: 0; }
.subtitle { max-width: 850px; margin: 6px 0 0; color: var(--header-muted); line-height: 1.45; }

.app-header .btn {
  border-color: var(--header-control-border);
  background: var(--header-control-bg);
  color: var(--header-ink);
}
.app-header .btn:hover { border-color: var(--header-control-border); background: var(--header-control-hover); }
.theme-button[aria-expanded="true"] .theme-chevron { transform: rotate(180deg); }
.theme-chevron { transition: transform .16s ease; }
.theme-menu {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 30;
  display: grid;
  width: min(310px, calc(100vw - 32px));
  gap: 3px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 16px 38px rgba(17, 32, 27, .18);
}
.theme-menu[hidden] { display: none; }
.theme-option {
  display: grid;
  grid-template-columns: 47px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: max(0px, calc(var(--radius) - 2px));
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.theme-option:hover, .theme-option:focus-visible { border-color: var(--brand-border); background: var(--brand-tint); outline: none; }
.theme-option[aria-checked="true"] { color: var(--brand-strong); font-weight: 700; }
.theme-check { width: 18px; height: 18px; opacity: 0; }
.theme-option[aria-checked="true"] .theme-check { opacity: 1; }
.theme-swatches { display: grid; grid-template-columns: repeat(3, 1fr); width: 45px; height: 24px; overflow: hidden; border: 1px solid rgba(0, 0, 0, .14); border-radius: 2px; }
.theme-swatches i:nth-child(1) { background: var(--swatch-1); }
.theme-swatches i:nth-child(2) { background: var(--swatch-2); }
.theme-swatches i:nth-child(3) { background: var(--swatch-3); }
[data-theme-option="current"] { --swatch-1: #0f766e; --swatch-2: #edf5f2; --swatch-3: #a23a52; }
[data-theme-option="ouh"] { --swatch-1: #1d7d45; --swatch-2: #111111; --swatch-3: #e0e3e5; }
[data-theme-option="rigshospitalet"] { --swatch-1: #003b5c; --swatch-2: #78c8e8; --swatch-3: #ffffff; }
[data-theme-option="auh"] { --swatch-1: #a6192e; --swatch-2: #ece8df; --swatch-3: #256575; }
[data-theme-option="aalborg"] { --swatch-1: #002138; --swatch-2: #e8e5e7; --swatch-3: #005f83; }
[data-theme-option="sjaelland"] { --swatch-1: #00809c; --swatch-2: #e6f2f5; --swatch-3: #decef1; }

.notice {
  align-items: flex-start;
  gap: 9px;
  max-width: 980px;
  padding: 10px 12px;
  border: 1px solid rgba(155, 91, 8, .3);
  border-radius: var(--radius);
  background: #fff8e8;
  color: #394840;
  font-size: 14px;
  line-height: 1.4;
}
.notice strong { color: #704100; }

.shell {
  display: grid;
  grid-template-columns: minmax(320px, 1.03fr) minmax(320px, .97fr);
  gap: 20px;
  align-items: start;
  padding: 22px clamp(16px, 3vw, 36px) 36px;
}
.patient-workspace, .plan-workspace { grid-column: 1 / -1; }
.workflow-nav {
  position: sticky;
  top: 8px;
  z-index: 12;
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
  box-shadow: 0 8px 24px rgba(20, 36, 32, .1);
}
.workflow-nav a { display: flex; min-width: 0; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 7px 10px; background: var(--panel); color: var(--body-copy); font-size: 13px; font-weight: 800; text-decoration: none; }
.workflow-nav a:hover, .workflow-nav a:focus-visible { background: var(--brand-tint); color: var(--brand-strong); outline: none; }
.workflow-nav span { display: inline-grid; place-items: center; width: 21px; height: 21px; flex: 0 0 21px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 11px; }
#card-workspace, #patient-workspace, #plan-workspace { scroll-margin-top: 64px; }
.medication-workspace { grid-column: 1 / -1; min-width: 0; }

.panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.panel-head { padding: 18px; border-bottom: 1px solid var(--line); }
.panel-title, .interaction-title, .interaction-pair { margin: 0; letter-spacing: 0; }
.panel-title { font-size: 18px; }
.panel-note, .interaction-note { margin: 5px 0 0; color: var(--muted); font-size: 14px; line-height: 1.4; }
.panel-body { padding: 18px; }

.searchbar, .manual-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}
.manual-row { grid-template-columns: minmax(0, 1fr) minmax(150px, auto) auto; margin-top: 12px; }
.manual-kind { width: auto; }

.field {
  width: 100%;
  min-height: 44px;
  padding: 11px 12px;
  border: 1px solid var(--field-border);
  border-radius: var(--radius);
  outline: none;
  background: var(--field-bg);
  color: var(--ink);
}
.field:focus { border-color: var(--brand-border); box-shadow: 0 0 0 3px var(--brand-focus); }
textarea.field { min-height: 250px; resize: vertical; line-height: 1.45; }
#cardInput { min-height: 150px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--field-border);
  border-radius: var(--radius);
  background: var(--field-bg);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--brand-border); background: var(--brand-tint); text-decoration: none; }
.btn.primary { border-color: var(--brand); background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-strong); }
.btn svg { width: 17px; height: 17px; flex: 0 0 auto; }
.btn.compact { min-height: 36px; padding: 7px 9px; font-size: 13px; }

.chips { gap: 8px; margin: 16px 0 4px; }
.chip, .manual-suggestion {
  padding: 7px 10px;
  border: 1px solid #d3dfd9;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--chip-ink);
  cursor: pointer;
  font-size: 13px;
}
.chip:hover, .chip.active, .manual-suggestion:hover, .manual-suggestion:focus-visible {
  border-color: var(--brand-border);
  background: var(--brand-tint);
  color: var(--brand-strong);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}
.stat { padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-soft); }
.stat strong { display: block; font-size: 20px; line-height: 1; }
.stat span { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }

.results, .clean-list, .interaction-list { display: grid; gap: 12px; }
.clean-list { gap: 16px; }
.results-more {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0 2px;
  color: var(--muted);
  font-size: 13px;
}
.results-more-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.med-card, .clean-item, .interaction-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-card);
}
.med-card { padding: 14px; }
.med-card.match { border-color: var(--brand-card-border); }
.med-name { margin: 0; font-size: 19px; line-height: 1.2; letter-spacing: 0; }
.generic { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.summary { margin: 11px 0 0; color: var(--body-copy); line-height: 1.45; }

.score, .source-badge, .tag, .severity {
  flex: 0 0 auto;
  border-radius: 999px;
  font-size: 12px;
}
.score { padding: 5px 8px; border: 1px solid var(--brand-score-border); background: var(--brand-score-tint); color: var(--brand-strong); font-weight: 700; }
.score.pending { border-color: #d5dde0; background: #f4f6f7; color: #53606a; }
.score.inactive { border-color: rgba(155, 91, 8, .25); background: #fff5dd; color: #794500; }
.meta-row { gap: 8px; margin-top: 12px; }
.tag { padding: 5px 8px; background: #eef3f0; color: #3f5148; }
.tag.blue { background: rgba(36, 88, 166, .1); color: var(--blue); }
.tag.amber { background: rgba(155, 91, 8, .12); color: var(--amber); }
.card-actions, .toolbar, .suggestion-actions { gap: 8px; }
.card-actions { margin-top: 13px; }
.toolbar { align-items: center; margin-top: 12px; }

.empty { padding: 18px; border: 1px dashed var(--field-border); border-radius: var(--radius); background: var(--surface-soft); color: var(--muted); line-height: 1.45; }
.settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 12px 0; }
.toggle { display: flex; align-items: center; gap: 9px; min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-soft); color: var(--body-copy); font-size: 14px; }
.toggle input { width: 17px; height: 17px; accent-color: var(--brand); }
.manual-suggestions { gap: 7px; margin-top: 8px; }
.manual-suggestions:empty { display: none; }
.manual-suggestion { padding: 6px 9px; font-size: 12px; font-weight: 700; }
.manual-suggestion.more { border-style: dashed; color: var(--brand-strong); }

.clean-item { display: grid; grid-template-columns: minmax(210px, .36fr) minmax(0, 1fr); gap: 0; min-width: 0; border-color: var(--field-border); border-left: 4px solid var(--brand); box-shadow: 0 2px 8px rgba(20, 36, 32, .06); }
.clean-item.unknown { border-color: rgba(155, 91, 8, .35); border-left-color: var(--amber); }
.clean-item.proposed { border-left-color: var(--blue); }
.clean-main { flex-direction: column; align-items: stretch; gap: 8px; min-width: 0; padding: 12px 14px; border-right: 1px solid var(--line); background: var(--surface-soft); }
.clean-item.unknown .clean-main { background: #fff6e5; }
.clean-title { display: flex; align-items: flex-start; gap: 9px; }
.clean-sequence { display: grid; flex: 0 0 22px; place-items: center; width: 22px; height: 22px; border: 1px solid var(--brand-border); border-radius: var(--radius); background: var(--brand-tint); color: var(--brand-strong); font-size: 11px; font-weight: 800; }
.clean-name { min-width: 0; overflow-wrap: anywhere; font-weight: 800; line-height: 1.25; }
.clean-extra { margin-top: 3px; color: var(--muted); font-size: 13px; line-height: 1.4; }
.medication-status { display: inline-flex; margin-left: 6px; padding: 2px 6px; border: 1px solid var(--brand-border); border-radius: var(--radius); background: var(--brand-tint); color: var(--brand-strong); font-size: 10px; font-weight: 800; vertical-align: 2px; }
.clean-item .card-actions { margin-top: 4px; }
.medication-review { display: grid; gap: 8px; min-width: 0; padding: 12px 14px; }
.review-top-grid, .review-use-grid { display: grid; gap: 10px; min-width: 0; }
.review-top-grid { grid-template-columns: minmax(0, .65fr) minmax(0, 1.35fr); }
.review-use-grid { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: end; }
.review-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px 10px; }
.review-row-title { min-width: 74px; color: var(--secondary-copy); font-size: 11px; }
.review-choices { display: flex; flex: 1 1 220px; flex-wrap: wrap; gap: 5px 12px; }
.review-choice { display: inline-flex; align-items: center; gap: 4px; min-height: 24px; color: var(--body-copy); font-size: 11px; line-height: 1.2; cursor: pointer; }
.review-choice input { width: 15px; height: 15px; margin: 0; accent-color: var(--brand); cursor: pointer; }
.review-choice:has(input:checked) { color: var(--brand-strong); font-weight: 700; }
.review-dose-grid { display: grid; grid-template-columns: repeat(4, minmax(42px, 1fr)) minmax(80px, 1.4fr); gap: 6px; }
.review-dose-field, .review-text-field { display: grid; gap: 3px; min-width: 0; color: var(--secondary-copy); font-size: 11px; font-weight: 700; }
.review-dose-field .field, .review-text-field .field { min-width: 0; min-height: 34px; padding: 6px 7px; font-size: 12px; font-weight: 400; }
.review-dose-field .field:disabled { opacity: .6; }
.review-text-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.review-plan-row { padding-top: 6px; border-top: 1px solid var(--line); }
.suggestion { display: grid; gap: 9px; margin-top: 9px; padding: 10px; border: 1px solid rgba(155, 91, 8, .25); border-radius: var(--radius); background: #fff6e5; }
.suggestion-text { color: #5b3b09; font-size: 13px; line-height: 1.4; }

.interaction-section { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.interaction-title { font-size: 16px; }
.interaction-note { font-size: 13px; }
.source-badge { padding: 5px 8px; border: 1px solid var(--field-border); background: var(--chip-bg); color: var(--secondary-copy); font-size: 11px; font-weight: 700; }
.interaction-evidence-callout { display: grid; gap: 3px; padding: 11px 12px; border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: var(--radius); background: #f1faf5; }
.interaction-evidence-callout.incomplete { border-left-color: var(--amber); background: #fffaf1; }
.interaction-evidence-callout strong { color: var(--ink); font-size: 13px; line-height: 1.35; }
.interaction-evidence-callout span { color: var(--secondary-copy); font-size: 11px; line-height: 1.45; }
.interaction-evidence-details { border-bottom: 1px solid var(--line); padding: 0 2px 10px; }
.interaction-evidence-details summary { color: var(--brand-strong); font-size: 12px; font-weight: 800; cursor: pointer; }
.interaction-evidence-list { display: grid; gap: 8px; margin-top: 10px; }
.interaction-evidence-row { display: grid; grid-template-columns: minmax(140px, .8fr) minmax(190px, auto); gap: 3px 12px; align-items: start; padding: 9px 10px; border-left: 3px solid var(--amber); background: var(--surface-soft); }
.interaction-evidence-row[data-state^="approved"] { border-left-color: var(--green); }
.interaction-evidence-row[data-state^="reviewed"] { border-left-color: var(--blue); }
.interaction-evidence-row > div { min-width: 0; }
.interaction-evidence-row > div strong, .interaction-evidence-row > div span { display: block; }
.interaction-evidence-row > div strong { color: var(--ink); font-size: 12px; }
.interaction-evidence-row > div span { margin-top: 2px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.interaction-evidence-row .evidence-state { color: var(--secondary-copy); font-size: 10px; font-weight: 800; text-align: right; }
.interaction-evidence-row p { grid-column: 1 / -1; margin: 3px 0 0; color: var(--muted); font-size: 10px; line-height: 1.4; }
.patient-fields { display: grid; grid-template-columns: 1.35fr .65fr .8fr 1fr; gap: 10px; }
.patient-birth-field { grid-column: span 2; }
.patient-egfr-field { grid-column: span 2; }
.field-label { display: grid; align-content: start; gap: 6px; min-width: 0; color: var(--secondary-copy); font-size: 12px; font-weight: 800; }
.field-label .field { min-height: 40px; padding: 8px 10px; font-weight: 400; }
.field-help { color: var(--muted); font-size: 10px; font-weight: 500; line-height: 1.35; }
.birth-date-status { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; grid-column: 1 / -1; }
.birth-date-status:empty { display: none; }
.birth-date-status p { margin: 0; color: var(--muted); font-size: 12px; }
.birth-date-status.invalid p { color: var(--rose); font-weight: 700; }
.field-with-unit { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 7px; }
.field-with-unit small { max-width: 86px; color: var(--muted); font-size: 10px; font-weight: 600; line-height: 1.2; }
.organ-fieldset { min-width: 0; margin: 13px 0 0; padding: 0; border: 0; }
.organ-fieldset legend { padding: 0; color: var(--secondary-copy); font-size: 12px; font-weight: 800; }
.organ-options { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 7px; }
.organ-toggle { display: inline-flex; align-items: center; gap: 6px; min-height: 35px; padding: 6px 9px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-soft); color: var(--body-copy); font-size: 12px; cursor: pointer; }
.organ-toggle:has(input:checked) { border-color: var(--brand-border); background: var(--brand-tint); color: var(--brand-strong); font-weight: 700; }
.organ-toggle input { width: 15px; height: 15px; margin: 0; accent-color: var(--brand); }
.patient-caveat { margin: 10px 0 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.clarification-resolutions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.clarification-resolutions:empty { display: none; }
.clarified-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 4px 7px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-soft); color: var(--body-copy); font-size: 11px; }
.clarified-chip button { border: 0; background: transparent; color: var(--muted); font: inherit; cursor: pointer; }
.clarification-list { display: grid; gap: 9px; margin-bottom: 12px; }
.clarification-toggle { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; padding: 11px 12px; border: 1px solid rgba(155, 91, 8, .28); border-radius: var(--radius); background: #fffaf1; color: var(--body-copy); text-align: left; cursor: pointer; }
.clarification-toggle strong { font-size: 13px; }
.clarification-toggle span { color: var(--muted); font-size: 11px; }
.clarification-item { padding: 11px; border: 1px solid rgba(155, 91, 8, .28); border-left: 4px solid var(--amber); border-radius: var(--radius); background: #fffaf1; }
.clarification-item h4 { margin: 0; font-size: 13px; letter-spacing: 0; }
.clarification-item p { margin: 5px 0 0; color: var(--body-copy); font-size: 12px; line-height: 1.45; }
.clarification-item details { margin-top: 8px; }
.clarification-item summary { color: var(--secondary-copy); font-size: 11px; font-weight: 800; cursor: pointer; }
.clarification-reasons { margin: 7px 0 0; padding-left: 18px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.clarification-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.interaction-trigger { color: var(--body-copy); }
.plan-toolbar { margin-top: 0; }
.plan-output-label { margin-top: 16px; }
.plan-output { min-height: 150px; margin-top: 6px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; line-height: 1.55; }
.plan-validation { display: grid; gap: 10px; margin-top: 14px; }
.plan-validation-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.plan-check { min-width: 0; padding: 11px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-soft); }
.plan-check strong { display: block; font-size: 18px; }
.plan-check span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.35; }
.plan-check.pass { border-color: rgba(36, 112, 75, .35); background: #f1faf5; }
.plan-check.warn { border-color: rgba(155, 91, 8, .32); background: #fffaf1; }
.plan-check.critical { border-color: rgba(162, 58, 82, .35); background: #fff4f6; }
.plan-findings { display: grid; gap: 8px; }
.plan-finding { padding: 10px 12px; border-left: 4px solid var(--amber); background: var(--surface-soft); color: var(--body-copy); font-size: 12px; line-height: 1.45; }
.plan-finding.critical { border-left-color: var(--rose); }
.safety-signals { display: grid; gap: 10px; margin-top: 12px; }
.context-lamps { display: flex; flex-wrap: wrap; gap: 7px; }
.context-lamp { display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding: 6px 9px; border: 1px solid #d9d0bd; border-radius: var(--radius); background: #fffaf0; color: #615238; font-size: 11px; line-height: 1.3; }
.context-lamp i { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: #d29a34; box-shadow: 0 0 0 3px rgba(210, 154, 52, .16); }
.safety-warning-list { display: grid; gap: 8px; }
.safety-warning { padding: 10px 11px; border: 1px solid var(--line); border-left: 4px solid var(--amber); border-radius: var(--radius); background: #fffdf8; }
.safety-warning.critical { border-left-color: var(--rose); background: #fffafb; }
.safety-warning-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.safety-warning p { margin: 7px 0 0; color: var(--body-copy); font-size: 12px; line-height: 1.45; }
.safety-warning .safety-context { color: var(--muted); font-weight: 700; }
.safety-warning .safety-threshold { padding: 7px 8px; border-left: 3px solid var(--amber); background: rgba(210, 154, 52, .09); color: var(--body-copy); }
.safety-warning.critical .safety-threshold { border-left-color: var(--rose); background: rgba(168, 48, 64, .06); }
.safety-source { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 12px; }
.safety-source span { color: var(--muted); font-size: 11px; }
.safety-clear { padding: 10px 11px; border-left: 4px solid var(--green); background: rgba(36, 112, 75, .07); color: var(--body-copy); font-size: 12px; line-height: 1.45; }
.safety-coverage { margin: 0; color: var(--muted); font-size: 11px; }
.interaction-item { padding: 13px; border-left-width: 4px; }
.interaction-item.critical { border-left-color: var(--rose); background: #fffafb; }
.interaction-item.moderate { border-left-color: var(--amber); background: #fffdf8; }
.interaction-item.minor { border-left-color: var(--blue); }
.interaction-item.none { border-left-color: var(--green); }
.interaction-item.unclear { border-left-color: #69766f; }
.interaction-pair { font-size: 15px; }
.interaction-substances { margin-top: 3px; color: var(--muted); font-size: 12px; }
.severity { padding: 5px 8px; font-size: 11px; font-weight: 800; text-transform: capitalize; }
.severity.critical { color: #84253b; background: rgba(162, 58, 82, .12); }
.severity.moderate { color: #754300; background: rgba(155, 91, 8, .13); }
.severity.minor { color: #244f91; background: rgba(36, 88, 166, .1); }
.severity.none { color: #1f603f; background: rgba(36, 112, 75, .1); }
.severity.unclear { color: #4d5b53; background: #edf1ef; }
.interaction-details { display: grid; gap: 9px; margin: 12px 0 0; }
.interaction-details div { display: grid; gap: 2px; }
.interaction-details dt { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.interaction-details dd { margin: 0; color: var(--body-copy); font-size: 13px; line-height: 1.45; }
.source-link { display: inline-block; margin-top: 10px; font-size: 12px; font-weight: 700; }

.coverage-section { padding: 34px clamp(16px, 3vw, 36px) 40px; border-top: 1px solid var(--line); background: var(--panel); }
.coverage-inner { max-width: 1320px; margin: 0 auto; }
.coverage-intro { display: grid; grid-template-columns: minmax(0, 1fr) minmax(230px, .34fr); gap: 34px; align-items: end; margin-bottom: 24px; }
.coverage-title { margin: 0; font-family: var(--heading-font); font-size: 24px; letter-spacing: 0; }
.coverage-copy { max-width: 820px; margin: 8px 0 0; color: var(--secondary-copy); line-height: 1.5; }
.coverage-headline { display: grid; gap: 2px; padding-left: 18px; border-left: 4px solid var(--amber); }
.coverage-headline strong { color: var(--ink); font-family: var(--heading-font); font-size: 30px; line-height: 1; }
.coverage-headline span { color: var(--secondary-copy); font-size: 12px; line-height: 1.4; }
.coverage-list { border-top: 1px solid var(--line); }
.coverage-row { display: grid; grid-template-columns: minmax(230px, .75fr) minmax(300px, 1.45fr) minmax(170px, .55fr); gap: 24px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); }
.coverage-name { display: grid; justify-items: start; gap: 7px; }
.coverage-name h3 { margin: 0; font-size: 15px; line-height: 1.3; letter-spacing: 0; }
.coverage-row p { margin: 0; color: var(--secondary-copy); font-size: 13px; line-height: 1.45; }
.coverage-status { display: inline-flex; align-items: center; min-height: 24px; padding: 4px 7px; border: 1px solid transparent; border-radius: var(--radius); font-size: 10px; font-weight: 800; line-height: 1.2; text-transform: uppercase; }
.coverage-status.complete { border-color: rgba(36, 112, 75, .24); background: rgba(36, 112, 75, .09); color: var(--green); }
.coverage-status.partial, .coverage-status.pilot { border-color: rgba(155, 91, 8, .24); background: rgba(155, 91, 8, .1); color: var(--amber); }
.coverage-status.pending { border-color: var(--line); background: var(--surface-soft); color: var(--muted); }
.coverage-count { color: var(--body-copy); font-size: 12px; line-height: 1.4; }
.coverage-measure { display: grid; grid-template-columns: 1fr auto; gap: 5px 8px; align-items: center; }
.coverage-measure .coverage-count { grid-column: 1 / -1; }
.coverage-measure progress { width: 100%; height: 7px; border: 0; border-radius: var(--radius); overflow: hidden; background: var(--line); accent-color: var(--amber); }
.coverage-measure progress::-webkit-progress-bar { background: var(--line); }
.coverage-measure progress::-webkit-progress-value { background: var(--amber); }
.coverage-measure progress::-moz-progress-bar { background: var(--amber); }
.coverage-measure span { color: var(--muted); font-size: 11px; font-weight: 800; white-space: nowrap; }
.coverage-explanation { display: grid; grid-template-columns: minmax(230px, .75fr) minmax(300px, 1.45fr) minmax(170px, .55fr); gap: 24px; align-items: start; padding-top: 20px; }
.coverage-explanation h3 { margin: 0; font-size: 15px; letter-spacing: 0; }
.coverage-explanation p { margin: 0; color: var(--secondary-copy); font-size: 13px; line-height: 1.5; }
.coverage-explanation a { font-size: 12px; font-weight: 800; }

.about-section { padding: 30px clamp(16px, 3vw, 36px) 38px; border-top: 1px solid var(--line); background: var(--about-bg); }
.about-inner { display: grid; grid-template-columns: minmax(220px, .7fr) minmax(320px, 1.3fr); gap: 30px; max-width: 1320px; margin: 0 auto; }
.about-title { margin: 0; font-size: 22px; letter-spacing: 0; }
.about-copy { margin: 8px 0 0; color: var(--secondary-copy); line-height: 1.5; }
.source-list { display: grid; gap: 0; margin: 0; border-top: 1px solid var(--source-line); }
.source-row { display: grid; grid-template-columns: minmax(130px, .35fr) minmax(0, 1fr); gap: 18px; padding: 13px 0; border-bottom: 1px solid var(--source-line); }
.source-row dt { font-weight: 800; }
.source-row dd { margin: 0; color: var(--secondary-copy); line-height: 1.45; }
.source-row--versions { padding-top: 0; }
.release-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--source-line); border-bottom: 1px solid var(--source-line); }
.release-summary > div { min-height: 76px; padding: 12px 14px 10px 0; }
.release-summary > div:not(:last-child) { margin-right: 14px; border-right: 1px solid var(--source-line); }
.release-summary span, .version-ledger span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.release-state { display: inline-flex; align-items: center; gap: 6px; }
.release-state::before { content: ""; width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: var(--amber); }
.release-state--current::before { background: var(--green); }
.release-state--outdated::before { background: var(--rose); }
.release-connection, .version-caveat { margin: 10px 0 0; color: var(--secondary-copy); font-size: 12px; line-height: 1.45; }
.text-button { margin-top: 8px; padding: 0; border: 0; background: transparent; color: var(--brand-strong); cursor: pointer; font-size: 12px; font-weight: 800; text-decoration: underline; }
.text-button:disabled { color: var(--muted); cursor: wait; }
.version-ledger { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 18px; border-top: 1px solid var(--source-line); }
.version-ledger > div { min-width: 0; padding: 11px 12px 8px 0; border-bottom: 1px solid var(--source-line); }
.version-ledger strong { overflow-wrap: anywhere; font-size: 12px; }
.version-caveat { padding-left: 12px; border-left: 3px solid var(--amber); }
.footer-note { margin-top: 14px; color: var(--muted); font-size: 12px; line-height: 1.4; }

.toast { position: fixed; right: 18px; bottom: 18px; z-index: 20; padding: 10px 12px; border-radius: var(--radius); background: #17201b; color: #fff; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); opacity: 0; transform: translateY(8px); pointer-events: none; transition: .18s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 980px) {
  .shell, .about-inner { grid-template-columns: 1fr; }
  .patient-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .coverage-row, .coverage-explanation { grid-template-columns: minmax(210px, .75fr) minmax(0, 1.25fr); }
  .coverage-row > :last-child, .coverage-explanation > :last-child { grid-column: 2; }
  .version-ledger { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .clean-item { grid-template-columns: 1fr; }
  .clean-main { border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 640px) {
  .app-header { padding-top: 18px; }
  .topline { flex-direction: column; }
  .header-actions { width: 100%; flex-direction: column; }
  .pwa-status { width: 100%; text-align: center; }
  .release-summary, .version-ledger { grid-template-columns: 1fr; }
  .release-summary > div { min-height: 0; padding: 10px 0; }
  .release-summary > div:not(:last-child) { margin-right: 0; border-right: 0; border-bottom: 1px solid var(--source-line); }
  .theme-picker { width: 100%; }
  .theme-menu { right: auto; left: 0; width: 100%; }
  .searchbar, .manual-row, .source-row, .patient-fields, .review-top-grid, .review-use-grid, .review-text-grid, .interaction-evidence-row, .coverage-intro, .coverage-row, .coverage-explanation { grid-template-columns: 1fr; }
  .settings { gap: 6px; }
  .settings .toggle { gap: 6px; padding: 8px 6px; font-size: 12px; overflow-wrap: anywhere; }
  .stats { gap: 5px; }
  .stat { padding: 7px; }
  .stat strong { font-size: 16px; }
  .stat span { font-size: 10px; overflow-wrap: anywhere; }
  .interaction-evidence-row .evidence-state { text-align: left; }
  .manual-kind { width: 100%; }
  .patient-birth-field, .patient-egfr-field { grid-column: auto; }
  .review-dose-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .review-dose-unit { grid-column: 1 / -1; }
  .panel-head, .med-head, .clean-main, .interaction-heading, .interaction-item-head { flex-direction: column; }
  .results-more, .safety-warning-head { align-items: flex-start; flex-direction: column; }
  .source-row { gap: 4px; }
  .coverage-intro { gap: 18px; }
  .coverage-headline { padding-left: 12px; }
  .coverage-row, .coverage-explanation { gap: 9px; }
  .coverage-row > :last-child, .coverage-explanation > :last-child { grid-column: 1; }
  .plan-validation-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workflow-nav { top: 4px; }
  .workflow-nav a { gap: 5px; padding-inline: 5px; font-size: 11px; }
  .btn { width: 100%; }
  .toolbar .btn, .card-actions .btn, .suggestion-actions .btn { width: auto; }
}

@media (max-width: 360px) {
  .workflow-nav span { display: none; }
  .settings { grid-template-columns: 1fr; }
}

:root[data-theme="ouh"] .app-header { border-top-width: 9px; }
:root[data-theme="ouh"] .panel-title { text-transform: uppercase; }
:root[data-theme="rigshospitalet"] .app-header,
:root[data-theme="aalborg"] .app-header { border-top-width: 8px; }
:root[data-theme="auh"] .app-header { border-top-width: 10px; }
:root[data-theme="auh"] .panel-head { border-top: 3px solid var(--header-accent); }
:root[data-theme="sjaelland"] .panel-head { background: #eef6f7; }
