/* Glassmorphism Design System */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-color: #f3f4f6;
    --text-color: #1f2937;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #e0f2fe 0%, #eef2ff 100%);
    color: var(--text-color);
    margin: 0;
    min-height: 100vh;
}

/* Sticky footer */
.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page__content {
    flex: 1 0 auto;
}

.site-footer {
    margin-top: auto;
    padding-top: 3rem;
    padding-bottom: 2rem;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.auth-container {
    max-width: 500px;
    margin: 80px auto;
}

/* Glass Card */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 2rem;
    padding-left: 18px;
    padding-right: 18px;
    margin-bottom: 2rem;
}

/* Profile card (Dashboard top card) */
.profile-card {
    border-color: #e5e7eb;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: stretch;
    gap: 1.5rem;
}

.profile-card__left {
    min-width: 165px;
}

.profile-card__status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.profile-card__status-icon {
    width: 20px;
    height: 20px;
    color: var(--primary-color);
    flex: 0 0 auto;
}

.profile-card__name {
    margin-top: 0.35rem;
    font-size: 24px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.15;
}

.profile-card__unit {
    margin-top: 0.3rem;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
}

.profile-card__details {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
    padding: 0 1.5rem;
    border-left: 1px solid #eef2f7;
    border-right: 1px solid #eef2f7;
    align-items: center;
}

.profile-card__detail-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #94a3b8;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 0.35rem;
}

.profile-card__detail-icon {
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
    flex: 0 0 16px;
    display: block;
    aspect-ratio: 1 / 1;
}

.profile-card__detail-value {
    font-weight: 600;
    color: #0f172a;
    min-width: 0;
}

.profile-card__detail-value--truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-card__rate {
    min-width: 165px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: right;
}

.profile-card__rate-label {
    color: #94a3b8;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 0.3rem;
}

.profile-card__rate-value {
    color: #0f172a;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.profile-card__rate-suffix {
    color: #94a3b8;
    font-weight: 700;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .profile-card {
        flex-direction: column;
        gap: 1rem;
    }

    .profile-card__left,
    .profile-card__rate {
        min-width: 0;
    }

    .profile-card__details {
        padding: 1rem 0 0;
        border-left: 0;
        border-right: 0;
        border-top: 1px solid #eef2f7;
        grid-template-columns: 1fr;
        gap: 1rem;
        align-items: start;
    }

    .profile-card__rate {
        text-align: left;
        border-top: 1px solid #eef2f7;
        padding-top: 1rem;
    }
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    margin-top: 0;
    font-weight: 600;
}

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

.text-muted {
    color: #6b7280;
}

.text-sm {
    font-size: 0.875rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="month"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s;
    box-sizing: border-box;
    /* Fix for width: 100% causing overflow with padding */
}

/* Select2 (searchable selects) - match Glass theme */
.select2-container .select2-selection--single {
    height: 45px !important;
    border: 1px solid #d1d5db !important;
    border-radius: 8px !important;
    padding: 8px 12px;
    background-color: #ffffff;
}

.select2-container--default .select2-selection--single {
    display: flex !important;
    align-items: center !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 28px !important;
    padding-left: 0;
    padding-right: 64px;
    color: #1f2937;
    font: inherit !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
    flex: 1 1 auto;
    align-self: stretch;
    display: flex !important;
    align-items: center !important;
}

#select2-unit_no-container {
    height: 22px !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 43px !important;
    right: 10px;
    top: 50% !important;
    transform: translateY(-50%);
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.select2-container--default .select2-selection--single .select2-selection__clear {
    position: absolute !important;
    right: 38px !important; /* sits before the arrow (arrow is at right:10px) */
    top: 50% !important;
    transform: translateY(-50%);
    margin: 0 !important;
    line-height: 1 !important;
    height: 24px !important;
    width: 24px !important;
    border-radius: 9999px;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #64748b !important;
}

.select2-container--default .select2-selection--single .select2-selection__clear > span {
    height: 14px !important;
}

.select2-container--default .select2-selection--single .select2-selection__clear:hover {
    background: rgba(148, 163, 184, 0.18) !important;
    color: rgba(136, 136, 136, 1) !important;
}

