/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

@media (max-width: 768px) {
    html {
        zoom: 1.2;
    }

    .landing-container,
    .login-wrapper,
    .dashboard-container {
        min-height: calc(100vh / 1.2);
    }

    .members-page {
        height: calc(100vh / 1.2);
        max-height: calc(100vh / 1.2);
    }
}

.container {
    max-width: 1351px;
    margin: 0 auto;
    padding: 0 20px;
}
@media (max-width: 768px) {
    .container {
        padding: 0 10px;
    }
}

/* Landing Page Styles */
.landing-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.landing-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem 0;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.logo {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.tagline {
    font-size: 1.2rem;
    opacity: 0.9;
}

.landing-main {
    flex: 1;
}

.hero-section {
    background: white;
    padding: 4rem 0;
    text-align: center;
}

.hero-section h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #667eea;
}

.hero-description {
    font-size: 1.2rem;
    color: #666;
    max-width: 800px;
    margin: 0 auto 2rem;
    line-height: 1.8;
}

.cta-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-block;
    padding: 6px 15px;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

.btn-primary {
    background-color: #667eea;
    color: white;
}

.btn-primary:hover {
    background-color: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
    transform: translateY(-2px);
}

.filter-button-row {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    max-width: 100%;
}

.year-controls {
    display: flex;
    flex: 0 0 auto;
    gap: 6px;
    align-items: stretch;
    flex-wrap: nowrap;
}

.year-controls .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    line-height: 1;
    min-height: 30px;
    background-color: #dbe7ff;
    color: #243056;
    border: 1px solid #c5d4fb;
}

.year-controls .btn:hover {
    background-color: #c9daff;
    color: #243056;
    transform: none;
    box-shadow: none;
}

.year-nav {
    min-width: 36px;
}

.year-nav i {
    font-size: 1rem;
    line-height: 1;
    display: block;
}

.year-controls .btn:disabled,
.year-controls .btn:disabled:hover {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.about-section,
.mission-section {
    background: #f8f9fa;
    padding: 3rem 0;
    margin-top: 2rem;
}

.about-section h2,
.mission-section h2 {
    text-align: center;
    color: #667eea;
    margin-bottom: 1.5rem;
    font-size: 2rem;
}

.about-section p,
.mission-section p {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    font-size: 1.1rem;
    color: #555;
    line-height: 1.8;
}

.landing-footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: auto;
}

.landing-footer p {
    margin: 0;
}

/* Login Page Styles */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

html:has(.login-page) {
    zoom: 1;
    height: auto;
    min-height: 100%;
    overflow: auto;
}

body.login-page {
    min-height: 100dvh;
    overflow: auto;
    background:
        radial-gradient(900px 420px at 10% -10%, rgba(102, 126, 234, 0.18), transparent 60%),
        radial-gradient(700px 380px at 110% 110%, rgba(36, 48, 86, 0.12), transparent 55%),
        #eef1f8;
    color: #243056;
}

.login-shell {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 28px 20px 18px;
}

.login-card {
    display: grid;
    grid-template-columns: minmax(240px, 0.86fr) minmax(300px, 1.14fr);
    width: min(880px, 100%);
    background: #fff;
    border: 1px solid #e4e7f2;
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(36, 48, 86, 0.12);
    overflow: hidden;
}

.login-aside {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 10px;
    padding: 36px 32px;
    background:
        linear-gradient(160deg, rgba(102, 126, 234, 0.28), transparent 42%),
        #243056;
    color: #fff;
}

.login-page .login-brand-logo {
    width: 64px;
    height: 64px;
    max-height: none;
    margin: 0 0 8px;
    padding: 8px;
    object-fit: contain;
    background: #fff;
    border-radius: 14px;
}

.login-brand-name {
    margin: 0;
    color: #fff;
    font-size: 1.55rem;
    line-height: 1.25;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.login-aside-text {
    margin: 0;
    max-width: 26ch;
    color: #d5dcf0;
    font-size: 0.95rem;
    line-height: 1.45;
}

.login-panel {
    padding: 28px 32px 24px;
}

.login-panel-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.login-panel-top h2 {
    margin: 0;
    color: #243056;
    font-size: 1.35rem;
    line-height: 1.3;
    text-align: left;
}

.login-page .lang-switch {
    padding: 3px;
    background: #f3f5fb;
    border-radius: 999px;
}

.login-page .lang-switch .btn {
    min-width: 36px;
    padding: 4px 10px;
    border-radius: 999px;
    background: transparent;
    color: #5c6378;
    box-shadow: none;
}

.login-page .lang-switch .btn:hover {
    transform: none;
    background: transparent;
    color: #243056;
}

.login-page .lang-switch .btn.is-active,
.login-page .lang-switch .btn.is-active:hover {
    background: #fff;
    color: #243056;
    box-shadow: 0 1px 3px rgba(36, 48, 86, 0.12);
}

.login-page .alert {
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 14px;
    font-size: 0.88rem;
}

.login-field {
    margin-bottom: 14px;
}

.login-field label {
    display: block;
    margin-bottom: 6px;
    color: #5c6378;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.3;
}

.login-control {
    position: relative;
}

.login-field input {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1px solid #d5d9e6;
    border-radius: 10px;
    background: #fafbfe;
    color: #222;
    font: inherit;
    font-size: 0.95rem;
}

.login-field input:focus {
    outline: none;
    border-color: #667eea;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.16);
}

.login-control input {
    padding-right: 44px;
}

.login-reveal {
    position: absolute;
    top: 50%;
    right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #667;
    cursor: pointer;
    transform: translateY(-50%);
}

.login-reveal:hover {
    background: #eef1f8;
    color: #243056;
}

.login-reveal svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.login-reveal .is-hidden {
    display: none;
}

.login-submit {
    width: 100%;
    height: 44px;
    margin-top: 4px;
    border-radius: 10px;
    font-size: 0.95rem;
}

.login-page .login-submit:hover {
    transform: none;
    background: #5568d3;
}

.login-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
}

.login-meta a {
    color: #4d5bb5;
    font-size: 0.86rem;
    font-weight: 600;
    text-decoration: none;
}

.login-meta a:hover {
    text-decoration: underline;
}

.login-meta .login-text-btn {
    padding: 0;
    border: 0;
    background: none;
    color: #4d5bb5;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
}

.login-meta .login-text-btn:hover {
    text-decoration: underline;
}

.login-page .login-footer {
    width: min(880px, 100%);
    padding: 0;
    background: transparent;
    color: #8b90a3;
    text-align: center;
}

.login-page .login-footer p {
    margin: 0;
    font-size: 0.78rem;
}

.login-page .pwa-install {
    bottom: 16px;
}

body.login-page.pwa-ask-open .login-shell {
    justify-content: flex-start;
    padding-bottom: 220px;
}

@media (max-width: 760px) {
    .login-shell {
        justify-content: flex-start;
        padding: 16px 12px 12px;
    }

    .login-card {
        grid-template-columns: 1fr;
    }

    .login-aside {
        gap: 6px;
        padding: 18px 18px 16px;
    }

    .login-page .login-brand-logo {
        width: 48px;
        height: 48px;
        border-radius: 12px;
    }

    .login-brand-name {
        font-size: 1.2rem;
    }

    .login-aside-text {
        font-size: 0.86rem;
    }

    .login-panel {
        padding: 18px 16px 16px;
    }

    .login-panel-top h2 {
        font-size: 1.15rem;
    }

    .login-field input,
    .login-submit {
        font-size: 16px;
    }

    .login-meta {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }
}

.login-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

/* Login Footer */
.login-footer {
    background-color: rgba(0, 0, 0, 0.3);
    color: white;
    text-align: center;
    padding: 1rem 0;
}

.login-footer p {
    margin: 0;
    font-size: 0.9rem;
}

.login-box {
    background: white;
    padding: 2.5rem;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.login-box h2 {
    text-align: center;
    color: #667eea;
    margin-bottom: 1.5rem;
    font-size: 2rem;
}

.login-lang-switch {
    display: flex;
    justify-content: center;
    margin-top: 1.25rem;
}

.login-links {
    text-align: center;
    margin-top: 0.75rem;
}

.login-links + .login-links {
    margin-top: 1rem;
}

.login-links a {
    color: #667eea;
    text-decoration: none;
}

.login-box .logo {
    text-align: center;
    color: #667eea;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    overflow-wrap: anywhere;
    word-break: break-word;
}

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

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #333;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn-full {
    width: 100%;
    padding: 12px;
    margin-top: 1rem;
}

