:root {
    --hotr-primary: #244b78;
    --hotr-primary-2: #356da6;
    --hotr-accent: #c9a86c;
    --hotr-bg: #f5f7fb;
    --hotr-surface: #ffffff;
    --hotr-surface-2: #f8fafc;
    --hotr-text: #172033;
    --hotr-muted: #6b7280;
    --hotr-border: #e5e9f0;
    --hotr-success: #198754;
    --hotr-warning: #d39e00;
    --hotr-danger: #dc3545;
    --hotr-info: #0d6efd;
    --hotr-radius: 14px;
    --hotr-shadow: 0 5px 20px rgba(20, 35, 55, .06);
}

[data-theme="dark"] {
    --hotr-bg: #111827;
    --hotr-surface: #182231;
    --hotr-surface-2: #202c3b;
    --hotr-text: #e7edf5;
    --hotr-muted: #9aa7b7;
    --hotr-border: #2d3a4a;
    --hotr-shadow: 0 5px 20px rgba(0, 0, 0, .18);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
    background: var(--hotr-bg);
    color: var(--hotr-text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    overflow-x: hidden;
}

a { color: inherit; }

.app-shell { min-height: 100vh; }

.topbar {
    min-height: 68px;
    background: var(--hotr-surface);
    border-bottom: 1px solid var(--hotr-border);
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: 0 2px 12px rgba(20,35,55,.04);
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--hotr-primary);
    color: #fff;
    flex: 0 0 auto;
}

.brand-text { line-height: 1.05; display: flex; flex-direction: column; }
.brand-text strong { font-size: .98rem; letter-spacing: .03em; }
.brand-text small { font-size: .66rem; color: var(--hotr-muted); letter-spacing: .04em; margin-top: 3px; }

.navbar-brand { color: var(--hotr-text) !important; }
.mobile-menu-btn, .topbar-icon {
    width: 40px;
    height: 40px;
    border: 1px solid var(--hotr-border);
    background: var(--hotr-surface-2);
    color: var(--hotr-text);
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.topbar-icon { text-decoration: none; font-size: 1.05rem; }
.topbar-icon:hover, .mobile-menu-btn:hover { background: var(--hotr-primary); color: #fff; border-color: var(--hotr-primary); }

.topbar-notification-dot {
    position: absolute;
    top: -4px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 20px;
    background: var(--hotr-danger);
    color: #fff;
    font-size: .62rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--hotr-surface);
}

.user-menu {
    border: 0;
    background: transparent;
    color: var(--hotr-text);
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .2rem .1rem .2rem .35rem;
}
.user-menu::after { margin-left: .15rem; }
.user-menu strong { font-size: .82rem; }
.user-menu small { font-size: .68rem; color: var(--hotr-muted); }
.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--hotr-primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}
.dropdown-menu {
    background: var(--hotr-surface);
    border-color: var(--hotr-border);
    color: var(--hotr-text);
}
.dropdown-item { color: var(--hotr-text); }
.dropdown-item:hover { background: var(--hotr-surface-2); color: var(--hotr-text); }

.app-body { display: flex; min-height: calc(100vh - 68px); }

.sidebar {
    width: 252px;
    flex: 0 0 252px;
    background: var(--hotr-surface);
    border-right: 1px solid var(--hotr-border);
    padding: 18px 12px;
    position: sticky;
    top: 68px;
    height: calc(100vh - 68px);
    overflow-y: auto;
}
.sidebar-inner { flex: 1; }
.sidebar-section-label {
    color: var(--hotr-muted);
    font-size: .65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .1em;
    padding: 13px 12px 6px;
}
.sidebar .nav-link,
.mobile-sidebar .nav-link {
    color: var(--hotr-muted);
    border-radius: 11px;
    padding: 10px 12px;
    margin: 2px 0;
    display: flex;
    align-items: center;
    gap: 11px;
    font-size: .88rem;
    font-weight: 600;
    transition: .18s ease;
}
.sidebar .nav-link i,
.mobile-sidebar .nav-link i { width: 20px; text-align: center; font-size: 1rem; }
.sidebar .nav-link:hover,
.sidebar .nav-link.active,
.mobile-sidebar .nav-link:hover,
.mobile-sidebar .nav-link.active {
    color: var(--hotr-primary);
    background: color-mix(in srgb, var(--hotr-primary) 9%, transparent);
}
[data-theme="dark"] .sidebar .nav-link:hover,
[data-theme="dark"] .sidebar .nav-link.active,
[data-theme="dark"] .mobile-sidebar .nav-link:hover,
[data-theme="dark"] .mobile-sidebar .nav-link.active {
    color: #fff;
    background: color-mix(in srgb, var(--hotr-primary-2) 25%, transparent);
}
.nav-count {
    margin-left: auto;
    background: var(--hotr-danger);
    color: #fff;
    min-width: 21px;
    height: 21px;
    padding: 0 5px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .65rem;
}
.sidebar-footer { margin-top: 15px; }
.sidebar-footer-card {
    background: var(--hotr-surface-2);
    border: 1px solid var(--hotr-border);
    border-radius: 12px;
    padding: 11px 12px;
}

