:root {
    --dem-blue: #0090FF;
    --dem-green: #38B24A;
    --dem-navy: #081D39;
    --dem-light: #F2F4F7;
    --dem-white: #FFFFFF;
    --dem-gray: #6c757d;
    --dem-dark: #1a1a2e;
}

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

body {
    margin: 0; padding: 0;
    font-family: 'Roboto', sans-serif;
    background: var(--dem-light);
    min-height: 100vh;
}

/* ============ SPLIT SCREEN AUTH ============ */
.dem-auth-split {
    display: flex; min-height: 100vh; width: 100%;
}
.dem-auth-split__form {
    flex: 1; display: flex; align-items: center; justify-content: center;
    padding: 40px 24px; background: var(--dem-white);
}
.dem-auth-split__visual {
    flex: 1; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--dem-navy) 0%, #0a2a5c 100%);
    padding: 40px; position: relative; overflow: hidden;
}
.dem-auth-stage { width: 100%; max-width: 440px; }
.dem-auth-brand { text-align: center; margin-bottom: 32px; }
.dem-auth-brand img { height: 56px; margin-bottom: 12px; }
.dem-auth-brand h1 { font-size: 24px; font-weight: 700; color: var(--dem-navy); margin: 0 0 4px 0; }
.dem-auth-brand p { font-size: 14px; color: var(--dem-gray); margin: 0; }

.dem-field { margin-bottom: 20px; }
.dem-field label {
    display: block; font-size: 13px; font-weight: 500;
    color: var(--dem-navy); margin-bottom: 6px;
}
.dem-field .form-control {
    width: 100%; height: 48px; padding: 12px 16px; font-size: 15px;
    border: 1.5px solid #dde1e6; border-radius: 10px;
    background: var(--dem-white); color: var(--dem-navy);
    transition: all 0.2s; outline: none;
}
.dem-field .form-control:focus {
    border-color: var(--dem-blue);
    box-shadow: 0 0 0 3px rgba(0,144,255,0.12);
}
.dem-field .form-control::placeholder { color: #a0a8b3; }

.dem-field .select2-container .select2-selection--single {
    height: 48px; border: 1.5px solid #dde1e6; border-radius: 10px;
}
.dem-field .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 48px; padding-left: 16px; font-size: 15px; color: var(--dem-navy);
}
.dem-field .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 46px;
}

.dem-auth-btn {
    width: 100%; height: 48px; border: none; border-radius: 10px;
    font-size: 15px; font-weight: 600; cursor: pointer;
    transition: all 0.2s;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.dem-auth-btn--primary { background: var(--dem-blue); color: var(--dem-white); }
.dem-auth-btn--primary:hover {
    background: #0078e0; transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,144,255,0.3);
}
.dem-auth-btn--google {
    background: var(--dem-white); color: var(--dem-dark);
    border: 1.5px solid #dde1e6;
}
.dem-auth-btn--google:hover { background: #f5f5f5; border-color: #bbb; }
.dem-auth-btn--google i { font-size: 18px; color: #DB4437; }

.dem-auth-divider {
    display: flex; align-items: center; margin: 24px 0;
    color: var(--dem-gray); font-size: 13px;
}
.dem-auth-divider::before, .dem-auth-divider::after {
    content: ''; flex: 1; height: 1px; background: #dde1e6;
}
.dem-auth-divider span { padding: 0 16px; }

.dem-auth-footer { text-align: center; margin-top: 24px; font-size: 14px; color: var(--dem-gray); }
.dem-auth-footer a { color: var(--dem-blue); text-decoration: none; font-weight: 500; }
.dem-auth-footer a:hover { text-decoration: underline; }

.dem-auth-slogan { text-align: center; margin-top: 32px; font-size: 12px; color: #a0a8b3; }

.dem-auth-visual-content { text-align: center; color: var(--dem-white); max-width: 400px; }
.dem-auth-visual-content h2 { font-size: 28px; font-weight: 700; margin: 0 0 16px; line-height: 1.3; }
.dem-auth-visual-content p { font-size: 15px; opacity: 0.85; line-height: 1.6; }

@media (max-width: 768px) {
    .dem-auth-split__visual { display: none; }
    .dem-auth-split__form { padding: 24px 16px; }
}

/* ============ BORROWER DASHBOARD ============ */
.dem-dash {
    display: flex; min-height: 100vh;
}
.dem-dash__sidebar {
    width: 260px; background: var(--dem-navy); color: var(--dem-white);
    display: flex; flex-direction: column; position: fixed; top: 0; left: 0;
    height: 100vh; z-index: 100;
}
.dem-dash__sidebar-header {
    padding: 20px; text-align: center; border-bottom: 1px solid rgba(255,255,255,0.1);
}
.dem-dash__sidebar-header img { height: 40px; margin-bottom: 8px; }
.dem-dash__sidebar-header h5 { font-size: 13px; font-weight: 400; opacity: 0.7; margin: 0; }
.dem-dash__sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; }
.dem-dash__sidebar-nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 20px; color: rgba(255,255,255,0.7);
    text-decoration: none; font-size: 14px; font-weight: 400;
    transition: all 0.2s;
}
.dem-dash__sidebar-nav a:hover, .dem-dash__sidebar-nav a.active {
    background: rgba(255,255,255,0.08); color: var(--dem-white);
}
.dem-dash__sidebar-nav a i { font-size: 20px; }
.dem-dash__sidebar-footer {
    padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.1);
}
.dem-dash__sidebar-footer a {
    color: rgba(255,255,255,0.6); text-decoration: none; font-size: 14px;
    display: flex; align-items: center; gap: 8px;
}
.dem-dash__sidebar-footer a:hover { color: var(--dem-white); }

.dem-dash__main {
    margin-left: 260px; flex: 1; min-height: 100vh;
    display: flex; flex-direction: column;
}
.dem-dash__topbar {
    background: var(--dem-white); padding: 16px 32px;
    display: flex; align-items: center; justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    position: sticky; top: 0; z-index: 50;
}
.dem-dash__topbar h4 { margin: 0; font-size: 20px; font-weight: 600; color: var(--dem-navy); }
.dem-dash__topbar-user { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--dem-gray); }
.dem-dash__topbar-user i { font-size: 24px; color: var(--dem-navy); }