.alert {
    padding: 12px;
    border-radius: 5px;
    margin-bottom: 1rem;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Dashboard Styles */
.dashboard-container {
    min-height: 100vh;
    background-color: #f5f5f5;
    display: flex;
    flex-direction: column;
}

.dashboard-header {
    /* background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); */
    background: linear-gradient(135deg, #ff87b3 0%, #764ba2 100%);
    color: white;
    /* padding: 1rem 0; */
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* Dashboard Header Navigation Styles */
.topnav {
    padding: 6px 0;
}

.brand-and-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.portal-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.portal-brand-title {
    min-width: 0;
}

.brand-logo {
    height: 40px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
    background: #fff;
    border-radius: 4px;
}

.portal-brand h1,
.brand-and-toggle h1 {
    font-size: 1.5rem;
    margin: 0;
}

.settings-file-preview-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-top: 8px;
}

.settings-file-preview {
    max-width: 180px;
    max-height: 90px;
    object-fit: contain;
}

.login-brand-logo,
.landing-brand-logo {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 80px;
    margin: 0 auto 0.75rem;
    object-fit: contain;
}

.settings-letterhead-preview {
    max-width: 100%;
    max-height: 180px;
    object-fit: contain;
    border: 1px solid #e0e0e0;
    background: #fff;
}

.brand-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.notify-menu {
    position: relative;
}

.notify-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    cursor: pointer;
}

.notify-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #c62828;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

.notify-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 20;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    width: min(340px, calc(100vw - 20px));
    max-width: calc(100vw - 20px);
    min-width: 0;
    overflow: hidden;
    overscroll-behavior: contain;
    background: #fff;
    color: #333;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

.notify-panel[hidden] {
    display: none !important;
}

.notify-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 0 0 auto;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #e6e8f2;
}

.notify-panel-head strong {
    min-width: 0;
    font-size: 0.95rem;
    overflow-wrap: anywhere;
}

.notify-mark-all {
    border: 0;
    background: transparent;
    color: #3d4fa3;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

.notify-list {
    flex: 1 1 auto;
    min-height: 0;
    max-height: min(420px, 70vh);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.notify-empty {
    margin: 0;
    padding: 16px 12px;
    color: #777;
    font-size: 0.9rem;
}

.notify-item {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-bottom: 1px solid #eef0f6;
    background: #fff;
    color: #333;
    text-align: left;
    cursor: pointer;
}

.notify-item strong,
.notify-item small {
    display: block;
    overflow-wrap: anywhere;
}

.notify-item small {
    margin-top: 3px;
    color: #888;
    font-size: 0.75rem;
}

.notify-item.is-unread {
    background: #243056;
    color: #fff;
}

.notify-item.is-unread small {
    color: rgba(255, 255, 255, 0.75);
}

.nav-toggle {
    display: none;
    background: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.95rem;
    cursor: pointer;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    /* justify-content: space-between; */
}

.nav-menu .welcome {
    margin-right: 6px;
    color: #333;
    font-size: 0.85rem;
}

.nav-menu .btn {
    padding: 3px 6px;
    font-size: 1rem;
}

.nav-links,
.nav-links-a,
.nav-links-b {
    display: flex;
    /* align-items: center; */
    gap: 10px;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .portal-brand {
        flex: 1;
        overflow: hidden;
    }

    .portal-brand-title {
        flex: 1;
        overflow: hidden;
    }

    .portal-brand h1 {
        display: inline-block;
        white-space: nowrap;
        max-width: none;
    }

    .portal-brand.is-overflowing h1 {
        animation: portal-brand-scroll var(--brand-duration, 8s) ease-in-out infinite alternate;
    }

    .nav-toggle {
        display: inline-block;
        flex-shrink: 0;
    }

    .notify-badge {
        top: -4px;
        right: -2px;
    }

    .notify-panel {
        position: fixed;
        top: 58px;
        left: auto;
        right: 0;
        display: flex;
        flex-direction: column;
        width: 95%;
        max-width: 95%;
        max-height: calc(100vh - 70px);
    }

    .notify-panel[hidden] {
        display: none;
    }

    .notify-list {
        min-height: 0;
        max-height: none;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .notify-panel-head {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .notify-mark-all {
        white-space: normal;
        text-align: right;
    }
    
    .nav-menu {
        display: none;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding-top: 8px;
    }
    
    .nav-menu.open {
        display: flex;
    }

    .nav-menu .nav-welcome,
    .nav-menu .nav-links {
        width: 100%;
    }

    .nav-menu .nav-links {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px 10px;
    }

    .nav-menu .nav-links-a,
    .nav-menu .nav-links-b {
        display: flex;
        flex-direction: column;
        /* align-items: stretch; */
        gap: 10px;
        min-width: 0;
    }
    .nav-menu .nav-links-a {
        align-content: flex-start;
    }
    .nav-menu .nav-links-b {
        align-content: flex-end;
    }

    .nav-menu .nav-links .btn {
        display: block;
        /* width: 100%; */
        box-sizing: border-box;
        text-align: center;
    }

    .login-container {
        padding: 1rem;
    }

    .login-box {
        padding: 1.5rem;
    }

    .login-brand-logo,
    .landing-brand-logo {
        max-height: 64px;
    }
}

.expense-sheet { background: #fff; border: 1px solid #e6e8f2; border-radius: 8px; padding: 16px; }
.expense-sheet-kicker { color: #667eea; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.expense-sheet h4 { margin: 16px 0 8px; font-size: 0.95rem; }
.expense-sheet-table { width: 100%; border-collapse: collapse; }
.expense-sheet-table th,
.expense-sheet-table td { padding: 8px 0; border-bottom: 1px solid #eef0f6; vertical-align: top; text-align: left; }
.expense-sheet-table th { width: 130px; color: #666; font-weight: 600; }
.expense-sheet-amount { font-size: 1.15rem; }
.expense-sheet-description { white-space: pre-wrap; word-break: break-word; }
.expense-sheet-documents { display: flex; flex-direction: column; gap: 12px; }
.expense-sheet-document a { word-break: break-word; }
.expense-sheet-empty { margin: 0; color: #888; }
.expense-sheet .removed-badge { margin-bottom: 10px; }
.expense-photo-thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.expense-photo-thumb {
    flex: 0 0 auto;
    width: 72px;
    height: 72px;
    padding: 0;
    border: 1px solid #e6e8f2;
    border-radius: 6px;
    background: #f4f6fb;
    cursor: pointer;
    overflow: hidden;
}
.expense-photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.expense-photo-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.92);
}
.expense-photo-lightbox[hidden] { display: none; }
.expense-photo-lightbox img {
    display: block;
    max-width: calc(100vw - 140px);
    max-height: calc(100vh - 48px);
    object-fit: contain;
}
.expense-photo-lightbox-close,
.expense-photo-lightbox-nav {
    position: absolute;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.94);
    color: #222;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.expense-photo-lightbox-close { top: 16px; right: 16px; width: 40px; height: 40px; font-size: 28px; line-height: 1; }
.expense-photo-lightbox-nav { top: 50%; width: 44px; height: 44px; transform: translateY(-50%); font-size: 28px; line-height: 1; }
.expense-photo-lightbox-nav[data-expense-photo-step="-1"] { left: 16px; }
.expense-photo-lightbox-nav[data-expense-photo-step="1"] { right: 16px; }
.expense-photo-lightbox-nav[hidden] { display: none; }
#expenseViewModal .modal-header h3 { min-width: 0; overflow-wrap: anywhere; }
#expenseViewModal .close { flex: 0 0 auto; }

@media (max-width: 768px) {
    #expenseViewModal .modal-content {
        width: calc(100% - 1rem);
        max-width: none;
        margin: 0.5rem auto;
        padding: 0.85rem 0.75rem 1rem;
    }
    #expenseViewModal .modal-header { align-items: flex-start; gap: 8px; margin-bottom: 0.75rem; }
    #expenseViewModal .modal-header h3 { font-size: 1.05rem; line-height: 1.3; }
    #expenseViewModal .expense-sheet { padding: 10px; max-width: 100%; }
    #expenseViewModal .expense-sheet-table {
        width: 100% !important;
        min-width: 0 !important;
        table-layout: fixed;
    }
    #expenseViewModal .expense-sheet-table th { width: 5.5rem; }
    #expenseViewModal .expense-sheet-table td { overflow-wrap: anywhere; word-break: break-word; }
    .expense-photo-lightbox img { max-width: calc(100vw - 96px); }
}

@media (max-width: 480px) {
    #expenseViewModal .expense-sheet-table,
    #expenseViewModal .expense-sheet-table tbody,
    #expenseViewModal .expense-sheet-table tr,
    #expenseViewModal .expense-sheet-table th,
    #expenseViewModal .expense-sheet-table td {
        display: block;
        width: 100% !important;
        white-space: normal;
    }
    #expenseViewModal .expense-sheet-table th {
        padding-bottom: 0;
        border-bottom: none;
    }
    #expenseViewModal .expense-sheet-table td { padding-top: 2px; }
}

@keyframes portal-brand-scroll {
    from { transform: translateX(0); }
    to { transform: translateX(var(--brand-shift, 0px)); }
}

@media (prefers-reduced-motion: reduce) {
    .portal-brand.is-overflowing h1 {
        animation: none;
    }
}

.dashboard-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-nav h1 {
    font-size: 1.5rem;
}

.dashboard-nav .user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.dashboard-nav .btn {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.dashboard-content {
    padding: 0.5rem 0;
    flex: 1;
}

/* Dashboard Footer */
.dashboard-footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 0.25rem 0;
    margin-top: auto;
    /* position: sticky;
    bottom: 0; */
}
.login-wrapper .login-footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 0.25rem 0;
    margin-top: auto;
    position: sticky;
    bottom: 0;
}

.dashboard-footer p {
    margin: 0;
    font-size: 0.9rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.profile-container ~ .page-header {
    margin-bottom: 1rem;
}

.page-header h2 {
    color: #333;
    font-size: 2rem;
}

.lang-switch {
    display: flex;
    gap: 0.35rem;
    flex: 0 0 auto;
}

.lang-switch .btn {
    padding: 4px 12px;
    font-size: 0.8rem;
    background: #ccc;
    color: #333;
}

.lang-switch .btn.is-active {
    background: #667eea;
    color: #fff;
}

.password-lang-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.password-lang-bar h2 {
    margin: 0;
}

body.lang-bn {
    font-family: 'Nirmala UI', 'Kalpurush', 'Segoe UI', sans-serif;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    min-width: 0;
    max-width: 100%;
}

.dues-reminder-modal .modal-content {
    display: flex;
    flex-direction: column;
    max-width: 900px;
    max-height: 90vh;
    padding: 0;
    overflow: hidden;
}

.dues-reminder-modal .modal-header {
    margin-bottom: 0;
    padding: 16px 16px 12px;
}

.dues-preview-bar,
.dues-preview-foot {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #e6e8f2;
}

.dues-preview-foot {
    justify-content: flex-end;
    border-bottom: none;
    border-top: 1px solid #e6e8f2;
}

.dues-preview-bar label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    cursor: pointer;
}

.dues-message-options {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-left: auto;
}

#duesSelectedCount {
    color: #666;
}

#duesNoWhatsappEmpty {
    padding: 16px 16px 0;
}

