:root {
    color-scheme: light;
    font-family:
        "Microsoft YaHei",
        "PingFang SC",
        "Segoe UI",
        Arial,
        sans-serif;
    color: #20242b;
    background: #f3f5f7;
    font-synthesis: none;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 760px;
    min-height: 100%;
    background: #f3f5f7;
}

body {
    min-height: 100vh;
    margin: 0;
    background: #f3f5f7;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
}

.workspace {
    width: min(1100px, calc(100% - 48px));
    margin: 24px auto 40px;
    overflow: hidden;
    border: 1px solid #d9dee5;
    border-radius: 6px;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(32, 36, 43, 0.06);
}

.message-bar {
    min-height: 44px;
    padding: 11px 24px;
    border-bottom: 1px solid transparent;
    font-size: 14px;
    line-height: 22px;
}

.message-bar.is-error {
    border-color: #efb3ad;
    color: #9f251c;
    background: #fff0ee;
}

.message-bar.is-info {
    border-color: #b6d4ed;
    color: #15578a;
    background: #edf6fd;
}

.query-section,
.result-section {
    padding: 22px 24px;
}

.query-section {
    border-bottom: 1px solid #e4e8ed;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 28px;
    margin-bottom: 16px;
    gap: 16px;
}

.section-heading h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 650;
    line-height: 28px;
}

.query-form {
    display: grid;
    grid-template-columns: 150px 140px 72px;
    justify-content: start;
    align-items: end;
    gap: 12px;
}

.field {
    display: grid;
    gap: 7px;
}

.field > span {
    color: #4a5360;
    font-size: 13px;
    font-weight: 600;
    line-height: 20px;
}

.field input {
    width: 100%;
    height: 40px;
    padding: 0 11px;
    border: 1px solid #b9c1cc;
    border-radius: 5px;
    color: #20242b;
    background: #ffffff;
    outline: none;
}

.field input:focus {
    border-color: #1769aa;
    box-shadow: 0 0 0 3px rgba(23, 105, 170, 0.13);
}

.query-form button {
    height: 40px;
    border: 1px solid #1769aa;
    border-radius: 5px;
    color: #ffffff;
    background: #1769aa;
    font-weight: 650;
}

.query-form button:hover:not(:disabled) {
    border-color: #11578f;
    background: #11578f;
}

.query-form button:disabled {
    border-color: #8caec9;
    background: #8caec9;
}

.result-summary {
    color: #66717f;
    font-size: 13px;
    line-height: 20px;
}

.result-summary strong {
    margin-left: 3px;
    color: #20242b;
    font-size: 15px;
    font-weight: 650;
}

.table-wrap {
    min-height: 310px;
    overflow-x: auto;
    border: 1px solid #d9dee5;
    border-radius: 5px;
}

.summary-table,
.project-table,
.detail-table {
    width: 100%;
    border-collapse: collapse;
}

.summary-table th,
.summary-table td,
.project-table th,
.project-table td,
.detail-table th,
.detail-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #e4e8ed;
    text-align: left;
    vertical-align: middle;
}

.summary-table th,
.summary-table td {
    height: 46px;
}

.summary-table th,
.project-table th,
.detail-table th {
    color: #4e5865;
    background: #f6f8fa;
    font-size: 13px;
    font-weight: 650;
    white-space: nowrap;
}

.summary-table td,
.project-table td,
.detail-table td {
    color: #29313a;
    font-size: 14px;
    line-height: 22px;
}

.summary-table th:nth-child(1),
.summary-table td:nth-child(1) {
    width: 70px;
}

.summary-table th:nth-child(5),
.summary-table td:nth-child(5) {
    width: 110px;
}

.summary-table tbody tr:hover {
    background: #eef6fb;
}

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

.amount-column,
td.amount-column {
    text-align: left;
}

td.amount-column {
    font-variant-numeric: tabular-nums;
    font-weight: 650;
}

.detail-button {
    height: 32px;
    padding: 0 14px;
    border: 1px solid #1769aa;
    border-radius: 4px;
    color: #1769aa;
    background: #ffffff;
    font-weight: 600;
}

.detail-button:hover {
    color: #ffffff;
    background: #1769aa;
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 240px;
    padding: 24px;
    color: #7a8592;
    font-size: 14px;
    text-align: center;
}

.table-wrap.has-results .empty-state {
    display: none;
}

/* 详情弹窗 */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 24px;
    overflow-y: auto;
    background: rgba(20, 24, 30, 0.5);
}

.modal-backdrop[hidden] {
    display: none;
}

.modal {
    width: min(760px, 100%);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    padding: 24px;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 16px 48px rgba(20, 24, 30, 0.28);
}

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

.modal-head h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 650;
    line-height: 26px;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 5px;
    color: #5d6875;
    background: transparent;
    font-size: 22px;
    line-height: 1;
}

.modal-close:hover {
    background: #f0f3f6;
}

.detail-member {
    margin-bottom: 14px;
    color: #53606d;
    font-size: 14px;
    line-height: 22px;
}

.detail-member strong {
    color: #20242b;
}

.detail-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.detail-stats > div {
    display: grid;
    gap: 4px;
    padding: 14px 16px;
    border: 1px solid #e4e8ed;
    border-radius: 6px;
    background: #f8fafb;
}

.detail-stats span {
    color: #6f7a87;
    font-size: 12px;
    line-height: 18px;
}

.detail-stats strong {
    color: #20242b;
    font-size: 20px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}

.detail-stats strong.is-remain {
    color: #12613e;
}

.detail-projects,
.detail-list {
    margin-bottom: 20px;
}

.detail-projects h3,
.detail-list h3 {
    margin: 0 0 10px;
    font-size: 15px;
    font-weight: 650;
    line-height: 22px;
}

.project-table {
    border: 1px solid #e4e8ed;
    border-radius: 5px;
    overflow: hidden;
}

.project-table th,
.project-table td {
    height: 42px;
}

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

.detail-table-wrap {
    position: relative;
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid #e4e8ed;
    border-radius: 5px;
}

.detail-table th,
.detail-table td {
    height: 42px;
}

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

.detail-empty {
    padding: 20px;
    color: #7a8592;
    font-size: 13px;
    text-align: center;
}

@media (max-width: 720px) {
    html {
        min-width: 0;
    }

    .workspace {
        width: calc(100% - 28px);
        margin-top: 16px;
    }

    .query-form {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .query-form button {
        width: 100%;
    }

    .detail-stats {
        grid-template-columns: 1fr;
    }
}

/* 一键退费 */
.detail-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 14px;
}

.refund-button {
    height: 34px;
    padding: 0 18px;
    border: 1px solid #c0392b;
    border-radius: 5px;
    color: #ffffff;
    background: #c0392b;
    font-weight: 600;
}

.refund-button:hover:not(:disabled) {
    background: #a93226;
}

.refund-button:disabled {
    border-color: #d8a99f;
    background: #d8a99f;
    cursor: not-allowed;
}

.delete-member-button {
    height: 34px;
    padding: 0 18px;
    border: 1px solid #7b241c;
    border-radius: 5px;
    color: #ffffff;
    background: #7b241c;
    font-weight: 600;
}

.delete-member-button:hover:not(:disabled) {
    background: #5d1a14;
}

.delete-member-button:disabled {
    border-color: #c9a6a1;
    background: #c9a6a1;
    cursor: not-allowed;
}

.detail-table tr.is-refund td {
    color: #b06a2c;
    background: #fdf6ec;
}

.detail-table td.memo-column {
    color: #8a6d3b;
    white-space: nowrap;
}