:root {
  color-scheme: light;
  --ink: #14243d;
  --muted: #65748b;
  --line: #e1e8f2;
  --paper: #f3f7fc;
  --white: #fff;
  --green: #075dbd;
  --green-dark: #064a98;
  --mint: #e8f3ff;
  --amber: #a56708;
  --red: #b63843;
  --shadow: 0 12px 32px rgba(20, 51, 93, .07);
  --navy: #071b55;
  --cyan: #11c8ee;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Roboto, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

h1, h2, h3, .stat-value, .brand { font-family: Inter, "Segoe UI", Roboto, system-ui, sans-serif; }
.sidebar { background: linear-gradient(180deg, #fff 0%, #f7faff 100%); border-right-color: #dce6f3; }
.brand { padding-bottom: 25px; }
.brand-logo { object-fit: contain; object-position: left center; max-height: 86px; }
.nav-link { border-radius: 10px; transition: background .16s ease, color .16s ease, transform .16s ease; }
.nav-link:hover { transform: translateX(2px); }
.nav-link:hover, .nav-link.selected { background: #e8f3ff; color: var(--navy); }
.nav-link.selected { box-shadow: inset 3px 0 var(--cyan); }
.main { background: var(--paper); }
.topbar { color: #526681; border-bottom-color: var(--line); }
.content { max-width: 1540px; padding-top: 30px; }
.footer { color: #8190a7; border-top-color: var(--line); }
.button { border-radius: 9px; min-height: 40px; transition: transform .16s ease, box-shadow .16s ease, background .16s ease; }
.button:hover { transform: translateY(-1px); box-shadow: 0 6px 15px rgba(7, 40, 92, .14); }
.primary { background: linear-gradient(135deg, #075dbd, #073c92); }
.primary:hover { background: linear-gradient(135deg, #064a98, #062e76); }
.secondary { border-color: #d8e3f1; color: #243e64; }
.stat-grid { gap: 16px; }
.stat-card, .panel { border-color: #e3eaf3; border-radius: 14px; box-shadow: var(--shadow); }
.stat-card { position: relative; min-height: 130px; padding: 21px; overflow: hidden; }
.stat-card::after { content: ""; position: absolute; width: 110px; height: 110px; right: -34px; bottom: -48px; border-radius: 50%; background: #edf6ff; }
.stat-label { color: #667791; font-size: 11px; letter-spacing: .02em; }
.stat-value { position: relative; z-index: 1; color: var(--navy); font-size: clamp(21px, 2vw, 28px); }
.stat-foot { color: #8290a5; font-size: 11px; }
.stat-icon { position: absolute; top: 17px; right: 18px; z-index: 1; display: grid; place-items: center; width: 37px; height: 37px; border-radius: 12px; background: #e6f6fb; color: #008eb5; font-size: 17px; font-weight: 800; }
.panel { padding: 22px; }
.panel h2 { color: #142b52; font-size: 15px; }
.panel-head { margin-bottom: 18px; }
.text-link, .table-link { color: #075dbd; }
.location-button { margin-top: 8px; width: fit-content; }
.route-location { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid #edf2f6; font-size: 11px; color: #52657a; }
.route-location > span { min-width: 0; overflow-wrap: anywhere; }
.route-location .button { flex-shrink: 0; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.contact-button { min-height: 36px; padding: 8px 12px; font-size: 11px; }
.contact-button.whatsapp { border-color: #b8e8d0; background: #e9fbf1; color: #087642; }
.contact-button.whatsapp:hover { background: #d8f6e6; }
.contact-phone { margin-top: 8px; font-size: 11px; color: #52657a; }
.loan-assignment-panel { max-width: 760px; margin-bottom: 16px; }
.table-wrap { border-radius: 10px; }
.table-wrap th { position: sticky; top: 0; background: #f1f6fc; color: #516582; border-color: #e3eaf3; }
.table-wrap td { color: #3e516c; }
.table-wrap tbody tr { transition: background .15s ease; }
.table-wrap tbody tr:hover { background: #f6faff; }
.amount, .due-amount { color: #102b59 !important; }
.due-day { background: #e5f6fb; color: #087c9f; border-radius: 11px; }
.form-stack label { color: #344965; font-size: 12px; }
.form-stack input, .form-stack select, .form-stack textarea, .search-bar input { border-radius: 9px; border-color: #d8e3ef; min-height: 42px; }
.form-stack input:focus, .form-stack select:focus, .form-stack textarea:focus, .search-bar input:focus { border-color: #05a9d2; box-shadow: 0 0 0 3px rgba(17, 200, 238, .16); }
.notice { background: #e8f5ff; color: #124e7d; border: 1px solid #cfe8f9; border-radius: 10px; }
.notice.error { background: #fff0f0; color: #9b2833; border-color: #f3d1d4; }
.badge { border-radius: 999px; padding: 5px 10px; }
.badge.active, .badge.paid { background: #e4f6ff; color: #075d9b; }
.badge.cancelled, .badge.uncollectible, .badge.refused { background: #fff0f0; color: #a6323b; }
.badge.pending, .badge.rescheduled { background: #fff5df; color: #94600e; }
.badge.visited, .badge.no_answer { background: #edf2f8; color: #526681; }
.login-wrap { min-height: calc(100vh - 105px); padding: 28px 16px; background: radial-gradient(ellipse at 50% 0%, #e2f7ff 0, transparent 46%); }
.login-card { width: min(100%, 430px); padding: 34px; border-color: #dfe8f3; border-radius: 18px; box-shadow: 0 24px 65px rgba(7, 27, 85, .12); }
.login-brand { max-width: 270px; margin: 0 auto 22px; padding: 0; }
.login-brand .brand-logo { width: 100%; max-height: 82px; object-fit: contain; object-position: center; }
.login-card h1 { color: var(--navy); font-size: 28px; letter-spacing: -.04em; }
.login-card > .muted { margin-bottom: 24px; line-height: 1.6; }
.password-control { display: flex; align-items: stretch; position: relative; }
.password-control input { padding-right: 76px; }
.password-toggle { position: absolute; top: 1px; right: 1px; height: calc(100% - 2px); padding: 0 12px; border: 0; border-radius: 0 8px 8px 0; background: #f2f7fc; color: #07539c; font: 600 11px "Segoe UI", sans-serif; cursor: pointer; }
.password-toggle:hover { background: #e4f2fb; }
.login-card .full { min-height: 46px; margin-top: 3px; font-size: 13px; }
.login-card a { color: #075dbd; font-weight: 600; text-decoration: none; }
.login-card a:hover { text-decoration: underline; }
.dashboard-hero { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin: 0 0 22px; padding: 25px 28px; border-radius: 16px; color: white; background: radial-gradient(circle at 95% 0, rgba(17, 200, 238, .4), transparent 27%), linear-gradient(120deg, #071b55, #0a4c9b); box-shadow: 0 14px 30px rgba(7, 27, 85, .16); }
.dashboard-hero .eyebrow { color: #8beaff; }
.dashboard-hero h1 { color: white; margin: 5px 0; font-size: 27px; }
.dashboard-hero .muted { color: #d0e1f7; }
.dashboard-hero .button { background: white; color: #073c83; }
.dashboard-hero .button:hover { background: #e9faff; }
.dashboard-stats { margin-bottom: 20px; }
.dashboard-stats .stat-label { padding-right: 44px; }
.dashboard-insights { align-items: stretch; margin-bottom: 20px; }
.chart-key { display: flex; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 10px; }
.chart-key span::before { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 2px; content: ''; }
.expected-key::before { background: #b8c9e7; }
.collected-key::before { background: #08a4c9; }
.bar-chart { display: grid; gap: 11px; }
.chart-row { display: grid; grid-template-columns: 43px minmax(0, 1fr) 124px; align-items: center; gap: 8px; }
.chart-month { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.chart-bars { display: grid; align-content: center; gap: 3px; min-height: 20px; }
.chart-bar { display: block; min-width: 2px; height: 8px; border-radius: 99px; }
.chart-bar.expected { background: #b8c9e7; }
.chart-bar.collected { background: linear-gradient(90deg, #057fa3, #0ebbd5); }
.chart-bar.overdue { background: linear-gradient(90deg, #f09a44, #d75542); }
.chart-values { display: flex; justify-content: flex-end; gap: 7px; color: var(--muted); font-size: 9px; white-space: nowrap; }
.overdue-chart .chart-row { grid-template-columns: 43px minmax(0, 1fr) 72px; }
.top-debtors { margin-bottom: 20px; }
.debtor-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 2px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.debtor-row:first-of-type { border-top: 0; }
.debtor-row:hover b { color: #057fa3; }
.debtor-row b, .debtor-row small { display: block; }
.debtor-row small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.debtor-row strong { color: #b8493a; font-size: 13px; white-space: nowrap; }
.login-card .notice { margin-bottom: 15px; }
:focus-visible { outline: 3px solid rgba(0, 174, 218, .48); outline-offset: 2px; }

@media (max-width: 1000px) {
  .content { padding: 24px; }
  .stat-card { min-height: 122px; }
}
@media (max-width: 650px) {
  .route-location { align-items: flex-start; flex-direction: column; }
  .route-location .button { width: 100%; }
  .location-button { width: 100%; }
  .contact-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .contact-button { width: 100%; }
  .content { padding: 18px 14px 28px; }
  .brand-logo { max-width: 175px; max-height: 56px; }
  .dashboard-hero { align-items: flex-start; flex-direction: column; padding: 22px; }
  .dashboard-hero h1 { font-size: 23px; }
  .dashboard-hero .button { width: 100%; }
  .dashboard-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .dashboard-stats .stat-card { min-height: 118px; padding: 14px; }
  .dashboard-stats .stat-icon { top: 12px; right: 12px; width: 30px; height: 30px; font-size: 14px; }
  .dashboard-stats .stat-value { font-size: 19px; overflow-wrap: anywhere; }
  .chart-row, .overdue-chart .chart-row { grid-template-columns: 37px minmax(0, 1fr); }
  .chart-values { grid-column: 2; justify-content: flex-start; }
  .login-wrap { min-height: calc(100vh - 90px); padding: 18px 12px; }
  .login-card { padding: 25px 21px; }
  .login-brand { max-width: 225px; margin-bottom: 20px; }
  .login-brand .brand-logo { max-height: 68px; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; } }

.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; }
.login-eyebrow { margin: 0 0 4px; color: #0786a9; text-align: center; }
.login-reset { margin: 18px 0 0; text-align: center; font-size: 12px; }
.login-security { display: flex; justify-content: center; align-items: center; gap: 7px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); color: #7788a0; font-size: 10px; }
.login-security span { color: #06a7c8; font-size: 8px; }
.dashboard-empty { display: grid; justify-items: center; gap: 7px; padding: 33px 12px; }
.dashboard-empty > span:first-child { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 3px; border-radius: 14px; background: #e7f6fb; color: #0585a8; font-size: 19px; }
.dashboard-empty b { color: #19345f; font-size: 12px; }
.dashboard-empty > span:last-child { color: var(--muted); font-size: 11px; }
.dashboard-panels { align-items: start; }

.client-profile-summary { display: flex; align-items: center; gap: 18px; }
.client-profile-photo { display: grid; place-items: center; flex: 0 0 82px; width: 82px; height: 82px; overflow: hidden; border: 1px solid #d9e5e8; border-radius: 50%; background: #eaf4f5; color: #087f99; font: 700 30px Manrope, sans-serif; }
.client-profile-photo img { width: 100%; height: 100%; object-fit: cover; }
.client-list-name { display: inline-flex; align-items: center; gap: 10px; color: #176c56; font-size: 11px; font-weight: 600; text-decoration: none; }
.client-list-photo { display: grid; place-items: center; flex: 0 0 34px; width: 34px; height: 34px; overflow: hidden; border-radius: 50%; background: #eaf4f5; color: #087f99; font-size: 12px; font-weight: 700; }
.client-list-photo img { width: 100%; height: 100%; object-fit: cover; }
.client-form-image-preview { width: min(100%, 180px); max-height: 180px; align-self: flex-start; border: 1px solid #d9e5e8; border-radius: 10px; object-fit: cover; }
.client-loan-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid #eff2f0; }
.page-heading-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.client-loan-main { display: flex; flex: 1; min-width: 0; align-items: center; justify-content: space-between; gap: 8px; color: var(--ink); font-size: 11px; text-decoration: none; }
.client-loan-main b, .client-loan-main small { display: block; }
.client-loan-main small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.refinance-link { padding: 7px 10px; font-size: 10px; }
.refinance-summary { max-width: 740px; margin-bottom: 14px; }
.refinance-summary p { margin: 6px 0 0; color: #467060; font-size: 11px; line-height: 1.5; }
.refinance-notice { margin-bottom: 17px; }
.refinance-notice a { margin-left: 5px; }
.badge.refinanced { background: #eaf0fa; color: #536b9c; }

@media (max-width: 650px) {
  .sidebar { overflow-x: auto; white-space: nowrap; }
  .sidebar .brand { white-space: normal; }
  .table-wrap { overflow: visible; margin: 0; }
  .table-wrap table, .table-wrap tbody { display: block; width: 100%; white-space: normal; }
  .table-wrap thead { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
  .table-wrap tbody tr { display: block; margin: 10px 0; padding: 4px 12px; border: 1px solid #e2eaf3; border-radius: 11px; background: #fff; box-shadow: 0 4px 14px rgba(20, 51, 93, .045); }
  .table-wrap td { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; padding: 9px 0; border-bottom: 1px solid #edf1f6; text-align: right; overflow-wrap: anywhere; }
  .table-wrap td::before { content: attr(data-label); flex: 0 0 38%; color: #718099; font-size: 10px; font-weight: 700; text-align: left; }
  .table-wrap td[colspan] { display: block; text-align: center; }
  .table-wrap td[colspan]::before { content: none; }
  .table-wrap tbody tr:last-child td { border-bottom: 1px solid #edf1f6; }
  .table-wrap tbody tr td:last-child { border-bottom: 0; }
  .table-wrap .right { text-align: right !important; }
}

.checkbox-field { display: flex; flex-direction: column; gap: 5px; }
.form-stack .checkbox-field > label { display: flex; flex-direction: row; align-items: center; gap: 10px; width: fit-content; cursor: pointer; }
.form-stack .checkbox-field input[type="checkbox"] { width: 18px; min-height: 18px; height: 18px; margin: 0; padding: 0; accent-color: #075dbd; }
.checkbox-field .help { margin-left: 28px; line-height: 1.5; }
