:root {
    --sidebar-width: 260px;
    --sidebar-bg: #1a2332;
    --sidebar-hover: #2a3650;
    --sidebar-active: #0d6efd;
    --primary: #0d6efd;
    --primary-dark: #0b5ed7;
    --bg-light: #f4f6f9;
    --card-shadow: 0 2px 8px rgba(0,0,0,0.08);
    --border-color: #e0e0e0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html { font-size: 15px; }
}

body {
    background: var(--bg-light);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ===== AUTH PAGES ===== */
.auth-body {
    background: linear-gradient(135deg, #1a2332 0%, #2a3650 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 1rem;
}

.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 64px;
    height: 64px;
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    color: #fff;
    font-size: 1.8rem;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.login-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
}

.login-header h2 {
    font-size: 1.3rem;
    color: #1a2332;
    margin-bottom: 0.25rem;
}

.login-header p {
    color: #6c757d;
    font-size: 0.9rem;
}

.btn-login {
    padding: 0.7rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: #adb5bd;
}

/* ===== DASHBOARD LAYOUT ===== */
.wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #cbd5e0;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
    width: 42px;
    height: 42px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.sidebar-header h5 {
    margin: 0;
    color: #fff;
    font-size: 1.05rem;
    font-weight: 700;
}

.sidebar-header small {
    color: #8895a7;
    font-size: 0.75rem;
}

.sidebar-nav {
    list-style: none;
    padding: 0.75rem 0;
    margin: 0;
    flex-grow: 1;
    overflow-y: auto;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1.5rem;
    color: #cbd5e0;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-nav li a:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-nav li a.active {
    background: rgba(13,110,253,0.15);
    color: #fff;
    border-left-color: var(--primary);
}

.sidebar-nav li a i {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-footer a {
    color: #ef5350 !important;
    text-decoration: none;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 36, 0.45);
    z-index: 999;
}

.sidebar-overlay.show {
    display: block;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    background: #fff;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    position: sticky;
    top: 0;
    z-index: 999;
}

.btn-toggle {
    background: transparent;
    border: none;
    font-size: 1.3rem;
    color: #495057;
    margin-right: 1rem;
    cursor: pointer;
}

.page-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: #1a2332;
}

.page-content {
    padding: 1.5rem;
    flex-grow: 1;
}

.page-footer {
    padding: 1rem 1.5rem;
    text-align: center;
    color: #adb5bd;
    font-size: 0.8rem;
    border-top: 1px solid var(--border-color);
    background: #fff;
}

/* ===== STAT CARDS ===== */
.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 1.25rem;
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid transparent;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card.clickable {
    cursor: pointer;
    position: relative;
}

.stat-card.clickable:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    border-color: rgba(13,110,253,0.2);
}

.stat-card-arrow {
    margin-left: auto;
    color: #adb5bd;
    font-size: 1rem;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
}

.stat-card.clickable:hover .stat-card-arrow {
    opacity: 1;
    transform: translateX(4px);
    color: var(--primary);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
    flex-shrink: 0;
}

