@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&display=swap');

:root {
    --ink: #17211f;
    --muted: #65716d;
    --line: #dfe6e2;
    --paper: #f7f9f6;
    --white: #ffffff;
    --green: #0f6a4f;
    --green-dark: #084232;
    --gold: #c08a2b;
    --red: #b42318;
    --shadow: 0 20px 60px rgba(20, 35, 31, 0.12);
    --font-main: Montserrat, Arial, sans-serif;
    --font-ui: "Google Sans", "Google Sans Text", "Product Sans", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font-main); color: var(--ink); background: var(--paper); }
a { color: inherit; text-decoration: none; }

.site-header {
    position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 24px;
    padding: 18px clamp(20px, 5vw, 72px); background: rgba(247, 249, 246, 0.92); backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(223, 230, 226, 0.75);
}
.brand { display: inline-flex; align-items: center; gap: 12px; font-family: var(--font-ui); font-weight: 800; }
.brand-mark { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 8px; color: var(--white); background: var(--green); font-size: 0.82rem; letter-spacing: 0; }
.site-nav { display: flex; align-items: center; gap: 22px; color: var(--muted); font-family: var(--font-ui); font-weight: 600; }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 20px; border: 0; border-radius: 8px; color: var(--white); background: var(--green); font-family: var(--font-ui); font-size: inherit; font-weight: 800; cursor: pointer; }
.button:hover { background: var(--green-dark); }
.button-secondary { color: var(--green-dark); background: var(--white); border: 1px solid var(--line); }
.button-secondary:hover { color: var(--white); }
.button-small { min-height: 38px; padding: 0 16px; }
.button-full { width: 100%; }

