:root {
  --ink: #10201b;
  --muted: #4d6256;
  --cream: #f3f1e9;
  --paper: #fbfaf5;
  --forest: #0b3329;
  --forest-deep: #051c17;
  --lime: #b9dc72;
  --gold: #e4ad54;
  --line: rgba(16, 32, 27, 0.15);
  --danger: #8c2d20;
  --shell: min(1160px, calc(100vw - 48px));
  --sans: "DM Sans", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --display: "Manrope", var(--sans);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--forest); text-underline-offset: 3px; }
img { max-width: 100%; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 2px; }
[hidden] { display: none !important; }

h1, h2, h3, h4 { font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; margin: 0 0 .55em; }
h1 { font-size: clamp(34px, 5.2vw, 58px); line-height: 1.04; letter-spacing: -0.045em; }
h2 { font-size: clamp(22px, 2.6vw, 30px); line-height: 1.15; }
h3 { font-size: 18px; letter-spacing: -0.02em; }
p { margin: 0 0 1em; max-width: 68ch; }
small, .muted { color: var(--muted); }

.skip { position: fixed; left: 12px; top: -60px; z-index: 200; padding: 10px 16px; background: white; border: 1px solid var(--line); transition: top .2s; }
.skip:focus { top: 12px; }

/* ---- header ---- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 16px max(24px, calc((100vw - var(--shell)) / 2));
  background: rgba(251, 250, 245, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { flex-shrink: 0; width: 150px; padding: 7px 9px; display: inline-flex; background: white; border-radius: 4px; box-shadow: 0 1px 0 var(--line); }
.brand img { width: 100%; height: auto; display: block; }
.site-nav { display: flex; flex-wrap: wrap; gap: 26px; }
.site-nav a { position: relative; font-size: 13px; font-weight: 600; color: var(--forest); padding: 4px 0; }
.site-nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: right; transition: transform .25s; }
.site-nav a:hover::after, .site-nav a:focus-visible::after { transform: scaleX(1); transform-origin: left; }

main { flex: 1; width: var(--shell); margin: 0 auto; padding: 46px 0 72px; }

.eyebrow { display: flex; flex-wrap: wrap; align-items: center; gap: 0 10px; margin: 0 0 22px; color: #4f7f3b; font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.eyebrow::before { content: ""; width: 30px; height: 1px; background: var(--lime); }
.eyebrow i { font-style: normal; color: var(--line); }
.lede { color: var(--muted); font-size: 18px; max-width: 60ch; }

/* ---- layout ---- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 30px; align-items: start; margin-top: 30px; }
.layout > section { min-width: 0; }
.single { max-width: 880px; }

.card, fieldset {
  background: white; border: 1px solid var(--line); border-radius: 14px;
  padding: 26px; margin: 0 0 22px;
}
fieldset { min-width: 0; }
legend { padding: 0 8px; font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; }
.card > :last-child, fieldset > :last-child { margin-bottom: 0; }

aside {
  position: sticky; top: 96px;
  max-height: calc(100vh - 120px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--forest); color: rgba(255,255,255,0.86);
  border-radius: 14px; padding: 26px;
}
aside h2 { color: var(--lime); }
aside p { color: rgba(255,255,255,0.86); }
aside small { color: rgba(255,255,255,0.6); }
aside a { color: var(--lime); }
.price { font-family: var(--display); font-weight: 700; font-size: 30px; letter-spacing: -0.03em; line-height: 1.15; color: white; margin: 6px 0 4px; }

/* ---- forms ---- */
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.full { grid-column: 1 / -1; }
label { display: block; font-size: 13px; font-weight: 600; letter-spacing: 0.01em; }
input, select, textarea {
  display: block; width: 100%; margin-top: 7px; padding: 11px 13px;
  font: inherit; color: var(--ink); background: white;
  border: 1px solid #7d8f85; border-radius: 7px;
}
input:focus, select:focus, textarea:focus { border-color: var(--forest); }
textarea { min-height: 104px; resize: vertical; }
input[type=file] { padding: 9px; font-size: 13px; background: var(--cream); }
input[type=checkbox] { width: 18px; height: 18px; margin: 0 9px 0 0; display: inline-block; vertical-align: -3px; accent-color: var(--forest); }
.check { display: block; margin-top: 15px; font-size: 14px; font-weight: 400; }
.help { margin: 6px 0 0; font-size: 13px; color: var(--muted); }

