:root {
    --bg: #eef2f7;
    --surface: #ffffff;
    --surface-soft: #f7f9fc;
    --text: #172033;
    --muted: #667085;
    --heading: #0f766e;
    --heading-soft: #475467;
    --border: #d9e0ea;
    --primary: #0f766e;
    --primary-dark: #115e59;
    --primary-soft: #d9f3ef;
    --accent: #b7791f;
    --accent-soft: #fff4d8;
    --danger: #c2410c;
    --danger-soft: #ffedd5;
    --shadow: 0 14px 38px rgba(20, 31, 48, 0.11);
    --sidebar-width: 260px;
}

* {
    box-sizing: border-box;
    font-family: inherit;
}

html {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
    font-size: 14px;
    letter-spacing: 0;
    max-width: 100%;
    overflow-x: hidden;
}

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

body.dark {
    --bg: #111827;
    --surface: #1f2937;
    --surface-soft: #263244;
    --text: #f3f4f6;
    --muted: #b9c0cc;
    --heading: #5eead4;
    --heading-soft: #cbd5e1;
    --border: #374151;
    --primary: #2dd4bf;
    --primary-dark: #14b8a6;
    --primary-soft: rgba(45, 212, 191, 0.16);
    --accent: #fbbf24;
    --accent-soft: rgba(251, 191, 36, 0.14);
    --danger: #fb923c;
    --danger-soft: rgba(251, 146, 60, 0.14);
    --shadow: 0 16px 42px rgba(0, 0, 0, 0.28);
}

body.landing-page {
    display: block;
    padding: 0;
}

.login-split {
    display: grid;
    grid-template-columns: 40% 60%;
    min-height: 100vh;
}

.login-form-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 48px;
    background: var(--surface);
}

.login-language-toggle {
    position: absolute;
    top: 24px;
    right: 24px;
}

.login-logo-small {
    width: 86px;
    height: 86px;
    margin-bottom: 24px;
    border-radius: 8px;
    object-fit: cover;
}

.login-form-panel h1 {
    margin: 0 0 8px;
    font-size: 28px;
}

.landing-copy {
    margin: 0 0 20px;
    color: var(--muted);
}

.landing-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.landing-actions .btn {
    flex: 1 1 160px;
}

.admin-login {
    display: grid;
    gap: 12px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.admin-login[hidden] {
    display: none;
}

.admin-login label,
#modalBody label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-weight: 700;
}

.error-message {
    min-height: 20px;
    margin: 0;
    color: var(--danger);
    font-weight: 700;
}

.login-brand-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 56px;
    background: linear-gradient(135deg, #0057ff 0%, #0078ff 45%, #00a3ff 100%);
    color: #ffffff;
}

.login-brand-logo {
    width: min(280px, 55%);
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.22);
}

.login-brand-panel h2 {
    margin: 28px 0 12px;
    font-size: 34px;
}

.login-brand-panel p {
    max-width: 620px;
    margin: 0;
    color: rgba(255, 255, 255, 0.88);
    font-size: 17px;
    line-height: 1.6;
}

.login-feature-list {
    display: grid;
    gap: 10px;
    margin-top: 28px;
}

.login-feature-list span {
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.26);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    font-weight: 700;
}

button,
input,
select,
textarea {
    font: inherit;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    max-height: 100vh;
    overflow-y: auto;
    padding: 24px 18px;
    background: #101828;
    color: #ffffff;
    box-shadow: 10px 0 32px rgba(15, 23, 42, 0.18);
    z-index: 10;
}

.sidebar-backdrop {
    display: none;
}

.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    min-width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--text);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

.logo {
    margin-bottom: 24px;
    padding: 14px 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    color: #f8fafc;
    font-size: 14px;
    font-weight: 800;
    text-align: center;
    letter-spacing: 0;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 18px;
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px 8px 4px;
    color: #94a3b8;
    font-size: 12px;
    text-align: center;
}

.nav-link {
    width: 100%;
    border: 0;
    border-radius: 8px;
    padding: 12px 14px;
    background: transparent;
    color: #cbd5e1;
    text-align: left;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(45, 212, 191, 0.15);
    color: #ffffff;
}

.nav-link.active {
    box-shadow: inset 3px 0 0 var(--primary);
}

.main {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 18px 28px;
    background: rgba(255, 255, 255, 0.86);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px);
}

body.dark .topbar {
    background: rgba(31, 41, 55, 0.86);
}

.topbar h3 {
    margin: 0;
    font-size: 18px;
}

.topbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.topbar-brand img {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    object-fit: cover;
}

.topbar-actions,
.module-header,
.database-filters,
.modal-actions,
.btn-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    min-width: 0;
}

.language-toggle {
    display: inline-flex;
    gap: 6px;
}

.language-toggle .btn {
    width: 82px;
    min-height: 34px;
    padding: 7px 10px;
}

.language-toggle .btn:hover {
    box-shadow: none;
    transform: none;
}

.language-toggle .btn.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.content {
    padding: 22px;
    min-width: 0;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}

.card,
.module {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    min-width: 0;
}

.card {
    padding: 20px;
}

.card h4 {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.card h2 {
    margin: 0;
    color: var(--heading);
    font-size: 28px;
}

.module {
    margin-bottom: 22px;
    padding: 18px;
}

.module-header {
    justify-content: space-between;
    margin-bottom: 18px;
}

.module-header h2 {
    margin: 0;
    color: var(--heading);
    font-size: 21px;
}

.module h3 {
    margin: 16px 0 12px;
    color: var(--heading-soft);
    font-size: 16px;
}

.btn {
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    padding: 9px 14px;
    background: var(--primary);
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.btn:hover {
    background: var(--primary-dark);
    box-shadow: 0 8px 18px rgba(15, 118, 110, 0.22);
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.btn:disabled:hover {
    box-shadow: none;
    transform: none;
}

.btn-secondary {
    background: var(--surface-soft);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--primary-soft);
    color: var(--text);
}

.btn-danger {
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid rgba(194, 65, 12, 0.16);
}

.btn-danger:hover {
    background: var(--danger);
    color: #ffffff;
}

.btn-sm {
    min-height: 44px;
    padding: 7px 10px;
    font-size: 13px;
}

.table-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.employee-photo-thumb,
.employee-photo-preview {
    display: block;
    width: 45px;
    min-width: 45px;
    max-width: 45px;
    height: 58px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface-soft);
    object-fit: cover;
}

.employee-photo-preview {
    width: 90px;
    min-width: 90px;
    max-width: 90px;
    height: 116px;
}

.employee-photo-button {
    display: inline-flex;
    width: 45px;
    height: 58px;
    border: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
}

.employee-photo-modal {
    display: block;
    width: min(280px, 80vw);
    aspect-ratio: 45 / 58;
    border-radius: 8px;
    object-fit: cover;
}

.employee-card-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
}

.employee-card {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 16px;
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 10px 24px rgba(20, 31, 48, 0.08);
}

.employee-card-photo {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.employee-photo-button-large,
.employee-photo-card-img,
.employee-photo-placeholder {
    width: 90px;
    min-width: 90px;
    max-width: 90px;
    height: 116px;
    border-radius: 4px;
}

.employee-photo-card-img,
.employee-photo-placeholder {
    border: 1px solid var(--border);
    background: var(--surface-soft);
    object-fit: cover;
}

.employee-photo-placeholder {
    display: grid;
    place-items: center;
    color: var(--muted);
    font-weight: 800;
}

.employee-card-body {
    display: grid;
    gap: 12px;
    min-width: 0;
}

.employee-card-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}

.employee-card-title h3 {
    margin: 0;
    color: var(--heading);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.employee-card-grid div {
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-soft);
}

