﻿:root {
    --bg: #0F172A;
    --card: #1E293B;
    --card-hover: #334155;
    --text: #F8FAFC;
    --text-light: #94A3B8;
    --primary: #06B6D4;
    --primary-glow: rgba(6, 182, 212, 0.2);
    --secondary: #14B8A6;
    --accent: #8B5CF6;
    --danger: #F43F5E;
    --success: #10B981;
    --warning: #F59E0B;
    --border: #334155;
}

* {
    margin: 0.5px;
    padding: 0.5px;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    padding-bottom: calc(90px + env(safe-area-inset-bottom, 0px));
}

body.theme-light {
    --bg: #f8fafc;
    --card: #ffffff;
    --card-hover: #e2e8f0;
    --text: #0f172a;
    --text-light: #475569;
    --primary: #0284c7;
    --primary-glow: rgba(2, 132, 199, 0.16);
    --secondary: #0f766e;
    --accent: #7c3aed;
    --danger: #dc2626;
    --success: #059669;
    --warning: #d97706;
    --border: #cbd5e1;
    background:
        radial-gradient(circle at 18% 0%, rgba(2, 132, 199, 0.08), transparent 32%),
        #f8fafc;
    color: var(--text);
}

.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 0.5rem;
}

.flex-1 {
    flex: 1;
}

.w-full {
    width: 100%;
}

.p-4 {
    padding: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-sm {
    font-size: 0.875rem;
}

.text-lg {
    font-size: 1.125rem;
}

.text-xl {
    font-size: 1.25rem;
}

.text-2xl {
    font-size: 1.5rem;
}

.font-bold {
    font-weight: 700;
}

.text-primary {
    color: var(--primary);
}

.text-secondary {
    color: var(--secondary);
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

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

.text-light {
    color: var(--text-light);
}

.btn {
    padding: 14px 24px;
    border-radius: 12px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

    .btn:active {
        transform: scale(0.96);
    }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-success {
    background-color: var(--success);
    color: white;
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-warning {
    background-color: var(--warning);
    color: white;
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--border);
    color: var(--text);
}

.btn-small {
    padding: 8px 12px;
    font-size: 0.875rem;
    width: auto;
}

.input-group {
    margin-bottom: 1.2rem;
}

    .input-group label {
        display: block;
        margin-bottom: 0.5rem;
        font-weight: 500;
        font-size: 0.9rem;
        color: var(--text-light);
    }

    .input-group input, .input-group select, .input-group textarea {
        width: 100%;
        padding: 14px;
        border: 1px solid var(--border);
        border-radius: 12px;
        font-size: 1rem;
        background: var(--bg);
        color: var(--text);
        font-family: inherit;
    }

    .input-group textarea {
        min-height: 80px;
        resize: vertical;
    }

        .input-group input:focus, .input-group textarea:focus, .input-group select:focus {
            outline: none;
            border-color: var(--primary);
            box-shadow: 0 0 0 3px var(--primary-glow);
        }

    .input-group input:read-only {
        background: var(--card-hover);
        color: var(--text-light);
        cursor: not-allowed;
    }

.card {
    background: var(--card);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--border);
    margin-bottom: 1rem;
}

.card-gradient {
    background: linear-gradient(135deg, var(--card) 0%, #1e293b 100%);
    border: 1px solid rgba(6, 182, 212, 0.2);
}

body.theme-light .card-gradient {
    background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
    border-color: rgba(2, 132, 199, 0.2);
}

.app-header {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    color: white;
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border);
}

.app-brand-logo {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    box-shadow: 0 10px 26px var(--primary-glow);
    text-decoration: none;
}

.app-brand-logo i {
    font-size: 1.45rem;
    line-height: 1;
}

.app-brand-logo:hover {
    color: #ffffff;
    transform: translateY(-1px);
}

body.theme-light .app-header {
    background: rgba(255, 255, 255, 0.94);
    color: var(--text);
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-around;
    padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border);
    z-index: 100;
}

body.theme-light .bottom-nav {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 -10px 28px rgba(15, 23, 42, 0.08);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-light);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    transition: all .2s ease;
    -webkit-tap-highlight-color: rgba(59, 130, 246, 0.2);
}

.nav-item:active {
    transform: scale(0.95);
    background: rgba(59, 130, 246, 0.12);
}

.list-item {
    background: var(--card);
    padding: 1.2rem;
    border-radius: 14px;
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 2px solid rgba(59, 130, 246, 0.25); /* Always visible */
    cursor: pointer;
    transition: all .2s ease;
    position: relative;
}


