/* ==========================================================================
   FRENZON SACCO — Member Portal Stylesheet
   Modern, Accessible, Responsive CSS Design System

   IMPORTANT:
   - CSS is presentation only.
   - Authorization is enforced by Supabase/RLS/backend RPCs.
   - Financial calculations and eligibility rules are backend-owned.
   ========================================================================== */


/* ==========================================================================
   1. DESIGN TOKENS
   ========================================================================== */

:root {
    --primary: #1b4332;
    --primary-hover: #081c15;
    --primary-light: #d8f3dc;

    --accent: #52b788;
    --accent-hover: #40916c;

    --success: #2d6a4f;
    --success-light: #d8f3dc;

    --warning: #b7791f;
    --warning-light: #fffaf0;

    --danger: #9b2c2c;
    --danger-light: #fff5f5;

    --info: #2b6cb0;
    --info-light: #ebf8ff;

    --bg-main: #f4f6f8;
    --bg-card: #ffffff;
    --bg-subtle: #edf2f7;
    --bg-dark: #081c15;

    --text-main: #1a202c;
    --text-muted: #4a5568;
    --text-light: #718096;
    --text-white: #ffffff;

    --border-color: #e2e8f0;
    --border-dark: #cbd5e0;
    --border-focus: #52b788;

    --shadow-sm:
        0 1px 3px rgba(0, 0, 0, 0.08);

    --shadow-md:
        0 4px 6px -1px rgba(0, 0, 0, 0.08),
        0 2px 4px -1px rgba(0, 0, 0, 0.04);

    --shadow-lg:
        0 10px 15px -3px rgba(0, 0, 0, 0.10),
        0 4px 6px -2px rgba(0, 0, 0, 0.05);

    --shadow-focus:
        0 0 0 3px rgba(82, 183, 136, 0.18);

    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 22px;
    --radius-full: 9999px;

    --sidebar-width: 260px;
    --topbar-height: 70px;

    --transition:
        all 0.2s ease-in-out;
}


/* ==========================================================================
   2. BASE RESET
   ========================================================================== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Oxygen,
        Ubuntu,
        Cantarell,
        sans-serif;

    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;

    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button,
input,
select,
textarea {
    font-family: inherit;
    font-size: 100%;
}

button {
    border: 0;
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent-hover);
}

ul,
ol {
    list-style: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-main);
    line-height: 1.25;
}

p {
    margin-bottom: 0.75rem;
}

p:last-child {
    margin-bottom: 0;
}


/* ==========================================================================
   3. ACCESSIBILITY
   ========================================================================== */

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(82, 183, 136, 0.35);
    outline-offset: 2px;
}

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}


/* ==========================================================================
   4. UTILITY CLASSES
   ========================================================================== */

.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--text-muted);
}

.text-light {
    color: var(--text-light);
}

.text-primary {
    color: var(--primary);
}

.text-success {
    color: var(--success);
}

.text-warning {
    color: var(--warning);
}

.text-danger {
    color: var(--danger);
}

.w-full {
    width: 100%;
}

.mt-0 {
    margin-top: 0;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.mb-0 {
    margin-bottom: 0;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}


/* ==========================================================================
   5. AUTHENTICATION SCREEN
   ========================================================================== */

.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;

    min-height: 100vh;
    width: 100%;

    background:
        linear-gradient(
            135deg,
            var(--bg-main) 0%,
            #e9f5ef 100%
        );

    padding: 1rem;
}

.auth-card {
    width: 100%;
    max-width: 430px;

    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);

    box-shadow: var(--shadow-lg);

    padding: 2.5rem;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.03em;
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.auth-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-light);
}

.auth-notice {
    margin-top: 1rem;
    padding: 0.85rem 1rem;

    background-color: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);

    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.5;
}

.password-field {
    position: relative;
}

.password-field .form-control {
    padding-right: 3rem;
}

.password-toggle {
    position: absolute;
    right: 0.75rem;
    top: 50%;

    transform: translateY(-50%);

    background: transparent;
    color: var(--text-muted);

    cursor: pointer;
    padding: 0.25rem;
}

