/* theme.css — branding / visual theme overrides (colors, fonts, logo accents).
   Loaded last so it wins the cascade for theme-related properties.

   This file is also the single home for DESIGN TOKENS. See docs/DESIGN_GUIDELINES.md §4.

   Why tokens live in the last-loaded stylesheet: custom properties resolve at
   computed-value time, not at parse time, so a var(--ecr-*) reference made in
   site.css still picks up a definition written here. That keeps every value —
   and therefore every per-tenant reskin — in one file.

   Values below were extracted verbatim from the rules already in site.css; they
   are DEFINITIONS ONLY and change nothing on screen. Adopt them incrementally:
   when you next touch a rule that hard-codes one of these literals, swap it for
   the var(). Per docs/DESIGN_GUIDELINES.md D-TOK-01, a NEW color/spacing/font-size value must
   be added here as a token rather than hard-coded at the point of use. */

:root {

    /* ── Brand ──────────────────────────────────────────────────────────── */
    --ecr-brand-accent: #41b5e8;    /* navbar gradient end, brand blue */
    --ecr-brand-fade: #ffffff;      /* navbar gradient start */
    --ecr-brand-gradient: linear-gradient(90deg, var(--ecr-brand-fade) 0%, var(--ecr-brand-accent) 100%);

    /* ── Ink ────────────────────────────────────────────────────────────── */
    --ecr-ink: #111;                /* body/menu text — WCAG AA on all surfaces below */
    --ecr-ink-inverse: #fff;        /* text on --ecr-surface-inverse */
    --ecr-ink-interactive: orangered; /* link and nav-item hover */

    /* ── Surfaces ───────────────────────────────────────────────────────── */
    --ecr-surface-menu: #e8e8e8;         /* level-1 dropdown */
    --ecr-surface-menu-nested: #a8a8a8;  /* level-2 submenu */
    --ecr-surface-inverse: #111;         /* open dropdown toggle in navbar */
    --ecr-modal-backdrop: rgba(0, 0, 0, 0.3); /* sign-in dialog: wash over the page behind it */
    --ecr-modal-backdrop-blur: 6px;   /* sign-in dialog: higher is blurrier. See docs/TODO.md, Privacy */
    --ecr-modal-header-bg: var(--ecr-brand-accent);          /* sign-in dialog header background */

    /* ── Borders ────────────────────────────────────────────────────────── */
    --ecr-border-menu: #bbb;
    --ecr-border-menu-nested: #888;

    /* ── Selection / highlight ──────────────────────────────────────────── */
    /* Menu highlight is a light wash with an outline, not a dark fill: the
       label must stay dark-on-light so the open branch is legible (D-LEG-01) and
       the current position stays visible (D-VIS-04). See the bad/good menu pair
       in docs/DESIGN_GUIDELINES.md §3.                  */
    --ecr-highlight-bg: #f5f0c8;
    --ecr-highlight-outline: #c8b850;
    --ecr-highlight-bg-footer: khaki;

    /* ── Spacing ────────────────────────────────────────────────────────── */
    --ecr-space-inline: 10px;       /* nav-link horizontal padding, --gap */
    --ecr-space-submenu-offset: 14px; /* level-2 submenu left offset */

   /* ── Table styles (defaults) ──────────────────────────────────────────── */
    --ecr-table-header-bg: #2f5496;  /* header row background */
    --ecr-table-header-ink: #fff;    /* header row text */
    --ecr-table-row-bg: #fff;        /* body row background */
    --ecr-table-row-alt-bg: #f5f5f5;  /* body row alternate background */
    --ecr-table-row-selected-bg: #f5f0c8; /* body row selected background */
    --ecr-table-row-selected-ink: #111;    /* body row selected text */

    --ecr-table-group-parent-row-bg: #faebd7;  /* group row background */
    --ecr-table-group-parent-row-alt-bg: #fff6eb;  /* group row alternate background */
    --ecr-table-group-parent-row-ink: #111;      /* group row text */
    --ecr-table-group-parent-row-selected-bg: #ffe84f; /* body row selected background */
    --ecr-table-group-parent-row-selected-ink: #111;    /* body row selected text */
    --ecr-table-group-child-row-bg: #f0ffff;        /* group child row background */
    --ecr-table-group-child-row-alt-bg: #e0ffff;  /* group child row alternate background */
    --ecr-table-group-child-row-selected-bg: #c2fdfd;
    --ecr-table-group-child-row-ink: #111;      /* group child row text */
    

    /* ── Race palette ───────────────────────────────────────────────────
       docs/DESIGN_GUIDELINES.md D-CHT-04. THE definition for every race-coloured mark in the
       app; charts read these at draw time rather than carrying their own hex,
       so restyling race colouring app-wide means editing this block only.

       Slots are POSITIONAL, in warehouse RaceCode order — which is how
       `Diabetes by Race` colours its bars (race is its category axis, and it
       walks this list by index). Reports that name their races use the aliases
       below instead. Taken from that RDL's ChartCustomPaletteColors.

       These are FILL colours for marks — bars, points, swatches. They are pale
       by design and must never be used as text colour: none of them clears
       D-LEG-01's 4.5:1 on a light ground. Race-coloured *text* is a different
       problem needing a different, darker set. */
    --ecr-race-1: #ffe4c4;          /* Bisque */
    --ecr-race-2: #add8e6;          /* LightBlue */
    --ecr-race-3: #90ee90;          /* LightGreen */
    --ecr-race-4: #c0c0c0;          /* Silver */
    --ecr-race-5: #d3d3d3;          /* LightGray */
    --ecr-race-6: #f5f5f5;          /* WhiteSmoke */

    /* Named aliases for reports that select races by name rather than by
       position (My Summary's four fixed series). The mapping was checked against
       the warehouse: Diabetes by Race, which orders by RaceCode, renders its
       categories as White, Black, Asian, other — so the aliases below line up
       with slots 1-4. If a registry ever reports a different order, correct it
       HERE and both reports stay consistent. */
    --ecr-race-white: var(--ecr-race-1);
    --ecr-race-black: var(--ecr-race-2);
    --ecr-race-asian: var(--ecr-race-3);
    --ecr-race-other: var(--ecr-race-4);

    /* ── Outcome palette ─────────────────────────────────────────────────
       Better / unchanged / worse, for the outcome reports that colour-code a
       direction of travel: Cataract's IOL Outcome trio (post-op visual acuity
       against pre-op), Myopia Trend by Age (refraction improving, stable or
       progressing) and the two AMD Outcome reports (VA over the last 3 months).

       Those four RDLs each picked their own greens and pinks — LightGreen /
       LightPink here, PaleGreen / LightGrey / Pink there, Salmon somewhere else —
       for what is the same three-way judgement about the same kind of measure.
       One definition, so "improved" is one colour across the app.

       Fill colours for marks and cell backgrounds only; too pale for text (D-LEG-01).
       Never the sole carrier of the meaning (D-LEG-03) — every cell using these also
       states the class in words.              */
    --ecr-outcome-improved: #90ee90;      /* LightGreen */
    --ecr-outcome-stable: #b4b4b4;        /* LightGray */
    --ecr-outcome-degraded: #ffb6c1;      /* LightPink */
    --ecr-outcome-unknown: #abbce0;       /* WhiteSmoke — not measured */

    /* ── Meibomian gland loss palette ────────────────────────────────────
       The five Pult meiboscale grades on "MGL Grading by Age", soft green (no
       loss) through soft red (>75% loss). Fill colours for marks, column headings
       and cell tints: text on them uses --ecr-mgl-grade-ink, never a grade colour
       (D-LEG-01). Every use also names the grade in words (D-LEG-03). */
    --ecr-mgl-grade-0: #48a483;
    --ecr-mgl-grade-1: #a0cd74;
    --ecr-mgl-grade-2: #fdeb9c;
    --ecr-mgl-grade-3: #f6a971;
    --ecr-mgl-grade-4: #e0686d;
    --ecr-mgl-grade-ink: #1f2933;

    /* The value labels on a by-age chart's "Total" line: blue and bold (see
       ReportChartSeries.TotalLine), so they read apart from the dark bar labels. */
    --ecr-total-line-label: #1d4ed8;

    /* ── Sex palette ────────────────────────────────────────────────────
       The Myopia reports ("Myopia Patients", "Myopia by Age and Gender")
       split their age curves by patient sex. One definition so Female and
       Male read as the same colour across both. Pale fills for marks and
       lines only; every series is also named in words in the legend (D-LEG-03). */
    --ecr-sex-female: #ffb6c1;            /* LightPink */
    --ecr-sex-male: #add8e6;              /* LightBlue */

    /* ── Categorical series palette ──────────────────────────────────────
       The ten-colour list the AMD and Cataract RDLs carry as their
       ChartCustomPaletteColors, for charts whose series are simply "several
       things" with no inherent meaning to their order (drug groups, procedures,
       surgeons). Positional, like the race slots: a chart walks it by index via
       ReportPalette.SeriesAt(i).

       Unlike the race and outcome palettes these are mid-tone, because they
       carry no semantics that a pale wash would need to stay out of the way of. */
    --ecr-series-1: #4c68a2;
    --ecr-series-2: #b5dddf;
    --ecr-series-3: #7292cc;
    --ecr-series-4: #89bcc5;
    --ecr-series-5: #c4d5f3;
    --ecr-series-6: #c6c595;
    --ecr-series-7: #87acf3;
    --ecr-series-8: #7b9291;
    --ecr-series-9: #a8c4ec;
    --ecr-series-10: #a49ed4;

    /* ── Chart markers ──────────────────────────────────────────────────
       report-charts.js reads this for the legend key's boxWidth/boxHeight,
       applied uniformly across every series regardless of shape. A bar
       series' 'rect' pointStyle and a line series' 'circle'/'triangle' one
       do not fill their nominal radius equally — a square inscribed in a
       circle of radius r is smaller than the circle — so matching the two
       ternary branches this used to have (POINT_RADIUS * 2 for a line
       chart, a bare 10 for a bar chart) still left bar legend keys reading
       smaller than line ones. One fixed size for both closes that gap. */
    --ecr-legend-marker: 8px; /* default and max is  8px */

    /* ── IOL lens style class ────────────────────────────────────────────
       Row backgrounds on the two Cataract lens-catalog reports, which band their
       rows by whether the lens is a standard monofocal, a speciality lens
       (toric/multifocal), or has not been classified at all. Taken from those
       RDLs; shared because both reports draw the same bands. */
    --ecr-lens-standard: #fafad2;         /* LightGoldenrodYellow */
    --ecr-lens-speciality: #eee8aa;       /* PaleGoldenrod */
    --ecr-lens-unclassified: #ffffe0;     /* LightYellow */

}