.employee-card-grid span,
.employee-card-grid strong {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.employee-card-grid span {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.employee-card-actions {
    justify-content: flex-start;
}

table {
    width: 100%;
    min-width: max(100%, 900px);
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}

th,
td {
    height: 48px;
    max-width: 220px;
    padding: 10px 11px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    overflow-wrap: anywhere;
}

td img {
    vertical-align: middle;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface-soft);
    color: var(--heading-soft);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

td {
    color: var(--text);
}

td:empty::before {
    content: "-";
    color: var(--muted);
}

tbody tr:last-child td {
    border-bottom: 0;
}

tr:hover td {
    background: var(--surface-soft);
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    border-radius: 999px;
    padding: 4px 10px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

body.dark .badge {
    color: var(--primary);
}

.empty-state {
    padding: 28px 16px;
    color: var(--muted);
    text-align: center;
}

.database-filters {
    margin-bottom: 16px;
    padding: 14px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.database-filters label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-weight: 700;
    min-width: 0;
}

input,
select,
textarea {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 11px 12px;
    background: var(--surface);
    color: var(--text);
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

textarea {
    min-height: 100px;
    resize: vertical;
}

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

.modal.show {
    display: flex;
}

.modal-content {
    width: min(520px, 100%);
    max-height: 88vh;
    overflow-y: auto;
    padding: 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 26px 70px rgba(0, 0, 0, 0.28);
}

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

.modal-header h3 {
    margin: 0;
    font-size: 20px;
}

.close-btn {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--text);
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
}

#modalBody {
    display: grid;
    gap: 12px;
}

.modal-actions {
    justify-content: flex-end;
    margin-top: 18px;
}

.fund-card {
    margin-bottom: 12px;
    padding: 16px;
    background: var(--accent-soft);
    border: 1px solid rgba(183, 121, 31, 0.18);
    border-radius: 8px;
}

.fund-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.fund-snapshot-module {
    overflow: hidden;
}

.dashboard-fund-snapshot-module {
    background: var(--surface);
    border-color: var(--border);
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.22);
}

.dashboard-fund-snapshot-module .module-header {
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.dashboard-fund-snapshot-module .module-header h2 {
    color: var(--heading);
}

.fund-snapshot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.fund-snapshot-card {
    --snapshot-accent: #2dd4bf;
    --snapshot-accent-soft: rgba(45, 212, 191, 0.14);
    display: grid;
    gap: 14px;
    min-width: 0;
    margin-bottom: 0;
    padding: 18px;
    background: var(--surface);
    border: 1px solid color-mix(in srgb, var(--snapshot-accent) 28%, var(--border));
    border-radius: 8px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 12px 28px rgba(0, 0, 0, 0.2);
    transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.fund-snapshot-card:hover {
    background: var(--surface-soft);
    border-color: color-mix(in srgb, var(--snapshot-accent) 36%, rgba(148, 163, 184, 0.18));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 16px 34px rgba(0, 0, 0, 0.24);
}

.fund-snapshot-card-debts {
    --snapshot-accent: #f59e0b;
    --snapshot-accent-soft: rgba(245, 158, 11, 0.13);
}

.fund-snapshot-card-expenses {
    --snapshot-accent: #fb7185;
    --snapshot-accent-soft: rgba(251, 113, 133, 0.12);
}

.fund-snapshot-card-reimbursementClaims {
    --snapshot-accent: #a78bfa;
    --snapshot-accent-soft: rgba(167, 139, 250, 0.12);
}

.fund-snapshot-card-payments {
    --snapshot-accent: #60a5fa;
    --snapshot-accent-soft: rgba(96, 165, 250, 0.12);
}

.fund-snapshot-card-funds {
    --snapshot-accent: #34d399;
    --snapshot-accent-soft: rgba(52, 211, 153, 0.12);
}

.fund-snapshot-card-atmCash {
    --snapshot-accent: #22d3ee;
    --snapshot-accent-soft: rgba(34, 211, 238, 0.12);
}

.fund-snapshot-card-bankRental {
    --snapshot-accent: #2dd4bf;
    --snapshot-accent-soft: rgba(45, 212, 191, 0.14);
}

.fund-snapshot-header {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.fund-snapshot-accent {
    width: 4px;
    height: 28px;
    border-radius: 999px;
    background: var(--snapshot-accent);
    box-shadow: 0 0 18px var(--snapshot-accent-soft);
}

.fund-snapshot-name {
    min-width: 0;
    color: var(--heading-soft);
    font-size: 15px;
    font-weight: 800;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.fund-snapshot-total {
    color: var(--heading);
    font-size: 25px;
    font-weight: 850;
    line-height: 1.12;
    overflow-wrap: anywhere;
}

.fund-snapshot-amounts {
    display: grid;
    gap: 8px;
    padding: 12px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.fund-snapshot-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-size: 13px;
}

.fund-snapshot-row strong {
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
    text-align: right;
    white-space: nowrap;
}

td.btn-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-width: 210px;
    overflow: visible;
    white-space: nowrap;
}

td.btn-group .btn {
    flex: 0 0 auto;
}

.table-name-cell {
    white-space: nowrap;
}

.table-money-cell {
    text-align: right;
}

.table-money {
    display: inline-block;
    min-width: 92px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.table-detail-cell {
    min-width: 112px;
    text-align: center;
}

.table-detail-btn {
    min-width: 98px;
}

.table-detail-empty {
    color: var(--muted);
}

.table-detail-viewer {
    display: grid;
    gap: 12px;
}

.table-detail-content {
    max-height: 56vh;
    overflow-y: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.55;
}

.fund-snapshot-empty {
    grid-column: 1 / -1;
    padding: 42px 18px;
    border: 1px dashed rgba(148, 163, 184, 0.26);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
    color: #aab6c7;
    font-weight: 700;
}

.category-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.category-row:last-child {
    border-bottom: 0;
}

.detail-grid {
    display: grid;
    gap: 12px;
}

.detail-row {
    display: grid;
    gap: 6px;
}

.detail-row strong {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.detail-value {
    white-space: pre-line;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.text-wrap-cell {
    white-space: nowrap;
    min-width: 112px;
}

hr {
    margin: 16px 0;
    border: 0;
    border-top: 1px solid var(--border);
}

@media (max-width: 900px) {
    :root {
        --sidebar-width: 220px;
    }

    .cards {
        grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    }

    .content,
    .topbar {
        padding-left: 20px;
        padding-right: 20px;
    }
}

@media (max-width: 1024px) {
    .fund-snapshot-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 780px) {
    .login-split {
        grid-template-columns: 1fr;
    }

    .login-form-panel {
        min-height: auto;
        padding: 88px 20px 30px;
    }

    .login-language-toggle {
        top: 16px;
        right: 16px;
    }

    .login-logo-small {
        width: 72px;
        height: 72px;
        margin-bottom: 18px;
    }

    .login-form-panel h1 {
        font-size: clamp(24px, 8vw, 30px);
    }

    .login-brand-panel {
        min-height: auto;
        padding: 34px 20px;
    }

    .login-brand-panel h2 {
        font-size: clamp(24px, 7vw, 32px);
    }

    .login-brand-logo {
        width: min(180px, 60vw);
    }

    .sidebar {
        inset: 0 auto 0 0;
        width: min(82vw, 300px);
        max-height: 100vh;
        padding: 18px 14px;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        will-change: transform;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 45;
        display: none;
        background: rgba(15, 23, 42, 0.48);
    }

    body.sidebar-open .sidebar-backdrop {
        display: block;
    }

    .mobile-menu-btn {
        display: inline-flex;
    }

    .logo {
        margin-bottom: 12px;
    }

    .nav {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .nav-link {
        min-height: 44px;
        text-align: left;
    }

    .main {
        width: 100%;
        margin-left: 0;
        min-width: 0;
    }

    .topbar {
        position: sticky;
        align-items: center;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px 16px;
    }

    .topbar-brand {
        flex: 1 1 160px;
        min-width: 0;
        font-size: 16px;
    }

    .topbar-brand img {
        width: 30px;
        height: 30px;
    }

    .topbar-actions {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
        width: 100%;
        align-items: stretch;
        gap: 8px;
    }

    .topbar-actions .btn,
    .topbar-actions .language-toggle {
        width: 100%;
    }

    .language-toggle {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .language-toggle .btn {
        width: 100%;
    }

    .module-header {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
    }

    .module-header .btn,
    .module-header .btn-group {
        width: 100%;
    }

    .btn-group .btn {
        flex: 1 1 130px;
    }

    .database-filters {
        align-items: stretch;
        flex-direction: column;
    }

    .database-filters label {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
    }

    .cards {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .module {
        max-width: 100%;
        overflow: hidden;
    }

    table {
        min-width: 820px;
    }

    th,
    td {
        padding: 10px;
    }

    .fund-snapshot-grid {
        grid-template-columns: 1fr;
    }

    .fund-snapshot-card {
        width: 100%;
    }

    .fund-snapshot-row {
        font-size: 13px;
    }

    .employee-card {
        grid-template-columns: 88px minmax(0, 1fr);
        gap: 12px;
    }

    .employee-photo-button-large,
    .employee-photo-card-img,
    .employee-photo-placeholder {
        width: 72px;
        min-width: 72px;
        max-width: 72px;
        height: 93px;
    }

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

@media (max-width: 520px) {
    .login-form-panel,
    .login-brand-panel {
        padding-left: 16px;
        padding-right: 16px;
    }

    .login-language-toggle {
        right: 12px;
    }

    .content {
        padding: 16px;
    }

    .module,
    .card {
        padding: 16px;
    }

    .cards {
        grid-template-columns: 1fr;
    }

    .card h2 {
        font-size: 24px;
    }

    .fund-snapshot-card {
        padding: 16px;
    }

    .fund-snapshot-total {
        font-size: 22px;
    }

    .fund-snapshot-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .fund-snapshot-row strong {
        text-align: left;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .topbar-actions {
        grid-template-columns: 1fr;
    }

    .landing-actions .btn,
    .btn-group .btn {
        flex-basis: 100%;
    }

    .modal-content {
        padding: 18px;
    }
}

.table-wrapper td.btn-group,
.module:has(button[onclick^="setBankRentalTab"]) td:last-child.btn-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-width: 190px;
    overflow: visible;
    white-space: normal;
}

.table-wrapper td.btn-group .btn,
.module:has(button[onclick^="setBankRentalTab"]) td:last-child.btn-group .btn {
    flex: 0 0 auto;
    width: auto;
    min-width: 78px;
}

/* Bank Rental module polish only */
.module:has(button[onclick^="setBankRentalTab"]) {
    display: grid;
    gap: 16px;
    padding: 24px;
    border-color: color-mix(in srgb, var(--primary) 16%, var(--border));
}

.module:has(button[onclick^="setBankRentalTab"]) .module-header {
    margin-bottom: 0;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.module:has(button[onclick^="setBankRentalTab"]) .module-header h2 {
    font-size: clamp(20px, 2vw, 25px);
    font-weight: 850;
}

.module:has(button[onclick^="setBankRentalTab"]) .module-header .btn-group {
    display: grid;
    grid-template-columns: repeat(3, minmax(132px, 1fr));
    align-items: stretch;
    gap: 10px;
}

.module:has(button[onclick^="setBankRentalTab"]) .module-header .btn {
    width: 100%;
    min-width: 132px;
    min-height: 44px;
    padding: 10px 14px;
    transform: none;
    transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.module:has(button[onclick^="setBankRentalTab"]) .module-header .btn:hover,
.module:has(button[onclick^="setBankRentalTab"]) .module-header .btn:active {
    transform: none;
}

.module:has(button[onclick^="setBankRentalTab"]) > .btn-group:first-of-type {
    display: grid;
    grid-template-columns: repeat(6, minmax(112px, 1fr));
    gap: 8px;
    padding: 6px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.module:has(button[onclick^="setBankRentalTab"]) > .btn-group:first-of-type .btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 44px;
    min-width: 0;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid transparent;
    box-shadow: none;
    font-size: 13px;
    line-height: 1;
    text-align: center;
    transform: none;
    transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.module:has(button[onclick^="setBankRentalTab"]) > .btn-group:first-of-type .btn:not(.btn-secondary) {
    box-shadow: 0 8px 18px rgba(15, 118, 110, 0.16);
}

.module:has(button[onclick^="setBankRentalTab"]) > .btn-group:first-of-type .btn:hover,
.module:has(button[onclick^="setBankRentalTab"]) > .btn-group:first-of-type .btn:active {
    transform: none;
}

.module:has(button[onclick^="setBankRentalTab"]) > .database-filters:not(:last-child) {
    display: grid;
    grid-template-columns: minmax(240px, 1.5fr) minmax(180px, 1fr) minmax(150px, 0.7fr);
    align-items: end;
    gap: 12px;
    margin-bottom: 0;
    padding: 16px;
}

.module:has(button[onclick^="setBankRentalTab"]) > .database-filters:not(:last-child) label {
    display: grid;
    align-items: start;
    gap: 7px;
    font-size: 12px;
    letter-spacing: 0;
}

.module:has(button[onclick^="setBankRentalTab"]) > .database-filters:not(:last-child) input,
.module:has(button[onclick^="setBankRentalTab"]) > .database-filters:not(:last-child) select {
    min-height: 44px;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.module:has(button[onclick^="setBankRentalTab"]) .table-wrapper {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.module:has(button[onclick^="setBankRentalTab"]) table {
    min-width: 1960px;
}

.module:has(button[onclick^="setBankRentalTab"]) th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 12px 14px;
    background: var(--surface-soft);
}

.module:has(button[onclick^="setBankRentalTab"]) td {
    padding: 14px;
    vertical-align: top;
}

.module:has(button[onclick^="setBankRentalTab"]) td:nth-child(6) {
    font-weight: 800;
    white-space: nowrap;
}

.module:has(button[onclick^="setBankRentalTab"]) td:nth-child(7) {
    min-width: 130px;
}

.module:has(button[onclick^="setBankRentalTab"]) td:nth-child(12),
.module:has(button[onclick^="setBankRentalTab"]) td:nth-child(13),
.module:has(button[onclick^="setBankRentalTab"]) td:nth-child(14) {
    min-width: 220px;
    line-height: 1.45;
}

.bank-rental-money-cell {
    text-align: right;
}

.bank-rental-money {
    display: inline-block;
    min-width: 92px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.bank-rental-detail-cell {
    max-width: 260px;
}

.bank-rental-detail-btn {
    width: auto;
    min-width: 92px;
    min-height: 32px;
    margin-top: 8px;
    padding: 6px 10px;
}

.bank-rental-detail-empty {
    color: var(--muted);
}

.bank-rental-source-field,
.bank-rental-checkbox {
    display: grid;
    gap: 7px;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
}

.bank-rental-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bank-rental-checkbox input {
    width: auto;
    min-height: auto;
}

.bank-rental-modal {
    max-width: 100%;
}

.bank-rental-modal-content {
    max-height: 56vh;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.55;
}

.bank-rental-status-badge {
    justify-content: center;
    min-width: 76px;
}

.bank-rental-status-normal {
    background: #dcfce7;
    color: #166534;
}

.bank-rental-status-none {
    background: #f3f4f6;
    color: #4b5563;
}

.bank-rental-status-pending {
    background: #ffedd5;
    color: #9a3412;
}

.bank-rental-status-partial {
    background: #fef9c3;
    color: #854d0e;
}

.bank-rental-status-settled {
    background: #dbeafe;
    color: #1d4ed8;
}

.bank-rental-summary-cards {
    margin-bottom: 0;
}

.bank-rental-summary-cards .card {
    padding: 16px;
}

.bank-rental-summary-cards .card h2 {
    font-size: 22px;
}

.bank-rental-agent-group {
    display: grid;
    gap: 12px;
}

.bank-rental-agent-header {
    display: grid;
    gap: 10px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-soft);
}

.bank-rental-agent-header h3 {
    margin: 0;
    font-size: 18px;
}

.bank-rental-agent-totals {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 8px;
    font-size: 13px;
}

.bank-rental-agent-totals span {
    white-space: nowrap;
}

.module:has(button[onclick^="setBankRentalTab"]) td:last-child.btn-group .btn {
    min-width: 78px;
    min-height: 38px;
    padding: 7px 8px;
    box-shadow: none;
    transform: none;
    transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.module:has(button[onclick^="setBankRentalTab"]) td:last-child.btn-group .btn:hover,
.module:has(button[onclick^="setBankRentalTab"]) td:last-child.btn-group .btn:active {
    transform: none;
}

.module:has(button[onclick^="setBankRentalTab"]) .empty-state {
    padding: 46px 18px;
    color: var(--muted);
    font-weight: 700;
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--primary-soft) 45%, transparent), transparent);
}

.module:has(button[onclick^="setBankRentalTab"]) > .database-filters:last-child {
    display: flex;
    justify-content: center;
    margin-top: -4px;
}

@media (max-width: 1100px) {
    .module:has(button[onclick^="setBankRentalTab"]) > .btn-group:first-of-type {
        grid-template-columns: repeat(3, minmax(112px, 1fr));
    }

    .module:has(button[onclick^="setBankRentalTab"]) > .database-filters:not(:last-child) {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 780px) {
    .module:has(button[onclick^="setBankRentalTab"]) {
        padding: 18px;
        gap: 14px;
    }

    .module:has(button[onclick^="setBankRentalTab"]) .module-header .btn-group,
    .module:has(button[onclick^="setBankRentalTab"]) > .btn-group:first-of-type,
    .module:has(button[onclick^="setBankRentalTab"]) > .database-filters:not(:last-child) {
        grid-template-columns: 1fr;
    }

    .module:has(button[onclick^="setBankRentalTab"]) .module-header .btn,
    .module:has(button[onclick^="setBankRentalTab"]) > .btn-group:first-of-type .btn {
        min-width: 0;
    }

    .module:has(button[onclick^="setBankRentalTab"]) table {
        min-width: 1520px;
    }

    .table-wrapper td.btn-group,
    .module:has(button[onclick^="setBankRentalTab"]) td:last-child.btn-group {
        align-items: stretch;
        min-width: 150px;
    }

    .table-wrapper td.btn-group .btn,
    .module:has(button[onclick^="setBankRentalTab"]) td:last-child.btn-group .btn {
        flex: 1 1 100%;
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 520px) {
    .module:has(button[onclick^="setBankRentalTab"]) {
        padding: 16px;
    }

    .table-wrapper {
        margin-inline: -4px;
        width: calc(100% + 8px);
    }

    .module:has(button[onclick^="setBankRentalTab"]) table {
        min-width: 1320px;
    }

    .module:has(button[onclick^="setBankRentalTab"]) th,
    .module:has(button[onclick^="setBankRentalTab"]) td {
        padding: 10px;
    }
}
