/* Every colour, size and font the portal uses. Values from docs/design/DESIGN.md. */
:root {
  /* Structure. Since 28 Nov (B608, B609) the app sits on UpGuard's cool light grey behind white sheets and cards
     with a neutral rule; public pages and long reading stay white. */
  --page: #ffffff;
  --canvas: #f4f5f7;
  --card: #ffffff;
  --card-rule: #e3e6eb;
  --rule-strong: #d0d5dd;

  /* The reader's sidebar (B608, B614, B615): a filled dark slate-navy, white text and icons; the active item a
     lighter step of the same hue, hover a step between. No edge or stripe. The admin has its own neutral sidebar
     (.adm below). Contrast: white on --nav-active 11.8:1, --nav-ink-2 on --nav-bg 10.6:1, --nav-ink-3 on --nav-bg
     6.3:1 and on --nav-active 5.0:1. */
  --nav-bg: #1d283c;
  --nav-hover: #243149;
  --nav-active: #2b3851;
  --nav-ink: #ffffff;
  --nav-ink-2: #d5dbe6;
  --nav-ink-3: #9eaac0;
  --nav-rule: rgba(255, 255, 255, .14);
  --sidebar: var(--nav-bg);
  --sidebar-active: var(--nav-active);
  --sand-rule: #ebe7de;
  --rule: #eceef1;
  --quiet: #f7f8fa;
  --hover: rgba(14, 23, 38, .06);

  /* Filters and sorting (B271 to B273): a chip's neutral border, the active chip's light tint */
  --filter-rule: #d0d5dd;
  --filter-on-bg: #eef3f8;
  --filter-on-fg: #16375a;
  --filter-h: 34px;

  /* Ink */
  --ink: #0e1726;
  --ink-2: #344054;
  --ink-3: #5d6878;
  --body: #1d2636;

  /* Accent */
  --accent: #24507a;
  --accent-hover: #16375a;
  --accent-fill: #eef3f8;
  --accent-fill-2: #e7eef5;
  --on-accent: #ffffff;   /* text on a solid --accent fill: buttons, counters (B781) */

  /* Chips: fill / text */
  --chip-theme-bg: #d8e7f2;   --chip-theme-fg: #215074;
  --chip-nordic-bg: #d3e9e5;  --chip-nordic-fg: #20564f;
  --chip-eu-bg: #ebe9c4;      --chip-eu-fg: #54531c;
  --chip-actor-bg: #ebe0ee;   --chip-actor-fg: #5c3c67;
  --chip-week-bg: #e1eeda;    --chip-week-fg: #3a6329;
  --chip-neutral-bg: #f1f3f5; --chip-neutral-fg: #344054;

  /* Data */
  --fjord: #25618a;
  --brick: #b83a2a;
  --amber: #a8620f;
  --moss: #4d7a3a;
  --heather: #7a4f8a;

  /* Chart tones (B613), the same family as the admin's: solid hues for marks, light tints for ok/warn/info only.
     Red never gets a tint: a light red is pink. */
  --c-ok: #1b7f4e;
  --c-warn: #946a00;
  --c-bad: #c62a2f;
  --c-info: #2b62a3;
  --t-ok: #e3f2e8;
  --t-warn: #f8efd4;
  --t-info: #e8eef9;
  --t-none: #eef0f3;
  --grade-ink: #ffffff;

  /* Type */
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: Consolas, Menlo, monospace;
  --fs-title: 34px;
  --fs-head: 24px;
  --fs-brief-lead: 20px;
  --fs-lead: 18px;
  --fs-list-head: 17px;
  --fs-body: 16px;
  --fs-table: 15px;
  --fs-meta: 14px;
  --fs-label: 13px;
  --fs-small: 12px;
  --leading-read: 1.7; /* long reading: the brief's story text and the source reader */

  /* Layout */
  --sidebar-open: 256px;
  --sidebar-rail: 64px;
  --reading: 720px;
  --reading-wide: 860px;  /* the reading column when the sidebar is a rail (B227) */
  --touch: 44px;
  color-scheme: light;
}