/* ---- buttons ---- */
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 46px; padding: 0 22px;
  font-family: var(--display); font-size: 12px; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--forest-deep); background: var(--lime);
  border: 1px solid transparent; border-radius: 8px;
  cursor: pointer; text-decoration: none; transition: transform .15s, background .2s, color .2s, border-color .2s;
}
button:hover, .button:hover { transform: translateY(-2px); background: #cce98f; }
.secondary { background: transparent; color: var(--forest); border-color: var(--forest); }
.secondary:hover { background: var(--forest); color: white; }
.danger { background: var(--danger); color: white; }
.danger:hover { background: #a5392a; }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }

/* ---- pay callout ---- */
.pay-card { border-color: rgba(11, 51, 41, 0.3); box-shadow: 0 14px 34px -28px rgba(11, 51, 41, 0.85); }
.pay-card h2 { margin-bottom: 0.3em; }
.pay-amount {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; margin: 0;
  font-family: var(--display); font-weight: 700; font-size: clamp(30px, 4.2vw, 40px);
  letter-spacing: -0.035em; line-height: 1.1; color: var(--forest);
}
.pay-amount span { font-family: var(--sans); font-size: 15px; font-weight: 400; letter-spacing: 0; color: var(--muted); }
.pay-cta { min-height: 58px; padding: 0 32px; font-size: 14px; }
.pay-card .help { margin-top: 14px; }

/* ---- steps ---- */
.steps { list-style: none; display: flex; gap: 10px; margin: 26px 0 0; padding: 0; }
.steps li { flex: 1; padding: 9px 4px 0; border-top: 3px solid var(--line); font-size: 13px; color: var(--muted); }
.steps .active { border-color: var(--forest); color: var(--forest); font-weight: 700; }

/* ---- notes ---- */
.banner, .warning, #notice:not(:empty) {
  margin: 18px 0; padding: 16px 20px; border-left: 4px solid #739d36;
  background: #eef4e0; border-radius: 6px;
}
.warning { border-color: var(--gold); background: #fbf1dc; }
#notice.error, .error { border-color: var(--danger) !important; background: #fdecea !important; }
#notice { overflow-wrap: anywhere; }
#notice:empty { display: none; }

.pill { display: inline-block; padding: 5px 12px; border-radius: 30px; background: var(--cream); font-family: var(--display); font-size: 11px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.secret { padding: 14px; background: var(--cream); border-radius: 8px; font-family: ui-monospace, monospace; font-size: 13px; word-break: break-all; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 26px 0; }
.account { max-width: 520px; }

details { margin: 14px 0; }
summary { cursor: pointer; font-weight: 700; }

/* ---- tables ---- */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 11px 13px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { background: var(--cream); font-family: var(--display); font-size: 12px; letter-spacing: 0.02em; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td { overflow-wrap: anywhere; }
td button, td .button { min-height: 32px; padding: 0 12px; font-size: 11px; }

.review-list { display: grid; grid-template-columns: 160px 1fr; gap: 10px 16px; margin: 0; }
.review-list dt { color: var(--muted); font-size: 14px; }
.review-list dd { margin: 0; overflow-wrap: anywhere; }

.filters { display: flex; flex-wrap: wrap; gap: 14px; align-items: end; }
.filters label { flex: 1; min-width: 150px; }
.filters button { min-height: 44px; }

/* ---- staff console ---- */
.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; }
.admin-page { margin-top: -12px; }
.admin-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.admin-heading h1 { margin: 0; font-size: clamp(32px, 4vw, 46px); }
.admin-kicker { margin: 0 0 5px; color: #4f7f3b; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.admin-intro { margin: 6px 0 0; color: var(--muted); font-size: 15px; }
.admin-header-actions, .admin-export { display: flex; flex-wrap: wrap; align-items: end; gap: 9px; }
.admin-header-actions button, .admin-export button, .admin-export .button, .admin-pagination button { min-height: 38px; padding: 0 15px; font-size: 11px; }
.quiet { min-height: 38px; padding: 0 8px; color: var(--muted); background: transparent; border-color: transparent; }
.quiet:hover { color: var(--forest); background: var(--cream); transform: none; }

.admin-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 22px; }
.summary-group { padding: 16px 18px 14px; background: white; border: 1px solid var(--line); border-radius: 10px; }
.summary-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.summary-head h2 { margin: 0; color: #4f7f3b; font-family: var(--sans); font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.summary-total { display: flex; gap: 14px; margin: 0; color: var(--muted); font-size: 13px; }
.summary-total strong { color: var(--ink); font-family: var(--display); font-size: 22px; }
.summary-rows { margin: 0; padding: 0; list-style: none; }
.summary-rows li { display: grid; grid-template-columns: minmax(0, 1fr) 72px 64px; align-items: center; gap: 12px; padding: 8px 0; font-size: 13px; }
.summary-rows li + li { border-top: 1px solid rgba(16, 32, 27, 0.07); }
.summary-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.summary-meter { width: 100%; height: 5px; border: 0; border-radius: 3px; overflow: hidden; background: #eef4e0; appearance: none; -webkit-appearance: none; }
.summary-meter::-webkit-progress-bar { background: #eef4e0; }
.summary-meter::-webkit-progress-value { background: #739d36; }
.summary-meter::-moz-progress-bar { background: #739d36; }
.summary-count { color: var(--muted); text-align: right; white-space: nowrap; }
.summary-count strong { color: var(--ink); }
.admin-filters { display: grid; grid-template-columns: minmax(220px, 1.6fr) repeat(4, minmax(130px, 1fr)) auto; gap: 12px; align-items: end; margin: 22px 0 18px; padding: 18px; background: var(--cream); border: 1px solid var(--line); border-radius: 10px; }
.admin-filters label, .admin-export label { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.admin-filters input, .admin-filters select, .admin-export select { min-height: 40px; margin-top: 5px; padding: 8px 10px; color: var(--ink); background: white; font-size: 13px; letter-spacing: 0; text-transform: none; }
.admin-filters button { min-height: 40px; padding: 0 17px; font-size: 11px; }
.admin-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.admin-result-count { margin: 0; color: var(--muted); font-size: 14px; white-space: nowrap; }
.admin-result-count strong { color: var(--ink); font-family: var(--display); font-size: 22px; }
.admin-result-count span { margin-left: 8px; padding-left: 9px; border-left: 1px solid var(--line); }
.admin-export label { min-width: 130px; }

.admin-bulk { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 12px; padding: 12px 15px; background: #eef4e0; border-left: 3px solid #739d36; border-radius: 5px; }
.admin-bulk p { display: flex; gap: 12px; margin: 0; font-size: 13px; }
.admin-bulk p strong { white-space: nowrap; }
.admin-bulk p span { color: var(--muted); }
.admin-bulk button { min-height: 38px; padding: 0 15px; font-size: 11px; white-space: nowrap; }
.admin-bulk-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.table-hint { display: none; }
.admin-table-wrap { margin: 0; background: white; border-radius: 10px; }
.admin-table { table-layout: fixed; font-size: 13px; }
.admin-table th { padding: 10px 12px; color: var(--muted); background: #f6f4ed; font-size: 10px; letter-spacing: .07em; text-transform: uppercase; }
.admin-table td { padding: 14px 12px; vertical-align: middle; }
.admin-table th:nth-child(2) { width: 15%; }
.admin-table th:nth-child(3) { width: 28%; }
.admin-table th:nth-child(4) { width: 12%; }
.admin-table th:nth-child(5) { width: 15%; }
.admin-table th:nth-child(6) { width: 18%; }
.select-column { width: 44px; text-align: center; }
.select-column input[type=checkbox] { margin: 0; }
.reference-button { min-height: 0; padding: 0; color: var(--forest); background: transparent; border: 0; border-bottom: 1px solid rgba(11, 51, 41, .35); border-radius: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; font-weight: 700; letter-spacing: .02em; text-transform: none; }
.reference-button:hover { color: #4f7f3b; background: transparent; transform: none; border-color: currentColor; }
.institution-name, .contact-detail { display: block; line-height: 1.45; }
.institution-name { font-weight: 600; }
.contact-detail { color: var(--muted); font-size: 12px; }
a.contact-detail { width: fit-content; text-decoration-color: transparent; }
a.contact-detail:hover { text-decoration-color: currentColor; }
.category-label { font-size: 12px; text-transform: capitalize; }
.status { display: inline-block; padding: 4px 8px; border: 1px solid transparent; border-radius: 999px; font-size: 10px; font-weight: 700; line-height: 1.2; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.status-approved { color: #285b25; background: #eaf4df; border-color: #c9dfb6; }
.status-awaiting-payment, .status-awaiting-review { color: #75500d; background: #fbf1dc; border-color: #efd59f; }
.status-correction-requested { color: #81461c; background: #fae9dc; border-color: #eec8ab; }
.status-rejected, .status-cancelled { color: var(--danger); background: #fdecea; border-color: #efc4be; }
.created-date { color: var(--muted); font-size: 12px; white-space: nowrap; }
.admin-empty { padding: 44px !important; color: var(--muted); text-align: center; }
.admin-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 16px; }
.admin-pagination span { color: var(--muted); font-size: 12px; }

/* ---- footer ---- */
.site-footer {
  display: flex; flex-wrap: wrap; gap: 10px 26px; justify-content: space-between;
  padding: 22px max(24px, calc((100vw - var(--shell)) / 2));
  background: var(--forest-deep); color: rgba(255,255,255,0.7); font-size: 13px;
}
.site-footer a { color: rgba(255,255,255,0.7); }
.site-footer a:hover { color: var(--lime); }
.footer-powered { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; }
.footer-powered img { height: 17px; width: auto; display: block; }
.footer-powered-name { font-family: var(--display); font-weight: 600; font-size: 15px; letter-spacing: -0.01em; color: rgba(255,255,255,0.92); }
.site-footer .footer-powered:hover .footer-powered-name { color: #fff; }

@media (max-width: 820px) {
  .site-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .site-nav { gap: 16px; }
  .layout { grid-template-columns: 1fr; }
  aside { position: static; grid-row: 1; max-height: none; overflow: visible; }
  .fields { grid-template-columns: 1fr; }
  .review-list { grid-template-columns: 1fr; gap: 3px; }
  .review-list dd { margin-bottom: 12px; }
  .actions > * { flex: 1; }
  .steps { gap: 6px; }
  .steps li { font-size: 12px; }
  .admin-heading, .admin-toolbar { align-items: flex-start; flex-direction: column; }
  .admin-header-actions, .admin-export { width: 100%; }
  .admin-summary { grid-template-columns: 1fr; }
  .admin-filters { grid-template-columns: 1fr 1fr; }
  .admin-search { grid-column: 1 / -1; }
  .admin-filters button { width: 100%; }
  .admin-export > * { flex: 1; }
  .admin-bulk { align-items: flex-start; flex-direction: column; }
  .admin-bulk p { flex-direction: column; gap: 1px; }
  .admin-bulk-actions, .admin-bulk button { width: 100%; }
  .table-hint { display: block; margin: 0 0 6px; color: var(--muted); font-size: 11px; text-align: right; }
  .admin-table { min-width: 780px; }
  .admin-pagination { justify-content: space-between; }
}

@media (max-width: 520px) {
  .admin-filters { grid-template-columns: 1fr; }
  .admin-search { grid-column: auto; }
  .admin-header-actions button, .admin-export > * { flex: 1 1 100%; }
}
