:root {
    color-scheme: light;
    --bg: #f4f7f6;
    --panel: #ffffff;
    --ink: #1c2523;
    --muted: #65736f;
    --line: #dbe4e0;
    --brand: #0f8b6f;
    --brand-dark: #096650;
    --accent: #e8b44b;
    --danger: #c83d3d;
    --success: #18764f;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--ink);
}

.shell {
    width: min(960px, calc(100% - 32px));
    margin: 0 auto;
    padding: 36px 0;
}

.compact {
    width: min(420px, calc(100% - 32px));
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 18px;
    box-shadow: 0 10px 30px rgba(17, 45, 38, 0.07);
}

.hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 10px;
    font-size: clamp(28px, 5vw, 44px);
}

h2 {
    margin-bottom: 18px;
    font-size: 22px;
}

.eyebrow {
    margin-bottom: 8px;
    color: var(--brand);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.muted {
    color: var(--muted);
}

.admin-link,
button {
    border: 0;
    border-radius: 7px;
    background: var(--brand);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.15s ease, transform 0.15s ease;
}

.admin-link {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    padding: 0 16px;
}

button {
    min-height: 46px;
    padding: 0 18px;
}

button:hover,
.admin-link:hover {
    background: var(--brand-dark);
}

button:active,
.admin-link:active {
    transform: translateY(1px);
}

button:disabled {
    background: #a9b7b2;
    cursor: not-allowed;
    transform: none;
}

label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 0 14px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}

textarea {
    min-height: 120px;
    padding: 12px 14px;
    resize: vertical;
}

.inline-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
}

.stack-form {
    display: grid;
    gap: 16px;
}

.admin-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(130px, 1fr));
    gap: 14px;
    align-items: end;
}

.admin-form .wide {
    grid-column: span 3;
}

.order-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
}

