:root {
  --ink: #1c1f23;
  --muted: #5b6168;
  --paper: #f6f6f3;
  --card: #ffffff;
  --line: #dadcd7;
  --line-soft: #ecedea;
  --accent: #155e63;
  --accent-dark: #0e4246;
  --accent-wash: #e3f0ef;
  --amber-bg: #fcf1dc;
  --amber-ink: #7a4f00;
  --blue-bg: #e3eef6;
  --blue-ink: #174a73;
  --green-bg: #e5f3ea;
  --green-ink: #1e6b3a;
  --red-bg: #fbe9e7;
  --red-ink: #8a1f17;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  overflow-wrap: break-word;
}

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

h1 { margin: 0; font-size: 26px; font-weight: 600; }
h2 { margin: 0 0 12px; font-size: 16px; font-weight: 600; }

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 14px 32px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: baseline; gap: 12px; }
.brand-name { font-weight: 600; font-size: 18px; color: var(--ink); text-decoration: none; }
.firm { font-size: 14px; color: var(--muted); }

.mainnav { display: flex; gap: 4px; flex: 1 1 auto; }
.mainnav a { padding: 8px 12px; border-radius: 6px; text-decoration: none; }
.mainnav a:hover { background: var(--accent-wash); }

.whoami { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: 14px; }
.muted { color: var(--muted); }

.page { max-width: 1200px; margin: 0 auto; padding: 28px 32px 56px; display: flex; flex-direction: column; gap: 16px; }
.page.narrow, .card.narrow { max-width: 460px; }

.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}

.stack { display: flex; flex-direction: column; gap: 14px; }
.stack label, label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }

input[type="text"], input[type="email"], input[type="password"], input[type="date"], select, textarea {
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  padding: 10px 12px;
  border: 1px solid #c9ccc6;
  border-radius: 6px;
  background: #fff;
  width: 100%;
  max-width: 520px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

fieldset { border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; margin: 0; }
legend { font-size: 13px; color: var(--muted); padding: 0 6px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 18px; }
label.check { flex-direction: row; align-items: center; gap: 6px; font-size: 15px; color: var(--ink); }

button, .button {
  font: inherit;
  font-size: 15px;
  display: inline-block;
  padding: 10px 14px;
  min-height: 44px;
  border: 1px solid #c9ccc6;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}
button.primary, .button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 500;
}
button.primary:hover, .button.primary:hover { background: var(--accent-dark); color: #fff; }
button.link-button {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  text-decoration: underline;
}
form.inline { display: inline; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-bottom: 14px; }
.hint { margin: 0; font-size: 13px; color: var(--muted); }
.readonly { display: flex; gap: 10px; align-items: baseline; }
.readonly .label { font-size: 13px; color: var(--muted); }

.errors { background: var(--red-bg); border: 1px solid #efc4bf; border-radius: 6px; padding: 10px 14px; margin-bottom: 14px; }
.error { margin: 2px 0; color: var(--red-ink); }

.filters { display: flex; flex-wrap: wrap; gap: 10px 28px; margin-bottom: 14px; }
.filter-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.filter-label { font-size: 13px; color: var(--muted); margin-right: 4px; }
.chip {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  text-decoration: none;
  font-size: 14px;
}
.chip.active { background: var(--accent-wash); border-color: var(--accent); color: var(--accent-dark); font-weight: 500; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; font-weight: 500; font-size: 13px; color: var(--muted); padding: 12px 16px; }
table.data td { padding: 12px 16px; border-top: 1px solid var(--line-soft); vertical-align: top; }
td.wrap, dd.wrap { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 420px; }
.mono { font-family: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
td.mono { overflow-wrap: anywhere; }

.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 13px; }
.badge-draft { background: var(--amber-bg); color: var(--amber-ink); }
.badge-with_checker, .badge-with_reviewer { background: var(--blue-bg); color: var(--blue-ink); }
.badge-final { background: var(--green-bg); color: var(--green-ink); }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 24px; margin: 0 0 6px; }
.facts div { display: flex; flex-direction: column; gap: 2px; }
.facts dt { font-size: 13px; color: var(--muted); }
.facts dd { margin: 0; }

.action-list { display: flex; flex-wrap: wrap; gap: 16px; }
.action-form { flex: 1 1 280px; border: 1px solid var(--line-soft); border-radius: 6px; padding: 14px; }

.chain { padding: 4px 10px; border-radius: 999px; font-size: 13px; }
.chain-ok { background: var(--green-bg); color: var(--green-ink); }
.chain-broken { background: var(--red-bg); color: var(--red-ink); font-weight: 600; }

.pager { display: flex; gap: 14px; align-items: center; margin-top: 14px; font-size: 14px; }
.empty { color: var(--muted); }

/* ---- slice 5a: numbers, grids, steps, icons ---- */
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 4px 8px; }
table.data th { padding-top: 12px; padding-bottom: 12px; }
table.data td { padding-top: 10px; padding-bottom: 10px; }
table.data.grid th[scope="row"] { text-align: left; font-weight: 500; color: var(--ink); font-size: 14px; }
table.data.grid td { padding-top: 6px; padding-bottom: 6px; }
table.data input[type="text"], table.data select { max-width: 150px; padding: 6px 8px; }
input.num, td.num input { text-align: right; font-variant-numeric: tabular-nums; }
input.date { max-width: 170px; }
.draft-id { font-size: 14px; }
.steps { display: flex; flex-wrap: wrap; gap: 4px; }
.steps a { padding: 8px 12px; border-radius: 6px; text-decoration: none; border: 1px solid transparent; }
.steps a:hover { background: var(--accent-wash); }
.steps a.active { background: var(--accent-wash); color: var(--accent-dark); font-weight: 500; border-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px 24px; }
.form-grid input[type="text"], .form-grid select, .form-grid textarea { max-width: none; }
.mapping-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 24px; padding: 4px 0; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
label.field.wide { grid-column: 1 / -1; }
.prev { font-size: 12px; color: var(--muted); padding: 0 4px; }
.hint { max-width: 80ch; }
h3 { margin: 14px 0 8px; font-size: 15px; font-weight: 600; }
ul.plain { margin: 0; padding-left: 20px; }
.result-table td, .result-table th { font-variant-numeric: tabular-nums; }
.download-button { display: inline-flex; align-items: center; gap: 8px; }
.download-button svg { flex: none; width: 22px; height: 22px; }
.run-facts dd { font-variant-numeric: tabular-nums; }
.badge-run-none { background: var(--amber-bg); color: var(--amber-ink); }
.badge-run-current { background: var(--green-bg); color: var(--green-ink); }
.badge-run-stale { background: var(--red-bg); color: var(--red-ink); }
.notice { background: var(--amber-bg); border: 1px solid #ead9b0; border-radius: 6px; padding: 10px 14px; margin-top: 12px; }
a.button.download-button, button.download-button { display: inline-flex; align-items: center; gap: 8px; }

/* ---- the people pages: a wider frame and a compact list ---- */
.page.wide { max-width: 1600px; }
table.data.people { font-size: 13px; }
table.data.people th, table.data.people td {
  padding: 4px 5px;
  white-space: nowrap;
  vertical-align: middle;
  line-height: 1.35;
}
table.data.people th { padding-top: 8px; padding-bottom: 8px; font-size: 12px; }
table.data.people td[data-field="display_name"], table.data.people td[data-field="email"] {
  white-space: normal;
  overflow-wrap: break-word;
  min-width: 9em;
}
table.data.people .cell-email {
  display: inline-block;
  max-width: 18em;
  overflow-wrap: break-word;
  white-space: normal;
  vertical-align: top;
}
table.data.people td[data-field="attention"] {
  white-space: normal;
  overflow-wrap: break-word;
  min-width: 8em;
  max-width: 11em;
}

/* At desktop widths the list is a fixed grid: eleven columns whose shares add up to 100%, so the
   table is exactly the width of its frame and nothing is hidden behind the sideways scroll. */
@media (min-width: 1280px) {
  table.data.people { table-layout: fixed; }
  table.data.people th:nth-child(1) { width: 12%; }
  table.data.people th:nth-child(2) { width: 15%; }
  table.data.people th:nth-child(3) { width: 10%; }
  table.data.people th:nth-child(4) { width: 13%; }
  table.data.people th:nth-child(5) { width: 5%; }
  table.data.people th:nth-child(6) { width: 9%; }
  table.data.people th:nth-child(7) { width: 8%; }
  table.data.people th:nth-child(8) { width: 8%; }
  table.data.people th:nth-child(9) { width: 8%; }
  table.data.people th:nth-child(10) { width: 5%; }
  table.data.people th:nth-child(11) { width: 7%; }
  table.data.people .cell-email { display: inline; max-width: none; }
  table.data.people td[data-field="roles"],
  table.data.people td:nth-child(11) { white-space: normal; }
}