.password-toggle:hover {
    color: var(--primary);
}


/* ==========================================================================
   6. APPLICATION SHELL
   ========================================================================== */

.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}


/* ==========================================================================
   7. SIDEBAR
   ========================================================================== */

.sidebar {
    width: var(--sidebar-width);

    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);

    display: flex;
    flex-direction: column;

    position: fixed;
    inset: 0 auto 0 0;

    z-index: 100;

    transition: var(--transition);
}

.sidebar-header {
    min-height: var(--topbar-height);

    padding: 1rem 1.25rem;

    border-bottom: 1px solid var(--border-color);

    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-brand {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.025em;
}

.sidebar-subtitle {
    font-size: 0.72rem;
    color: var(--text-light);
    margin-top: 0.1rem;
}

.sidebar-nav {
    flex: 1;

    padding: 1rem;

    display: flex;
    flex-direction: column;
    gap: 0.35rem;

    overflow-y: auto;
}

.nav-section-title {
    padding: 0.75rem 1rem 0.4rem;

    color: var(--text-light);

    font-size: 0.7rem;
    font-weight: 700;

    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.nav-item {
    width: 100%;

    display: flex;
    align-items: center;
    gap: 0.75rem;

    padding: 0.75rem 1rem;

    border-radius: var(--radius-sm);

    background: transparent;

    color: var(--text-muted);

    font-weight: 500;
    text-align: left;

    cursor: pointer;

    transition: var(--transition);
}

.nav-item:hover {
    background-color: var(--bg-subtle);
    color: var(--primary);
}

.nav-item.active {
    background-color: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.nav-icon {
    width: 1.25rem;
    min-width: 1.25rem;

    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nav-label {
    flex: 1;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

.sidebar-user {
    padding: 0.75rem;

    background-color: var(--bg-subtle);
    border-radius: var(--radius-md);

    margin-bottom: 0.75rem;
}

.sidebar-user-name {
    font-weight: 600;
    font-size: 0.9rem;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-user-number {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 0.15rem;
}


/* ==========================================================================
   8. MAIN CONTENT
   ========================================================================== */

.main-content {
    flex: 1;

    margin-left: var(--sidebar-width);

    min-width: 0;

    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--topbar-height);

    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 2rem;

    position: sticky;
    top: 0;

    z-index: 90;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;

    min-width: 0;
}

.topbar-title {
    font-size: 1.2rem;
    font-weight: 700;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-member {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.content-body {
    width: 100%;
    max-width: 1250px;

    margin: 0 auto;

    padding: 2rem;

    flex: 1;
}

.page-header {
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: 1.65rem;
    font-weight: 750;
    margin-bottom: 0.3rem;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.92rem;
}


/* ==========================================================================
   9. CARDS
   ========================================================================== */

.card {
    background-color: var(--bg-card);

    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);

    box-shadow: var(--shadow-sm);

    padding: 1.5rem;

    margin-bottom: 1.5rem;
}

.card:last-child {
    margin-bottom: 0;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 1rem;

    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 650;
}

.card-subtitle {
    margin-top: 0.2rem;

    font-size: 0.82rem;
    color: var(--text-light);
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;

    flex-wrap: wrap;
}

.card-body {
    min-width: 0;
}

.card-footer {
    margin-top: 1.25rem;
    padding-top: 1rem;

    border-top: 1px solid var(--border-color);
}


/* ==========================================================================
   10. GRID SYSTEM
   ========================================================================== */

.grid-2,
.grid-3,
.grid-4 {
    display: grid;

    gap: 1.5rem;

    margin-bottom: 1.5rem;
}

.grid-2 {
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
}

.grid-3 {
    grid-template-columns:
        repeat(3, minmax(0, 1fr));
}

.grid-4 {
    grid-template-columns:
        repeat(4, minmax(0, 1fr));
}

.grid-2:last-child,
.grid-3:last-child,
.grid-4:last-child {
    margin-bottom: 0;
}


/* ==========================================================================
   11. STAT / FINANCIAL CARDS
   ========================================================================== */

.stat-card {
    background-color: var(--bg-card);

    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);

    padding: 1.25rem;

    box-shadow: var(--shadow-sm);

    min-width: 0;
}

.stat-label {
    font-size: 0.82rem;
    color: var(--text-muted);

    font-weight: 600;

    margin-bottom: 0.4rem;
}

.stat-value {
    font-size: 1.55rem;
    font-weight: 750;

    color: var(--primary);

    line-height: 1.2;

    overflow-wrap: anywhere;
}

.stat-description {
    margin-top: 0.45rem;

    font-size: 0.75rem;
    color: var(--text-light);
}

.stat-icon {
    width: 2.4rem;
    height: 2.4rem;

    border-radius: var(--radius-md);

    background-color: var(--primary-light);
    color: var(--primary);

    display: flex;
    align-items: center;
    justify-content: center;

    margin-bottom: 0.85rem;
}

.financial-card {
    position: relative;
    overflow: hidden;
}

.financial-card::after {
    content: "";

    position: absolute;

    width: 90px;
    height: 90px;

    right: -35px;
    bottom: -35px;

    border-radius: 50%;

    background-color: rgba(82, 183, 136, 0.08);
}

.financial-breakdown {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 0.75rem;
}

.financial-item {
    padding: 0.85rem;

    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);

    background-color: var(--bg-subtle);
}

.financial-item-label {
    display: block;

    color: var(--text-muted);
    font-size: 0.76rem;

    margin-bottom: 0.2rem;
}

.financial-item-value {
    display: block;

    font-size: 1rem;
    font-weight: 700;

    color: var(--text-main);
}


/* ==========================================================================
   12. QUICK ACTIONS
   ========================================================================== */

.quick-actions {
    display: grid;

    grid-template-columns:
        repeat(auto-fit, minmax(150px, 1fr));

    gap: 0.75rem;
}

.quick-action {
    min-height: 90px;

    padding: 1rem;

    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;

    gap: 0.45rem;

    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);

    background-color: var(--bg-card);

    color: var(--text-main);

    cursor: pointer;

    transition: var(--transition);
}

.quick-action:hover {
    border-color: var(--accent);
    background-color: var(--primary-light);

    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.quick-action-icon {
    color: var(--primary);
    font-size: 1.15rem;
}

.quick-action-title {
    font-weight: 650;
    font-size: 0.88rem;
}

.quick-action-description {
    color: var(--text-light);
    font-size: 0.73rem;
}


/* ==========================================================================
   13. BUTTON SYSTEM
   ========================================================================== */

.btn {
    min-height: 40px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    gap: 0.5rem;

    padding: 0.625rem 1.15rem;

    border: 1px solid transparent;
    border-radius: var(--radius-sm);

    font-size: 0.9rem;
    font-weight: 600;

    cursor: pointer;

    transition: var(--transition);

    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--text-white);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-accent {
    background-color: var(--accent);
    color: var(--text-white);
}

.btn-accent:hover {
    background-color: var(--accent-hover);
}

.btn-outline {
    background-color: transparent;
    border-color: var(--border-dark);
    color: var(--text-main);
}

.btn-outline:hover {
    background-color: var(--bg-subtle);
    border-color: var(--accent);
}

.btn-danger {
    background-color: var(--danger);
    color: var(--text-white);
}

.btn-danger:hover {
    background-color: #7f1d1d;
}

.btn-success {
    background-color: var(--success);
    color: var(--text-white);
}

.btn-warning {
    background-color: var(--warning);
    color: var(--text-white);
}

.btn-sm {
    min-height: 34px;
    padding: 0.45rem 0.8rem;
    font-size: 0.8rem;
}

.btn-lg {
    min-height: 46px;
    padding: 0.75rem 1.4rem;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    width: 40px;
    height: 40px;

    padding: 0;

    border-radius: var(--radius-sm);
}

.btn-icon.btn-sm {
    width: 34px;
    height: 34px;
}


/* ==========================================================================
   14. FORMS
   ========================================================================== */

.form-group {
    margin-bottom: 1.2rem;
}

.form-row {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 1rem;
}

.form-label {
    display: block;

    font-size: 0.84rem;
    font-weight: 600;

    color: var(--text-muted);

    margin-bottom: 0.45rem;
}

.form-control {
    width: 100%;

    min-height: 42px;

    padding: 0.7rem 0.8rem;

    font-size: 0.9rem;

    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);

    background-color: var(--bg-card);
    color: var(--text-main);

    transition: var(--transition);
}

.form-control::placeholder {
    color: #a0aec0;
}

.form-control:hover {
    border-color: var(--border-dark);
}

.form-control:focus {
    outline: none;

    border-color: var(--border-focus);

    box-shadow: var(--shadow-focus);
}

.form-control:disabled {
    background-color: var(--bg-subtle);
    cursor: not-allowed;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

select.form-control {
    cursor: pointer;
}

.form-help {
    margin-top: 0.35rem;

    color: var(--text-light);

    font-size: 0.75rem;
}

.form-error {
    margin-top: 0.35rem;

    color: var(--danger);

    font-size: 0.78rem;
}

.required {
    color: var(--danger);
}


/* ==========================================================================
   15. ALERTS / NOTICES
   ========================================================================== */

.alert {
    display: flex;
    align-items: flex-start;

    gap: 0.75rem;

    padding: 0.95rem 1rem;

    border-radius: var(--radius-sm);

    font-size: 0.87rem;

    margin-bottom: 1rem;
}

.alert:last-child {
    margin-bottom: 0;
}

.alert-icon {
    flex: 0 0 auto;
    margin-top: 0.1rem;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 700;
    margin-bottom: 0.15rem;
}

.alert-danger {
    background-color: var(--danger-light);
    color: var(--danger);
    border: 1px solid #feb2b2;
}

.alert-success {
    background-color: var(--success-light);
    color: var(--success);
    border: 1px solid #9ae6b4;
}

.alert-warning {
    background-color: var(--warning-light);
    color: var(--warning);
    border: 1px solid #f6d89b;
}

.alert-info {
    background-color: var(--info-light);
    color: var(--info);
    border: 1px solid #bee3f8;
}

.security-notice {
    display: flex;
    gap: 0.75rem;

    padding: 1rem;

    background-color: var(--bg-subtle);

    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);

    color: var(--text-muted);

    font-size: 0.82rem;
}


/* ==========================================================================
   16. BADGES / STATUS
   ========================================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 0.25rem 0.65rem;

    border-radius: var(--radius-full);

    font-size: 0.7rem;
    font-weight: 700;

    text-transform: uppercase;
    letter-spacing: 0.04em;

    white-space: nowrap;
}

.badge-success {
    background-color: var(--success-light);
    color: var(--success);
}

.badge-warning {
    background-color: var(--warning-light);
    color: var(--warning);
}

.badge-danger {
    background-color: var(--danger-light);
    color: var(--danger);
}

.badge-info {
    background-color: var(--info-light);
    color: var(--info);
}

.badge-neutral {
    background-color: var(--bg-subtle);
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;

    border-radius: 50%;

    display: inline-block;

    margin-right: 0.4rem;
}

.status-dot.success {
    background-color: var(--success);
}

.status-dot.warning {
    background-color: var(--warning);
}

.status-dot.danger {
    background-color: var(--danger);
}


/* ==========================================================================
   17. TABLES
   ========================================================================== */

.table-responsive {
    width: 100%;
    overflow-x: auto;

    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;

    border-collapse: collapse;

    text-align: left;

    font-size: 0.86rem;
}

.table th,
.table td {
    padding: 0.8rem 0.9rem;

    border-bottom: 1px solid var(--border-color);

    vertical-align: middle;
}

.table th {
    background-color: var(--bg-subtle);

    color: var(--text-muted);

    font-weight: 650;

    white-space: nowrap;
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background-color: #f8fafc;
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.table-empty {
    text-align: center;

    padding: 2rem 1rem !important;

    color: var(--text-light);
}


/* ==========================================================================
   18. LOAN UI
   ========================================================================== */

.loan-card {
    position: relative;
}

.loan-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    gap: 1rem;

    margin-bottom: 1rem;
}

.loan-reference {
    color: var(--text-light);
    font-size: 0.75rem;
    margin-top: 0.2rem;
}

.loan-title {
    font-size: 1rem;
    font-weight: 700;
}

.loan-summary {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 0.75rem;

    margin-bottom: 1rem;
}

.loan-summary-item {
    padding: 0.8rem;

    background-color: var(--bg-subtle);

    border-radius: var(--radius-sm);
}

.loan-summary-label {
    display: block;

    color: var(--text-light);

    font-size: 0.72rem;

    margin-bottom: 0.2rem;
}

.loan-summary-value {
    display: block;

    color: var(--text-main);

    font-weight: 700;
}

.loan-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;

    margin-top: 1rem;
}

.loan-progress {
    margin-top: 1rem;
}

.progress-track {
    width: 100%;
    height: 8px;

    overflow: hidden;

    background-color: var(--bg-subtle);

    border-radius: var(--radius-full);
}

.progress-bar {
    height: 100%;

    background-color: var(--accent);

    border-radius: inherit;

    transition: width 0.3s ease;
}

.progress-label {
    display: flex;
    justify-content: space-between;

    margin-bottom: 0.4rem;

    font-size: 0.75rem;
    color: var(--text-muted);
}

.eligibility-card {
    border-left: 4px solid var(--accent);
}

.eligibility-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.eligibility-icon {
    width: 40px;
    height: 40px;

    border-radius: 50%;

    background-color: var(--primary-light);
    color: var(--primary);

    display: flex;
    align-items: center;
    justify-content: center;
}


/* ==========================================================================
   19. GUARANTORS
   ========================================================================== */

.guarantor-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.guarantor-item {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 1rem;

    padding: 0.9rem;

    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);

    background-color: var(--bg-card);
}

.guarantor-info {
    min-width: 0;
}

.guarantor-name {
    font-weight: 650;
}

.guarantor-meta {
    margin-top: 0.15rem;

    color: var(--text-light);

    font-size: 0.75rem;
}

.guarantor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}


