/* Self-hosted fonts (SIL Open Font License 1.1): Schibsted Grotesk, Newsreader, IBM Plex Mono.
   Downloaded from Google Fonts, latin and latin-ext subsets. */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-latin-ext-normal-400.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-latin-normal-400.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-latin-ext-normal-500.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-latin-normal-500.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-latin-ext-normal-600.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-latin-normal-600.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Newsreader';
  font-style: italic;
  font-weight: 300 700;
  font-display: swap;
  src: url('fonts/newsreader-latin-ext-italic-300-700.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Newsreader';
  font-style: italic;
  font-weight: 300 700;
  font-display: swap;
  src: url('fonts/newsreader-latin-italic-300-700.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('fonts/newsreader-latin-ext-normal-300-700.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('fonts/newsreader-latin-normal-300-700.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Schibsted Grotesk';
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/schibsted-grotesk-latin-ext-italic-400-700.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Schibsted Grotesk';
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/schibsted-grotesk-latin-italic-400-700.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Schibsted Grotesk';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('fonts/schibsted-grotesk-latin-ext-normal-400-900.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Schibsted Grotesk';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('fonts/schibsted-grotesk-latin-normal-400-900.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ==========================================================================================
   PharmaSafe DS — design tokens and components shared by pharmasafe.no and RWE Studio.
   Design: Claude Design canvas "PharmaSafe platform design" (Main.dc.html = foundations).
   Use the classes below; feature styles use their own prefix (psm- mapping, psc- codelists,
   pss- signal, odl- library …) and only the --ps-* variables for colour, type and space.
   Theme: light by default; dark with [data-theme="dark"] on <html>, or the system setting when
   no data-theme is set.
   ========================================================================================== */

:root {
  color-scheme: light;
  --ps-font: 'Schibsted Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ps-font-read: 'Newsreader', Georgia, 'Times New Roman', serif;
  --ps-font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  --ps-bg: #F6F7F4;
  --ps-surface: #FFFFFF;
  --ps-surface-2: #EFF2EE;
  --ps-surface-3: #E6EAE5;
  --ps-surface-sunk: #FAFBF9;
  --ps-line: #DDE3DC;
  --ps-line-soft: #EEF1ED;
  --ps-line-strong: #C3CCC3;
  --ps-ink: #0F1E18;
  --ps-ink-2: #3C4A44;
  --ps-ink-3: #5F6D66;
  --ps-ink-inverse: #FFFFFF;

  --ps-brand: #0E7A4B;
  --ps-brand-hover: #0A6340;
  --ps-brand-ink: #0A5C38;
  --ps-brand-soft: #E2F1E8;
  --ps-brand-line: #9FD1B5;
  --ps-brand-vivid: #22A04B;
  --ps-signal: #C2410C;
  --ps-signal-ink: #9A330A;
  --ps-signal-soft: #FCEBE1;

  --ps-ok: #15803D;      --ps-ok-ink: #11622F;   --ps-ok-soft: #E3F3E8;
  --ps-info: #2563A8;    --ps-info-ink: #1D4F86; --ps-info-soft: #E3EDF8;
  --ps-warn: #F59E0B;    --ps-warn-ink: #8A4508; --ps-warn-soft: #FDF0DC;
  --ps-bad: #B91C1C;     --ps-bad-ink: #951515;  --ps-bad-soft: #FBE5E3;
  --ps-muted: #8A9991;

  /* chart series, distinct in lightness, colour-blind safe order */
  --ps-c1: #0E7A4B; --ps-c2: #2563A8; --ps-c3: #E07B39; --ps-c4: #6D4FC2; --ps-c5: #B08900; --ps-c6: #4B5D67;

  /* OMOP domains (mapping, codelists) */
  --ps-dom-condition-bg: #E3EDF8;   --ps-dom-condition: #1D4F86;
  --ps-dom-drug-bg: #E2F1E8;        --ps-dom-drug: #0A5C38;
  --ps-dom-procedure-bg: #FDF0DC;   --ps-dom-procedure: #8A4508;
  --ps-dom-measurement-bg: #F1ECFB; --ps-dom-measurement: #4F38A0;
  --ps-dom-observation-bg: #EEF0F2; --ps-dom-observation: #3B4752;
  --ps-dom-device-bg: #FBEFF4;      --ps-dom-device: #8A2452;
  --ps-dom-other-bg: #EFF2EE;       --ps-dom-other: #3C4A44;

  /* workspace chrome */
  --ps-chrome: #0F1E18;
  --ps-chrome-2: #16231E;
  --ps-chrome-on: #1B2C25;
  --ps-chrome-line: #233229;
  --ps-chrome-ink: #E7EFEA;
  --ps-chrome-ink-2: #B4C2BB;
  --ps-chrome-ink-3: #8A9991;

  --ps-r-xs: 4px; --ps-r-sm: 6px; --ps-r-md: 10px; --ps-r-lg: 16px; --ps-r-xl: 24px; --ps-r-pill: 999px;
  --ps-s1: 4px; --ps-s2: 8px; --ps-s3: 12px; --ps-s4: 16px; --ps-s5: 24px; --ps-s6: 32px; --ps-s7: 48px; --ps-s8: 64px;
  --ps-shadow-1: 0 1px 2px rgba(15, 30, 24, .08), 0 1px 1px rgba(15, 30, 24, .04);
  --ps-shadow-2: 0 8px 24px rgba(15, 30, 24, .12);
  --ps-shadow-3: 0 24px 48px rgba(15, 30, 24, .18);
  --ps-focus: 0 0 0 3px rgba(14, 122, 75, .28);
  --ps-scrim: rgba(15, 30, 24, .42);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ps-bg: #0B1310; --ps-surface: #111B17; --ps-surface-2: #16231E; --ps-surface-3: #1B2C25; --ps-surface-sunk: #0E1713;
  --ps-line: #233229; --ps-line-soft: #1B2922; --ps-line-strong: #2E4036;
  --ps-ink: #E7EFEA; --ps-ink-2: #B4C2BB; --ps-ink-3: #8A9991; --ps-ink-inverse: #0B1310;
  --ps-brand: #39B97A; --ps-brand-hover: #4CCB8B; --ps-brand-ink: #7DD3A8; --ps-brand-soft: #133325; --ps-brand-line: #24573D;
  --ps-signal: #F2814A; --ps-signal-ink: #F7A57B; --ps-signal-soft: #3A2116;
  --ps-ok: #39B97A; --ps-ok-ink: #7DD3A8; --ps-ok-soft: #133325;
  --ps-info: #6AAEF0; --ps-info-ink: #8FC1F2; --ps-info-soft: #12283D;
  --ps-warn: #E0B634; --ps-warn-ink: #EBC75E; --ps-warn-soft: #33290C;
  --ps-bad: #F07A70; --ps-bad-ink: #F5A39B; --ps-bad-soft: #3A1715;
  --ps-c1: #39B97A; --ps-c2: #6AAEF0; --ps-c3: #F2814A; --ps-c4: #A88BF0; --ps-c5: #E0B634; --ps-c6: #9AAAB3;
  --ps-dom-condition-bg: #12283D; --ps-dom-condition: #8FC1F2;
  --ps-dom-drug-bg: #133325; --ps-dom-drug: #7DD3A8;
  --ps-dom-procedure-bg: #33290C; --ps-dom-procedure: #EBC75E;
  --ps-dom-measurement-bg: #251D3D; --ps-dom-measurement: #C3B1F5;
  --ps-dom-observation-bg: #1C242B; --ps-dom-observation: #B6C3CE;
  --ps-dom-device-bg: #3A1528; --ps-dom-device: #F2A7C8;
  --ps-dom-other-bg: #16231E; --ps-dom-other: #B4C2BB;
  --ps-chrome: #070D0A; --ps-chrome-2: #0E1713; --ps-chrome-on: #16231E; --ps-chrome-line: #1B2922;
  --ps-shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
  --ps-shadow-2: 0 8px 24px rgba(0, 0, 0, .5);
  --ps-shadow-3: 0 24px 48px rgba(0, 0, 0, .6);
  --ps-focus: 0 0 0 3px rgba(57, 185, 122, .35);
  --ps-scrim: rgba(0, 0, 0, .6);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]).ps-auto-theme {
    color-scheme: dark;
    --ps-bg: #0B1310; --ps-surface: #111B17; --ps-surface-2: #16231E; --ps-surface-3: #1B2C25; --ps-surface-sunk: #0E1713;
    --ps-line: #233229; --ps-line-soft: #1B2922; --ps-line-strong: #2E4036;
    --ps-ink: #E7EFEA; --ps-ink-2: #B4C2BB; --ps-ink-3: #8A9991; --ps-ink-inverse: #0B1310;
    --ps-brand: #39B97A; --ps-brand-hover: #4CCB8B; --ps-brand-ink: #7DD3A8; --ps-brand-soft: #133325; --ps-brand-line: #24573D;
    --ps-signal: #F2814A; --ps-signal-ink: #F7A57B; --ps-signal-soft: #3A2116;
    --ps-ok: #39B97A; --ps-ok-ink: #7DD3A8; --ps-ok-soft: #133325;
    --ps-info: #6AAEF0; --ps-info-ink: #8FC1F2; --ps-info-soft: #12283D;
    --ps-warn: #E0B634; --ps-warn-ink: #EBC75E; --ps-warn-soft: #33290C;
    --ps-bad: #F07A70; --ps-bad-ink: #F5A39B; --ps-bad-soft: #3A1715;
    --ps-chrome: #070D0A; --ps-chrome-2: #0E1713; --ps-chrome-on: #16231E; --ps-chrome-line: #1B2922;
  }
}

/* ---- base ------------------------------------------------------------------------------- */
.ps-ui, .ps-ui *, .ps-ui *::before, .ps-ui *::after { box-sizing: border-box; }
.ps-ui { font-family: var(--ps-font); font-size: 14px; line-height: 1.5; color: var(--ps-ink); -webkit-font-smoothing: antialiased; }
.ps-ui :focus-visible { outline: none; box-shadow: var(--ps-focus); border-radius: var(--ps-r-sm); }
.ps-mono { font-family: var(--ps-font-mono); }
.ps-read { font-family: var(--ps-font-read); }
.ps-muted { color: var(--ps-ink-3); }
.ps-eyebrow { font: 600 11.5px/1 var(--ps-font); letter-spacing: .09em; text-transform: uppercase; color: var(--ps-ink-3); }
.ps-h1 { margin: 0; font: 740 32px/1.1 var(--ps-font); letter-spacing: -.022em; }
.ps-h2 { margin: 0; font: 690 22px/1.2 var(--ps-font); letter-spacing: -.015em; }
.ps-h3 { margin: 0; font: 650 16px/1.3 var(--ps-font); }
.ps-lead { margin: 0; font-size: 14.5px; line-height: 1.55; color: var(--ps-ink-3); }
.ps-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ps-link { color: var(--ps-brand); font-weight: 600; text-decoration: none; }
.ps-link:hover { color: var(--ps-brand-hover); text-decoration: underline; }
.ps-stack { display: flex; flex-direction: column; gap: var(--ps-s4); }
.ps-row { display: flex; align-items: center; gap: var(--ps-s3); flex-wrap: wrap; }
.ps-spacer { flex: 1; }
.ps-grid { display: grid; gap: var(--ps-s4); grid-template-columns: repeat(auto-fit, minmax(min(var(--ps-col, 260px), 100%), 1fr)); }

/* ---- buttons ---------------------------------------------------------------------------- */
.ps-btn { font: 600 14px/1 var(--ps-font); height: 40px; padding: 0 16px; border-radius: var(--ps-r-md); border: 1px solid transparent; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s, color .12s; user-select: none; }
.ps-btn:disabled, .ps-btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.ps-btn svg { flex: none; }
.ps-btn--primary { background: var(--ps-brand); color: #fff; }
.ps-btn--primary:hover:not(:disabled) { background: var(--ps-brand-hover); }
:root[data-theme="dark"] .ps-btn--primary { color: #06120C; }
.ps-btn--secondary { background: var(--ps-surface); color: var(--ps-ink); border-color: var(--ps-line-strong); }
.ps-btn--secondary:hover:not(:disabled) { background: var(--ps-surface-2); }
.ps-btn--ghost { background: transparent; color: var(--ps-brand); }
.ps-btn--ghost:hover:not(:disabled) { background: var(--ps-brand-soft); }
.ps-btn--quiet { background: transparent; color: var(--ps-ink-2); }
.ps-btn--quiet:hover:not(:disabled) { background: var(--ps-surface-2); color: var(--ps-ink); }
.ps-btn--dark { background: var(--ps-ink); color: var(--ps-ink-inverse); }
.ps-btn--danger { background: var(--ps-surface); color: var(--ps-bad); border-color: color-mix(in srgb, var(--ps-bad) 30%, transparent); }
.ps-btn--danger:hover:not(:disabled) { background: var(--ps-bad-soft); }
.ps-btn--sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.ps-btn--xs { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 7px; gap: 6px; }
.ps-btn--lg { height: 48px; padding: 0 22px; font-size: 16px; border-radius: 12px; }
.ps-btn--icon { width: 40px; padding: 0; }
.ps-btn--icon.ps-btn--sm { width: 32px; }
.ps-btn.is-busy { position: relative; color: transparent !important; }
.ps-btn.is-busy::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-color: rgba(255,255,255,.5) rgba(255,255,255,.5) #fff #fff; animation: ps-spin .7s linear infinite; }
.ps-btn--secondary.is-busy::after { border-color: var(--ps-line-strong) var(--ps-line-strong) var(--ps-ink) var(--ps-ink); }
@keyframes ps-spin { to { transform: rotate(360deg); } }

/* ---- forms ------------------------------------------------------------------------------ */
.ps-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ps-label { font: 600 13px/1.3 var(--ps-font); color: var(--ps-ink); }
.ps-help { font: 400 12.5px/1.45 var(--ps-font); color: var(--ps-ink-3); }
.ps-error-text { font: 500 12.5px/1.45 var(--ps-font); color: var(--ps-bad); }
.ps-input, .ps-select, .ps-textarea { width: 100%; height: 40px; border: 1px solid var(--ps-line-strong); border-radius: var(--ps-r-md); padding: 0 12px; font: 400 14px var(--ps-font); color: var(--ps-ink); background: var(--ps-surface); transition: border-color .12s, box-shadow .12s; }
.ps-textarea { height: auto; min-height: 88px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.ps-input:focus, .ps-select:focus, .ps-textarea:focus { outline: none; border-color: var(--ps-brand); box-shadow: var(--ps-focus); }
.ps-input--sm, .ps-select--sm { height: 32px; font-size: 13px; border-radius: 8px; padding: 0 10px; }
.ps-input[aria-invalid="true"] { border-color: var(--ps-bad); }
.ps-input--mono { font-family: var(--ps-font-mono); font-size: 13px; }
.ps-search { position: relative; display: block; }
.ps-search > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ps-ink-3); pointer-events: none; }
.ps-search > .ps-input { padding-left: 36px; }
.ps-secret { position: relative; }
.ps-secret > .ps-input { padding-right: 44px; }
.ps-secret > button { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border: 0; background: transparent; border-radius: 8px; color: var(--ps-ink-2); cursor: pointer; display: grid; place-items: center; }
.ps-check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.ps-check input { width: 17px; height: 17px; accent-color: var(--ps-brand); margin: 0; }
.ps-switch { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.ps-switch input { appearance: none; -webkit-appearance: none; width: 38px; height: 22px; border-radius: 99px; background: var(--ps-line-strong); position: relative; margin: 0; cursor: pointer; transition: background .15s; flex: none; }
.ps-switch input::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.ps-switch input:checked { background: var(--ps-brand); }
.ps-switch input:checked::after { transform: translateX(16px); }
.ps-switch input:focus-visible { box-shadow: var(--ps-focus); }
.ps-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 16px 20px; }
.ps-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; padding-top: 18px; border-top: 1px solid var(--ps-line-soft); }

/* ---- chips, badges, tags ------------------------------------------------------------------ */
.ps-chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--ps-r-pill); border: 1px solid var(--ps-line-strong); background: var(--ps-surface); font: 500 13px/1 var(--ps-font); color: var(--ps-ink-2); cursor: pointer; white-space: nowrap; }
.ps-chip:hover { border-color: var(--ps-ink-3); color: var(--ps-ink); }
.ps-chip[aria-pressed="true"], .ps-chip.is-on { background: var(--ps-ink); border-color: var(--ps-ink); color: var(--ps-ink-inverse); }
.ps-chip .ps-count { font-family: var(--ps-font-mono); font-size: 11.5px; opacity: .75; }
.ps-badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: var(--ps-r-pill); font: 600 12px/1 var(--ps-font); white-space: nowrap; background: var(--ps-surface-2); color: var(--ps-ink-2); }
.ps-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ps-muted); }
.ps-badge--plain::before { display: none; }
.ps-badge--ok { background: var(--ps-ok-soft); color: var(--ps-ok-ink); } .ps-badge--ok::before { background: var(--ps-ok); }
.ps-badge--info, .ps-badge--run { background: var(--ps-info-soft); color: var(--ps-info-ink); } .ps-badge--info::before, .ps-badge--run::before { background: var(--ps-info); }
.ps-badge--run::before { animation: ps-pulse 1.4s ease-in-out infinite; }
.ps-badge--warn { background: var(--ps-warn-soft); color: var(--ps-warn-ink); } .ps-badge--warn::before { background: var(--ps-warn); }
.ps-badge--bad { background: var(--ps-bad-soft); color: var(--ps-bad-ink); } .ps-badge--bad::before { background: var(--ps-bad); }
.ps-badge--signal { background: var(--ps-signal-soft); color: var(--ps-signal-ink); } .ps-badge--signal::before { background: var(--ps-signal); }
.ps-badge--strike { text-decoration: line-through; color: var(--ps-ink-3); } .ps-badge--strike::before { display: none; }
@keyframes ps-pulse { 50% { opacity: .35; } }
.ps-tag { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: var(--ps-r-sm); font: 600 11.5px/1 var(--ps-font-mono); background: var(--ps-surface-2); color: var(--ps-ink-2); white-space: nowrap; }
.ps-tag--std { background: var(--ps-ink); color: var(--ps-ink-inverse); }
.ps-tag--nonstd { background: transparent; border: 1px dashed var(--ps-line-strong); color: var(--ps-ink-3); }
.ps-count-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 99px; background: var(--ps-signal); color: #fff; font: 700 11px/1 var(--ps-font); }
.ps-dom { display: inline-flex; align-items: center; font: 600 10.5px/1 var(--ps-font); letter-spacing: .04em; padding: 4px 6px; border-radius: 5px; text-transform: uppercase; background: var(--ps-dom-other-bg); color: var(--ps-dom-other); white-space: nowrap; }
.ps-dom--condition { background: var(--ps-dom-condition-bg); color: var(--ps-dom-condition); }
.ps-dom--drug { background: var(--ps-dom-drug-bg); color: var(--ps-dom-drug); }
.ps-dom--procedure { background: var(--ps-dom-procedure-bg); color: var(--ps-dom-procedure); }
.ps-dom--measurement { background: var(--ps-dom-measurement-bg); color: var(--ps-dom-measurement); }
.ps-dom--observation { background: var(--ps-dom-observation-bg); color: var(--ps-dom-observation); }
.ps-dom--device { background: var(--ps-dom-device-bg); color: var(--ps-dom-device); }
.ps-concept { display: inline-flex; align-items: center; gap: 8px; padding: 5px 9px 5px 6px; border-radius: 8px; background: var(--ps-surface-sunk); border: 1px solid var(--ps-line-soft); font-size: 13.5px; max-width: 100%; min-width: 0; }
.ps-concept > .ps-mono { font-size: 12px; color: var(--ps-ink-3); }

