:root {
    --sky: #dff4ff;
    --paper: #f9fdff;
    --ink: #24355e;
    --muted: #677391;
    --blue: #1682c5;
    --cyan: #0794a4;
    --pink: #d94b87;
    --lime: #91b72e;
    --yellow: #e6a518;
    --red: #c93c49;
    --line: #acd5e9;
    --shadow: 0 8px 24px rgba(38, 86, 120, .11);
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--sky); }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: linear-gradient(180deg, #eefaff 0, var(--sky) 260px, #f8fcff 100%);
    font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
    letter-spacing: 0;
}
a { color: var(--blue); text-decoration: none; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
.site-header {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 0 max(20px, calc((100vw - 1180px) / 2));
    background: rgba(249, 253, 255, .96);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand .leaf {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    display: block;
    overflow: hidden;
    color: transparent;
    background: url("mxd_maple_leaf.png") center / contain no-repeat;
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; }
nav { display: flex; align-items: center; gap: 20px; font-size: 14px; }
nav a, .link-button { color: var(--ink); }
.nav-accent { color: var(--pink); font-weight: 700; }
.inline { display: inline-flex; margin: 0; }
.link-button { padding: 0; border: 0; background: transparent; cursor: pointer; }
.promo-strip {
    min-height: 118px;
    display: flex;
    align-items: center;
    padding: 22px max(20px, calc((100vw - 1180px) / 2));
    background:
        linear-gradient(90deg, rgba(22,130,197,.92), rgba(7,148,164,.82) 52%, rgba(145,183,46,.8)),
        url("hero.png") center 42% / cover;
    color: #fff;
    border-bottom: 4px solid rgba(255,255,255,.7);
}
.promo-strip span, .promo-strip strong { display: block; text-shadow: 0 2px 8px rgba(0,0,0,.2); }
.promo-strip span { font-size: 12px; font-weight: 800; }
.promo-strip strong { margin-top: 5px; font-size: 24px; }
.site-main { width: min(1180px, calc(100% - 32px)); margin: 28px auto 56px; }
.welcome { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .8fr); gap: 42px; align-items: center; padding: 28px 0; }
.eyebrow { color: var(--cyan); font-size: 12px; font-weight: 800; margin: 0 0 7px; }
h1 { margin: 0; font-size: 30px; line-height: 1.25; }
h2 { font-size: 18px; }
.welcome p:not(.eyebrow) { color: var(--muted); max-width: 650px; line-height: 1.9; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.btn {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 17px;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
}
.btn.primary { color: white; background: var(--blue); border-color: var(--blue); }
.btn.secondary { color: var(--blue); background: white; border-color: var(--line); }
.btn.download { color: white; background: var(--cyan); border-color: var(--cyan); }
.btn.purchase { color: white; background: var(--red); border-color: var(--red); }
.btn.disabled { color: var(--muted); background: #edf3f6; border-color: #d5e1e7; cursor: default; }
.btn.danger { color: var(--red); background: #fff4f4; border-color: #edb9bf; }
.btn.tiny { min-height: 28px; padding: 4px 9px; font-size: 12px; }
.status-board { border-left: 4px solid var(--pink); background: rgba(255,255,255,.76); box-shadow: var(--shadow); }
.status-board div { display: flex; justify-content: space-between; gap: 18px; padding: 17px 20px; border-bottom: 1px solid var(--line); }
.status-board div:last-child { border: 0; }
.status-board span { color: var(--muted); }
.notice { margin-bottom: 16px; padding: 12px 15px; border-left: 4px solid var(--blue); background: #eef9ff; line-height: 1.6; }
.notice.success { border-color: var(--lime); background: #f5fae9; }
.notice.error { border-color: var(--red); background: #fff1f2; }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px 16px; }
.auth-shell.compact { min-height: 440px; }
.auth-panel { width: min(480px, 100%); padding: 28px; background: rgba(255,255,255,.9); border: 1px solid var(--line); box-shadow: var(--shadow); }
.auth-panel h1 { font-size: 25px; margin-bottom: 22px; }
.form-stack { display: grid; gap: 14px; }
label { display: grid; gap: 6px; color: var(--ink); font-size: 13px; font-weight: 700; }
label small, form > small { color: var(--muted); font-weight: 400; }
input, select, textarea {
    width: 100%;
    min-height: 39px;
    padding: 8px 10px;
    color: var(--ink);
    background: white;
    border: 1px solid var(--line);
    border-radius: 4px;
    outline: 0;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(22,130,197,.1); }
input[readonly] { background: #f0f5f8; color: var(--muted); }
.form-foot { text-align: center; color: var(--muted); font-size: 13px; margin: 18px 0 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 20px; }
.form-grid .wide { grid-column: 1 / -1; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.badge { display: inline-flex; align-items: center; min-height: 27px; padding: 4px 9px; border-radius: 4px; font-size: 12px; font-weight: 800; }
.badge.active { color: #507600; background: #eef7d5; }
.badge.expired { color: #9d3541; background: #fde8eb; }
.badge.pending { color: #8a6200; background: #fff3c9; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.metric-grid article { min-width: 0; padding: 20px; background: white; border-top: 3px solid var(--cyan); box-shadow: var(--shadow); }
.metric-grid article:nth-child(2) { border-color: var(--pink); }
.metric-grid article:nth-child(3) { border-color: var(--lime); }
.metric-grid article:nth-child(4) { border-color: var(--yellow); }
.metric-grid span, .metric-grid strong { display: block; }
.metric-grid span { color: var(--muted); font-size: 12px; }
.metric-grid strong { margin-top: 9px; font-size: 20px; overflow-wrap: anywhere; }
.content-band, .redeem-band {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-top: 22px;
    padding: 20px;
    background: rgba(255,255,255,.78);
    border: 1px solid var(--line);
}
.content-band h2, .content-band p { margin: 0; }
.content-band p { margin-top: 6px; color: var(--muted); }
.redeem-band form { flex: 1; display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.redeem-band form label { grid-column: 1; }
.redeem-band form button { grid-column: 2; grid-row: 1; }
.redeem-band > div { min-width: 220px; padding-left: 22px; border-left: 1px solid var(--line); }
.redeem-band span, .redeem-band strong { display: block; }
.redeem-band span { color: var(--muted); font-size: 12px; }
.redeem-band strong { margin-top: 6px; }
.section-title { margin: 28px 0 12px; }
.plan-grid, .plan-admin-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.plan-grid article { padding: 18px; background: white; border: 1px solid var(--line); border-top: 4px solid var(--pink); }
.plan-grid article:nth-child(2n) { border-top-color: var(--cyan); }
.plan-grid article > span, .code-prefix { color: var(--cyan); font-size: 11px; font-weight: 800; }
.plan-grid h3 { margin: 8px 0; font-size: 17px; }
.plan-grid article > strong { font-size: 22px; }
.plan-grid p, .plan-grid small { color: var(--muted); line-height: 1.5; }
.table-wrap { width: 100%; overflow: auto; background: white; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid #d8eaf3; white-space: nowrap; }
th { color: var(--muted); background: #edf8fd; font-size: 12px; }
tr:last-child td { border-bottom: 0; }
.empty { padding: 34px; text-align: center; color: var(--muted); }
.positive { color: #5b8410; font-weight: 700; }
.negative { color: var(--red); font-weight: 700; }
.referral-copy { display: grid; grid-template-columns: 1fr 2fr; gap: 14px; margin-bottom: 16px; }
.referral-copy label > div { display: flex; }
.referral-copy input { border-radius: 4px 0 0 4px; }
.referral-copy .btn { border-radius: 0 4px 4px 0; flex: none; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.settings-panel { display: grid; gap: 13px; padding: 20px; background: white; border: 1px solid var(--line); }
.settings-panel h2 { margin: 0 0 4px; }
footer { display: flex; justify-content: center; gap: 20px; padding: 22px; color: var(--muted); border-top: 1px solid var(--line); font-size: 12px; }

.admin-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); min-height: calc(100vh - 64px); }
.admin-nav { padding: 18px 12px; background: #eaf7fc; border-right: 1px solid var(--line); }
.admin-nav a { display: block; padding: 11px 13px; margin-bottom: 3px; color: var(--ink); border-left: 3px solid transparent; }
.admin-nav a.active { color: var(--blue); background: white; border-left-color: var(--pink); font-weight: 800; }
.admin-main { min-width: 0; padding: 26px; }
.admin-user { color: var(--muted); }
.admin-tool { margin-bottom: 16px; padding: 14px; background: white; border: 1px solid var(--line); }
.admin-tool summary { cursor: pointer; font-weight: 800; }
.open-tool { display: block; }
.form-inline { display: flex; align-items: end; gap: 12px; }
.form-inline label { min-width: 180px; }
.search-row { display: flex; gap: 8px; max-width: 500px; margin-bottom: 12px; }
.controls { gap: 5px; }
.controls select { min-width: 80px; min-height: 30px; padding: 4px; }
.plan-admin-grid { grid-template-columns: repeat(5, minmax(170px, 1fr)); }
.check-line { display: flex; grid-template-columns: auto 1fr; align-items: center; }
.check-line input { width: auto; min-height: auto; }
.settings-panel.narrow { max-width: 540px; }
.generated-box { margin-bottom: 16px; padding: 18px; background: #fffbea; border: 1px solid #e9d082; }
.generated-box h2, .generated-box p { margin-top: 0; }
code { color: var(--pink); }
.announcement-editor { max-width: 760px; }
.homepage-links-editor { max-width: 760px; }
.homepage-links-preview {
    max-width: 760px;
    margin-top: 16px;
    padding: 18px 20px;
    background: #eef9ff;
    border: 1px solid var(--line);
    border-left: 4px solid var(--lime);
}
.homepage-links-preview > span { color: var(--cyan); font-size: 11px; font-weight: 800; }
.homepage-links-preview .actions { margin-top: 12px; }
.announcement-preview {
    max-width: 760px;
    margin-top: 16px;
    padding: 18px 20px;
    background: #f4fae8;
    border: 1px solid #cfdfa9;
    border-left: 4px solid var(--pink);
}
.announcement-preview span,
.announcement-preview strong,
.announcement-preview small { display: block; }
.announcement-preview span { color: var(--cyan); font-size: 11px; font-weight: 800; }
.announcement-preview strong { margin-top: 7px; }
.announcement-preview p { margin: 9px 0; line-height: 1.75; white-space: normal; }
.announcement-preview small { color: var(--muted); }
.buy-main { max-width: 1080px; }
.purchase-plan-grid { display: grid; grid-template-columns: repeat(5, minmax(160px, 1fr)); gap: 12px; }
.purchase-plan { display: grid; align-content: start; gap: 11px; padding: 19px; background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--cyan); box-shadow: var(--shadow); }
.purchase-plan:nth-child(2n) { border-top-color: var(--red); }
.purchase-plan > span { color: var(--cyan); font-size: 11px; font-weight: 800; }
.purchase-plan h2, .purchase-plan p { margin: 0; }
.purchase-plan p { min-height: 44px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.plan-price { color: var(--red); font-size: 25px; font-weight: 800; }
.order-lookup { margin-top: 24px; padding: 16px 20px; background: #fff; border: 1px solid var(--line); }
.order-lookup summary { cursor: pointer; font-weight: 800; }
.checkout-grid, .commerce-settings { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr); gap: 18px; }
.order-panel, .payment-panel { padding: 22px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); }
.order-panel > div { display: flex; justify-content: space-between; gap: 18px; padding: 13px 0; border-bottom: 1px solid #d8eaf3; }
.order-panel span { color: var(--muted); }
.order-panel .price { color: var(--red); font-size: 25px; }
.order-panel .code-delivery { display: grid; justify-content: stretch; }
.code-delivery code { padding: 14px; background: #f4fae8; border: 1px dashed var(--lime); font-size: 18px; text-align: center; }
.payment-panel { text-align: center; }
.payment-panel h2 { margin-top: 0; }
.payment-panel p { color: var(--muted); line-height: 1.7; }
.payment-panel small { color: var(--muted); }
.payment-qr { display: block; width: min(280px, 100%); aspect-ratio: 1; object-fit: contain; margin: 0 auto; background: #fff; border: 1px solid var(--line); }
.qr-empty { display: grid; width: min(280px, 100%); aspect-ratio: 1; place-items: center; margin: 0 auto; color: var(--muted); background: #edf3f6; border: 1px dashed var(--line); }
.qr-preview { text-align: center; }
.order-filter { display: flex; gap: 8px; margin: 22px 0 10px; }
.order-filter a { padding: 7px 12px; background: #fff; border: 1px solid var(--line); border-radius: 4px; }
.slider-captcha { display: grid; width: 300px; max-width: 100%; gap: 8px; user-select: none; }
.slider-picture { position: relative; width: 100%; height: 82px; overflow: hidden; border: 1px solid var(--line); border-radius: 5px; }
.slider-picture > img { display: block; width: 100%; height: 82px; object-fit: fill; }
.slider-piece { position: absolute; z-index: 3; left: 8px; top: 26px; width: 24px; height: 32px; background: var(--red); clip-path: polygon(25% 25%,25% 0,75% 0,75% 25%,100% 25%,100% 44%,75% 44%,75% 63%,100% 63%,100% 100%,0 100%,0 63%,25% 63%,25% 44%,0 44%,0 25%); filter: drop-shadow(0 2px 3px rgba(36,53,94,.25)); pointer-events: none; }
.slider-piece::after { content: ""; position: absolute; inset: 2px; background: rgba(255,255,255,.94); clip-path: inherit; }
.slider-track { position: relative; display: block; width: 100%; height: 42px; min-height: 42px; overflow: hidden; background: #edf5f8; border: 1px solid var(--line); border-radius: 5px; touch-action: none; }
.slider-track em { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 12px; font-style: normal; pointer-events: none; }
.slider-progress { position: absolute; inset: 0 auto 0 0; width: 40px; background: #dff3df; border-right: 1px solid #92c895; }
.slider-handle { position: absolute; z-index: 2; left: 0; top: 0; display: grid; place-items: center; width: 40px; min-width: 40px; height: 40px; min-height: 40px; margin: 0; padding: 0; color: var(--red); background: #fff; border: 0; border-right: 1px solid var(--line); border-radius: 0; cursor: grab; touch-action: none; }
.slider-handle:active { cursor: grabbing; }
.slider-captcha.attempted .slider-track em { opacity: 0; }
.resend-form { margin-top: 18px; text-align: center; }
.security-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); gap: 18px; max-width: 980px; }
.compact-grid { margin: 0; }
.settings-help { margin-top: 0; color: var(--muted); line-height: 1.7; }
.smtp-reference { display: grid; gap: 8px; margin-top: 18px; padding: 15px; background: #eef9ff; border-left: 4px solid var(--cyan); }
.smtp-reference span { color: var(--muted); font-size: 13px; }
.download-main { max-width: 980px; }
.download-promo {
    background:
        linear-gradient(90deg, rgba(7,148,164,.91), rgba(22,130,197,.83) 50%, rgba(201,60,73,.73)),
        url("hero.png") center 42% / cover;
}
.download-grid { display: grid; gap: 13px; }
.download-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 24px;
    min-height: 132px;
    padding: 22px;
    background: #fff;
    border: 1px solid var(--line);
    border-left: 5px solid var(--cyan);
    box-shadow: var(--shadow);
}
.download-card:nth-child(2n) { border-left-color: var(--red); }
.download-card:nth-child(3n) { border-left-color: var(--lime); }
.download-card-content { min-width: 0; }
.download-card-content h2 { margin: 5px 0 0; font-size: 19px; }
.download-card-content p { margin: 8px 0 0; color: var(--muted); line-height: 1.65; }
.download-number { color: var(--cyan); font-size: 11px; font-weight: 800; }
.download-card-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(126px, 1fr));
    gap: 8px;
}
.download-card-actions.single { grid-template-columns: minmax(150px, 1fr); }
.download-card-actions .btn { text-align: center; overflow-wrap: anywhere; }
.download-empty { padding: 42px 20px; color: var(--muted); text-align: center; background: #fff; border: 1px solid var(--line); }
.download-admin-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.download-admin-item { padding: 18px; background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--cyan); }
.download-admin-item:nth-child(2n) { border-top-color: var(--red); }
.download-editor { margin-top: 12px; }
.download-admin-item .download-editor { margin-top: 0; }
.download-delete-form { margin-top: 10px; padding-top: 10px; text-align: right; border-top: 1px solid #d8eaf3; }
.model-admin-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.model-admin-item { padding: 18px; background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--lime); }
.model-admin-item:nth-child(2n) { border-top-color: var(--red); }
.model-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.model-card-head img { width: 58px; height: 58px; flex: 0 0 58px; object-fit: cover; background: #edf3f6; border: 1px solid var(--line); border-radius: 5px; }
.model-card-head strong, .model-card-head span { display: block; }
.model-card-head span { margin-top: 5px; color: var(--muted); font-size: 12px; }
.model-editor { margin-top: 12px; }
.model-delete-form { margin-top: 10px; padding-top: 10px; text-align: right; border-top: 1px solid #d8eaf3; }

@media (max-width: 900px) {
    .site-header { height: auto; min-height: 64px; padding: 10px 16px; align-items: flex-start; }
    nav { gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
    .promo-strip { padding-inline: 18px; }
    .welcome, .two-column { grid-template-columns: 1fr; }
    .metric-grid { grid-template-columns: 1fr 1fr; }
    .plan-grid { grid-template-columns: repeat(2, 1fr); }
    .plan-admin-grid { grid-template-columns: 1fr 1fr; }
    .purchase-plan-grid { grid-template-columns: repeat(2, 1fr); }
    .admin-layout { grid-template-columns: 1fr; }
    .admin-nav { display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
    .admin-nav a { flex: none; }
    .download-admin-list { grid-template-columns: 1fr; }
    .model-admin-list { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .site-header { display: block; }
    .site-header nav { margin-top: 10px; justify-content: flex-start; }
    .promo-strip strong { font-size: 19px; }
    .site-main { width: min(100% - 20px, 1180px); margin-top: 18px; }
    h1 { font-size: 25px; }
    .metric-grid, .plan-grid, .plan-admin-grid, .form-grid, .referral-copy { grid-template-columns: 1fr; }
    .purchase-plan-grid, .checkout-grid, .commerce-settings, .security-grid { grid-template-columns: 1fr; }
    .content-band, .redeem-band { align-items: stretch; flex-direction: column; }
    .redeem-band > div { padding: 14px 0 0; border-left: 0; border-top: 1px solid var(--line); }
    .redeem-band form { grid-template-columns: 1fr; }
    .redeem-band form button { grid-column: 1; grid-row: auto; }
    .admin-main { padding: 16px 10px; }
    .form-inline { align-items: stretch; flex-direction: column; }
    .form-inline label { min-width: 0; width: 100%; }
    .download-card { grid-template-columns: 1fr; align-items: stretch; gap: 16px; }
    .download-card-actions { grid-template-columns: 1fr; }
}
