:root {
    --navy-950: #071a2b;
    --navy-900: #102a43;
    --navy-800: #173f5f;
    --ink: #172b3a;
    --muted: #647788;
    --line: #dfe7ec;
    --surface: #ffffff;
    --canvas: #f3f7f9;
    --teal: #149989;
    --teal-dark: #0f766e;
    --teal-soft: #e6f6f3;
    --blue-soft: #e9f2fb;
    --amber: #c87912;
    --amber-soft: #fff4dc;
    --red: #c43e4f;
    --red-soft: #ffebee;
    --green: #20825e;
    --green-soft: #e8f6ef;
    --shadow: 0 18px 50px rgba(16, 42, 67, .09);
    --shadow-soft: 0 7px 24px rgba(16, 42, 67, .07);
    --radius: 18px;
}

* { box-sizing: border-box; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    margin: 0;
    color: var(--ink);
    background: var(--canvas);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { color: var(--navy-950); line-height: 1.14; letter-spacing: -.025em; }
h1 { margin-bottom: .35rem; font-size: clamp(1.55rem, 2vw, 2.05rem); }
h2 { margin-bottom: .35rem; font-size: clamp(1.25rem, 1.7vw, 1.55rem); }
p { color: var(--muted); }

.eyebrow {
    margin-bottom: .35rem;
    color: var(--teal-dark);
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

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

.sidebar {
    position: fixed;
    z-index: 30;
    inset: 0 auto 0 0;
    display: flex;
    width: 270px;
    flex-direction: column;
    padding: 1.5rem 1rem;
    overflow-y: auto;
    color: #d9e6ee;
    background: var(--navy-950);
}

.brand-lockup { display: flex; align-items: center; gap: .8rem; }
.brand-lockup strong { display: block; color: var(--navy-950); font-size: .98rem; line-height: 1.25; }
.brand-lockup small { display: block; margin-top: .12rem; color: var(--muted); font-size: .75rem; }
.brand-lockup.light strong, .sidebar-brand strong { color: #fff; }
.brand-lockup.light small, .sidebar-brand small { color: #9db1c2; }

.brand-mark {
    display: inline-grid;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    place-items: center;
    color: #fff;
    border-radius: 13px;
    background: var(--teal);
    box-shadow: 0 8px 24px rgba(20, 153, 137, .27);
    font-size: 1.2rem;
    font-weight: 900;
}

.sidebar-brand { padding: .35rem .45rem 1.6rem; }
.side-nav { display: grid; gap: .38rem; margin-top: .55rem; }
.side-nav a {
    display: flex;
    align-items: center;
    gap: .85rem;
    min-height: 48px;
    padding: .7rem .9rem;
    color: #b9cad6;
    border-radius: 13px;
    font-size: .94rem;
    font-weight: 650;
    transition: background .2s ease, color .2s ease, transform .2s ease;
}
.side-nav a span { width: 22px; color: #82a0b6; font-size: 1.2rem; text-align: center; }
.side-nav a:hover { color: #fff; background: rgba(255,255,255,.06); transform: translateX(2px); }
.side-nav a.active { color: #fff; background: var(--navy-800); box-shadow: inset 3px 0 0 var(--teal); }
.side-nav a.active span { color: #5ee0ce; }

.sidebar-user {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: .7rem;
    margin-top: auto;
    padding: 1rem .55rem .25rem;
    border-top: 1px solid rgba(255,255,255,.1);
}
.sidebar-user strong { display: block; overflow: hidden; color: #fff; font-size: .86rem; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user small { display: block; color: #86a0b3; font-size: .73rem; }
.sidebar-user > a { color: #9fb1be; font-size: 1.2rem; }

.avatar {
    display: inline-grid;
    width: 38px;
    height: 38px;
    place-items: center;
    color: #fff;
    border-radius: 12px;
    background: var(--navy-800);
    font-weight: 800;
}
.avatar.small { width: 34px; height: 34px; border-radius: 10px; }
.avatar.large { width: 68px; height: 68px; border-radius: 19px; background: var(--teal); font-size: 1.55rem; }

.main-panel { width: calc(100% - 270px); min-width: 0; margin-left: 270px; }
.topbar {
    position: sticky;
    z-index: 20;
    top: 0;
    display: flex;
    min-height: 88px;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem clamp(1.1rem, 3vw, 2.4rem);
    border-bottom: 1px solid rgba(210, 222, 229, .75);
    background: rgba(243, 247, 249, .94);
    backdrop-filter: blur(12px);
}
.topbar h1 { margin: 0; }
.topbar .eyebrow { margin: 0 0 .12rem; }
.topbar-account { display: flex; align-items: center; gap: .55rem; color: var(--navy-900); font-size: .88rem; font-weight: 700; }
.menu-button { display: none; width: 43px; height: 43px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--navy-900); }
.content-wrap { width: min(1520px, 100%); margin: 0 auto; padding: 1.6rem clamp(1rem, 3vw, 2.4rem) 3.5rem; }

.panel, .stat-card, .loan-card, .client-profile, .welcome-panel, .loan-hero {
    border: 1px solid rgba(210, 223, 230, .9);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}
.panel { margin-bottom: 1.25rem; padding: 1.35rem; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; }
.panel-heading h2, .panel-heading p { margin-bottom: 0; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.15rem; }
.stat-card { position: relative; min-height: 150px; padding: 1.2rem; overflow: hidden; }
.stat-card::after { position: absolute; right: -16px; bottom: -28px; width: 78px; height: 78px; content: ""; border: 16px solid currentColor; border-radius: 50%; opacity: .08; }
.stat-label { display: block; margin-bottom: .8rem; color: var(--muted); font-size: .78rem; font-weight: 760; text-transform: uppercase; letter-spacing: .06em; }
.stat-card strong { display: block; overflow: hidden; color: var(--navy-950); font-size: clamp(1.45rem, 2vw, 2rem); letter-spacing: -.04em; text-overflow: ellipsis; white-space: nowrap; }
.stat-card small { color: var(--muted); font-size: .8rem; }
.accent-blue { color: #3178ae; border-top: 4px solid #3178ae; }
.accent-teal { color: var(--teal); border-top: 4px solid var(--teal); }
.accent-amber { color: var(--amber); border-top: 4px solid var(--amber); }
.accent-green { color: var(--green); border-top: 4px solid var(--green); }
.accent-red { color: var(--red); border-top: 4px solid var(--red); }
.accent-purple { color: #7653b5; border-top: 4px solid #7653b5; }

.attention-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding: 1rem 1.2rem;
    border: 1px solid #f3c8cf;
    border-radius: 15px;
    background: var(--red-soft);
}
.attention-strip > div { display: flex; align-items: center; gap: .8rem; }
.attention-strip strong { color: #8b2736; }
.attention-strip p { margin: .1rem 0 0; color: #9f5360; font-size: .85rem; }
.attention-icon { display: inline-grid; width: 38px; height: 38px; place-items: center; color: #fff; border-radius: 11px; background: var(--red); font-weight: 900; }

.page-grid { display: grid; gap: 1.25rem; }
.dashboard-grid { grid-template-columns: minmax(0, 2fr) minmax(260px, .8fr); }
.form-layout { grid-template-columns: minmax(0, 1.65fr) minmax(280px, .75fr); align-items: start; }
.loan-form-layout { grid-template-columns: minmax(0, 1.55fr) minmax(310px, .65fr); align-items: start; }
.narrow { max-width: 850px; }
.sticky-panel { position: sticky; top: 108px; }
.form-main { min-width: 0; }

.quick-panel { align-self: start; }
.quick-action { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: .8rem; padding: .85rem 0; border-bottom: 1px solid var(--line); }
.quick-action:last-child { border-bottom: 0; }
.quick-action > span { display: inline-grid; width: 42px; height: 42px; place-items: center; color: var(--teal-dark); border-radius: 12px; background: var(--teal-soft); font-size: 1.2rem; font-weight: 800; }
.quick-action strong, .quick-action small { display: block; }
.quick-action strong { color: var(--navy-900); font-size: .9rem; }
.quick-action small { color: var(--muted); font-size: .75rem; }

.button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .68rem 1rem;
    border: 1px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    font-size: .9rem;
    font-weight: 760;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.button:hover { transform: translateY(-1px); }
.button.primary { color: #fff; background: var(--teal-dark); box-shadow: 0 8px 22px rgba(15,118,110,.19); }
.button.primary:hover { background: #0b665f; }
.button.secondary { color: var(--navy-900); border-color: var(--line); background: #fff; }
.button.danger { color: #fff; border-color: var(--red); background: var(--red); }
.button.danger:hover { background: #9f2f3e; }
.button.ghost { color: #8b2736; border-color: #eebdc5; background: rgba(255,255,255,.65); }
.button.light { color: var(--navy-950); background: #fff; box-shadow: 0 8px 22px rgba(0,0,0,.16); }
.button.wide { width: 100%; }
.text-link { color: var(--teal-dark); font-size: .88rem; font-weight: 760; }
.icon-link { display: inline-grid; width: 36px; height: 36px; place-items: center; color: var(--teal-dark); border-radius: 10px; background: var(--teal-soft); font-weight: 900; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.15rem; }
.toolbar-actions { display: flex; flex-wrap: wrap; gap: .65rem; }
.search-box { display: flex; width: min(520px, 100%); min-height: 46px; align-items: center; gap: .55rem; padding: 0 .75rem; border: 1px solid var(--line); border-radius: 13px; background: #fff; box-shadow: 0 5px 16px rgba(16,42,67,.04); }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; }
.search-box > span { color: var(--muted); font-size: 1.25rem; }
.search-box > a { color: var(--muted); font-size: 1.3rem; }
.back-row { margin-bottom: 1rem; }

.filter-tabs { display: flex; gap: .35rem; margin-bottom: 1rem; padding: .25rem; overflow-x: auto; }
.filter-tabs a { padding: .58rem .9rem; color: var(--muted); border-radius: 10px; font-size: .86rem; font-weight: 720; white-space: nowrap; }
.filter-tabs a.active { color: var(--navy-900); background: #fff; box-shadow: var(--shadow-soft); }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { padding: .72rem .75rem; color: #758594; border-bottom: 1px solid var(--line); font-size: .72rem; font-weight: 800; letter-spacing: .055em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { padding: .9rem .75rem; color: #344a59; border-bottom: 1px solid #edf1f4; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
td strong { display: block; color: var(--navy-900); }
td small { display: block; margin-top: .12rem; color: var(--muted); font-size: .75rem; }
.overdue-row td { background: #fff9fa; }

.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .6rem; border-radius: 999px; font-size: .73rem; font-weight: 800; white-space: nowrap; }
.badge::before { width: 6px; height: 6px; content: ""; border-radius: 50%; background: currentColor; }
.badge.success { color: var(--green); background: var(--green-soft); }
.badge.warning { color: #a66007; background: var(--amber-soft); }
.badge.danger { color: var(--red); background: var(--red-soft); }
.badge.muted { color: #687783; background: #eef2f4; }

.empty-state { display: grid; min-height: 250px; place-items: center; align-content: center; padding: 2rem; text-align: center; }
.empty-state strong { color: var(--navy-900); font-size: 1.05rem; }
.empty-state p { max-width: 420px; margin: .3rem 0 1rem; font-size: .9rem; }
.empty-state.compact { min-height: 110px; }

.form-panel { padding: 1.4rem; }
.form-stack { display: grid; gap: 1rem; }
.form-grid { display: grid; gap: 1rem; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .span-two { grid-column: 1 / -1; }
fieldset { margin: 0; padding: 1.15rem; border: 1px solid var(--line); border-radius: 14px; }
fieldset + fieldset { margin-top: .25rem; }
legend { padding: 0 .35rem; color: var(--navy-900); font-size: .87rem; font-weight: 800; }
label { display: grid; gap: .4rem; color: #435966; font-size: .82rem; font-weight: 730; }
input, select, textarea {
    width: 100%;
    min-height: 46px;
    padding: .7rem .78rem;
    color: var(--ink);
    border: 1px solid #cad7df;
    border-radius: 11px;
    outline: 0;
    background: #fff;
    font-size: .96rem;
    font-weight: 500;
    transition: border .18s ease, box-shadow .18s ease;
}
textarea { min-height: 108px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(20,153,137,.12); }
input::placeholder, textarea::placeholder { color: #9aa9b3; }
.field-help { color: var(--muted); font-size: .74rem; font-weight: 500; }
.password-field { position: relative; display: flex; }
.password-field input { padding-right: 5.2rem; }
.password-field button { position: absolute; right: .45rem; top: .45rem; height: 34px; padding: 0 .65rem; color: var(--teal-dark); border: 0; border-radius: 8px; background: var(--teal-soft); cursor: pointer; font-size: .74rem; font-weight: 800; }
.input-suffix { display: flex; align-items: stretch; }
.input-suffix input { border-radius: 11px 0 0 11px; }
.input-suffix span { display: inline-flex; align-items: center; padding: 0 .75rem; color: var(--muted); border: 1px solid #cad7df; border-left: 0; border-radius: 0 11px 11px 0; background: #f5f8f9; font-size: .8rem; }

.client-profile { display: grid; grid-template-columns: minmax(250px, .8fr) minmax(0, 1.6fr); align-items: center; gap: 1.4rem; margin-bottom: 1.25rem; padding: 1.4rem; }
.client-identity { display: flex; align-items: center; gap: 1rem; }
.client-identity h2 { margin-bottom: .45rem; }
.client-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; padding-left: 1.4rem; border-left: 1px solid var(--line); }
.client-details small, .client-details strong { display: block; }
.client-details small { margin-bottom: .2rem; color: var(--muted); font-size: .74rem; }
.client-details strong { color: var(--navy-900); font-size: .9rem; }

.calculation-card { padding: 1.5rem; color: #d5e4ec; border-radius: var(--radius); background: var(--navy-950); box-shadow: var(--shadow); }
.calculation-card .eyebrow { color: #6ee7d5; }
.calculation-card h2 { color: #fff; }
.calculation-list { margin: 1.3rem 0; }
.calculation-list > div { display: flex; align-items: baseline; justify-content: space-between; gap: .8rem; padding: .8rem 0; border-bottom: 1px solid rgba(255,255,255,.1); }
.calculation-list span { color: #91aabd; font-size: .78rem; }
.calculation-list strong { color: #fff; font-size: 1rem; }
.calculation-list .calculation-total { display: block; margin: .45rem 0; padding: 1rem; border: 0; border-radius: 13px; background: var(--navy-800); }
.calculation-total span, .calculation-total strong { display: block; }
.calculation-total strong { margin-top: .2rem; font-size: 1.75rem; letter-spacing: -.04em; }
.calculation-note { color: #8fa8b9; font-size: .76rem; }

.welcome-panel { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; padding: 1.5rem; border-left: 5px solid var(--teal); }
.welcome-panel h2 { margin-bottom: .35rem; }
.welcome-panel p:last-child { margin-bottom: 0; }
.privacy-pill { padding: .45rem .7rem; color: var(--teal-dark); border-radius: 999px; background: var(--teal-soft); font-size: .74rem; font-weight: 800; white-space: nowrap; }
.loan-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; }
.loan-card { padding: 1.35rem; }
.loan-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: .8rem; }
.loan-card-top h2 { margin: .25rem 0 1rem; font-size: 1.8rem; }
.loan-number { color: var(--teal-dark); font-size: .75rem; font-weight: 850; letter-spacing: .06em; }
.loan-card-data { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem; margin: 1rem 0; }
.loan-card-data > div { padding: .72rem; border-radius: 11px; background: #f6f9fa; }
.loan-card-data small, .loan-card-data strong { display: block; }
.loan-card-data small { color: var(--muted); font-size: .68rem; }
.loan-card-data strong { margin-top: .18rem; overflow: hidden; color: var(--navy-900); font-size: .87rem; text-overflow: ellipsis; white-space: nowrap; }

.progress-label { display: flex; align-items: center; justify-content: space-between; gap: .8rem; color: #475e6b; font-size: .8rem; }
.progress-label strong { color: var(--teal-dark); }
.progress { height: 8px; margin-top: .42rem; overflow: hidden; border-radius: 999px; background: #e5ecef; }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--teal); }
.progress.large { height: 12px; }

.loan-hero { display: flex; align-items: center; justify-content: space-between; gap: 2rem; margin-bottom: 1.15rem; padding: 1.5rem; color: #dce8ef; border: 0; background: var(--navy-950); }
.loan-hero h2 { margin-bottom: .35rem; color: #fff; font-size: clamp(1.55rem, 3vw, 2.25rem); }
.loan-hero p { margin-bottom: 0; color: #9fb4c3; }
.loan-hero .eyebrow { color: #61ddcb; }
.loan-hero-status { display: grid; min-width: 200px; justify-items: end; }
.loan-hero-status small { margin-top: .9rem; color: #8fa8b9; }
.loan-hero-status strong { color: #fff; font-size: 1.7rem; letter-spacing: -.04em; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .85rem; margin-bottom: 1.15rem; }
.summary-grid article { padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: 15px; background: #fff; box-shadow: var(--shadow-soft); }
.summary-grid article.highlight { border-color: #b9e2dc; background: var(--teal-soft); }
.summary-grid small, .summary-grid strong, .summary-grid span { display: block; }
.summary-grid small { color: var(--muted); font-size: .72rem; }
.summary-grid strong { margin: .18rem 0; color: var(--navy-900); font-size: 1.15rem; }
.summary-grid span { color: var(--muted); font-size: .75rem; }
.progress-panel { padding: 1.15rem 1.35rem; }
.progress-meta { display: flex; justify-content: space-between; gap: 1rem; margin-top: .45rem; color: var(--muted); font-size: .73rem; }
.condition-note { padding: .4rem .65rem; color: #9b5b09; border-radius: 10px; background: var(--amber-soft); font-size: .74rem; font-weight: 750; }
.legal-copy { margin: .9rem 0 0; color: var(--muted); font-size: .75rem; }
.payment-panel { scroll-margin-top: 105px; border-top: 4px solid var(--teal); }
.payment-grid { grid-template-columns: 1.2fr .8fr .8fr 1fr; align-items: start; }
.payment-submit { grid-column: 1 / -1; }
.field-action { justify-self: start; padding: 0; color: var(--teal-dark); border: 0; background: none; cursor: pointer; font-size: .72rem; font-weight: 750; }
.notes-panel p:last-child { margin-bottom: 0; color: var(--ink); }

.alert { margin-bottom: 1rem; padding: .8rem 1rem; border: 1px solid; border-radius: 12px; font-size: .86rem; font-weight: 650; }
.alert.danger { color: #922f3d; border-color: #f0bdc6; background: var(--red-soft); }
.alert.success { color: #176c4e; border-color: #b9dfcf; background: var(--green-soft); }
.alert.warning { color: #8a5208; border-color: #f0d399; background: var(--amber-soft); }

.auth-body { min-height: 100vh; background: var(--navy-950); }
.auth-shell { display: grid; width: min(1120px, calc(100% - 2rem)); min-height: 680px; grid-template-columns: 1.05fr .95fr; margin: max(1rem, 5vh) auto; overflow: hidden; border-radius: 26px; background: #fff; box-shadow: 0 30px 90px rgba(0,0,0,.27); }
.auth-intro { display: flex; flex-direction: column; padding: clamp(2rem, 5vw, 4rem); color: #fff; background: var(--navy-900); }
.intro-copy { margin: auto 0; }
.intro-copy .eyebrow { color: #62ddcb; }
.intro-copy h1 { max-width: 520px; color: #fff; font-size: clamp(2.3rem, 5vw, 4.3rem); letter-spacing: -.055em; }
.intro-copy p { max-width: 500px; color: #b6c8d4; font-size: 1.05rem; }
.privacy-note { display: flex; align-items: center; gap: .5rem; color: #a8bdca; font-size: .8rem; }
.privacy-note span { color: #62ddcb; }
.auth-card { display: flex; flex-direction: column; justify-content: center; padding: clamp(2rem, 5vw, 4rem); background: #fff; }
.auth-heading { margin-bottom: 1.35rem; }
.auth-heading h2, .auth-heading h1 { margin-bottom: .45rem; }
.auth-heading p:last-child { margin-bottom: 0; }
.auth-help { margin: 1.25rem 0 0; color: var(--muted); font-size: .78rem; text-align: center; }

.install-shell { width: min(920px, calc(100% - 2rem)); margin: 2rem auto; }
.install-card { display: block; padding: clamp(1.4rem, 4vw, 2.5rem); border-radius: 24px; box-shadow: 0 30px 90px rgba(0,0,0,.25); }
.install-card > .brand-lockup { margin-bottom: 2rem; }
.install-success { display: grid; min-height: 420px; place-items: center; align-content: center; text-align: center; }
.install-success p { max-width: 520px; }
.install-success .button { max-width: 360px; margin-top: .75rem; }
.success-icon { display: grid; width: 72px; height: 72px; margin-bottom: 1rem; place-items: center; color: #fff; border-radius: 22px; background: var(--teal); font-size: 2rem; font-weight: 900; }

.receipt-body { min-height: 100vh; padding: 2rem 1rem; background: #e9eff2; }
.receipt-shell { width: min(850px, 100%); margin: 0 auto; }
.receipt-actions { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.receipt { padding: clamp(1.5rem, 5vw, 3.5rem); border-top: 8px solid var(--teal); border-radius: 4px 4px 20px 20px; background: #fff; box-shadow: var(--shadow); }
.receipt-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--line); }
.receipt-number { text-align: right; }
.receipt-number small, .receipt-number strong, .receipt-number span { display: block; }
.receipt-number small { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; }
.receipt-number strong { margin: .15rem 0; color: var(--navy-900); }
.receipt-number span { color: var(--muted); font-size: .8rem; }
.receipt-amount { padding: 2rem 0; text-align: center; }
.receipt-amount small, .receipt-amount strong, .receipt-amount span { display: block; }
.receipt-amount small { color: var(--muted); text-transform: uppercase; font-size: .72rem; font-weight: 800; letter-spacing: .08em; }
.receipt-amount strong { margin: .25rem 0; color: var(--navy-950); font-size: clamp(2.5rem, 7vw, 4.2rem); letter-spacing: -.06em; }
.receipt-amount span { color: var(--teal-dark); font-weight: 750; }
.receipt-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.receipt-grid > div { padding: 1rem; border-radius: 12px; background: #f5f8f9; }
.receipt-grid small, .receipt-grid strong, .receipt-grid span { display: block; }
.receipt-grid small { color: var(--muted); font-size: .7rem; }
.receipt-grid strong { margin: .15rem 0; color: var(--navy-900); }
.receipt-grid span { color: var(--muted); font-size: .8rem; }
.receipt-balance { margin-top: 1.4rem; padding: 1rem 1.15rem; border: 1px solid var(--line); border-radius: 14px; }
.receipt-balance > div { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .55rem 0; color: var(--muted); font-size: .86rem; }
.receipt-balance strong { color: var(--navy-900); }
.receipt-balance .receipt-balance-total { margin-top: .35rem; padding-top: .9rem; color: var(--navy-900); border-top: 1px solid var(--line); font-weight: 800; }
.receipt-balance-total strong { color: var(--teal-dark); font-size: 1.2rem; }
.receipt-schedule { margin-top: 1.6rem; }
.receipt-schedule h2 { margin-bottom: .8rem; font-size: 1.05rem; }
.receipt-note { margin: 1rem 0; padding: .8rem; color: var(--ink); border-radius: 10px; background: var(--amber-soft); font-size: .82rem; }
.receipt-footer { display: grid; grid-template-columns: 1fr 1fr; align-items: end; gap: 2rem; margin-top: 3rem; color: var(--muted); }
.receipt-footer > div { text-align: center; }
.signature-line { display: block; border-top: 1px solid #80909b; }
.receipt-footer small { display: block; margin-top: .4rem; }
.receipt-footer p { margin: 0; font-size: .72rem; text-align: right; }
.sidebar-backdrop { display: none; }

.cash-toolbar { align-items: flex-end; }
.cash-tabs { margin-bottom: 0; }
.period-filter { display: flex; align-items: flex-end; gap: .65rem; }
.period-filter label { min-width: 190px; }
.cash-heading p:last-child, .finance-note p:last-child { margin-bottom: 0; }
.cash-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.movement-amount.income { color: var(--green); }
.movement-amount.outflow { color: var(--red); }
.finance-note { border-left: 4px solid var(--teal); }

@media (max-width: 1180px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .payment-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 920px) {
    .sidebar { transform: translateX(-100%); transition: transform .24s ease; }
    .menu-open .sidebar { transform: translateX(0); }
    .menu-open .sidebar-backdrop { position: fixed; z-index: 25; inset: 0; display: block; background: rgba(5,18,29,.55); }
    .main-panel { width: 100%; margin-left: 0; }
    .menu-button { display: inline-grid; place-items: center; }
    .topbar { justify-content: flex-start; min-height: 78px; }
    .topbar-account { margin-left: auto; }
    .topbar-account > span:last-child { display: none; }
    .dashboard-grid, .form-layout, .loan-form-layout { grid-template-columns: 1fr; }
    .sticky-panel { position: static; }
    .client-profile { grid-template-columns: 1fr; }
    .client-details { padding: 1rem 0 0; border-top: 1px solid var(--line); border-left: 0; }
    .auth-shell { grid-template-columns: 1fr; margin: 1rem auto; }
    .auth-intro { min-height: 320px; }
    .intro-copy { margin: 2.5rem 0; }
    .intro-copy h1 { font-size: clamp(2rem, 9vw, 3.4rem); }
}

@media (max-width: 680px) {
    .content-wrap { padding: 1rem .8rem 2rem; }
    .topbar { padding: .8rem; }
    .topbar .eyebrow { display: none; }
    .topbar h1 { font-size: 1.35rem; }
    .stats-grid, .summary-grid, .loan-card-grid { grid-template-columns: 1fr; }
    .stat-card { min-height: 130px; }
    .panel { padding: 1rem; border-radius: 15px; }
    .toolbar, .loan-toolbar { align-items: stretch; flex-direction: column; }
    .toolbar > .button, .loan-toolbar > .button { width: 100%; }
    .toolbar-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .form-grid.two, .payment-grid { grid-template-columns: 1fr; }
    .form-grid .span-two, .payment-submit { grid-column: auto; }
    .client-details { grid-template-columns: 1fr; }
    .loan-card-data { grid-template-columns: 1fr; }
    .loan-hero { align-items: flex-start; flex-direction: column; gap: 1rem; padding: 1.2rem; }
    .loan-hero-status { width: 100%; grid-template-columns: 1fr auto; align-items: center; justify-items: start; }
    .loan-hero-status small { margin-top: .8rem; }
    .loan-hero-status strong { justify-self: end; }
    .panel-heading { align-items: flex-start; flex-direction: column; }
    .welcome-panel { align-items: flex-start; flex-direction: column; }
    .attention-strip { align-items: flex-start; flex-direction: column; }
    .attention-strip .button { width: 100%; }
    .auth-shell { width: 100%; min-height: 100vh; margin: 0; border-radius: 0; }
    .auth-intro { min-height: 290px; padding: 1.5rem; }
    .auth-card { padding: 1.5rem; }
    .install-shell { width: 100%; margin: 0; }
    .install-card { min-height: 100vh; padding: 1.2rem; border-radius: 0; }
    .receipt-body { padding: 0; background: #fff; }
    .receipt { padding: 1.2rem; border-radius: 0; box-shadow: none; }
    .receipt-header, .receipt-actions { align-items: flex-start; flex-direction: column; }
    .receipt-number { text-align: left; }
    .receipt-grid, .receipt-footer { grid-template-columns: 1fr; }
    .receipt-footer p { text-align: center; }
    .progress-meta { align-items: flex-start; flex-direction: column; gap: .2rem; }
    .period-filter { align-items: stretch; flex-direction: column; }
    .period-filter label { min-width: 0; }
    .period-filter .button { width: 100%; }
}

@media print {
    @page { size: A4; margin: 12mm; }
    body { color: #000; background: #fff; }
    .print-hidden, .sidebar, .topbar, .sidebar-backdrop { display: none !important; }
    .main-panel { width: 100%; margin: 0; }
    .content-wrap { width: 100%; max-width: none; padding: 0; }
    .panel, .loan-hero, .summary-grid article, .client-profile { break-inside: avoid; box-shadow: none; }
    .loan-hero { color: #000; border: 1px solid #bbb; background: #fff; }
    .loan-hero h2, .loan-hero-status strong { color: #000; }
    .loan-hero p, .loan-hero small { color: #555; }
    .loan-hero .eyebrow { color: #333; }
    .receipt-body { padding: 0; }
    .receipt { padding: 0; border-top: 6px solid #222; box-shadow: none; }
    a { text-decoration: none; }
}