.dues-current-note {
    margin: 0;
    padding: 10px 16px 0;
    color: #475569;
    font-size: 0.92rem;
}

#duesReminderList {
    flex: 1;
    overflow: auto;
    padding: 16px;
}

.dues-empty {
    text-align: center;
    color: #666;
    margin: 0;
}

.dues-recipient {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: #fafafa;
}

.dues-recipient.is-skipped {
    opacity: 0.72;
}

.dues-recipient-head {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.dues-recipient-body {
    flex: 1;
    min-width: 0;
}

.dues-recipient-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.35rem;
    flex-wrap: wrap;
}

.dues-recipient-meta span,
.dues-months,
.dues-skip-note,
.dues-char-count {
    color: #666;
}

.dues-months,
.dues-skip-note {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
}

.dues-recipient textarea {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 0.75rem;
    font-size: 0.9rem;
    line-height: 1.45;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 0;
    height: auto;
    overflow: hidden;
    resize: none;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-family: inherit;
}

.sms-template-editor {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sms-template-editor textarea {
    width: 100%;
    box-sizing: border-box;
    min-height: 0;
    overflow: hidden;
    resize: none;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    line-height: 1.45;
    font-family: inherit;
}

.sms-template-count {
    font-size: 0.8rem;
    margin-top: 0.25rem;
    color: #666;
}

.dues-char-count {
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.member-search {
    position: relative;
    flex: 1 1 220px;
    width: 100%;
    min-width: 0;
    max-width: 360px;
}

.member-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    width: 18px;
    height: 18px;
    transform: translateY(-50%);
    fill: #8b93b0;
    pointer-events: none;
}

.member-search input {
    width: 100%;
    min-width: 0;
    height: 42px;
    padding: 0 40px 0 42px;
    border: 1px solid #e4e7f1;
    border-radius: 999px;
    background: #fff;
    font-size: 0.95rem;
    color: #333;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.member-search input::placeholder {
    color: #98a0b8;
}

.member-search input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.16);
}

.member-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    width: 26px;
    height: 26px;
    transform: translateY(-50%);
    border: none;
    border-radius: 50%;
    background: #eef0f6;
    color: #5b6178;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

.member-search-clear:hover {
    background: #e2e5f0;
}

/* Table Styles */
.table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow-x: auto;
}

.table-container .dataTables_wrapper {
    padding: 12px 16px 16px;
}
.table-container .dataTables_length,
.table-container .dataTables_filter,
.table-container .dataTables_info,
.table-container .dataTables_paginate {
    margin: 8px 0;
    font-size: 0.9rem;
}
.table-container .dataTables_filter input,
.table-container .dataTables_length select {
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}
.table-container .dataTables_paginate .paginate_button {
    padding: 4px 8px !important;
    border-radius: 4px !important;
}
.table-container .dataTables_paginate .paginate_button.current {
    background: #667eea !important;
    color: #fff !important;
    border: 1px solid #5a6fd6 !important;
}
#smsLogsTable td.sms-log-message {
    white-space: normal;
    max-width: 420px;
    word-break: break-word;
}
#smsLogsTable td.sms-log-receipt {
    white-space: normal;
    max-width: 180px;
}
#expensesTable.dataTable tbody td,
#expensesTable tbody td,
#expenseReportTable.dataTable tbody td,
#expenseReportTable tbody td {
    vertical-align: top;
}
#expensesTable th.expense-title,
#expensesTable td.expense-title {
    width: 180px;
    min-width: 140px;
    max-width: 220px;
    white-space: normal;
    overflow-wrap: anywhere;
    vertical-align: top;
}
#expensesTable td.expense-amount {
    text-align: right;
    white-space: nowrap;
}

.members-page {
    height: 100vh;
    max-height: 100vh;
    overflow: clip;
}

.members-page .dashboard-content {
    min-height: 0;
    min-width: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: clip;
}

/* .members-page .dashboard-content > .container,
.donations-page .dashboard-content > .container {
    flex: 1;
    min-height: 0;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
} */
.dashboard-container .dashboard-content > .container {
    flex: 1;
    min-height: 0;
    min-width: 0;
    width: 100%;
    /* max-width: 100%; */
    /* all right reserved to IntechDigital (erfan.intech@gmail.com)*/
    max-width: 1351px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.members-page .dashboard-content > .container {
    overflow: clip;
}

.members-page .page-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    flex-shrink: 0;
    flex-wrap: wrap;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    container-type: inline-size;
}

.member-add-btn .member-add-icon {
    display: none;
}

.member-tools-toggle {
    display: none;
}

.member-header-tools {
    display: contents;
}

.member-tools-arrow {
    display: block;
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    margin-top: -4px;
}

.member-tools-toggle[aria-expanded="true"] .member-tools-arrow {
    transform: rotate(-135deg);
    margin-top: 4px;
}

.members-page .page-header h2 {
    flex: 0 1 auto;
    min-width: 0;
    margin: 0;
}

.members-page .table .hidden-member-col {
    display: none;
}

.members-page.show-invited-by .table .hidden-member-col {
    display: table-cell;
}

.member-name-link {
    padding: 0;
    border: 0;
    background: none;
    color: #3f51b5;
    font: inherit;
    font-weight: 600;
    font-size: 120%;
    white-space: normal;
    overflow-wrap: break-word;
    cursor: pointer;
    text-align: left;
}

.member-name-link:hover {
    text-decoration: underline;
}

.member-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
}

.member-trash-icon {
    font-size: 14px;
    line-height: 1;
}

.members-page .page-header > .btn {
    flex: 0 0 auto;
}

