:root {
    color-scheme: light;
    --brand-primary: #1d4ed8;
    --brand-secondary: #0f172a;
    --brand-accent: #6366f1;
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --border-subtle: #e2e8f0;
    --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.12);
    --shadow-md: 0 16px 40px rgba(15, 23, 42, 0.1);
    --shadow-sm: 0 10px 24px rgba(15, 23, 42, 0.08);
    --body-bg: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
    --text-primary: #0f172a;
    --text-muted: #64748b;
    --sidebar-bg: #ffffff;
    --sidebar-text: #0f172a;
    --sidebar-active: rgba(59, 130, 246, 0.16);
    --table-surface: #ffffff;
    --table-striped: #f1f5f9;
    --table-hover: #e2e8f0;
}

[data-theme="dark"] {
    color-scheme: dark;
    --brand-primary: #60a5fa;
    --brand-secondary: #e2e8f0;
    --brand-accent: #a5b4fc;
    --surface: #0f172a;
    --surface-muted: #111827;
    --border-subtle: #1f2937;
    --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.5);
    --shadow-md: 0 16px 40px rgba(15, 23, 42, 0.4);
    --body-bg: radial-gradient(circle at top, #111827 0%, #0b1120 55%, #020617 100%);
    --text-primary: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.8);
    --sidebar-bg: #020617;
    --sidebar-text: rgba(255, 255, 255, 0.8);
    --sidebar-active: rgba(96, 165, 250, 0.2);
    --table-surface: #0b1220;
    --table-striped: rgba(148, 163, 184, 0.12);
    --table-hover: rgba(148, 163, 184, 0.2);
    
}

    [data-theme="dark"] .dashboard-table,
    [data-theme="dark"] table {
        color: #ffffff
    }

    [data-theme="dark"] .dashboard-table:hover,
    [data-theme="dark"] table:hover  {
       color: #ffffff
    }

    [data-theme="dark"] .table {
        --bs-table-bg: var(--table-surface);
        --bs-table-striped-bg: var(--table-striped);
        --bs-table-hover-bg: var(--table-hover);
    }

    [data-theme="dark"] .table thead th {
        color: var(--text-muted);
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.06em;
    }

    [data-theme="dark"] .modal-content {
        background: var(--surface);
        color: var(--text-primary);
        border-color: var(--border-subtle);
        box-shadow: var(--shadow-md);
    }

    [data-theme="dark"] .modal-header,
    [data-theme="dark"] .modal-footer {
        border-color: var(--border-subtle);
    }

    [data-theme="dark"] .modal-title,
    [data-theme="dark"] .modal-body {
        color: var(--text-primary);
    }

    [data-theme="dark"] .btn-close {
        filter: invert(1) grayscale(100%);
    }

* {
    box-sizing: border-box;
}

html {
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    min-height: 100vh;
    margin: 0;
    font-family: "Manrope", "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--body-bg);
    color: var(--text-primary);
}

    body.sidebar-collapsed {
        --sidebar-width: 96px;
    }

main {
    min-height: calc(100vh - 200px);
}

a {
    text-decoration: none;
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem rgba(37, 140, 251, 0.3);
}

.navbar {
    backdrop-filter: blur(10px);
}

    .navbar .navbar-brand {
        font-weight: 700;
        color: var(--brand-secondary);
    }

    .navbar .nav-link {
        font-weight: 500;
        color: var(--text-muted);
    }

        .navbar .nav-link:hover {
            color: var(--brand-primary);
        }

.page-shell {
    background: var(--surface);
    border-radius: 24px;
    padding: 2.5rem 3rem;
    box-shadow: var(--shadow-lg);
    animation: float-in 0.6s ease-out;
}

.app-shell {
    min-height: 100vh;
    display: block;
}

.app-sidebar {
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width, 280px);
    overflow-y: auto;
    transition: width 0.25s ease, padding 0.25s ease, box-shadow 0.25s ease;
    box-shadow: inset -1px 0 0 rgba(148, 163, 184, 0.2);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-brand {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--sidebar-text);
}

