:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --ink: #1c2530;
  --muted: #667085;
  --line: #dfe3e8;
  --brand: #0a2250;
  --brand-ink: #ffffff;
  --heading: #0a2250;
  --grey: #707070;
  --plate: #ffffff;
  --plate-ink: #0a2250;
  --accent: #707070;
  --blue: #1d5fa8; --blue-bg: #e7f0fa;
  --amber: #8a5a00; --amber-bg: #fff4d6;
  --violet: #5b3fa0; --violet-bg: #efeaf9;
  --green: #17653a; --green-bg: #e2f4ea;
  --red: #a12525; --red-bg: #fbe8e8;
  --radius: 6px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11171e; --surface: #19212b; --ink: #e6ebf1; --muted: #98a2b3; --line: #2b3643;
    --brand: #24478f; --heading: #e6ebf1; --accent: #9aa3b2;
    --blue: #7db4ee; --blue-bg: #17283b;
    --amber: #f0c36a; --amber-bg: #38301a;
    --violet: #b7a2ef; --violet-bg: #28203f;
    --green: #78d09c; --green-bg: #15301f;
    --red: #f19a9a; --red-bg: #3a1c1c;
  }
}
* { box-sizing: border-box; }
html { color-scheme: light dark; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font); }
a { color: var(--blue); }
.wrap { max-width: 1080px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
main.wrap { padding-block: 24px 48px; }
.top { background: var(--plate); color: var(--plate-ink); border-bottom: 4px solid var(--brand); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; padding-block: 8px; }
.brand { color: var(--plate-ink); text-decoration: none; display: flex; align-items: center; gap: 14px; line-height: 1.2; }
.brand img { height: 66px; width: auto; display: block; }
@media (max-width: 760px) { .brand img { height: 54px; } }
.brand span { font-weight: 600; font-size: 12.5px; color: var(--grey); letter-spacing: .08em; text-transform: uppercase; border-left: 2px solid var(--grey); padding-left: 14px; }
.top nav { display: flex; gap: 6px 18px; align-items: center; flex-wrap: wrap; }
.top nav a, .top nav .link { white-space: nowrap; }
.top nav a { color: var(--plate-ink); text-decoration: none; font-weight: 600; font-size: 14px; }
.top nav a:hover { text-decoration: underline; }
.foot { color: var(--muted); font-size: 12px; padding-block: 16px 32px; }
h1 { font-size: 24px; margin: 0 0 8px; text-wrap: balance; color: var(--heading); }
h2 { font-size: 16px; margin: 28px 0 12px; padding-bottom: 8px; border-bottom: 2px solid var(--line); color: var(--heading); }
.card > h2:first-child { margin-top: 0; }
.intro { max-width: 70ch; margin-bottom: 20px; }
.muted { color: var(--muted); }
.pre { white-space: pre-wrap; margin: 6px 0 0; }
.ref { font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 16px; }
.card.narrow { max-width: 420px; margin: 40px auto; }
.card.center { max-width: 560px; margin: 32px auto; text-align: center; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.f { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.f.full { grid-column: 1 / -1; }
label { font-weight: 600; font-size: 13.5px; }
label b, legend b { color: var(--red); }
small { color: var(--muted); font-size: 12.5px; font-weight: 400; }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=search], input[type=date], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 4px; padding: 9px 11px;
}
input[type=file] { font: inherit; font-size: 13px; max-width: 100%; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
fieldset.cats { border: 1px solid var(--line); border-radius: 4px; padding: 12px 14px 8px; margin: 0 0 16px; min-width: 0; }
fieldset.cats legend { font-weight: 600; font-size: 13.5px; padding: 0 6px; }
fieldset.cats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 20px; }
fieldset.cats legend { grid-column: 1 / -1; }
.chk { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; font-size: 14px; padding: 3px 0; }
.chk input { margin-top: 4px; }
.decl { margin-top: 22px; padding: 12px 14px; background: var(--bg); border-radius: 4px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.existing { background: var(--bg); border-radius: 4px; padding: 10px 14px; margin-bottom: 16px; }
.existing ul { list-style: none; margin: 6px 0 0; padding: 0; }
.actions { margin-top: 22px; display: flex; gap: 10px; }
.btn { font: inherit; font-weight: 600; background: var(--brand); color: var(--brand-ink); border: 0; border-radius: 4px; padding: 10px 20px; cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover { filter: brightness(1.15); }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
.btn.small { padding: 7px 14px; font-size: 13.5px; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.green { background: var(--green); color: var(--surface); }
.btn.amber { background: var(--amber); color: var(--surface); }
.btn.red { background: var(--red); color: var(--surface); }
.stack { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 10px; }
.link { background: none; border: 0; color: var(--plate-ink); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; padding: 0; }
.link:hover { text-decoration: underline; }
form.inline { display: inline; margin: 0; }
.alert { border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; border: 1px solid transparent; }
.alert ul { margin: 6px 0 0; padding-left: 20px; }
.alert.red { background: var(--red-bg); color: var(--red); border-color: var(--red); }
.alert.amber { background: var(--amber-bg); color: var(--amber); border-color: var(--amber); }
.alert.green { background: var(--green-bg); color: var(--green); border-color: var(--green); }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.pill.blue { background: var(--blue-bg); color: var(--blue); }
.pill.amber { background: var(--amber-bg); color: var(--amber); }
.pill.violet { background: var(--violet-bg); color: var(--violet); }
.pill.green { background: var(--green-bg); color: var(--green); }
.pill.red { background: var(--red-bg); color: var(--red); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 16px 0; }
.tabs a { text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); padding: 6px 12px; border-radius: 999px; font-size: 13.5px; }
.tabs a span { color: var(--muted); margin-left: 4px; font-variant-numeric: tabular-nums; }
.tabs a.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.tabs a.on span { color: var(--brand-ink); opacity: .8; }
.search { display: flex; gap: 8px; }
.search input { min-width: 260px; }
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: left; font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
td .muted { font-size: 12.5px; }
td:first-child { white-space: nowrap; }
td.empty { text-align: center; color: var(--muted); padding: 32px; }
.cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
dl { margin: 0; }
.kv { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); font-size: 13.5px; }
.kv dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.files, .hist { list-style: none; margin: 0; padding: 0; }
.files li, .hist li { padding: 7px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.files li:last-child, .hist li:last-child { border-bottom: 0; }
.hist { font-size: 13.5px; }
@media (max-width: 760px) {
  .grid, fieldset.cats { grid-template-columns: 1fr; }
  .cols { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .search input { min-width: 0; flex: 1; }
  .search { width: 100%; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn { transition: filter .15s; }
}

/* staff area additions */
.top nav .who { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; font-weight: 600; font-size: 14px; color: var(--plate-ink); }
.top nav .who small { font-weight: 400; font-size: 11.5px; color: var(--grey); letter-spacing: .04em; text-transform: uppercase; }
.grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.toolbar { flex-wrap: wrap; margin-top: 12px; }
.toolbar select { width: auto; min-width: 190px; }
.toolbar input[type=search] { flex: 1 1 280px; width: auto; }
.links { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.btn.danger { color: var(--red); border-color: var(--red); }
.adminbar { background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 14px; margin-bottom: 8px; }
.member { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; background: var(--bg); }
.member.off { opacity: .7; }
.static { padding: 9px 0; font-variant-numeric: tabular-nums; }
.member .f .btn { align-self: flex-start; margin-top: 6px; }
@media (max-width: 760px) {
  .grid.g3 { grid-template-columns: 1fr; }
  .top nav .who { align-items: flex-start; }
  .toolbar select { width: 100%; }
}

/* permission tick boxes on the Team page */
fieldset.perms{border:1px solid var(--line,#d9dde5);border-radius:10px;margin:.75rem 0;padding:.6rem .9rem;display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:.35rem .9rem}
fieldset.perms legend{font-weight:600;padding:0 .4rem;font-size:.9rem}
fieldset.perms .full{grid-column:1/-1;margin:0}
.actions{margin-top:.5rem}

/* team: members table, add-member steps, activation */
.pill.grey { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.card.flush { padding: 0; overflow-x: auto; }
.mt th, .mt td { padding: 12px 16px; text-align: left; vertical-align: middle; }
.crumb { font-size: 13px; margin: 18px 0 0; }
.roles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin: 10px 0 16px; }
.rc { display: block; cursor: pointer; }
.rc input { position: absolute; opacity: 0; pointer-events: none; }
.rc-in { display: flex; flex-direction: column; gap: 3px; height: 100%; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: var(--surface); font-size: 13px; }
.rc-in b { color: var(--heading); font-size: 14px; }
.rc-in small { color: var(--muted); }
.rc input:checked + .rc-in { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand); }
.rc input:focus-visible + .rc-in { outline: 2px solid var(--blue); outline-offset: 2px; }
.pl { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 2px 14px; margin: 6px 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
fieldset.cats.flat { border: 0; padding: 0; margin: 0; grid-template-columns: 1fr; }
form.js [data-step][hidden] { display: none; }
.steps { list-style: none; display: none; gap: 8px; padding: 0; margin: 14px 0; flex-wrap: wrap; }
form.js .steps { display: flex; }
.steps li { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 13.5px; }
.steps li span { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--bg); font-weight: 700; font-size: 12px; }
.steps li.on { color: var(--brand-ink); background: var(--brand); border-color: var(--brand); }
.steps li.on span { background: var(--surface); color: var(--brand); }
.steps li.done span { background: var(--green-bg); color: var(--green); }
.sumbox { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; background: var(--bg); border-radius: var(--radius); padding: 14px; margin-bottom: 8px; }
.sumbox div { display: flex; flex-direction: column; gap: 2px; }
.mail { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); max-width: 560px; overflow: hidden; }
.mail-h { padding: 10px 14px; background: var(--bg); border-bottom: 1px solid var(--line); }
.mail-b { padding: 6px 18px; }
.linkbox { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 14px; margin: 8px 0; }
.copyrow { display: flex; gap: 8px; }
.copyrow input { flex: 1; min-width: 0; }
details.member-d { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; background: var(--surface); }
details.member-d > summary { cursor: pointer; padding: 12px 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
details.member-d > form { padding: 0 16px 14px; }
.inline-form { padding: 0 16px 16px; }
@media (max-width: 760px) { .two { grid-template-columns: 1fr; } }
h3 { font-size: 15px; color: var(--heading); margin: 22px 0 6px; }

/* approvals: a box per ticked approval */
.ap { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; background: var(--surface); }
.ap-h { padding: 10px 14px; margin: 0; font-weight: 600; }
.ap-b { display: none; padding: 0 14px 8px; }
.ap:has(.ap-cb:checked) { border-color: var(--brand); }
.ap:has(.ap-cb:checked) .ap-b { display: block; }
ul.plain { margin: 0; padding-left: 18px; }
