/* Omilon design tokens (plan/design-retningslinjer.md, chapter 5; kjøring 1, steg 5a, 27.11.2026). Light and dark.
   Two layers. The roles (--om-c-*) are the guidelines' colour table: the Bar, the surface (paper), one accent (petrol)
   for the main button, links, the chosen and the done, red only for recording and danger, uncertain, text, muted text
   and lines. The component tokens the style sheets use (--om-bg, --om-primary, …) point at a role. Dark mode gets its
   own values for the same roles later; they are not decided, so the dark blocks below keep the values the dark theme
   had before the guidelines (no new choice, still WCAG 2.1 AA). Every text pair meets 4.5:1 and every control/focus
   pair 3:1 (PU-02; tests/a11y/contrast.test.ts); colour never carries a meaning alone (status is in words).
   The NEXUS colours (--nx-*) are kept only for the Omilon mark (the brand, not the interface). */
:root {
  /* Roles (chapter 5.2). */
  --om-c-bar: #1E2A2E;
  --om-c-on-bar: #FFFFFF;
  --om-c-surface: #FBFAF7;
  /* The paper one step darker: soft fields (badges, banners, the selected row). */
  --om-c-surface-soft: #F1EEE8;
  --om-c-accent: #0E6B67;
  --om-c-on-accent: #FFFFFF;
  --om-c-danger: #C8423B;
  --om-c-uncertain-bg: #F6E7BF;
  --om-c-uncertain-text: #6B4E0A;
  --om-c-text: #1E2A2E;
  --om-c-text-muted: #5E6A6E;
  --om-c-line: #DDD8CF;

  /* The Omilon mark (logo): NEXUS red accent on a white ring. */
  --nx-red: #B80F2E;
  --nx-navy: #1F2336;
  --nx-gray: #9C9D9F;
  --nx-rose: #BA4C61;
  --nx-blue: #35628B;
  --nx-lg: #E8ECF0;

  --om-bg: var(--om-c-surface);
  --om-surface: var(--om-c-surface);
  --om-text: var(--om-c-text);
  --om-muted: var(--om-c-text-muted);
  --om-line: var(--om-c-line);
  /* Borders that show where a field is (non-text contrast 3:1): the line colour is too light for that. */
  --om-field-line: var(--om-c-text-muted);
  /* The main button (one per window, top right). */
  --om-primary: var(--om-c-accent);
  --om-on-primary: var(--om-c-on-accent);
  --om-focus: var(--om-c-accent);
  /* Focus on the dark Bar: the accent is too dark there, so the Bar's own text colour. */
  --om-focus-on-chrome: var(--om-c-on-bar);
  /* The chosen option (segmented buttons, tabs). */
  --om-selected: var(--om-c-accent);
  --om-on-selected: var(--om-c-on-accent);
  --om-rec: var(--om-c-danger);
  --om-link: var(--om-c-accent);
  /* Soft panels (banners, notes, badges). */
  --om-soft: var(--om-c-surface-soft);
  --om-on-soft: var(--om-c-text);
  /* Errors: red text on the paper (red on the soft paper would be under 4.5:1). */
  --om-err-bg: var(--om-c-surface);
  --om-err-text: var(--om-c-danger);
  /* Warnings and uncertain facts share the uncertain role (yellow, chapter 4.4). */
  --om-warn-bg: var(--om-c-uncertain-bg);
  --om-warn-text: var(--om-c-uncertain-text);
  --om-uncertain-bg: var(--om-c-uncertain-bg);
  --om-uncertain-text: var(--om-c-uncertain-text);
  /* Done («Sendt til EPJ») is the accent. */
  --om-ok-bg: var(--om-c-surface-soft);
  --om-ok-text: var(--om-c-accent);
  /* The dark chrome (the Bar and its menus) in both themes. */
  --om-chrome: var(--om-c-bar);
  --om-on-chrome: var(--om-c-on-bar);
  --om-on-chrome-muted: var(--om-c-line);
  /* Errors on the Bar are said in words; red text would be under 4.5:1 on the Bar. */
  --om-on-chrome-error: var(--om-c-on-bar);
  --om-chrome-line: rgba(255, 255, 255, 0.4);
  /* The Bar (PW-45): flat, quiet white tints behind the icons and the patient chip. */
  --om-chrome-soft: rgba(255, 255, 255, 0.08);
  --om-chrome-sep: rgba(255, 255, 255, 0.14);

  /* Strong colours behind white text (status «failed», the Bar's buttons, admin's primary button). */
  --om-info-strong: var(--om-c-accent);
  --om-danger-strong: var(--om-c-danger);
  --om-on-strong: var(--om-c-on-accent);
  --om-chrome-hover: rgba(255, 255, 255, 0.16);
  /* A QR code is dark on light in both themes, so every camera can read it (PL-24). */
  --om-qr-dark: #1E2A2E;
  --om-qr-light: #FFFFFF;

  /* Type (chapter 5.3): the Windows 11 type ramp in Segoe UI Variable. Every size is in rem, so it follows the user's
     text size (PS-02): 1rem is 14 px on a PC with a mouse and 16 px with touch (density, below). In px at 14:
     caption 12/16 (xs, sm), body 14/20 (md, lg; semibold for labels and section headings), subtitle 20/28 (xl),
     title 28/36 (2xl), and the note itself 15/22 in a serif, the one exception to one font. Never under 12 px. */
  --om-text-xs: 0.8571rem;
  --om-text-sm: 0.8571rem;
  --om-text-md: 1rem;
  --om-text-lg: 1rem;
  --om-text-xl: 1.4286rem;
  --om-text-2xl: 2rem;
  --om-text-note: 1.0714rem;
  /* The large clock of the calm listening view (SPEC-REC-010): readable from a distance. */
  --om-text-clock: 3.5rem;
  --om-leading: 1.4286;
  --om-leading-tight: 1.25;
  --om-leading-caption: 1.3333;
  --om-leading-subtitle: 1.4;
  --om-leading-title: 1.2857;
  --om-leading-note: 1.4667;
  /* Two weights only: semibold for emphasis, never bold, italic or capitals. */
  --om-weight-regular: 400;
  --om-weight-semibold: 600;
  /* Segoe UI Variable on Windows; elsewhere fonts with about the same widths, so nothing is cut (the Bar is narrow). */
  --om-font: "Segoe UI Variable Text", "Segoe UI Variable", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --om-font-display: "Segoe UI Variable Display", "Segoe UI Variable", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --om-font-note: Georgia, "Times New Roman", serif;

  /* Spacing on a 4 px grid (chapter 5.4): 4, 8, 12, 16, 24, 32. */
  --om-space-1: 4px;
  --om-space-2: 8px;
  --om-space-3: 12px;
  --om-space-4: 16px;
  --om-space-5: 24px;
  --om-space-6: 24px;
  --om-space-7: 32px;
  --om-space-8: 32px;

  /* Corners (chapter 5.4): 4 small elements, 8 buttons and fields, 12 panels and menus; the Bar's capsule is round. */
  --om-radius-s: 4px;
  --om-radius-control: 8px;
  --om-radius: 12px;
  --om-radius-pill: 999px;
  /* The Bar is a capsule, round at the ends (4.2, 5.4; PW-47: the Windows client draws the same, BarShape). */
  --om-radius-bar: 999px;
  /* Thin lines separate; no heavy shadows, only a faint one under menus. */
  --om-shadow: 0 1px 2px rgba(30, 42, 46, 0.06);
  --om-shadow-raised: 0 8px 16px rgba(30, 42, 46, 0.14);
  --om-shadow-up: 0 -1px 0 rgba(30, 42, 46, 0.08);
  /* Motion (chapter 5.6): 150–300 ms, starting and ending softly; nothing blinks. */
  --om-dur-fast: 150ms;
  --om-dur: 200ms;
  --om-dur-slow: 300ms;
  /* The recording dot breathes slowly: calm, not alarming. */
  --om-dur-breath: 2400ms;
  --om-ease: cubic-bezier(0.45, 0, 0.55, 1);

  /* Density. Touch (the default) keeps 16 px text and 44 px controls (RULE-12); only a mouse makes it compact, below.
     Both are above the guidelines' smallest target (32 × 32). */
  --om-root-text: 100%;
  --om-touch: 44px;
  font-family: var(--om-font);
  font-size: var(--om-root-text);
  line-height: var(--om-leading);
  color: var(--om-text);
  background: var(--om-bg);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    /* Until dark values for the roles are decided (chapter 5.2), dark mode keeps the colours it had before. */
    --om-primary: #B80F2E;
    --om-focus: #BA4C61;
    --om-focus-on-chrome: #BA4C61;
    --om-rec: #BA4C61;
    --om-uncertain-bg: #3D2C0A;
    --om-uncertain-text: #FFD99A;
    --om-chrome: #1F2336;
    --om-on-chrome-muted: #B0B1B2;
    --om-on-chrome-error: #FFD3DA;
    --om-info-strong: #35628B;
    --om-danger-strong: #B80F2E;
    --om-bg: #14161F;
    --om-surface: #1F2336;
    --om-text: #EEF1F5;
    --om-muted: #A9B0C2;
    --om-line: #2E3348;
    --om-field-line: #7A83A0;
    --om-link: #A9BEE6;
    --om-soft: #2A3047;
    --om-on-soft: #EEF1F5;
    --om-selected: #EEF1F5;
    --om-on-selected: #1F2336;
    --om-err-bg: #4A1622;
    --om-err-text: #FFC9D2;
    --om-warn-bg: #3D2C0A;
    --om-warn-text: #FFD99A;
    --om-ok-bg: #12331F;
    --om-ok-text: #A8E0B8;
    --om-qr-dark: #1E2A2E;
    --om-qr-light: #FFFFFF;
    --om-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
    --om-shadow-raised: 0 12px 32px rgba(0, 0, 0, 0.5);
    --om-shadow-up: 0 -8px 10px -8px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  /* Until dark values for the roles are decided (chapter 5.2), dark mode keeps the colours it had before. */
  --om-primary: #B80F2E;
  --om-focus: #BA4C61;
  --om-focus-on-chrome: #BA4C61;
  --om-rec: #BA4C61;
  --om-uncertain-bg: #3D2C0A;
  --om-uncertain-text: #FFD99A;
  --om-chrome: #1F2336;
  --om-on-chrome-muted: #B0B1B2;
  --om-on-chrome-error: #FFD3DA;
  --om-info-strong: #35628B;
  --om-danger-strong: #B80F2E;
  --om-bg: #14161F;
  --om-surface: #1F2336;
  --om-text: #EEF1F5;
  --om-muted: #A9B0C2;
  --om-line: #2E3348;
  --om-field-line: #7A83A0;
  --om-link: #A9BEE6;
  --om-soft: #2A3047;
  --om-on-soft: #EEF1F5;
  --om-selected: #EEF1F5;
  --om-on-selected: #1F2336;
  --om-err-bg: #4A1622;
  --om-err-text: #FFC9D2;
  --om-warn-bg: #3D2C0A;
  --om-warn-text: #FFD99A;
  --om-ok-bg: #12331F;
  --om-ok-text: #A8E0B8;
  --om-qr-dark: #1E2A2E;
  --om-qr-light: #FFFFFF;
  --om-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  --om-shadow-raised: 0 12px 32px rgba(0, 0, 0, 0.5);
  --om-shadow-up: 0 -8px 10px -8px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}