.members-page .page-header .member-search {
    margin-left: auto;
    flex: 1 1 220px;
    width: auto;
    max-width: 360px;
    min-width: 160px;
}

.members-page .table-container {
    flex: 1;
    min-height: 0;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    overflow: auto;
    overscroll-behavior: contain;
    overflow-y: auto;
    overscroll-behavior-y: auto;
    contain: paint;
}

.members-page .table {
    border-collapse: separate;
    border-spacing: 0;
}

.members-page .table td {
    padding: 5px;
}

.members-page .table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: #667eea;
}

.members-page .table thead th.sortable:hover {
    background-color: #667eea;
    background-image: linear-gradient(rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.12));
}

.members-page .table th.member-name-col,
.members-page .table td.member-name-col {
    min-width: 200px;
    white-space: normal;
    overflow-wrap: break-word;
}

.members-page .table td.member-name-col .member-name-link {
    display: inline;
    max-width: 100%;
}

.members-page .member-photo-name { display: none; }

/* Apply no-wrap to all tables across the codebase */
table th,
table td {
    white-space: nowrap;
}

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

.table thead {
    background-color: #667eea;
    color: white;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.table th.table-actions,
.table td.table-actions,
table.dataTable thead th.table-actions,
table.dataTable tbody td.table-actions {
    text-align: right;
}

.table td.table-actions > div {
    justify-content: flex-end;
}

.table th.sortable {
    cursor: pointer;
    user-select: none;
}

.table th.sortable:hover {
    background-color: rgba(255, 255, 255, 0.12);
}

.table th.sortable::after {
    content: ' \2195';
    font-size: 0.75em;
    opacity: 0.55;
}

.table th.sortable.sort-asc::after {
    content: ' \25B2';
    opacity: 1;
}

.table th.sortable.sort-desc::after {
    content: ' \25BC';
    opacity: 1;
}

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

table tbody tr.row-glow td {
    background-color: #efeaff !important;
    box-shadow: inset 0 0 14px rgba(102, 126, 234, 0.28);
    animation: row-glow 0.45s ease;
}

table tbody tr.row-glow td:first-child {
    box-shadow: inset 4px 0 0 #667eea, inset 0 0 14px rgba(102, 126, 234, 0.28);
}

@keyframes row-glow {
    from { background-color: #d9d2ff; }
    to { background-color: #efeaff; }
}

.row-name-tip {
    display: none;
    position: fixed;
    z-index: 40;
    max-width: min(240px, 72vw);
    padding: 4px 10px;
    border-radius: 6px;
    background: #3f51b5;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.2;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.row-name-tip.is-visible {
    display: block;
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 0.875rem;
}

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

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

.btn-edit {
    background-color: #28a745;
    color: white;
}

.btn-edit:hover {
    background-color: #218838;
}

.btn-warning {
    background-color: #ffc107;
    color: #000;
}

.btn-warning:hover {
    background-color: #e0a800;
}

.btn-success {
    background-color: #28a745;
    color: white;
}

.btn-success:hover {
    background-color: #218838;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-active {
    background-color: #d4edda;
    color: #155724;
}

.status-inactive {
    background-color: #f8d7da;
    color: #721c24;
}

.status-paid {
    background-color: #d4edda;
    color: #155724;
}

.status-unpaid {
    background-color: #fff3cd;
    color: #856404;
}

.payment-history-note {
    color: #666;
    font-size: 0.85rem;
    margin: 0 0 0.75rem;
}

.payment-history-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.payment-history-year {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #333;
    font-size: 0.85rem;
    font-weight: 600;
}

.payment-history-year select,
.year-select select {
    font: inherit;
    font-weight: 500;
    padding: 4px 8px;
    border: 1px solid #d5d9e6;
    border-radius: 6px;
    background: #fff;
    color: #222;
}

.year-select {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #333;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.payment-history-year-print {
    display: none;
}

.member-details-print-sheet .payment-history-year-print {
    display: inline;
}

.payment-row-unpaid {
    background-color: #fffdf5;
}

.payment-row-deactivated {
    background-color: #fafafa;
    color: #777;
}

.payment-row-receipt {
    cursor: pointer;
}

.payment-row-receipt:hover td {
    background: #eef2ff;
}

.receipt-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 16px;
    overflow-y: auto;
}

.receipt-overlay[hidden] {
    display: none;
}

.receipt-dialog {
    width: min(560px, 90%);
    margin: auto;
}

.receipt-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.28);
    color: #1e293b;
    /* font-size: 1.2rem; */
}

.receipt-head {
    display: flex;
    gap: 14px;
    align-items: center;
    background: #667eea;
    color: #fff;
    padding: 20px 22px;
}

.receipt-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    background: #fff;
    border-radius: 10px;
    flex: 0 0 auto;
}

.receipt-head h3 {
    margin: 0 0 4px;
    font-size: 1.55rem;
    color: #fff;
}

.receipt-head p,
.receipt-tagline {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.92);
}

.receipt-body {
    padding: 20px 22px 22px;
}

.receipt-title {
    text-align: center;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 1.2rem;
    color: #4338ca;
    margin-bottom: 16px;
}

.receipt-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    padding: 4px 0;
    border-bottom: 1px dashed #e2e8f0;
}

.receipt-row span {
    color: #64748b;
    flex: 0 0 auto;
}

.receipt-row strong {
    text-align: right;
    font-weight: 700;
    min-width: 0;
    overflow-wrap: anywhere;
    white-space: pre-line;
}

.receipt-note {
    padding: 12px 0;
    border-bottom: 1px dashed #e2e8f0;
}

.receipt-note span {
    color: #64748b;
    font-size: 1.05rem;
}

.receipt-note p {
    margin: 4px 0 0;
    font-size: 1rem;
    white-space: pre-line;
}

.receipt-amount {
    margin-top: 18px;
    background: #eef2ff;
    border-radius: 10px;
    padding: 16px;
    text-align: center;
}

.receipt-amount span {
    display: block;
    color: #64748b;
    font-size: 1.05rem;
}

.receipt-amount strong {
    display: block;
    font-size: 2.15rem;
    color: #3730a3;
    margin-top: 4px;
}

.receipt-thanks {
    text-align: center;
    color: #64748b;
    margin: 16px 0 0;
    font-size: 1.1rem;
}

.receipt-actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 8px;
    margin-top: 12px;
    margin-bottom: 12px;
}

.receipt-actions .btn {
    flex: 1 1 0;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 1.05rem;
    padding: 12px 10px;
}

.receipt-actions .receipt-close-btn {
    flex: 0 0 46px;
    padding: 12px 0;
    font-size: 1.7rem;
    line-height: 1;
}

.receipt-actions .btn:disabled {
    opacity: 0.65;
    cursor: wait;
    transform: none;
}

.receipt-actions .btn[hidden] {
    display: none;
}

.removed-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 8px 16px;
    border-radius: 999px;
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1;
}

.removed-badge[hidden] {
    display: none;
}

.receipt-actions .removed-badge {
    flex: 1 1 auto;
}

#viewMemberModal.is-removed .member-details-export-actions,
#viewMemberModal.is-removed .member-details-header-actions > .btn,
#viewMemberModal.is-removed .member-details-actions > .btn:not(.member-details-close) {
    display: none;
}

.receipt-sms-tick {
    color: #bbf7d0;
    font-size: 1.15em;
    line-height: 1;
}

.receipt-sms-tick[hidden] {
    display: none;
}

.receipt-sms-overlay {
    z-index: 1300;
    align-items: center;
}

.receipt-sms-dialog {
    width: min(440px, 100%);
}

.receipt-sms-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px 16px 18px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.28);
}

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

.receipt-sms-head h3 {
    margin: 0;
    font-size: 1.15rem;
    color: #1e293b;
}

.receipt-sms-close {
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
}

.receipt-sms-card label {
    display: block;
    margin: 10px 0 4px;
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 700;
}

.receipt-sms-member {
    font-weight: 700;
    color: #1e293b;
}

.receipt-sms-card input,
.receipt-sms-card textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #d5d9e6;
    border-radius: 8px;
    padding: 8px 10px;
    font: inherit;
}

.receipt-sms-card textarea {
    min-height: 120px;
    resize: vertical;
    font-family: 'Segoe UI', 'Nirmala UI', Arial, sans-serif;
    line-height: 1.5;
}

.receipt-sms-message-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.receipt-sms-message-head label {
    margin-bottom: 0;
}

