/* selfmanaged — every colour the app uses, and nowhere else (the Apple guidelines pass, 24 Sep 2026; docs/HIG.md). Since
   the three-tab look (Stage 1 step 3, 1 Oct 2026; docs/look/three-tabs/DESIGN.md §4.3) these are its colours, copied from
   docs/look/three-tabs/tokens.css, the candidate rehearsed through tests/check.py's own contrast_table(), R7_PAIRS and the
   tenant panels' EXTRA_PAIRS (docs/look/three-tabs/REHEARSAL.md: nothing under its bar). Four sets: light, dark, and an
   increased-contrast version of each. They follow the device (prefers-color-scheme, prefers-contrast), switch live with no
   reload, and there is no in-app switch (HIG Dark Mode, Color; DRK-01, DRK-02, COL-01, COL-04). app.css uses these names
   only: tests/check.py fails on a colour written anywhere else. Every token name the checks know is kept.

   The look: white cards on iOS's grouped grey page, black text, one red (only for an emergency or something late, always
   bold with words), one blue (only for what you tap: the filled button, the back link, links, the current tab), no
   shadows, no gradients, the old logo in its own colours. The plan's named colours:
     page #F2F2F7 (--paper); card and bars #FFFFFF (--white, --elevated, --bar); text #000000 (--ink); secondary text
     #48484D (--muted); the chevron #6C6C72 (--muted-2); separators #C9C9CE (--line, --hair, --bar-edge); the one red
     #C4161C (--late, --destructive; the badge: --on-alarm on --alarm); the one blue #0A56C9, what you tap (--navy, with
     --on-navy #FFFFFF). Dark: page #000000, card #1C1C1E, text #FFFFFF, secondary #B4B4BA, chevron #98989F, separator
     #48484A, red text #FF6B63, the badge white on #D6221F, blue #5AA7FF with black lettering on a filled button.
   The rest were worked out in Stage 0 (REHEARSAL.md says why each is what it is), and the two increased-contrast sets are new.

   What each token is, in this look:
     --paper      the page (iOS systemGroupedBackground)            --white   a card, a field (secondarySystemGroupedBackground)
     --wash       set off inside a card: the page's grey (tertiarySystemGroupedBackground); on the page itself, use --white
     --elevated   sheets and the status message, a step lighter in dark (DRK-09)
     --ink        text: black                --muted   secondary text, 8:1 or more on page and card (6.75 and 7.92
                                                       on a wash or a sheet in the two dark sets: DESIGN §10)
     --muted-2    the chevron (and a select's, a placeholder's, a disabled item's), never words someone has to read; 4.5:1
                  or more on the page, a card, a wash and a sheet, but under it on a pressed row's tint (4.03 on the page in
                  light): 3:1 there, a graphic's
     --line, --hair  separators (decorative)  --field   a text field's edge, 3:1 or more
     --navy       the one blue: the filled button, the back link, links, the current tab; --on-navy its lettering
     --navy-tint  under a pressed or hovered row, button or sheet item: 10% light, 14% with more contrast, 6% and 7% in
                  dark, so red, blue, ink and secondary words on it keep 4.5:1 (DESIGN §10)
     --late, --destructive  the one red, always in bold with words; --soon and --fine are ink (no green, no amber)
     *-wash       the card: nothing is tinted
     --bar        the bars: opaque, the card's colour, a separator under or over them; no blur. At the top of a screen the
                  navigation bar is the page's grey (as iOS draws it under a large title), so the theme-color metas stay
                  each set's --paper (app.css, .navbar)
     --focus      the focus ring: the blue (3:1 or more on page and card)
     --alarm, --on-alarm   the red badge and the red ground, and their white lettering
   The logo keeps its own colours (--logo, --brass), as since 28 Sep 2026. The drawing's tokens (--slip…, --bldg, --edge…,
   --soon-tint, --soon-line, --fine-tint) stay for the key plans (decision 6 keeps one at the top of a property's page). */

