:root {
    color-scheme: light;
    --bg: #f5f7fb;
    --panel: #ffffff;
    --text: #1d2733;
    --muted: #697386;
    --line: #dfe5ef;
    --primary: #1769e0;
    --primary-ink: #ffffff;
    --danger: #c83232;
    --success-bg: #e8f7ef;
    --success-text: #16633b;
    --error-bg: #feecec;
    --error-text: #a42828;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    line-height: 1.5;
}

a {
    color: var(--primary);
    text-decoration: none;
}

.topbar {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    color: var(--text);
    font-size: 18px;
    font-weight: 700;
}

.topbar nav,
.actions,
.section-head,
.row-form,
.actions-cell,
.subnav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.container {
    width: min(1180px, calc(100% - 32px));
    margin: 28px auto 56px;
}

.hero {
    min-height: calc(100vh - 148px);
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
    gap: 24px;
    align-items: center;
}

h1,
h2 {
    margin: 0 0 14px;
    line-height: 1.15;
}

h1 {
    font-size: 42px;
}

h2 {
    font-size: 22px;
}

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

.eyebrow {
    color: var(--primary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0;
}

.panel,
.auth-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 8px 24px rgba(31, 45, 61, 0.06);
}

.auth-card {
    width: min(440px, 100%);
    margin: 64px auto;
}

.grid {
    display: grid;
    gap: 18px;
    margin-bottom: 18px;
}

.grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.section-head {
    justify-content: space-between;
    margin-bottom: 16px;
}

form label {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
    color: var(--muted);
    font-weight: 600;
}

input,
select {
    width: 100%;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0 12px;
    background: #fff;
    color: var(--text);
}

.row-form input,
.row-form select {
    width: 180px;
}

.row-form.compact {
    margin: 4px 0;
}

.inline {
    display: inline;
}

.button,
button {
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
}

.button.primary,
button.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--primary-ink);
}

.button.small,
button.small {
    min-height: 32px;
    padding: 0 10px;
    font-size: 13px;
}

.button.danger,
button.danger {
    color: var(--danger);
}

.button.full,
button.full {
    width: 100%;
}

.recharge-card {
    width: min(520px, 100%);
}

.pay-summary,
.pay-status {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 8px 12px;
    margin: 18px 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.pay-summary span,
.pay-status span,
.muted {
    color: var(--muted);
}

.qr-wrap {
    display: flex;
    justify-content: center;
    margin: 18px 0 10px;
}

.pay-qr {
    width: 260px;
    height: 260px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 10px;
}

.center {
    text-align: center;
}

.link-button {
    border: 0;
    background: transparent;
    color: var(--primary);
    padding: 0;
    min-height: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

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

th {
    color: var(--muted);
    font-weight: 700;
}

.badge {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 2px 8px;
    color: var(--muted);
}

.alert {
    border-radius: 8px;
    margin-bottom: 18px;
    padding: 12px 14px;
    border: 1px solid var(--line);
}

.alert.success,
.success-box {
    background: var(--success-bg);
    color: var(--success-text);
}

.alert.error {
    background: var(--error-bg);
    color: var(--error-text);
}

pre {
    overflow-x: auto;
    background: #111827;
    color: #e5e7eb;
    border-radius: 8px;
    padding: 16px;
}

code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

dl {
    margin: 0;
}

dt {
    color: var(--muted);
    font-weight: 700;
    margin-top: 12px;
}

dd {
    margin: 4px 0 0;
    word-break: break-all;
}

.subnav {
    margin-bottom: 18px;
}

@media (max-width: 820px) {
    .topbar {
        align-items: flex-start;
        height: auto;
        padding: 14px 16px;
        gap: 12px;
        flex-direction: column;
    }

    .hero,
    .grid.two,
    .settings-grid {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 32px;
    }

    .section-head,
    .row-form {
        align-items: stretch;
        flex-direction: column;
    }

    .row-form input,
    .row-form select {
        width: 100%;
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}
