:root {
    --green: #07c160;
    --green-dark: #06ad56;
    --ink: #1a1a1a;
    --muted: #8a8f99;
    --line: #e9ecef;
    --bg: #f5f6f8;
    --radius: 16px;
    --shadow: 0 10px 30px rgba(17, 24, 39, .06);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

.topbar {
    background: #fff;
    border-bottom: 1px solid var(--line);
}

.topbar .inner {
    max-width: 920px;
    margin: 0 auto;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 17px;
    color: var(--ink);
    letter-spacing: .2px;
}

.brand .mark {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: linear-gradient(135deg, #07c160, #0aa86b);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 15px;
    font-weight: 700;
}

.topbar .spacer { flex: 1; }
.topbar .nav a { color: var(--muted); font-size: 13px; }

.page {
    flex: 1;
    width: 100%;
    max-width: 920px;
    margin: 0 auto;
    padding: 28px 20px 48px;
}

.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}

.card + .card { margin-top: 18px; }

h1, h2, h3 { margin: 0; font-weight: 700; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
.sub { color: var(--muted); font-size: 13px; margin-top: 6px; }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.pitem {
    position: relative;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: .16s ease;
    background: #fff;
}

.pitem:hover { border-color: #bfe8d1; }

.pitem.on {
    border-color: var(--green);
    background: #f6fffa;
    box-shadow: 0 0 0 3px rgba(7, 193, 96, .1);
}

.pitem .pname { font-weight: 600; font-size: 15px; }
.pitem .pdesc { color: var(--muted); font-size: 12px; margin-top: 4px; min-height: 18px; }
.pitem .price { margin-top: 10px; color: var(--green-dark); font-weight: 700; font-size: 20px; font-variant-numeric: tabular-nums; }
.pitem .price small { font-size: 12px; font-weight: 500; }

.field { margin-top: 18px; }

label.lb { display: block; font-size: 13px; color: #555; margin-bottom: 8px; font-weight: 600; }

input[type=text], input[type=number], input[type=password], input[type=file], select, textarea {
    width: 100%;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    padding: 11px 13px;
    font-size: 15px;
    font-family: inherit;
    color: var(--ink);
    background: #fff;
    outline: none;
    transition: .15s;
}

input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(7, 193, 96, .12); }

textarea { min-height: 110px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.5; }

.amount-row { display: flex; align-items: center; gap: 10px; }
.amount-row .cny { font-size: 20px; color: var(--muted); font-weight: 600; }
.amount-row input { font-size: 22px; font-weight: 700; letter-spacing: .5px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 12px;
    padding: 13px 22px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: .15s;
    background: var(--green);
    color: #fff;
    width: 100%;
}

.btn:hover { background: var(--green-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--ink); border: 1.5px solid var(--line); }
.btn.ghost:hover { border-color: #cfd4da; background: #fafafa; }
.btn.sm { width: auto; padding: 7px 13px; font-size: 13px; border-radius: 9px; }
.btn.danger { background: #f04438; }
.btn.danger:hover { background: #d92d20; }

.hint { font-size: 12px; color: var(--muted); margin-top: 10px; }
.err { background: #fef3f2; color: #b42318; border-radius: 10px; padding: 12px 14px; font-size: 13px; margin-top: 14px; display: none; }
.err.on { display: block; }

/* 收银台 */
.cashier { display: grid; grid-template-columns: 300px 1fr; gap: 32px; align-items: start; }

.qrbox {
    width: 260px;
    height: 260px;
    border: 1px solid var(--line);
    border-radius: 14px;
    display: grid;
    place-items: center;
    padding: 10px;
    background: #fff;
    margin: 0 auto;
    position: relative;
}

.qrbox canvas, .qrbox img { display: block; }

.qr-mask {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, .94);
    border-radius: 14px;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 20px;
    font-size: 14px;
    color: var(--muted);
    line-height: 1.7;
}

.qr-mask strong { color: var(--ink); display: block; margin-bottom: 6px; font-size: 15px; }

.summary .row { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.summary .row:last-child { border-bottom: 0; }
.summary .row .k { color: var(--muted); }
.summary .row .v { font-weight: 600; text-align: right; word-break: break-all; }
.summary .total .v { color: var(--green-dark); font-size: 24px; font-variant-numeric: tabular-nums; }

.paystate {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    padding: 7px 12px;
    border-radius: 999px;
    background: #fff7e6;
    color: #b54708;
}

.paystate.ok { background: #ecfdf3; color: #027a48; }
.paystate.dead { background: #f2f4f7; color: #667085; }

.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

.steps { margin: 18px 0 0; padding: 0; list-style: none; counter-reset: s; }
.steps li { position: relative; padding-left: 30px; font-size: 13px; color: #555; margin-top: 10px; }
.steps li::before {
    counter-increment: s;
    content: counter(s);
    position: absolute;
    left: 0;
    top: 1px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ecfdf3;
    color: var(--green-dark);
    font-size: 11px;
    font-weight: 700;
    display: grid;
    place-items: center;
}

/* 结果页 */
.result { text-align: center; padding: 14px 0 6px; }
.result .ico { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 16px; font-size: 30px; color: #fff; }
.ok-ico { background: var(--green); }
.fail-ico { background: #f04438; }
.wait-ico { background: #f79009; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: none; }
td.mono, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }

.tag { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.tag.paid { background: #ecfdf3; color: #027a48; }
.tag.pending { background: #fff7e6; color: #b54708; }
.tag.closed { background: #f2f4f7; color: #667085; }
.tag.refund { background: #eff8ff; color: #175cd3; }
.tag.fail { background: #fef3f2; color: #b42318; }

.footer { text-align: center; color: #a0a5ad; font-size: 12px; padding: 20px; }

.toast {
    position: fixed;
    left: 50%;
    bottom: 40px;
    transform: translateX(-50%) translateY(20px);
    background: rgba(26, 26, 26, .92);
    color: #fff;
    padding: 11px 20px;
    border-radius: 10px;
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    transition: .25s;
    z-index: 99;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 720px) {
    .cashier { grid-template-columns: 1fr; gap: 22px; }
    .card { padding: 18px; }
    .page { padding: 18px 14px 40px; }
}