.receipt-sms-langs {
    display: flex;
    gap: 6px;
}

.receipt-sms-langs .btn {
    min-width: 40px;
    padding: 4px 10px;
}

#sendReceiptSmsBtn {
    width: 100%;
    margin-top: 12px;
}

#sendReceiptSmsBtn:disabled {
    opacity: 0.65;
    cursor: wait;
}

.btn-whatsapp {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background-color: #25d366;
    color: #fff;
}

.btn-whatsapp:hover {
    background-color: #1ebe57;
    color: #fff;
}

.btn-whatsapp svg {
    width: 1.15em;
    height: 1.15em;
    fill: currentColor;
    flex: 0 0 auto;
}

@media (max-width: 640px) {
    .receipt-overlay {
        padding: 8px;
    }

    /* .receipt-card {
        font-size: 1.35rem;
    } */

    .receipt-head {
        padding: 18px 16px;
    }

    .receipt-logo {
        width: 64px;
        height: 64px;
    }

    .receipt-head h3 {
        font-size: 1.7rem;
    }

    .receipt-head p,
    .receipt-tagline {
        font-size: 1.15rem;
    }

    .receipt-body {
        padding: 18px 16px 20px;
    }

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

    .receipt-row {
        padding: 4px 0;
    }

    .receipt-note span,
    .receipt-amount span {
        font-size: 1.15rem;
    }

    .receipt-note p {
        font-size: 1rem;
    }

    .receipt-amount strong {
        font-size: 2.4rem;
    }

    .receipt-thanks {
        font-size: 1.2rem;
    }

    .receipt-actions .receipt-btn-label {
        display: none;
    }

    .receipt-actions .btn,
    .receipt-actions .receipt-close-btn {
        flex: 1 1 0;
        width: auto;
        padding: 12px 0;
        font-size: 1.15rem;
    }

    .receipt-actions .receipt-close-btn {
        font-size: 1.7rem;
        line-height: 1;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow-y: auto;
}

.modal-content {
    background-color: white;
    margin: 2% auto;
    padding: 2rem;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

#memberModal .modal-content {
    transform: translateZ(0);
}

/* Compact Password Modal */
.password-modal {
    padding: 1.25rem;
    max-width: 500px;
}

.password-modal .modal-header {
    margin-bottom: 1rem;
}

.password-modal .modal-header h3 {
    font-size: 1.25rem;
}

.password-modal .form-group {
    margin-bottom: 0.75rem;
}

.password-modal .form-group label {
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

.password-modal .form-group input {
    padding: 8px 12px;
    font-size: 0.95rem;
}

.password-modal .form-row {
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

/* Compact Member Modal */
.member-modal {
    padding: 1.25rem;
    max-width: 650px;
}

.member-modal .modal-header {
    margin-bottom: 1rem;
}

.member-modal .modal-header h3 {
    font-size: 1.25rem;
}

.member-modal .form-group {
    margin-bottom: 0.75rem;
}

.member-modal .form-group label {
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

#memberModal .form-group > label,
#memberModal .member-picker > label,
#memberModal .member-category-label {
    display: block;
    background: #ccccdb;
    padding: 4px 8px;
    border-radius: 4px;
}

.member-modal .form-group input,
.member-modal .form-group select,
.member-modal .form-group textarea {
    padding: 8px 12px;
    font-size: 0.95rem;
}

.member-modal .form-group textarea {
    padding: 8px 12px;
}

.member-modal .form-row {
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.member-category-label { display: block; margin-bottom: 0.4rem; font-weight: 600; }
.member-category-choices { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.member-category-choice { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.member-category-choice input { width: auto; margin: 0; }
.member-category-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.member-category-row input,
.member-category-add input { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid #ddd; border-radius: 6px; font: inherit; }
.member-category-row .btn,
.member-category-add .btn { flex: 0 0 auto; }
.member-category-row .btn:disabled,
.member-category-row .btn:disabled:hover { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.member-category-add { display: flex; gap: 8px; align-items: center; }
.members-by-type-modal { max-width: 920px; }
.members-by-type-search { max-width: none; margin-bottom: 12px; }
.members-by-type-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.member-type-chip.is-selected,
.member-type-chip.is-selected:hover { background: #667eea; color: #fff; border-color: #5a6fd6; }
.member-type-section { margin-bottom: 16px; }
.member-type-section h4 { margin: 0 0 8px; color: #667eea; }
.members-by-type-table-wrap { max-height: 60vh; overflow: auto; }
.member-type-phone { color: #666; font-size: 0.85rem; font-weight: 400; }
.members-by-type-modal .member-category-choices { gap: 6px 12px; }

.member-modal .photo-preview {
    max-width: 120px;
    max-height: 120px;
    margin-top: 8px;
}

.member-modal .photo-preview-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.phone-numbers-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
}

.phone-number-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.phone-primary {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: #444;
    white-space: nowrap;
}

.phone-primary input {
    width: auto;
    margin: 0;
}

.phone-primary-tag {
    color: #667eea;
    font-size: 0.75rem;
    font-weight: 700;
}

.phone-number-row input[type="tel"] {
    flex: 1;
    min-width: 140px;
}

.member-modal .field-hint {
    margin: 6px 0 0;
    font-size: 0.8rem;
    color: #666;
}

.member-phones {
    display: flex;
    flex-direction: column;
    gap: 0;
    line-height: 1.25;
}

.member-phones a,
.member-phones span,
.member-card-grid strong .member-phones a,
.member-card-grid strong .member-phones span {
    color: #000;
    font-weight: 400;
    text-decoration: none;
}

.member-phones .phone-primary-number,
.member-card-grid strong .member-phones .phone-primary-number {
    font-weight: 700;
}

.member-phones a:hover {
    text-decoration: underline;
}

/* Compact Donation Modal */
.donation-modal {
    padding: 1.25rem;
    max-width: 760px;
}

.month-year-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.45rem;
}

.month-year-bar label {
    margin: 0;
}

.donation-modal .month-year-bar input {
    width: 110px;
    margin: 0;
}

.month-entry-wrap {
    max-height: 240px;
    overflow: auto;
    border: 1px solid #e4e7f1;
    border-radius: 8px;
    background: #fafbff;
}

.month-entry-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.month-entry-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #eef0fb;
    color: #667eea;
    font-size: 0.75rem;
    text-align: left;
    padding: 0.4rem 0.5rem;
}

.month-entry-table td {
    padding: 0.3rem 0.45rem;
    border-top: 1px solid #e6e8f0;
    vertical-align: middle;
    white-space: nowrap;
}

.month-entry-table tr.is-paid td {
    color: #98a0b8;
}

.month-checks-empty {
    margin: 0;
    color: #667;
    font-size: 0.85rem;
}

.month-check {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    font-size: 0.82rem;
    font-weight: 500;
}

.donation-modal .month-check input {
    width: auto;
    margin: 0;
    padding: 0;
}

.month-check.is-paid {
    color: #98a0b8;
}

.month-check em {
    font-style: normal;
    font-size: 0.68rem;
    color: #dc3545;
}

.donation-modal .month-entry-table input[type="number"],
.donation-modal .month-entry-table input[type="text"],
.donation-modal .month-entry-table input[type="date"] {
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 6px 8px;
    box-sizing: border-box;
}

.month-entry-table .month-amount-col {
    width: 110px;
}

.month-entry-table .month-date-col {
    width: 9.5rem;
}

.month-entry-table .month-note-col {
    width: 34%;
}

@media (max-width: 768px) {
    .modal-content table {
        width: max-content !important;
        min-width: 100%;
    }

    .month-entry-table .month-amount-col,
    .month-entry-table td:nth-child(2) {
        width: 110px;
        min-width: 110px;
    }

    .month-entry-table .month-date-col,
    .month-entry-table td:nth-child(3) {
        width: 9.5rem;
        min-width: 9.5rem;
    }

    .month-entry-table .month-note-col,
    .month-entry-table td:nth-child(4) {
        width: 9rem;
        min-width: 9rem;
    }
}

#donationModal {
    z-index: 1100;
}

.member-picker { position: relative; }
.member-suggestions { position: absolute; left: 0; right: 0; top: 100%; z-index: 20; margin: 2px 0 0; padding: 4px 0; list-style: none; max-height: 240px; overflow-y: auto; background: #fff; border: 1px solid #d5d9e6; border-radius: 4px; box-shadow: 0 6px 18px rgba(0,0,0,0.15); }
.member-suggestions li { padding: 6px 10px; cursor: pointer; font-size: 0.92rem; }
.member-suggestions li small { display: block; color: #777; font-size: 0.78rem; }
.member-suggestions li.is-active,
.member-suggestions li:hover { background: #eef0fb; }
.member-suggestions li.is-selected { font-weight: 600; }
.member-suggestions li.member-suggestions-empty { color: #777; cursor: default; background: transparent; }
.donation-modal .member-picker input.is-locked {
    background: #f3f4f8;
    cursor: default;
}

.donation-modal .modal-header {
    margin-bottom: 1rem;
}

.donation-modal .modal-header h3 {
    font-size: 1.25rem;
}

.donation-modal .form-group {
    margin-bottom: 0.75rem;
}

.donation-modal .form-group label {
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

.donation-modal .form-group input,
.donation-modal .form-group select {
    padding: 8px 12px;
    font-size: 0.95rem;
}

.member-picker-field {
    position: relative;
}

.member-picker-field > input {
    width: 100%;
    box-sizing: border-box;
    padding-right: 32px;
}

.member-modal .member-picker-field > input,
.donation-modal .member-picker-field > input {
    padding-right: 32px;
}

.member-picker-clear {
    position: absolute;
    right: 6px;
    top: 50%;
    width: 22px;
    height: 22px;
    transform: translateY(-50%);
    border: none;
    border-radius: 50%;
    background: #eef0f6;
    color: #5b6178;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    cursor: pointer;
}

.member-picker-clear:hover {
    background: #e2e5f0;
}

.member-picker-clear[hidden] {
    display: none;
}

.donation-modal .form-row {
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.donation-modal #sms_message {
    font-family: 'Segoe UI', 'Nirmala UI', 'Kalpurush', Arial, sans-serif;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.donation-modal .btn-sm {
    min-width: 40px;
}

.sms-message-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    /* gap: 0.5rem; */
    margin-bottom: 0.5rem;
}
.sms-message-label {
    font-size: 1rem !important;
    background-color: #f1bda0 !important;
    padding: 2px 5px !important;
    border-radius: 6px !important;
}

.sms-message-bar > label {
    margin-bottom: 0;
}

.sms-message-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-end;
}

.sms-message-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.donation-modal .send-sms-toggle {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
}

.donation-modal .send-sms-toggle input {
    width: auto;
    margin: 0;
    padding: 0;
}

#smsCharCount {
    font-size: 0.85rem;
    color: #666;
    font-weight: 500;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .donation-modal .sms-message-tools {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 0.25rem;
    }

    .donation-modal .sms-message-actions {
        order: 1;
    }

    .donation-modal #smsCharCount {
        order: 2;
    }
}

/* View Member Modal Styles */
#memberDetails {
    max-height: 70vh;
    overflow-y: auto;
}

.member-details-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.member-details-export-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.member-details-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
    justify-content: flex-end;
}

.member-details-close-icon {
    display: none;
}

@media (max-width: 768px) {
    #viewMemberModal .modal-content {
        position: relative;
        width: calc(100% - 1rem);
        margin: 0.5rem auto;
        padding: 0.45rem 0.6rem 1rem;
    }

    #viewMemberModal .modal-header {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: start;
        column-gap: 0.5rem;
        row-gap: 0.35rem;
        margin-bottom: 0.75rem;
    }

    #viewMemberModal .modal-header h3 {
        grid-column: 1;
        grid-row: 1;
        margin: 0.1rem 0 0;
        font-size: 1.2rem;
    }

    #viewMemberModal .member-details-header-actions {
        display: contents;
    }

    #viewMemberModal .member-details-header-actions .close {
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
        align-self: start;
        margin: -0.15rem -0.15rem 0 0;
        padding: 0;
        line-height: 1;
        font-size: 1.85rem;
    }

    #viewMemberModal .member-details-export-actions {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-content: flex-end;
        gap: 0.4rem;
    }

    .member-details-header-actions .btn:not(.member-export-btn) {
        display: none;
    }

    .member-details-header-actions .member-export-btn {
        display: inline-flex;
        align-items: center;
        padding: 6px 8px;
        font-size: 0.75rem;
    }

    .member-details-actions {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: stretch;
        justify-content: stretch;
        gap: 0.4rem;
    }

    .member-details-actions .btn {
        flex: 1 1 0;
        width: auto;
        min-width: 0;
        padding: 8px 6px;
        font-size: 0.75rem;
        line-height: 1.2;
        white-space: normal;
        text-align: center;
    }

    .member-details-actions .member-details-close {
        flex: 0 0 36px;
        width: 36px;
        min-width: 36px;
        padding: 0;
        font-size: 1.5rem;
        line-height: 1;
    }

    .member-details-close-label {
        display: none;
    }

    .member-details-close-icon {
        display: block;
    }
}

#memberDetails strong {
    font-weight: 600;
    color: #667eea;
}