.list-item:active {
    transform: scale(0.98);
    background: rgba(59, 130, 246, 0.08);
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-block;
}

.badge-paid {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-unpaid {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-overdue {
    background: rgba(244, 63, 94, 0.2);
    color: var(--danger);
    border: 1px solid rgba(244, 63, 94, 0.3);
}

.badge-clear {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-owes {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-screen {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at top, #1e293b 0%, #0f172a 100%);
    overflow: hidden;
}



.login-card {
    background: var(--card);
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border);
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    border-radius: 24px;
    margin: auto;
}

.logo-large {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 15px var(--primary-glow));
}

.progress-bg {
    width: 100%;
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 4px;
    transition: width 0.5s ease;
}

.loan-card {
    background: var(--card);
    border-radius: 14px;
    padding: 1.2rem;
    border: 1px solid var(--border);
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: 0.2s;
}

    .loan-card:active {
        transform: scale(0.98);
        border-color: var(--primary);
    }

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.section-heading > div {
    min-width: 0;
}

.section-heading p {
    margin-top: 4px;
}

.section-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
}

.section-link:hover {
    color: var(--secondary);
}

.dashboard-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 18px;
}

.dashboard-action {
    width: auto;
    min-width: 132px;
}

.analytics-panel {
    margin-bottom: 12px;
}

.analytics-panel > summary {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 15px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.analytics-panel > summary::-webkit-details-marker {
    display: none;
}

.analytics-panel > summary span {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.analytics-panel > summary strong {
    color: var(--text);
    font-size: 0.98rem;
    line-height: 1.25;
}

.analytics-panel > summary small {
    color: var(--text-light);
    font-size: 0.78rem;
    line-height: 1.35;
}

.analytics-panel > summary i {
    color: var(--text-light);
    flex: 0 0 auto;
    transition: transform .2s ease;
}

.analytics-panel[open] > summary {
    margin-bottom: 10px;
    border-color: rgba(6, 182, 212, 0.36);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

.analytics-panel[open] > summary i {
    transform: rotate(180deg);
}

.analytics-panel.dashboard-repeat > summary {
    border-style: dashed;
    opacity: 0.92;
}

.loan-list-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.loan-list-header > div:first-child {
    min-width: 0;
}

.loan-list-header p {
    margin: 4px 0 0;
}

.loan-filter-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    overflow-x: auto;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(148, 163, 184, 0.08);
    -webkit-overflow-scrolling: touch;
}

.loan-filter-btn {
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-light);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 38px;
    padding: 8px 12px;
    white-space: nowrap;
    font-size: 0.86rem;
    font-weight: 800;
}

.loan-filter-btn span {
    min-width: 22px;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.16);
    color: var(--text);
    font-size: 0.72rem;
}

.loan-filter-btn.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 8px 20px var(--primary-glow);
}

.loan-filter-btn.active span {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}

.legal-page {
    width: min(920px, calc(100% - 28px));
    margin: 22px auto 120px;
}

.legal-hero {
    margin-bottom: 16px;
}

.legal-hero h1 {
    color: var(--text);
    font-size: 1.85rem;
    line-height: 1.15;
    margin: 16px 0 6px;
}

.legal-hero p {
    color: var(--text-light);
    margin: 0;
}

.legal-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    color: var(--text-light);
    line-height: 1.62;
}

.legal-card h2 {
    color: var(--text);
    font-size: 1.08rem;
    margin: 24px 0 8px;
}

.legal-card h2:first-child {
    margin-top: 0;
}

.legal-card p {
    margin: 0 0 12px;
}

.legal-card ul {
    margin: 0 0 14px 20px;
    padding: 0;
}

.legal-card li {
    margin-bottom: 8px;
}

.admin-nav-link {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--card);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 800;
    text-decoration: none;
}

.admin-nav-link:active {
    transform: scale(0.96);
}

.admin-page {
    max-width: 980px;
    margin: 0 auto;
}

.admin-heading {
    margin-bottom: 16px;
}

.eyebrow {
    color: var(--primary);
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 800;
    margin-bottom: 6px;
    text-transform: uppercase;
}

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