/* The reader's dark theme (B776 to B783, spec 2026-11-28-reader-dark-theme). <html data-theme> comes from the
   server: "auto" (no choice made) follows the computer through the media query, "dark" is the reader's own choice
   from the sidebar's moon or Settings. The two blocks hold the same values; a test keeps them equal. The public
   site, sign-in and the admin render data-theme="light" and never match (B779). */
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    /* Structure: a dark canvas behind a calm dark-grey sheet, never pure black (B780) */
    --page: #1b1e24;
    --canvas: #121418;
    --card: #1b1e24;
    --card-rule: #2c313a;
    --rule-strong: #3a404b;
    --sand-rule: #2c313a;
    --rule: #2a2f37;
    --quiet: #22262d;
    --hover: rgba(230, 235, 245, .06);
    /* The slate sidebar (B615) one step deeper, so it still frames the canvas; white on --nav-bg 16.9:1,
       --nav-ink-3 on --nav-bg 7.2:1 and on --nav-active 5.5:1 */
    --nav-bg: #161d2b;
    --nav-hover: #1d2637;
    --nav-active: #26324a;
    --nav-ink: #ffffff;
    --nav-ink-2: #d5dbe6;
    --nav-ink-3: #9eaac0;
    --nav-rule: rgba(255, 255, 255, .12);
    --filter-rule: #3a404b;
    --filter-on-bg: #1f2b3a;
    --filter-on-fg: #b9d2ee;
    /* Ink on --page: 14.0, 12.3, 10.3 and 6.6 to 1 */
    --ink: #e8ebf0;
    --body: #d9dee5;
    --ink-2: #c5ccd6;
    --ink-3: #9aa3b0;
    /* Links 7.3:1; text on a solid accent is dark ink (--on-accent) */
    --accent: #7fb0e0;
    --accent-hover: #a6c8ec;
    --accent-fill: #1f2b3a;
    --accent-fill-2: #1c2633;
    --on-accent: #0e1726;
    /* Chips: a deep tint of the hue with a light text of the same hue, each pair 7.5:1 or more */
    --chip-theme-bg: #1e3346;   --chip-theme-fg: #a9cdea;
    --chip-nordic-bg: #183a35;  --chip-nordic-fg: #9fd6cc;
    --chip-eu-bg: #35341a;      --chip-eu-fg: #dedb9a;
    --chip-actor-bg: #31263a;   --chip-actor-fg: #cfb8e2;
    --chip-week-bg: #233420;    --chip-week-fg: #b5d8a4;
    --chip-neutral-bg: #262a31; --chip-neutral-fg: #c5ccd6;
    /* Data and chart tones: solid hues that hold 4.5:1 on --page as text too; red stays a clear red, never
       salmon, and still never gets a tint */
    --fjord: #58a6ff;
    --brick: #f85149;
    --amber: #d29922;
    --moss: #3fb950;
    --heather: #b392f0;
    --c-ok: #3fb950;
    --c-warn: #d29922;
    --c-bad: #f85149;
    --c-info: #58a6ff;
    --t-ok: #1a3324;
    --t-warn: #3a2f12;
    --t-info: #1d2c42;
    --t-none: #262a31;
    --grade-ink: #0e1726;   /* text on a solid tone: dark ink, 5.6:1 or more on every tone */
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  /* Structure: a dark canvas behind a calm dark-grey sheet, never pure black (B780) */
  --page: #1b1e24;
  --canvas: #121418;
  --card: #1b1e24;
  --card-rule: #2c313a;
  --rule-strong: #3a404b;
  --sand-rule: #2c313a;
  --rule: #2a2f37;
  --quiet: #22262d;
  --hover: rgba(230, 235, 245, .06);
  /* The slate sidebar (B615) one step deeper, so it still frames the canvas; white on --nav-bg 16.9:1,
     --nav-ink-3 on --nav-bg 7.2:1 and on --nav-active 5.5:1 */
  --nav-bg: #161d2b;
  --nav-hover: #1d2637;
  --nav-active: #26324a;
  --nav-ink: #ffffff;
  --nav-ink-2: #d5dbe6;
  --nav-ink-3: #9eaac0;
  --nav-rule: rgba(255, 255, 255, .12);
  --filter-rule: #3a404b;
  --filter-on-bg: #1f2b3a;
  --filter-on-fg: #b9d2ee;
  /* Ink on --page: 14.0, 12.3, 10.3 and 6.6 to 1 */
  --ink: #e8ebf0;
  --body: #d9dee5;
  --ink-2: #c5ccd6;
  --ink-3: #9aa3b0;
  /* Links 7.3:1; text on a solid accent is dark ink (--on-accent) */
  --accent: #7fb0e0;
  --accent-hover: #a6c8ec;
  --accent-fill: #1f2b3a;
  --accent-fill-2: #1c2633;
  --on-accent: #0e1726;
  /* Chips: a deep tint of the hue with a light text of the same hue, each pair 7.5:1 or more */
  --chip-theme-bg: #1e3346;   --chip-theme-fg: #a9cdea;
  --chip-nordic-bg: #183a35;  --chip-nordic-fg: #9fd6cc;
  --chip-eu-bg: #35341a;      --chip-eu-fg: #dedb9a;
  --chip-actor-bg: #31263a;   --chip-actor-fg: #cfb8e2;
  --chip-week-bg: #233420;    --chip-week-fg: #b5d8a4;
  --chip-neutral-bg: #262a31; --chip-neutral-fg: #c5ccd6;
  /* Data and chart tones: solid hues that hold 4.5:1 on --page as text too; red stays a clear red, never
     salmon, and still never gets a tint */
  --fjord: #58a6ff;
  --brick: #f85149;
  --amber: #d29922;
  --moss: #3fb950;
  --heather: #b392f0;
  --c-ok: #3fb950;
  --c-warn: #d29922;
  --c-bad: #f85149;
  --c-info: #58a6ff;
  --t-ok: #1a3324;
  --t-warn: #3a2f12;
  --t-info: #1d2c42;
  --t-none: #262a31;
  --grade-ink: #0e1726;   /* text on a solid tone: dark ink, 5.6:1 or more on every tone */
  color-scheme: dark;
}

