/* Symphony Office, Option D (see ../DESIGN.md).
   The markup is semantic HTML with no class names, so styling hangs off elements,
   ARIA attributes and structure. The mode (Light, Dark, Device) is data-theme on <html>; the colour theme is data-palette (00-themes.css). */

/* The colours, as OKLCH: tinted neutrals (hue 265), one accent (the company theme's primary) and three status colours. Electric Blue is
   written here; the other company themes override the neutrals, the accent and --pop (00-themes.css, from design/themes.mjs). Roles and
   the rules for using them are in ../../../../DESIGN.md (colorize review, 2026-10-22).
   data-force-dark: always dark Electric Blue, whatever mode or theme was chosen (the Admin sign-in's brand side, owner 2026-10-29). */
:root, [data-force-dark] {
  --background: oklch(19.6% 0.017 269);       /* the page (60%) */
  --foreground: oklch(95.7% 0.007 261);       /* text */
  --muted: oklch(25.7% 0.02 268);             /* second surface: table heads, hover, read-only fields */
  --muted-foreground: oklch(74% 0.029 265);   /* secondary text, 7.3:1 on the card */
  --card: oklch(23.1% 0.02 268);              /* surfaces (30%) */
  --border: oklch(30.9% 0.023 264);           /* hairlines, decorative only */
  --border-strong: oklch(56.1% 0.033 264);    /* inputs and controls, 3:1 on the card */

  /* the accent: only on what can be pressed, what is selected and the one live figure */
  --accent: oklch(52.8% 0.263 262.9);         /* filled primary button, progress */
  --accent-ink: oklch(72.6% 0.141 267);       /* the accent as text: links, the current tab; 4.5:1 on the tint below too */
  --accent-foreground: oklch(100% 0 0);       /* text on the accent */
  --accent-tint: oklch(62.4% 0.202 266 / 0.12); /* the current tab or selected row, nothing else */
  --accent-line: oklch(72.6% 0.141 267 / 0.4);
  --ring: oklch(72.6% 0.141 267);
  --bar: oklch(61.4% 0.114 267.4);             /* plain amount bars (a count, not a status): the ink, 3:1 on the card */

  --inverse-bg: oklch(14.1% 0.026 265);
  --inverse-fg: oklch(98.4% 0.003 248);
  --inverse-muted: oklch(75.7% 0.032 261);
  --inverse-line: oklch(100% 0 0 / 0.14);
  --inverse-fill: oklch(100% 0 0 / 0.06);
  --accent-on-dark: oklch(78.9% 0.106 268);

  /* the theme's second colour: a second data series only (the labour line, the late shift, the back-of-house mark), never a status;
     themes override these */
  --pop: oklch(83.69% 0.1644 84.4);
  --pop-ink: oklch(83.69% 0.1644 84.4);
  --pop-bg: oklch(24.9% 0.041 86);
  --pop-line: oklch(83.69% 0.1644 84.4);

  /* Status: one meaning each, the same in every theme and on the till (apps/symphony-ios Theme.swift). Shown as text, arrows and small
     marks; the -bg tints only for a blocking error, a destructive confirm or the To do list. */
  /* a booking that is booked: always this blue, whatever the theme, so it never looks like seated or done (owner, 2026-10-28) */
  --booked: #6697FF; --booked-bg: rgba(0, 82, 255, 0.12); --booked-line: rgba(102, 151, 255, 0.4);
  --good: oklch(78% 0.15 152);                /* on target, done, improved, on */
  --good-bg: oklch(27% 0.04 155);
  --warn: oklch(82% 0.13 82);                 /* estimated, needs a look, waiting, at the limit, sick or absent */
  --warn-bg: oklch(28% 0.04 85);
  --bad: oklch(72% 0.15 22);                  /* below target, wrong, blocks, unpaid, delete */
  --bad-bg: oklch(27% 0.05 20);
  /* filled red with near-white text (the bell's count, the kill switch): the light red above is too pale under white (2.8:1), so the
     filled red is the same in both modes and every theme, 6.4:1 */
  --bad-solid: oklch(50% 0.19 27);
  --on-bad: oklch(99% 0.003 265);

  --shadow-md: 0 4px 6px oklch(12% 0.02 265 / 0.35);
  --shadow-lg: 0 10px 15px oklch(12% 0.02 265 / 0.4);

  --scroll-thumb: oklch(51.6% 0.163 266);
  --scroll-track: oklch(19.6% 0.017 269);
  --gate-scrim: oklch(14.1% 0.026 265 / 0.45);
  --gate-panel: oklch(22% 0.037 265 / 0.62);
  --scrim: oklch(13.3% 0.015 259 / 0.6);      /* behind every dialog and under a photo's button */
  --on-scrim: oklch(98% 0.005 265);           /* text and icons on the scrim */
  /* a category's colour as the till draws it (HSB 35% / 32% in dark, 25% / 95% in light, as HSL), for --hue set on the element */
  --tile-shade: 21.2% 26.4%;
  --tile-ring: 40% 60%;
  color-scheme: dark;

  /* Type (typeset review, owner 2026-10-22; DESIGN.md "Type"). Inter for words, JetBrains Mono for figures only (never words), Noto Sans Thai
     for Thai (downloaded only when Thai is on the page). --font-baht is Inter's own ฿ and nothing else, first in both stacks. */
  --font-ui: var(--font-baht), var(--font-inter), var(--font-thai), system-ui, sans-serif;
  --font-mono: var(--font-baht), var(--font-jetbrains), var(--font-thai), ui-monospace, "SF Mono", Menlo, monospace;
  /* seven sizes, in rem so a larger browser text size is followed (1rem = 16px) */
  --text-caption: 0.75rem;   /* 12: meta under a figure, chips, chart axes; the smallest text there is */
  --text-label: 0.8125rem;   /* 13: labels, table headings, help lines, notes */
  --text-body: 0.9375rem;    /* 15: body, table cells, buttons, sidebar, inputs (16 on phones) */
  --text-title: 1.0625rem;   /* 17: card titles, the Summary sentence, small figures */
  --text-heading: 1.25rem;   /* 20: section headings */
  --figure: 1.5rem;          /* 24: every tile figure and dd */
  --text-display: 2.25rem;   /* 36: the page title, and the one hero figure (dish GP) */
  /* four weights: 400 body, 500 labels and figures, 600 buttons and headings, 700 the page title (800 only on the setup guide's entry screens) */
  --leading-tight: 1.15;     /* titles, figures */
  --leading-snug: 1.35;      /* compact UI: tiles, buttons, chips */
  --leading-body: 1.55;      /* running text */
  --tracking-title: -0.02em;
  --tracking-heading: -0.01em;

  /* spacing scale: every padding, margin and gap comes from this set */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  /* the page's rhythm (layout review, owner 2026-10-22): clear air between the sections of a page, half that between the groups inside one,
     and 8 to 12px inside a group, so related things sit together and nothing reads as one even run */
  --gap-section: var(--space-7);
  --gap-group: var(--space-5);
  /* four content widths in place of ten one-offs: the page; Admin and Settings; a form; a narrow card (sign-in steps, small forms) */
  --w-page: 1360px;
  --w-content: 1040px;
  --w-form: 760px;
  --w-narrow: 480px;
  /* stacking order of page layers */
  --z-menu: 20;
  --z-nav: 50;
  --z-skip: 100;
  --z-overlay: 200;
  --nav-h: 61px; /* height of the sticky top bar, for sticky table headers and the dish summary */
  /* The Saved notice and Admin's message box sit this far up from the bottom: clear of the iPhone's home bar, and raised over a page's own
     bottom bar below (owner, 2026-10-30) */
  --saved-notice-bottom: calc(var(--space-5) + env(safe-area-inset-bottom));
  --radius: 10px;
  --radius-lg: 12px;
  --control-h: 44px; /* a button, a box or a sidebar row; Compact makes it 34 with a mouse (25-compact.css), a finger keeps 44 */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* data-force-light: a page that is always light Electric Blue, whatever mode or theme was chosen (the Admin sign-in) */
:root[data-theme="light"], [data-force-light] {
  --background: oklch(97% 0.006 265);
  --foreground: oklch(22% 0.031 267);
  --muted: oklch(95.1% 0.009 258);
  --muted-foreground: oklch(49.7% 0.039 261);
  --card: oklch(99.4% 0.002 248);
  --border: oklch(91.4% 0.014 258);
  --border-strong: oklch(65.8% 0.038 256);

  --accent: oklch(52.8% 0.263 262.9);
  --accent-foreground: oklch(100% 0 0);
  --accent-ink: oklch(52.8% 0.263 262.9);
  --accent-tint: oklch(52.8% 0.263 262.9 / 0.06);
  --accent-line: oklch(52.8% 0.263 262.9 / 0.3);
  --ring: oklch(52.8% 0.263 262.9);
  --bar: oklch(62.1% 0.204 262.8);

  /* The top bar is light in the light theme, dark in the dark theme. */
  --inverse-bg: oklch(99.4% 0.002 248);
  --inverse-fg: oklch(20.8% 0.04 266);
  --inverse-muted: oklch(49.7% 0.039 261);
  --inverse-line: oklch(91.4% 0.014 258);
  --inverse-fill: oklch(95.1% 0.009 258);
  --accent-on-dark: oklch(52.8% 0.263 262.9);

  --pop: oklch(76.86% 0.1647 70.1);
  --pop-ink: oklch(55.53% 0.1455 49);
  --pop-bg: oklch(98.7% 0.021 95);
  --pop-line: oklch(55.53% 0.1455 49);

  --booked: #004DF0; --booked-bg: rgba(0, 82, 255, 0.07); --booked-line: rgba(0, 77, 240, 0.32);
  --good: oklch(50% 0.13 150);                /* 5.5:1 on the card (was 4.9) */
  --good-bg: oklch(96.5% 0.03 152);
  --warn: oklch(52% 0.11 70);
  --warn-bg: oklch(96% 0.04 88);
  --bad: oklch(50% 0.19 27);
  --bad-bg: oklch(96.5% 0.018 20);

  --shadow-md: 0 4px 6px oklch(20% 0.03 265 / 0.07);
  --shadow-lg: 0 10px 15px oklch(20% 0.03 265 / 0.08);

  --scroll-thumb: oklch(62.4% 0.202 266);
  --scroll-track: oklch(95.1% 0.009 258);
  --gate-scrim: oklch(97% 0.006 265 / 0.4);
  --gate-panel: oklch(100% 0 0 / 0.66);
  --tile-shade: 70.4% 83.1%;
  --tile-ring: 45% 45%;
  color-scheme: light;
}

/* The old status names, kept for one release so nothing breaks; new code uses the names above. Here, not in :root, so a
   [data-force-light] page reads its own light values. */
:root, [data-force-light] {
  --success: var(--good);
  --success-bg: var(--good-bg);
  --danger: var(--bad);
  --danger-bg: var(--bad-bg);
  --danger-solid: var(--bad-solid);
  --on-danger: var(--on-bad);
  --amber: var(--warn);
  --amber-bg: var(--warn-bg);
}

/* Paper: the status colours print in their light values whatever mode the screen is in */
@media print {
  /* A printout is dark text on white paper whatever mode or colour theme the screen is in: dark is the default, and anything that sets
     color: var(--foreground) itself printed near-white on white (harden P1). The extra attributes outrank the themes in 00-themes.css. */
  html:root[data-theme][data-palette], html:root {
    --background: #fff; --foreground: #000; --card: #fff; --muted: #f2f2f2; --muted-foreground: #444; --border: #ccc; --border-strong: #999;
    --accent-ink: #000; --pop-ink: #000; --inverse-bg: #fff; --inverse-fg: #000; --inverse-muted: #444; --bar-bg: #fff;
    color-scheme: light;
  }
  html:root {
    --good: oklch(50% 0.13 150); --good-bg: oklch(96.5% 0.03 152);
    --warn: oklch(52% 0.11 70); --warn-bg: oklch(96% 0.04 88);
    --bad: oklch(50% 0.19 27); --bad-bg: oklch(96.5% 0.018 20);
  }
}

/* ============ Base ============ */
* { box-sizing: border-box; }

html {
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
  scrollbar-width: thin;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-ui);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
}

