html {
    height: 100%;
}

body {
    font-family: "Segoe UI", "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #dff5df;
    color: #1d2b3a;
    min-height: 100%;
    overflow-x: hidden;
}

.layout {
    min-height: 100vh;
    display: flex;
    width: 100%;
    background: none;
    position: relative;
}

.sidebar {
    width: 240px;
    min-width: 240px;
    flex: 0 0 240px;
    background: linear-gradient(180deg, #1f7a4d 0%, #135a38 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 2rem 1.75rem 5.75rem;
    box-shadow: 6px 0 16px rgba(12, 65, 38, 0.22);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 20;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.2rem;
    font-weight: 600;
}

.sidebar__logo {
    font-size: 1.75rem;
}

.sidebar__title {
    letter-spacing: 1px;
}

.sidebar__user {
    background: rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.sidebar__greeting {
    font-size: 1rem;
    font-weight: 600;
}

.sidebar__status {
    font-size: 0.85rem;
    opacity: 0.85;
}

.sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar__nav a {
    display: block;
    padding: 0.65rem 0.85rem;
    border-radius: 10px;
    color: #f4fbf7;
    text-decoration: none;
    font-weight: 500;
    transition: background 0.2s ease, transform 0.2s ease;
}


.sidebar__nav a.is-active {
    background: rgba(255, 255, 255, 0.28);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 10px 24px rgba(10, 64, 38, 0.25);
    transform: translateX(4px);
}

.sidebar__nav a.sidebar__nav-link--secondary {
    margin-top: auto;
    background: none;
}

.sidebar__nav a.sidebar__nav-link--logout {
    color: #ffd6d6;
}

.sidebar__nav a:hover,
.sidebar__nav a:focus {
    background: rgba(255, 255, 255, 0.18);
    transform: translateX(4px);
}

.sidebar__close {
    margin-top: 2rem;
    align-self: stretch;
    background: rgba(0, 0, 0, 0.18);
    color: #f4fbf7;
    border: none;
    border-radius: 999px;
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-align: center;
    cursor: pointer;
    display: none;
}

.sidebar__close:hover,
.sidebar__close:focus {
    background: rgba(0, 0, 0, 0.22);
}

.layout__main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-height: 100vh;
    width: 100%;
}

.topbar {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.65);
    padding: 0.85rem 1.75rem;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    position: sticky;
    top: 0;
    z-index: 10;
    width: 100%;
}

.topbar__title {
    margin: 0;
    font-size: 1.6rem;
    color: #0f4029;
    letter-spacing: 0.5px;
}

.sidebar-toggle {
    display: none;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #1f7a4d 0%, #135a38 100%);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    padding: 0;
    position: relative;
}

.topbar .sidebar-toggle {
    position: static;
    transform: none;
}

.sidebar-toggle__bar {
    display: block;
    width: 20px;
    height: 2px;
    background-color: #fff;
    border-radius: 999px;
    position: absolute;
    left: 12px;
    right: 12px;
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform-origin: center;
}

.sidebar-toggle__bar:nth-child(1) {
    top: 14px;
}

.sidebar-toggle__bar:nth-child(2) {
    top: 21px;
}

.sidebar-toggle__bar:nth-child(3) {
    top: 28px;
}

.sidebar-toggle[aria-expanded="true"] .sidebar-toggle__bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.sidebar-toggle[aria-expanded="true"] .sidebar-toggle__bar:nth-child(2) {
    opacity: 0;
}

.sidebar-toggle[aria-expanded="true"] .sidebar-toggle__bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.sidebar-backdrop {
    display: none;
}

body.sidebar-open {
    overflow: hidden;
}

.main-content {
    flex: 1;
    width: 100%;
    padding: 2.5rem clamp(1.25rem, 2.5vw, 3rem) 6rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1.75rem;
    box-sizing: border-box;
}

section {
    background-color: #ffffff;
    padding: 1.5rem 1.5rem 1.75rem;
    width: 100%;
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 18px 32px rgba(15, 23, 42, 0.08);
}

.module-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.module-section > h2,
.module-section > h3,
.module-section > h4 {
    margin-top: 0;
    font-size: 1.5rem;
    color: #134a2f;
}

.module-section > p {
    color: #526072;
    margin-top: 0.35rem;
}

.module-section__content {
    width: 100%;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(255, 255, 255, 0.95);
    max-height: 26rem;
    overflow: auto;
    box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.04);
    padding: 0.5rem;
    box-sizing: border-box;
}

.module-section__content table {
    margin-top: 0;
    margin-bottom: 0;
}

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

.table-pagination__summary {
    font-size: 0.9rem;
    color: rgba(15, 23, 42, 0.7);
}