.app-brand {
    font-family: "Patrick Hand", "Manrope", "Inter", "Segoe UI", system-ui, sans-serif;
    letter-spacing: 0.04em;
    text-transform: none;
}

.app-brand-icon {
    margin-right: 0.45rem;
    font-size: 1.1em;
}

    .sidebar-brand:hover {
        color: var(--brand-accent);
    }

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.sidebar-link {
    color: var(--sidebar-text);
    padding: 0.55rem 0.9rem;
    border-radius: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    transition: background 0.2s ease, color 0.2s ease;
}

.sidebar-link-toggle {
    width: 100%;
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
}

.sidebar-toggle-indicator {
    margin-left: auto;
    transition: transform 0.2s ease;
}

.sidebar-link-toggle[aria-expanded="false"] .sidebar-toggle-indicator {
    transform: rotate(-90deg);
}

.sidebar-link-icon {
    font-size: 1.05rem;
    width: 1.25rem;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-link:hover {
    background: rgba(99, 102, 241, 0.12);
    color: var(--brand-secondary);
}

.sidebar-link.active {
    background: var(--sidebar-active);
    color: var(--brand-secondary);
}

.sidebar-subnav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding-left: 2.1rem;
    margin-top: -0.2rem;
    margin-bottom: 0.35rem;
}

    .sidebar-subnav[hidden] {
        display: none;
    }

.sidebar-sublink {
    color: var(--sidebar-text);
    padding: 0.4rem 0.7rem;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: background 0.2s ease, color 0.2s ease;
}

    .sidebar-sublink:hover {
        background: rgba(99, 102, 241, 0.12);
        color: var(--brand-secondary);
    }

.app-main {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin-left: var(--sidebar-width, 280px);
    transition: margin-left 0.25s ease;
}

body.sidebar-collapsed .app-sidebar {
    padding: 1.5rem 0.9rem;
}

body.sidebar-collapsed .sidebar-brand,
body.sidebar-collapsed .sidebar-link span:not(.sidebar-link-icon),
body.sidebar-collapsed .sidebar-link-toggle .sidebar-toggle-indicator,
body.sidebar-collapsed .sidebar-sublink span:not(.sidebar-link-icon) {
    display: none;
}

body.sidebar-collapsed .sidebar-subnav {
    display: none !important;
}

body.sidebar-collapsed .sidebar-link,
body.sidebar-collapsed .sidebar-sublink {
    justify-content: center;
    padding: 0.55rem;
}

.app-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2.5rem 0;
    gap: 1.5rem;
}

.topbar-title {
    font-size: 1.4rem;
    font-weight: 600;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-collapse-toggle {
    border-radius: 12px;
    padding: 0.4rem 0.6rem;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
}

.theme-toggle-input {
    appearance: none;
    width: 42px;
    height: 22px;
    border-radius: 999px;
    background: #cbd5f5;
    position: relative;
    outline: none;
    cursor: pointer;
    transition: background 0.2s ease;
}

    .theme-toggle-input::after {
        content: "";
        position: absolute;
        top: 3px;
        left: 3px;
        width: 16px;
        height: 16px;
        border-radius: 50%;
        background: #ffffff;
        box-shadow: 0 4px 10px rgba(15, 23, 42, 0.2);
        transition: transform 0.2s ease;
    }

    .theme-toggle-input:checked {
        background: #1d4ed8;
    }

        .theme-toggle-input:checked::after {
            transform: translateX(20px);
        }

.theme-toggle-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.auth-header {
    background: transparent;
}

.hero {
    padding: 3rem 0;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.12);
    color: var(--brand-accent);
    font-weight: 600;
    font-size: 0.85rem;
}

.hero-title {
    font-size: clamp(2rem, 3vw, 3.1rem);
    font-weight: 700;
    color: var(--brand-secondary);
}

.hero-subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.card {
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    box-shadow: var(--shadow-md);
}