/* Compact on a PC (SPEC-NFR-DESIGN-002, PS-09): with a mouse or touchpad as the main input, the root text is 87.5 %
   (14 px at the default font, and it still follows the user's font setting, since every text size is in rem) and
   controls are 36 px, close to the prototype. A phone or tablet (pointer: coarse) never gets here. */
@media (pointer: fine) {
  :root {
    --om-root-text: 87.5%;
    --om-touch: 36px;
  }
}
html, body { margin: 0; height: 100%; background: var(--om-bg); }
/* ONE scroll surface per view: the view's <main> scrolls, nothing inside it does (see shared/layout.ts). */
body { overflow: hidden; }
button { min-height: var(--om-touch); min-width: var(--om-touch); font: inherit; }
/* Two weights (chapter 5.3): emphasis and headings are semibold, never bold; titles from 20 px use the display cut. */
strong, b, h1, h2, h3, h4, h5, h6, th { font-weight: var(--om-weight-semibold); }
h1, h2 { font-family: var(--om-font-display); }

/* Visible focus on every control, in every app (PU-05). */
:where(a[href], button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--om-focus);
  outline-offset: 2px;
}

/* Text only for screen readers (shared/announce.ts and labels that are shown as icons). */
.om-sr, .om-sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* «Reduce motion» in the operating system: nothing pulses or slides (PU-10). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