.table-pagination__controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.table-pagination__page-info {
    font-size: 0.9rem;
    color: rgba(15, 23, 42, 0.7);
}

.table-pagination__controls button {
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    background: rgba(31, 122, 77, 0.1);
    color: #1f7a4d;
    border: 1px solid rgba(31, 122, 77, 0.2);
    cursor: pointer;
    transition: background 0.2s ease;
}

.table-pagination__controls button:disabled {
    background: rgba(148, 163, 184, 0.15);
    color: rgba(71, 85, 105, 0.75);
    cursor: not-allowed;
}

.table-pagination__controls select {
    border-radius: 999px;
    padding: 0.3rem 1.75rem 0.3rem 0.75rem;
    border: 1px solid rgba(15, 23, 42, 0.2);
    background-color: #fff;
    font-size: 0.9rem;
}

.finance-totals {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.finance-total-card {
    background: linear-gradient(135deg, rgba(31, 122, 77, 0.12) 0%, rgba(19, 90, 56, 0.18) 100%);
    border-radius: 14px;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    border: 1px solid rgba(31, 122, 77, 0.18);
    color: #0f4029;
}

.finance-total-card__label {
    font-size: 0.9rem;
    opacity: 0.8;
}

.finance-total-card__value {
    font-size: 1.35rem;
    font-weight: 700;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.25rem;
    background-color: #fff;
    border-radius: 12px;
    overflow: hidden;
}

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

thead {
    background-color: #f1f5f9;
}

tbody tr:hover {
    background-color: #f8fafc;
}

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

.footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    text-align: center;
    padding: 0.85rem 2rem;
    background-color: #f8fbff;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    z-index: 40;
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
}

.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(223, 245, 223, 0.65) 0%, rgba(223, 245, 223, 0.95) 100%);
    padding: 2rem 1rem 6rem;
    box-sizing: border-box;
}

.auth-wrapper {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.auth-container {
    background-color: #fff;
    padding: 2rem;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 360px;
}

.auth-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0.75rem 1rem;
    background-color: rgba(255, 255, 255, 0.92);
    text-align: center;
    border-top: 1px solid rgba(15, 23, 42, 0.12);
    font-size: 0.85rem;
    color: rgba(15, 23, 42, 0.68);
}

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

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    color: #1d2b3a;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid #d0d9e6;
    border-radius: 10px;
    box-sizing: border-box;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #1f7a4d;
    box-shadow: 0 0 0 3px rgba(31, 122, 77, 0.18);
}

.btn,
.button,
button,
input[type="submit"],
input[type="button"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.6rem 1.6rem;
    background: linear-gradient(135deg, #1f7a4d 0%, #1a5f3d 100%);
    color: #fff;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    box-shadow: 0 12px 22px rgba(31, 122, 77, 0.28);
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn:hover,
.button:hover,
button:hover,
input[type="submit"]:hover,
input[type="button"]:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 28px rgba(31, 122, 77, 0.32);
}

.btn:focus,
.button:focus,
button:focus,
input[type="submit"]:focus,
input[type="button"]:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(31, 122, 77, 0.28);
}

.btn--secondary,
.button-secondary,
a.button-secondary,
button.button-secondary {
    background: rgba(31, 122, 77, 0.12);
    color: #135a38;
    box-shadow: none;
    border: 1px solid rgba(19, 90, 56, 0.18);
}

.btn--secondary:hover,
.button-secondary:hover,
a.button-secondary:hover,
button.button-secondary:hover {
    background: rgba(31, 122, 77, 0.18);
    box-shadow: none;
}

.btn--ghost {
    background: rgba(255, 255, 255, 0.75);
    color: #135a38;
    border: 1px solid rgba(19, 90, 56, 0.12);
    box-shadow: none;
}

.btn--ghost:hover {
    background: rgba(255, 255, 255, 0.95);
}

.link-button {
    background: none;
    border: none;
    color: #1f4b99;
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
}

.link-button:hover {
    color: #163a77;
}

.form-card {
    max-width: 640px;
    margin: 0 auto;
}

.form-helper {
    margin: 0.25rem 0 0.75rem;
    font-size: 0.9rem;
    color: #5d6c7f;
}

.checkbox-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 1.25rem;
}

.checkbox-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background-color: rgba(31, 122, 77, 0.08);
    color: #155940;
    transition: background 0.2s ease;
}

.checkbox-item input {
    accent-color: #1f7a4d;
}

.checkbox-item:hover {
    background-color: rgba(31, 122, 77, 0.16);
}

.alert {
    padding: 0.85rem 1rem;
    margin-bottom: 1.2rem;
    border-radius: 12px;
    border: 1px solid transparent;
    font-size: 0.95rem;
}

.alert-danger {
    background-color: #fef2f2;
    color: #b91c1c;
    border-color: rgba(248, 113, 113, 0.35);
}