#main { min-height: 60vh; }
main article { padding: 0; max-width: none; }
main, article {
  display: block;
  max-width: var(--w-page);   /* the redesign (Option D) width: 1360 including the page padding */
  margin: 0 auto;
  padding: var(--space-6) var(--space-5) var(--space-8);
}

h1, h2, h3 { margin: 0; overflow-wrap: anywhere; } /* anywhere, not break-word: a long unbroken name (a supplier, a dish) then wraps inside a flex or grid row instead of pushing it wider than the screen */
h1 {
  font-size: var(--text-display);
  font-weight: 600;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-title);
}
h2 { font-size: var(--text-heading); font-weight: 600; letter-spacing: var(--tracking-heading); line-height: var(--leading-tight); margin-top: var(--gap-section); margin-bottom: var(--space-3); }
h3 { font-size: var(--text-title); font-weight: 600; letter-spacing: var(--tracking-heading); line-height: var(--leading-snug); }
p { margin: var(--space-2) 0; max-width: 72ch; overflow-wrap: anywhere; }
main > h1 + p, article > h1 + p { color: var(--muted-foreground); margin-bottom: var(--gap-group); }
main > h1, article > h1 { margin-bottom: var(--space-2); }

a { color: var(--accent-ink); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 1.5px; text-decoration-skip-ink: none; } /* one clean line on hover; skipping round letters like g and y left it broken */

:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

img { max-width: 100%; height: auto; border-radius: var(--radius); }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--space-5) 0; }
ul, ol { padding-left: var(--space-5); }
small { color: var(--muted-foreground); }
code, kbd { font-family: var(--font-mono); font-size: 0.9em; }
/* The figures font is for figures only (UX-20, owner 2026-10-25). Words that sit where figures go ("not reachable", "No recipe", "Off",
   a switch, a badge) carry data-word, and a button or a note inside a figure cell keeps the UI font. !important because the figure
   rules they sit under are many and more specific (a table cell, the last span of a list row); this marker has no other job. */
[data-word], [data-unit], td:is([data-num], [data-right]) :is(button, small) { font-family: var(--font-ui) !important; } /* data-unit: "per kg" beside a price (UX-20) */

/* the page title (and the dish GP) is 28px on phones (quieter Office, owner 2026-10-22) */
@media (max-width: 720px) { :root { --text-display: 1.75rem; } }

/* Thai: taller lines for the marks above and below, and no tightened letter-spacing, which crowds them. The words carry lang="th"
   (the details form, a Thai name or second name), and every line height below is a token, so a Thai part takes these values. */
:lang(th) { --leading-tight: 1.35; --leading-snug: 1.5; --leading-body: 1.7; --tracking-title: 0; --tracking-heading: 0; letter-spacing: 0; }
[lang="th"] { line-height: var(--leading-body); }
:is(h1, h2, h3, h4)[lang="th"], :is(h1, h2, h3, h4) [lang="th"] { line-height: var(--leading-tight); }