/* ---- surfaces ------------------------------------------------------------------------------ */
.ps-card { background: var(--ps-surface); border: 1px solid var(--ps-line); border-radius: var(--ps-r-lg); padding: 24px; display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.ps-panel { background: var(--ps-surface); border: 1px solid var(--ps-line); border-radius: var(--ps-r-lg); min-width: 0; }
.ps-panel__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--ps-line-soft); flex-wrap: wrap; }
.ps-panel__head h2, .ps-panel__head h3 { margin: 0; font: 650 15.5px/1.25 var(--ps-font); }
.ps-panel__body { padding: 16px 20px; }
.ps-panel__foot { padding: 12px 20px; border-top: 1px solid var(--ps-line-soft); display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--ps-ink-3); }
.ps-tile { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--ps-surface); border: 1px solid var(--ps-line); font-family: var(--ps-font); color: var(--ps-ink); text-align: left; min-width: 0; }
button.ps-tile { cursor: pointer; }
.ps-tile[aria-pressed="true"] { border: 1.5px solid var(--ps-ink); }
.ps-tile__label { font-size: 12.5px; color: var(--ps-ink-3); display: inline-flex; align-items: center; gap: 6px; }
.ps-tile__value { font-size: 24px; font-weight: 720; letter-spacing: -.02em; line-height: 1.1; }
.ps-tile__dot { width: 7px; height: 7px; border-radius: 50%; }
.ps-kv { display: grid; grid-template-columns: minmax(110px, max-content) minmax(0, 1fr); gap: 8px 16px; margin: 0; font-size: 13.5px; }
.ps-kv dt { color: var(--ps-ink-3); }
.ps-kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.ps-divider { height: 1px; background: var(--ps-line-soft); border: 0; margin: 0; }

