/* Duty Sorted: plain, readable, phone-first. The only JavaScript is the phone menu,
   and the site works without it.
   Colours and spacing are variables at the top, so the look can be tuned in one place. */

:root {
  --text: #1b2429;
  --muted: #5d6a73;
  --line: #e1e6ea;
  --line-strong: #c9d1d7;
  --bg: #f5f7f9;
  --card: #ffffff;
  --accent: #1f5f8b;
  --accent-dark: #174a6c;
  --accent-soft: #e9f1f8;
  --info-bg: #eef5fb;   --info-line: #1f5f8b;
  --warn-bg: #fff7e6;   --warn-line: #b7791f;
  --urgent-bg: #fdeeee; --urgent-line: #b42318;
  --ok-bg: #edf7ef;     --ok-line: #2e7d32;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 32, 0.04), 0 1px 3px rgba(16, 24, 32, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  /* Keep the footer at the bottom of the window on short pages. */
  min-height: 100vh; display: flex; flex-direction: column;
}

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

.wrap { max-width: 880px; margin: 0 auto; padding-left: 20px; padding-right: 20px; }

/* --- Header -------------------------------------------------------------- */
header.site { background: var(--accent); color: #fff; }
header.site .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; min-height: 60px; padding-top: 8px; padding-bottom: 8px; }
header.site .brand { color: #fff; font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em; text-decoration: none; margin-right: auto; display: inline-flex; align-items: center; gap: 10px; }
header.site .brand-mark { flex: none; }
header.site nav { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 18px; }
header.site nav a { color: rgba(255, 255, 255, 0.88); text-decoration: none; padding: 6px 0; border-bottom: 2px solid transparent; }
header.site nav a:hover { color: #fff; }
header.site nav a[aria-current="page"] { color: #fff; border-bottom-color: #fff; }
header.site form { display: inline; }
header.site button.link { color: rgba(255, 255, 255, 0.88); font: inherit; padding: 6px 0; text-decoration: none; }
header.site button.link:hover { color: #fff; background: none; }

/* Phone menu button (shown by the script in base.html on small screens only) */
.menu-toggle { display: none; }
.menu-toggle .icon-close { display: none; }
.menu-toggle[aria-expanded="true"] .icon-open { display: none; }
.menu-toggle[aria-expanded="true"] .icon-close { display: block; }
.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; }

/* --- Page layout and type ------------------------------------------------ */
main { padding-top: 40px; padding-bottom: 64px; flex: 1 0 auto; width: 100%; }

h1 { font-size: 2rem; line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 10px; }
h2 { font-size: 1.3rem; line-height: 1.3; letter-spacing: -0.01em; margin: 36px 0 12px; }
h3 { font-size: 1.05rem; line-height: 1.4; margin: 24px 0 8px; }
p { margin: 0 0 14px; }
h1 + .muted, h1 + p { margin-bottom: 24px; }
.muted, .help { color: var(--muted); font-size: 0.93rem; }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 40em; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin: 0 0 16px; box-shadow: var(--shadow); }
.card > :last-child { margin-bottom: 0; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }

.figure { font-size: 1.9rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; margin: 4px 0; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin: 0 0 16px; }
.grid > .card { margin: 0; }

/* --- Home page ------------------------------------------------------------ */
.hero { padding: 24px 0 40px; }
.hero .eyebrow { display: inline-block; font-size: 0.85rem; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 4px 12px; border-radius: 999px; margin-bottom: 18px; }
.hero h1 { font-size: 2.6rem; max-width: 16em; margin-bottom: 16px; }
.hero .lede { margin-bottom: 28px; }
.hero .actions { margin: 0 0 14px; }
.feature .icon { display: inline-flex; width: 40px; height: 40px; align-items: center; justify-content: center; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent); margin-bottom: 12px; }
.feature h3 { margin: 0 0 6px; }
.feature p { color: var(--muted); font-size: 0.95rem; margin: 0; }
.note { font-size: 0.93rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 18px; margin-top: 28px; }

/* --- Alerts and messages -------------------------------------------------- */
.alert { border: 1px solid transparent; border-left: 4px solid var(--info-line); background: var(--info-bg); padding: 14px 16px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 0 0 14px; }
.alert.warning { border-left-color: var(--warn-line); background: var(--warn-bg); }
.alert.urgent { border-left-color: var(--urgent-line); background: var(--urgent-bg); }
.alert.success { border-left-color: var(--ok-line); background: var(--ok-bg); }
.alert strong.level { display: block; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 2px; }
.alert > :last-child { margin-bottom: 0; }

.disclaimer { border: 1px solid #f0d9a8; background: var(--warn-bg); padding: 12px 16px; border-radius: var(--radius-sm); font-size: 0.95rem; margin: 0 0 20px; }

/* --- Buttons --------------------------------------------------------------- */
.button, button, input[type=submit] {
  display: inline-block; font: inherit; font-weight: 600; line-height: 1.2; padding: 12px 20px; border-radius: var(--radius-sm);
  border: 1px solid var(--accent); background: var(--accent); color: #fff; text-decoration: none; cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.button:hover, button:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.button:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid #8fbce0; outline-offset: 2px; }
.button.secondary, button.secondary { background: #fff; color: var(--accent); border-color: var(--line-strong); }
.button.secondary:hover, button.secondary:hover { background: var(--accent-soft); color: var(--accent-dark); border-color: var(--accent); }
.button.danger, button.danger { background: var(--urgent-line); border-color: var(--urgent-line); }
button.link { background: none; border: 0; padding: 0; font-weight: normal; text-decoration: underline; cursor: pointer; color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 18px 0; }

/* --- Forms ----------------------------------------------------------------- */
form.card { padding: 24px; }
.field { margin: 0 0 20px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; }
.field.checkbox label { display: flex; gap: 10px; align-items: flex-start; font-weight: normal; }
.field.checkbox input { margin-top: 4px; width: 20px; height: 20px; flex: none; accent-color: var(--accent); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date],
input[type=month], select, textarea {
  width: 100%; font: inherit; padding: 11px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31, 95, 139, 0.18); }
.errorlist { color: var(--urgent-line); list-style: none; padding: 0; margin: 6px 0 0; font-weight: 600; font-size: 0.93rem; }
.field .help { margin-top: 6px; }

/* --- Tables: scroll sideways on small screens rather than squashing -------- */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); margin: 0 0 16px; }
.table-scroll table { border: 0; }
table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child > td, tr:last-child > th { border-bottom: 0; }
th { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* --- Batch list -------------------------------------------------------------- */
.batch { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 6px 16px; }
.batch .name { font-weight: 700; }
.batch .actions { margin: 0; }
.tag { display: inline-block; font-size: 0.78rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark); margin: 6px 4px 0 0; }
.tag.spoiled { background: var(--urgent-bg); color: var(--urgent-line); }

/* --- Monthly return: values to copy ------------------------------------------ */
.copy-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 16px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.copy-row .value { font: 600 1.1rem/1.4 ui-monospace, Consolas, monospace; user-select: all; background: var(--bg); padding: 2px 8px; border-radius: 4px; }
.question { font-style: italic; color: var(--muted); }

/* --- Footer ------------------------------------------------------------------- */
footer.site { border-top: 1px solid var(--line); background: #fff; padding: 24px 0 40px; color: var(--muted); font-size: 0.88rem; }
footer.site p:last-child { margin-bottom: 0; }

/* --- Phones --------------------------------------------------------------------- */
@media (max-width: 700px) {
  .js .menu-toggle { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0;
    background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, 0.35); border-radius: var(--radius-sm); }
  .js .menu-toggle:hover { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.6); }
  .js header.site nav { display: none; width: 100%; flex-direction: column; align-items: stretch; gap: 0; padding: 4px 0 8px; }
  .js header.site nav.open { display: flex; }
  .js header.site nav a, .js header.site nav form { display: block; padding: 12px 4px; border-bottom: 1px solid rgba(255, 255, 255, 0.15); }
  .js header.site nav a[aria-current="page"] { border-bottom-color: rgba(255, 255, 255, 0.15); box-shadow: inset 3px 0 0 #fff; padding-left: 14px; }
  .js header.site nav form { border-bottom: 0; }
  .js header.site nav button.link { padding: 0; width: 100%; text-align: left; }
}

@media (max-width: 600px) {
  main { padding-top: 28px; padding-bottom: 48px; }
  h1 { font-size: 1.65rem; }
  .hero { padding: 8px 0 28px; }
  .hero h1 { font-size: 2rem; }
  .card, form.card { padding: 18px; }
}

@media print {
  header.site, footer.site nav, .no-print { display: none; }
  body { background: #fff; }
  .card, .table-scroll { border: 0; padding: 0; box-shadow: none; }
}
