:root {
  color-scheme:light;
  --ink:#1e3028;
  --muted:#53665c;
  --green:#214a39;
  --line:#d7dfd6;
  --bg:#f5f7f2;
  --wash:#e6efe4;
  font:15px/1.5 "DM Sans",system-ui,sans-serif;
  color:var(--ink);
  background:var(--bg);
}

* {
  box-sizing:border-box;
}

body {
  margin:0;
  min-height:100vh;
  display:grid;
  grid-template-columns:215px minmax(0,1fr);
}

.staff-page {
  display:grid;
  grid-template-columns:minmax(0,1fr);
  place-items:start center;
  padding:clamp(18px,7vw,72px) 18px;
}

.staff-card {
  display:grid;
  gap:16px;
  width:min(100%, 34rem);
  padding:clamp(18px,4vw,32px);
  background:white;
  border:1px solid var(--line);
  border-radius:12px;
}

.staff-form,.staff-card #staff-link:not([hidden]) {
  display:grid;
  justify-items:start;
  gap:10px;
}

.staff-card [hidden], .mast [hidden] {
  display:none;
}

.staff-card .staff-check {
  display:flex;
  align-items:center;
  gap:8px;
  color:var(--ink);
}

.staff-card .staff-check input {
  width:auto;
}

.staff-card label {
  width:100%;
}

.staff-card [role="alert"] {
  color:#9e302b;
}

.staff-card p:empty {
  display:none;
}

.staff-list {
  margin:0;
  padding:0;
  list-style:none;
}

.staff-list li, .staff-mast {
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:10px;
}

.staff-list li {
  justify-content:space-between;
  padding:12px 0;
  border-top:1px solid var(--line);
  overflow-wrap:anywhere;
}

aside {
  background:#1e3e32;
  color:white;
  padding:32px 19px;
  display:flex;
  flex-direction:column;
  gap:42px;
}

aside small {
  margin-top:auto;
  color:#c1d3c5;
}

.brand,nav,.mast,.head,.toolbar,.dialogfoot,.metrics,.fields {
  display:flex;
  align-items:center;
  gap:12px;
}

.brand {
  font-weight:650;
}

.brand b {
  border:1px solid #92ad99;
  border-radius:8px;
  padding:7px;
  font-size:15px;
}

nav {
  align-items:stretch;
  flex-direction:column;
  gap:5px;
}

nav a {
  color:#e0e9df;
  text-decoration:none;
  padding:9px 12px;
  border-radius:7px;
}

nav a[aria-current] {
  background:#ffffff20;
  color:white;
  font-weight:650;
}

main {
  width:100%;
  max-width:1250px;
  padding:24px clamp(18px,4vw,65px) 50px;
}

.mast,.head,.dialogfoot {
  justify-content:space-between;
}

.mast {
  font-size:13px;
  color:var(--muted);
  padding:4px 0 18px;
  border-bottom:1px solid var(--line);
}

.head {
  margin:26px 0 18px;
  flex-wrap:wrap;
}

h1,h2,h3,p {
  margin:0;
}

h1 {
  font-size:clamp(26px,3.3vw,40px);
  letter-spacing:-.045em;
  line-height:1.22;
}

h2 {
  font-size:20px;
  letter-spacing:-.025em;
}

h3 {
  font-size:16px;
}

a {
  color:var(--green);
}

p,small,.muted {
  color:var(--muted);
}

button,select,input {
  font:inherit;
}

button,select {
  cursor:pointer;
}

button,.button {
  font-weight:600;
  color:var(--green);
  background:white;
  border:1px solid var(--line);
  border-radius:7px;
  padding:8px 13px;
}

.primary {
  background:var(--green);
  color:white;
  border-color:var(--green);
}

button:hover {
  filter:brightness(.94);
}

:focus-visible {
  outline:3px solid #a97616;
  outline-offset:2px;
}

.metrics {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(145px,1fr));
  margin:18px 0;
}

.metric,.panel {
  background:white;
  border:1px solid var(--line);
  border-radius:12px;
}

.metric {
  padding:17px;
}

.metric:first-child {
  background:var(--wash);
}

.metric strong {
  display:block;
  font-size:clamp(22px,2.8vw,32px);
  letter-spacing:-.045em;
  font-variant-numeric:tabular-nums;
}

.metric span,.tag {
  font-size:13px;
  color:var(--muted);
}

.panel {
  padding:20px;
  margin:16px 0;
}

.panel h2 {
  margin-bottom:8px;
}

.toolbar {
  flex-wrap:wrap;
  margin:12px 0;
}

.scroll {
  overflow-x:auto;
}

table {
  border-collapse:collapse;
  width:100%;
  font-variant-numeric:tabular-nums;
}

