/* ============================================================ EZFin application styles
   One file, no build step, no framework - the same convention as the marketing site.

   Tokens are carried over from ezfin.com so the application does not look like a different
   company's software. Never hardcode a hex; off-palette values are how a rebrand leaves
   stragglers behind.

   NO WEBFONT. The Content-Security-Policy is locked to 'self', and a font from a CDN would
   need it relaxed for every page. The system stack renders immediately, has no layout shift,
   and costs nothing - not a compromise worth reversing for a slightly different letterform.

   NO JAVASCRIPT ANYWHERE IN THIS APPLICATION. Every interaction is a form post and a redirect.
   That means layout has to work without it: the mobile nav is a scrolling strip, not a drawer,
   because the CSS-only <details> drawer trick behaves inconsistently across engines.
   ============================================================================== */

:root {
  --ink: #0b1c2c;
  --ink-2: #12293e;
  --body: #34434f;
  --muted: #6b7c8c;

  --brand: #1568d8;
  --brand-2: #4da3ff;
  --brand-d: #114fa8;
  --brand-l: #e8f1fe;

  /* Reserved for figures that argue against us, and for money owed. Not a second accent. */
  --gold: #b8791a;
  --gold-l: #fdf4e6;

  --good: #12805c;
  --good-l: #e6f5ef;
  --bad: #b3261e;
  --bad-l: #fdeceb;

  --bg: #ffffff;
  --bg-alt: #f5f9fb;
  --line: #e2ebf1;

  --r: 14px;
  --r-s: 9px;
  --shadow: 0 1px 2px rgba(11, 28, 44, .05), 0 12px 32px -12px rgba(11, 28, 44, .14);

  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  --sidebar: 15rem;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg-alt);
  color: var(--body);
  font: 400 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  color: var(--ink);
  margin: 0 0 .5em;
  font-weight: 700;
  letter-spacing: -.018em;
  line-height: 1.2;
  text-wrap: balance;
}

h1 { font-size: 1.6rem; }
h2 { font-size: 1.22rem; }
h3 { font-size: 1.02rem; }
h4 { font-size: .92rem; }

p { margin: 0 0 1em; text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-d); text-decoration: underline; }

strong, b { font-weight: 650; color: var(--ink); }

/* Every figure. Columns of money that do not line up look like a bug in the arithmetic. */
.num, td.num, .stat b, .money, table { font-variant-numeric: tabular-nums; }

/* ============================================================ LAYOUT */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar);
  flex: 0 0 var(--sidebar);
  background: var(--ink);
  color: #cfdae4;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #fff;
  font-weight: 700;
  font-size: 1.08rem;
  letter-spacing: -.02em;
  padding: 0 6px;
}

.brand:hover { color: #fff; text-decoration: none; }

.brand-mark {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  display: grid;
  place-items: center;
  font-size: .74rem;
  font-weight: 800;
  color: #fff;
}

.brand-sub {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--brand-2);
  font-weight: 600;
  padding: 0 6px;
  margin-top: -12px;
}

.nav-main { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.nav-main a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border-radius: var(--r-s);
  color: #cfdae4;
  font-size: .89rem;
  font-weight: 500;
  min-height: 40px;
}

.nav-main a:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.nav-main a.on { background: var(--brand); color: #fff; }

.nav-main hr {
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, .13);
  margin: 10px 4px;
  /* Load-bearing: with no content this collapses to zero width in the mobile flex row. */
  flex-shrink: 0;
}