:root {
  color-scheme: light dark;

  --paper: #F2F2F7;
  --white: #FFFFFF;
  --wash: #F2F2F7;
  --hand-page: #FFFFFF;  --hand-panel: #F2F2F7;  --hand-inset: #FFFFFF;   /* the hand-drawn look (css/hand.css): the page, a panel on it, what is set off inside a panel */
  /* Traffic lights (Allan, 18 Nov 2026): amber for what is waiting on you, the red ground (--alarm) for an emergency alone. The amber
     is the door's handle, at its palest (Allan, the same day: "let's match the handle from the door", then, shown the handle's brass
     at three strengths, "The palest one please"): --brass with more white in it, and --brass itself as the line drawn on it and round
     the badge. Black on it is 12.5:1 and --on-amber-2 8.7:1. The same in every set: the panel is lit, in dark too. */
  --amber: #E0C48E;  --on-amber: #000000;  --on-amber-2: #33270A;  --amber-hair: #A8813F;  --amber-inset: #FFF6E0;
  --hand-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 5l7 7-7 7' fill='none' stroke='%23000000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --elevated: #FFFFFF;
  --line: #C9C9CE;
  --hair: #C9C9CE;
  --field: #6C6C72;

  --ink: #000000;
  --muted: #48484D;
  --muted-2: #6C6C72;

  --navy: #0A56C9;
  --navy-hover: #094BB0;
  --navy-press: #073E93;
  --on-navy: #FFFFFF;
  --navy-tint: rgba(10, 86, 201, 0.10);   /* a pressed row; the current tab is the blue itself, not a box */
  --logo: #1B3348;
  --brass: #A8813F;

  --late: #C4161C;  --late-wash: #FFFFFF;
  --soon: #000000;  --soon-wash: #FFFFFF;
  --fine: #000000;  --fine-wash: #FFFFFF;
  --destructive: #C4161C;  --destructive-wash: #FFFFFF;

  --bar: #FFFFFF;
  --bar-edge: #C9C9CE;
  --bar-blur: none;
  --scrim: rgba(0, 0, 0, 0.4);
  --skeleton: #E5E5EA;

  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.2l5 5 5-5' fill='none' stroke='%236C6C72' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");

  --rule: #6C6C72;
  --focus: #0A56C9;
  --edge: #C4161C;
  --edge-page: #C4161C;
  --slip: #FFFFFF;
  --slip-ink: #000000;
  --slip-ink-2: #48484D;
  --slip-line: #6C6C72;
  --slip-hair: #C9C9CE;
  --bldg: #E5E5EA;
  --alarm: #C4161C;
  --alarm-rule: #C4161C;
  --on-alarm: #FFFFFF;
  --on-alarm-2: #FFE6E4;
  --alarm-ink: #A8121A;
  --alarm-hair: #E3797B;
  --soon-tint: #F4E5B8;
  --soon-line: #86610C;
  --fine-tint: #D5E8CA;

  /* Printing is always black on white, whatever the screen shows. */
  --print-ink: #000000;
  --print-paper: #FFFFFF;
  --print-rule: #999999;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #000000;
    --white: #1C1C1E;
    --wash: #2C2C2E;
    --hand-page: #000000;  --hand-panel: #1C1C1E;  --hand-inset: #2C2C2E;
    --amber: #E0C48E;  --on-amber: #000000;  --on-amber-2: #33270A;  --amber-hair: #A8813F;  --amber-inset: #FFF6E0;
    --elevated: #2C2C2E;
    --line: #48484A;
    --hair: #48484A;
    --field: #8E8E93;

    --ink: #FFFFFF;
    --muted: #B4B4BA;
    --muted-2: #98989F;

    --navy: #5AA7FF;
    --navy-hover: #7AB8FF;
    --navy-press: #3F8FEA;
    --on-navy: #000000;
    --navy-tint: rgba(90, 167, 255, 0.06);   /* 6%: red on it over a sheet 4.53, not 3.80 at 16% */
    --logo: #A9C3DC;
    --brass: #C9A15C;

    --late: #FF6B63;  --late-wash: #1C1C1E;
    --soon: #FFFFFF;  --soon-wash: #1C1C1E;
    --fine: #FFFFFF;  --fine-wash: #1C1C1E;
    --destructive: #FF6B63;  --destructive-wash: #1C1C1E;

    --bar: #1C1C1E;
    --bar-edge: #48484A;
    --scrim: rgba(0, 0, 0, 0.6);
    --skeleton: #2C2C2E;

    --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.2l5 5 5-5' fill='none' stroke='%2398989F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");

    --rule: #8E8E93;
    --focus: #5AA7FF;
    --edge: #FF6B63;
    --edge-page: #FF6B63;
    --slip: #1C1C1E;
    --slip-ink: #FFFFFF;
    --slip-ink-2: #B4B4BA;
    --slip-line: #98989F;
    --slip-hair: #48484A;
    --bldg: #2C2C2E;
    --alarm: #D6221F;
    --alarm-rule: #FF6B63;
    --on-alarm: #FFFFFF;
    --on-alarm-2: #FFF0EF;   /* not white, so the red ground's filled button still changes when pressed (BTN-01) */
    --alarm-ink: #A8121A;
    --alarm-hair: #F08A88;
    --soon-tint: #262012;
    --soon-line: #E8C263;
    --fine-tint: #2B5232;
  }
}

/* Increase Contrast: a deeper grey page under white cards (iOS's own grouped background with more contrast), secondary
   text near black, the chevron as dark as the plain set's secondary text, stronger separators and field edges, a deeper
   blue and red (lighter in dark). */