th,td {
  padding:11px 8px;
  text-align:left;
  border-bottom:1px solid var(--line);
  vertical-align:top;
}

th {
  font-size:12px;
  color:var(--muted);
}

td button {
  font-size:13px;
  padding:4px 8px;
}

tr:last-child td {
  border-bottom:0;
}

.tag {
  display:inline-block;
  border-radius:5px;
  background:var(--wash);
  padding:2px 7px;
}

.late,.error {
  color:#863c2d;
}

.empty {
  padding:14px 0;
}

dialog {
  border:1px solid var(--line);
  border-radius:12px;
  width:min(510px,94vw);
  max-height:88vh;
  padding:24px;
  color:var(--ink);
}

dialog::backdrop {
  background:#18332866;
}

.fields {
  margin:16px 0;
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  align-items:start;
}

.wide {
  grid-column:1/-1;
}

#check-batch-status:empty,#check-batch-preview:empty {
  display:none;
}

#check-batch-preview input {
  width:100%;
  min-width:8ch;
}

label {
  display:grid;
  gap:4px;
  font-size:14px;
  font-weight:600;
}

input,select {
  min-width:0;
  border:1px solid #aab9ac;
  background:white;
  color:var(--ink);
  border-radius:6px;
  padding:7px 9px;
}

.dialogfoot {
  margin-top:16px;
}

.danger {
  color:#943e30;
}

.history {
  padding:9px 0;
  border-bottom:1px solid var(--line);
}

summary {
  cursor:pointer;
}

.review-past {
  margin-top:12px;
}

.review-past summary {
  color:var(--green);
  font-weight:600;
  text-decoration:underline;
}

.history pre {
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  font-size:13px;
  background:var(--bg);
  padding:9px;
}

dl {
  display:grid;
  grid-template-columns:1fr auto;
  gap:6px 14px;
}

dd {
  margin:0;
  font-variant-numeric:tabular-nums;
}

.link {
  background:transparent;
  border:none;
  padding:0;
  color:var(--green);
  text-decoration:underline;
}

.back {
  display:inline-block;
  margin-top:19px;
}

@media(max-width:740px) {
  body {
    display:block;
  }
  aside {
    padding:10px 16px;
    display:flex;
    flex-direction:row;
    align-items:center;
    gap:10px;
    flex-wrap:wrap;
  }
  .brand span {
    display:none;
  }
  nav {
    flex-direction:row;
    flex-wrap:wrap;
  }
  aside small {
    margin:0 0 0 auto;
  }
  main {
    padding:15px;
  }
  .metrics {
    gap:8px;
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  .metric {
    padding:12px;
  }
  .panel {
    padding:13px;
  }
  .head {
    margin-top:20px;
  }
}

[hidden] {
  display:none!important;
}

.field-group {
  border:0;
  display:grid;
  grid-column:1/-1;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
  margin:0;
  min-width:0;
  padding:0;
}

.payment-actions {
  display:flex;
  flex-wrap:wrap;
  gap:6px;
}

.check-label {
  display:flex;
  align-items:center;
  grid-column:1/-1;
}

textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #aabbaf;
  border-radius: 7px;
  font: inherit;
  resize: vertical;
}

.guarantee-wording {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.statement-link {
  text-decoration:none;
}

.borrower-statement {
  max-width:1050px;
  overflow-wrap:anywhere;
}

.statement-header {
  margin-top:24px;
}

.statement-header h1 {
  margin:4px 0 8px;
}

@media print {
  body.statement-page {
    display:block;
    background:white;
    color:#111;
    font-size:10pt;
  }
  .statement-page aside,.statement-page .mast,.statement-page .statement-controls,.statement-page dialog {
    display:none;
  }
  .statement-page main {
    max-width:none;
    padding:0;
  }
  .borrower-statement {
    max-width:none;
  }
  .statement-header {
    margin-top:0;
  }
  .statement-header h1 {
    font-size:22pt;
  }
  .borrower-statement .metrics {
    grid-template-columns:repeat(3,minmax(0,1fr));
  }
  .borrower-statement .metric {
    padding:8pt;
    background:white;
  }
  .borrower-statement .metric strong {
    font-size:16pt;
  }
  .borrower-statement .panel {
    border:0;
    padding:0;
    margin:14pt 0;
  }
  .borrower-statement .panel h2 {
    font-size:13pt;
    break-after:avoid;
  }
  .borrower-statement .scroll {
    overflow:visible;
  }
  .borrower-statement thead {
    display:table-header-group;
  }
  .borrower-statement tr,.borrower-statement .metrics {
    break-inside:avoid;
  }
  .borrower-statement th,.borrower-statement td {
    padding:5pt 4pt;
  }
}
