:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --ink: #16213a;
  --muted: #5d6677;
  --line: #d9dde5;
  --line-strong: #b8bfcc;
  --brand: #1d4ed8;
  --brand-deep: #1e3a8a;
  --brand-tint: #e4ebfb;
  --ok: #1f7a4d;
  --ok-tint: #e1f3e8;
  --warn: #9a6a00;
  --warn-tint: #fbefcf;
  --err: #b13a2e;
  --err-tint: #f8e1dd;
  --radius: 8px;
  --font:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}
html {
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}
a {
  color: var(--brand-deep);
}
a:hover {
  color: var(--brand);
}

.wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 16px 48px;
}

/* Header */
.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 0 10px;
  border-bottom: 1.5px solid var(--line-strong);
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.wordmark {
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}
.wordmark span {
  color: var(--brand);
}
nav {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items: baseline;
}
nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  padding-bottom: 10px;
  margin-bottom: -11.5px;
  border-bottom: 2.5px solid transparent;
}
nav a:hover {
  color: var(--ink);
}
nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--brand);
}
.foot {
  margin-top: 48px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* Type */
h1 {
  font-size: clamp(1.7rem, 5vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 8px;
}
h2 {
  font-size: 1.2rem;
  font-weight: 650;
  margin: 0 0 10px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
p {
  margin: 0 0 12px;
  max-width: 64ch;
}
.lede {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 52ch;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 0.9rem;
}
code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--brand-tint);
  padding: 1px 5px;
  border-radius: 4px;
}

/* Flash */
.flash {
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-weight: 500;
}
.flash.ok {
  background: var(--ok-tint);
  color: var(--ok);
}
.flash.err {
  background: var(--err-tint);
  color: var(--err);
}

/* Cards and grid */
.card {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 0 0 20px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.grid .card {
  margin: 0;
}

/* Forms */
.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 480px;
}
.row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-top: 12px;
}
.row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9rem;
  color: var(--muted);
}
.stack label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 500;
}
input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 9px 11px;
  min-width: 0;
}
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
  border-color: var(--brand);
}
input.code {
  font-size: 1.6rem;
  letter-spacing: 0.3em;
  text-align: center;
  max-width: 240px;
}
textarea {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.95rem;
}
button {
  font: inherit;
  cursor: pointer;
  border-radius: var(--radius);
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  padding: 8px 14px;
}
button:hover {
  border-color: var(--ink);
}
button.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
  align-self: flex-start;
}
button.primary:hover {
  background: var(--brand-deep);
}
button.danger {
  color: var(--err);
}
button.danger:hover {
  border-color: var(--err);
}
button.linkish {
  border: 0;
  background: none;
  padding: 0;
  color: var(--muted);
  font-weight: 500;
}
button.linkish:hover {
  color: var(--ink);
}
form.inline {
  display: inline;
}

/* Tables */
table.list {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 12px 0 20px;
  font-size: 0.95rem;
}
table.list th,
table.list td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.list th {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
td.actions {
  white-space: nowrap;
}
td.actions form {
  display: inline-block;
  margin-right: 6px;
}
td.actions button {
  padding: 4px 9px;
  font-size: 0.85rem;
}

/* Badges */
.badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--line);
  color: var(--muted);
}
.badge.ok {
  background: var(--ok-tint);
  color: var(--ok);
}
.badge.warn {
  background: var(--warn-tint);
  color: var(--warn);
}
.badge.err {
  background: var(--err-tint);
  color: var(--err);
}

@media (max-width: 640px) {
  table.list,
  table.list thead,
  table.list tbody,
  table.list tr,
  table.list td,
  table.list th {
    display: block;
  }
  table.list thead {
    display: none;
  }
  table.list tr {
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
  }
  table.list td {
    border: 0;
    padding: 3px 12px;
  }
}

/* Audit grid */
.week {
  margin: 20px 0 8px;
}
.week h2 {
  margin-bottom: 8px;
}
.days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}
.day {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  min-width: 0;
}
.day.today {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand-tint);
}
.day.future {
  opacity: 0.55;
}
.day-name {
  font-weight: 600;
  font-size: 0.85rem;
}
.day-date {
  font-size: 0.78rem;
  color: var(--muted);
}
.day input {
  width: 100%;
  font-size: 1.05rem;
  padding: 6px 6px;
  text-align: center;
  margin-top: 4px;
}
.day input:disabled {
  background: var(--bg);
  color: var(--muted);
}
.day .entered {
  font-size: 0.72rem;
}
.week-total {
  margin: 8px 0 0;
}
.help {
  max-width: 70ch;
}
label.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-weight: 400;
  font-size: 0.95rem;
}
label.check input {
  margin-top: 4px;
}
.summary {
  border-color: var(--brand);
}
@media (max-width: 720px) {
  .days {
    grid-template-columns: repeat(4, 1fr);
  }
}
@media (max-width: 420px) {
  .days {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Weekly check-ins */
ul.weeks {
  list-style: none;
  padding: 0;
  margin: 12px 0;
}
.week-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.week-line.current {
  background: var(--brand-tint);
  margin: 0 -8px;
  padding: 8px;
  border-radius: var(--radius);
  border-bottom: 0;
}
.week-status {
  display: flex;
  gap: 10px;
  align-items: baseline;
}
form.survey {
  max-width: 640px;
}
form.survey fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
form.survey .q {
  font-weight: 600;
  display: block;
  margin-bottom: 6px;
}
form.survey label,
form.survey .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
form.survey label.check {
  flex-direction: row;
}
form.survey .yesno {
  display: flex;
  gap: 18px;
}
form.survey .yesno label {
  flex-direction: row;
  gap: 6px;
  align-items: center;
  font-weight: 500;
}
form.survey .track {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}
form.survey input.readonly {
  background: var(--bg);
  color: var(--muted);
  max-width: 160px;
}
form.survey input[type="number"] {
  max-width: 160px;
}
.field-error {
  color: var(--err);
  font-weight: 500;
  margin: 0;
}
#big-three[data-preview="no"] {
  opacity: 0.5;
}

/* Staff: members and timeline */
table.members td {
  vertical-align: middle;
}
table.list.compact th,
table.list.compact td {
  padding: 5px 8px;
  font-size: 0.88rem;
}
table.list tr.inactive td {
  color: var(--muted);
}
.err-text {
  color: var(--err);
}
ul.facts {
  margin: 8px 0;
  padding-left: 18px;
}
ul.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
}
ul.timeline li {
  display: grid;
  grid-template-columns: 190px 70px 1fr;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}
ul.timeline .when {
  color: var(--muted);
  white-space: nowrap;
}
ul.timeline .kind {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
}
.filters a {
  margin-right: 12px;
}
.filters a.current {
  font-weight: 700;
  color: var(--ink);
}
@media (max-width: 640px) {
  ul.timeline li {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}