#memberDetails span:not(.status-badge) {
    color: #333;
    word-break: break-word;
}

#memberDetails img {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.member-details-header-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.member-details-print-sheet {
    display: none;
    position: absolute;
    left: -12000px;
    top: 0;
    width: 190mm;
    background: #fff;
    color: #222;
    padding: 0 0 8px;
}

.member-print-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 2px;
}

.member-print-org { text-align: left; min-width: 0; }
.member-print-meta { margin-left: auto; text-align: right; flex: 0 0 auto; }
.member-print-head h1 { margin: 0; font-size: 16pt; color: #222; }
.member-print-head h2 { margin: 0; font-size: 13pt; color: #222; }
.member-print-head p { margin: 0; font-size: 9pt; color: #333; }
.member-print-meta p { white-space: nowrap; }

.member-details-print-sheet .member-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    gap: 12px;
}

.member-details-print-sheet .member-card-identity {
    flex: 1 1 auto;
    min-width: 0;
    text-align: left;
}

.member-details-print-sheet .member-card-photo {
    order: 2;
    margin-left: auto;
    flex: 0 0 auto;
}

.member-details-print-sheet .member-card-name,
.member-details-print-sheet .member-card-meta {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    margin-top: 0;
}

.member-details-print-sheet .member-card-name {
    margin-right: 0.55rem;
}

.member-details-print-sheet .member-print-bn {
    display: inline;
    font-family: 'Nirmala UI', 'Kalpurush', 'Segoe UI', sans-serif;
    font-weight: 600;
}

.member-details-print-sheet .member-card-identity .member-print-info {
    width: 100%;
    margin-top: 4px;
    border-collapse: collapse;
    table-layout: auto;
    font-size: 9pt;
}

.member-details-print-sheet .member-card-identity .member-print-info th,
.member-details-print-sheet .member-card-identity .member-print-info td {
    width: auto;
    font-size: 9pt;
    font-weight: 400;
    line-height: 1.35;
    padding: 1px 6px !important;
    text-align: left;
    vertical-align: top;
    white-space: normal;
}

.member-details-print-sheet .member-card-identity .member-print-info th {
    width: 1%;
    font-weight: 700;
    color: #333;
    white-space: nowrap;
    background: #eef0f6 !important;
}

.member-details-print-sheet .member-card-identity .member-print-info td {
    color: #222;
}

.member-details-print-sheet .member-card-identity .member-print-info a,
.member-details-print-sheet .member-card-identity .member-print-info span,
.member-details-print-sheet .member-card-identity .member-print-info .phone-primary-number {
    color: #222;
    font-size: 9pt;
    font-weight: 400;
    line-height: 1.35;
    text-decoration: none;
}

.member-details-print-sheet .member-print-contact {
    margin: 3px 0 0;
    color: #222;
    font-size: 9pt;
    font-weight: 400;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.member-details-print-sheet .member-print-contact a,
.member-details-print-sheet .member-print-contact span,
.member-details-print-sheet .member-print-contact .phone-primary-number {
    color: #222;
    font-size: 9pt;
    font-weight: 400;
    line-height: 1.35;
    text-decoration: none;
}

.member-details-print-sheet .member-print-contact .member-print-contact-label {
    font-weight: 700;
    color: #333;
    font-size: 9pt;
}

.member-details-print-sheet .member-card-identity .member-phones {
    display: inline;
}

.member-details-print-sheet .member-card-identity .member-phones a,
.member-details-print-sheet .member-card-identity .member-phones span {
    display: inline;
    white-space: normal;
}

.member-details-print-sheet .member-card-identity .member-phones a + a::before,
.member-details-print-sheet .member-card-identity .member-phones a + span::before,
.member-details-print-sheet .member-card-identity .member-phones span + a::before,
.member-details-print-sheet .member-card-identity .member-phones span + span::before {
    content: ", ";
}

.member-details-print-sheet .member-card {
    border: none;
    box-shadow: none;
    background: transparent;
    border-radius: 0;
    padding: 0;
    margin-bottom: 12px;
}

.member-details-print-sheet .member-print-columns {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
}

.member-details-print-sheet .member-print-columns .member-print-info {
    flex: 1 1 0;
    width: 0;
    min-width: 0;
    table-layout: fixed;
}

.member-details-print-sheet .member-print-info th {
    width: 50%;
    text-align: left;
    vertical-align: top;
    background: #eef0f6 !important;
    color: #333;
    font-weight: 600;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.member-details-print-sheet .member-print-info td {
    width: 50%;
    text-align: left;
    vertical-align: top;
    color: #222;
    padding-left: 4px;
    padding-right: 12px;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.member-details-print-sheet .member-print-info .member-phones,
.member-details-print-sheet .member-print-info .member-phones a,
.member-details-print-sheet .member-print-info .member-phones span {
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.member-details-print-sheet .member-print-address {
    width: 100%;
    margin-top: 0;
    table-layout: fixed;
}

.member-details-print-sheet .member-print-address th {
    width: 25%;
}

.member-details-print-sheet .member-print-address td {
    width: 75%;
}

.member-details-print-sheet .member-print-info td strong {
    color: #222;
    font-weight: 600;
}

.member-details-print-table {
    width: 100%;
    border-collapse: collapse;
}

.member-details-print-table > thead {
    display: table-header-group;
}

.member-details-print-table > tbody {
    display: table-row-group;
}

.member-details-print-table > thead > tr,
.member-details-print-table > tbody > tr {
    break-inside: avoid;
    page-break-inside: avoid;
}

.member-details-print-table > tbody > tr.member-print-flow {
    break-inside: auto;
    page-break-inside: auto;
}

.member-details-print-sheet .member-details-print-table > tbody > tr.member-print-flow > td.member-print-cell {
    padding-top: 10px !important;
}

.member-details-print-sheet .member-print-history thead {
    display: table-header-group;
}

.member-details-print-sheet .member-print-history tr {
    break-inside: avoid;
    page-break-inside: avoid;
}

.member-details-print-sheet .member-print-history-caption th {
    border: none !important;
    background: transparent !important;
    color: #667eea !important;
    font-size: 1em;
    font-weight: 700;
    text-align: left !important;
    padding: 0 0 4px !important;
}

.member-details-print-sheet .member-print-banner,
.member-details-print-sheet .member-print-cell {
    border: none !important;
    background: #fff !important;
    text-align: left !important;
    padding: 0 !important;
}

.member-details-print-sheet .member-print-banner {
    padding: 0 !important;
}

.member-details-print-sheet .member-print-info th,
.member-details-print-sheet .member-print-info td,
.member-details-print-sheet .member-print-line th,
.member-details-print-sheet .member-print-line td {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.member-details-print-sheet .member-print-line {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    table-layout: fixed;
}

.member-details-print-sheet .member-print-line th,
.member-details-print-sheet .member-print-line td,
.member-details-print-sheet .member-print-line .status-badge {
    white-space: nowrap !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
    vertical-align: top;
}

.member-details-print-sheet .member-print-line .status-badge {
    padding: 0 6px;
}

.member-details-print-sheet .member-card,
.member-details-print-sheet table {
    break-inside: auto;
}

.member-details-print-sheet table {
    width: 100%;
    border-collapse: collapse;
}

.member-details-print-sheet th,
.member-details-print-sheet td {
    border: 1px solid #ddd;
}

.member-details-print-sheet .status-badge,
.member-details-print-sheet .member-card {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

@media print {
    body.print-member-details .dashboard-container,
    body.print-member-details .modal,
    body.print-member-details .receipt-overlay,
    body.print-member-details .ledger-print-sheet {
        display: none !important;
    }

    body.print-member-details .member-details-print-sheet {
        display: block !important;
        position: static !important;
        left: auto !important;
        width: auto !important;
        z-index: auto !important;
        background: #fff !important;
    }

    body.print-member-details .member-details-print-table > thead,
    body.print-member-details .member-print-history thead {
        display: table-header-group !important;
    }
}

.member-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    background: #fff;
    border: 1px solid #e6e8f0;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(16, 24, 40, 0.06);
}

.member-card-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.member-card-photo {
    width: 64px;
    height: 64px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid #e6e8f0;
}

#memberDetails .member-card-photo,
.member-details-print-sheet .member-card-photo {
    width: 96px;
    height: 96px;
}

.member-card-name {
    margin: 0;
    font-size: 1.05rem;
    color: #222;
}

.member-card-name-bn,
.member-bn-line {
    display: block;
    margin-top: 0.15rem;
    color: #222;
    font-family: 'Nirmala UI', 'Kalpurush', 'Segoe UI', sans-serif;
    font-weight: 600;
    line-height: 1.35;
}

.member-card-name-bn {
    margin: 0.15rem 0 0;
    font-size: 1rem;
}

.member-category-line {
    margin: 0.2rem 0 0;
    color: #444;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.35;
}

.member-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.65rem;
    margin-top: 0.25rem;
    color: #667;
    font-size: 0.8rem;
}

.member-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.45rem;
}

.member-card-grid > div {
    min-width: 0;
    padding: 0.4rem 0.55rem;
    background: #f7f8fc;
    border-radius: 8px;
}

.member-card-grid span {
    display: block;
    margin-bottom: 0.1rem;
    color: #667eea;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.member-card-grid strong {
    display: block;
    color: #222;
    font-size: 0.88rem;
    font-weight: 600;
    word-break: break-word;
}

.member-card-grid strong a,
.invited-members-list a {
    color: #3f51b5;
    font-weight: 600;
    text-decoration: none;
}

.member-card-grid strong a:hover,
.invited-members-list a:hover {
    text-decoration: underline;
}

.invited-members-list {
    margin: 0.2rem 0 0;
    padding-left: 1.25rem;
    color: #222;
    font-size: 0.88rem;
    font-weight: 600;
}

.invited-members-list li + li {
    margin-top: 0.15rem;
}

.member-card-wide {
    grid-column: 1 / -1;
}

.member-card-wide strong {
    white-space: pre-wrap;
}

.invite-panel {
    margin-top: 0.45rem;
    padding: 0.45rem 0.55rem;
    background: #f7f8fc;
    border-radius: 8px;
}

.invite-panel summary {
    cursor: pointer;
    color: #667eea;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.invite-panel-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem;
    margin-top: 0.45rem;
}

.invite-panel-body > div {
    min-width: 0;
    padding: 0.4rem 0.55rem;
    background: #fff;
    border-radius: 8px;
}

.invite-panel-body span {
    display: block;
    margin-bottom: 0.1rem;
    color: #667eea;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.invite-panel-body strong {
    display: block;
    color: #222;
    font-size: 0.88rem;
    font-weight: 600;
    word-break: break-word;
}

@media (max-width: 768px) {
    .invite-panel-body {
        grid-template-columns: 1fr;
    }
}

#memberDetails .member-card-grid span,
#memberProfile .member-card-grid span {
    color: #667eea;
}

#memberDetails .member-card-grid strong,
#memberProfile .member-card-grid strong {
    color: #222;
}

#memberDetails .member-card-meta,
#memberProfile .member-card-meta {
    color: #667;
}

@media (max-width: 768px) {
    .member-card-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    color: #667eea;
    font-size: 1.5rem;
}

.close {
    font-size: 2rem;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    border: none;
    background: none;
}

.close:hover {
    color: #000;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
}

.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    background-color: white;
}

.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.photo-preview {
    max-width: 150px;
    max-height: 150px;
    border-radius: 8px;
    margin-top: 10px;
    object-fit: cover;
}

/* Profile Styles */
.profile-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 1.5rem;
    max-width: 900px;
    margin: 0 auto;
}

