:root {
    --green: #07c160;
    --green-dark: #06ad56;
    --green-soft: #e8f8ef;
    --text: #1a1a1a;
    --muted: #888;
    --border: #e8e8e8;
    --bg: #f5f5f5;
    --header-h: 56px;
    --sidebar-w: 200px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    font-size: 14px;
}

a { color: #576b95; text-decoration: none; }
a:hover { color: var(--green); }

.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-h);
    background: #fff;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    z-index: 20;
    padding: 0 24px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 220px;
    color: inherit;
}

.brand-mark {
    width: 28px;
    height: 28px;
    display: block;
    flex-shrink: 0;
    border-radius: 50%;
    object-fit: cover;
}

.brand-name {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: .5px;
}

.brand-split {
    width: 1px;
    height: 16px;
    background: #ddd;
    margin: 0 2px;
}

.brand-sub {
    color: #666;
    font-size: 14px;
}

.top-user {
    margin-left: auto;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
}

.top-user .link,
.top-user button.link {
    color: #666;
    border: 0;
    background: none;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    padding: 0;
}

.top-user .link:hover,
.top-user button.link:hover { color: var(--green); }

.layout {
    padding-top: var(--header-h);
    min-height: 100%;
    display: flex;
}

.sidebar {
    width: var(--sidebar-w);
    background: #fff;
    border-right: 1px solid #f0f0f0;
    min-height: calc(100vh - var(--header-h));
    padding: 16px 0 40px;
    flex-shrink: 0;
}

.side-title {
    padding: 10px 24px 6px;
    color: #b0b0b0;
    font-size: 12px;
}

.side-item {
    display: block;
    padding: 8px 24px 8px 36px;
    color: #333;
    position: relative;
}

.side-item:hover { color: var(--green); }

.side-item.active {
    color: var(--green);
    background: #fff;
}

.side-item.active:before {
    content: "";
    position: absolute;
    left: 0; top: 6px; bottom: 6px;
    width: 3px;
    background: var(--green);
    border-radius: 0 2px 2px 0;
}

.content {
    flex: 1;
    padding: 24px 28px 48px;
    min-width: 0;
}

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

.page-title {
    font-size: 18px;
    font-weight: 500;
}

.panel {
    background: #fff;
    padding: 8px 24px 28px;
    min-height: 360px;
}

.cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.cards article {
    background: #fff;
    padding: 20px 22px;
    min-height: 96px;
}