.dem-dash__content { padding: 32px; flex: 1; }

.dem-dash__welcome {
    background: linear-gradient(135deg, var(--dem-blue), #0078e0);
    color: var(--dem-white); border-radius: 16px; padding: 32px; margin-bottom: 32px;
}
.dem-dash__welcome h2 { margin: 0 0 8px; font-size: 24px; font-weight: 700; }
.dem-dash__welcome p { margin: 0; font-size: 15px; opacity: 0.9; }

.dem-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 32px; }
.dem-stat-card {
    background: var(--dem-white); border-radius: 12px; padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.dem-stat-card__label { font-size: 13px; color: var(--dem-gray); margin-bottom: 4px; }
.dem-stat-card__value { font-size: 28px; font-weight: 700; color: var(--dem-navy); }
.dem-stat-card__icon { font-size: 32px; color: var(--dem-blue); }

.dem-table-wrap { background: var(--dem-white); border-radius: 12px; padding: 24px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.dem-table-wrap h5 { margin: 0 0 16px; font-size: 16px; font-weight: 600; color: var(--dem-navy); }
.dem-table { width: 100%; border-collapse: collapse; }
.dem-table th { text-align: left; padding: 12px; font-size: 12px; font-weight: 600; color: var(--dem-gray); text-transform: uppercase; border-bottom: 2px solid #eee; }
.dem-table td { padding: 12px; font-size: 14px; color: var(--dem-dark); border-bottom: 1px solid #f0f0f0; }

.dem-badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.dem-badge--pending { background: #fff3cd; color: #856404; }
.dem-badge--approved, .dem-badge--active { background: #d4edda; color: #155724; }
.dem-badge--rejected { background: #f8d7da; color: #721c24; }
.dem-badge--review { background: #cce5ff; color: #004085; }

.dem-action-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 500;
    text-decoration: none; cursor: pointer; border: none; transition: all 0.2s;
}
.dem-action-btn--primary { background: var(--dem-blue); color: var(--dem-white); }
.dem-action-btn--primary:hover { background: #0078e0; }
.dem-action-btn--outline { background: transparent; color: var(--dem-blue); border: 1.5px solid var(--dem-blue); }
.dem-action-btn--outline:hover { background: rgba(0,144,255,0.06); }
.dem-action-btn--success { background: var(--dem-green); color: var(--dem-white); }
.dem-action-btn--success:hover { background: #2d9a3e; }

.loan-application-card {
    border-radius: 20px;
    padding: 36px;
}

.loan-application-card__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
}

.loan-application-card__title {
    margin: 0;
    font-size: 36px;
    font-weight: 800;
    color: var(--dem-navy);
    line-height: 1.15;
}

.loan-application-card__subtitle {
    margin: 10px 0 0;
    font-size: 18px;
    color: var(--dem-gray);
    line-height: 1.7;
    max-width: 760px;
}

.loan-application-card__meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
    font-size: 16px;
    color: var(--dem-gray);
    background: #f8fbff;
    border: 1px solid #d9ebff;
    border-radius: 16px;
    padding: 14px 18px;
}

.loan-form-section {
    padding-top: 22px;
    margin-top: 22px;
    border-top: 1px solid #edf2f7;
}

.loan-form-section:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.loan-form-section__title {
    margin: 0 0 16px;
    font-size: 26px;
    font-weight: 800;
    color: var(--dem-navy);
}

.loan-form-section__description {
    margin: 0 0 18px;
    font-size: 18px;
    line-height: 1.7;
    color: var(--dem-gray);
}

.loan-application-form .dem-field {
    margin-bottom: 24px;
}

.loan-application-form .dem-field label {
    font-size: 19px;
    font-weight: 700;
    margin-bottom: 10px;
}

.loan-application-form .form-control,
.loan-application-form .select2-container--default .select2-selection--single .select2-selection__rendered {
    font-size: 19px;
}

.loan-application-form .form-control {
    min-height: 64px;
    height: 64px;
    padding: 16px 18px;
    border-radius: 16px;
}

.loan-application-form .form-control::placeholder {
    font-size: 18px;
}

.loan-application-form .dem-field-textarea {
    min-height: 170px;
    height: auto;
    line-height: 1.7;
    resize: vertical;
}

.loan-application-form .select2-container .select2-selection--single {
    height: 64px;
    border-radius: 16px;
}

.loan-application-form .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 64px;
}

.loan-application-form .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 62px;
}

.loan-upload-input {
    padding: 14px 18px !important;
    line-height: 1.5;
    background: #fff !important;
}

.loan-upload-help {
    display: block;
    margin-top: 10px;
    font-size: 16px;
    color: var(--dem-gray);
    line-height: 1.6;
}

.loan-form-actions {
    margin-top: 32px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.loan-form-submit,
.loan-form-cancel {
    min-height: 62px;
    padding: 0 28px;
    font-size: 19px;
    font-weight: 700;
    justify-content: center;
}

.loan-form-submit i,
.loan-form-cancel i {
    font-size: 22px !important;
}

.loan-feedback-cell {
    min-width: 220px;
    max-width: 340px;
    line-height: 1.6;
}

.loan-detail-card {
    border-radius: 20px;
    padding: 32px;
}

.loan-detail-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 26px;
}

.loan-detail-card__header h5 {
    margin: 0;
    font-size: 30px;
    font-weight: 800;
}

.loan-detail-card__header p {
    margin: 8px 0 0;
    font-size: 16px;
    color: var(--dem-gray);
}

.loan-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.loan-detail-item {
    border: 1px solid #e8eef5;
    border-radius: 16px;
    padding: 18px 20px;
    background: #fbfdff;
}

.loan-detail-item__label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--dem-gray);
    text-transform: uppercase;
}

.loan-detail-item strong {
    font-size: 18px;
    line-height: 1.6;
    color: var(--dem-navy);
}

.loan-detail-note {
    margin-top: 20px;
    padding: 20px;
    border-radius: 16px;
    background: #f8fbff;
    border: 1px solid #d8e8f8;
}

.loan-detail-note--danger {
    background: #fff5f5;
    border-color: #fed7d7;
}

.loan-detail-note h6 {
    margin: 0 0 10px;
    font-size: 18px;
    font-weight: 700;
    color: var(--dem-navy);
}

.loan-detail-note p {
    margin: 0;
    font-size: 16px;
    line-height: 1.7;
    color: var(--dem-dark);
}

.empty-state {
	text-align: center;
	padding: 56px 24px;
	color: var(--dem-gray);
}

.empty-state i {
	font-size: 56px;
	margin-bottom: 16px;
	opacity: 0.2;
	color: #94a3b8;
	display: block;
}

.empty-state p {
	font-size: 16px;
	margin: 0 0 28px;
	color: #6b7a8f;
	line-height: 1.6;
}

.empty-state__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 14px 36px;
	border-radius: 999px;
	font-size: 15px;
	font-weight: 700;
	text-decoration: none;
	border: none;
	cursor: pointer;
	background: linear-gradient(135deg, #0090FF, #0077E6);
	color: #FFFFFF;
	box-shadow: 0 8px 20px rgba(0,144,255,0.25);
	transition: all 0.3s ease;
	letter-spacing: 0.01em;
}

.empty-state__btn:hover {
	transform: translateY(-2px);
	box-shadow: 0 12px 28px rgba(0,144,255,0.35);
	background: linear-gradient(135deg, #0077E6, #0066cc);
	color: #FFFFFF;
}

.empty-state__btn i {
	font-size: 18px;
	margin: 0;
	opacity: 1;
	color: inherit;
	display: inline;
}

@media (max-width: 768px) {
    .dem-dash__sidebar { width: 0; overflow: hidden; }
    .dem-dash__main { margin-left: 0; }
    .dem-dash__content { padding: 16px; }
    .dem-stats { grid-template-columns: 1fr; }
    .loan-application-card,
    .loan-detail-card { padding: 24px 18px; }
    .loan-application-card__title { font-size: 30px; }
    .loan-application-card__subtitle,
    .loan-form-section__description { font-size: 16px; }
    .loan-form-section__title { font-size: 24px; }
    .loan-application-form .dem-field label { font-size: 18px; }
    .loan-application-form .form-control,
    .loan-application-form .select2-container--default .select2-selection--single .select2-selection__rendered { font-size: 18px; }
    .loan-application-form .form-control { min-height: 58px; height: 58px; }
    .loan-application-form .select2-container .select2-selection--single { height: 58px; }
    .loan-application-form .select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 58px; }
    .loan-application-form .select2-container--default .select2-selection--single .select2-selection__arrow { height: 56px; }
    .loan-form-submit,
    .loan-form-cancel { width: 100%; font-size: 18px; min-height: 58px; }
    .loan-detail-grid { grid-template-columns: 1fr; }
}

body.dem-sidebar-open {
    overflow: hidden;
}

.dem-dash,
.dem-dash__main,
.dem-dash__content {
    min-width: 0;
}

.dem-dash__toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid rgba(56, 178, 74, 0.25);
    border-radius: 12px;
    background: rgba(56, 178, 74, 0.12);
    color: #38B24A;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.dem-dash__toggle i {
    font-size: 22px;
    color: #38B24A !important;
}

.dem-dash__toggle:hover {
    background: #38B24A;
    color: #FFFFFF;
    transform: scale(1.03);
}

.dem-dash__toggle:hover i {
    color: #FFFFFF !important;
}

.dem-dash__toggle.active {
    background: rgba(56, 178, 74, 0.18);
    border-color: rgba(56, 178, 74, 0.30);
}

.dem-dash__toggle.active i {
    color: #38B24A !important;
}

.dem-dash__overlay {
    position: fixed;
    inset: 0;
    border: none;
    background: rgba(8, 29, 57, 0.45);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    z-index: 95;
}

.dem-dash__overlay.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.dem-dash__topbar > div:first-child {
    min-width: 0;
}

.dem-dash__topbar h4,
.dem-dash__topbar-user span {
    overflow-wrap: anywhere;
}

.dem-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.dem-table {
    min-width: 680px;
}

.loan-form-actions .dem-action-btn,
.loan-form-actions .loan-form-submit,
.loan-form-actions .loan-form-cancel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 991px) {
    .dem-dash__toggle {
        display: inline-flex;
    }

    .dem-dash__sidebar {
        width: 280px;
        max-width: 86vw;
        transform: translateX(-100%);
        transition: transform 0.28s ease;
        overflow: hidden auto;
        box-shadow: none;
    }

    .dem-dash__sidebar.open {
        transform: translateX(0);
        box-shadow: 0 18px 40px rgba(8, 29, 57, 0.28);
    }

    .dem-dash__main {
        margin-left: 0;
        width: 100%;
    }

    .dem-dash__topbar {
        padding: 16px 18px;
        gap: 14px;
        flex-wrap: wrap;
    }

    .dem-dash__topbar-user {
        min-width: 0;
    }

    .loan-application-card__header,
    .loan-detail-card__header {
        flex-direction: column;
        align-items: flex-start;
    }

    .loan-application-card__meta {
        width: 100%;
    }

    .loan-application-form .row > [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .dem-dash__sidebar {
        width: 280px;
    }

    .dem-dash__topbar {
        align-items: flex-start;
    }

    .dem-dash__topbar-user {
        width: 100%;
        justify-content: flex-start;
    }

    .dem-table {
        min-width: 620px;
    }

    .loan-form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .loan-form-actions > * {
        width: 100%;
    }
}

@media (max-width: 576px) {
    .dem-dash__sidebar {
        width: min(280px, 88vw);
    }

    .dem-dash__content {
        padding: 14px 12px;
    }

    .dem-dash__topbar {
        padding: 14px 12px;
    }

    .dem-dash__welcome,
    .dem-table-wrap,
    .loan-application-card,
    .loan-detail-card {
        border-radius: 16px;
    }

    .loan-application-card__title,
    .loan-detail-card__header h5 {
        font-size: 26px;
    }

    .loan-upload-help,
    .loan-detail-note p,
    .loan-detail-item strong {
        font-size: 15px;
    }
}