.profile-section {
    padding-bottom: 0;
    margin-bottom: 0;
    border-bottom: none;
}

.profile-section h3 {
    color: #667eea;
    margin-bottom: 1rem;
    font-size: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #667eea;
}

.profile-section .form-group {
    margin-bottom: 0.75rem;
}

.profile-section .form-group label {
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

.profile-section .form-group input {
    padding: 8px 12px;
    font-size: 0.95rem;
}

.profile-section small {
    font-size: 0.75rem;
}

.profile-section .form-row {
    gap: 1rem;
    margin-bottom: 0.5rem;
}
.filters, .ledger-filters{
    background-color: #9df1d1;
}

/* Shared page filters: labels above controls, fields on the left, buttons on the right.
   Small screens collapse the bar and place each label beside its control. */
.page-filters-toggle { display: none; }
.page-filters .filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px 12px;
    margin-bottom: 12px;
    padding: 8px 10px;
    border-radius: 8px;
}
.page-filters .filter-field {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 3px;
    min-width: 0;
}
.page-filters .filter-field > label {
    display: block;
    margin: 0;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    color: #3d4458;
    white-space: nowrap;
}
.page-filters .filter-field input,
.page-filters .filter-field select {
    height: 30px;
    box-sizing: border-box;
    margin: 0;
    padding: 2px 8px;
    border: 1px solid #c5cad8;
    border-radius: 4px;
    background: #fff;
    color: #222;
    font-size: 0.85rem;
}
.page-filters .filter-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}
.page-filters .filter-actions > .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 30px;
    padding: 0 12px;
    font-size: 0.85rem;
    line-height: 1;
}
.page-filters .filter-member-picker { min-width: 220px; z-index: 5; }
.page-filters .filter-member-picker:focus-within { z-index: 30; }
.page-filters .filter-member-picker input[type="text"] {
    width: 100%;
    min-width: 220px;
    box-sizing: border-box;
    padding: 2px 28px 2px 8px;
}
@media (max-width: 768px) {
    .page-filters { 
        margin-bottom: 8px; 
        background: #fff; 
        border: 1px solid #e6e8f2; 
        border-radius: 8px; 
    }
    .page-filters-toggle {
        display: flex;
        width: 100%;
        align-items: center;
        justify-content: space-between;
        padding: 6px 10px;
        border: none;
        background: #ee424263;
        font-size: 0.82rem;
        font-weight: 600;
        color: #333;
        cursor: pointer;
        border-top-left-radius: inherit;
        border-top-right-radius: inherit;
    }
    .page-filters-toggle::after {
        content: "";
        width: 7px;
        height: 7px;
        border-right: 2px solid #667;
        border-bottom: 2px solid #667;
        transform: rotate(45deg);
        margin-top: -3px;
    }
    .page-filters:not(.is-collapsed) .page-filters-toggle::after {
        transform: rotate(-135deg);
        margin-top: 3px;
    }
    .page-filters.is-collapsed .filters { display: none; }
    .page-filters .filters {
        display: flex;
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
        gap: 0;
        margin: 0;
        padding: 0 8px 4px;
        /* background: transparent; */
        background: #ddbdbd6b;
        border-bottom-left-radius: inherit;
        border-bottom-right-radius: inherit;

    }
    .page-filters .filter-field {
        display: grid;
        grid-template-columns: 5rem minmax(0, 1fr);
        align-items: center;
        column-gap: 6px;
        min-width: 0;
        /* padding: 3px 0; */
        padding: 1px 0;
        border-top: 1px solid #eef0f4;
    }
    .page-filters .filter-field:first-child { border-top: none; }
    .page-filters .filter-field > label {
        margin: 0;
        font-size: 0.72rem;
        font-weight: 600;
        color: #5c6378;
        line-height: 1.1;
        white-space: nowrap;
    }
    .page-filters .filter-field input,
    .page-filters .filter-field select {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        height: 26px;
        box-sizing: border-box;
        margin: 0;
        padding: 1px 6px;
        border: 1px solid #d8dce8;
        border-radius: 4px;
        background: #fafbfe;
        color: #222;
        font-size: 0.75rem;
    }
    .page-filters .filter-member-picker { min-width: 0; }
    .page-filters .filter-member-picker input[type="text"] { min-width: 0; padding-right: 22px; }
    .page-filters .member-picker-field { min-width: 0; }
    .page-filters .member-picker-clear { width: 16px; height: 16px; right: 4px; font-size: 0.8rem; }
    .page-filters .filter-actions {
        order: 1;
        justify-content: flex-end;
        width: 100%;
        margin: 0;
        padding: 2px 0;
    }
    .page-filters .filter-actions > .btn {
        height: 24px;
        padding: 0 8px;
        font-size: 0.72rem;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .filter-button-row > .btn,
    .year-controls .btn {
        padding: 4px 8px;
        font-size: 0.78rem;
        min-height: 28px;
        line-height: 1;
    }
    .year-select {
        font-size: 0.78rem;
    }
    .year-select select {
        min-height: 28px;
        padding: 4px 8px;
    }
    .year-nav {
        min-width: 28px;
        padding-left: 6px;
        padding-right: 6px;
    }
    .year-nav i {
        font-size: 0.75rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .page-header h2 {
        font-size: 1.4rem;
    }

    .members-page .page-header {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }

    .member-profile-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
    }

    .member-profile-header h2 {
        flex: 1 1 auto;
        min-width: 0;
        font-size: 1.25rem;
    }

    .member-profile-header .lang-switch {
        margin-left: auto;
    }

    .members-page .page-header h2 {
        flex: 1 1 auto;
        font-size: 1.15rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .members-page .page-header > .btn {
        flex: 0 1 auto;
        min-width: 0;
        padding: 6px 10px;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    .members-page .page-header .member-search {
        flex: 1 0 100%;
        width: 100%;
        max-width: none;
        min-width: 0;
        margin-left: 0;
    }

    .members-page .page-header > .member-tools-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
        width: 32px;
        height: 32px;
        min-width: 32px;
        padding: 0;
        font-size: 0;
    }

    .members-page .member-header-tools {
        display: none;
        flex: 1 0 100%;
        flex-direction: column;
        gap: 8px;
    }

    .members-page .member-header-tools.is-open {
        display: flex;
    }

    .members-page .member-header-tools .btn {
        width: 100%;
        padding: 8px 10px;
        font-size: 0.9rem;
    }
    
    .table {
        font-size: 0.875rem;
    }
    
    .modal-content {
        width: 95%;
        padding: 1.5rem;
    }
    
    .dashboard-nav .user-info {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .profile-container {
        padding: 1.5rem;
    }

    .members-page .table th.member-photo-col,
    .members-page .table td.member-photo-col {
        position: sticky;
        left: 0;
        z-index: 1;
        min-width: 64px;
        background-color: #fff;
        box-shadow: 2px 0 0 #e6e8f2;
    }

    .members-page .table thead th.member-photo-col {
        z-index: 4;
        background-color: #667eea;
    }

    .members-page .table tbody tr:hover td.member-photo-col {
        background-color: #f8f9fa;
    }

    .members-page .table tbody tr.row-glow td.member-photo-col {
        background-color: #efeaff !important;
    }

    .members-page .member-photo-empty { color: #999; }
    .members-page .member-photo-name { display: none; }

    .members-page.photo-col-stuck .table td.member-photo-col {
        width: 76px;
        max-width: 76px;
        white-space: normal;
    }

    .members-page.photo-col-stuck .member-photo-empty { display: none; }

    .members-page.photo-col-stuck .member-photo-name {
        display: block;
        max-width: 72px;
        color: #333;
        font-size: 0.68rem;
        font-weight: 600;
        line-height: 1.15;
        white-space: normal;
        overflow-wrap: anywhere;
    }
}

@container (max-width: 480px) {
    .members-page .page-header > .member-add-btn .member-add-label {
        display: none;
    }

    .members-page .page-header > .member-add-btn .member-add-icon {
        display: block;
        line-height: 1;
    }

    .members-page .page-header > .member-add-btn {
        flex: 0 0 auto;
        width: 36px;
        height: 36px;
        padding: 0;
        font-size: 1.5rem;
        line-height: 1;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .members-page .page-header > .member-tools-toggle {
        width: 36px;
        height: 36px;
        min-width: 36px;
    }
}

.backup-wait {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.55);
}

.backup-wait[hidden] {
    display: none !important;
}

body.backup-wait-open {
    overflow: hidden;
}

.backup-wait-card {
    width: min(420px, 100%);
    background: #fff;
    border-radius: 12px;
    padding: 28px 24px;
    text-align: center;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

.backup-wait-spinner {
    width: 46px;
    height: 46px;
    margin: 0 auto 16px;
    border: 4px solid #e6e9f5;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: backup-wait-spin 0.8s linear infinite;
}

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

.backup-wait-text {
    margin: 0;
    color: #1f2937;
    font-size: 16px;
    line-height: 1.5;
}