.cards h3 { margin-bottom: 8px; font-size: 12px; color: #888; font-weight: 400; }
.cards p { font-size: 22px; font-weight: 500; }

.btn {
    display: inline-block;
    height: 32px;
    line-height: 32px;
    padding: 0 22px;
    border: 1px solid transparent;
    border-radius: 2px;
    cursor: pointer;
    font-size: 14px;
    background: #fff;
    font-family: inherit;
}

.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); color: #fff; }
.btn-ghost { border-color: #ddd; color: #333; }
.btn-ghost:hover { border-color: var(--green); color: var(--green); }
.btn:disabled { opacity: .6; cursor: not-allowed; }

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

table.data th {
    background: #fafafa;
    color: #b0b0b0;
    font-weight: 400;
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid #f0f0f0;
}

table.data td {
    padding: 14px 10px;
    border-bottom: 1px solid #f7f7f7;
    color: #333;
    vertical-align: middle;
}

table.data img.thumb {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 4px;
    background: #f5f5f5;
    display: block;
}

.empty { text-align: center; color: #bbb; padding: 48px 0 24px; }

.pay-ops {
    display: inline-flex;
    gap: 12px;
    align-items: center;
}

.pay-ops a,
.pay-ops button {
    border: 0;
    background: none;
    padding: 0;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    color: #576b95;
}

.pay-ops button.danger { color: #fa5151; }
.pay-ops a:hover,
.pay-ops button:hover { color: var(--green); }

/* auth */
.auth-page { min-height: 100vh; background: #f3f5f7; }
.auth-top {
    height: 56px;
    background: #fff;
    display: flex;
    align-items: center;
    padding: 0 40px;
    border-bottom: 1px solid #eee;
}
.auth-wrap {
    width: 420px;
    margin: 72px auto 40px;
    background: #fff;
    padding: 36px 40px 40px;
    box-shadow: 0 8px 24px rgba(0,0,0,.04);
}
.auth-wrap h1 { font-size: 20px; font-weight: 500; margin-bottom: 6px; }
.auth-wrap .sub { color: #999; margin-bottom: 28px; }
.auth-field { margin-bottom: 16px; }
.auth-field label { display: block; margin-bottom: 6px; color: #666; }
.auth-field input {
    width: 100%;
    height: 40px;
    border: 1px solid #ddd;
    padding: 0 12px;
    outline: none;
    font-size: 14px;
    background: #fff;
}
.auth-field input:focus { border-color: var(--green); }
.btn-block { width: 100%; height: 40px; line-height: 40px; margin-top: 8px; }
.form-msg { min-height: 20px; margin-top: 10px; color: #cf1322; font-size: 13px; }

/* modal */
.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 50;
    padding: 4vh 16px 24px;
    overflow: auto;
}
.modal-mask[hidden] { display: none; }
.modal {
    width: 520px;
    background: #fff;
    box-shadow: 0 8px 28px rgba(0,0,0,.15);
}
.modal.wide { width: min(860px, 100%); }
.modal-hd {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    font-size: 16px;
}
.modal-close {
    border: 0;
    background: none;
    font-size: 22px;
    cursor: pointer;
    color: #999;
    width: 32px;
    height: 32px;
}
.modal-close:hover { color: #333; }
.modal-bd { padding: 8px 24px 8px; }
.modal-ft {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px 24px;
}
.form-row {
    display: flex;
    align-items: flex-start;
    margin-bottom: 18px;
}
.form-row.block { display: block; }
.form-row.block .form-label { width: auto; text-align: left; padding: 0 0 8px; }
.editor-wrap { border: 1px solid #d9d9d9; background: #fff; }
#policyToolbar { border-bottom: 1px solid #eee; }
#policyEditor { height: 160px; }
#policyEditor .w-e-text-container,
#policyEditor .w-e-scroll {
    height: 100% !important;
}
#policyEditor [data-slate-editor] {
    min-height: 100% !important;
    cursor: text;
}
.form-label {
    width: 80px;
    text-align: right;
    padding: 8px 16px 0 0;
    color: #333;
    flex-shrink: 0;
}
.form-control {
    height: 32px;
    width: 320px;
    border: 1px solid #d9d9d9;
    padding: 0 10px;
    outline: none;
    background: #fff;
    font-size: 13px;
}
.form-control:focus { border-color: var(--green); }
.logo-field { display: flex; align-items: center; gap: 12px; }
.logo-field img,
.logo-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    object-fit: cover;
    background: #f5f5f5;
    border: 1px solid #eee;
}
.logo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #bbb;
    font-size: 12px;
}
.field-hint { display: block; margin-top: 6px; color: #999; font-size: 12px; }
.logo-field input[type="file"] { font-size: 13px; }
textarea.form-control {
    height: auto;
    min-height: 84px;
    padding: 8px 10px;
    resize: vertical;
    line-height: 1.5;
}
select.form-control { padding-right: 24px; }
.check-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    color: #333;
}
.req { color: #fa5151; margin-left: 2px; }
.crumb { color: #999; font-size: 13px; margin-bottom: 8px; }
.crumb a { color: #576b95; }
.apply-panel { padding: 0 0 8px; }
.apply-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    min-height: 480px;
}
.apply-side {
    border-right: 1px solid #f0f0f0;
    padding: 0 0 16px;
}
.apply-main { padding: 0 24px 16px; min-width: 0; }
.apply-side-hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    font-weight: 500;
}
.apply-main .apply-side-hd { padding-left: 0; padding-right: 0; }
.section-list { padding-bottom: 8px; }
.section-item {
    padding: 12px 20px 14px;
    border-left: 3px solid transparent;
    cursor: pointer;
}
.section-item:hover { background: #fafafa; }
.section-item.active {
    background: #f7fbf8;
    border-left-color: var(--green);
}
.section-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}
.section-no {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #07c160;
    color: #fff;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.section-item:not(.active) .section-no { background: #c8c8c8; }
.section-intro {
    margin: 6px 0 8px 26px;
    color: #999;
    font-size: 12px;
    line-height: 1.4;
}
.approver-panel { margin-top: 16px; padding: 8px 24px 24px; }
.approver-panel .apply-side-hd { padding: 16px 0 8px; }
.approver-hint { margin: 0 0 12px; }
.search-box { position: relative; }
.search-box .form-control { width: 280px; }
.search-result {
    position: absolute;
    right: 0;
    top: 36px;
    width: 360px;
    max-height: 240px;
    overflow: auto;
    background: #fff;
    border: 1px solid #eee;
    box-shadow: 0 8px 20px rgba(0,0,0,.08);
    z-index: 8;
}
.search-item {
    padding: 8px 12px;
    cursor: pointer;
}
.search-item:hover { background: #f7fbf8; }
.search-item .email { color: #333; }
.search-item .meta { color: #999; font-size: 12px; margin-top: 2px; }
.search-empty { padding: 16px 12px; color: #bbb; text-align: center; }
.record-filter { display: flex; gap: 8px; align-items: center; }
.pager {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 0 4px;
    color: #888;
    font-size: 13px;
}
.pager button {
    border: 1px solid #ddd;
    background: #fff;
    height: 28px;
    padding: 0 12px;
    cursor: pointer;
    font-family: inherit;
}
.pager button:disabled { opacity: .45; cursor: not-allowed; }
.status.ok { color: #07c160; }
.record-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 16px;
    margin-bottom: 18px;
    color: #555;
    font-size: 13px;
}
.record-section { margin-bottom: 20px; }
.record-section h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.record-section table.data th {
    background: #fafafa;
    color: #666;
    width: 140px;
}
.preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.preview-thumb {
    width: 96px;
    height: 96px;
    object-fit: cover;
    border: 1px solid #eee;
    border-radius: 4px;
    background: #f5f5f5;
    cursor: zoom-in;
    display: block;
}
.img-preview {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.78);
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    cursor: zoom-out;
}
.img-preview[hidden] { display: none; }
.img-preview img {
    max-width: min(92vw, 1200px);
    max-height: 90vh;
    object-fit: contain;
    box-shadow: 0 8px 32px rgba(0,0,0,.35);
}
.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tab {
    height: 32px;
    padding: 0 16px;
    border: 1px solid #eee;
    background: #fff;
    cursor: pointer;
    font-family: inherit;
    color: #666;
}
.tab.active { color: var(--green); border-color: var(--green); background: var(--green-soft); }
.status.warn { color: #fa9d3b; }
.status.err { color: #fa5151; }
.audit-ft { justify-content: space-between; align-items: center; }
.audit-action { display: flex; gap: 8px; align-items: center; flex: 1; }
.audit-action .form-control { width: 240px; }
.appeal-ft {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
}
.appeal-action .form-control { width: 100%; }
.appeal-ft .form-msg { margin-top: 6px; min-height: 0; }
.appeal-btns {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}
.pay-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    width: 100%;
}
.pay-form label {
    display: block;
    color: #666;
    font-size: 12px;
    margin-bottom: 6px;
}
.pay-form .form-control { width: 100%; }
select.form-control { padding-right: 8px; }

@media (max-width: 900px) {
    .layout { display: block; }
    .sidebar { width: 100%; min-height: auto; border-right: 0; border-bottom: 1px solid #f0f0f0; }
    .cards { grid-template-columns: 1fr; }
    .auth-wrap { width: auto; margin: 32px 16px; padding: 28px 20px; }
    .apply-grid { grid-template-columns: 1fr; }
    .apply-side { border-right: 0; border-bottom: 1px solid #f0f0f0; }
}