.nav-foot { border-top: 1px solid rgba(255, 255, 255, .13); padding-top: 14px; }
.nav-foot .who { font-size: .8rem; color: #9fb2c2; padding: 0 6px 8px; }
.nav-foot .who b { color: #fff; display: block; font-weight: 600; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

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

.topbar h1 { margin: 0; font-size: 1.28rem; }
.topbar .sub { color: var(--muted); font-size: .86rem; margin: 2px 0 0; }

.content { padding: 24px 26px 60px; max-width: 1240px; width: 100%; }

/* ============================================================ CARDS AND GRIDS */

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

.card + .card { margin-top: 18px; }
.card h2, .card h3 { margin-top: 0; }

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.card-head h2, .card-head h3 { margin: 0; }
.card-head .sub { color: var(--muted); font-size: .85rem; }

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.stat {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px 18px;
}

.stat b { display: block; font-size: 1.5rem; color: var(--ink); font-weight: 700; letter-spacing: -.02em; }
.stat span { display: block; color: var(--muted); font-size: .8rem; margin-top: 3px; }
.stat.warn b { color: var(--gold); }
.stat.good b { color: var(--good); }

/* ============================================================ TABLES */

/* .tbl-wrap provides the horizontal scroll. A table must never widen the page. */
.tbl-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }

table { width: 100%; border-collapse: collapse; font-size: .89rem; }

th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 0 12px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--bg-alt); }

th.r, td.r { text-align: right; }
td.strong { color: var(--ink); font-weight: 600; }
td.muted, .muted { color: var(--muted); }
td.nowrap, .nowrap { white-space: nowrap; }

/* ============================================================ BADGES */

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: .73rem;
  font-weight: 600;
  letter-spacing: .01em;
  white-space: nowrap;
  background: var(--bg-alt);
  color: var(--muted);
  border: 1px solid var(--line);
}

.badge.good { background: var(--good-l); color: var(--good); border-color: transparent; }
.badge.bad { background: var(--bad-l); color: var(--bad); border-color: transparent; }
.badge.warn { background: var(--gold-l); color: var(--gold); border-color: transparent; }
.badge.info { background: var(--brand-l); color: var(--brand-d); border-color: transparent; }

/* ============================================================ BUTTONS */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 17px;
  border-radius: var(--r-s);
  border: 1px solid transparent;
  font-size: .89rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--bg);
  color: var(--ink);
  border-color: var(--line);
  text-decoration: none;
}

.btn:hover { text-decoration: none; background: var(--bg-alt); color: var(--ink); }

.btn-brand { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-brand:hover { background: var(--brand-d); border-color: var(--brand-d); color: #fff; }

.btn-danger { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn-danger:hover { background: #8f1e17; border-color: #8f1e17; color: #fff; }

.btn-sm { min-height: 34px; padding: 0 12px; font-size: .82rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ============================================================ FORMS */

.field { margin-bottom: 16px; }

.field label, .lbl {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 5px;
}

.field .hint { font-size: .8rem; color: var(--muted); margin: 5px 0 0; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=tel], select, textarea {
  width: 100%;
  /* 16px on mobile is enforced below. Below that, iOS Safari zooms the page on focus and
     leaves it scrolled sideways. */
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  background: var(--bg);
  font-size: .92rem;
  min-height: 42px;
  color: var(--ink);
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--brand);
  outline-offset: -1px;
  border-color: var(--brand);
}

textarea { min-height: 90px; resize: vertical; }

.frow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }

/* ============================================================ BANNERS */

.msg {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--r-s);
  margin-bottom: 18px;
  font-size: .89rem;
  border: 1px solid transparent;
}

.msg.ok { background: var(--good-l); color: var(--good); }
.msg.error { background: var(--bad-l); color: var(--bad); }
.msg.warn { background: var(--gold-l); color: var(--gold); }
.msg.info { background: var(--brand-l); color: var(--brand-d); }
.msg a { color: inherit; text-decoration: underline; font-weight: 600; }

.note {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: var(--r-s);
  padding: 14px 16px;
  font-size: .88rem;
}

.note.warn { border-left-color: var(--gold); background: var(--gold-l); }
.note h4 { margin: 0 0 5px; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty h3 { color: var(--ink); }

/* ============================================================ PROGRESS */

.bar { height: 7px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); }

.steps { display: flex; gap: 6px; margin-bottom: 24px; flex-wrap: wrap; }

.steps .s {
  flex: 1;
  min-width: 92px;
  font-size: .74rem;
  font-weight: 600;
  color: var(--muted);
  padding-top: 8px;
  border-top: 3px solid var(--line);
}

.steps .s.on { color: var(--brand); border-top-color: var(--brand); }
.steps .s.done { color: var(--good); border-top-color: var(--good); }

/* ============================================================ PUBLIC / APPLY FLOW */

.public {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 18px 60px;
  background: var(--bg-alt);
}

.public-head { width: 100%; max-width: 620px; margin-bottom: 22px; }
.public-body { width: 100%; max-width: 620px; }

.public .card { box-shadow: var(--shadow); }

.disclosure {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  padding: 16px;
  font-size: .87rem;
  white-space: pre-wrap;
  max-height: 260px;
  overflow-y: auto;
  margin-bottom: 14px;
}

.offer {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px;
  margin-bottom: 12px;
  background: var(--bg);
}

.offer.pick { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.offer-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.offer-pay { font-size: 1.45rem; font-weight: 700; color: var(--ink); letter-spacing: -.02em; }
.offer-term { font-size: .84rem; color: var(--muted); }

/* The total is deliberately as prominent as the payment. A longer term is a lower payment and
   materially more interest, and the borrower should see both halves of that trade. */
.offer-total { font-size: .84rem; color: var(--body); margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; }
.offer-total b { color: var(--ink); }

/* ============================================================ SIGN IN */

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 18px;
  background: var(--ink);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg);
  border-radius: var(--r);
  padding: 30px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .5);
}