.card-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border-subtle);
    font-weight: 600;
}

[data-theme="dark"] .card {
    background: var(--table-surface);
}

[data-theme="dark"] .card-header {
    background: var(--table-surface);
}

.feature-card {
    border: 1px solid var(--border-subtle);
    border-radius: 18px;
    padding: 1.5rem;
    background: var(--surface-muted);
    height: 100%;
}

    .feature-card h3 {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }

    .feature-card p {
        color: var(--text-muted);
        margin-bottom: 0;
    }

.dashboard-overview {
    padding: 0 0 3rem;
}

.dashboard-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--brand-secondary);
}

.dashboard-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.dashboard-subtitle {
    color: var(--text-muted);
}

.dashboard-tile {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1.5rem;
    border-radius: 18px;
    border: 1px solid var(--border-subtle);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    min-height: 120px;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    animation: float-in 0.6s ease-out;
}

.dashboard-tile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.dashboard-tile-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    font-size: 1.35rem;
    color: #ffffff;
}

.dashboard-tile--users {
    background: linear-gradient(140deg, rgba(59, 130, 246, 0.15), rgba(14, 116, 144, 0.08));
    border-color: rgba(59, 130, 246, 0.25);
}

    .dashboard-tile--users .dashboard-tile-icon {
        background: linear-gradient(135deg, #3b82f6, #0ea5e9);
    }

.dashboard-tile--active {
    background: linear-gradient(140deg, rgba(16, 185, 129, 0.15), rgba(34, 197, 94, 0.08));
    border-color: rgba(16, 185, 129, 0.25);
}

    .dashboard-tile--active .dashboard-tile-icon {
        background: linear-gradient(135deg, #10b981, #22c55e);
    }

.dashboard-tile--expected {
    background: linear-gradient(140deg, rgba(99, 102, 241, 0.16), rgba(139, 92, 246, 0.1));
    border-color: rgba(99, 102, 241, 0.3);
}

    .dashboard-tile--expected .dashboard-tile-icon {
        background: linear-gradient(135deg, #6366f1, #8b5cf6);
    }

.dashboard-tile--collected {
    background: linear-gradient(140deg, rgba(245, 158, 11, 0.16), rgba(251, 146, 60, 0.08));
    border-color: rgba(245, 158, 11, 0.3);
}

    .dashboard-tile--collected .dashboard-tile-icon {
        background: linear-gradient(135deg, #f59e0b, #f97316);
    }

.dashboard-tile--borrowed {
    background: linear-gradient(140deg, rgba(244, 63, 94, 0.16), rgba(239, 68, 68, 0.08));
    border-color: rgba(244, 63, 94, 0.3);
}

    .dashboard-tile--borrowed .dashboard-tile-icon {
        background: linear-gradient(135deg, #f43f5e, #ef4444);
    }

.dashboard-tile--inception-loaned {
    background: linear-gradient(140deg, rgba(20, 184, 166, 0.16), rgba(45, 212, 191, 0.08));
    border-color: rgba(20, 184, 166, 0.3);
}

    .dashboard-tile--inception-loaned .dashboard-tile-icon {
        background: linear-gradient(135deg, #14b8a6, #2dd4bf);
    }

.dashboard-tile--inception-payments {
    background: linear-gradient(140deg, rgba(59, 130, 246, 0.16), rgba(147, 197, 253, 0.08));
    border-color: rgba(59, 130, 246, 0.3);
}

    .dashboard-tile--inception-payments .dashboard-tile-icon {
        background: linear-gradient(135deg, #3b82f6, #93c5fd);
    }

.dashboard-tile--inception-overdue {
    background: linear-gradient(140deg, rgba(245, 158, 11, 0.18), rgba(250, 204, 21, 0.1));
    border-color: rgba(245, 158, 11, 0.32);
}

    .dashboard-tile--inception-overdue .dashboard-tile-icon {
        background: linear-gradient(135deg, #f59e0b, #facc15);
    }

.dashboard-label {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dashboard-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--brand-secondary);
}

.dashboard-metric {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
}

.dashboard-tile:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.dashboard-card {
    overflow: hidden;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.chart-title {
    font-size: 1.9rem;
    font-weight: 700;
}

.chart-subtitle {
    color: var(--text-muted);
}

.chart-legend {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.chart-bars {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.9rem;
    align-items: end;
    min-height: 200px;
}

.chart-bar {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

    .chart-bar::before {
        content: "";
        width: 100%;
        height: var(--bar-height, 50%);
        border-radius: 999px;
        background: linear-gradient(180deg, #60a5fa 0%, #2563eb 100%);
        box-shadow: 0 12px 30px rgba(37, 99, 235, 0.2);
        transition: height 0.6s ease;
    }

.progress-soft {
    height: 10px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.2);
}

    .progress-soft .progress-bar {
        border-radius: 999px;
    }

.progress-card {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.risk-meter {
    display: flex;
    gap: 0.35rem;
    align-items: center;
}

.risk-dot {
    width: 18px;
    height: 8px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.3);
}

    .risk-dot.is-active {
        background: linear-gradient(90deg, #22c55e, #16a34a);
        box-shadow: 0 6px 16px rgba(34, 197, 94, 0.35);
    }

.dashboard-table tbody tr td {
    vertical-align: middle;
}

.table {
    --bs-table-color: inherit;
    --bs-table-striped-color: inherit;
    --bs-table-hover-color: inherit;
    --bs-table-border-color: transparent;
    border-color: transparent;
}

.dashboard-table {
    --bs-table-bg: var(--table-surface);
    --bs-table-striped-bg: var(--table-striped);
    --bs-table-hover-bg: var(--table-hover);
}

    .dashboard-table thead th {
        color: var(--text-muted);
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.06em;
    }




.mini-meter {
    height: 6px;
    width: 80px;
    background: rgba(148, 163, 184, 0.3);
    border-radius: 999px;
    margin-bottom: 0.25rem;
    overflow: hidden;
}

    .mini-meter span {
        display: block;
        height: 100%;
        background: linear-gradient(90deg, #2563eb, #60a5fa);
    }

    .mini-meter.is-warning span {
        background: linear-gradient(90deg, #f97316, #f59e0b);
    }

.form-control,
.form-check-input {
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
}

.btn-primary {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    border-radius: 999px;
    padding: 0.6rem 1.4rem;
    font-weight: 600;
}

.btn-outline-primary {
    border-radius: 999px;
    padding: 0.6rem 1.4rem;
    font-weight: 600;
}

.btn-outline-secondary {
    border-radius: 999px;
}

.footer {
    background: transparent;
    color: var(--text-muted);
    padding: 1.5rem 0;
}

    .footer a {
        color: var(--brand-primary);
    }

.holiday-calendar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.calendar-legend {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.calendar-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #f97316;
    box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.15);
}

.calendar-month {
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 1rem;
    background: var(--surface);
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.08);
    height: 100%;
}

.calendar-month-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.calendar-month-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.calendar-month-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.35rem;
}

.calendar-weekday {
    text-align: center;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.calendar-day {
    position: relative;
    border-radius: 10px;
    min-height: 42px;
    background: rgba(148, 163, 184, 0.12);
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 0.35rem 0.4rem;
    font-size: 0.75rem;
    color: var(--text-primary);
}

.calendar-day-number {
    font-weight: 600;
}

.calendar-day--empty {
    background: transparent;
}

.calendar-day.is-holiday {
    background: rgba(249, 115, 22, 0.2);
    color: #c2410c;
    box-shadow: inset 0 0 0 1px rgba(249, 115, 22, 0.5);
}

.text-muted {
    color: var(--text-muted) !important;
}

.login-card {
    padding: 0.5rem;
}

    .login-card .card-body {
        padding: 2rem;
    }

@keyframes float-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 992px) {
    .app-sidebar {
        position: static;
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        border-radius: 0;
    }

    .app-main {
        margin-left: 0;
    }
}