.select2-dropdown {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 9999;
}

/* Select2 dropdown sizing/typography to match options */
.select2-container--default .select2-search--dropdown .select2-search__field {
    width: 100% !important;
    box-sizing: border-box !important;
    height: 36px !important;
    min-height: 36px !important;
    padding: 0 12px !important;
    font: inherit !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
    line-height: 34px !important;
    color: #1f2937 !important;
    background-color: #ffffff !important;
    border: 1px solid #d1d5db !important;
    outline: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
}

.select2-container--default .select2-search--dropdown .select2-search__field::-webkit-search-cancel-button,
.select2-container--default .select2-search--dropdown .select2-search__field::-webkit-search-decoration {
    -webkit-appearance: none !important;
}

.select2-container--default .select2-results__option {
    min-height: 36px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    font: inherit;
    font-size: 1rem;
    font-weight: 700;
    color: #1f2937;
    box-sizing: border-box;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    font: inherit !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
    color: #1f2937 !important;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-size: 1rem;
    box-sizing: border-box;
    max-width: 100%;
}

.btn.is-loading {
    cursor: not-allowed;
    opacity: 0.95;
    transform: none !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn.is-loading:hover {
    transform: none !important;
}

.btn__spinner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.btn__spinner svg {
    width: 44px;
    height: 18px;
    display: block;
}

.btn-plus-right {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.btn-plus-right__icon {
    width: 1.8em;
    height: 1.8em;
    flex: 0 0 auto;
    display: block;
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.page-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 2rem;
}

.page-header-row h2,
.page-header-row h3 {
    margin: 0;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.page-header__text h2 {
    margin: 0;
}

.page-subtitle {
    margin-top: 0.35rem;
    color: #6b7280;
    font-size: 0.95rem;
    font-weight: 500;
}

.desktop-only {
    display: block !important;
}

.mobile-only {
    display: none !important;
}

.payment-cards {
    display: grid;
    gap: 1.25rem;
    margin-bottom: 40px;
}

.payment-card {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(229, 231, 235, 0.9);
    border-radius: 16px;
    padding: 1rem;
    box-shadow: 0 6px 20px rgba(31, 38, 135, 0.08);
    margin: 10px 0;
}

.payment-card__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.payment-card__row--top {
    margin-bottom: 0.35rem;
}

.payment-card__title {
    font-weight: 700;
    font-size: 1.05rem;
}

.payment-card__amount {
    font-weight: 700;
    white-space: nowrap;
}

.payment-card__row--meta {
    margin-bottom: 0.75rem;
}

.payment-card__date {
    color: #6b7280;
    font-size: 0.9rem;
    white-space: nowrap;
}

.payment-card__row--ref {
    align-items: center;
    border-top: 1px solid rgba(244, 246, 250, 0.9);
    padding-top: 0.75rem;
}

.payment-card__ref-block {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.payment-card__ref-label {
    color: #9ca3af;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.payment-card__ref-value {
    color: #4b5563;
    font-size: 0.9rem;
    font-weight: 500;
    word-break: break-word;
}

.recent-payments__footer {
    margin-top: 1rem;
    text-align: right;
}

@media (max-width: 640px) {
    .recent-payments__footer {
        text-align: center;
    }
}

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.results-summary {
    color: #6b7280;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    padding: 0.4rem 0.6rem;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    background: white;
    color: #374151;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1;
}

.page-link:hover {
    border-color: #cbd5e1;
    background: #f9fafb;
}

.page-link.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.page-link.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.page-ellipsis {
    color: #6b7280;
    padding: 0 0.25rem;
    user-select: none;
}

@media (max-width: 640px) {
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.85rem;
    }

    .page-header__cta {
        width: 100%;
        justify-content: center;
        box-sizing: border-box;
        max-width: 100%;
    }

    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: block !important;
    }

    .pagination-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .pagination {
        justify-content: center;
        gap: 0.35rem;
    }

    .page-link {
        min-width: 2rem;
        padding: 0.45rem 0.6rem;
        border-radius: 12px;
    }
}

.btn-secondary {
    background-color: white;
    color: var(--text-color);
    border: 1px solid #d1d5db;
}

.btn-secondary:hover {
    background-color: #f9fafb;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
}

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

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-sm .btn-plus-right__icon {
    width: 1.6em;
    height: 1.6em;
}

/* Navbar */
.navbar {
    background: white;
    padding: 1rem 0 0.65rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 48px;
    padding-top: 5px;
    padding-bottom: 5px;
}

.nav-brand {
    display: inline-flex;
    align-items: center;
    min-height: 48px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    line-height: 1;
}

.nav-brand__logo {
    height: 48px;
    width: auto;
    display: block;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    text-decoration: none;
    color: #4b5563;
    font-weight: 500;
    line-height: 1;
    padding: 0 0.15rem;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
}

/* Navbar user dropdown */
.nav-user {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.nav-user-button {
    width: 38px;
    height: 38px;
    border-radius: 9999px;
    border: 1px solid #e5e7eb;
    background: white;
    color: #4b5563;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-user-button:hover {
    color: var(--primary-color);
    border-color: #cbd5e1;
    background: #f9fafb;
}

.nav-user-button i {
    font-size: 1.15rem;
    line-height: 1;
}

.nav-user-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 210px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
    padding: 0.35rem;
    display: none;
    z-index: 50;
}

.nav-user-menu.is-open {
    display: block;
}

.nav-user-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.75rem;
    border-radius: 12px;
    text-decoration: none;
    color: #374151;
    font-weight: 600;
    transition: background 0.15s, color 0.15s;
}

.nav-user-item i {
    width: 18px;
    text-align: center;
    color: #6b7280;
}

.nav-user-item:hover {
    background: #f3f4f6;
}

.nav-user-item.active {
    background: rgba(37, 99, 235, 0.08);
    color: var(--primary-color);
}

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

.nav-user-item--danger {
    color: #dc2626;
}

.nav-user-item--danger i {
    color: #dc2626;
}

.nav-user-item--danger:hover {
    background: #fee2e2;
}

/* Mobile polish */
@media (max-width: 640px) {
    .navbar {
        padding: 0.75rem 0 0.5rem;
    }

    .navbar .container {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.75rem;
        padding-bottom: 5px;
    }

    .nav-brand {
        font-size: 1.15rem;
        line-height: 1.2;
        min-height: 0;
    }

    .nav-brand__logo {
        height: 42px;
    }

    .nav-links {
        width: 100%;
        flex-wrap: wrap;
        gap: 0.6rem 2.5rem;
    }

    .nav-user {
        margin-left: auto;
    }

    .nav-link {
        font-size: 0.95rem;
        min-height: 0;
        padding: 0;
    }

    .btn {
        padding: 0.625rem 1.125rem;
        font-size: 0.95rem;
    }
}

/* Password input with toggle icon */
.password-input {
    position: relative;
}

.password-input input[type="password"],
.password-input input[type="text"] {
    padding-right: 44px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #94a3b8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.password-toggle:hover {
    background: #f3f4f6;
    color: #64748b;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

/* Use fixed layout so column widths are respected (Residents page). */
.residents-table {
    table-layout: fixed;
    /* Prevent columns collapsing too tightly; allow horizontal scroll via .table-responsive */
    min-width: 760px;
}

th,
td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

/* Residents table: prevent text spilling into adjacent columns.
   IMPORTANT: do not apply overflow clipping to the Actions column, otherwise
   the 3-dots dropdown menu will be clipped. */
.residents-table th:not(:last-child),
.residents-table td:not(:last-child) {
    overflow: hidden;
    text-overflow: ellipsis;
}

.residents-table th:last-child,
.residents-table td:last-child {
    overflow: visible;
}

.residents-table th {
    white-space: nowrap;
}

/* Allow names to wrap; keep other columns compact */
.residents-table td:nth-child(2) {
    white-space: normal;
}

th {
    font-weight: 600;
    color: #4b5563;
    background-color: #f9fafb;
}

tr:hover {
    background-color: #f9fafb;
}

/* Table row actions (3-dots dropdown) */
.table-actions {
    position: relative;
    display: inline-flex;
    justify-content: center;
}

.table-actions__toggle {
    padding-left: 0.7rem;
    padding-right: 0.7rem;
    min-width: 38px;
}

.table-actions__toggle i {
    font-size: 1rem;
}

.table-actions__menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 210px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
    padding: 0.35rem;
    display: none;
    z-index: 60;
}

.table-actions__menu.is-open {
    display: block;
}

/* Flip the dropdown upward when near bottom */
.table-actions__menu.is-open-up {
    top: auto;
    bottom: calc(100% + 10px);
}

.table-actions__item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.75rem;
    border-radius: 12px;
    text-decoration: none;
    color: #374151;
    font-weight: 600;
    background: transparent;
    border: 0;
    cursor: pointer;
    font: inherit;
    transition: background 0.15s, color 0.15s;
    text-align: left;
}