.auth-card h1 { font-size: 1.32rem; }
.auth-card .lead { color: var(--muted); font-size: .89rem; margin-bottom: 22px; }

.portal-pick { display: grid; gap: 12px; margin-top: 20px; }

.portal-pick a {
  display: block;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  color: var(--ink);
}

.portal-pick a:hover { border-color: var(--brand); background: var(--brand-l); text-decoration: none; }
.portal-pick b { display: block; font-size: .95rem; }
.portal-pick span { display: block; font-size: .82rem; color: var(--muted); margin-top: 2px; }

/* ============================================================ MISC */

.stack { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; gap: 14px; align-items: baseline; }
.right { margin-left: auto; }
.center { text-align: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 7px 20px; font-size: .89rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink); font-weight: 600; text-align: right; }

.crumbs { font-size: .82rem; color: var(--muted); margin-bottom: 6px; }

/* ============================================================ RESPONSIVE
   Verify at 375px after any layout change: scrollWidth must equal clientWidth. A horizontal
   scrollbar on a phone is always a bug. */

@media (max-width: 1080px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .shell { flex-direction: column; }

  .sidebar {
    width: 100%;
    flex: none;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    overflow-x: auto;
  }

  .brand-sub, .nav-foot .who { display: none; }

  /* A scrolling strip, not a drawer. Every destination stays one tap away, and it needs no
     JavaScript and no <details> behaviour that differs between engines. */
  .nav-main { flex-direction: row; gap: 4px; flex: 1; overflow-x: auto; }
  .nav-main a { white-space: nowrap; padding: 8px 12px; }
  .nav-main hr { display: none; }
  .nav-foot { border-top: 0; padding-top: 0; }

  .content, .topbar { padding-left: 16px; padding-right: 16px; }
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
  .frow { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px) {
  /* 16px exactly. Below it, iOS Safari zooms on focus. */
  input[type=text], input[type=email], input[type=password], input[type=number],
  input[type=date], input[type=tel], select, textarea { font-size: 16px; }

  .btn { width: 100%; }
  .btn-row .btn { width: auto; flex: 1; min-width: 140px; }
  .tbl-wrap { margin: 0 -16px; padding: 0 16px; }
}

@media print {
  .sidebar, .topbar, .btn, .msg { display: none; }
  body { background: #fff; }
  .card { border: 0; padding: 0; }
}
