:root {
    --ink: #18222d;
    --muted: #637083;
    --line: #d9e0e8;
    --surface: #ffffff;
    --canvas: #f4f7f9;
    --teal: #0f766e;
    --teal-dark: #0b5e57;
    --amber: #b45309;
    --coral: #be3b4a;
    --blue: #245b9f;
    --shadow: 0 8px 22px rgba(31, 45, 61, 0.08);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--canvas); font: 15px/1.55 Arial, "Microsoft YaHei", sans-serif; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar, .app-main, .site-footer { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }
.topbar { height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: inline-flex; align-items: center; min-width: 0; gap: 9px; font-size: 18px; font-weight: 700; }
.brand img { width: 30px; height: 30px; border-radius: 5px; object-fit: cover; }
.brand strong { color: var(--teal); font-size: 13px; font-weight: 700; padding-left: 9px; border-left: 1px solid var(--line); }
.topnav { display: flex; align-items: center; gap: 16px; color: var(--muted); font-size: 14px; }
.topnav a:hover, .link-button:hover { color: var(--teal); }
.inline-form { display: inline; }
.link-button { border: 0; color: var(--muted); background: none; padding: 0; }

.app-main { min-height: calc(100vh - 134px); padding: 42px 0 48px; }
.site-footer { color: var(--muted); border-top: 1px solid var(--line); padding: 18px 0 28px; font-size: 13px; }
.notice { width: min(760px, 100%); margin: 0 auto 24px; padding: 11px 14px; border: 1px solid; border-radius: 5px; }
.notice-success { color: #0b5e57; background: #e6f6f2; border-color: #9bd8cc; }
.notice-error { color: #8d2736; background: #fff0f1; border-color: #efb7be; }

.request-shell { display: grid; grid-template-columns: minmax(240px, 0.85fr) minmax(360px, 1fr); gap: 68px; width: min(860px, 100%); margin: 42px auto 0; align-items: center; }
.request-context { min-height: 330px; padding: 12px 0; }
.context-mark { width: 58px; height: 58px; object-fit: cover; border-radius: 7px; margin-bottom: 24px; }
.eyebrow { margin: 0 0 7px; color: var(--teal); font-size: 12px; font-weight: 700; letter-spacing: 0; text-transform: uppercase; }
h1, h2 { margin: 0; line-height: 1.25; letter-spacing: 0; }
h1 { font-size: 30px; }
h2 { font-size: 21px; }
.step-list { list-style: none; margin: 30px 0 0; padding: 0; border-left: 1px solid var(--line); }
.step-list li { padding: 9px 0 9px 15px; color: var(--muted); }
.step-list span { display: inline-block; width: 31px; color: #8b98a6; font-family: Consolas, monospace; font-size: 12px; }
.step-list .is-current { color: var(--ink); font-weight: 700; border-left: 3px solid var(--teal); margin-left: -1px; padding-left: 13px; }

.form-panel, .confirmation-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); padding: 30px; }
.panel-heading { margin-bottom: 26px; }
.supporting-copy { margin: 8px 0 0; color: var(--muted); overflow-wrap: anywhere; }
.form-stack { display: grid; gap: 10px; }
.form-stack label { margin-top: 6px; color: #465466; font-size: 13px; font-weight: 700; }
.form-stack input, .form-stack select, .form-stack textarea { width: 100%; min-height: 43px; padding: 10px 11px; color: var(--ink); border: 1px solid #bfcad6; border-radius: 4px; background: #fff; outline: none; }
.form-stack textarea { min-height: 120px; resize: vertical; }
.form-stack input:focus, .form-stack select:focus, .form-stack textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.13); }
.form-stack input[readonly] { color: var(--muted); background: #f3f6f8; }
.benefit-summary { margin: 0; padding: 0; }
.benefit-summary h2 { font-size: 17px; }
.benefit-membership { margin: 0 0 10px; color: var(--ink); }
.benefit-membership strong { color: var(--teal); }
.benefit-list { display: grid; gap: 7px; margin: 10px 0 0; padding-left: 22px; color: #465466; }
.ticket-confirmation-page { width: min(800px, 100%); margin: 0 auto; }
.ticket-confirmation-panel { padding: 26px 30px; }
.ticket-confirmation-panel .panel-heading { margin-bottom: 20px; }
.ticket-benefit-grid { padding: 17px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.qq-contact { min-width: 0; }
.qq-contact p { margin: 0; color: var(--ink); font-weight: 700; }
.qq-contact-actions { display: flex; align-items: center; gap: 12px; margin-top: 11px; }
.qq-contact-actions .secondary-button { flex: 1; padding: 8px 10px; font-size: 13px; }
.qq-friend-qr { width: 128px; height: 128px; background: #fff; image-rendering: pixelated; }
.ticket-account-contact { margin: 0 0 18px; padding: 15px 0; border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); }
.mengya-registration { display: flex; align-items: center; gap: 12px; margin: 0; padding: 14px 0 2px; }
.mengya-registration .eyebrow { flex: 0 0 auto; margin: 0; }
.mengya-registration .supporting-copy { flex: 1; margin: 0; }
.mengya-registration .secondary-button { flex: 0 0 auto; min-height: 37px; margin: 0; padding: 7px 10px; font-size: 13px; }
.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; min-height: 43px; padding: 10px 16px; border-radius: 4px; font-weight: 700; }
.primary-button { margin-top: 12px; color: #fff; background: var(--teal); border: 1px solid var(--teal); }
.primary-button:hover { background: var(--teal-dark); border-color: var(--teal-dark); }
.secondary-button { color: var(--ink); background: #fff; border: 1px solid #bdc9d5; }
.secondary-button:hover { border-color: var(--teal); color: var(--teal); }
.single-column-page { width: min(510px, 100%); margin: 48px auto 0; }
.confirmation-panel { text-align: left; }
.confirmation-panel .secondary-button { margin-top: 20px; }
.ticket-account-page { width: min(510px, 100%); margin: 36px auto 0; }
.ticket-account-panel { padding: 28px 30px; }
.ticket-account-panel .panel-heading { margin-bottom: 22px; }
.text-link { display: inline-block; margin-top: 18px; color: var(--muted); font-size: 13px; }
.text-link:hover { color: var(--teal); }
.status-result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 22px 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--line); }
.status-result-grid div { min-width: 0; padding: 14px; background: var(--surface); }
.status-result-grid dt { color: var(--muted); font-size: 12px; font-weight: 700; }
.status-result-grid dd { margin: 6px 0 0; overflow-wrap: anywhere; }
.status-result-empty { margin: 22px 0; padding: 17px; border: 1px solid var(--line); border-radius: 6px; background: #f8fafb; }
.status-result-empty h2 { font-size: 18px; }

.admin-page { width: min(1120px, 100%); margin: 0 auto; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 24px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 22px; }
.metric { min-height: 92px; padding: 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.metric span { display: block; color: var(--muted); font-size: 13px; }
.metric strong { display: block; margin-top: 6px; font-size: 25px; }
.metric-pending { border-top: 3px solid var(--amber); }
.metric-processing { border-top: 3px solid var(--blue); }
.metric-completed { border-top: 3px solid var(--teal); }
.metric-rejected { border-top: 3px solid var(--coral); }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-link { padding: 7px 11px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); background: var(--surface); font-size: 13px; }
.filter-link.is-active, .filter-link:hover { color: var(--teal); border-color: var(--teal); background: #edf9f7; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; min-width: 860px; }
th, td { padding: 13px 15px; text-align: left; border-bottom: 1px solid #e4e9ee; vertical-align: middle; }
th { color: var(--muted); background: #f8fafb; font-size: 12px; font-weight: 700; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfdfd; }
.ticket-link { color: var(--teal); font-weight: 700; }
.empty-cell { color: var(--muted); text-align: center; padding: 36px; }
.status { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.status-pending { color: #8d4d08; background: #fff3db; }
.status-processing { color: #194c8d; background: #e8f0fe; }
.status-completed { color: #075c55; background: #ddf6f1; }
.status-rejected { color: #942d3d; background: #fde8eb; }
.status-unsubmitted { color: #526170; background: #edf1f4; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 20px; color: var(--muted); }
.pagination-jump { display: flex; align-items: center; gap: 7px; }
.pagination-jump input[type="number"] { width: 68px; min-height: 32px; padding: 4px 7px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); }
.pagination-jump .secondary-button { min-height: 32px; padding: 5px 10px; }
.icon-button { display: grid; width: 32px; height: 32px; place-items: center; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); }
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 0 0 22px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--line); }
.detail-grid div { min-width: 0; padding: 16px; background: var(--surface); }
.detail-grid dt { color: var(--muted); font-size: 12px; font-weight: 700; }
.detail-grid dd { margin: 6px 0 0; overflow-wrap: anywhere; }
.admin-editor { width: min(620px, 100%); }
.delete-ticket-form { margin-top: 14px; }
.danger-button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 9px 14px; color: #942d3d; border: 1px solid #d99ba5; border-radius: 4px; background: #fff; font-weight: 700; }
.danger-button:hover { color: #fff; border-color: var(--coral); background: var(--coral); }
.settings-page { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 0.62fr); gap: 20px; align-items: start; }
.settings-page .page-heading { grid-column: 1 / -1; margin-bottom: 4px; }
.settings-form, .smtp-test-form { margin: 0; }
.settings-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.settings-grid label { display: block; margin: 0 0 6px; color: #465466; font-size: 13px; font-weight: 700; }
.checkbox-label { display: flex; align-items: center; gap: 7px; color: var(--muted) !important; font-weight: 400 !important; }
.checkbox-label input { width: 16px !important; min-height: 16px !important; padding: 0 !important; }
.admin-search { display: flex; align-items: end; gap: 9px; margin-bottom: 14px; }
.admin-search label { color: var(--muted); font-size: 13px; font-weight: 700; }
.admin-search input { width: min(360px, 100%); min-height: 40px; padding: 8px 10px; border: 1px solid #bfcad6; border-radius: 4px; background: #fff; }
.admin-search .secondary-button { min-height: 40px; padding: 8px 13px; }
.members-table { min-width: 1050px; }
.table-action-form { margin: 0; }
.table-danger-button { min-height: 30px; padding: 4px 8px; color: #942d3d; border: 1px solid #d99ba5; border-radius: 4px; background: #fff; font-size: 13px; }
.table-danger-button:hover { color: #fff; border-color: var(--coral); background: var(--coral); }
.ticket-table { min-width: 1080px; }
.ticket-status-form { display: flex; align-items: center; gap: 7px; }
.ticket-status-form select { min-height: 32px; padding: 4px 7px; border: 1px solid var(--line); border-radius: 4px; background: #fff; font-size: 13px; }
.table-status-button { min-height: 32px; padding: 4px 8px; color: #075c55; border: 1px solid #87cfc4; border-radius: 4px; background: #f3fcfa; font-size: 13px; font-weight: 700; white-space: nowrap; }
.table-status-button:hover { color: #fff; border-color: var(--teal); background: var(--teal); }

@media (max-width: 760px) {
    .topbar, .app-main, .site-footer { width: min(100% - 24px, 1120px); }
    .topbar { height: auto; min-height: 58px; padding: 8px 0; align-items: flex-start; }
    .brand { font-size: 16px; }
    .topnav { max-width: 170px; flex-wrap: wrap; justify-content: flex-end; row-gap: 4px; }
    .request-shell { grid-template-columns: 1fr; gap: 18px; margin-top: 12px; }
    .request-context { min-height: 0; padding: 4px 0; }
    .context-mark { width: 42px; height: 42px; margin-bottom: 13px; }
    .step-list { display: flex; border-left: 0; border-top: 1px solid var(--line); margin-top: 18px; overflow: hidden; }
    .step-list li { flex: 1; padding: 10px 6px; font-size: 12px; }
    .step-list span { display: block; margin-bottom: 2px; }
    .step-list .is-current { border-left: 0; border-top: 3px solid var(--teal); margin-top: -1px; padding-left: 6px; }
    .form-panel, .confirmation-panel { padding: 23px; }
    .single-column-page { margin-top: 18px; }
    .ticket-confirmation-page, .ticket-account-page { margin-top: 18px; }
    .ticket-confirmation-panel, .ticket-account-panel { padding: 23px; }
    .ticket-benefit-grid { padding: 15px 0; }
    .qq-contact-actions { justify-content: space-between; }
    .qq-contact-actions .secondary-button { flex: 0 1 auto; }
    .qq-friend-qr { display: none; }
    .mengya-registration { display: block; padding-top: 16px; }
    .mengya-registration .eyebrow { margin-bottom: 5px; }
    .mengya-registration .secondary-button { margin-top: 11px; }
    .page-heading { align-items: start; flex-direction: column; }
    .admin-search { align-items: stretch; flex-direction: column; }
    .admin-search input { width: 100%; }
    .pagination { flex-wrap: wrap; }
    .metric-grid { grid-template-columns: repeat(2, 1fr); }
    .detail-grid { grid-template-columns: 1fr 1fr; }
    .status-result-grid { grid-template-columns: 1fr; }
    .settings-page { display: block; }
    .settings-form, .smtp-test-form { width: 100%; margin-top: 18px; }
    .settings-grid { grid-template-columns: 1fr; }
    .qq-contact-actions { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 420px) {
    h1 { font-size: 26px; }
    .topnav { gap: 10px; font-size: 13px; }
    .brand strong { display: none; }
    .detail-grid { grid-template-columns: 1fr; }
}