.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.admin-stat {
    min-height: 88px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.admin-stat span,
.admin-user-summary p,
.admin-toggle-row small {
    color: var(--text-light);
}

.admin-stat strong {
    color: var(--text);
    display: block;
    font-size: 1.65rem;
    line-height: 1.1;
    margin-top: 8px;
}

.admin-users {
    display: grid;
    gap: 12px;
}

.admin-user-card {
    display: grid;
    gap: 14px;
    padding: 0 !important;
    overflow: hidden;
}

.admin-user-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    list-style: none;
    min-height: 78px;
    padding: 16px;
    -webkit-tap-highlight-color: rgba(6, 182, 212, 0.16);
}

.admin-user-summary::-webkit-details-marker {
    display: none;
}

.admin-user-summary > div {
    min-width: 0;
}

.admin-user-summary i {
    color: var(--text-light);
    flex: 0 0 auto;
    transition: transform .2s ease;
}

.admin-user-card[open] .admin-user-summary i {
    transform: rotate(180deg);
}

.admin-user-expanded {
    border-top: 1px solid var(--border);
    display: grid;
    gap: 14px;
    padding: 16px;
}

.admin-user-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.admin-user-summary h2 {
    color: var(--text);
    font-size: 1.05rem;
    margin: 0 0 4px;
}

.admin-user-summary p {
    margin: 0;
    overflow-wrap: anywhere;
}

.admin-user-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.admin-user-metrics span {
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-light);
    padding: 10px;
}

.admin-user-metrics strong {
    color: var(--text);
    display: block;
    font-size: 0.98rem;
    overflow-wrap: anywhere;
}

.admin-lock-note {
    align-items: flex-start;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.28);
    border-radius: 12px;
    color: var(--text);
    display: flex;
    gap: 8px;
    padding: 12px;
}

.admin-access-form {
    display: grid;
    gap: 12px;
}

.admin-tool-panel {
    background: rgba(148, 163, 184, 0.07);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
}

.admin-advanced {
    display: grid;
    gap: 12px;
}

.admin-tool-panel h3 {
    align-items: center;
    color: var(--text);
    display: flex;
    font-size: 0.95rem;
    gap: 8px;
    margin: 0;
}

.admin-danger-form {
    border: 1px solid rgba(244, 63, 94, 0.28);
    border-radius: 12px;
    display: grid;
    gap: 12px;
    padding: 12px;
}

.admin-lock-warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.28);
}

.admin-toggle-row {
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 12px;
}

.admin-toggle-row small {
    display: block;
    font-size: 0.8rem;
    margin-top: 3px;
}

.settings-field {
    display: grid;
    gap: 7px;
}

.settings-field span {
    color: var(--text);
    font-weight: 800;
}

.settings-field input,
.settings-field textarea {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    min-height: 44px;
    padding: 10px 12px;
    width: 100%;
}

.settings-field textarea {
    resize: vertical;
}

.access-required-card {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 30px auto;
    max-width: 560px;
    text-align: center;
}

.access-overlay-page {
    min-height: calc(100vh - 150px);
    padding: 18px 16px 110px;
    position: relative;
}

.access-blur-background {
    filter: blur(7px);
    opacity: 0.48;
    pointer-events: none;
    transform: scale(0.98);
}

.access-preview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.access-lock-overlay {
    align-items: center;
    background: rgba(15, 23, 42, 0.88);
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    gap: 13px;
    left: 50%;
    max-width: 540px;
    padding: 22px;
    position: fixed;
    text-align: center;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(calc(100% - 28px), 540px);
    z-index: 140;
}

.access-lock-overlay h1 {
    color: #ffffff;
    font-size: 1.45rem;
    line-height: 1.18;
    margin: 0;
}

.access-lock-overlay p {
    color: #cbd5e1;
    line-height: 1.5;
    margin: 0;
}

.access-lock-overlay .access-required-hint {
    color: #fde68a;
}

.access-required-icon {
    align-items: center;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.28);
    border-radius: 18px;
    color: var(--warning);
    display: inline-flex;
    font-size: 1.6rem;
    height: 58px;
    justify-content: center;
    width: 58px;
}

.access-required-card h1 {
    color: var(--text);
    font-size: 1.5rem;
    margin: 0;
}

.access-required-card p {
    color: var(--text-light);
    line-height: 1.5;
    margin: 0;
}

.access-required-hint {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.28);
    border-radius: 12px;
    padding: 12px;
    text-align: left;
}

