/* PicNest Portal. Brand: Teal #0F4C5C, Sun #F2B33D, Coral #E86A50, Ink #1B2A33, Mist #EEF3F4; Avenir Next (built into Apple devices; Segoe UI on Windows). Crisp look (0.73.0). */
/* Colours (0.45.0), in three layers:
   1. Brand and palette values: only ever used inside this block.
   2. Meanings: what the screens use (text, surface, border, brand, status, focus, test-mode bar).
   3. A component's own value, where it needs one, is set from a meaning.
   A status colour always means the same thing: success, warning, danger, info or neutral.
   oms/tests/test_screen_words.py fails if a raw colour or a layer-1 name is used outside this block. */
:root {
  /* 1. Brand and palette */
  --teal: #0F4C5C; --teal-dark: #0A3540; --teal-tint: #E3EEF0; --teal-mist: #CFE1E5;
  --sun: #F2B33D; --sun-tint: #FDF1D8; --sun-ink: #6B4A00; --sun-line: #B88400; --sun-wash: #FFFAEE; --sun-wash-2: #FFF5DD;
  --coral: #E86A50; --coral-tint: #FBE5E0; --coral-ink: #9A2F1A;
  --green-tint: #E2F2E7; --green-ink: #1E6B3A;
  --grey-tint: #ECEFF1; --grey-ink: #4A5A63;
  --ink: #1B2A33; --slate: #4A5A63; --mist: #EEF3F4; --mist-light: #F7FAFB; --mist-faint: #FAFCFC; --line: #DCE3E6; --white: #fff;
  --mist-cool: #F6F8F8; --line-cool: #E3E8E9; --line-faint: #EDF1F2; --line-control: #D3DCDF; --coral-deep: #C2462E;
  --green-edge: #CFE8D7; --sun-edge: #F4E0B2; --coral-edge: #F6D3CA; --grey-edge: #E1E6E8;
  --ochre-wash: #FFF4D6; --ochre: #E0A800; --ochre-ink: #5A4300; --ochre-deep: #3F2F00;

  /* 2. Meanings */
  --text: var(--ink); --text-muted: var(--slate); --text-on-dark: var(--white); --text-on-dark-muted: var(--teal-mist);
  --surface: var(--white); --surface-page: var(--mist-cool); --surface-sunken: var(--mist-light); --surface-hover: var(--mist-faint);
  --border: var(--line-cool); --border-soft: var(--line-faint); --border-control: var(--line-control);
  /* Header (0.73.0): white, with teal marking the screen you're on. */
  --header-bg: var(--white); --header-ink: var(--ink); --header-muted: var(--slate); --header-line: var(--line-cool); --header-on: var(--teal);
  --count-bg: var(--coral-deep); --count-ink: var(--white); --mode-badge-bg: var(--sun-tint); --mode-badge-ink: var(--sun-ink);
  --brand: var(--teal); --brand-strong: var(--teal-dark); --brand-tint: var(--teal-tint); --brand-accent: var(--sun);
  --status-success-bg: var(--green-tint); --status-success-ink: var(--green-ink); --status-success-line: var(--green-ink); --status-success-edge: var(--green-edge);
  --status-warning-bg: var(--sun-tint);   --status-warning-ink: var(--sun-ink);   --status-warning-line: var(--sun-line); --status-warning-edge: var(--sun-edge);
  --status-danger-bg: var(--coral-tint);  --status-danger-ink: var(--coral-ink);  --status-danger-line: var(--coral-ink); --status-danger-edge: var(--coral-edge);
  --status-info-bg: var(--teal-tint);     --status-info-ink: var(--teal);         --status-info-line: var(--teal); --status-info-edge: var(--teal-mist);
  --status-neutral-bg: var(--grey-tint);  --status-neutral-ink: var(--grey-ink);  --status-neutral-line: var(--grey-ink); --status-neutral-edge: var(--grey-edge);
  --row-attention: var(--sun-wash); --row-attention-hover: var(--sun-wash-2);
  --mode-bg: var(--ochre-wash); --mode-ink: var(--ochre-ink); --mode-line: var(--ochre); --mode-strong: var(--ochre-deep);
  /* Keyboard focus (0.44.0): dark on the light screens, white on the teal header.
     Not Sun: Sun is the warning colour, and only about 1.9:1 against white. */
  --focus: var(--ink); --focus-on-dark: var(--white);

  /* Fonts already on the device (0.73.0): nothing to download. Avenir Next on Apple devices, Segoe UI on Windows. */
  --font: "Avenir Next", Avenir, "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
/* Whatever the keyboard moves to scrolls clear of the sticky header and the packing buttons. */
/* The header can wrap to two rows (--header-h), and table headings stick under it. */
html { scroll-padding-top: calc(var(--header-h, 50px) + 56px); scroll-padding-bottom: 96px; }
body { margin: 0; background: var(--surface-page); color: var(--text); font: 14px/1.45 var(--font); }
a { color: var(--brand); }
button, input, select { font: inherit; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; min-height: 56px;
  padding: 0 20px; background: var(--header-bg); color: var(--header-ink); border-bottom: 1px solid var(--header-line); }
.brand { display: flex; align-items: center; gap: 9px; color: var(--header-ink); text-decoration: none; }
.word { font-weight: 700; font-size: 20px; letter-spacing: -0.02em; }
.word span { color: var(--brand); }
.word small { font-weight: 500; font-size: 15px; letter-spacing: -0.01em; color: var(--header-muted); margin-left: 5px; }
.mode { background: var(--mode-badge-bg); color: var(--mode-badge-ink); font-weight: 700; font-size: 11px; letter-spacing: .07em;
  padding: 3px 8px; border-radius: 6px; }
nav { display: flex; gap: 2px; align-self: stretch; }
nav a { display: flex; align-items: center; color: var(--header-muted); text-decoration: none; padding: 0 8px; font-size: 13.5px; font-weight: 500; }
nav a:hover { color: var(--header-ink); }
/* The screen you're on: darker words and a teal line along the bottom of the header. */
nav a.on { color: var(--header-ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--header-on); }
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--count-bg);
  color: var(--count-ink); font-size: 11px; font-weight: 700; text-align: center; margin-left: 5px; }
