:root {
    color-scheme: light;
    --page-bg: #f4f6f8;
    --panel-bg: #ffffff;
    --text-main: #17202a;
    --text-muted: #65717e;
    --line: #dce3ea;
    --line-strong: #c9d3dd;
    --primary: #2357c6;
    --primary-hover: #1d49a7;
    --danger: #b42318;
    --success-bg: #e9f7ef;
    --success-text: #167647;
    --pending-bg: #fff4de;
    --pending-text: #9a5b00;
    --danger-bg: #fdecec;
    --muted-bg: #eef2f5;
    --radius: 8px;
    --shadow: 0 18px 42px rgba(18, 32, 46, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
}

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

a {
    color: inherit;
}

.demo-page {
    padding: 32px 20px 48px;
}

.demo-header,
.demo-shell {
    width: min(100%, 1120px);
    margin: 0 auto;
}

.demo-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    padding: 6px 0 22px;
}

.demo-toast {
    position: sticky;
    top: 14px;
    z-index: 20;
    width: min(100%, 1120px);
    margin: 0 auto 18px;
    padding: 14px 16px;
    border: 1px solid #f2b8b5;
    border-left: 4px solid var(--danger);
    border-radius: var(--radius);
    color: #7a271a;
    background: #fff7f6;
    box-shadow: 0 14px 34px rgba(127, 29, 29, 0.14);
}

.toast-title {
    font-size: 15px;
    font-weight: 750;
}

.toast-message {
    margin: 4px 0 0;
    font-size: 13px;
}

.demo-title {
    margin: 0;
    font-size: 30px;
    font-weight: 750;
    letter-spacing: 0;
}

.demo-subtitle {
    margin: 8px 0 0;
    color: var(--text-muted);
    font-size: 14px;
}

.demo-kicker {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    margin: 0 0 8px;
    padding: 0 10px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    color: #405061;
    background: #fff;
    font-size: 12px;
    font-weight: 700;
}

.header-actions,
.action-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.demo-shell {
    display: grid;
    gap: 18px;
}

.index-grid {
    grid-template-columns: minmax(320px, 410px) minmax(0, 1fr);
    align-items: start;
}

.detail-shell {
    grid-template-columns: 1fr;
}

.detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
    gap: 18px;
}

.demo-panel,
.login-panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel-bg);
    box-shadow: var(--shadow);
}

.demo-panel {
    min-width: 0;
    padding: 22px;
}

.section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.section-title {
    margin: 0;
    font-size: 18px;
    font-weight: 750;
    letter-spacing: 0;
}

.section-note {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 13px;
}

.login-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
}

.login-shell {
    width: min(100%, 420px);
}

.login-panel {
    padding: 34px;
}

.login-panel .demo-title {
    font-size: 28px;
}

.login-form,
.order-form {
    display: grid;
    gap: 14px;
}

.login-form {
    margin-top: 26px;
}

.form-row {
    display: grid;
    gap: 7px;
}

.form-label {
    color: #344255;
    font-size: 13px;
    font-weight: 700;
}

.form-input {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    color: var(--text-main);
    background: #fff;
    font: inherit;
}

.form-input:focus {
    border-color: var(--primary);
    outline: 3px solid rgba(35, 87, 198, 0.14);
}

.form-message,
.field-message,
.form-error {
    min-height: 20px;
    margin: 0;
    color: var(--danger);
    font-size: 13px;
}

.primary-button,
.secondary-button,
.text-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    max-width: 100%;
    border-radius: 6px;
    font: inherit;
    font-weight: 750;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.primary-button,
.secondary-button {
    padding: 0 16px;
    border: 1px solid transparent;
}

.primary-button {
    color: #fff;
    background: var(--primary);
}

.primary-button:hover {
    background: var(--primary-hover);
}

.secondary-button {
    color: #243447;
    background: #fff;
    border-color: var(--line-strong);
}

.secondary-button:hover {
    background: #f8fafc;
    border-color: #b7c3cf;
}