@media (prefers-contrast: more) {
  :root {
    --paper: #EBEBF0;
    --white: #FFFFFF;
    --wash: #EBEBF0;
    --hand-page: #FFFFFF;  --hand-panel: #EBEBF0;  --hand-inset: #FFFFFF;
    --amber: #E0C48E;  --on-amber: #000000;  --on-amber-2: #000000;  --amber-hair: #7A5C26;  --amber-inset: #FFF6E0;
    --elevated: #FFFFFF;
    --line: #8E8E93;
    --hair: #8E8E93;
    --field: #48484D;
    --ink: #000000;
    --muted: #2C2C30;
    --muted-2: #48484D;
    --navy: #0043A8;
    --navy-hover: #00398F;
    --navy-press: #002F75;
    --on-navy: #FFFFFF;
    --navy-tint: rgba(0, 67, 168, 0.14);
    --logo: #10243A;
    --brass: #A8813F;
    --late: #A10E13;
    --late-wash: #FFFFFF;
    --soon: #000000;
    --soon-wash: #FFFFFF;
    --fine: #000000;
    --fine-wash: #FFFFFF;
    --destructive: #A10E13;
    --destructive-wash: #FFFFFF;
    --bar: #FFFFFF;
    --bar-edge: #6C6C72;
    --scrim: rgba(0, 0, 0, 0.5);
    --skeleton: #DCDCE1;
    --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.2l5 5 5-5' fill='none' stroke='%2348484D' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    --rule: #48484D;
    --focus: #0043A8;
    --edge: #A10E13;
    --edge-page: #A10E13;
    --slip: #FFFFFF;
    --slip-ink: #000000;
    --slip-ink-2: #2C2C30;
    --slip-line: #48484D;
    --slip-hair: #8E8E93;
    --bldg: #DCDCE1;
    --alarm: #A10E13;
    --alarm-rule: #A10E13;
    --on-alarm: #FFFFFF;
    --on-alarm-2: #FFFFFF;
    --alarm-ink: #A10E13;
    --alarm-hair: #D9777A;
    --soon-tint: #F0DB9E;
    --soon-line: #5E4507;
    --fine-tint: #C6E1BA;
  }
}
@media (prefers-color-scheme: dark) and (prefers-contrast: more) {
  :root {
    --paper: #000000;
    --white: #242426;
    --wash: #363638;
    --hand-page: #000000;  --hand-panel: #242426;  --hand-inset: #363638;
    --amber: #E0C48E;  --on-amber: #000000;  --on-amber-2: #000000;  --amber-hair: #7A5C26;  --amber-inset: #FFF6E0;
    --elevated: #363638;
    --line: #7C7C80;
    --hair: #7C7C80;
    --field: #AEAEB2;
    --ink: #FFFFFF;
    --muted: #D1D1D6;
    --muted-2: #AEAEB2;
    --navy: #8AC0FF;
    --navy-hover: #A6CFFF;
    --navy-press: #6EAEFA;
    --on-navy: #000000;
    --navy-tint: rgba(138, 192, 255, 0.07);   /* 7%: red on it over a sheet 4.59, not 3.50 at 20% */
    --logo: #C9DCEE;
    --brass: #C9A15C;
    --late: #FF8A82;
    --late-wash: #242426;
    --soon: #FFFFFF;
    --soon-wash: #242426;
    --fine: #FFFFFF;
    --fine-wash: #242426;
    --destructive: #FF8A82;
    --destructive-wash: #242426;
    --bar: #242426;
    --bar-edge: #8E8E93;
    --scrim: rgba(0, 0, 0, 0.7);
    --skeleton: #363638;
    --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.2l5 5 5-5' fill='none' stroke='%23AEAEB2' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    --rule: #AEAEB2;
    --focus: #8AC0FF;
    --edge: #FF8A82;
    --edge-page: #FF8A82;
    --slip: #242426;
    --slip-ink: #FFFFFF;
    --slip-ink-2: #D1D1D6;
    --slip-line: #AEAEB2;
    --slip-hair: #7C7C80;
    --bldg: #363638;
    --alarm: #B3141A;
    --alarm-rule: #FF8A82;
    --on-alarm: #FFFFFF;
    --on-alarm-2: #FFFFFF;
    --alarm-ink: #A10E13;
    --alarm-hair: #E07D7F;
    --soon-tint: #2A2310;
    --soon-line: #F5D06E;
    --fine-tint: #2F5A36;
  }
}

/* Reduce Transparency: the bars are already opaque in every set; these rules keep them so. WebKit's support for the media
   feature isn't confirmed in a web view, so the native shell can also set the class (docs/HIG.md, DRK-10). */
@media (prefers-reduced-transparency: reduce) {
  :root { --bar: var(--white); --bar-blur: none; }
}
:root.reduce-transparency { --bar: var(--white); --bar-blur: none; }

/* The Demo Room's stage (views/demoroom.js; docs/words/demo-room.md): Allan's deck's slide 8 is the dark appearance, so the stage
   takes the dark set's own values whatever the device's appearance, while the Demo Room is shown (app.js's root carries dr-stage). */
:root.dr-stage {
  --paper: #000000;
  --white: #1C1C1E;
  --wash: #2C2C2E;
  --elevated: #2C2C2E;
  --line: #48484A;
  --hair: #48484A;
  --ink: #FFFFFF;
  --muted: #B4B4BA;
  --muted-2: #98989F;
  --navy: #5AA7FF;
  --navy-hover: #7AB8FF;
  --navy-press: #3F8FEA;
  --on-navy: #000000;
}