.stat-icon.bg-blue { background: linear-gradient(135deg, #0d6efd, #0a58ca); }
.stat-icon.bg-green { background: linear-gradient(135deg, #198754, #157347); }
.stat-icon.bg-orange { background: linear-gradient(135deg, #fd7e14, #dc6402); }
.stat-icon.bg-purple { background: linear-gradient(135deg, #6f42c1, #5a32a3); }
.stat-icon.bg-red { background: linear-gradient(135deg, #dc3545, #bb2d3b); }
.stat-icon.bg-teal { background: linear-gradient(135deg, #20c997, #1aa179); }
.stat-icon.bg-pink { background: linear-gradient(135deg, #d63384, #b02a6f); }
.stat-icon.bg-indigo { background: linear-gradient(135deg, #6610f2, #520dc2); }

.stat-info h3 {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 700;
    color: #1a2332;
}

.stat-info p {
    margin: 0;
    font-size: 0.85rem;
    color: #6c757d;
}

/* ===== TABLES ===== */
.table-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.table-card .card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.table-card .card-header h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.table-card table {
    margin: 0;
}

.table-card table thead th {
    background: #f8f9fa;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    border-bottom: 2px solid var(--border-color);
}

.table-card table tbody td {
    vertical-align: middle;
    font-size: 0.9rem;
}

/* ===== BADGES ===== */
.badge-status {
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
    border-radius: 6px;
}

.badge-draft { background: #e9ecef; color: #6c757d; }
.badge-submitted { background: #cff4fc; color: #055160; }
.badge-approved { background: #d1e7dd; color: #0a3622; }
.badge-returned { background: #fff3cd; color: #664d03; }
.badge-rejected { background: #f8d7da; color: #842029; }

/* ===== FORMS ===== */
.form-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-card h5 {
    font-weight: 600;
    color: #1a2332;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

.form-section-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.form-section-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #fff;
    flex-shrink: 0;
}

.form-section-header h5 {
    margin: 0;
    font-weight: 700;
    color: #1a2332;
    padding: 0;
    border: none;
}

.form-section-header p {
    margin: 0.2rem 0 0;
    font-size: 0.85rem;
    color: #6c757d;
}

.input-group-text {
    background: #f8f9fa;
    border-color: #dee2e6;
    color: #6c757d;
    border-radius: 8px 0 0 8px;
}

.input-group .form-control,
.input-group .form-select {
    border-radius: 0 8px 8px 0;
}

.info-note {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: #e7f1ff;
    border: 1px solid #b6d4fe;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    font-size: 0.88rem;
    color: #084298;
}

.info-note i {
    font-size: 1.1rem;
    margin-top: 1px;
    flex-shrink: 0;
}

.info-note code {
    background: #fff;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #d63384;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.form-label {
    font-weight: 500;
    font-size: 0.85rem;
    color: #495057;
    margin-bottom: 0.35rem;
}

.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    padding: 0.55rem 0.75rem;
    font-size: 0.9rem;
}

.form-control:focus, .form-select:focus {
    box-shadow: 0 0 0 0.2rem rgba(13,110,253,0.15);
    border-color: var(--primary);
}

/* ===== MULTI-STEP FORM ===== */
.progress-stepper {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    position: relative;
    overflow-x: auto;
}

.progress-stepper::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 2px;
    background: #e0e0e0;
    z-index: 0;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
    cursor: pointer;
    min-width: 80px;
}

.step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.step.active .step-circle {
    background: var(--primary);
    color: #fff;
}

.step.completed .step-circle {
    background: #198754;
    color: #fff;
}

.step-label {
    font-size: 0.75rem;
    margin-top: 0.5rem;
    color: #6c757d;
    text-align: center;
    white-space: nowrap;
}

.step.active .step-label { color: var(--primary); font-weight: 600; }
.step.completed .step-label { color: #198754; }

.form-section {
    display: none;
}

.form-section.active {
    display: block;
}

/* ===== DYNAMIC ROW ITEMS ===== */
.dynamic-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    position: relative;
}

.dynamic-item .btn-delete-row {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    color: #dc3545;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
}

/* ===== CHECKBOX GRID ===== */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}

.checkbox-grid .form-check {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 0.6rem 1rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 4px 0 20px rgba(0,0,0,0.3);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .topbar {
        padding: 0.6rem 1rem;
    }

    .page-title {
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        min-width: 0;
    }

    .page-content {
        padding: 1rem;
    }

    .page-footer {
        padding: 0.75rem 1rem;
        font-size: 0.72rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-icon {
        width: 42px;
        height: 42px;
        font-size: 1.2rem;
    }

    .stat-info h3 {
        font-size: 1.3rem;
    }

    .form-card {
        padding: 1.1rem;
    }

    .table-card .card-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .dashboard-welcome {
        padding: 1.1rem 1.25rem;
    }

    .login-card {
        padding: 1.75rem 1.25rem;
    }
}

/* ===== UTILITY ===== */
.text-link {
    color: var(--primary);
    text-decoration: none;
}

.text-link:hover {
    text-decoration: underline;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.card {
    border: none;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
}

.alert {
    border-radius: 8px;
}

/* ===== DASHBOARD WELCOME ===== */
.dashboard-welcome {
    background: linear-gradient(135deg, #1a2332 0%, #2a3650 100%);
    border-radius: 12px;
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    color: #fff;
}

.dashboard-welcome h4 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
}

.dashboard-welcome h4 i {
    color: #5b9bd5;
    margin-right: 0.5rem;
}

.dashboard-welcome p {
    margin: 0.25rem 0 0;
    font-size: 0.9rem;
    color: #8895a7;
}

.welcome-date {
    font-size: 0.9rem;
    color: #cbd5e0;
    background: rgba(255,255,255,0.08);
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

.welcome-date i {
    margin-right: 0.4rem;
}

/* ===== QUICK ACTION CARDS ===== */
.quick-action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.75rem 1rem;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    text-decoration: none;
    color: #495057;
    font-weight: 600;
    font-size: 0.9rem;
    text-align: center;
    transition: all 0.2s;
}

.quick-action-card i {
    font-size: 2rem;
    color: var(--primary);
    transition: transform 0.2s;
}

.quick-action-card:hover {
    background: #fff;
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(13,110,253,0.15);
}

.quick-action-card:hover i {
    transform: scale(1.15);
}

/* ===== FUNDING AMOUNT ===== */
.funding-amount {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.25rem;
}

.funding-amount .currency {
    font-size: 1.5rem;
    color: #198754;
    font-weight: 600;
}

.funding-amount .amount {
    font-size: 2.2rem;
    color: #198754;
    font-weight: 800;
    letter-spacing: -1px;
}

/* ===== STATUS ROWS ===== */
.status-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.5rem;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9rem;
}

.status-row:last-child {
    border-bottom: none;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}