/* ==========================================================================
   发卡网 · 全站样式（零依赖，含前台与后台）
   ========================================================================== */
:root {
    --bg: #0d1117;
    --bg-soft: #161b22;
    --card: #171d26;
    --line: #262d38;
    --text: #e6edf3;
    --muted: #8b98a8;
    --primary: #2f81f7;
    --primary-dark: #1f6feb;
    --ok: #3fb950;
    --warn: #d29922;
    --err: #f85149;
    --info: #58a6ff;
    --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
}

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

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.center-actions { justify-content: center; }

/* ---------------------------------------------------------------- 布局 */
.wrap { max-width: 960px; margin: 0 auto; padding: 20px 16px 60px; }
.hd { display: flex; align-items: center; justify-content: space-between; padding: 8px 0 20px; flex-wrap: wrap; gap: 10px; }
.hd-logo { font-size: 19px; font-weight: 700; color: var(--text); display: inline-flex; align-items: center; gap: 8px; }
.hd-logo:hover { text-decoration: none; }
.hd-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); display: inline-block; }
.hd-nav { display: flex; align-items: center; gap: 16px; font-size: 14px; }
.hd-contact { color: var(--muted); }
.main { display: flex; flex-direction: column; gap: 16px; }
.ft { margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; text-align: center; }
.ft-sub { margin-top: 6px; opacity: .8; }

/* ---------------------------------------------------------------- 卡片 */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
}
.card + .card { margin-top: 16px; }
.card-title { margin: 0 0 12px; font-size: 17px; }
.hero { padding: 8px 4px 0; }
.hero-title { margin: 0 0 6px; font-size: 22px; }
.hero-sub { margin: 0; color: var(--muted); font-size: 14px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.product { display: flex; flex-direction: column; gap: 10px; }
.product-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.product-title { margin: 0; font-size: 16px; }
.product-price { color: var(--warn); font-weight: 700; font-size: 18px; white-space: nowrap; }
.product-desc { margin: 0; color: var(--muted); font-size: 13px; max-height: 80px; overflow: hidden; }
.product-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; }
.stock { font-size: 13px; color: var(--muted); }
.stock-out { color: var(--err); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; border: 1px solid transparent; white-space: nowrap; }
.badge-ok { color: var(--ok); border-color: rgba(63,185,80,.4); background: rgba(63,185,80,.1); }
.badge-warn { color: var(--warn); border-color: rgba(210,153,34,.4); background: rgba(210,153,34,.1); }
.badge-err { color: var(--err); border-color: rgba(248,81,73,.4); background: rgba(248,81,73,.1); }
.badge-info { color: var(--info); border-color: rgba(88,166,255,.4); background: rgba(88,166,255,.1); }
.badge-mute { color: var(--muted); border-color: var(--line); background: rgba(139,152,168,.08); }

/* ---------------------------------------------------------------- 按钮 */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 16px; border-radius: 9px; border: 1px solid var(--line);
    background: #1f2630; color: var(--text); font-size: 14px; cursor: pointer;
    transition: .15s; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: #263041; text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: rgba(248,81,73,.12); border-color: rgba(248,81,73,.5); color: #ff9d95; }
.btn-danger:hover { background: rgba(248,81,73,.22); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- 表单 */
.field { margin-bottom: 16px; }
.field > label { display: block; margin-bottom: 6px; font-size: 14px; color: var(--muted); }
input[type=text], input[type=password], input[type=number], input[type=email], input[type=url], select, textarea {
    width: 100%; padding: 10px 12px; border-radius: 9px;
    border: 1px solid var(--line); background: #0f151d; color: var(--text);
    font-size: 14px; font-family: inherit; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,129,247,.15); }