.count[hidden] { display: none; }
.spacer { flex: 1; }
.version { color: var(--header-muted); font-size: 12px; }

main { padding: 16px 20px 40px; max-width: 1500px; margin: 0 auto; }
h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; margin: 6px 0 14px; text-wrap: balance; }
h2 { font-size: 15px; font-weight: 600; margin: 18px 0 8px; }
.sub { color: var(--text-muted); margin: -6px 0 12px; }

.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.bar .grow { flex: 1; }
.muted { color: var(--text-muted); font-size: 13px; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 7px;
  border: 1px solid var(--brand); background: var(--brand); color: var(--text-on-dark); font-weight: 600; cursor: pointer;
  text-decoration: none; font-size: 13px; }
.btn:hover { background: var(--brand-strong); }
.btn.secondary { background: var(--surface); color: var(--brand); border-color: var(--border-control); }
.btn.secondary:hover { background: var(--brand-tint); }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn.ghost-light { background: transparent; border-color: rgba(255,255,255,.5); }
.btn:disabled { opacity: .55; cursor: progress; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.toast :focus-visible { outline-color: var(--focus-on-dark); }
h1:focus, main:focus { outline: none; }

/* Filters and tabs: a grey tray with the chosen one raised in white (0.73.0). */
.chips { display: inline-flex; gap: 2px; padding: 3px; border-radius: 9px; background: var(--border-soft); }
.chips button { border: 0; border-radius: 6px; background: transparent; padding: 5px 12px; cursor: pointer; color: var(--text-muted); font-weight: 600; font-size: 13px; }
.chips button:hover { color: var(--text); }
.chips button[aria-pressed="true"], .chips button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(17,28,33,.14); }
input[type=search], input[type=text], input[type=password], input[type=url], input[type=email], select {
  border: 1px solid var(--border-control); border-radius: 7px; padding: 6px 10px; background: var(--surface); color: var(--text); }
input[type=search] { min-width: 220px; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 1px 2px rgba(17,28,33,.04); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
th { position: sticky; top: var(--header-h, 56px); background: var(--surface); font-size: 12.5px; color: var(--text-muted); font-weight: 600;
  border-bottom-color: var(--border); z-index: 1; }
tbody tr:hover { background: var(--surface-hover); }
tr.attention { background: var(--row-attention); }
tr.attention:hover { background: var(--row-attention-hover); }
td.num, th.num { text-align: right; white-space: nowrap; }
.code { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; }

.badge { display: inline-block; padding: 1px 7px; border-radius: 6px; border: 1px solid transparent; font-size: 12px; font-weight: 600; white-space: nowrap; }
/* One class per meaning (0.45.0). Success, warning and danger also carry a mark,
   so they never rely on colour alone; screen readers skip the mark (the word says it). */
.b-success { background: var(--status-success-bg); color: var(--status-success-ink); border-color: var(--status-success-edge); }
.b-warning { background: var(--status-warning-bg); color: var(--status-warning-ink); border-color: var(--status-warning-edge); }
.b-danger { background: var(--status-danger-bg); color: var(--status-danger-ink); border-color: var(--status-danger-edge); }
.b-info { background: var(--status-info-bg); color: var(--status-info-ink); border-color: var(--status-info-edge); }
.b-neutral { background: var(--status-neutral-bg); color: var(--status-neutral-ink); border-color: var(--status-neutral-edge); }
.b-success::before, .b-danger::before { font-weight: 700; margin-right: 4px; }
.b-success::before { content: "✓"; content: "✓" / ""; }
/* Warnings: no "!" in front (0.55.0); the words and the amber say it. */
.b-danger::before { content: "✕"; content: "✕" / ""; }

.pack { margin-bottom: 6px; }
.pack:last-child { margin-bottom: 0; }
.pack-title { font-weight: 600; }
.slots { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.slot { display: inline-flex; gap: 4px; align-items: baseline; padding: 1px 7px; border-radius: 6px;
  background: var(--surface-page); border: 1px solid var(--border); font-size: 12px; }
.slot b { font-weight: 600; }
.problems { margin: 4px 0 0; padding-left: 16px; color: var(--status-danger-ink); font-size: 12.5px; }

.empty { padding: 36px 20px; text-align: center; color: var(--text-muted); }
.empty strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 6px; }

.cols { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
.school-list button { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--border);
  background: var(--surface); padding: 10px 12px; cursor: pointer; }
.school-list button:last-child { border-bottom: 0; border-radius: 0 0 10px 10px; }
.school-list button:first-child { border-radius: 10px 10px 0 0; }
.school-list button[aria-current="true"] { background: var(--brand-tint); box-shadow: inset 3px 0 0 var(--brand); }
.school-list .name { font-weight: 600; }

.form { display: grid; grid-template-columns: 200px minmax(0, 520px); gap: 10px 16px; align-items: center; padding: 16px; }
.form label { font-weight: 600; }
.form .hint { grid-column: 2; color: var(--text-muted); font-size: 12.5px; margin-top: -6px; }
.form input { width: 100%; }

.toast { position: fixed; right: 20px; bottom: 20px; z-index: 10; max-width: 460px; padding: 12px 16px;
  border-radius: 10px; background: var(--text); color: var(--text-on-dark); box-shadow: 0 6px 24px rgba(0,0,0,.18); }
.toast { display: flex; align-items: center; gap: 12px; }
.toast[hidden] { display: none; }
.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid rgba(255,255,255,.5);
  border-top-color: var(--text-on-dark); border-radius: 50%; animation: s 0.8s linear infinite; }