.alert-success {
    background-color: #ecfdf5;
    color: #047857;
    border-color: rgba(34, 197, 94, 0.35);
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.75rem;
    border-radius: 999px;
    background: rgba(18, 58, 40, 0.12);
    color: #134a2f;
    font-size: 0.8rem;
    font-weight: 600;
}

.tag-muted {
    background-color: #e2e8f0;
    color: #475569;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@media (max-width: 960px) {
    .layout {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        height: auto;
        flex: none;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: min(260px, 80vw);
        min-width: 0;
        padding: 2rem 1.5rem 2.5rem;
        box-shadow: 18px 0 36px rgba(12, 65, 38, 0.3);
    }

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

    .sidebar__close {
        display: inline-flex;
    }

    .sidebar-toggle {
        display: inline-flex;
    }

    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        z-index: 15;
    }

    body.sidebar-open .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .topbar {
        padding: 1.25rem 1.25rem 1.5rem;
    }

    .topbar__title {
        font-size: 1.75rem;
    }

    .main-content {
        padding: 2rem 1.25rem 2.5rem;
    }
}

@media (max-width: 640px) {
    .topbar {
        padding: 1.1rem 1rem 1.35rem;
    }

    .topbar__title {
        font-size: 1.55rem;
    }

    .main-content {
        padding: 1.75rem 1rem 2rem;
    }

    section {
        padding: 1.25rem;
    }
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
    align-items: flex-end;
}

.inline-form .form-group {
    min-width: 180px;
    margin-bottom: 0;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1 1 220px;
    margin-bottom: 1rem;
}


.action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1.5rem;
}

.action-bar__import-form {
    align-items: center;
    gap: 0.75rem;
}

.action-bar__import-form input[type="file"] {
    padding: 0.5rem 0.75rem;
    border: 1px dashed rgba(19, 90, 56, 0.3);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.8);
    cursor: pointer;
}

.action-bar__import-form input[type="file"]:focus {
    outline: none;
    border-color: #1f7a4d;
    box-shadow: 0 0 0 3px rgba(31, 122, 77, 0.18);
}

.action-bar__import-form .form-group {
    min-width: auto;
}

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

.pagination-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.inline-form--table {
    margin-top: 0;
    gap: 0.5rem;
    align-items: center;
}

.inline-form--table .link-button {
    padding: 0;
}

.table-action-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.table-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
    box-shadow: none;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.table-action--view {
    background: #edf4ff;
    color: #1f4b99;
    border-color: rgba(31, 75, 153, 0.18);
}

.table-action--view:hover,
.table-action--view:focus {
    background: #e0edff;
    color: #143473;
}

.table-action--edit {
    background: #e9f7ef;
    color: #135a38;
    border-color: rgba(19, 90, 56, 0.18);
}

.table-action--edit:hover,
.table-action--edit:focus {
    background: #dcf2e4;
}

.table-action--delete {
    background: #fff1f0;
    color: #b42318;
    border-color: rgba(244, 63, 94, 0.2);
}

.table-action--delete:hover,
.table-action--delete:focus {
    background: #ffe2e0;
}

.table-action-group form {
    margin: 0;
}

.table-action-group .inline-form--table {
    margin: 0;
    gap: 0.35rem;
}

.text-muted {
    color: #666;
}

.income-summary {
    background-color: #fff;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.income-summary__cards {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

.income-card {
    flex: 1;
    min-width: 220px;
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.income-card__label {
    display: block;
    color: #2e7d32;
    font-weight: 600;
}

.income-card__value {
    display: block;
    font-size: 1.6rem;
    color: #1b5e20;
    margin-top: 0.5rem;
}

.role-cost-groups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.role-cost-group {
    background-color: #f0fff0;
    border: 1px solid #d7eed7;
    border-radius: 6px;
    padding: 0.75rem 1rem;
}

.role-cost-group h4 {
    margin-top: 0;
}

.role-cost-group h5 {
    margin: 0;
    font-size: 1rem;
    color: #2e7d32;
}

.role-cost-group ul {
    padding-left: 1.25rem;
    margin: 0.5rem 0;
}

.role-cost-total {
    font-weight: bold;
    margin-top: 0.5rem;
}

.finance-adjustment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.finance-adjustment-item .inline-form {
    margin: 0;
}

.staff-groups {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.staff-group {
    flex: 1 1 260px;
    border: 1px solid #ddd;
    padding: 1rem;
    border-radius: 4px;
    background-color: #fafafa;
}

.staff-group ul {
    padding-left: 1.2rem;
}

.finance-details {
    margin-top: 0.5rem;
}

.finance-details h4 {
    margin-bottom: 0.3rem;
}

.finance-details ul {
    padding-left: 1.2rem;
}