.table-actions__item i {
    width: 18px;
    text-align: center;
    color: #6b7280;
}

.table-actions__item:hover {
    background: #f3f4f6;
}

/* Modal */
body.is-modal-open {
    overflow: hidden;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background: rgba(15, 23, 42, 0.55);
    z-index: 80;
}

.modal-overlay.is-open {
    display: flex;
}

.modal-dialog.glass-card {
    width: min(680px, 100%);
    margin-bottom: 0;
    max-height: calc(100vh - 44px);
    overflow: auto;
    background: #ffffff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.18);
}

/* Reminder modal (redesigned like reference) */
.reminder-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.95);
}

.reminder-modal__header-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.reminder-modal__icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(37, 99, 235, 0.10);
    border: 1px solid rgba(37, 99, 235, 0.18);
    color: var(--primary-color);
    flex: 0 0 auto;
}

.reminder-modal__icon i {
    font-size: 1.05rem;
}

.reminder-modal__header-text {
    min-width: 0;
}

.reminder-modal__title {
    margin: 0;
    color: #0f172a;
    font-weight: 900;
    letter-spacing: -0.01em;
}

.reminder-modal__subtitle {
    margin-top: 2px;
    color: #64748b;
    font-size: 0.92rem;
    font-weight: 400;
    line-height: 1.35;
}