.access-required-actions {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.analytics-split {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 10px;
}

.metric-card {
    min-height: 112px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
}

.metric-card.compact {
    min-height: 88px;
}

.metric-label {
    color: var(--text-light);
    font-size: 0.84rem;
    font-weight: 700;
}

.metric-card strong {
    color: var(--text);
    font-size: 1.45rem;
    line-height: 1.1;
}

.collection-card {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 150px;
}

.collection-loan-card {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 16px;
    align-items: center;
}

.collection-loan-main {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.collection-loan-main h3,
.collection-loan-main p,
.collection-loan-room p {
    margin: 0;
}

.collection-loan-room {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-left: 16px;
    border-left: 1px solid var(--border);
}

.collection-loan-room strong {
    color: var(--text);
    font-size: 1.65rem;
    line-height: 1;
}

.collection-card h3,
.loan-room-card p,
.chart-card p {
    margin: 0;
}

.rate-ring {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    background: conic-gradient(var(--success) calc(var(--value) * 1%), rgba(148, 163, 184, 0.2) 0);
    position: relative;
}

.rate-ring::after {
    content: "";
    position: absolute;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: var(--card);
}

.rate-ring span {
    position: relative;
    z-index: 1;
    color: var(--text);
    font-size: 1.15rem;
    font-weight: 800;
}

.loan-room-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    min-height: 150px;
}

.loan-room-card strong {
    color: var(--text);
    font-size: 1.85rem;
    line-height: 1;
}

.chart-card {
    overflow: hidden;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
    color: var(--text-light);
    font-size: 0.82rem;
    font-weight: 700;
}

.chart-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
}

.legend-dot.loaned,
.bar-loaned {
    background: var(--primary);
}

.legend-dot.collected,
.bar-collected {
    background: var(--success);
}

.legend-dot.profit,
.bar-profit {
    background: var(--accent);
}

.legend-dot.due,
.bar-due {
    background: var(--warning);
}

.monthly-chart {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.month-row {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
}

.month-label {
    color: var(--text);
    font-weight: 800;
    font-size: 0.9rem;
    line-height: 1.4;
}

.month-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.bar-line {
    display: grid;
    grid-template-columns: 70px minmax(56px, 1fr) minmax(72px, auto);
    gap: 8px;
    align-items: center;
    min-width: 0;
}

.bar-line span,
.bar-line strong {
    color: var(--text-light);
    font-size: 0.76rem;
    line-height: 1.2;
}

.bar-line strong {
    text-align: right;
    white-space: nowrap;
}

.bar-track {
    width: 100%;
    height: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.18);
}

.bar-fill {
    display: block;
    height: 100%;
    min-width: 3px;
    border-radius: inherit;
}

.guidance-card h3 {
    margin: 0 0 14px;
}

.guidance-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 0;
    border-top: 1px solid var(--border);
    color: var(--text-light);
    line-height: 1.45;
}

.guidance-item:first-of-type {
    border-top: none;
    padding-top: 0;
}

.guidance-item i {
    color: var(--warning);
    margin-top: 2px;
}

