/* Meal Repository — the whole stylesheet.
 *
 * One hand-written file, no build step and no framework (plan §5). It is served static and cached,
 * which is the only reason it is not inline in base.html any more.
 *
 * The look is meant for the way this tool is actually used: one or two people, most of a working
 * day, reading carefully. So it is calm rather than striking, dense rather than airy, and colour is
 * spent only where it carries meaning — allergens, review state, and whether the gate said yes.
 * Every colour below is a token, which is what makes the dark palette a swap rather than a rewrite.
 */

:root {
  color-scheme: light dark;

  --bg: #faf9f7;
  --surface: #ffffff;
  --surface-2: #f6f5f2;
  --line: #e7e4de;
  --line-strong: #d6d2ca;

  --ink: #1b1a17;
  --ink-2: #56514a;
  --muted: #8b857c;

  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: #edfbf7;
  --accent-line: #99e6d8;

  --ok: #15803d;      --ok-soft: #f0fdf4;   --ok-line: #bbf7d0;
  --warn: #b45309;    --warn-soft: #fffbeb; --warn-line: #fde68a;
  --bad: #b3261e;     --bad-soft: #fef2f2;  --bad-line: #fecaca;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(24, 22, 19, .04), 0 1px 3px rgba(24, 22, 19, .05);
  --shadow-lift: 0 1px 2px rgba(24, 22, 19, .05), 0 4px 14px rgba(24, 22, 19, .07);

  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
          sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16151a;
    --surface: #1f1e24;
    --surface-2: #26252c;
    --line: #322f3a;
    --line-strong: #443f4e;

    --ink: #eeecf2;
    --ink-2: #b8b3c0;
    --muted: #8b8595;

    --accent: #2dd4bf;
    --accent-ink: #06201d;
    --accent-soft: #10312d;
    --accent-line: #1c5b53;

    --ok: #6ee7a0;   --ok-soft: #10291b;   --ok-line: #1f5335;
    --warn: #fbbf5a; --warn-soft: #2e2110; --warn-line: #6b4a17;
    --bad: #fca5a5;  --bad-soft: #2e1616;  --bad-line: #6b2626;

    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .28);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  /* Quantities live in columns and get compared down the page. Proportional digits make 240 and
     160 different widths, which is exactly the comparison a curator is trying to make by eye. */
  font-variant-numeric: tabular-nums;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

code, .slug { font-family: var(--mono); font-size: .92em; }

/* -- chrome ---------------------------------------------------------------------------------- */

header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: .75rem 1.75rem;
  /* Solid, not translucent. A blurred header looks pleasant on a marketing page and shows a smear
     of the table scrolling underneath on a page that is mostly tables. */
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
header h1 {
  font-size: .9rem;
  margin: 0;
  font-weight: 650;
  letter-spacing: -.01em;
  white-space: nowrap;
}
header nav { display: flex; gap: .25rem; flex: 1; }
header nav a {
  padding: .3rem .65rem;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  text-decoration: none;
  font-size: .9rem;
}
header nav a:hover { background: var(--surface-2); color: var(--ink); }
header nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
header .who { color: var(--muted); font-size: .82rem; white-space: nowrap; }

main { max-width: 72rem; margin: 0 auto; padding: 2rem 1.75rem 5rem; }

h2 { font-size: 1.4rem; margin: 0 0 .2rem; letter-spacing: -.02em; font-weight: 650; }
h2 .muted { font-weight: 400; font-size: .8em; }
.sub { color: var(--muted); font-size: .9rem; margin: 0 0 1.5rem; max-width: 62ch; }
.sub a { color: var(--accent); }

/* -- surfaces -------------------------------------------------------------------------------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  margin-bottom: 1.1rem;
  box-shadow: var(--shadow);
}

label {
  display: block;
  font-size: .72rem;
  font-weight: 650;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .4rem;
}

/* -- forms ----------------------------------------------------------------------------------- */

input[type=text], input[type=email], input[type=password], select {
  width: 100%;
  padding: .5rem .65rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  font-variant-numeric: tabular-nums;
  background: var(--surface);
  color: var(--ink);
  transition: border-color .12s ease, box-shadow .12s ease;
}
input:focus-visible, select:focus-visible, button:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input[readonly], select:disabled, input:disabled {
  background: var(--surface-2);
  color: var(--ink-2);
  cursor: not-allowed;
}
input::placeholder { color: var(--muted); opacity: .7; }

