
:root {
  color-scheme: light dark;
  --bg: #FBF6EE;
  --card: #FFFFFF;
  --text: #2B2522;
  --muted: #6B5747;
  --accent: #A9501C;
  --on-accent: #FFFFFF;
  --accent-soft: #F6E4D4;
  --border: #927E6E;
  --divider: #E2D6C8;
  --ok: #2E7048;
  --warn: #8A5A00;
  --bad: #AE362D;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1C1816;
    --card: #27211E;
    --text: #F4EDE4;
    --muted: #C7B6A6;
    --accent: #E8925A;
    --on-accent: #1C1816;
    --accent-soft: #3A2A20;
    --border: #857467;
    --divider: #3E3530;
    --ok: #6FC08E;
    --warn: #E3B04B;
    --bad: #F08A80;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
  overflow-wrap: anywhere;
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 8px; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; margin-top: 32px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.wrap { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 24px; padding-bottom: 48px; }

/* Top bar */
.topbar { background: var(--card); border-bottom: 1px solid var(--divider); }
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; min-height: 56px; flex-wrap: wrap;
}
.brand { font-weight: 700; font-size: 1.125rem; color: var(--text); text-decoration: none; }
.brand span { color: var(--accent); }
.who { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.who-name { font-weight: 600; }

/* Breadcrumb */
.crumbs { margin: 0 0 12px; font-size: 0.875rem; color: var(--muted); }
.crumbs a { color: var(--muted); }

/* Cards and grids */
.card {
  background: var(--card); border: 1px solid var(--divider);
  border-radius: var(--radius); padding: 16px;
}
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.card-link { display: block; color: inherit; text-decoration: none; }
.card-link:hover { border-color: var(--border); }
.card h2, .card h3 { margin-top: 0; }
.card-link h2, .card-link h3 { color: var(--accent); }
.card-muted { background: transparent; border-style: dashed; color: var(--muted); }
.stack > * + * { margin-top: 16px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 8px 16px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { border-color: var(--text); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--accent); min-height: 40px; padding: 6px 10px; }
.btn-quiet:hover { border-color: var(--divider); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: var(--on-accent); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 16px 0; }
.inline-form { display: inline; margin: 0; }

/* Forms */
form.stack { max-width: 560px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label, .field .label { font-weight: 600; }
.field-row { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .field-row { grid-template-columns: 1fr 1fr; } }
input[type="text"], input[type="password"], input[type="date"], input[type="number"],
select, textarea {
  width: 100%; min-height: 44px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--card); color: var(--text); font: inherit;
}
textarea { min-height: 96px; resize: vertical; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] {
  border-color: var(--bad); border-width: 2px;
}
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.hint { font-size: 0.875rem; color: var(--muted); }
.error-text { font-size: 0.875rem; color: var(--bad); font-weight: 600; }

/* Notices */
.notice { border-radius: 10px; padding: 12px 16px; border: 1px solid var(--divider); background: var(--accent-soft); }
.notice-error { border-color: var(--bad); color: var(--text); }
.notice-error strong { color: var(--bad); }

/* Stats */
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin: 16px 0; }
.stat { background: var(--card); border: 1px solid var(--divider); border-radius: var(--radius); padding: 12px 16px; }
.stat-value { font-size: 1.25rem; font-weight: 700; }
.stat-label { font-size: 0.875rem; color: var(--muted); }

/* Tables */
.table-scroll { position: relative; width: 100%; overflow-x: auto; border: 1px solid var(--divider); border-radius: var(--radius); background: var(--card); }
table.data { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
table.data th, table.data td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--divider); white-space: nowrap; }
table.data td.wrap-cell { white-space: normal; min-width: 160px; }
table.data th { font-size: 0.8125rem; color: var(--muted); font-weight: 600; }
table.data tr:last-child td { border-bottom: 0; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.8125rem; font-weight: 600; background: var(--accent-soft); color: var(--text); }
.badge-ok { color: var(--ok); }
.badge-warn { color: var(--warn); }
.badge-bad { color: var(--bad); }

.empty { padding: 24px 16px; text-align: center; color: var(--muted); }

/* Sign-in page */
.login { max-width: 400px; margin: 8vh auto 0; }
.login h1 { margin-bottom: 4px; }

/* Front page */
.hero { padding: 48px 0 24px; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.8125rem; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.hero h1 { font-size: 2.5rem; }
.lede { font-size: 1.125rem; color: var(--muted); max-width: 40ch; }
.gallery { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin: 24px 0 48px; }
.frame { margin: 0; }
.frame-photo {
  aspect-ratio: 4 / 5; border-radius: var(--radius);
  border: 2px dashed var(--border); background: var(--accent-soft);
}
.frame figcaption { font-size: 0.875rem; color: var(--muted); margin-top: 6px; }
.site-footer { border-top: 1px solid var(--divider); padding: 16px 0 32px; font-size: 0.875rem; color: var(--muted); }