/* iOS Safari zooms the page into any box under 16px when it is tapped: on phones every box is 16px (the staff ordering form, T1).
   !important because it is a floor, like reduced motion: smaller boxes are set by more specific rules further on. */
@media (max-width: 720px) {
  input, select, textarea { font-size: 1rem !important; }
}

/* Skip link: hidden until focused */
a[href="#main"] {
  position: absolute;
  left: 12px;
  top: -80px;
  z-index: var(--z-skip);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-foreground);
  font-weight: 600;
  text-decoration: none;
}
a[href="#main"]:focus { top: 12px; }


/* A page on its way (components/layout/Link.tsx): a thin bar along the top, after a moment so a quick page shows none */
[data-link-pending] {
  position: fixed;
  inset: 0 0 auto;
  height: 3px;
  z-index: var(--z-overlay);
  background: var(--accent);
  transform-origin: left;
  animation: link-pending 3s var(--ease) 0.15s both;
}
@keyframes link-pending { from { transform: scaleX(0); } to { transform: scaleX(0.9); } }
@media (prefers-reduced-motion: reduce) { [data-link-pending] { animation: none; } }

/* words for screen readers only, where colour carries the meaning on screen (owner, 2026-10-25) */
[data-sr] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* a change of light/dark or colour theme crossfades the page once (lib/theme/fade.ts, owner 2026-10-29); skipped there under Reduce motion */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 250ms; animation-timing-function: ease-out; }