/* ==========================================================================
   20. PAYMENT UI
   ========================================================================== */

.payment-card {
    border-left: 4px solid var(--accent);
}

.payment-summary {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 0.75rem;
}

.payment-methods {
    display: grid;

    grid-template-columns:
        repeat(auto-fit, minmax(130px, 1fr));

    gap: 0.65rem;
}

.payment-method {
    padding: 0.8rem;

    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);

    background-color: var(--bg-card);

    cursor: pointer;

    transition: var(--transition);
}

.payment-method:hover {
    border-color: var(--accent);
}

.payment-method.selected {
    border-color: var(--accent);

    background-color: var(--primary-light);
}

.payment-method-title {
    font-size: 0.82rem;
    font-weight: 650;
}

.payment-method-description {
    margin-top: 0.2rem;

    color: var(--text-light);

    font-size: 0.7rem;
}

.payment-reference {
    font-family:
        ui-monospace,
        SFMono-Regular,
        Menlo,
        Monaco,
        Consolas,
        monospace;

    font-size: 0.82rem;
}


/* ==========================================================================
   21. TABS
   ========================================================================== */

.tabs {
    display: flex;

    gap: 0.25rem;

    overflow-x: auto;

    border-bottom: 1px solid var(--border-color);

    margin-bottom: 1.25rem;
}

