:root {
    --bg: #f5f7fb;
    --card: #ffffff;
    --text: #172033;
    --muted: #6b7280;
    --line: #e5e9f2;
    --primary: #1264ff;
    --primary-dark: #0d4fd1;
    --orange: #ff7a1a;
    --green: #15a36d;
    --red: #d92d20;
    --radius: 14px;
    --shadow: 0 8px 30px rgba(21, 35, 70, .06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 8px; }
h1 { font-size: 24px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.break { word-break: break-all; }

.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 14px;
    min-height: 56px; padding: 0 18px;
    background: rgba(255,255,255,.94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(10px);
}
.brand { font-weight: 800; font-size: 19px; color: var(--text); letter-spacing: -.4px; }
.brand span { color: var(--primary); font-size: 12px; margin-left: 4px; font-weight: 600; }
.pc-nav { display: flex; gap: 18px; margin-left: 24px; }
.pc-nav a { color: #344056; font-size: 14px; }
.pc-hint { margin-left: auto; color: var(--muted); font-size: 12px; }
.top-me { margin-left: auto; font-size: 14px; color: var(--muted); }

.mobile-main { max-width: 760px; margin: 0 auto; padding: 16px 14px 88px; }
.pc-main { max-width: 1180px; margin: 0 auto; padding: 28px 24px 64px; }

.bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: flex; justify-content: space-around;
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
    background: rgba(255,255,255,.97);
    border-top: 1px solid var(--line);
}
.bottom-nav a { flex: 1; text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0; }
.bottom-nav a.active { color: var(--primary); font-weight: 700; }

.flash { border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; font-size: 14px; }
.flash-error { background: #fff1f0; color: #a8071a; border: 1px solid #ffccc7; }
.flash-success { background: #edfbf4; color: #087443; border: 1px solid #b7ebd3; }
.notice { background: #eef4ff; border: 1px solid #cfe0ff; color: #1e429f; border-radius: 12px; padding: 12px 14px; margin: 12px 0; }
.notice.small { font-size: 13px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.section { margin: 26px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { margin: 0; }
.section-head a { font-size: 13px; }
.empty { text-align: center; padding: 34px 18px; }

.hero { padding: 28px 4px 22px; }
.eyebrow { font-size: 11px; letter-spacing: 2px; color: var(--primary); font-weight: 800; margin-bottom: 10px; }
.hero h1 { font-size: 28px; letter-spacing: -.6px; }
.hero-sub { color: var(--muted); margin-bottom: 18px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 42px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
    font-size: 14px; font-weight: 700; cursor: pointer; line-height: 1; text-align: center;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:active { background: var(--primary-dark); }
.btn-ghost { background: #fff; color: #24314a; border-color: var(--line); }
.btn-block { display: flex; width: 100%; }

.product-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.product-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.product-card h3 { font-size: 19px; }
.product-card p { color: var(--muted); min-height: 44px; }
.product-tag { display: inline-block; font-size: 11px; font-weight: 800; color: var(--primary); background: #eaf1ff; border-radius: 999px; padding: 3px 9px; margin-bottom: 8px; }
.product-meta { display: flex; align-items: baseline; justify-content: space-between; margin: 14px 0; color: var(--muted); font-size: 13px; }
.product-meta strong { color: var(--orange); font-size: 20px; }

.three-notes { display: grid; gap: 10px; }
.three-notes div { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.three-notes strong { display: block; margin-bottom: 4px; }
.three-notes span { color: var(--muted); font-size: 13px; }

.page-head { margin: 4px 0 16px; }
.page-head h1 { margin-bottom: 4px; }
.back { display: inline-block; font-size: 13px; color: var(--muted); margin-bottom: 8px; }

.product-hero { padding: 8px 0 22px; }
.product-layout { display: grid; gap: 14px; }
.product-desc { line-height: 1.8; }
.product-desc img { border-radius: 10px; }
.buy-aside h3 { margin-bottom: 12px; }
.sku-row { display: grid; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.sku-row:first-of-type { border-top: 0; }
.sku-price { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sku-price strong { color: var(--orange); font-size: 21px; }
.feature-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.feature-list span { font-size: 11px; color: #475467; background: #f2f5fa; border-radius: 999px; padding: 3px 8px; }
.aside-links { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding-top: 14px; margin-top: 6px; font-size: 13px; }

.ticket-list { display: grid; gap: 10px; }
.ticket-item { display: grid; gap: 4px; padding: 14px 16px; }
.ticket-item.card { color: var(--text); }
.ticket-title { display: flex; gap: 8px; align-items: center; }

.form-card { display: grid; gap: 13px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; color: #344056; font-weight: 600; }
.field input, .field select, .field textarea, .filter-bar input, .filter-bar select, .inline-edit input {
    width: 100%; border: 1px solid #d5dbe8; border-radius: 10px; background: #fff;
    padding: 11px 12px; font: inherit; color: var(--text); outline: none;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(18,100,255,.12); }
.checkline { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: #475467; }
.checkline input { margin-top: 4px; }
.form-section { border-top: 1px solid var(--line); padding-top: 14px; }
.order-product { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.order-product strong:last-child { color: var(--orange); font-size: 20px; }

.order-card { display: grid; gap: 12px; }
.order-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.order-amount { font-size: 30px; font-weight: 800; color: var(--orange); }
.order-items { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 10px 0; }
.order-item { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: 14px; }
.pay-box { padding-top: 4px; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 3px 8px; background: #eef2f8; color: #475467; }
.badge-pending { background: #fff6e8; color: #b54708; }
.badge-paid { background: #e9f9f1; color: #087443; }
.badge-closed, .badge-refunded, .badge-frozen, .badge-expired { background: #f2f4f7; color: #667085; }
.badge-active, .badge-unused { background: #eaf1ff; color: #175cd3; }
.badge-exhausted { background: #fff1f0; color: #b42318; }
.license-line { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); color: var(--text); }

.me-head { display: flex; gap: 14px; align-items: center; margin: 8px 0 20px; }
.avatar { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #1264ff, #68a1ff); color: #fff; font-size: 22px; font-weight: 800; }
.me-head h1 { margin-bottom: 2px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 10px; text-align: center; color: var(--text); }
.stat strong { display: block; font-size: 23px; line-height: 1.2; }
.stat span { font-size: 12px; color: var(--muted); }
.menu-list { padding: 4px 16px; }
.menu-list a { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; padding: 14px 0; border-bottom: 1px solid var(--line); color: var(--text); }
.menu-list a:last-child { border-bottom: 0; }
.menu-list em { font-style: normal; font-size: 12px; color: var(--muted); text-align: right; }

.license-list, .order-list, .message-list { display: grid; gap: 11px; }
.license-card, .order-row, .message-item { display: grid; gap: 5px; color: var(--text); }
.license-title, .message-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.license-meta { display: flex; justify-content: space-between; gap: 10px; align-items: center; color: var(--muted); font-size: 13px; }
.license-meta code { font-size: 14px; color: var(--text); letter-spacing: 1px; }
.order-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.order-row-right { display: grid; justify-items: end; gap: 4px; }
.message-item p { margin: 4px 0 8px; }

.code-card { text-align: center; }
.code-display { font-size: 22px; font-weight: 800; letter-spacing: 1.4px; word-break: break-all; margin: 14px 0; padding: 12px 8px; background: #f7f9fd; border-radius: 10px; }
.code-display.code-long { font-size: 16px; line-height: 1.8; letter-spacing: 1px; }
.code-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 10px; }
.device-list { display: grid; gap: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.device-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.device-row:last-child { border-bottom: 0; }
.device-row div { display: grid; gap: 2px; }
.device-row time { color: var(--muted); font-size: 12px; }

.thread { display: grid; gap: 10px; margin-bottom: 16px; }
.thread-item { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.thread-item.from-admin { background: #f2f7ff; border-color: #cfe0ff; }
.thread-meta { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 5px; font-size: 12px; color: var(--muted); }
.thread-meta strong { color: #344056; }
.thread-content { white-space: normal; }

.center-page { display: grid; place-items: center; min-height: 60vh; padding: 20px 0; }
.center-card { text-align: center; max-width: 520px; width: 100%; }
.center-card h1 { margin-top: 10px; }
.big-icon { width: 64px; height: 64px; border-radius: 18px; background: #eaf1ff; color: var(--primary); display: grid; place-items: center; margin: 0 auto; font-size: 26px; font-weight: 800; }
.copy-input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin: 12px 0; color: var(--muted); font-size: 12px; }
.qr-large, .qr-box { display: grid; place-items: center; min-height: 220px; margin: 14px auto; }
.qr-large img, .qr-box img, .qr-large canvas, .qr-box canvas { max-width: 100%; height: auto; }
.qr-large table, .qr-box table { margin: 0 auto; }

.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 18px; }
.modal-mask { position: absolute; inset: 0; background: rgba(10, 20, 40, .55); }
.modal-card { position: relative; width: min(360px, 100%); background: #fff; border-radius: 18px; padding: 22px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-close { position: absolute; right: 10px; top: 8px; border: 0; background: none; font-size: 26px; color: #98a2b3; cursor: pointer; }
.modal-card h3 { margin-bottom: 4px; }

.pc-footer, .mobile-footer { color: #98a2b3; font-size: 12px; text-align: center; padding: 18px 12px 28px; }
.pc-footer { max-width: 1180px; margin: 0 auto; }
.mobile-footer { padding-bottom: 90px; }

.prose h2 { margin-top: 20px; font-size: 17px; }
.prose p { color: #475467; }

.admin-body { background: #f3f5f9; }
.admin-top { display: flex; align-items: center; gap: 16px; padding: 10px 18px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.admin-nav { display: flex; gap: 12px; overflow-x: auto; scrollbar-width: none; }
.admin-nav a { white-space: nowrap; font-size: 13px; color: #344056; }
.admin-main { max-width: 1180px; margin: 0 auto; padding: 18px 14px 60px; }
.admin-login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.admin-login-card { width: min(420px, 100%); }
.admin-login-card h1 { font-size: 22px; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.link-btn { border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; padding: 4px; }
.admin-stats { grid-template-columns: repeat(2, 1fr); }
.admin-columns { display: grid; gap: 14px; margin-bottom: 14px; }
.admin-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--text); font-size: 14px; }
.admin-row:last-child { border-bottom: 0; }
.table-wrap { overflow-x: auto; padding: 0; }
.table { width: 100%; border-collapse: collapse; min-width: 640px; font-size: 13px; }
.table th, .table td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; background: #fafbfe; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.filter-bar input, .filter-bar select { width: auto; min-width: 140px; padding: 9px 10px; border: 1px solid #d5dbe8; border-radius: 9px; background: #fff; font: inherit; }
.inline-edit { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline-edit input[type="number"] { width: 88px; padding: 7px 8px; border: 1px solid #d5dbe8; border-radius: 8px; font: inherit; }
.mini-check { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 3px; }
.sku-table td:nth-child(3) { min-width: 300px; }

@media (min-width: 900px) {
    .product-grid { grid-template-columns: repeat(3, 1fr); }
    .three-notes { grid-template-columns: repeat(3, 1fr); }
    .product-layout { grid-template-columns: minmax(0, 1.6fr) minmax(320px, .9fr); align-items: start; }
    .buy-aside { position: sticky; top: 76px; }
    .sku-row { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
    .sku-price { display: grid; justify-items: end; }
    .admin-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .admin-stats { grid-template-columns: repeat(4, 1fr); }
    .mobile-main { padding-bottom: 40px; }
}