.main-content {
    flex: 1 1 auto;
    min-width: 0;
}
.content-container {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px;
}

.mobile-sidebar { background: var(--hotr-surface); color: var(--hotr-text); width: min(88vw, 320px) !important; }
.mobile-sidebar .offcanvas-header { border-bottom: 1px solid var(--hotr-border); }
.mobile-sidebar .btn-close { filter: var(--hotr-close-filter, none); }

[data-theme="dark"] .mobile-sidebar .btn-close { filter: invert(1) grayscale(1) brightness(2); }

.mobile-bottom-nav {
    display: none;
}

.card {
    background: var(--hotr-surface);
    border: 1px solid var(--hotr-border);
    border-radius: var(--hotr-radius);
    color: var(--hotr-text);
    box-shadow: var(--hotr-shadow);
}
.card-header {
    background: var(--hotr-surface);
    color: var(--hotr-text);
    border-bottom: 1px solid var(--hotr-border);
    padding: 14px 18px;
}
.card-body { padding: 18px; }

.stat-card {
    border: 0;
    box-shadow: var(--hotr-shadow);
    overflow: hidden;
}
.stat-card .stat-number { color: inherit; }
.stat-card:hover { transform: translateY(-2px); }

.table {
    color: var(--hotr-text);
    --bs-table-bg: var(--hotr-surface);
    --bs-table-color: var(--hotr-text);
    --bs-table-border-color: var(--hotr-border);
    margin-bottom: 0;
}
.table thead th {
    background: var(--hotr-surface-2);
    color: var(--hotr-muted);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 700;
    border-bottom-width: 1px;
    white-space: nowrap;
}
.table tbody tr:hover { --bs-table-hover-bg: color-mix(in srgb, var(--hotr-primary) 4%, transparent); }

.form-control, .form-select {
    max-width: none;
    width: 100%;
    background: var(--hotr-surface);
    color: var(--hotr-text);
    border-color: var(--hotr-border);
    border-radius: 10px;
    min-height: 42px;
}
.form-control:focus, .form-select:focus {
    background: var(--hotr-surface);
    color: var(--hotr-text);
    border-color: var(--hotr-primary-2);
    box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--hotr-primary-2) 15%, transparent);
}
.form-label { color: var(--hotr-text); font-weight: 600; font-size: .84rem; }
.form-text { color: var(--hotr-muted); }

.btn { border-radius: 10px; font-weight: 600; }
.btn-primary { background: var(--hotr-primary); border-color: var(--hotr-primary); }
.btn-primary:hover { background: var(--hotr-primary-2); border-color: var(--hotr-primary-2); }

.alert {
    border-radius: 12px;
    border-width: 1px;
}
.app-alert {
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(20,35,55,.05);
}

.badge { font-weight: 600; letter-spacing: .01em; }

.page-title-box, .dashboard-header, .reports-header {
    margin-bottom: 20px;
}
.page-title-box h1, .page-title-box h2, .page-title-box h3, .page-title-box h4,
.dashboard-header h1, .reports-header h1 { color: var(--hotr-text); }

.input-group .form-control { min-width: 0; }

.btn-group { flex-wrap: wrap; }

img, canvas, svg { max-width: 100%; }

.chart-container, #attendanceChart, #financialChart { max-width: 100%; }

.empty-state {
    padding: 38px 20px;
    text-align: center;
    color: var(--hotr-muted);
}
.empty-state i { font-size: 2rem; margin-bottom: 10px; }

.mobile-only { display: none; }

@media (max-width: 1199.98px) {
    .content-container { padding: 20px; }
    .sidebar { width: 230px; flex-basis: 230px; }
}