.tab-button {
    padding: 0.7rem 1rem;

    background: transparent;

    color: var(--text-muted);

    border-bottom: 2px solid transparent;

    font-size: 0.85rem;
    font-weight: 600;

    cursor: pointer;

    white-space: nowrap;

    transition: var(--transition);
}

.tab-button:hover {
    color: var(--primary);
}

.tab-button.active {
    color: var(--primary);
    border-bottom-color: var(--accent);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}


/* ==========================================================================
   22. PROFILE / ACCOUNT
   ========================================================================== */

.profile-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 1rem;
}

.profile-item {
    padding: 0.85rem;

    border: 1px solid var(--border-color);

    border-radius: var(--radius-sm);

    background-color: var(--bg-subtle);
}

.profile-label {
    display: block;

    color: var(--text-light);

    font-size: 0.74rem;

    margin-bottom: 0.25rem;
}

.profile-value {
    display: block;

    color: var(--text-main);

    font-size: 0.9rem;

    font-weight: 600;

    overflow-wrap: anywhere;
}

.profile-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;

    margin-top: 1rem;
}


/* ==========================================================================
   23. ACTIVITY / HISTORY
   ========================================================================== */

.activity-list {
    display: flex;
    flex-direction: column;
}

.activity-item {
    display: flex;

    gap: 0.85rem;

    padding: 0.9rem 0;

    border-bottom: 1px solid var(--border-color);
}

