/* ==========================================================================
   QuikTross customer app — fintech UI
   Brand: QuikTross green #1B552A.
   Mobile: app-like screens, deep-green header, gradient hero, floating bottom nav.
   Desktop (≥960px): sidebar shell with dashboard layout.
   ========================================================================== */

:root {
    /* Brand — QuikTross green */
    --deep-900: #04120a;
    --deep-800: #0a2413;
    --deep-700: #123a1e;
    --brand-600: #1b552a;
    --brand-700: #133f1e;
    --brand-100: #cde5d5;
    --brand-50: #eaf4ed;

    /* Neutrals */
    --bg: #f2f6f3;
    --surface: #ffffff;
    --ink: #111b14;
    --muted: #5e6f64;
    --faint: #92a297;
    --line: #e3eae5;
    --line-strong: #cfdcd4;

    /* Semantic */
    --ok: #0e9f6e;
    --ok-soft: #e2f7ee;
    --ok-ink: #06603f;
    --warn: #b45309;
    --warn-soft: #fdf0dc;
    --danger: #dc2626;
    --danger-soft: #fdecec;
    --danger-ink: #991b1b;

    --radius-lg: 20px;
    --radius: 16px;
    --radius-sm: 12px;

    --nav-h: 66px;
    --safe-t: env(safe-area-inset-top, 0px);
    --safe-b: env(safe-area-inset-bottom, 0px);

    --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;

    --shadow-card: 0 1px 2px rgba(17, 27, 20, .04), 0 4px 16px rgba(17, 27, 20, .05);
    --shadow-float: 0 8px 30px rgba(8, 24, 13, .16);
    --shadow-hero: 0 14px 34px rgba(15, 61, 30, .35);

    --grad-hero: linear-gradient(132deg, #0b2a14 0%, #164824 46%, #2a7c42 100%);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; }

body {
    margin: 0;
    min-height: 100dvh;
    font-family: var(--font);
    font-size: 16px;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: var(--brand-600); text-decoration: none; font-weight: 600; }
a:hover { color: var(--brand-700); }

button { font-family: inherit; }

/* --------------------------------------------------------------------------
   Icons
   -------------------------------------------------------------------------- */
.icon { display: block; width: 20px; height: 20px; flex-shrink: 0; color: currentColor; }
.icon--nav { width: 22px; height: 22px; }
.icon--side { width: 20px; height: 20px; }
.icon--qa { width: 22px; height: 22px; }
.icon--btn { width: 19px; height: 19px; margin: auto; }
.icon--btn-inline { width: 17px; height: 17px; display: inline-block; vertical-align: -3.5px; }
.icon--chevron { width: 18px; height: 18px; color: var(--faint); }
.icon--row { width: 20px; height: 20px; }
.icon--empty { width: 30px; height: 30px; margin: 0 auto; }
.icon--upload { width: 26px; height: 26px; margin: 0 auto; }
.icon--success { width: 30px; height: 30px; margin: auto; color: #fff; }
.icon--auth { width: 22px; height: 22px; }
.icon--feature { width: 19px; height: 19px; }

/* --------------------------------------------------------------------------
   Brand
   -------------------------------------------------------------------------- */
.brand-mark__img {
    display: block;
    max-width: 150px;
    max-height: 42px;
    width: auto;
    height: auto;
    object-fit: contain;
}
.brand-mark__word {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -.02em;
    color: var(--ink);
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */
.title-xl { font-size: clamp(1.8rem, 5.5vw, 2.4rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.12; margin: 0; }
.title-lg { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; margin: 0 0 6px; }
.title-md { font-size: 1.08rem; font-weight: 700; letter-spacing: -.01em; margin: 0; }
.subtitle { color: var(--muted); font-size: .93rem; line-height: 1.6; margin: 0; }
.money { font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

/* ==========================================================================
   APP SHELL
   ========================================================================== */
.app-shell { min-height: 100dvh; }

.app-main {
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.screen {
    flex: 1;
    padding: 0 18px calc(var(--nav-h) + var(--safe-b) + 26px);
}

/* ----- Top bar (mobile: deep-green band) ----- */
.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: calc(var(--safe-t) + 16px) 18px 16px;
    background: var(--deep-800);
    color: #fff;
}
.app-topbar__user { display: flex; align-items: center; gap: 12px; min-width: 0; }
.app-topbar__greet { font-size: .74rem; font-weight: 600; color: rgba(255, 255, 255, .62); }
.app-topbar__name { font-weight: 700; font-size: 1.02rem; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.avatar {
    width: 42px; height: 42px; border-radius: 50%;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .22);
    display: grid; place-items: center;
    font-weight: 800; font-size: .95rem; flex-shrink: 0;
}

.icon-btn {
    width: 40px; height: 40px; border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, .2);
    background: rgba(255, 255, 255, .1);
    color: rgba(255, 255, 255, .85);
    display: grid; place-items: center;
    cursor: pointer; padding: 0;
    transition: background .15s ease;
}
.icon-btn:hover { background: rgba(255, 255, 255, .18); color: #fff; }

/* Home screen pulls the hero card up over the deep-green band */
.app-shell.is-home .app-topbar { padding-bottom: 92px; }
.app-shell.is-home .screen { margin-top: -78px; }

/* ----- Sidebar (desktop only) ----- */
.side-nav { display: none; }

/* ----- Bottom nav (mobile) ----- */
.bottom-nav {
    position: fixed;
    left: 50%; transform: translateX(-50%);
    bottom: calc(10px + var(--safe-b));
    width: min(430px, calc(100% - 28px));
    padding: 8px;
    background: rgba(255, 255, 255, .92);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow-float);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    z-index: 50;
}
.nav-item {
    border: 0; background: transparent; color: var(--faint);
    font: inherit; font-size: .67rem; font-weight: 700;
    padding: 7px 4px 6px; border-radius: 15px; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    transition: color .15s ease, background .15s ease;
}
.nav-item__icon { display: grid; place-items: center; height: 24px; }
.nav-item.is-active { color: var(--brand-600); background: var(--brand-50); }

/* ==========================================================================
   HOME (dashboard)
   ========================================================================== */

/* Hero / balance card */
.hero-card {
    position: relative;
    display: block;
    width: 100%;
    text-align: left;
    padding: 22px 20px 20px;
    border: 0;
    border-radius: var(--radius-lg);
    background: var(--grad-hero);
    color: #fff;
    font: inherit;
    box-shadow: var(--shadow-hero);
    overflow: hidden;
    isolation: isolate;
}
.hero-card::before,
.hero-card::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    z-index: -1;
}
.hero-card::before {
    width: 220px; height: 220px;
    right: -70px; top: -110px;
    background: rgba(255, 255, 255, .07);
}
.hero-card::after {
    width: 150px; height: 150px;
    right: 30px; bottom: -95px;
    background: rgba(255, 255, 255, .05);
}
button.hero-card { cursor: pointer; }
button.hero-card:active { transform: scale(.99); }
.hero-card__badge {
    display: inline-flex;
    font-size: .68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .09em;
    color: rgba(255, 255, 255, .66);
    margin-bottom: 10px;
}
.hero-card__label {
    font-size: .7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .08em;
    color: rgba(255, 255, 255, .6);
    margin-bottom: 4px;
}
.hero-card__amount {
    font-size: 2.15rem;
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    margin: 0 0 6px;
}
.hero-card__sub {
    color: rgba(255, 255, 255, .72);
    font-size: .85rem; font-weight: 600;
    margin: -2px 0 8px;
    font-variant-numeric: tabular-nums;
}
.hero-card__meta {
    display: flex; align-items: center; gap: 10px;
    color: rgba(255, 255, 255, .78);
    font-size: .87rem; font-weight: 600;
}
.hero-card__cta {
    display: inline-flex; align-items: center; gap: 6px;
    margin-top: 18px;
    padding: 9px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .2);
    font-size: .84rem; font-weight: 700; color: #fff;
}
.hero-card--empty .hero-card__lead {
    color: rgba(255, 255, 255, .8);
    font-size: .93rem; line-height: 1.6; margin: 0;
    max-width: 34ch;
}
.hero-card .btn { margin-top: 18px; }

/* Status pill on dark hero */
.hero-card .status-pill { background: rgba(255, 255, 255, .16); color: #fff; }

/* Quick actions — two labelled tiles (Apply / Pay) */
.qa-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 20px;
}
.qa {
    display: flex; align-items: center; gap: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 15px;
    cursor: pointer; color: var(--ink); font: inherit; text-align: left;
    box-shadow: var(--shadow-card);
    transition: transform .12s ease, border-color .15s ease;
}
.qa:hover { border-color: var(--brand-100); transform: translateY(-2px); }
.qa:active { transform: scale(.98); }
.qa__circle {
    width: 46px; height: 46px; border-radius: 50%;
    background: var(--brand-50);
    display: grid; place-items: center;
    color: var(--brand-600);
    flex-shrink: 0;
}
.qa--primary .qa__circle { background: var(--brand-600); color: #fff; box-shadow: 0 6px 18px rgba(27, 85, 42, .35); }
.qa__text { min-width: 0; }
.qa__label { display: block; font-size: .92rem; font-weight: 800; color: var(--ink); }
.qa__hint { display: block; color: var(--muted); font-size: .76rem; font-weight: 500; margin-top: 2px; }

/* Section headings */
.section-head {
    display: flex; align-items: center; justify-content: space-between;
    margin: 26px 0 12px;
}
.section-head h2 {
    font-size: .95rem; font-weight: 800; letter-spacing: -.01em;
    color: var(--ink); margin: 0;
}
.section-head .section-link {
    border: 0; background: none; padding: 0; cursor: pointer;
    font-size: .8rem; font-weight: 700; color: var(--brand-600); font-family: inherit;
}

/* ==========================================================================
   CARDS / LISTS
   ========================================================================== */
.card, .panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
}
.panel { padding: 18px; margin-bottom: 14px; }

/* Loan rows */
.loan-list { display: grid; gap: 10px; }
.loan-card {
    display: flex; align-items: center; gap: 13px;
    padding: 14px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow-card);
}
.loan-card--clickable {
    width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer;
    transition: border-color .15s ease, transform .1s ease;
}
.loan-card--clickable:hover { border-color: var(--line-strong); }
.loan-card--clickable:active { transform: scale(.99); }
.loan-card__icon {
    width: 42px; height: 42px; border-radius: 13px;
    background: var(--brand-50); color: var(--brand-600);
    display: grid; place-items: center; flex-shrink: 0;
}
.loan-card__main { min-width: 0; flex: 1; }
.loan-card__ref { font-weight: 700; font-size: .93rem; letter-spacing: -.01em; }
.loan-card__meta { color: var(--muted); font-size: .8rem; margin-top: 3px; }
.loan-card__side { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.loan-card__amount { font-weight: 800; font-size: .95rem; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* Status pills */
.status-pill {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 9px; border-radius: 999px;
    font-size: .64rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
    white-space: nowrap;
}
.status-pill--draft, .status-pill--submitted { background: var(--warn-soft); color: var(--warn); }
.status-pill--approved, .status-pill--disbursed, .status-pill--active { background: var(--ok-soft); color: var(--ok-ink); }
.status-pill--under_review, .status-pill--pending { background: #edf1ee; color: var(--muted); }
.status-pill--rejected, .status-pill--cancelled { background: var(--danger-soft); color: var(--danger-ink); }

/* ==========================================================================
   LOAN DETAIL
   ========================================================================== */
.detail-hero {
    position: relative;
    border-radius: var(--radius-lg);
    background: var(--grad-hero);
    color: #fff;
    padding: 22px 20px;
    box-shadow: var(--shadow-hero);
    overflow: hidden;
    isolation: isolate;
    margin-bottom: 14px;
}
.detail-hero::before {
    content: "";
    position: absolute; z-index: -1; border-radius: 50%;
    width: 210px; height: 210px; right: -70px; top: -110px;
    background: rgba(255, 255, 255, .07);
}
.detail-hero__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.detail-hero__ref { font-size: .95rem; font-weight: 700; }
.detail-hero__type { color: rgba(255, 255, 255, .65); font-size: .8rem; font-weight: 600; margin-top: 3px; }
.detail-hero .status-pill { background: rgba(255, 255, 255, .16); color: #fff; }
.detail-hero__amount {
    font-size: 2rem; font-weight: 800; letter-spacing: -.03em;
    font-variant-numeric: tabular-nums;
}
.detail-hero__label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.6); margin-bottom: 6px; }

.detail-section-title {
    font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em;
    color: var(--faint); margin: 0 0 10px;
}
.detail-rows { display: grid; }
.detail-row {
    display: flex; justify-content: space-between; gap: 12px;
    padding: 11px 0; border-bottom: 1px solid var(--line); font-size: .9rem;
}
.detail-row:last-child { border-bottom: 0; }
.detail-row span { color: var(--muted); }
.detail-row strong { font-weight: 700; text-align: right; }
.detail-row--stack { flex-direction: column; align-items: flex-start; gap: 4px; }
.detail-row--stack strong { text-align: left; font-weight: 500; color: var(--muted); }

.schedule-list { display: grid; }
.schedule-row {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 12px 0; border-bottom: 1px solid var(--line); font-size: .9rem;
}
.schedule-row:last-child { border-bottom: 0; }
.schedule-row__date { font-weight: 700; }
.schedule-row__meta { color: var(--muted); font-size: .78rem; margin-top: 2px; }
.schedule-row strong { font-variant-numeric: tabular-nums; font-weight: 800; }
.schedule-row__side { display: flex; align-items: center; gap: 10px; }

.btn-mini {
    border: 0; border-radius: 999px;
    background: var(--brand-600); color: #fff;
    font: inherit; font-size: .74rem; font-weight: 800;
    padding: 6px 14px; cursor: pointer;
    transition: background .15s ease, transform .1s ease;
}
.btn-mini:hover { background: var(--brand-700); }
.btn-mini:active { transform: scale(.95); }

.detail-layout { display: grid; gap: 0; }

/* Sub-page header: back button + title (replaces the greeting bar) */
.page-head {
    display: flex; align-items: center; gap: 13px;
    padding: calc(var(--safe-t) + 14px) 18px 14px;
}
.page-head__title { font-size: 1.15rem; font-weight: 800; letter-spacing: -.02em; }

/* Pay with Monime */
.pay-code { text-align: center; padding: 24px 20px; }
.pay-code__label {
    font-size: .7rem; font-weight: 800;
    text-transform: uppercase; letter-spacing: .08em;
    color: var(--faint); margin-bottom: 6px;
}
.pay-code__amount {
    font-size: 2rem; font-weight: 800; letter-spacing: -.03em;
    margin-bottom: 4px;
}
.pay-code__ussd {
    margin: 18px auto 4px;
    padding: 16px 18px;
    border: 2px dashed var(--brand-600);
    border-radius: 14px;
    background: var(--brand-50);
    color: var(--brand-700);
    font-size: 1.45rem; font-weight: 800; letter-spacing: .06em;
    font-variant-numeric: tabular-nums;
    max-width: 320px;
    user-select: all;
    -webkit-user-select: all;
}
.pay-code__steps {
    text-align: left;
    margin: 18px 0 6px; padding-left: 20px;
    color: var(--muted); font-size: .86rem; line-height: 1.65;
    display: grid; gap: 6px;
}

/* ==========================================================================
   APPLICATION FLOW
   ========================================================================== */
.flow-bar { padding: 16px 18px 4px; }
.flow-bar__top {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px;
}
.flow-btn {
    width: 40px; height: 40px; border-radius: 12px;
    border: 1px solid var(--line); background: var(--surface);
    color: var(--ink); display: grid; place-items: center;
    cursor: pointer; padding: 0;
    box-shadow: var(--shadow-card);
}
.flow-btn:hover { border-color: var(--line-strong); }
.flow-bar__step { font-size: .78rem; font-weight: 800; color: var(--muted); letter-spacing: .02em; }
.flow-bar__track { height: 5px; border-radius: 999px; background: #dfe8e2; overflow: hidden; }
.flow-bar__fill { height: 100%; border-radius: 999px; background: var(--brand-600); transition: width .35s ease; }

.step-screen { padding-top: 18px; max-width: 480px; margin: 0 auto; }
.step-screen__title { font-size: 1.45rem; font-weight: 800; letter-spacing: -.02em; margin: 0 0 6px; }
.step-screen__sub { color: var(--muted); font-size: .92rem; line-height: 1.6; margin: 0 0 20px; }

/* Forms */
.form-stack { display: grid; gap: 16px; }
.field label {
    display: block; font-size: .8rem; font-weight: 700;
    color: var(--ink); margin-bottom: 7px; letter-spacing: .01em;
}
.field input, .field textarea, .field select {
    width: 100%; border-radius: 14px; border: 1.5px solid var(--line-strong);
    background: var(--surface); color: var(--ink);
    padding: 14px 15px; font: inherit; font-size: 1rem;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.field input::placeholder, .field textarea::placeholder { color: var(--faint); }
.field input:focus, .field textarea:focus, .field select:focus {
    outline: none; border-color: var(--brand-600);
    box-shadow: 0 0 0 4px rgba(27, 85, 42, .14);
}
.field-hint { font-size: .78rem; color: var(--muted); margin-top: 7px; }
.label-optional { font-weight: 500; color: var(--faint); }
.checkbox-row {
    display: flex; gap: 10px; align-items: center;
    color: var(--muted); font-size: .88rem; font-weight: 500; cursor: pointer;
}
.checkbox-row input { width: 17px; height: 17px; accent-color: var(--brand-600); }

.amount-display {
    text-align: center; padding: 4px 0 12px;
}
.amount-display__range {
    display: inline-flex; padding: 7px 14px; border-radius: 999px;
    background: var(--brand-50); color: var(--brand-700);
    font-size: .82rem; font-weight: 700;
}

/* Option cards (loan type / term) */
.option-list { display: grid; gap: 10px; }
.option-card {
    position: relative;
    width: 100%; text-align: left;
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 16px 48px 16px 16px;
    cursor: pointer; color: var(--ink); font: inherit;
    box-shadow: var(--shadow-card);
    transition: border-color .15s ease, transform .1s ease;
}
.option-card::after {
    content: "";
    position: absolute; right: 16px; top: 50%;
    width: 22px; height: 22px; margin-top: -11px;
    border-radius: 50%;
    border: 2px solid var(--line-strong);
    transition: border-color .15s ease;
}
.option-card:hover { border-color: var(--brand-600); }
.option-card:hover::after { border-color: var(--brand-600); }
.option-card:active { transform: scale(.99); }
.option-card__title { font-weight: 800; font-size: .98rem; letter-spacing: -.01em; margin-bottom: 4px; }
.option-card__sub { color: var(--muted); font-size: .84rem; line-height: 1.5; }
.option-card__tag {
    display: inline-block; margin-top: 9px;
    font-size: .72rem; font-weight: 800; color: var(--brand-600);
    text-transform: uppercase; letter-spacing: .05em;
}

/* Upload */
.upload-zone {
    border: 1.5px dashed var(--line-strong); border-radius: var(--radius);
    padding: 28px 16px; text-align: center; background: var(--surface);
    cursor: pointer; position: relative; color: var(--brand-600);
    transition: border-color .15s ease, background .15s ease;
}
.upload-zone:hover { border-color: var(--brand-600); background: var(--brand-50); }
.upload-zone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.upload-zone__icon { margin-bottom: 10px; }
.upload-zone__text { font-weight: 800; font-size: .92rem; color: var(--ink); }
.upload-zone__sub { color: var(--muted); font-size: .78rem; margin-top: 4px; font-weight: 500; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.photo-grid img {
    width: 100%; aspect-ratio: 1; object-fit: cover;
    border-radius: 12px; border: 1px solid var(--line);
}

/* Asset strip — committed assets shown while adding more */
.asset-strip { margin-bottom: 16px; display: grid; gap: 8px; }
.asset-strip__title {
    font-size: .72rem; font-weight: 800;
    text-transform: uppercase; letter-spacing: .07em;
    color: var(--faint);
}
.asset-chip {
    display: flex; align-items: center; gap: 11px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 10px 12px;
    box-shadow: var(--shadow-card);
}
.asset-chip--current {
    margin-bottom: 12px;
    border-style: dashed;
    border-color: var(--line-strong);
    box-shadow: none;
}
.asset-chip__thumb {
    width: 40px; height: 40px; border-radius: 10px;
    object-fit: cover; flex-shrink: 0;
    border: 1px solid var(--line);
}
.asset-chip__thumb--empty {
    display: grid; place-items: center;
    background: var(--brand-50); color: var(--brand-600);
    border-color: transparent;
}
.asset-chip__text { min-width: 0; flex: 1; }
.asset-chip__text strong { display: block; font-size: .88rem; font-weight: 700; text-transform: capitalize; }
.asset-chip__text span { color: var(--muted); font-size: .76rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.asset-chip__done {
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--ok-soft); color: var(--ok-ink);
    display: grid; place-items: center; flex-shrink: 0;
}

/* Collateral requirement meter (asset photos step) */
.collateral-meter {
    margin-top: 16px;
    padding: 14px 15px;
    border-radius: 14px;
    background: var(--warn-soft);
    border: 1px solid #f3ddb8;
}
.collateral-meter--ok { background: var(--ok-soft); border-color: #bde9d6; }
.collateral-meter__row {
    display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
    font-size: .85rem; margin-bottom: 8px;
}
.collateral-meter__row span { color: var(--muted); font-weight: 600; }
.collateral-meter__row strong { font-weight: 800; }
.collateral-meter__req { color: var(--muted); font-weight: 600; font-size: .76rem; }
.collateral-meter__track {
    height: 6px; border-radius: 999px; overflow: hidden;
    background: rgba(17, 27, 20, .1);
}
.collateral-meter__fill {
    height: 100%; border-radius: 999px;
    background: var(--warn);
    transition: width .3s ease;
}
.collateral-meter--ok .collateral-meter__fill { background: var(--ok); }
.collateral-meter__hint { margin-top: 8px; font-size: .78rem; font-weight: 600; color: var(--warn); }
.collateral-meter--ok .collateral-meter__hint { color: var(--ok-ink); }

/* Review page asset cards */
.review-asset { padding: 12px 0; border-top: 1px solid var(--line); }
.review-asset:first-of-type { border-top: 0; padding-top: 2px; }
.review-asset__head {
    display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
}
.review-asset__head strong { font-size: .95rem; font-weight: 800; text-transform: capitalize; }
.review-asset__value { font-weight: 800; }
.review-asset__details { color: var(--muted); font-size: .85rem; line-height: 1.5; margin: 4px 0 0; }
.review-asset .photo-grid { margin-top: 10px; }
.review-asset__total {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    margin-top: 12px; padding: 13px 14px;
    border-radius: 12px;
    background: var(--brand-50);
    font-size: .88rem;
}
.review-asset__total span { color: var(--brand-700); font-weight: 700; }
.review-asset__total strong { font-size: 1.05rem; font-weight: 800; color: var(--brand-700); }
.review-asset__total-hint { color: var(--muted); font-size: .74rem; font-weight: 600; margin-top: 2px; }

/* Receipt / summary */
.receipt { padding: 2px 0; }
.receipt__row {
    display: flex; justify-content: space-between; gap: 12px;
    padding: 11px 0; border-bottom: 1px solid var(--line); font-size: .9rem;
}
.receipt__row:last-child { border-bottom: 0; }
.receipt__row span:first-child { color: var(--muted); }
.receipt__row strong { font-weight: 700; font-variant-numeric: tabular-nums; }
.receipt__total {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 14px; padding: 15px 16px; border-radius: 14px;
    background: var(--deep-800); color: #fff;
}
.receipt__total .subtitle { color: rgba(255, 255, 255, .65); font-size: .82rem; }
.receipt__total strong { font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

/* Success */
.success-screen { text-align: center; padding: 34px 20px; }
.success-icon {
    width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 50%;
    background: var(--ok); display: grid; place-items: center;
    box-shadow: 0 10px 26px rgba(14, 159, 110, .35);
}
.chip {
    display: inline-flex; padding: 6px 12px; border-radius: 999px;
    font-size: .76rem; font-weight: 700;
    background: var(--brand-50); color: var(--brand-700); border: 1px solid var(--brand-100);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn-row { display: grid; gap: 10px; margin-top: 16px; }
.btn-row--2 { grid-template-columns: 1fr 1fr; }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; border: 0; border-radius: 14px;
    padding: 15px 18px; font: inherit; font-weight: 800; font-size: .95rem;
    letter-spacing: -.01em;
    cursor: pointer; text-decoration: none;
    transition: transform .1s ease, background .15s ease, box-shadow .15s ease;
}
.btn:active { transform: scale(.98); }
.btn-primary {
    background: var(--brand-600); color: #fff;
    box-shadow: 0 6px 18px rgba(27, 85, 42, .32);
}
.btn-primary:hover { background: var(--brand-700); color: #fff; }
.btn-ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line-strong); }
.btn-ghost:hover { border-color: var(--faint); }
.btn-soft { background: #e7efe9; color: var(--ink); }
.btn-soft:hover { background: #dbe8de; }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: #fbdddd; }
.btn-dark { background: var(--deep-800); color: #fff; }
.btn-dark:hover { background: var(--deep-700); color: #fff; }

/* ==========================================================================
   ALERTS / TOASTS
   ========================================================================== */
.alert {
    border-radius: 14px; padding: 13px 15px; margin-bottom: 14px;
    font-size: .88rem; font-weight: 600;
    border: 1px solid var(--line); background: var(--surface);
}
.alert-error { border-color: #f6c9c9; background: var(--danger-soft); color: var(--danger-ink); }
.alert-ok { border-color: #bde9d6; background: var(--ok-soft); color: var(--ok-ink); }

/* Modal dialog for notices and errors */
.dialog-overlay {
    position: fixed; inset: 0; z-index: 200;
    display: grid; place-items: center;
    padding: 24px;
    background: rgba(4, 18, 10, .5);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    animation: overlayIn .2s ease both;
}
.dialog {
    width: min(340px, 100%);
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-float);
    padding: 26px 22px 20px;
    text-align: center;
    animation: dialogIn .25s cubic-bezier(.2, .9, .3, 1.15) both;
}
.dialog__icon {
    width: 52px; height: 52px; margin: 0 auto 14px;
    border-radius: 50%;
    display: grid; place-items: center;
}
.dialog__icon--ok { background: var(--ok-soft); color: var(--ok-ink); }
.dialog__icon--error { background: var(--danger-soft); color: var(--danger); }
.icon--dialog { width: 24px; height: 24px; }
.dialog__message {
    margin: 0 0 18px;
    font-size: .95rem; font-weight: 600; line-height: 1.55;
    color: var(--ink);
    overflow-wrap: break-word;
}
.dialog__ok { max-width: 200px; margin: 0 auto; }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes dialogIn {
    from { opacity: 0; transform: translateY(14px) scale(.95); }
    to { opacity: 1; transform: none; }
}

/* In-app media viewer (images + PDFs) */
.media-overlay {
    position: fixed; inset: 0; z-index: 220;
    display: grid; place-items: center;
    padding: 16px;
    background: rgba(4, 12, 7, .82);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    animation: overlayIn .2s ease both;
}
.media-viewer {
    width: min(760px, 100%);
    max-height: 92dvh;
    display: flex; flex-direction: column;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-float);
    animation: dialogIn .25s cubic-bezier(.2, .9, .3, 1.15) both;
}
.media-viewer__bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 12px 10px 16px;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}
.media-viewer__title { font-weight: 800; font-size: .92rem; letter-spacing: -.01em; }
.media-viewer__actions { display: flex; align-items: center; gap: 6px; }
.media-viewer__open, .media-viewer__close {
    width: 38px; height: 38px; border-radius: 10px;
    border: 1px solid var(--line); background: var(--surface);
    color: var(--muted); display: grid; place-items: center;
    cursor: pointer; padding: 0;
}
.media-viewer__open:hover, .media-viewer__close:hover { color: var(--ink); border-color: var(--line-strong); }
.media-viewer__body {
    flex: 1; min-height: 0;
    display: grid; place-items: center;
    background: #0c1710;
    overflow: auto;
}
.media-viewer__img { max-width: 100%; max-height: 88dvh; display: block; object-fit: contain; }
.media-viewer__frame { width: 100%; height: 82dvh; border: 0; background: #fff; }

.photo-thumb {
    border: 0; padding: 0; cursor: pointer; background: none;
    border-radius: 12px; overflow: hidden; display: block;
}
.photo-thumb img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; border: 1px solid var(--line); border-radius: 12px; }
.photo-thumb:hover img { border-color: var(--brand-100); }

.linkbtn {
    border: 0; background: none; padding: 0; cursor: pointer;
    font: inherit; font-weight: 700; color: var(--brand-600);
}
.linkbtn:hover { color: var(--brand-700); }

/* Empty state */
.empty-state {
    text-align: center; padding: 34px 18px;
    color: var(--muted); font-size: .9rem;
    background: var(--surface); border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
}
.empty-state__icon {
    width: 52px; height: 52px; margin: 0 auto 12px;
    border-radius: 16px; background: var(--brand-50); color: var(--brand-600);
    display: grid; place-items: center;
}
.empty-state p { margin: 0; }

/* ==========================================================================
   AUTH & LANDING
   ========================================================================== */
.auth-shell { min-height: 100dvh; display: grid; }

.auth-brandpane { display: none; }

.auth-pane {
    display: flex; flex-direction: column; justify-content: center;
    padding: calc(var(--safe-t) + 34px) 22px calc(var(--safe-b) + 30px);
    width: 100%; max-width: 460px; margin: 0 auto;
}
.auth-pane .brand-mark { margin-bottom: 26px; }
.auth-pane__head { margin-bottom: 22px; }
.auth-card { padding: 22px 20px; }
.auth-footer { margin-top: 18px; text-align: center; color: var(--muted); font-size: .9rem; }
.auth-icon-wrap {
    width: 48px; height: 48px; border-radius: 14px;
    background: var(--brand-50); border: 1px solid var(--brand-100);
    color: var(--brand-600);
    display: grid; place-items: center; margin-bottom: 18px;
}

/* Branded left panel (desktop) */
.auth-brandpane {
    position: relative;
    background: var(--grad-hero);
    color: #fff;
    overflow: hidden;
    isolation: isolate;
    flex-direction: column;
    justify-content: space-between;
    padding: 44px 48px;
}
.auth-brandpane::before,
.auth-brandpane::after {
    content: ""; position: absolute; border-radius: 50%; z-index: -1;
}
.auth-brandpane::before { width: 420px; height: 420px; right: -140px; top: -180px; background: rgba(255, 255, 255, .06); }
.auth-brandpane::after { width: 320px; height: 320px; left: -120px; bottom: -160px; background: rgba(255, 255, 255, .05); }
.auth-brandpane .brand-mark__word { color: #fff; }
.auth-brandpane__title {
    font-size: clamp(1.9rem, 3vw, 2.5rem);
    font-weight: 800; letter-spacing: -.03em; line-height: 1.15;
    margin: 0 0 14px;
}
.auth-brandpane__lead { color: rgba(255, 255, 255, .72); font-size: 1rem; line-height: 1.65; margin: 0; max-width: 42ch; }
.auth-brandpane__foot { color: rgba(255, 255, 255, .5); font-size: .82rem; font-weight: 600; }

.feature-list { display: grid; gap: 14px; margin: 30px 0 0; }
.feature-item { display: flex; gap: 14px; align-items: flex-start; }
.feature-item__icon {
    width: 38px; height: 38px; border-radius: 12px;
    background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .16);
    color: #fff;
    display: grid; place-items: center; flex-shrink: 0;
}
.feature-item strong { display: block; font-size: .93rem; font-weight: 700; margin-bottom: 2px; }
.feature-item span { color: rgba(255, 255, 255, .65); font-size: .84rem; line-height: 1.5; }

/* Landing */
.landing-hero {
    min-height: 100dvh;
    display: flex; flex-direction: column; justify-content: center;
    padding: calc(var(--safe-t) + 40px) 24px calc(var(--safe-b) + 36px);
    width: 100%; max-width: 460px; margin: 0 auto;
}
.landing-hero .brand-mark { margin-bottom: 30px; }
.landing-lead { max-width: 38ch; margin: 14px 0 28px; font-size: 1rem; }
.landing-features { display: grid; gap: 10px; margin-top: 30px; }
.landing-feature {
    display: flex; gap: 13px; align-items: center;
    padding: 14px 15px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--line);
    box-shadow: var(--shadow-card);
}
.landing-feature__icon {
    width: 40px; height: 40px; border-radius: 12px;
    background: var(--brand-50); color: var(--brand-600);
    display: grid; place-items: center; flex-shrink: 0;
}
.landing-feature strong { display: block; font-size: .9rem; font-weight: 700; }
.landing-feature span { color: var(--muted); font-size: .8rem; line-height: 1.45; }

/* Flash messages (session redirects) */
.flash-stack {
    position: fixed; top: calc(var(--safe-t) + 14px); left: 50%;
    transform: translateX(-50%);
    z-index: 120; width: min(430px, calc(100% - 32px));
    display: grid; gap: 8px;
}
.flash-stack .alert { margin: 0; box-shadow: var(--shadow-float); animation: toastIn .3s ease both; }

/* Animations */
.fade-in { animation: rise .35s cubic-bezier(.2, .8, .3, 1) both; }
@keyframes rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ==========================================================================
   DESKTOP — ≥960px: sidebar shell, dashboard grid, split auth
   ========================================================================== */
@media (min-width: 960px) {
    :root { --nav-h: 0px; }

    /* !important: the app JS toggles inline display on this element */
    .bottom-nav { display: none !important; }

    .app-shell {
        display: grid;
        grid-template-columns: 264px 1fr;
    }

    /* Sidebar */
    .side-nav {
        display: flex;
        flex-direction: column;
        position: sticky; top: 0;
        height: 100dvh;
        background: var(--surface);
        border-right: 1px solid var(--line);
        padding: 26px 16px 20px;
    }
    .side-nav__brand { padding: 0 10px 26px; }
    .side-nav__menu { display: grid; gap: 4px; }
    .side-link {
        display: flex; align-items: center; gap: 12px;
        width: 100%; border: 0; background: transparent;
        border-radius: 12px; padding: 12px 14px;
        font: inherit; font-size: .92rem; font-weight: 700;
        color: var(--muted); cursor: pointer; text-align: left;
        transition: background .15s ease, color .15s ease;
    }
    .side-link:hover { background: var(--bg); color: var(--ink); }
    .side-link.is-active { background: var(--brand-50); color: var(--brand-700); }
    .side-nav__foot {
        margin-top: auto;
        display: flex; align-items: center; gap: 11px;
        padding: 12px 10px 0;
        border-top: 1px solid var(--line);
    }
    .side-nav__foot .avatar {
        width: 38px; height: 38px; font-size: .85rem;
        background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100);
    }
    .side-nav__who { min-width: 0; flex: 1; }
    .side-nav__who-name { font-weight: 700; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .side-nav__who-sub { color: var(--faint); font-size: .74rem; font-weight: 600; }
    .side-nav .icon-btn {
        width: 36px; height: 36px;
        background: transparent; border-color: var(--line);
        color: var(--muted);
    }
    .side-nav .icon-btn:hover { color: var(--danger); border-color: #f3c4c4; background: var(--danger-soft); }

    /* Main area */
    .app-main { max-width: none; margin: 0; min-height: 100dvh; }
    .screen { padding: 0 44px 48px; width: 100%; max-width: 1120px; margin: 0 auto; }

    .app-topbar {
        background: transparent;
        color: var(--ink);
        padding: 30px 44px 22px;
        max-width: 1120px; margin: 0 auto; width: 100%;
    }
    .app-topbar__greet { color: var(--muted); }
    .app-topbar__name { font-size: 1.25rem; }
    .app-topbar .avatar { display: none; }
    .app-topbar .icon-btn { display: none; } /* sign-out lives in the sidebar */

    .app-shell.is-home .app-topbar { padding-bottom: 22px; }
    .app-shell.is-home .screen { margin-top: 0; }

    /* Home becomes a two-column dashboard */
    .home-layout {
        display: grid;
        grid-template-columns: minmax(0, 1.02fr) minmax(0, .98fr);
        gap: 28px;
        align-items: start;
    }
    .hero-card { padding: 30px 28px 26px; }
    .hero-card__amount { font-size: 2.6rem; }
    .home-side .section-head:first-child { margin-top: 0; }

    .qa-row { margin-top: 22px; }
    .qa { padding: 16px; }

    /* Centered content pages */
    .page-narrow { max-width: 660px; margin: 0 auto; }
    .page-head {
        max-width: 1120px; margin: 0 auto; width: 100%;
        padding: 30px 44px 18px;
    }
    .step-screen { padding-top: 26px; }
    .flow-bar { max-width: 480px; margin: 0 auto; padding: 26px 0 4px; width: 100%; }

    /* Loan detail: two columns */
    .detail-layout {
        max-width: 880px; margin: 0 auto;
        grid-template-columns: 1fr 1fr; gap: 0 24px;
        align-items: start;
    }
    .detail-layout > .detail-hero,
    .detail-layout > .btn-row { grid-column: 1 / -1; }
    .detail-layout .btn-row { grid-template-columns: repeat(2, minmax(0, 240px)); justify-content: center; }


    /* Auth split screen */
    .auth-shell { grid-template-columns: 1.05fr .95fr; }
    .auth-brandpane { display: flex; }
    .auth-pane { max-width: 440px; padding: 48px 40px; }
    .auth-pane > .brand-mark { display: none; } /* brand shows in the left pane */
    .auth-pane .landing-features { display: none; } /* features shown in the left pane */

    /* Landing on desktop */
    .landing-hero { max-width: 440px; }
}

/* Wide phones / small tablets */
@media (min-width: 560px) and (max-width: 959px) {
    .screen, .app-topbar { padding-left: 26px; padding-right: 26px; }
}