/* ---- tabs and segmented control ----------------------------------------------------------- */
.ps-tabs { display: flex; gap: 26px; flex-wrap: wrap; border-bottom: 1px solid var(--ps-line); }
.ps-tab { padding: 13px 2px; font: 500 14px/1 var(--ps-font); color: var(--ps-ink-3); border: 0; border-bottom: 2px solid transparent; background: none; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; margin-bottom: -1px; }
.ps-tab:hover { color: var(--ps-ink); }
.ps-tab[aria-selected="true"], .ps-tab.is-on { color: var(--ps-ink); font-weight: 650; border-bottom-color: var(--ps-brand); }
.ps-seg { display: inline-flex; background: var(--ps-surface-2); border-radius: var(--ps-r-md); padding: 3px; gap: 2px; }
.ps-seg > button { padding: 7px 13px; border-radius: 8px; border: 0; background: transparent; font: 500 13px var(--ps-font); color: var(--ps-ink-2); cursor: pointer; }
.ps-seg > button[aria-pressed="true"] { background: var(--ps-surface); color: var(--ps-ink); font-weight: 600; box-shadow: var(--ps-shadow-1); }

/* ---- tables -------------------------------------------------------------------------------- */
.ps-table-wrap { overflow-x: auto; }
.ps-table { width: 100%; border-collapse: collapse; font: 400 14px/1.4 var(--ps-font); color: var(--ps-ink); }
.ps-table th { text-align: left; font: 600 12px/1 var(--ps-font); color: var(--ps-ink-3); padding: 11px 12px; border-bottom: 1px solid var(--ps-line); background: var(--ps-surface-sunk); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.ps-table td { padding: 12px; border-bottom: 1px solid var(--ps-line-soft); vertical-align: top; }
.ps-table tbody tr:hover { background: var(--ps-surface-sunk); }
.ps-table tr.is-selected { background: color-mix(in srgb, var(--ps-brand-soft) 60%, transparent); }
.ps-table--dense td { padding: 8px 12px; font-size: 13px; }
.ps-table .ps-num { text-align: right; font-family: var(--ps-font-mono); font-size: 13px; white-space: nowrap; }
.ps-table th.ps-num { font-family: var(--ps-font); }
.ps-table a { color: inherit; }
.ps-table a:hover { color: var(--ps-brand); }

/* ---- feedback ------------------------------------------------------------------------------ */
.ps-callout { display: flex; gap: 14px; padding: 14px 16px; border-radius: 12px; background: var(--ps-info-soft); color: var(--ps-info-ink); font-size: 13.5px; line-height: 1.5; }
.ps-callout > svg { flex: none; margin-top: 1px; }
.ps-callout strong { display: block; font-size: 14px; margin-bottom: 2px; }
.ps-callout--ok { background: var(--ps-ok-soft); color: var(--ps-ok-ink); }
.ps-callout--warn { background: var(--ps-warn-soft); color: var(--ps-warn-ink); }
.ps-callout--bad { background: var(--ps-bad-soft); color: var(--ps-bad-ink); }
.ps-callout--signal { background: var(--ps-signal-soft); color: var(--ps-signal-ink); }
.ps-toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 1000; max-width: min(420px, calc(100vw - 40px)); }
.ps-toast { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-radius: 12px; background: var(--ps-chrome); color: #fff; box-shadow: var(--ps-shadow-3); font-size: 14px; animation: ps-in .18s ease-out; }
.ps-toast--bad { background: #7A1212; }
.ps-toast button { margin-left: auto; background: none; border: 0; color: #7DD3A8; font: 600 13px var(--ps-font); cursor: pointer; }
@keyframes ps-in { from { transform: translateY(8px); opacity: 0; } }
.ps-progress { height: 6px; border-radius: 99px; background: var(--ps-surface-3); overflow: hidden; }
.ps-progress > span { display: block; height: 100%; border-radius: 99px; background: var(--ps-brand); transition: width .3s; }
.ps-progress--info > span { background: var(--ps-info); }
.ps-progress--indeterminate > span { width: 40% !important; animation: ps-indet 1.2s ease-in-out infinite; }
@keyframes ps-indet { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.ps-stackbar { height: 5px; border-radius: 99px; background: var(--ps-surface-3); display: flex; overflow: hidden; }
.ps-spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--ps-line-strong); border-top-color: var(--ps-brand); animation: ps-spin .7s linear infinite; display: inline-block; }
.ps-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 48px 24px; color: var(--ps-ink-3); font-size: 14px; }
.ps-empty strong { color: var(--ps-ink); font-size: 16px; }
.ps-skeleton { background: linear-gradient(90deg, var(--ps-surface-2), var(--ps-surface-3), var(--ps-surface-2)); background-size: 200% 100%; animation: ps-shimmer 1.2s linear infinite; border-radius: 6px; min-height: 12px; }
@keyframes ps-shimmer { to { background-position: -200% 0; } }

/* ---- avatars --------------------------------------------------------------------------------- */
.ps-avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; font: 700 12px/1 var(--ps-font); color: #fff; background: var(--ps-brand); flex: none; overflow: hidden; }
.ps-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ps-avatar--sm { width: 26px; height: 26px; font-size: 10.5px; }
.ps-avatar--lg { width: 44px; height: 44px; font-size: 15px; }

/* ---- overlays: menu, modal, drawer -------------------------------------------------------------- */
.ps-menu { position: absolute; z-index: 900; min-width: 200px; background: var(--ps-surface); border: 1px solid var(--ps-line); border-radius: 12px; box-shadow: var(--ps-shadow-2); padding: 6px; display: flex; flex-direction: column; }
.ps-menu > button, .ps-menu > a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; border: 0; background: none; font: 500 13.5px var(--ps-font); color: var(--ps-ink); text-align: left; cursor: pointer; text-decoration: none; }
.ps-menu > button:hover, .ps-menu > a:hover, .ps-menu > .is-active { background: var(--ps-surface-2); }
.ps-menu > .ps-menu__danger { color: var(--ps-bad); }
.ps-scrim { position: fixed; inset: 0; background: var(--ps-scrim); z-index: 950; display: grid; place-items: center; padding: 20px; animation: ps-fade .15s ease-out; }
@keyframes ps-fade { from { opacity: 0; } }
.ps-modal { width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--ps-surface); border-radius: 18px; box-shadow: var(--ps-shadow-3); display: flex; flex-direction: column; }
.ps-modal--wide { width: min(880px, 100%); }
.ps-modal__head { padding: 20px 24px 8px; display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.ps-modal__head h2 { margin: 0; font: 690 19px/1.25 var(--ps-font); }
.ps-modal__body { padding: 8px 24px 20px; display: flex; flex-direction: column; gap: 16px; }
.ps-modal__foot { padding: 16px 24px; border-top: 1px solid var(--ps-line-soft); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.ps-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--ps-surface); box-shadow: var(--ps-shadow-3); z-index: 960; display: flex; flex-direction: column; animation: ps-slide .2s ease-out; }
.ps-drawer--wide { width: min(880px, 100vw); }
@keyframes ps-slide { from { transform: translateX(24px); opacity: 0; } }
.ps-drawer__head { padding: 18px 22px; border-bottom: 1px solid var(--ps-line-soft); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.ps-drawer__body { flex: 1; overflow: auto; padding: 18px 22px; display: flex; flex-direction: column; gap: 16px; }
.ps-drawer__foot { padding: 14px 22px; border-top: 1px solid var(--ps-line-soft); display: flex; justify-content: flex-end; gap: 10px; }
.ps-code { font-family: var(--ps-font-mono); font-size: 12.5px; line-height: 1.6; background: var(--ps-surface-sunk); border: 1px solid var(--ps-line-soft); border-radius: 10px; padding: 12px 14px; overflow: auto; white-space: pre; color: var(--ps-ink); }
.ps-log { font-family: var(--ps-font-mono); font-size: 12px; line-height: 1.55; background: #0B1310; color: #CFE0D6; border-radius: 12px; padding: 14px 16px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.ps-log .is-err { color: #F5A39B; } .ps-log .is-warn { color: #EBC75E; } .ps-log .is-dim { color: #6E7F77; }

/* ---- workspace shell ---------------------------------------------------------------------------- */
.ps-shell { display: flex; min-height: 100vh; background: var(--ps-bg); }
.ps-sidebar { flex: 0 0 256px; background: var(--ps-chrome); color: var(--ps-chrome-ink); padding: 18px 14px; display: flex; flex-direction: column; gap: 3px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.ps-sidebar__brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; color: var(--ps-chrome-ink); text-decoration: none; }
.ps-sidebar__mark { width: 34px; height: 34px; border-radius: 10px; background: var(--ps-brand); display: grid; place-items: center; color: #fff; flex: none; }
.ps-sidebar__name { font-weight: 750; font-size: 16px; letter-spacing: -.01em; line-height: 1.1; }
.ps-sidebar__sub { font-size: 12px; color: var(--ps-chrome-ink-3); }
.ps-nav-h { font: 600 11px/1 var(--ps-font); letter-spacing: .1em; text-transform: uppercase; color: #6E7F77; padding: 18px 12px 8px; }
.ps-nav-i { display: flex; align-items: center; gap: 12px; min-height: 38px; padding: 0 12px; border-radius: 9px; font: 500 14px/1.2 var(--ps-font); color: var(--ps-chrome-ink-2); text-decoration: none; }
.ps-nav-i:hover { background: var(--ps-chrome-2); color: #fff; }
.ps-nav-i.is-on, .ps-nav-i[aria-current="page"] { background: var(--ps-chrome-on); color: #fff; font-weight: 600; }
.ps-nav-i.is-soon { color: #6E7F77; pointer-events: none; }
.ps-nav-i .ps-count-pill { margin-left: auto; }
.ps-nav-i .ps-soon { margin-left: auto; font-size: 11px; color: #6E7F77; }
.ps-sidebar__user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 14px 10px 4px; border-top: 1px solid var(--ps-chrome-line); }
.ps-rail { flex: 0 0 68px; background: var(--ps-chrome); display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 0; position: sticky; top: 0; height: 100vh; }
.ps-rail a { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; color: var(--ps-chrome-ink-3); }
.ps-rail a:hover { background: var(--ps-chrome-2); color: #fff; }
.ps-rail a.is-on, .ps-rail a[aria-current="page"] { background: var(--ps-chrome-on); color: #fff; }
.ps-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ps-topbar { display: flex; align-items: center; gap: 16px; padding: 14px 32px; border-bottom: 1px solid var(--ps-line); background: var(--ps-bg); flex-wrap: wrap; position: sticky; top: 0; z-index: 50; }
.ps-crumbs { font-size: 14px; color: var(--ps-ink-3); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ps-crumbs a { color: var(--ps-ink-3); text-decoration: none; }
.ps-crumbs a:hover { color: var(--ps-brand); }
.ps-crumbs strong { color: var(--ps-ink); font-weight: 600; }
.ps-page { padding: 28px 32px 48px; display: flex; flex-direction: column; gap: 24px; width: 100%; max-width: 1280px; }
.ps-page--wide { max-width: none; }
.ps-page__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.ps-page__title { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ps-toolhead { background: var(--ps-surface); border-bottom: 1px solid var(--ps-line); padding: 0 28px; }
.ps-toolhead__row { display: flex; align-items: center; gap: 16px; padding: 16px 0 4px; flex-wrap: wrap; }
.ps-toolhead__row h1 { margin: 0; font: 740 22px/1.15 var(--ps-font); letter-spacing: -.015em; }
.ps-toolhead .ps-tabs { border-bottom: 0; }
.ps-split { display: flex; flex-wrap: wrap; align-items: stretch; }
.ps-split__side { flex: 1 1 260px; max-width: 300px; padding: 20px 16px; border-right: 1px solid var(--ps-line); }
.ps-split__main { flex: 999 1 640px; min-width: 0; padding: 22px 28px 28px; display: flex; flex-direction: column; gap: 18px; }
.ps-selectionbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--ps-chrome); color: #fff; flex-wrap: wrap; }
.ps-selectionbar .ps-btn--xs, .ps-selectionbar .ps-btn--sm { background: var(--ps-chrome-on); color: #fff; }
.ps-selectionbar .ps-btn--primary { background: var(--ps-brand); }

@media (max-width: 900px) {
  .ps-sidebar { position: static; height: auto; flex-basis: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .ps-sidebar .ps-nav-h, .ps-sidebar__user { display: none; }
  .ps-shell { flex-direction: column; }
  .ps-rail { position: static; height: auto; flex-direction: row; width: 100%; padding: 8px 12px; }
  .ps-page, .ps-topbar, .ps-toolhead { padding-left: 16px; padding-right: 16px; }
  .ps-split__side { max-width: none; border-right: 0; border-bottom: 1px solid var(--ps-line); }
}

@media (prefers-reduced-motion: reduce) {
  .ps-ui *, .ps-ui *::before, .ps-ui *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media print {
  .ps-sidebar, .ps-rail, .ps-topbar, .ps-toasts { display: none !important; }
  .ps-shell { display: block; }
}