/* App v2 (spec docs/specs/2026-12-03-app-v2.md section 4; B2015 to B2017, B2046). Only on <html data-app>, which
   base.html writes while RS_APP is on and a page is a reader page: the public site, sign-in, the 404 page and the
   admin never carry it, and with the switch off no page reads these values. Michael's FAIR direction (light, airy,
   warm) in the names the portal already uses, so every old reader page inside the shell follows without a template
   edit. What does not move over: coloured stripes and borders (borders stay neutral) and the terracotta tint, which
   reads as salmon; red is solid or text, never a fill (there is no --t-bad). The two dark blocks hold the same
   values; a test keeps them equal and keeps a dark value for every light colour. */
:root[data-app] {
  /* Structure: the warm ground, white cards behind a thin warm rule, a very soft shadow */
  --page: #ffffff;
  --canvas: #f7f6f2;
  --card: #ffffff;
  --card-rule: #e3e0d6;
  --rule: #ebe8df;
  --rule-strong: #d6d2c6;
  --sand-rule: #e3e0d6;
  --quiet: #faf9f6;
  --hover: rgba(28, 27, 24, .04);
  --shadow: 0 1px 2px rgba(28, 27, 24, .06), 0 8px 24px rgba(28, 27, 24, .06);
  --radius: 10px;
  --radius-s: 8px;
  /* The light, warm menu (B2016, B2044): the active item on the soft accent, no edge or stripe */
  --nav-bg: #fbfaf7;
  --nav-hover: #f1efe8;
  --nav-active: #e7efeb;
  --nav-ink: #1c1b18;
  --nav-ink-2: #3d3b35;
  --nav-ink-3: #6c6a61;
  --nav-rule: #e3e0d6;
  /* Ink */
  --ink: #1c1b18;
  --body: #26251f;
  --ink-2: #3d3b35;
  --ink-3: #6c6a61;
  /* Accent: deep green */
  --accent: #1b5e4a;
  --accent-hover: #134537;
  --accent-fill: #e7efeb;
  --accent-fill-2: #eef4f1;
  --on-accent: #f5faf7;
  /* Filters */
  --filter-rule: #d6d2c6;
  --filter-on-bg: #e7efeb;
  --filter-on-fg: #134537;
  /* Data: amber and terracotta on data, green for good; bad is solid or text, never a tint */
  --c-ok: #1b5e4a;
  --c-warn: #9a6d10;
  --c-bad: #a03e2e;
  --c-bad-fill: #a03e2e;  /* the same red where it fills an area (B2581) */
  --c-info: #2f5d86;
  --t-ok: #e7efeb;
  --t-warn: #f6ecd6;
  --t-info: #e6edf4;
  --t-none: #efede6;
  --grade-ink: #ffffff;
  /* Type: IBM Plex, self-hosted (fonts/plex.css, B2047) */
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --app-nav: 248px;
  --app-top: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root[data-app][data-theme="auto"] {
    --page: #181c19;
    --canvas: #111412;
    --card: #181c19;
    --card-rule: #2a312d;
    --rule: #252b27;
    --rule-strong: #36403a;
    --sand-rule: #2a312d;
    --quiet: #151916;
    --hover: rgba(231, 235, 232, .05);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    --nav-bg: #141815;
    --nav-hover: #1c221e;
    --nav-active: #1c2c25;
    --nav-ink: #e7ebe8;
    --nav-ink-2: #c9d0cb;
    --nav-ink-3: #9aa39d;
    --nav-rule: #2a312d;
    --ink: #e7ebe8;
    --body: #dde2de;
    --ink-2: #c9d0cb;
    --ink-3: #9aa39d;
    --accent: #63b597;
    --accent-hover: #82c7ad;
    --accent-fill: #1c2c25;
    --accent-fill-2: #18241f;
    --on-accent: #0f1a15;
    --filter-rule: #36403a;
    --filter-on-bg: #1c2c25;
    --filter-on-fg: #a9dcc8;
    --c-ok: #63b597;
    --c-warn: #d8a847;
    --c-bad: #e27d69;
    --c-bad-fill: #cf3030;  /* B2581: #e27d69 read salmon on a filled badge; white on this is 5.1:1 */
    --c-info: #7fb0e0;
    --t-ok: #1c2c25;
    --t-warn: #2c2616;
    --t-info: #1b2633;
    --t-none: #222824;
    --grade-ink: #0f1a15;
    color-scheme: dark;
  }
}
:root[data-app][data-theme="dark"] {
  --page: #181c19;
  --canvas: #111412;
  --card: #181c19;
  --card-rule: #2a312d;
  --rule: #252b27;
  --rule-strong: #36403a;
  --sand-rule: #2a312d;
  --quiet: #151916;
  --hover: rgba(231, 235, 232, .05);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  --nav-bg: #141815;
  --nav-hover: #1c221e;
  --nav-active: #1c2c25;
  --nav-ink: #e7ebe8;
  --nav-ink-2: #c9d0cb;
  --nav-ink-3: #9aa39d;
  --nav-rule: #2a312d;
  --ink: #e7ebe8;
  --body: #dde2de;
  --ink-2: #c9d0cb;
  --ink-3: #9aa39d;
  --accent: #63b597;
  --accent-hover: #82c7ad;
  --accent-fill: #1c2c25;
  --accent-fill-2: #18241f;
  --on-accent: #0f1a15;
  --filter-rule: #36403a;
  --filter-on-bg: #1c2c25;
  --filter-on-fg: #a9dcc8;
  --c-ok: #63b597;
  --c-warn: #d8a847;
  --c-bad: #e27d69;
  --c-bad-fill: #cf3030;  /* B2581: #e27d69 read salmon on a filled badge; white on this is 5.1:1 */
  --c-info: #7fb0e0;
  --t-ok: #1c2c25;
  --t-warn: #2c2616;
  --t-info: #1b2633;
  --t-none: #222824;
  --grade-ink: #0f1a15;
  color-scheme: dark;
}