.hero { min-height: calc(100vh - 78px); display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr); align-items: center; gap: clamp(32px, 6vw, 86px); padding: 64px clamp(20px, 5vw, 72px) 80px; background: linear-gradient(120deg, rgba(15, 106, 79, 0.08), rgba(192, 138, 43, 0.10)), var(--paper); }
.eyebrow { margin: 0 0 12px; color: var(--gold); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3, .eyebrow, label, th, .stat-card span, .metric-grid span, .sidebar-nav, .logout-link, .profile-chip, .status, .text-button, .form-section-title { font-family: var(--font-ui); }
h1 { max-width: 820px; margin-bottom: 22px; font-size: clamp(2.6rem, 6vw, 5.8rem); line-height: 0.95; letter-spacing: 0; }
h2 { margin-bottom: 14px; font-size: clamp(2rem, 3.5vw, 3.4rem); line-height: 1; letter-spacing: 0; }
h3 { font-size: 1.05rem; }
.hero-text { max-width: 670px; color: var(--muted); font-size: 1.16rem; line-height: 1.7; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.hero-panel, .login-card, .content-panel, .stat-card, .feature-grid article { background: var(--white); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.hero-panel { padding: 18px; }
.panel-topbar { display: flex; gap: 7px; padding-bottom: 18px; }
.panel-topbar span { width: 11px; height: 11px; border-radius: 999px; background: var(--line); }
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.metric-grid article { padding: 18px; border-radius: 8px; background: #eef5f1; }
.metric-grid span, .stat-card span { display: block; color: var(--muted); font-size: 0.78rem; font-weight: 800; text-transform: uppercase; }
.metric-grid strong, .stat-card strong { display: block; margin-top: 10px; font-size: 1.8rem; }
.loan-list { display: grid; gap: 10px; margin-top: 16px; }
.loan-list div { display: flex; justify-content: space-between; padding: 16px; border: 1px solid var(--line); border-radius: 8px; }

.section, .login-section { padding: 76px clamp(20px, 5vw, 72px); }
.section-heading { max-width: 760px; margin-bottom: 32px; }
.feature-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.feature-grid article { padding: 24px; }
.feature-grid p, .split-section p, .login-copy p, .empty-state p { color: var(--muted); line-height: 1.7; }
.split-section { display: grid; grid-template-columns: 0.8fr 1fr; gap: 34px; align-items: start; background: var(--white); }
.login-section { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 440px); gap: 48px; align-items: center; }
.login-card { padding: 26px; }
label { display: grid; gap: 8px; margin-bottom: 16px; color: var(--ink); font-size: 0.9rem; font-weight: 800; }
input, select, textarea { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--white); font: inherit; }
input:focus, select:focus, textarea:focus { border-color: var(--green); outline: 3px solid rgba(15, 106, 79, 0.12); }
textarea { min-height: 88px; padding-top: 10px; resize: vertical; }
.alert { margin-bottom: 18px; padding: 12px 14px; border-radius: 8px; font-weight: 700; }
.alert-error { color: var(--red); background: #fff0ed; }
.alert-success { color: var(--green-dark); background: #e9f6ef; }

.dashboard-body { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 24px; color: var(--white); background: #10231e; }
.dashboard-brand { color: var(--white); }
.dashboard-brand .brand-mark { background: var(--gold); }
.sidebar-nav { display: grid; gap: 8px; margin-top: 36px; }
.sidebar-nav a, .logout-link { padding: 12px 14px; border-radius: 8px; color: rgba(255, 255, 255, 0.72); font-weight: 700; }
.sidebar-nav a.active, .sidebar-nav a:hover, .logout-link:hover { color: var(--white); background: rgba(255, 255, 255, 0.11); }
.logout-link { margin-top: auto; }
.dashboard-main { padding: 28px clamp(20px, 4vw, 48px) 54px; }
.dashboard-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 26px; }
.dashboard-header h1 { margin: 0; font-size: 2.35rem; line-height: 1.12; }
.profile-chip { display: flex; align-items: center; gap: 12px; min-width: 240px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); }
.profile-chip span { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 8px; color: var(--white); background: var(--green); font-weight: 800; }
.profile-chip strong, .profile-chip small { display: block; }
.profile-chip small { color: var(--muted); }
.dashboard-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { padding: 22px; }
.stat-card small { color: var(--muted); }
.content-panel { padding: 24px; }
.panel-heading { display: flex; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.panel-heading h2 { margin: 0; font-size: 1.6rem; }
.user-form { display: grid; grid-template-columns: repeat(6, minmax(140px, 1fr)); gap: 12px; align-items: end; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.user-form label { margin: 0; }
.table-wrap { width: 100%; overflow-x: auto; margin-top: 20px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; }
.status { display: inline-flex; padding: 6px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 800; }
.status-active { color: var(--green-dark); background: #e9f6ef; }
.status-muted { color: var(--muted); background: #eef1ef; }
.text-button { border: 0; color: var(--green); background: transparent; font: inherit; font-weight: 800; cursor: pointer; }
.clickable-row { cursor: pointer; }
.clickable-row:hover { background: #f0f6f2; }
.row-link { color: var(--green-dark); font-weight: 700; }
.dropdown-panel { padding: 0; overflow: hidden; }
.dropdown-panel summary { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 22px 24px; list-style: none; cursor: pointer; }
.dropdown-panel summary::-webkit-details-marker { display: none; }
.dropdown-panel summary strong { display: block; margin-top: 8px; font-family: var(--font-ui); font-size: 1.55rem; }
.dropdown-panel summary small { display: block; margin-top: 4px; color: var(--muted); }
.dropdown-panel .table-wrap { margin: 0; padding: 0 24px 22px; }
.dropdown-caret { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px; color: var(--green-dark); font-family: var(--font-ui); font-weight: 800; transition: transform 0.18s ease; }
.dropdown-panel[open] .dropdown-caret { transform: rotate(180deg); }
.empty-state { padding: 42px; border: 1px dashed var(--line); border-radius: 8px; background: #fbfcfb; }
.stack-form { display: grid; gap: 18px; }
.form-section-title { margin-top: 6px; color: var(--green-dark); font-weight: 800; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 14px; }
.form-grid label, .loan-form label, .filter-bar label, .check-grid label { margin: 0; }
.wide { grid-column: 1 / -1; }
.check-grid { display: grid; gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfb; }
.check-grid label { display: flex; align-items: flex-start; gap: 10px; color: var(--muted); font-weight: 700; line-height: 1.45; }
.check-grid input { width: auto; min-height: auto; margin-top: 3px; }
.loan-form, .filter-bar { display: grid; grid-template-columns: repeat(5, minmax(160px, 1fr)); gap: 14px; align-items: end; }
.chart-box { height: 320px; margin-top: 18px; }
.receipt-body { background: #eef3f0; }
.receipt-page { max-width: 980px; margin: 0 auto; padding: 30px 20px; }
.receipt-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-bottom: 18px; }
.receipt-card { padding: 34px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); box-shadow: var(--shadow); }
.receipt-header { display: flex; justify-content: space-between; gap: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.receipt-header h1 { margin: 12px 0 6px; font-size: 2rem; line-height: 1.05; }
.receipt-header p { color: var(--muted); }
.receipt-header > strong { color: var(--green-dark); font-size: 1.2rem; }
.receipt-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 24px; }
.receipt-grid div { padding: 16px; border: 1px solid var(--line); border-radius: 8px; }
.receipt-grid span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 0.78rem; font-weight: 800; text-transform: uppercase; }
.receipt-note { margin: 24px 0 0; color: var(--muted); line-height: 1.7; }
.client-create-panel { display: none; }
.client-create-panel.is-open { display: block; }
.icon-close { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: var(--white); font-family: var(--font-ui); font-weight: 800; cursor: pointer; }
.icon-close:hover { color: var(--white); background: var(--green); border-color: var(--green); }
.floating-add { position: fixed; right: 28px; bottom: 28px; z-index: 20; display: grid; place-items: center; width: 58px; height: 58px; border: 0; border-radius: 50%; color: var(--white); background: var(--green); box-shadow: 0 16px 36px rgba(8, 66, 50, 0.28); font-family: var(--font-ui); font-size: 2rem; font-weight: 800; line-height: 1; cursor: pointer; }
.floating-add:hover { background: var(--green-dark); }

@media (max-width: 1040px) {
    .hero, .split-section, .login-section { grid-template-columns: 1fr; }
    .feature-grid, .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .user-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid, .loan-form, .filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
    .site-header, .dashboard-header { align-items: flex-start; flex-direction: column; }
    .site-nav { width: 100%; justify-content: space-between; gap: 12px; font-size: 0.92rem; }
    .hero { min-height: auto; padding-top: 44px; }
    .metric-grid, .feature-grid, .dashboard-grid, .user-form, .form-grid, .loan-form, .filter-bar, .receipt-grid { grid-template-columns: 1fr; }
    .dashboard-body { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; }
    .dashboard-main { padding-top: 24px; }
    .dashboard-header h1 { font-size: 1.9rem; }
    .profile-chip { width: 100%; min-width: 0; }
    .receipt-header { flex-direction: column; }
    .floating-add { right: 18px; bottom: 18px; }
}

@media print {
    .receipt-actions { display: none; }
    .receipt-body { background: var(--white); }
    .receipt-card { box-shadow: none; }
}