.btn.secondary .spin { border-color: var(--brand-tint); border-top-color: var(--brand); }
@keyframes s { to { transform: rotate(360deg); } }

.ok-note { background: var(--status-success-bg); color: var(--status-success-ink); border-radius: 8px; padding: 8px 12px; }
.stack { display: grid; gap: 8px; margin-top: 10px; }
.stack label { display: grid; gap: 4px; font-weight: 600; font-size: 13px; }
label.btn { cursor: pointer; }
.meter { height: 10px; background: var(--surface-page); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; margin: 10px 0 6px; }
.meter span { display: block; height: 100%; background: var(--brand); transition: width .3s; }
.thumbs { display: flex; gap: 4px; flex-wrap: wrap; }
.thumbs img, .thumbs .nothumb { width: 44px; height: 44px; object-fit: cover; border-radius: 4px; background: var(--surface-page); }
.nothumb { display: inline-flex; align-items: center; justify-content: center; font-size: 9px; color: var(--text-muted); text-align: center; }
.problem { padding: 12px 14px; margin-bottom: 12px; border-left: 4px solid var(--status-warning-line); }
.problem.blocking { border-left-color: var(--status-danger-line); }
.fixgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.fixgrid figure { margin: 0; background: var(--surface-page); border-radius: 8px; padding: 6px; }
.fixgrid img, .fixgrid .nothumb { width: 100%; height: 110px; object-fit: contain; border-radius: 6px; background: var(--surface); display: flex; }
.fixgrid figcaption { font-size: 12px; margin: 4px 0; word-break: break-all; }
.fixbtns { display: flex; flex-wrap: wrap; gap: 4px; }
button.link { background: none; border: 0; color: var(--brand); text-decoration: underline; cursor: pointer; font-size: 13px;
  display: inline-flex; align-items: center; min-height: 24px; min-width: 24px; padding: 2px 6px; }
.spin.dark { border-color: var(--brand-tint); border-top-color: var(--brand); vertical-align: middle; }

@media (max-width: 900px) {
  .panel { overflow-x: auto; }
  th { position: static; }
  .cols { grid-template-columns: 1fr; }
  .form { grid-template-columns: 1fr; }
  .form .hint { grid-column: 1; }
  .top { flex-wrap: wrap; }
}

/* Cloud: tick boxes, one per line, box beside its label */
.checks { display: grid; gap: 6px; }
.checks label { display: flex; gap: 8px; align-items: center; font-weight: 400; justify-self: start; }
.checks input[type=checkbox] { width: auto; min-height: 0; margin: 0; }

/* Products */
table.products input.wide { width: 100%; min-width: 220px; }
.scroll-x { overflow-x: auto; }
input.money { width: 64px; text-align: right; }
table.products td { vertical-align: top; }
table.products .badge { margin-top: 4px; }

