:root {
  --bg: #eef3f8;
  --bg-2: #ffffff;
  --bg-3: #e8eef6;
  --line: #d5dee8;
  --text: #1b2430;
  --muted: #5d6b7c;
  --blue: #1a6eb8;
  --blue-2: #3a9ce8;
  --blue-dim: rgba(26, 110, 184, 0.12);
  --good: #177e4e;
  --warn: #8f6808;
  --bad: #ba4141;
  --side: #0d1520;
  --radius: 14px;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); min-height: 100%; }
a { color: var(--blue); text-decoration: none; }
img.logo { max-width: 100%; height: auto; display: block; }
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(180deg, #d7e6f5 0%, #eef3f8 45%, #f7fafc 100%);
}
.auth-card {
  width: min(440px, 100%);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px 26px 32px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(16, 32, 54, 0.08);
}
.auth-card .logo {
  width: 220px;
  margin: 0 auto 12px;
  background: transparent;
  border-radius: 12px;
  padding: 8px;
}
.tag { letter-spacing: .16em; font-size: 11px; color: var(--blue); text-transform: uppercase; }
.auth-card h1 { font-weight: 500; font-size: 22px; margin: 14px 0 6px; }
.hint { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
label { display: block; text-align: left; font-size: 12px; color: var(--muted); margin: 12px 0 6px; }
input, select, textarea {
  width: 100%;
  background: #f7fafc;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 15px;
}
textarea { min-height: 88px; resize: vertical; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 10px; padding: 11px 16px; font-weight: 600; cursor: pointer;
  background: linear-gradient(180deg, #2579c5, #1a6eb8); color: #fff;
}
.btn.full { width: 100%; margin-top: 16px; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: #ba4141; color: #fff; }
/* Keyboard focus: one clear ring everywhere (white on the dark bars), and a skip link for the long sidebar. */
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.side :focus-visible, .subnav :focus-visible { outline-color: #fff; }
main:focus { outline: none; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 1000; background: #fff; color: var(--blue); font-weight: 600; padding: 9px 14px; border: 2px solid var(--blue); border-radius: 8px; }
.skip-link:focus { top: 8px; }
.app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side {
  background: var(--side);
  border-right: 1px solid #1b2838;
  padding: 18px 14px;
}
.side .logo { width: 180px; margin: 0 auto 18px; background: #fff; border-radius: 12px; padding: 10px 8px; }
.nav a {
  display: block; color: #9aacbf; padding: 10px 12px; border-radius: 10px; margin-bottom: 4px;
}
.nav a.active, .nav a:hover { background: rgba(74, 166, 238, 0.16); color: #fff; }
.main { padding: 22px 26px 48px; }
.top {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 22px;
}
.top h2 { margin: 0; font-weight: 560; }
.top h1 { margin: 0; font-weight: 560; }
.main h1 { font-size: 1.5em; margin: 0.83em 0; }
.top h1, .main .top h1 { margin: 0; }
h1.page-title { font-size: 1.5em; margin: 0.83em 0; }
.grid { display: grid; gap: 14px; }
.cards { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 4px 16px rgba(16, 32, 54, 0.04);
}
.card h3 { margin: 0 0 8px; font-size: 13px; color: var(--muted); font-weight: 500; }
.card .n { font-size: 26px; font-weight: 650; color: #12324f; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 8px; border-bottom: 1px solid #e6edf4; }
th[scope="row"] { text-align: left; font-weight: inherit; color: inherit; }
.table th[scope="row"] { padding: 10px 8px; border-bottom: 1px solid #e6edf4; color: inherit; font-weight: inherit; }
.badge { font-size: 11px; padding: 3px 8px; border-radius: 999px; background: var(--bg-3); color: var(--blue); }
.badge.good { background: #e3f6ec; color: var(--good); }
.badge.warn { background: #fff4d6; color: var(--warn); }
.badge.bad { background: #fde8e8; color: var(--bad); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.span-2 { grid-column: 1 / -1; }
.flash { background: #e3f6ec; color: var(--good); padding: 10px 12px; border-radius: 10px; margin-bottom: 14px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 10px; margin: 12px 0; }
.metric { background: var(--bg-3); padding: 12px; border-radius: 10px; }
.metric span { display: block; color: var(--muted); font-size: 12px; }
.portal-head { display: flex; align-items: center; gap: 14px; }
.portal-head .logo { width: 140px; background: #000; border-radius: 10px; padding: 8px; }
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .side { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
  .side .logo { width: 120px; margin: 0; }
  .nav { display: flex; flex-wrap: wrap; gap: 6px; }
  .form-grid { grid-template-columns: 1fr; }
  /* a wide table or board scrolls inside the page instead of pushing the whole page sideways */
  .app { min-width: 0; }
  .main { min-width: 0; max-width: 100vw; overflow-x: auto; padding: 16px 14px 40px; }
  .main table { display: block; max-width: 100%; overflow-x: auto; }
}

.alert-bar {
  background: #fff4d6;
  border: 1px solid #e6c56e;
  color: #6b5208;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 16px;
}
.alert-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0; }

.table tr.total td { font-weight: 700; background: #e8eef6; border-top: 2px solid #c5d3e3; }

.modal-back {
  position: fixed; inset: 0; background: rgba(13, 21, 32, 0.55);
  display: grid; place-items: center; z-index: 40; padding: 18px;
}
.modal {
  width: min(480px, 100%); background: #fff; border-radius: 16px;
  border: 1px solid var(--line); padding: 22px; box-shadow: 0 16px 40px rgba(16, 32, 54, 0.18);
}
.steps { display: flex; flex-wrap: wrap; gap: 8px; }
.step {
  flex: 1 1 200px; background: var(--bg); border-radius: 10px; padding: 10px 12px; font-size: 13px; color: var(--text);
}
.step strong { display: block; color: var(--blue); font-size: 12px; margin-bottom: 4px; }
.setup-banner {
  background: #fff4d6; color: #6d5420; border-radius: 10px; padding: 10px 12px; margin-bottom: 14px;
}
.nav a .nav-count {
  display: inline-block;
  min-width: 1.25em;
  margin-left: 8px;
  padding: 0 6px;
  border-radius: 999px;
  background: #d43232;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.6;
  text-align: center;
  vertical-align: middle;
}
.nav a.has-flag { color: #fff; }
.review-alert {
  background: #fde8e8;
  border: 2px solid #c44545;
  color: #6b1d1d;
}
.review-alert a { color: #8a1f1f; font-weight: 700; }
.review-banner {
  background: #fde8e8;
  border: 2px solid #c44545;
  color: #6b1d1d;
  border-radius: 12px;
  padding: 14px 16px;
  margin: 0 0 18px;
}
.review-banner strong { display: block; margin-bottom: 4px; font-size: 16px; }
.review-banner .review-links { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 8px; }
.review-banner a { font-weight: 700; color: #8a1f1f; }
.review-card {
  border: 2px solid #c44545;
  background: #fff6f6;
}
.review-card h3 { color: #8a1f1f; }
.review-card .n { color: #c44545; }
.review-list { margin: 8px 0 0; padding-left: 18px; }
.review-list li { margin: 6px 0; }
.table tr.needs-review td { background: #fff4d6; }
.table tr.needs-review td:first-child { box-shadow: inset 4px 0 0 #c44545; }

.subnav { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.subnav:empty { display: none; }
.subnav a { font-size: 0.85em; padding: 4px 10px; border-radius: 6px; color: #9fb3c8; text-decoration: none; }
.subnav a.active, .subnav a:hover { background: rgba(74, 166, 238, 0.16); color: #fff; }
.subnav summary { color: #9fb3c8; }          /* the More menu: without this it fell back to the dark page text colour on the dark bar */
.subnav summary.active, .subnav summary:hover { color: #fff; }

/* UX-18 progress line */
.pline{display:flex;flex-wrap:wrap;gap:4px;margin:6px 0;padding:0;list-style:none;font-size:12px}
.pline li{padding:2px 8px;border-radius:999px;background:#eef2f6;color:#5b6b7a}
.pline li.done{background:#dff3e6;color:#1b5e3a}
.pline li.current{background:#1f3a5f;color:#fff;font-weight:650}

/* Phones: the "Send Short App" form opens in the page instead of floating off to the right (it made the page wider than the screen). */
@media (max-width: 640px) {
  .short-app { position: static !important; min-width: 0 !important; max-width: 100%; box-sizing: border-box; }
  .short-app input, .short-app select { max-width: 100%; box-sizing: border-box; }
}

/* Printing a staff page (a loan, a payoff, a statement): leave out the sidebar, the skip link and the buttons, and use the full width. */
@media print {
  .app { display: block; }
  .side, .skip-link, .btn, button, .flash { display: none !important; }
  .main { padding: 0; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
  a[href]:after { content: none; }
}

/* Utility classes replacing the most common inline style="" values (CSP1).
   Spacing and colour ones use !important to match what inline style did;
   the display ones don't, so scripts that set style.display still win. */
.u-inline{display:inline}
.u-inline-block{display:inline-block}
.u-mt8{margin-top:8px!important}
.u-mt10{margin-top:10px!important}
.u-mt12{margin-top:12px!important}
.u-mt14{margin-top:14px!important}
.u-mt16{margin-top:16px!important}
.u-mt18{margin-top:18px!important}
.u-w100{width:100%!important}
.u-block-m8{display:block!important;margin:8px 0!important}
.u-block-m10{display:block!important;margin:10px 0!important}
.u-m4-0-0{margin:4px 0 0!important}
.u-m0{margin:0!important}
.u-err{color:#b3261e!important}
.u-right{text-align:right!important}

/* More inline style values moved to classes (CSP1). Non-display properties use !important to match inline precedence. */
.u2-0{background:#fff6d6!important}
.u2-1{display:block;padding:8px!important}
.u2-2{background:#fde8e8!important;color:#8a2b2b!important}
.u2-3{display:inline;margin-left:8px!important}
.u2-4{display:block;margin:6px 0!important}
.u2-5{margin:6px 0!important}
.u2-6{margin:8px 0!important}
.u2-7{display:block}
.u2-8{margin:12px 0!important}
.u2-9{max-width:860px!important;margin:0 auto!important}
.u2-10{margin-bottom:16px!important}
.u2-11{cursor:pointer!important}
.u2-12{max-width:900px!important;margin:0 auto!important}
.u2-13{font-size:24px!important}
.u2-14{margin-top:6px!important}
.u2-15{margin-bottom:8px!important}
.u2-16{width:70%!important}
.u2-17{background:#e6f4ea!important;color:#14532d!important}
.u2-18{display:inline-block;vertical-align:top!important}
.u2-19{margin-bottom:10px!important}
.u2-20{width:100%!important;font-size:16px!important;padding:10px!important}
.u2-21{text-align:center!important;margin-top:24px!important}
.u2-22{color:#c0392b!important}
.u2-23{cursor:grab!important}
.u2-24{border:2px solid #d64545!important}
.u2-25{background:#fff8ee!important}
.u2-26{max-width:520px!important}
.u2-27{background:#fff4e0!important;color:#7a4b00!important}
.u2-28{max-width:720px!important;margin:0 auto!important}
.u2-29{margin-top:8px!important;max-width:640px!important}
.u2-30{border:2px solid #e0a800!important}

/* Touch targets: links and buttons that sit close together are at least 24px tall (WCAG 2.2 target size). */
.hint a, .touch-list a { display: inline-block; padding: 6px 0; }
details > summary { padding-block: 4px; }
.touch-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.touch-row a, .touch-row button { display: inline-flex; align-items: center; min-height: 32px; }
input[type="checkbox"], input[type="radio"] { width: auto; min-width: 24px; min-height: 24px; }

/* Links inside running text are underlined, so colour is not the only cue (WCAG 1.4.1). Buttons and navigation keep their own look. */
p a:not(.btn), li a:not(.btn), label a, .hint a { text-decoration: underline; }
.u-underline { text-decoration: underline; }

.list-filter { width: 100%; max-width: 420px; margin: 0 0 10px; }

/* Sortable table headers: a real button inside the header cell, with a small arrow for the sorted column. */
.th-sort { background: none; border: 0; padding: 4px 0; margin: 0; font: inherit; color: inherit; cursor: pointer; text-align: inherit; min-height: 24px; }
.th-sort:hover { text-decoration: underline; }
th[aria-sort="ascending"] .th-sort::after { content: " \25B2"; font-size: 0.7em; }
th[aria-sort="descending"] .th-sort::after { content: " \25BC"; font-size: 0.7em; }