@media (max-width: 420px) {
    .analytics-grid,
    .analytics-split {
        grid-template-columns: 1fr;
    }

    .dashboard-action {
        width: 100%;
    }

    .collection-card {
        align-items: flex-start;
    }

    .collection-loan-card {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .collection-loan-main {
        align-items: flex-start;
    }

    .collection-loan-room {
        padding-left: 0;
        padding-top: 14px;
        border-left: 0;
        border-top: 1px solid var(--border);
    }

    .collection-loan-room strong {
        font-size: 1.45rem;
    }

    .bar-line {
        grid-template-columns: 58px minmax(52px, 1fr) minmax(60px, auto);
        gap: 6px;
    }

    .bar-line span,
    .bar-line strong {
        font-size: 0.72rem;
    }

    .access-overlay-page {
        padding-inline: 10px;
    }

    .access-preview-grid {
        grid-template-columns: 1fr;
    }

    .access-lock-overlay {
        max-height: calc(100vh - 128px);
        overflow-y: auto;
        padding: 18px;
    }
}

@media (max-width: 520px) {
    .p-4 {
        padding: 0.8rem;
    }

    .app-header {
        padding: 0.75rem 0.85rem;
    }

    .app-brand-logo {
        width: 40px;
        height: 40px;
        border-radius: 12px;
    }

    .card,
    .loan-card,
    .list-item,
    .clickable-card {
        padding: 1rem !important;
        border-radius: 12px;
    }

    .beneficiary-card,
    .list-item {
        align-items: flex-start !important;
        gap: 12px;
    }

    .beneficiary-card {
        flex-wrap: wrap;
    }

    .section-heading,
    .loan-list-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .section-link {
        align-self: flex-start;
    }

    .loan-filter-tabs {
        width: 100%;
    }

    .loan-filter-btn {
        flex: 1 0 auto;
    }

    .bottom-nav {
        justify-content: space-between;
        overflow-x: auto;
        gap: 2px;
    }

    .nav-item {
        min-width: 66px;
        padding: 0.45rem 0.5rem;
    }

    .legal-page {
        width: min(100% - 18px, 430px);
        margin-top: 14px;
    }

    .legal-hero h1 {
        font-size: 1.55rem;
    }

    .legal-card {
        padding: 18px;
        border-radius: 14px;
        line-height: 1.55;
    }

    .admin-nav-link span {
        display: none;
    }

    .admin-nav-link {
        min-width: 42px;
        justify-content: center;
        padding: 0 10px;
    }

    .admin-stats,
    .admin-user-metrics,
    .access-required-actions {
        grid-template-columns: 1fr;
    }

    .admin-toggle-row {
        align-items: flex-start;
    }

    .modal-content {
        max-height: calc(100vh - 32px);
    }
}

/* Toast Notification */
.toast-container {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 90%;
    max-width: 400px;
    pointer-events: none;
}

.toast {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    animation: slideDown 0.3s ease;
    pointer-events: auto;
}

.toast-undo {
    background: var(--primary);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.app-notification {
    width: min(1120px, calc(100% - 32px));
    margin: 14px auto;
    padding: 13px 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border);
    font-weight: 600;
}

.app-notification-success {
    background: rgba(16, 185, 129, .12);
    border-color: rgba(16, 185, 129, .35);
    color: #34d399;
}

.app-notification-error {
    background: rgba(244, 63, 94, .12);
    border-color: rgba(244, 63, 94, .35);
    color: #fb7185;
}

.app-notification-warning {
    background: rgba(245, 158, 11, .12);
    border-color: rgba(245, 158, 11, .35);
    color: #fbbf24;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 150;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: var(--card);
    border-radius: 20px;
    padding: 1.5rem;
    width: 100%;
    max-width: 450px;
    max-height: 85vh;
    overflow-y: auto;
    border: 1px solid var(--border);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.5rem;
    cursor: pointer;
}

.description-box {
    background: rgba(6, 182, 212, 0.05);
    border-left: 3px solid var(--primary);
    padding: 12px;
    border-radius: 0 8px 8px 0;
    margin-top: 8px;
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.5;
}

.action-btns {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

    .action-btns .btn {
        flex: 1;
        padding: 10px;
        font-size: 0.85rem;
    }

a {
    color: var(--text-light);
    text-decoration: none;
    transition: 0.2s;
}

    a:hover {
        color: var(--primary);
    }

.profile-link {
    text-decoration: none;
    color: white;
    display: inline-flex;
    align-items: center;
}

.logout-icon-btn {
    width: 42px;
    height: 42px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.logout-icon-btn:active {
    transform: scale(0.95);
}

.profile-circle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: #0d6efd; /* blue */
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 19px;
    font-weight: bold;
}

#addLoanTitle {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    margin-bottom: 16px;
    font-weight: bold;
    color: #ffffff;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
}

    #addLoanTitle .icon {
        margin-right: 8px;
        color: #38bdf8; /* light blue like Bootstrap info */
        font-size: 18px;
    }

input, select, textarea {
    font-size: 16px;
}

html {
    -webkit-text-size-adjust: 100%;
}

input[type="date"] {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    -webkit-appearance: none; /* helps normalize rendering */
}

.action-btns {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
    justify-content: flex-end; /* ✔ THIS pushes everything to the right */
}

.left-a {
    display: flex;
    justify-content: flex-start; /* ✔ pushes everything to right */
    display: inline;
}

.header-actions {
    display: flex;
    justify-content: flex-end; /* ✔ pushes everything to right */
    margin-bottom: 10px;

}

.action-menu {
    position: relative;
    display: inline;
}

.menu-btn {
    background: #1f2937;
    color: white;
    padding: 10px 14px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.menu-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 110%;
    background: lightblue; /* dark background */
    min-width: 200px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
    border-radius: 10px;
    overflow: hidden;
    z-index: 999;
    border: 1px solid #1f2937;
}

    .menu-dropdown a,
    .menu-dropdown button {
        display: block;
        width: 100%;
        padding: 10px 12px;
        text-align: left;
        border: none;
        background: none;
        cursor: pointer;
        text-decoration: none;
        color: #111;
        font-size: 14px;
    }

        .menu-dropdown a:hover,
        .menu-dropdown button:hover {
            background: #f3f4f6;
        }