.reminder-modal__body {
    margin-top: 1rem;
}

.reminder-modal__body textarea {
    font: inherit;
    font-weight: 400;
    color: #111827;
}

.reminder-modal__body textarea::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

.reminder-modal__note {
    margin-top: 0.95rem;
    padding-top: 0.95rem;
    border-top: 1px solid rgba(226, 232, 240, 0.95);
    text-align: center;
    color: #94a3b8;
    font-size: 0.82rem;
    font-weight: 500;
}

.reminder-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 14px;
    margin-top: 1.05rem;
}

.reminder-modal__send {
    min-width: 240px;
}

.modal-close {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 0;
    background: transparent;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    flex: 0 0 auto;
}

.modal-close:hover {
    background: #f3f4f6;
    color: #475569;
}

.modal-close i {
    font-size: 1rem;
}

@media (max-width: 640px) {
    .payments-table th,
    .payments-table td {
        padding: 0.75rem;
    }

    /* Date column (3rd) - keep readable on mobile */
    .payments-table th:nth-child(3),
    .payments-table td:nth-child(3) {
        white-space: nowrap;
        min-width: 11rem;
    }
}

/* Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Alerts (multi-line messages) */
.alert {
    display: block;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    border: 1px solid transparent;
    margin-bottom: 20px;
}

.alert-warning {
    background-color: #fef3c7 !important;
    color: #92400e !important;
    border-color: #fcd34d !important;
}

/* Messages (warning/error panels) */
.message {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid transparent;
    margin-bottom: 20px;
}

.message__icon {
    width: 40px;
    height: 40px;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    margin-top: 2px;
    color: #fff;
}

.message__content {
    flex: 1;
    min-width: 0;
    color: rgba(69, 69, 69, 1);
    font-size: 1rem;
    line-height: 1.45;
}