.row { display: flex; gap: 1.1rem; flex-wrap: wrap; }
.row > * { flex: 1 1 12rem; }
.field { margin-bottom: 1rem; }
.field:last-child { margin-bottom: 0; }

button {
  font: inherit;
  font-weight: 550;
  padding: .45rem .95rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, transform .06s ease;
}
button:hover:not(:disabled) { background: var(--surface-2); border-color: var(--muted); }
button:active:not(:disabled) { transform: translateY(1px); }
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
button.primary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 88%, black);
  border-color: color-mix(in srgb, var(--accent) 88%, black);
}
button.danger { color: var(--bad); border-color: var(--bad-line); background: var(--surface); }
button.danger:hover:not(:disabled) { background: var(--bad-soft); border-color: var(--bad); }
button:disabled { opacity: .4; cursor: not-allowed; }
form.inline { display: inline; }

/* Allergen and meal-slot checklists. Wide targets: these get ticked while reading a label off a
   packet, and a mis-click here is the mistake this whole tool exists to prevent. */
.checks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
  gap: .15rem;
}
.checks label {
  display: flex;
  gap: .55rem;
  align-items: center;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  font-size: .92rem;
  color: var(--ink);
  margin: 0;
  padding: .35rem .5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.checks label:hover { background: var(--surface-2); }
.checks input { margin: 0; accent-color: var(--accent); width: 1rem; height: 1rem; }

/* -- tables ---------------------------------------------------------------------------------- */

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th {
  text-align: left;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 650;
  color: var(--muted);
  border-bottom: 1px solid var(--line-strong);
  padding: .45rem .6rem;
  white-space: nowrap;
}
td { padding: .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .1s ease; }
tbody tr:hover td { background: var(--surface-2); }
td input, td select { padding: .38rem .5rem; font-size: .88rem; }

/* -- semantic colour ------------------------------------------------------------------------- */

.tag {
  display: inline-block;
  padding: .13rem .5rem;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 550;
  background: var(--surface-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
  margin: 0 .2rem .2rem 0;
  white-space: nowrap;
}
/* Amber, everywhere, always. An allergen chip must never look like an ordinary tag — this is the
   one piece of information on the page that hurts somebody when it is wrong. */
.tag.allergen { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.tag.yes { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.tag.no { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }

.status {
  display: inline-block;
  padding: .13rem .55rem;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  border: 1px solid transparent;
}
.status.published { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.status.in_review { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.status.draft { background: var(--surface-2); color: var(--ink-2); border-color: var(--line); }
.status.retired { background: var(--surface-2); color: var(--muted); border-color: var(--line);
                  text-decoration: line-through; }

.notice {
  padding: .7rem .9rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  margin-bottom: 1.1rem;
  border: 1px solid transparent;
}
.notice.error { background: var(--bad-soft); color: var(--bad); border-color: var(--bad-line); }
.notice.warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.notice.ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.notice ul { margin: .4rem 0 0 1.1rem; padding: 0; }
.notice li { margin: .15rem 0; }

/* The gate checklist. Six rows a reviewer scans in one glance, so pass and fail have to be
   distinguishable without reading the words next to them. */
.check-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  font-size: .8rem;
  font-weight: 700;
}
.check-mark.pass { background: var(--ok-soft); color: var(--ok); }
.check-mark.fail { background: var(--bad-soft); color: var(--bad); }
tr.failed td { background: var(--bad-soft); }
tr.failed:hover td { background: var(--bad-soft); }

.muted { color: var(--muted); }
.small { font-size: .84rem; }
.stack > * + * { margin-top: .35rem; }

.empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--muted);
  font-size: .9rem;
}

/* -- narrow screens -------------------------------------------------------------------------- */

@media (max-width: 48rem) {
  main { padding: 1.25rem 1rem 4rem; }
  header { gap: .75rem; padding: .6rem 1rem; }
  header .who { display: none; }
  .panel { padding: 1rem; }
  .row { gap: .75rem; }
}