.text-link {
    min-height: 32px;
    padding: 0 10px;
    color: var(--primary);
    background: #edf3ff;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.order-table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
    background: #fff;
}

.order-table th,
.order-table td {
    padding: 12px 13px;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    text-align: left;
    vertical-align: middle;
}

.order-table th {
    color: #4a5968;
    background: #f8fafc;
    font-weight: 750;
}

.order-table tr:last-child td {
    border-bottom: 0;
}

.cell-strong {
    font-weight: 750;
}

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

.empty-cell,
.empty-text {
    color: var(--text-muted);
    text-align: center;
}

.empty-text {
    margin: 0;
    padding: 22px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    background: #fbfcfd;
}

.status,
.tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    max-width: 100%;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 750;
    line-height: 1.2;
    white-space: nowrap;
}

.status {
    color: var(--pending-text);
    background: var(--pending-bg);
}

.status-success {
    color: var(--success-text);
    background: var(--success-bg);
}

.status-danger {
    color: var(--danger);
    background: var(--danger-bg);
}

.status-muted {
    color: #596775;
    background: var(--muted-bg);
}

.tag {
    color: #405061;
    background: var(--muted-bg);
}

.pay-layout {
    display: grid;
    grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
    gap: 24px;
    align-items: center;
}

.qr-panel {
    display: grid;
    min-height: 300px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #f8fafc;
}

.qrcode-image {
    width: min(100%, 240px);
    aspect-ratio: 1;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

.pay-summary {
    display: grid;
    gap: 16px;
    min-width: 0;
}

.pay-title {
    margin: 0;
    font-size: 24px;
    font-weight: 750;
}

.pay-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

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

.detail-list {
    display: grid;
    grid-template-columns: 132px minmax(0, 1fr);
    gap: 12px 16px;
    margin: 0;
}

.detail-list dt {
    color: var(--text-muted);
    font-size: 13px;
}

.detail-list dd {
    min-width: 0;
    margin: 0;
    font-size: 14px;
    overflow-wrap: anywhere;
}

.operation-stack {
    display: grid;
    gap: 12px;
}

.operation-stack form {
    margin: 0;
}

.operation-stack .secondary-button {
    width: 100%;
}

.last-error {
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 6px;
    background: var(--danger-bg);
}

.raw-body {
    max-width: 360px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 720px) {
    .demo-page {
        padding: 22px 14px 34px;
    }

    .demo-header {
        align-items: stretch;
        flex-direction: column;
        gap: 14px;
        padding-bottom: 18px;
    }

    .demo-title {
        font-size: 25px;
    }

    .header-actions,
    .action-row,
    .pay-actions {
        width: 100%;
    }

    .primary-button,
    .secondary-button {
        width: 100%;
        white-space: normal;
    }

    .index-grid,
    .detail-grid,
    .pay-layout {
        grid-template-columns: 1fr;
    }

    .demo-panel,
    .login-panel {
        padding: 18px;
    }

    .login-page {
        padding: 16px;
    }

    .section-heading {
        flex-direction: column;
    }

    .order-table {
        min-width: 0;
    }

    .order-table,
    .order-table tbody,
    .order-table tr,
    .order-table td {
        display: block;
        width: 100%;
    }

    .order-table thead {
        display: none;
    }

    .order-table tr {
        padding: 8px 0;
        border-bottom: 1px solid var(--line);
    }

    .order-table tr:last-child {
        border-bottom: 0;
    }

    .order-table td {
        display: grid;
        grid-template-columns: 104px minmax(0, 1fr);
        gap: 10px;
        padding: 8px 10px;
        border-bottom: 0;
        overflow-wrap: anywhere;
    }

    .order-table td::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-weight: 700;
    }

    .order-table .empty-cell {
        display: block;
        padding: 18px 10px;
    }

    .order-table .empty-cell::before {
        content: none;
    }

    .qr-panel {
        min-height: 260px;
    }

    .detail-list {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .detail-list dd {
        padding-bottom: 8px;
        border-bottom: 1px solid var(--line);
    }

    .detail-list dd:last-child {
        border-bottom: 0;
    }
}