.message__title {
    font-weight: 700;
    letter-spacing: -0.01em;
}

.message__text {
    margin-top: 6px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
}

.message__content a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.message__detail {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: baseline;
}

.message__label {
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.78rem;
}

.message__value {
    font-weight: 500;
    font-size: 14px;
}

.message.is-warning .message__label {
    color: #92400e;
}

.message.is-danger .message__label {
    color: #b91c1c;
}

.message.is-warning {
    background: rgba(251, 191, 36, 0.22);
    border-color: rgba(245, 158, 11, 0.25);
    align-items: center;
}

.message.is-warning .message__icon {
    background: #f59e0b;
    margin-top: 0;
}

.message.is-success {
    background: rgba(34, 197, 94, 0.14);
    border-color: rgba(34, 197, 94, 0.22);
}

.message.is-success .message__icon {
    background: #22c55e;
}

.message.is-success .message__title {
    color: #065f46;
}

.message.is-danger {
    background: rgba(248, 113, 113, 0.18);
    border-color: rgba(239, 68, 68, 0.22);
}

.message.is-danger .message__icon {
    background: #ef4444;
}

/* Toast notifications */
.app-toast-container {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 2500;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    width: calc(100% - 36px);
    max-width: 420px;
}

.app-toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 12px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #f8fafc;
    box-shadow: 0 18px 45px rgba(2, 6, 23, 0.45);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transform: translateY(-8px);
    opacity: 0;
    transition: opacity 160ms ease, transform 160ms ease;
}

.app-toast.is-show {
    opacity: 1;
    transform: translateY(0);
}

.app-toast__icon {
    width: 36px;
    height: 36px;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    color: #fff;
}

.app-toast--success .app-toast__icon {
    background: #22c55e;
}

.app-toast--warning .app-toast__icon {
    background: #f59e0b;
}

.app-toast--danger .app-toast__icon {
    background: #ef4444;
}

.app-toast__content {
    flex: 1;
    min-width: 0;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.35;
}

.app-toast__close {
    appearance: none;
    background: transparent;
    border: 0;
    color: rgba(248, 250, 252, 0.92);
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 auto;
}

.app-toast__close:hover {
    background: rgba(255, 255, 255, 0.08);
}

.app-toast__close:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

@media (prefers-reduced-motion: reduce) {
    .app-toast {
        transition: none;
        transform: none;
    }
    .app-toast.is-show {
        transform: none;
    }
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

/* Paid/Member */
.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

/* Pending */
.badge-danger {
    background-color: #fee2e2;
    color: #b91c1c;
}

/* Unpaid/Non-Member */
.badge-secondary {
    background-color: #f3f4f6;
    color: #374151;
}

/* FPX */
.badge-primary {
    background-color: rgba(37, 99, 235, 0.14);
    color: #1d4ed8;
}

/* Vacant */

/* Grid */
.grid {
    display: grid;
    gap: 1.5rem;
}

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

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

.payments-filter__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.payments-filter__payment-for {
    display: flex;
    gap: 8px;
    align-items: center;
}

.payments-filter__payment-for select {
    flex: 1 1 0;
    min-width: 0;
}

.payments-filter__actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 12px;
    flex-wrap: wrap;
}

.stats-grid {
    align-items: stretch;
}

/* Stat widgets (dashboard cards) */
.stat-card {
    --stat-accent: var(--primary-color);
    --stat-accent-bg: rgba(37, 99, 235, 0.12);
    --stat-accent-border: rgba(37, 99, 235, 0.18);
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
    padding: 1.25rem 1.25rem;
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 170px;
    position: relative;
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(148, 163, 184, 0.35);
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.08);
}

.stat-card__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.65rem;
}

