/* The admin console's one stylesheet (`MealWeb.AdminEndpoint` serves it at /assets/admin.css; the
   CSP's `style-src 'self'` admits it and nothing inline). A tool for one operator: system fonts,
   a readable column, tables that scroll inside their own box rather than the page. */

:root {
  color-scheme: light dark;
  --fg: #1d1d1f;
  --bg: #fafaf7;
  --muted: #6b6b6b;
  --line: #d8d6cf;
  --accent: #8a3b12;
  --error: #a4161a;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fg: #ececea;
    --bg: #161615;
    --muted: #a3a3a0;
    --line: #3a3a37;
    --accent: #e8915c;
    --error: #ff6b6b;
  }
}

body {
  margin: 0 auto;
  max-width: 72rem;
  padding: 2rem 1rem;
  color: var(--fg);
  background: var(--bg);
}

h1 {
  font-size: 1.4rem;
  margin: 0 0 1rem;
}

form {
  display: grid;
  gap: 0.5rem;
  max-width: 24rem;
}

input,
button {
  font: inherit;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  color: inherit;
}

button {
  cursor: pointer;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

.flash {
  border-left: 3px solid var(--accent);
  padding: 0.4rem 0.75rem;
}

.flash-error {
  border-left-color: var(--error);
}

.bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.5rem;
  max-width: none;
  margin-bottom: 1rem;
}

select {
  font: inherit;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  color: inherit;
}

.scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 4px;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9rem;
}

th,
td {
  text-align: left;
  padding: 0.35rem 0.6rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 600;
}

.passkey-error {
  color: var(--error);
}

/* AC2: the page bar's nav, the overview's figures and window links, the detail's facts and its
   90-day strip. The strip's cells are shaded by class (a0 none, a1 one member, a2 two or more),
   never by a style attribute: the CSP's `style-src 'self'` admits this file and nothing inline. */

.bar nav {
  display: flex;
  gap: 1rem;
  margin-right: auto;
  margin-left: 1rem;
}

.bar form {
  max-width: none;
}

a {
  color: var(--accent);
}

h2 {
  font-size: 1.1rem;
  margin: 1.5rem 0 0.5rem;
}

h3 {
  font-size: 1rem;
  margin: 1rem 0 0.4rem;
}

.note {
  color: var(--muted);
  font-size: 0.9rem;
  max-width: 48rem;
}

.windows {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.windows a[aria-current="page"] {
  color: var(--fg);
  font-weight: 600;
  text-decoration: none;
}

.figures {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.5rem;
  margin: 0.5rem 0;
}

.figures div {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
}

.figures dt {
  color: var(--muted);
  font-size: 0.8rem;
}

.figures dd {
  margin: 0;
  font-size: 1.3rem;
}

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.2rem 1rem;
  margin: 0.5rem 0;
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  margin: 0;
}

.series td,
.figures dd {
  font-variant-numeric: tabular-nums;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 4px;
  padding: 0.75rem;
  color: var(--muted);
}

.strip {
  display: grid;
  grid-template-columns: repeat(30, 1fr);
  gap: 2px;
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
  max-width: 40rem;
}

.strip li {
  aspect-ratio: 1;
  border-radius: 2px;
}

.strip .a0 {
  background: var(--line);
}

.strip .a1 {
  background: color-mix(in srgb, var(--accent) 50%, var(--bg));
}

.strip .a2 {
  background: var(--accent);
}

/* AC4: household content. Photos are the media origin's `/t/` renditions, sized here (never by a
   style attribute); free text wraps inside its cell; a transcript is one bordered article per
   message, the tool rows' arguments in a scrolling `pre`. */

.context {
  margin-bottom: 0.5rem;
}

.photos {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.5rem 0;
}

.photos img {
  max-height: 10rem;
  max-width: 100%;
  border-radius: 4px;
  border: 1px solid var(--line);
}

td.text,
dd.text,
p.text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ingredients,
.instructions {
  max-width: 48rem;
}

.transcript {
  display: grid;
  gap: 0.5rem;
  max-width: 56rem;
}

.message {
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: 4px;
  padding: 0.4rem 0.75rem;
}

.message-user {
  border-left-color: var(--accent);
}

.message-tool {
  border-left-color: var(--muted);
}

.message .note {
  margin: 0;
}

pre {
  overflow-x: auto;
  font-size: 0.85rem;
  margin: 0.25rem 0 0;
}

/* AC5's action forms: each a plain form beside what it acts on, and an irreversible one inside a
   <details> whose summary is the first click and whose button the second. */
form.action {
  margin: 0.75rem 0;
}

form.action p {
  margin: 0;
  color: var(--muted);
}

details summary {
  cursor: pointer;
  color: var(--accent);
}

details[open] {
  max-width: 24rem;
  padding: 0.25rem 0 0.5rem;
}

details p {
  color: var(--muted);
  font-size: 0.9rem;
}

/* A table cell does not wrap (`td`'s nowrap); a consequence stated inside one must. */
td details[open] {
  min-width: 18rem;
  white-space: normal;
}