body.theme-light .card,
body.theme-light .loan-card,
body.theme-light .list-item,
body.theme-light .analytics-panel > summary,
body.theme-light .settings-sidebar,
body.theme-light .settings-panel {
    background: var(--card);
    border-color: var(--border);
    color: var(--text);
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
}

body.theme-light .rate-ring::after {
    background: var(--card);
}

body.theme-light .bar-track {
    background: #e2e8f0;
}

body.theme-light .settings-sidebar a {
    color: var(--text-light);
}

body.theme-light .settings-sidebar a:hover {
    background: #e2e8f0;
    color: var(--text);
}

body.theme-light .settings-sidebar a.active {
    background: rgba(2, 132, 199, 0.1);
    border-color: rgba(2, 132, 199, 0.28);
    color: var(--primary);
}

body.theme-light .settings-item {
    background: #f8fafc;
    border-color: var(--border);
    color: var(--text);
}

body.theme-light .admin-tool-panel {
    background: #f8fafc;
}

body.theme-light a.settings-item:hover {
    background: #f1f5f9;
    color: var(--text);
    border-color: rgba(2, 132, 199, 0.35);
}

body.theme-light .settings-item-icon {
    color: var(--primary);
    background: rgba(2, 132, 199, 0.1);
}

body.theme-light .settings-content .form-control,
body.theme-light .settings-content .input-group input,
body.theme-light .settings-content .input-group select,
body.theme-light .settings-content .input-group textarea,
body.theme-light .settings-field input,
body.theme-light .settings-field select,
body.theme-light .settings-field textarea,
body.theme-light .input-group input,
body.theme-light .input-group select,
body.theme-light .input-group textarea {
    background: #ffffff;
    color: var(--text);
    border-color: var(--border);
}

body.theme-light .settings-content .form-control:disabled,
body.theme-light .settings-content .form-control:read-only,
body.theme-light .settings-field input:disabled,
body.theme-light .settings-field input:read-only,
body.theme-light .input-group input:read-only {
    background: #e2e8f0;
    color: var(--text-light);
}

body.theme-light .clickable-card {
    background: #ffffff;
    color: var(--text);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
}

body.theme-light .beneficiary-card {
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    border-color: var(--border);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

body.theme-light .beneficiary-info h3,
body.theme-light .info-box strong,
body.theme-light #addLoanTitle {
    color: var(--text);
}

body.theme-light .beneficiary-info p,
body.theme-light .info-box small {
    color: var(--text-light);
}

body.theme-light .info-box {
    background: #f8fafc;
    border-color: var(--border);
}

body.theme-light .profile-link {
    color: var(--text);
}

body.theme-light .logout-icon-btn {
    color: var(--text);
    background: #f8fafc;
    border-color: var(--border);
}

body.theme-light .menu-btn {
    background: #ffffff;
    color: var(--text);
    border: 1px solid var(--border);
}

body.theme-light .menu-dropdown {
    background: #ffffff;
    border-color: var(--border);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.14);
}

.settings-device-status {
    display: block;
    margin-top: 6px;
    font-size: 0.8rem;
    font-weight: 700;
}

.settings-device-status[data-state="success"] {
    color: var(--success);
}

.settings-device-status[data-state="warning"] {
    color: var(--warning);
}

.settings-device-status[data-state="danger"] {
    color: var(--danger);
}

.settings-device-status[data-state="muted"] {
    color: var(--text-light);
}

body.theme-light .app-notification-success {
    background: #dcfce7;
    border-color: #bbf7d0;
    color: #166534;
}

body.theme-light .app-notification-error {
    background: #fee2e2;
    border-color: #fecaca;
    color: #991b1b;
}

body.theme-light .app-notification-warning {
    background: #fef3c7;
    border-color: #fde68a;
    color: #92400e;
}

body.theme-light .access-lock-overlay {
    background: rgba(255, 255, 255, 0.94);
    border-color: var(--border);
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
}

body.theme-light .access-lock-overlay h1 {
    color: var(--text);
}

body.theme-light .access-lock-overlay p {
    color: var(--text-light);
}

body.theme-light .access-lock-overlay .access-required-hint {
    color: #92400e;
}

