:root {
  --ink: #383838;
  --muted: #505050;
  --line: rgba(56, 56, 56, 0.14);
  --paper: #f3f5f7;
  --paper-deep: #e5e9ed;
  --card: #fafbfc;
  --cta: #c02820;
  --cta-hover: #8f1c16;
  --danger: #991b1b;
  --danger-bg: #fef2f2;
  --ok-bg: #f0fdf4;
  --ok: #166534;
  --focus: #383838;
  --font: "Barlow", "Segoe UI", sans-serif;
  --display: "Barlow", "Segoe UI", sans-serif;
}

@font-face {
  font-family: "Barlow";
  src: url("/static/fonts/Barlow-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Barlow";
  src: url("/static/fonts/Barlow-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Barlow";
  src: url("/static/fonts/Barlow-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.5;
}
.skip {
  position: absolute;
  left: 0.5rem;
  top: -3rem;
  background: var(--card);
  padding: 0.5rem 0.75rem;
}
.skip:focus { top: 0.5rem; }
.top {
  background: var(--paper);
  color: var(--ink);
  padding: 0.85rem 1.25rem 0.95rem;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-block;
  text-decoration: none;
}
.brand img {
  display: block;
  height: 52px;
  width: auto;
}
body.admin .top {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--paper);
}
.brand-sub {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}
main { padding: 1.25rem; }
.panel {
  max-width: 46rem;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.25rem;
}
.panel.wide { max-width: 64rem; }
.panel.narrow { max-width: 24rem; }
.panel-head, .inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: end;
  justify-content: space-between;
}
.panel-head a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
h1, h2, legend {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0;
}
h1 { font-size: 2rem; margin: 0 0 0.4rem; }
h2 { font-size: 1.45rem; margin: 1.5rem 0 0.6rem; }
legend { font-size: 1.2rem; }
.lede { color: var(--muted); margin-top: 0; }
fieldset {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1rem 0 0;
  padding: 0.8rem 0 0;
}
legend { padding: 0; }
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
.field { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 600; }
.hint { font-weight: 400; color: var(--muted); }
input, select, textarea {
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid rgba(56, 56, 56, 0.35);
}
  border-radius: 8px;
  padding: 0.7rem 0.75rem;
  min-height: 44px;
  width: 100%;
}
textarea { min-height: 6.5rem; resize: vertical; }
button, .panel-head a, .brand {
  cursor: pointer;
}
button {
  font: inherit;
  font-weight: 700;
  background: var(--cta);
  color: #fff;
  border: 0;
  border-radius: 8px;
  min-height: 44px;
  padding: 0.7rem 1rem;
  margin-top: 0.8rem;
}
button:hover { background: var(--cta-hover); }
button:disabled { background: #94a3b8; cursor: not-allowed; }
a { color: var(--cta-hover); }
.check {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  margin-top: 0.8rem;
  font-weight: 400;
}
.check { min-height: 44px; }
.check input { width: 1.5rem; height: 1.5rem; min-width: 1.5rem; min-height: 1.5rem; margin-top: 0.15rem; }
.errors {
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: 8px;
  padding: 0.75rem 1rem;
}
.errors a { color: var(--danger); }
.field-error { margin: 0; color: var(--danger); font-weight: 700; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] {
  border-color: var(--danger);
}
.notice {
  background: var(--ok-bg);
  color: var(--ok);
  border-radius: 6px;
  padding: 0.75rem 1rem;
}
.muted { color: var(--muted); }
.status { font-weight: 700; }
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: 0.4rem 0 0;
}
.stats div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 0.7rem 0.85rem;
}
.stats dd {
  margin: 0.1rem 0 0;
  font-family: var(--font);
  font-size: 1.85rem;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stats .late { background: var(--danger-bg); }
.stats .late dd { color: var(--danger); }
.facts { display: grid; gap: 0.7rem; margin: 0; }
.facts div { display: grid; gap: 0.15rem; }
dt { color: var(--muted); font-size: 0.95rem; }
dd { margin: 0; }
.order {
  white-space: pre-wrap;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.9rem;
  font-family: ui-monospace, monospace;
  font-size: 0.92rem;
}
.table-scroll { overflow-x: auto; max-width: 100%; }
.table-scroll table { min-width: 40rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.65rem 0.4rem; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.log { padding-left: 1.1rem; }
.log span { color: var(--muted); }
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
@media (min-width: 768px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .grid .field:has(textarea), form.grid button { grid-column: 1 / -1; }
}
@media (min-width: 960px) {
  .stats { grid-template-columns: repeat(5, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