/* The admin's look (B38, B555, B736 to B741, DESIGN.md "Admin look"). Only on <body class="adm">: the reader never
   sees these. The portal's own names are redefined, so portal.css follows along. Since 28 Nov (Michael: "Lad os
   lade os inspirere 100% af Risk Letters admin UI") the admin wears Risk Letters' exact values, from
   `Risk Letters/admin/src/index.css` (:root and .dark), overturning the UpGuard greys and dark sidebars of B608 to
   B615 for the admin. Geist for words, JetBrains Mono for numbers and the small uppercase card labels, both
   self-hosted under static/fonts/ (OFL), so no third-party request. Structure is warm neutral grey; colour sits on
   data (--c-*) and on small chips (--t-* tints). Red never gets a tint: a light red is pink. The copper primary
   (--primary) is Risk Letters' ring and avatar, solid, never a light tint. Risk Letters' light active menu pill is a
   pale amber (#fff7e6); the admin uses its neutral --sidebar-accent #eef0ee instead, since a pale amber reads as
   peach (B737). No pink, rose, salmon or peach in either theme. */
.adm {
  --font: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  /* Risk Letters' sizes (B738): text-sm 14 px body, tables and menu; 12 px meta (text-xs); 11 px mono labels;
     22 px mono stat values (stat-card.tsx); 15 px section heads (overview.tsx h2) */
  --fs-title: 22px;
  --fs-head: 15px;
  --fs-lead: 15px;
  --fs-body: 14px;
  --fs-table: 14px;
  --fs-meta: 12px;
  --fs-label: 11px;  /* the mono uppercase card labels only */
  --fs-small: 12px;
  --fs-stat: 22px;
  --radius: 12px;    /* --radius: 0.75rem */
  --radius-sm: 6px;
  --touch: 36px;
  --a-nav: 256px;    /* SIDEBAR_WIDTH 16rem */
  --a-top: 48px;     /* the top bar, h-12 */
}
.adm, .adm[data-theme="light"] {
  /* Risk Letters :root (B736) */
  --page: #f7f7f6;          /* --background */
  --canvas: #f7f7f6;
  --card: #ffffff;          /* --card */
  --card-rule: #e7e5e1;     /* --border */
  --rule: #e7e5e1;
  --rule-strong: #e7e5e1;   /* --input */
  --sand-rule: #e7e5e1;
  --quiet: #f0eeea;         /* --muted, --secondary */
  --hover: rgba(28, 27, 25, .04);
  --ink: #1c1b19;           /* --foreground */
  --ink-2: #3b3a36;         /* --sidebar-foreground */
  --ink-3: #6f6b64;         /* --muted-foreground */
  --body: #1c1b19;
  --primary: hsl(22 54% 52%);  /* --primary, --ring: the focus ring and the avatar only */
  --primary-ink: #ffffff;
  /* The sidebar: --sidebar #fbfbfa, --sidebar-border #e7e5e1, --sidebar-foreground #3b3a36; the active pill
     --sidebar-accent #eef0ee with --sidebar-accent-foreground #111111 (B737); hover a lighter neutral step */
  --nav-bg: #fbfbfa;
  --nav-rule: #e7e5e1;
  --nav-hover: #f2f2f0;
  --nav-active: #eef0ee;
  --nav-ink: #111111;
  --nav-ink-2: #3b3a36;
  --nav-ink-3: #77746e;     /* the group labels: --sidebar-foreground at 70 % on --sidebar */
  /* Links: Risk Letters' text-[#1d4ed8] */
  --accent: #1d4ed8;
  --accent-hover: #1e40af;
  --accent-fill: #dbeafe;
  --accent-fill-2: #f0eeea;
  /* Data: the hex values Risk Letters writes in its pages (#15803d, #b45309, #b91c1c, #1d4ed8) and purple-600 */
  --c-ok: #15803d;
  --c-warn: #b45309;
  --c-bad: #b91c1c;         /* --destructive */
  --c-info: #1d4ed8;
  --c-violet: #9333ea;
  /* Chips: Tailwind's -100 tints behind the badges (status-badge.tsx); red has none */
  --t-ok: #dcfce7;
  --t-warn: #fef3c7;
  --t-info: #dbeafe;
  --t-violet: #f3e8ff;
  --t-none: #f0eeea;
  --grade-ink: #ffffff;
  --filter-rule: var(--rule-strong);
  --filter-on-bg: var(--quiet);
  --filter-on-fg: var(--ink);
  --filter-h: 30px;
  --fjord: var(--c-info);
  --moss: var(--c-ok);
  --amber: var(--c-warn);
  --brick: var(--c-bad);
  --heather: var(--c-violet);
  color-scheme: light;
}
/* Risk Letters .dark, exactly (B736): the light theme's warm greys inverted */
.adm[data-theme="dark"] {
  --page: #141311;
  --canvas: #141311;
  --card: #1c1b19;
  --card-rule: #312f2b;
  --rule: #312f2b;
  --rule-strong: #3a3733;
  --sand-rule: #312f2b;
  --quiet: #272522;
  --hover: rgba(236, 235, 232, .04);
  --ink: #ecebe8;
  --ink-2: #d6d3cd;
  --ink-3: #a19d95;
  --body: #ecebe8;
  --primary: hsl(22 60% 60%);
  --primary-ink: #141311;
  --nav-bg: #171614;
  --nav-rule: #312f2b;
  --nav-hover: #222120;
  --nav-active: #2a2926;
  --nav-ink: #f5f5f4;
  --nav-ink-2: #d6d3cd;
  --nav-ink-3: #a19d95;
  --accent: #60a5fa;
  --accent-hover: #93c5fd;
  --accent-fill: #222e41;
  --accent-fill-2: #272522;
  --c-ok: #4ade80;
  --c-warn: #fbbf24;
  --c-bad: #f87171;
  --c-info: #60a5fa;
  --c-violet: #c084fc;
  /* Risk Letters' dark tints: the -500 hue at 18 % on the card */
  --t-ok: #1d3a25;
  --t-warn: #413616;
  --t-info: #222e41;
  --t-violet: #352541;
  --t-none: #272522;
  --grade-ink: #141311;
  --fjord: var(--c-info);
  --moss: var(--c-ok);
  --amber: var(--c-warn);
  --brick: var(--c-bad);
  --heather: var(--c-violet);
  color-scheme: dark;
}