.activity-item:first-child {
    padding-top: 0;
}

.activity-item:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.activity-icon {
    width: 34px;
    height: 34px;

    min-width: 34px;

    border-radius: 50%;

    background-color: var(--primary-light);
    color: var(--primary);

    display: flex;
    align-items: center;
    justify-content: center;
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-title {
    font-size: 0.84rem;
    font-weight: 650;
}

.activity-description {
    margin-top: 0.15rem;

    color: var(--text-muted);

    font-size: 0.76rem;
}

.activity-time {
    margin-top: 0.2rem;

    color: var(--text-light);

    font-size: 0.7rem;
}


/* ==========================================================================
   24. NOTIFICATIONS
   ========================================================================== */

.notification-list {
    display: flex;
    flex-direction: column;
}

.notification-item {
    display: flex;

    gap: 0.75rem;

    padding: 1rem;

    border-bottom: 1px solid var(--border-color);

    cursor: pointer;

    transition: var(--transition);
}

.notification-item:hover {
    background-color: var(--bg-subtle);
}

.notification-item:last-child {
    border-bottom: 0;
}

.notification-item.unread {
    background-color: #f7fcf9;
}

.notification-dot {
    width: 9px;
    height: 9px;

    min-width: 9px;

    margin-top: 0.35rem;

    border-radius: 50%;

    background-color: var(--accent);
}

.notification-item.read .notification-dot {
    background-color: var(--border-dark);
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-size: 0.85rem;
    font-weight: 650;
}

.notification-message {
    margin-top: 0.2rem;

    color: var(--text-muted);

    font-size: 0.77rem;

    overflow-wrap: anywhere;
}

.notification-time {
    margin-top: 0.3rem;

    color: var(--text-light);

    font-size: 0.7rem;
}

.notification-badge {
    min-width: 20px;
    height: 20px;

    padding: 0 0.35rem;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border-radius: var(--radius-full);

    background-color: var(--danger);
    color: #ffffff;

    font-size: 0.65rem;
    font-weight: 700;
}


/* ==========================================================================
   25. EMPTY / LOADING STATES
   ========================================================================== */

.empty-state {
    padding: 2.5rem 1rem;

    text-align: center;

    color: var(--text-light);
}

.empty-state-icon {
    font-size: 2rem;

    margin-bottom: 0.75rem;

    color: var(--border-dark);
}

.empty-state-title {
    color: var(--text-muted);

    font-size: 0.95rem;
    font-weight: 650;

    margin-bottom: 0.25rem;
}

.empty-state-description {
    max-width: 420px;

    margin: 0 auto;

    font-size: 0.78rem;
}

.loading-state {
    padding: 2rem 1rem;

    text-align: center;

    color: var(--text-light);
}

.spinner {
    width: 28px;
    height: 28px;

    margin: 0 auto 0.75rem;

    border: 3px solid var(--border-color);
    border-top-color: var(--accent);

    border-radius: 50%;

    animation: frenzon-spin 0.8s linear infinite;
}

@keyframes frenzon-spin {
    to {
        transform: rotate(360deg);
    }
}


/* ==========================================================================
   26. MODALS
   ========================================================================== */

.modal {
    position: fixed;

    inset: 0;

    z-index: 500;

    display: none;

    align-items: center;
    justify-content: center;

    padding: 1rem;

    background-color: rgba(8, 28, 21, 0.48);

    overflow-y: auto;
}

.modal.open,
.modal.active {
    display: flex;
}

.modal-dialog {
    width: 100%;
    max-width: 520px;

    background-color: var(--bg-card);

    border: 1px solid var(--border-color);

    border-radius: var(--radius-lg);

    box-shadow: var(--shadow-lg);

    overflow: hidden;
}

.modal-dialog.modal-lg {
    max-width: 760px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 1rem;

    padding: 1.25rem 1.5rem;

    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 1.05rem;
    font-weight: 700;
}

.modal-close {
    width: 34px;
    height: 34px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border-radius: var(--radius-sm);

    background: transparent;

    color: var(--text-muted);

    cursor: pointer;

    font-size: 1.1rem;
}

.modal-close:hover {
    background-color: var(--bg-subtle);
    color: var(--text-main);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;

    gap: 0.5rem;

    padding: 1rem 1.5rem;

    border-top: 1px solid var(--border-color);
}


/* ==========================================================================
   27. EXECUTIVE ACCESS
   ========================================================================== */

.executive-access {
    border: 1px solid var(--border-color);

    border-radius: var(--radius-md);

    padding: 1.25rem;

    background:
        linear-gradient(
            135deg,
            #ffffff 0%,
            #f2f8f5 100%
        );
}

.executive-access-header {
    display: flex;

    align-items: center;

    gap: 0.75rem;

    margin-bottom: 0.75rem;
}

.executive-access-icon {
    width: 42px;
    height: 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: var(--radius-md);

    background-color: var(--primary-light);

    color: var(--primary);
}

.executive-access-title {
    font-weight: 700;
}

.executive-access-description {
    color: var(--text-muted);

    font-size: 0.8rem;

    margin-bottom: 1rem;
}


/* ==========================================================================
   28. ROUTE / VIEW MANAGEMENT
   ========================================================================== */

.route {
    display: none;
}

.route.active {
    display: block;
}

.view {
    display: none;
}

.view.active {
    display: block;
}


/* ==========================================================================
   29. MOBILE NAVIGATION
   ========================================================================== */

.mobile-menu-button {
    display: none;

    width: 40px;
    height: 40px;

    align-items: center;
    justify-content: center;

    border-radius: var(--radius-sm);

    background-color: transparent;

    color: var(--text-muted);

    cursor: pointer;
}

.mobile-menu-button:hover {
    background-color: var(--bg-subtle);
}

.sidebar-overlay {
    display: none;

    position: fixed;

    inset: 0;

    z-index: 95;

    background-color: rgba(0, 0, 0, 0.35);
}

.bottom-nav {
    display: none;
}


/* ==========================================================================
   30. RESPONSIVE — TABLET
   ========================================================================== */

@media (max-width: 1100px) {
    .grid-4 {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .grid-3 {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .content-body {
        padding: 1.5rem;
    }
}


/* ==========================================================================
   31. RESPONSIVE — MOBILE
   ========================================================================== */

@media (max-width: 768px) {
    :root {
        --sidebar-width: 260px;
        --topbar-height: 62px;
    }

    .sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar.open + .sidebar-overlay {
        display: block;
    }

    .main-content {
        margin-left: 0;

        padding-bottom: 70px;
    }

    .mobile-menu-button {
        display: inline-flex;
    }

    .topbar {
        padding: 0 1rem;
    }

    .topbar-member {
        display: none;
    }

    .content-body {
        padding: 1rem;
    }

    .page-title {
        font-size: 1.35rem;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;

        gap: 1rem;

        margin-bottom: 1rem;
    }

    .card {
        padding: 1.15rem;

        margin-bottom: 1rem;
    }

    .stat-value {
        font-size: 1.4rem;
    }

    .form-row,
    .profile-grid {
        grid-template-columns: 1fr;
    }

    .loan-summary,
    .payment-summary {
        grid-template-columns: 1fr;
    }

    .financial-breakdown {
        grid-template-columns: 1fr;
    }

    .card-header {
        align-items: flex-start;

        flex-direction: column;
    }

    .card-actions {
        width: 100%;
    }

    .card-actions .btn {
        flex: 1;
    }

    .loan-header {
        flex-direction: column;
    }

    .guarantor-item {
        align-items: flex-start;

        flex-direction: column;
    }

    .guarantor-actions {
        width: 100%;
    }

    .guarantor-actions .btn {
        flex: 1;
    }

    .modal {
        align-items: flex-end;

        padding: 0;
    }

    .modal-dialog {
        max-width: none;

        border-radius:
            var(--radius-lg)
            var(--radius-lg)
            0
            0;

        max-height: 92vh;

        overflow-y: auto;
    }

    .auth-card {
        padding: 1.75rem;
    }

    .bottom-nav {
        position: fixed;

        left: 0;
        right: 0;
        bottom: 0;

        height: 64px;

        z-index: 120;

        background-color: var(--bg-card);

        border-top: 1px solid var(--border-color);

        display: grid;

        grid-template-columns:
            repeat(4, 1fr);

        box-shadow:
            0 -2px 8px rgba(0, 0, 0, 0.06);
    }

    .bottom-nav-item {
        display: flex;

        flex-direction: column;

        align-items: center;
        justify-content: center;

        gap: 0.2rem;

        background: transparent;

        color: var(--text-light);

        font-size: 0.65rem;

        cursor: pointer;
    }

    .bottom-nav-item.active {
        color: var(--primary);
    }

    .bottom-nav-icon {
        font-size: 1rem;
    }
}


/* ==========================================================================
   32. RESPONSIVE — SMALL PHONES
   ========================================================================== */

@media (max-width: 480px) {
    .content-body {
        padding: 0.75rem;
    }

    .topbar {
        padding: 0 0.75rem;
    }

    .topbar-title {
        font-size: 1rem;
    }

    .card {
        padding: 1rem;
    }

    .auth-wrapper {
        padding: 0.75rem;
    }

    .auth-card {
        padding: 1.35rem;
    }

    .btn {
        width: 100%;
    }

    .btn-icon {
        width: 40px !important;
    }

    .card-actions {
        flex-direction: column;
    }

    .card-actions .btn {
        width: 100%;
    }

    .loan-actions {
        flex-direction: column;
    }

    .loan-actions .btn {
        width: 100%;
    }

    .profile-actions {
        flex-direction: column;
    }

    .profile-actions .btn {
        width: 100%;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .modal-footer {
        flex-direction: column-reverse;
    }

    .modal-footer .btn {
        width: 100%;
    }

    .table {
        font-size: 0.78rem;
    }

    .table th,
    .table td {
        padding: 0.65rem;
    }
}


/* ==========================================================================
   33. REDUCED MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;

        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;

        transition-duration: 0.01ms !important;
    }
}


/* ==========================================================================
   34. DARK MODE SAFETY
   ========================================================================== */

/*
 * The Member Portal currently uses the defined light design system.
 * Do not automatically invert colors based on the device preference,
 * because doing so could reduce consistency with the approved portal UI.
 */


/* ==========================================================================
   35. PRINT
   ========================================================================== */

@media print {
    .sidebar,
    .topbar,
    .bottom-nav,
    .mobile-menu-button,
    .btn,
    .modal {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
    }

    .content-body {
        max-width: none;
        padding: 0;
    }

    .card {
        box-shadow: none;
        break-inside: avoid;
    }
}