textarea { min-height: 110px; resize: vertical; }
.form-inline { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form-inline .field { margin-bottom: 0; flex: 1 1 200px; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.qty { display: flex; align-items: center; gap: 8px; }
.qty input { width: 90px; text-align: center; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.pay-types { display: flex; gap: 12px; flex-wrap: wrap; }
.pay-type input { position: absolute; opacity: 0; pointer-events: none; }
.pay-type-box {
    display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px;
    border: 1px solid var(--line); border-radius: 10px; cursor: pointer; transition: .15s;
}
.pay-type input:checked + .pay-type-box { border-color: var(--primary); background: rgba(47,129,247,.12); }
.pay-ico { width: 22px; height: 22px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff; }
.pay-ico-alipay { background: #1677ff; }
.pay-ico-wxpay { background: #07c160; }
.pay-ico-qqpay { background: #12b7f5; }

.price-line { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.price-big { color: var(--warn); font-size: 22px; font-weight: 700; }
.total-line { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-top: 1px dashed var(--line); margin-bottom: 14px; }
.desc { color: var(--muted); font-size: 14px; }

/* ---------------------------------------------------------------- 提示 */
.alert { padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; border: 1px solid; }
.alert-info { color: #9fc7ff; border-color: rgba(88,166,255,.35); background: rgba(88,166,255,.08); }
.alert-ok { color: #8ce99a; border-color: rgba(63,185,80,.35); background: rgba(63,185,80,.08); }
.alert-warn { color: #f0c674; border-color: rgba(210,153,34,.35); background: rgba(210,153,34,.08); }
.alert-err { color: #ff9d95; border-color: rgba(248,81,73,.35); background: rgba(248,81,73,.08); }

/* ---------------------------------------------------------------- 表格 */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 500; font-size: 13px; white-space: nowrap; }
.table tr:hover td { background: rgba(255,255,255,.02); }

/* ---------------------------------------------------------------- 订单/取卡 */
.order-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px 18px; margin: 8px 0 4px; }
.kv > div { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed var(--line); padding: 7px 0; }
.kv span { color: var(--muted); font-size: 13px; }
.kv b { font-weight: 600; text-align: right; }
.actions { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.cards-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.card-secret { display: flex; align-items: center; gap: 10px; background: #0f151d; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; }
.card-secret .idx { color: var(--muted); font-size: 12px; }
.card-secret code { flex: 1; word-break: break-all; font-family: ui-monospace, Menlo, Consolas, monospace; }
.qr { width: 220px; height: 220px; margin: 14px auto; display: block; background: #fff; border-radius: 10px; padding: 8px; }
.spinner { width: 34px; height: 34px; margin: 0 auto 14px; border: 3px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.center-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.center-page .card { max-width: 460px; width: 100%; }

/* ---------------------------------------------------------------- 后台 */
.admin-body { background: #0b0f14; }
.admin-shell { display: flex; min-height: 100vh; }
.admin-side {
    width: 216px; flex: 0 0 216px; background: #11161d; border-right: 1px solid var(--line);
    display: flex; flex-direction: column; padding: 18px 14px; gap: 16px;
}
.admin-brand { font-weight: 700; display: flex; align-items: center; gap: 8px; padding: 0 6px 8px; }
.admin-menu { display: flex; flex-direction: column; gap: 4px; }
.admin-menu a { padding: 9px 12px; border-radius: 8px; color: var(--muted); font-size: 14px; }
.admin-menu a:hover { background: #1a212b; color: var(--text); text-decoration: none; }
.admin-menu a.active { background: rgba(47,129,247,.14); color: #cfe3ff; }
.admin-side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.admin-user { font-size: 13px; color: var(--muted); padding: 0 6px; }
.admin-content { flex: 1; padding: 22px 26px 60px; min-width: 0; }
.admin-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.admin-title { margin: 0; font-size: 20px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.stat .k { color: var(--muted); font-size: 13px; }
.stat .v { font-size: 21px; font-weight: 700; margin-top: 4px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.toolbar .field { margin-bottom: 0; }
.pager { display: flex; gap: 8px; align-items: center; margin-top: 14px; }
.token-box { background: #0f151d; border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; word-break: break-all; white-space: pre-wrap; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 380px; }
.login-card h1 { font-size: 19px; margin: 0 0 18px; text-align: center; }
.log-view { max-height: 420px; overflow: auto; background: #0f151d; border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; white-space: pre-wrap; word-break: break-all; }

@media (max-width: 720px) {
    .admin-shell { flex-direction: column; }
    .admin-side { width: 100%; flex: none; flex-direction: row; align-items: center; overflow-x: auto; }
    .admin-menu { flex-direction: row; }
    .admin-side-foot { margin: 0 0 0 auto; flex-direction: row; align-items: center; }
    .admin-content { padding: 16px 14px 50px; }
    .wrap { padding: 14px 12px 50px; }
}