@media (max-width: 991.98px) {
    .topbar { min-height: 62px; }
    .app-body { min-height: calc(100vh - 62px); }
    .content-container {
        padding: 18px 15px 88px;
    }

    .mobile-bottom-nav {
        position: fixed;
        z-index: 1040;
        left: 0;
        right: 0;
        bottom: 0;
        min-height: 62px;
        padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
        background: color-mix(in srgb, var(--hotr-surface) 96%, transparent);
        border-top: 1px solid var(--hotr-border);
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        backdrop-filter: blur(12px);
    }
    .mobile-bottom-nav a,
    .mobile-bottom-nav button {
        border: 0;
        background: transparent;
        color: var(--hotr-muted);
        text-decoration: none;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        font-size: .67rem;
        font-weight: 700;
    }
    .mobile-bottom-nav i { font-size: 1.15rem; }
    .mobile-bottom-nav .active { color: var(--hotr-primary); }

    .page-title-box,
    .dashboard-header,
    .reports-header {
        flex-wrap: wrap;
    }
    .card-header .d-flex { flex-wrap: wrap; gap: 10px; }
    .table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }
    .table thead, .table tbody { width: max-content; }
    .table th, .table td { min-width: 100px; }
    .table th:first-child, .table td:first-child { min-width: 160px; }
    .modal-dialog { margin: .5rem; }
    .container, .container-fluid { --bs-gutter-x: 1rem; }
    .row { --bs-gutter-y: 1rem; }
}

@media (max-width: 575.98px) {
    .content-container { padding: 14px 10px 82px; }
    .navbar-brand .brand-text small { display: none; }
    .brand-mark { width: 34px; height: 34px; }
    .user-avatar { width: 35px; height: 35px; }
    .topbar-icon, .mobile-menu-btn { width: 36px; height: 36px; }
    .card { border-radius: 12px; }
    .card-header, .card-body { padding: 13px; }

    .page-title-box .breadcrumb,
    .dashboard-header .btn,
    .reports-header .btn { width: 100%; margin-top: 8px; }

    .btn { min-height: 40px; }
    .btn-group { width: 100%; }
    .btn-group > .btn { flex: 1 1 auto; }

    .row > [class*="col-"] { min-width: 0; }

    .form-row-actions,
    .filter-actions {
        display: grid !important;
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .filter-actions .btn,
    .form-row-actions .btn { width: 100%; }

    .pagination { flex-wrap: wrap; justify-content: center; }

    .stat-number { font-size: 1.55rem !important; }

    .input-group {
        flex-wrap: nowrap;
    }
    .input-group > .form-control { min-width: 0; }

    .alert { font-size: .86rem; }
}

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

/* Page-level visual polish across the existing HOTR screens */
.dashboard-header,
.reports-header,
.page-title-box {
    background: transparent;
}

.dashboard-header h1,
.reports-header h1,
.page-title-box h4 {
    font-weight: 800;
    letter-spacing: -.02em;
}

.dashboard-header p,
.reports-header p { color: var(--hotr-muted) !important; }

.upcoming-events-banner {
    background: linear-gradient(135deg, var(--hotr-primary), var(--hotr-primary-2)) !important;
    border-radius: 16px !important;
}

.top-attendees-list .attendee-item,
.event-detail-card,
.event-item {
    background: var(--hotr-surface-2);
    border-color: var(--hotr-border) !important;
}

.notification-item {
    border: 1px solid var(--hotr-border) !important;
    border-radius: 12px;
    margin-bottom: 8px;
    background: var(--hotr-surface);
    padding: 13px !important;
}

.notification-item:hover { background: var(--hotr-surface-2) !important; }

.activity-item {
    transition: background .18s ease;
}
.activity-item:hover { background: var(--hotr-surface-2); }

#membersList .member-item label {
    transition: .16s ease;
}
#membersList .member-item label:hover {
    border-color: var(--hotr-primary-2) !important;
    background: color-mix(in srgb, var(--hotr-primary) 5%, var(--hotr-surface-2)) !important;
}

@media (max-width: 767.98px) {
    .dashboard-header .row,
    .reports-header .d-flex,
    .page-title-box.d-flex { align-items: flex-start !important; }

    .dashboard-header .col-md-4,
    .dashboard-header .col-md-8 { text-align: left !important; }

    .upcoming-events-banner .card-body { padding: 16px !important; }

    .upcoming-events-banner .row > [class*="col-"] {
        margin-bottom: 8px;
    }

    .finance-table,
    .donation-table,
    .members-table,
    .attendance-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .modal .modal-content { border-radius: 14px; }
}

/* Keep legacy custom pages inside the same visual language */
.text-muted { color: var(--hotr-muted) !important; }
.bg-light { background-color: var(--hotr-surface-2) !important; }
.border, .border-bottom, .border-top { border-color: var(--hotr-border) !important; }