.defs { white-space: nowrap; }
.defs .def { display: block; font-size: 12px; color: var(--text-muted); }
.defs select { font-size: 12px; padding: 3px 6px; min-height: 26px; margin-left: 4px; }
.pool-h { margin: 18px 0 8px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
.pool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.pool-card { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.pool-top { display: flex; gap: 8px; align-items: center; justify-content: space-between; width: 100%; }
.pool-price { font-size: 13px; font-weight: 600; }

/* Class & group photos */
.class-photos td { vertical-align: top; }
.cp-thumb img { display: block; width: 150px; border-radius: 6px; }
.cp-thumb .nothumb { display: flex; align-items: center; justify-content: center; width: 150px; height: 96px; border-radius: 6px; background: var(--brand-tint); color: var(--text-muted); font-size: 12px; }
#cp-group fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; display: flex; flex-wrap: wrap; gap: 6px 14px; }
#cp-group[hidden] { display: none; }
.cp-check { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; font-weight: 500; }
.digitals { margin: 0 0 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
/* Offers */
.offer { padding: 12px 14px; margin-bottom: 12px; }
.offer-grid { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr); gap: 10px 16px; align-items: start; }
.offer-grid fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0; }
.offer-params { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: end; }
@media (max-width: 700px) { .offer-grid { grid-template-columns: 1fr; } }
#dv-form fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin: 0 0 12px; }
#dv-form label.check { display: inline-flex; gap: 6px; align-items: center; margin-right: 16px; min-height: 32px; }
.delivery { margin-bottom: 4px; }
/* A table that scrolls sideways inside its panel can't use the page-level sticky header
   (it would stick 50px down inside the panel, over the first row). */
.scroll-x th { position: static; }
/* Fulfilment (0.24.0) */
.fl-school > span { display: block; }
.fl-school .badge { margin-top: 3px; }
.pack-card.packed { border-color: var(--status-success-ink); box-shadow: inset 4px 0 0 var(--status-success-ink); }
.chip-count { display: inline-block; border: 1px solid var(--border); border-radius: 8px; padding: 4px 10px; font-weight: 700; font-size: 16px; background: var(--surface); }
.pk-child { margin: 10px 0; }
.pk-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.pk-thumb { margin: 0; width: 110px; text-align: center; font-size: 12px; color: var(--text-muted); border: 2px solid transparent; border-radius: 8px; padding: 3px; }
.pk-thumb:not(.on) img { opacity: .45; }   /* only the photo is faded; its words stay readable */
span.pk-thumb { display: inline-flex; align-items: center; justify-content: center; height: 60px; background: var(--surface-page); }
.pk-thumb.on { opacity: 1; border-color: var(--brand); background: var(--brand-tint); color: var(--text); font-weight: 700; }
.pk-thumb img { width: 100%; height: 130px; object-fit: contain; border-radius: 5px; background: var(--surface); display: block; }
.pk-thumb figcaption { margin-top: 2px; }
#pp-labels label.check { display: inline-flex; gap: 6px; align-items: center; }
@media (max-width: 760px) { .pk-thumb { width: 90px; } .pk-thumb img { height: 105px; } }
/* Phone: the header wraps and the screen tabs scroll sideways inside it, not the whole page. */
@media (max-width: 900px) {
  .top { flex-wrap: wrap; gap: 6px 12px; padding: 8px 12px 0; }
  .top nav { order: 5; flex: 1 0 100%; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .top nav a { white-space: nowrap; padding: 10px 10px; }
  .top .spacer { flex: 1; }
}

/* ------------------------------------------------------------------ phones (0.26.0)
   Same screens, same order of work; laid out for one hand on a small screen. */
.cols > *, .bar > *, .stack > * { min-width: 0; }   /* a wide table scrolls inside its box, never widens the page */
@media (max-width: 700px) {
  main { padding: 12px 12px 88px; }
  h1 { font-size: 22px; }
  .sub { font-size: 14px; margin-top: -4px; }
  /* Tap targets and no zoom-on-focus (iPhone zooms into text boxes under 16px). */
  input:not([type=checkbox]):not([type=radio]), select, textarea { font-size: 16px; min-height: 40px; max-width: 100%; }
  .btn { min-height: 42px; padding: 8px 14px; }
  .btn.small { min-height: 36px; padding: 6px 10px; font-size: 13px; }
  label.check, .checks label { min-height: 36px; }
  input[type=checkbox], input[type=radio] { width: 20px; height: 20px; }
  .bar { gap: 8px; }
  .bar > select, .bar > input[type=search] { flex: 1 1 100%; min-width: 0; }
  .bar .grow { flex-basis: 100%; height: 0; }
  /* Tabs: one row that scrolls sideways, never squashed into tall columns. */
  .chips { max-width: 100%; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .chips button { white-space: nowrap; min-height: 40px; }
  .panel { overflow-x: visible; }
  .school-list { max-height: none; }
  /* Packing: the main actions stay under the thumb at the bottom of the screen. */
  .pack-actions { position: sticky; bottom: 0; z-index: 4; background: var(--surface); margin: 14px -18px -16px !important;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); border-radius: 0 0 10px 10px; }
  .pack-actions .btn { flex: 1 1 0; justify-content: center; min-height: 48px; font-size: 16px; }
  .pack-actions .btn .muted { display: none; }   /* "(Enter)": no keyboard on a phone */
  .pack-card h2 { font-size: 22px !important; }
  .pack-card .chip-count { font-size: 15px; }
  .toast { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}

/* Tablets and phones: tables become a list of cards, one card per row, each value with its heading. */
@media (max-width: 900px) {
  table.rt, .rt thead, .rt tbody, .rt tr, .rt td { display: block; width: auto; }
  .rt thead { display: none; }
  .rt tbody tr { padding: 10px 12px; border-bottom: 1px solid var(--border); }
  .rt tbody tr:last-child { border-bottom: 0; }
  .rt td { position: relative; border: 0; padding: 3px 0 3px min(36%, 190px); min-height: 32px; text-align: left !important; overflow-wrap: anywhere; }
  .rt td::before { content: attr(data-label); position: absolute; left: 0; top: 5px; width: min(33%, 175px); color: var(--text-muted);
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; line-height: 1.2; }
  .rt td[data-label=""] { padding-left: 0; }
  .rt td[data-label=""]::before { display: none; }
  .rt td:empty { display: none; }
  .rt td input.wide, .rt td input, .rt td select { max-width: 100%; }
  .rt td input.wide { min-width: 0; width: 100%; }
  .rt td.nowrap, .rt td .nowrap, .rt .badge { white-space: normal; }
  .rt td .btn { margin: 2px 0; }
}

/* Loading (0.27.0): a thin bar at the top while anything loads, and a plain
   note if it takes more than 3 seconds (the database waking up). */
body.loading::before { content: ""; position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 50;
  background: linear-gradient(90deg, transparent, var(--brand-accent), transparent); background-size: 50% 100%;
  animation: pn-load 1s linear infinite; }
@keyframes pn-load { from { background-position: -50% 0; } to { background-position: 150% 0; } }
.slow-note { position: fixed; left: 50%; transform: translateX(-50%); top: 64px; z-index: 40; max-width: min(92vw, 520px);
  background: var(--text); color: var(--text-on-dark); padding: 10px 14px; border-radius: 10px; font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
@media (prefers-reduced-motion: reduce) { body.loading::before { animation: none; background: var(--brand-accent); } }

/* Pupils & headshots (0.27.0) */
.pupils .stack { gap: 14px; margin-top: 0; }
.pad { padding: 14px 16px; }
.pad h2, .pad-x h2 { margin: 0 0 8px; }
.pad-x { padding: 12px 16px 0; }
.pad > p { margin: 0 0 10px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin: 6px 0 10px; }
.form-grid label { display: grid; gap: 4px; font-weight: 600; font-size: 13px; }
.form-grid input[type=file] { font-size: 13px; max-width: 100%; }
.panel.inner { padding: 12px 14px; margin-top: 10px; background: var(--surface-page); }
.panel.inner details { margin: 8px 0; }
.panel.inner summary { cursor: pointer; font-weight: 600; }
ul.tight { margin: 6px 0; padding-left: 18px; }
p.hint { margin-top: 0; }
table.compact td { padding: 6px 8px; }
@media (max-width: 900px) { .pad-x .chips { overflow-x: auto; max-width: 100%; } }

/* Test mode: viewing PicNest Portal as another login (0.31.0) */
.viewas-bar { position: sticky; top: 0; z-index: 30; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center;
  justify-content: space-between; padding: 8px 20px; background: var(--mode-bg); color: var(--mode-ink); border-bottom: 2px solid var(--mode-line); font-size: 14px; }
.viewas-bar .btn { background: var(--mode-ink); border-color: var(--mode-ink); }
.viewas-bar .btn:hover { background: var(--mode-strong); }

/* Products per type of job (0.34.0) */
.pp-pick { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; padding: 12px 16px; margin: 8px 0; }
.pp-pick label { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.pp-pick select { font-weight: 400; }
/* Switched off: a grey row, with the text kept readable (fading it failed contrast). */
table.lineup tr.is-off td { background: var(--surface-sunken); color: var(--text-muted); }
.switch { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; }
.switch input { width: 18px; height: 18px; }
/* A real on/off switch (0.55.0): the checkbox stays for keyboards and screen readers. */
.toggle { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; font-weight: 600; }
.toggle input { position: absolute; opacity: 0; width: 44px; height: 24px; margin: 0; cursor: pointer; }
.toggle-track { position: relative; width: 44px; height: 24px; border-radius: 12px; background: var(--border); transition: background .12s; flex: none; }
.toggle-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .12s; }
.toggle input:checked + .toggle-track { background: var(--brand); }
.toggle input:checked + .toggle-track::after { transform: translateX(20px); }
.toggle input:focus-visible + .toggle-track { outline: 3px solid var(--focus); outline-offset: 2px; }
.toggle input:disabled + .toggle-track { opacity: .5; }

/* New job steps (0.35.0) */
.wiz-steps { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; padding: 0; margin: 4px 0 14px; font-size: 14px; color: var(--text-muted); }
.wiz-steps li span { display: inline-flex; width: 24px; height: 24px; border-radius: 50%; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--brand-tint); margin-right: 4px; font-weight: 700; }
.wiz-steps li.on { color: var(--text); font-weight: 700; }
.wiz-steps li.on span { background: var(--brand); border-color: var(--brand); color: var(--text-on-dark); }
.wiz-steps li.done span { background: var(--brand-tint); color: var(--brand); }
.wiz { max-width: 720px; padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.wiz h2 { margin: 0; }
.wiz label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.wiz label input, .wiz label select { font-weight: 400; max-width: 420px; }
.wiz .hint { font-weight: 400; font-size: 13px; color: var(--text-muted); }
.wiz-nav { margin: 6px 0 0; }
.wiz-products tr.is-off td { background: var(--surface-sunken); color: var(--text-muted); }
.wiz-sum th { text-align: left; width: 170px; vertical-align: top; }
.job-edit { margin: 0 0 10px; font-size: 14px; }
.job-edit summary { cursor: pointer; }
.job-edit form { margin: 8px 0 0; flex-wrap: wrap; }
.job-edit label { display: flex; gap: 6px; align-items: center; }

/* Removing photos and jobs (0.36.0) */
.btn.danger { background: var(--status-danger-ink); border-color: var(--status-danger-ink); color: var(--text-on-dark); }
.btn.danger:hover { filter: brightness(.92); }
.btn.secondary.danger { background: var(--surface); color: var(--status-danger-ink); border-color: currentColor; }
.btn.danger:disabled { opacity: .5; cursor: not-allowed; }
.removal { margin-top: 16px; padding: 10px 14px; }
.removal summary { cursor: pointer; }
.removal-opts { display: grid; gap: 10px; margin: 8px 0 12px; }
.removal-opt { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.removal-opt input { margin-top: 4px; }
.removal-opt.wipe { border-top: 1px dashed var(--border); padding-top: 10px; }

/* Photographer profiles (0.38.0) */
.ph-form { display: flex; flex-direction: column; gap: 14px; max-width: 760px; }
.ph-form .wiz { max-width: none; }
.ph-logo { display: flex; flex-direction: column; gap: 6px; }
.ph-logo-label { font-weight: 600; }
.ph-logo-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ph-addr { display: flex; align-items: center; gap: 6px; }
.ph-addr input { flex: 1; min-width: 0; }
.ph-logo-img { display: block; max-width: 240px; max-height: 72px; object-fit: contain; padding: 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.ph-logo-pick { position: relative; cursor: pointer; }
.ph-logo-pick:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.ph-sites { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; }
.ph-sites legend { font-weight: 600; padding: 0; }
.ph-sites input { max-width: 420px; }
.ph-sites .btn { align-self: flex-start; }
.ph-clients { display: flex; flex-direction: column; gap: 10px; }
.ph-client { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px 12px; align-items: end;
  padding: 10px; border: 1px solid var(--border); border-radius: 8px; }
.ph-client label { font-size: 13px; }
.ph-client .btn { justify-self: start; }
.wiz textarea { font: inherit; max-width: 100%; }
.wiz > .btn.small, .wiz > #ph-add-client { align-self: flex-start; }
.ph-check { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; padding: 6px 0; }
.ph-check input { margin-top: 3px; }

/* ------------------------------------------------------------------ 0.44.0
   Messages, questions and keyboard use (WCAG 2.2 AA). */
.skip { position: absolute; left: 12px; top: -60px; z-index: 60; }
.skip:focus { top: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; }
label.check { display: inline-flex; gap: 8px; align-items: flex-start; }
label.check input { margin-top: 2px; flex: none; }

/* Messages: a note beside what went wrong, or a banner above the screen. Never colour alone: a bar, a word, an icon. */
.alerts { max-width: 1500px; margin: 0 auto; padding: 0 20px; }
.alerts:empty { display: none; }
.alerts .msg { margin-top: 12px; }
.msg { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; padding: 10px 14px; border-radius: 8px;
  border: 1px solid; border-left-width: 5px; background: var(--surface); }
.msg > div { flex: 1; }
.msg strong::before { font-weight: 700; margin-right: 6px; }
.msg-error { border-color: var(--status-danger-ink); background: var(--status-danger-bg); color: var(--text); }
.msg-error strong::before { content: "✕"; color: var(--status-danger-ink); }
.msg-warn { border-color: var(--status-warning-line); background: var(--status-warning-bg); color: var(--text); }
.msg .ref { display: block; margin-top: 4px; color: var(--text-muted); font-size: 12px; }
.msg-inline { margin: 8px 0; font-size: 13px; }
td .msg-inline, figure .msg-inline { padding: 6px 8px; }
h1 + .msg { margin-bottom: 12px; }

/* On-page questions (instead of the browser's pop-ups). */
dialog.ask { border: 0; border-radius: 12px; padding: 20px 22px; width: min(540px, calc(100vw - 32px)); color: var(--text);
  box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog.ask::backdrop { background: rgba(27, 42, 51, .5); }
dialog.ask h2 { margin: 0 0 10px; font-size: 18px; }
dialog.ask .ask-body p { margin: 0 0 10px; }
dialog.ask label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; margin: 10px 0; }
dialog.ask .hint { font-weight: 400; font-size: 13px; color: var(--text-muted); }
dialog.ask input, dialog.ask textarea { font: inherit; font-weight: 400; width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
dialog.ask [aria-invalid="true"] { border: 2px solid var(--status-danger-ink); }
.field-error { color: var(--status-danger-ink); font-weight: 600; font-size: 13px; }
.field-error::before { content: "✕ "; }
.ask-btns { margin: 16px 0 0; }
@media (max-width: 700px) { dialog.ask input, dialog.ask textarea { font-size: 16px; } .ask-btns .btn { flex: 1 1 100%; justify-content: center; } }

/* Working for (0.46.0): who the screens are about, in the header. */
.working-for { display: inline-flex; align-items: center; gap: 6px; color: var(--header-muted); font-size: 13px; font-weight: 600; }
.working-for select { max-width: 220px; padding: 4px 8px; font-weight: 600; }
@media (max-width: 900px) { .working-for { order: 4; } .working-for select { max-width: 60vw; } }
.ask-context { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin: -4px 0 10px; color: var(--text-muted); font-size: 13px; }
/* The header never squeezes its words onto two lines; if it runs out of room, Working for moves to a second row. */
.top { flex-wrap: wrap; row-gap: 6px; }
.top nav a, .mode, .working-for, .working-for span, .word { white-space: nowrap; }
/* Organise anyway: each possibly merged child checked by name (0.47.0). */
.merged { flex-basis: 100%; border: 1px solid var(--status-warning-line); border-radius: 8px; padding: 8px 12px; margin: 6px 0; display: grid; gap: 6px; }
.merged[hidden] { display: none; }
.merged legend { font-weight: 700; padding: 0 4px; }

/* One flag per order (0.47.0): why, who it waits on, how long; Dealt with clears it. */
.flag { margin-top: 6px; padding: 6px 8px; border-left: 3px solid var(--status-warning-line); background: var(--status-warning-bg); border-radius: 4px; font-size: 13px; max-width: 360px; }
.flag strong { display: block; color: var(--status-warning-ink); }
.flag-meta { color: var(--text-muted); font-size: 12px; margin: 2px 0 4px; }
.flag-more summary { cursor: pointer; font-size: 12px; color: var(--text-muted); }
.flag-done { margin-top: 4px; font-size: 12px; color: var(--text-muted); }

/* One order's page (0.48.0): what it is, what needs a look, packs, side facts, what happened. */
.order-cols { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; margin-top: 12px; }
.order-side { display: grid; gap: 12px; }
.order-side h2, .order-cols .pad h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.order-side p { margin: 0 0 6px; }
.order-pack { padding: 8px 0; border-bottom: 1px solid var(--border); }
.order-pack:last-child { border-bottom: 0; }
.flag.flag-wide { max-width: none; margin-top: 12px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 2px 12px; padding: 6px 0 6px 12px; border-left: 3px solid var(--border); }
.timeline li.person { border-left-color: var(--brand); }
.timeline .tl-when { color: var(--text-muted); font-size: 13px; grid-row: span 2; }
.timeline .tl-by { color: var(--text-muted); font-size: 12px; }
.pager { margin-top: 12px; }
@media (max-width: 900px) { .order-cols { grid-template-columns: 1fr; } .timeline li { grid-template-columns: 1fr; } .timeline .tl-when { grid-row: auto; } }

/* Today and a job's stages (0.49.0) */
.today { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.today-item { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 8px 14px; align-items: start; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border); border-left: 5px solid var(--status-info-line); border-radius: 8px; }
.today-item.danger { border-left-color: var(--status-danger-line); }
.today-item.warning { border-left-color: var(--status-warning-line); }
.today-item .badge { justify-self: start; }
.today-what { font-weight: 700; font-size: 15px; }
.today-item p { margin: 4px 0; }
.stages { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; max-width: 820px; }
.stage { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; padding: 12px 14px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; }
.stage.now { border: 2px solid var(--brand); }
.stage.later { background: var(--surface-sunken); }
.stage h2 { margin: 0 0 4px; font-size: 16px; }
.stage p { margin: 0 0 8px; }
.stage-n { display: inline-flex; width: 32px; height: 32px; border-radius: 50%; align-items: center; justify-content: center;
  font-weight: 700; background: var(--brand-tint); color: var(--brand); }
.stage.done .stage-n { background: var(--status-success-bg); color: var(--status-success-ink); }
@media (max-width: 700px) { .today-item { grid-template-columns: 1fr; } }
/* Today: coming up and shortcuts (0.55.0) */
.today-cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr); gap: 20px; align-items: start; margin-top: 12px; }
.today-cols h2 { font-size: 16px; margin: 0 0 8px; }
.today-cols .panel { margin-bottom: 16px; }
.coming { width: 100%; }
.coming td { vertical-align: top; }
.shortcuts { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.shortcut { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); text-decoration: none; font: inherit; text-align: left; cursor: pointer; }
.shortcut:hover { border-color: var(--brand); background: var(--surface-hover); }
.shortcut:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.shortcut span { font-size: 12.5px; color: var(--text-muted); }
@media (max-width: 900px) { .today-cols { grid-template-columns: 1fr; } }
/* What a send will change (0.50.0) */
ul.changes li { margin: 4px 0; }
dialog.ask .ask-body { overflow-x: auto; }
dialog.ask .ask-body table { font-size: 13px; }
dialog.ask .ask-body h3 { font-size: 14px; margin: 14px 0 6px; }

/* Help where the question comes up (0.51.0): one line, the rest behind "How this works". */
.howto { margin: 0 0 12px; }
.howto > p { margin: 0; }
.howto.sub { margin: -6px 0 12px; }
.howto details { margin-top: 2px; }
.howto summary { display: inline-flex; align-items: center; min-height: 24px; cursor: pointer; color: var(--brand); text-decoration: underline; font-size: 13px; }
.howto details > div { margin: 4px 0 0; max-width: 72ch; }
kbd { font: 600 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace; padding: 2px 6px; border: 1px solid currentColor; border-radius: 4px; }
table.keys th { position: static; background: none; text-align: left; white-space: nowrap; color: var(--text); font-size: 14px; }

/* Quick jump (Cmd-K). */
.qj-list { list-style: none; margin: 8px 0 0; padding: 0; max-height: 50vh; overflow-y: auto; }
.qj-list li { display: flex; justify-content: space-between; gap: 8px; align-items: center; min-height: 32px; padding: 4px 8px; border-radius: 6px; cursor: pointer; }
.qj-list li[aria-selected="true"] { background: var(--brand-tint); outline: 2px solid var(--focus); outline-offset: -2px; }

/* Compact view for big runs: smaller photos, tighter rows. */
.compact-view td, .compact-view th { padding-top: 4px; padding-bottom: 4px; }
.compact-view .pack-card { padding: 10px 12px !important; }
.compact-view .pk-child { margin: 4px 0; }
.compact-view .pk-thumb { width: 72px; }
.compact-view .pk-thumb img { height: 84px; }
.compact-view .pack-card h2 { font-size: 20px !important; }
.compact-view .fl-school { padding-top: 4px; padding-bottom: 4px; }
[data-compact][aria-pressed="true"] { background: var(--brand-tint); }

/* Orders (0.55.0): one shape per row; two short lines per cell; actions in the last column */
table.orders { table-layout: fixed; width: 100%; }
table.orders col.c-order { width: 150px; } table.orders col.c-job { width: 18%; } table.orders col.c-value { width: 100px; }
table.orders col.c-status { width: 22%; } table.orders col.c-act { width: 170px; }
table.orders td { vertical-align: middle; height: 52px; padding-top: 6px; padding-bottom: 6px; }
table.orders .l1, table.orders .l2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.orders .l2 { color: var(--text-muted); font-size: 12.5px; min-height: 1.3em; }
table.orders td.act { text-align: right; white-space: nowrap; }
.row-menu { display: inline-block; position: relative; margin-left: 6px; }
.row-menu summary { list-style: none; cursor: pointer; padding: 5px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; font-weight: 600; background: var(--surface); }
.row-menu summary::-webkit-details-marker { display: none; }
.row-menu-empty { visibility: hidden; }
.row-menu-empty span { display: inline-block; padding: 5px 10px; border: 1px solid transparent; font-size: 13px; font-weight: 600; }
table.orders td.act .btn { min-width: 96px; text-align: center; }
.row-menu summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.row-menu-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 230px; display: flex; flex-direction: column;
  padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, .12); text-align: left; }
.row-menu-list a, .row-menu-list button { display: block; padding: 8px 10px; border: 0; background: none; color: var(--text); font: inherit; font-size: 13.5px;
  text-align: left; text-decoration: none; cursor: pointer; border-radius: 6px; }
.row-menu-list a:hover, .row-menu-list button:hover { background: var(--surface-hover); }
@media (max-width: 900px) { table.orders col.c-job, table.orders col.c-status { width: auto; } }

/* Cards (0.55.0): the code is the key, at the table's own size; search; jobs grouped by photographer */
.cards-table tbody th.card-code { font-family: var(--mono); font-size: inherit; font-weight: 700; text-align: left; white-space: nowrap;
  background: transparent; color: var(--text); text-transform: none; letter-spacing: 0; }
.card-find input { min-width: min(360px, 100%); }
.job-find { width: 100%; margin-bottom: 8px; box-sizing: border-box; }
.job-group-head { padding: 8px 12px 6px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-muted); background: var(--surface-sunken); border-bottom: 1px solid var(--border); }
.job-group:first-child .job-group-head { border-radius: 10px 10px 0 0; }
.school-list .job-group button:first-child, .school-list .job-group button:last-child { border-radius: 0; }

/* Products grouped as parents see them; choices in their own window (0.55.0) */
.pp-group-head th { padding-top: 16px; font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: var(--surface-sunken); }
.pp-group-head .muted { font-weight: 400; letter-spacing: 0; text-transform: none; margin-left: 6px; }
table.choices { width: 100%; margin-bottom: 14px; }
table.choices caption { text-align: left; font-weight: 700; padding-bottom: 4px; }
.choice-chip { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 150px; padding: 6px 10px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; white-space: nowrap; }
button.choice-chip:hover { border-color: var(--brand); }
button.choice-chip:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.choice-chip span { color: var(--text-muted); font-size: 12.5px; }
.choice-chip .choice-edit { color: var(--brand); font-weight: 600; }
table.choices tbody th { background: transparent; color: var(--text); text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 600; }
table.choices input.money { width: 90px; }