.stat-card__kicker {
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.stat-card__icon {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

.stat-card__icon i {
    font-size: 18px;
    line-height: 1;
    display: block;
}

.stat-card__icon--blue {
    background: rgba(37, 99, 235, 0.12);
    color: #2563eb;
}

.stat-card__icon--violet {
    background: rgba(124, 58, 237, 0.12);
    color: #7c3aed;
}

.stat-card__icon--green {
    background: rgba(22, 163, 74, 0.12);
    color: #16a34a;
}

.stat-card__value {
    font-size: 2.05rem;
    font-weight: 900;
    color: #0f172a;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-top: 1.1rem;
    margin-bottom: 58px;
}

.stat-card__sub {
    margin-top: 16px;
    padding-top: 16px;
    border-top: solid 1px #f0f5fe;
}

.stat-card__sub-pill {
    align-items: center;
    justify-content: center;
    max-width: 100%;
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    background: var(--stat-accent-bg);
    border: 1px solid var(--stat-accent-border);
    color: var(--stat-accent);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: 0.55rem;
    font-size: 0.92rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.stat-trend i {
    font-size: 0.95em;
}

.stat-trend__muted {
    color: #94a3b8;
    font-weight: 700;
}

.stat-trend--up {
    color: #16a34a;
}

.stat-trend--down {
    color: #f97316;
}

.stat-progress {
    --accent: var(--stat-accent);
    width: 112px;
    height: 112px;
    border-radius: 9999px;
    margin: 0 auto;
    background: conic-gradient(var(--accent) 0% calc(var(--p, 0) * 1%), rgba(226, 232, 240, 0.9) 0% 100%);
    display: grid;
    place-items: center;
    position: relative;
}

.stat-card--blue {
    --stat-accent: #2563eb;
    --stat-accent-bg: rgba(37, 99, 235, 0.12);
    --stat-accent-border: rgba(37, 99, 235, 0.18);
}

.stat-card--violet {
    --stat-accent: #7c3aed;
    --stat-accent-bg: rgba(124, 58, 237, 0.12);
    --stat-accent-border: rgba(124, 58, 237, 0.18);
}

.stat-card--green {
    --stat-accent: #16a34a;
    --stat-accent-bg: rgba(22, 163, 74, 0.12);
    --stat-accent-border: rgba(22, 163, 74, 0.18);
}

.stat-progress::before {
    content: "";
    width: 86px;
    height: 86px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow: inset 0 6px 18px rgba(15, 23, 42, 0.06);
}

.stat-progress__inner {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    text-align: center;
    padding: 0 0.35rem;
}

.stat-progress__value {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.22rem;
    flex-wrap: wrap;
    font-size: 1.18rem;
    font-weight: 900;
    color: #0f172a;
    letter-spacing: -0.02em;
    line-height: 1.05;
}

.stat-progress__value-total {
    color: #475569;
}

.stat-progress__value-sep {
    color: #94a3b8;
}

.stat-progress__label {
    color: #94a3b8;
    font-size: 0.65rem;
    font-weight: 900;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

@media (max-width: 768px) {

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

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

    .stat-progress {
        width: 104px;
        height: 104px;
    }

    .stat-progress::before {
        width: 80px;
        height: 80px;
    }
}

@media (max-width: 640px) {
    .payments-filter__grid {
        grid-template-columns: 1fr;
    }

    .payments-filter__actions > * {
        flex: 1 1 auto;
    }
}

/* Segmented Control */
.segment-control {
    display: flex;
    background: #f3f4f6;
    /* bg-secondary */
    border-radius: 9999px;
    /* full rounded */
    padding: 0.25rem;
    margin-bottom: 1.5rem;
    border: 1px solid #e5e7eb;
}

.segment-option {
    flex: 1;
    text-align: center;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    cursor: pointer;
    font-weight: 500;
    color: #6b7280;
    transition: all 0.2s;
}

.segment-option.active {
    background-color: #fee2e2;
    /* bg-red-100 */
    color: #b91c1c;
    /* text-red-700 */
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    border: 1px solid #fecaca;
}

/* Day Selector for Weekly */
.day-selector {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    margin: 1rem 0;
}

.day-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 500;
    color: #6b7280;
    transition: all 0.2s;
}

.day-circle.active {
    background-color: #fee2e2;
    border-color: #ef4444;
    color: #b91c1c;
}

.day-label {
    font-size: 0.75rem;
    text-align: center;
    color: #6b7280;
    margin-top: 0.25rem;
}