.order-head h2 {
    margin-bottom: 6px;
    word-break: break-all;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    height: 32px;
    border-radius: 999px;
    padding: 0 12px;
    background: #eef7f4;
    color: var(--brand-dark);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.code-box {
    margin: 20px 0;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfb;
}

.code-box strong {
    display: block;
    margin: 8px 0;
    color: var(--success);
    font-size: 34px;
    line-height: 1.1;
    word-break: break-word;
}

.code-box p {
    margin-bottom: 0;
    color: var(--muted);
    word-break: break-word;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.notice {
    min-height: 22px;
    margin: 16px 0 0;
    color: var(--muted);
}

.alert {
    padding: 12px 14px;
    border-radius: 7px;
    background: #fff0f0;
    color: var(--danger);
    font-weight: 700;
}

.success {
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
    padding: 14px;
    border-radius: 7px;
    background: #eef8f4;
    color: var(--success);
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1180px;
}

th,
td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 13px;
}

code {
    color: var(--brand-dark);
    font-weight: 700;
}

.sms-cell {
    max-width: 280px;
    color: #4f5572;
    line-height: 1.55;
    word-break: break-word;
}

.is-hidden {
    display: none;
}

@media (max-width: 720px) {
    .shell {
        width: min(100% - 20px, 960px);
        padding: 18px 0;
    }

    .panel {
        padding: 18px;
    }

    .hero,
    .order-head {
        display: grid;
    }

    .inline-form,
    .admin-form {
        grid-template-columns: 1fr;
    }

    .admin-form .wide {
        grid-column: auto;
    }

    .actions button {
        width: 100%;
    }
}

.admin-page {
    background:
        linear-gradient(90deg, rgba(106, 96, 236, 0.05) 1px, transparent 1px),
        linear-gradient(180deg, rgba(106, 96, 236, 0.05) 1px, transparent 1px),
        #f4f6ff;
    background-size: 42px 42px;
    color: #171738;
}

.admin-page .shell {
    width: min(1160px, calc(100% - 32px));
}

.admin-page .compact {
    width: min(440px, calc(100% - 32px));
    min-height: 100vh;
    display: grid;
    align-items: center;
}

.admin-page .panel {
    border: 1px solid rgba(126, 134, 184, 0.14);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 22px 70px rgba(89, 95, 160, 0.16);
}

.admin-page .admin-hero {
    align-items: center;
}

.admin-page .brand-mark {
    margin-bottom: 18px;
}

.admin-page h1 {
    color: #171738;
    font-weight: 900;
}

.admin-page h2 {
    color: #171738;
    font-weight: 900;
}

.admin-page .muted {
    color: #7d829d;
}

.admin-page .eyebrow {
    color: #5b63f2;
}

.admin-page input,
.admin-page select,
.admin-page textarea {
    border-color: #dfe4ef;
    border-radius: 8px;
    background: #fbfcff;
    color: #171738;
}

.admin-page input:focus,
.admin-page select:focus,
.admin-page textarea:focus {
    border-color: #7379f6;
    box-shadow: 0 0 0 4px rgba(115, 121, 246, 0.12);
    outline: none;
}

.admin-page button,
.admin-page .admin-link {
    border-radius: 8px;
    background: linear-gradient(90deg, #536dfe, #9254f5);
    box-shadow: 0 12px 24px rgba(99, 91, 242, 0.22);
}

.admin-page button:hover,
.admin-page .admin-link:hover {
    background: linear-gradient(90deg, #485ee6, #8247de);
}

.admin-page table code {
    color: #5b63f2;
}

.admin-page th {
    color: #7d829d;
}

.admin-page td,
.admin-page th {
    border-bottom-color: #edf0f7;
}

.admin-tool-panel .export-form {
    grid-template-columns: minmax(180px, 1fr) minmax(160px, 1fr) auto;
}

.admin-tool-panel button {
    width: auto;
}

@media (max-width: 720px) {
    .admin-page .shell {
        width: min(100% - 20px, 1160px);
    }

    .admin-tool-panel .export-form {
        grid-template-columns: 1fr;
    }

    .admin-tool-panel button {
        width: 100%;
    }
}

.front-page {
    min-height: 100vh;
    background:
        linear-gradient(90deg, rgba(106, 96, 236, 0.05) 1px, transparent 1px),
        linear-gradient(180deg, rgba(106, 96, 236, 0.05) 1px, transparent 1px),
        #f4f6ff;
    background-size: 42px 42px;
    color: #171738;
}

.front-shell {
    width: min(1040px, calc(100% - 32px));
    min-height: 100vh;
    margin: 0 auto;
    padding: 18px 0 36px;
}

.front-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 42px;
    color: #171738;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
}

.brand-mark span {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    background: linear-gradient(135deg, #536dfe, #9254f5);
    box-shadow: 0 8px 22px rgba(83, 109, 254, 0.34);
    transform: rotate(45deg);
}

.topbar-lang {
    color: #6d7190;
    font-size: 13px;
}

.topbar-lang span {
    margin: 0 8px;
    color: #c0c5d8;
}

.front-hero {
    padding: 42px 0 26px;
    text-align: center;
}

.front-copy h1 {
    margin: 0;
    color: #171738;
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 900;
    letter-spacing: 0;
}

.front-copy p {
    margin: 16px 0 0;
    color: #9aa0b8;
    font-size: 16px;
    letter-spacing: 0;
}

.front-card {
    width: min(640px, 100%);
    margin: 0 auto 22px;
    padding: 38px 46px;
    border: 1px solid rgba(126, 134, 184, 0.14);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 22px 70px rgba(89, 95, 160, 0.16);
}

.front-page .order-panel {
    width: min(720px, 100%);
}

.stepper {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 34px;
    padding-bottom: 28px;
    border-bottom: 1px solid #edf0f7;
}

.stepper::before {
    content: "";
    position: absolute;
    top: 13px;
    left: 18%;
    right: 18%;
    height: 1px;
    background: #e4e8f2;
}

.step {
    position: relative;
    display: grid;
    justify-items: center;
    gap: 10px;
    color: #9aa0b8;
    font-size: 13px;
    font-weight: 700;
}

.step span {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 2px solid #e4e8f2;
    background: #fff;
    color: #9aa0b8;
    box-shadow: 0 0 0 7px #fff;
    z-index: 1;
}

.step.is-active,
.step.is-done {
    color: #5b63f2;
}

.step.is-active span,
.step.is-done span {
    border-color: transparent;
    background: linear-gradient(135deg, #536dfe, #9254f5);
    color: #fff;
    box-shadow: 0 8px 24px rgba(83, 109, 254, 0.34);
}

.front-page .redeem-form {
    display: grid;
    gap: 18px;
}

.front-page label {
    color: #171738;
    font-size: 17px;
}

.front-page .inline-form {
    display: block;
}

.front-page input {
    min-height: 48px;
    border-color: #dfe4ef;
    border-radius: 8px;
    background: #fbfcff;
    color: #171738;
}

.front-page input:focus {
    border-color: #7379f6;
    box-shadow: 0 0 0 4px rgba(115, 121, 246, 0.12);
    outline: none;
}

.front-page button {
    width: 100%;
    min-height: 48px;
    border-radius: 8px;
    background: linear-gradient(90deg, #536dfe, #9254f5);
    box-shadow: 0 12px 24px rgba(99, 91, 242, 0.26);
}

.front-page button:hover {
    background: linear-gradient(90deg, #485ee6, #8247de);
}

.front-page button:disabled {
    background: #b8bfd4;
    box-shadow: none;
}

.front-help {
    display: grid;
    gap: 9px;
    padding: 16px 18px;
    border: 1px solid #dfe4ef;
    border-radius: 8px;
    background: #fbfcff;
    color: #6d7190;
    font-size: 14px;
}

.front-help strong {
    color: #5b63f2;
}

.front-help p {
    margin: 0;
    line-height: 1.65;
}

.danger-line {
    color: #d94d5c;
    font-weight: 700;
}

.front-page .notice {
    margin: 16px 0 0;
    min-height: 22px;
    color: #7d829d;
    text-align: center;
}

.front-page .order-head {
    margin-top: 4px;
}

.front-page .eyebrow {
    color: #5b63f2;
}

.front-page .status-pill {
    background: #f1f0ff;
    color: #5b63f2;
}

.front-page .code-box {
    border-color: #dfe4ef;
    background: #fbfcff;
}

.front-page .code-box strong {
    color: #171738;
    font-weight: 900;
}

.front-page .actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 720px) {
    .front-shell {
        width: min(100% - 20px, 1040px);
        padding-top: 12px;
    }

    .front-card {
        padding: 26px 18px;
        border-radius: 16px;
    }

    .front-hero {
        padding: 30px 0 20px;
    }

    .stepper {
        gap: 4px;
    }

    .step {
        font-size: 12px;
    }

    .front-page .actions {
        grid-template-columns: 1fr;
    }
}
