/* ========== 基础 ========== */
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif; background: #f0f2f5; color: #1f2937; font-size: 14px; }
a { color: #2563eb; text-decoration: none; }
a:hover { color: #1d4ed8; }
h2 { font-size: 16px; }

/* ========== 布局：左菜单 + 右内容 ========== */
.layout { display: flex; min-height: 100vh; }

/* 左侧菜单 */
.sidebar { width: 224px; flex-shrink: 0; background: #0f172a; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.logo { display: flex; align-items: center; gap: 10px; height: 60px; padding: 0 18px; border-bottom: 1px solid rgba(255,255,255,.06); }
.logo-badge { width: 32px; height: 32px; border-radius: 8px; background: linear-gradient(135deg,#3b82f6,#2563eb); color: #fff; font-weight: 700; font-size: 16px; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(37,99,235,.45); }
.logo-text { color: #fff; font-size: 15px; font-weight: 700; letter-spacing: .5px; display: flex; flex-direction: column; line-height: 1.2; }
.logo-text b { font-size: 11px; font-weight: 400; color: rgba(255,255,255,.45); }
.menu { flex: 1; padding: 12px 10px; overflow-y: auto; }
.menu a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 2px; border-radius: 7px; color: rgba(255,255,255,.62); font-size: 14px; transition: all .15s; }
.menu a svg { width: 17px; height: 17px; flex-shrink: 0; }
.menu a:hover { color: #fff; background: rgba(255,255,255,.06); }
.menu a.on { color: #fff; background: #2563eb; box-shadow: 0 2px 8px rgba(37,99,235,.4); }
.side-foot { padding: 14px 18px; font-size: 11px; color: rgba(255,255,255,.28); border-top: 1px solid rgba(255,255,255,.06); }

/* 右侧 */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 60px; background: #fff; box-shadow: 0 1px 4px rgba(15,23,42,.08); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 10; }
.page-title { font-size: 16px; font-weight: 600; }
.top-right { display: flex; align-items: center; gap: 16px; }
.userchip { display: flex; align-items: center; gap: 7px; color: #4b5563; font-size: 14px; background: #f3f4f6; border-radius: 20px; padding: 5px 13px; }
.userchip svg { width: 15px; height: 15px; }
.logout { display: flex; align-items: center; gap: 5px; color: #6b7280; font-size: 14px; }
.logout svg { width: 15px; height: 15px; }
.logout:hover { color: #dc2626; }
.content { flex: 1; padding: 22px 24px 40px; }

/* ========== 通用组件 ========== */
.flash { padding: 11px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.flash.ok { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.flash.err { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }

.card { background: #fff; border-radius: 10px; padding: 18px 20px; margin-bottom: 18px; box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 4px 16px rgba(15,23,42,.05); }
.card h2 { margin: 0 0 14px; }

/* 统计卡片：左侧彩条 */
.cards { display: grid; grid-template-columns: repeat(auto-fill,minmax(190px,1fr)); gap: 14px; }
.stat { background: #fff; border-radius: 10px; padding: 16px 18px 16px 20px; box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 4px 16px rgba(15,23,42,.05); position: relative; overflow: hidden; transition: transform .15s, box-shadow .15s; }
.stat:hover { transform: translateY(-2px); box-shadow: 0 4px 6px rgba(15,23,42,.05), 0 10px 24px rgba(15,23,42,.09); }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: #2563eb; }
.cards .stat:nth-child(2)::before { background: #059669; }
.cards .stat:nth-child(3)::before { background: #d97706; }
.cards .stat:nth-child(4)::before { background: #7c3aed; }
.cards .stat:nth-child(5)::before { background: #0891b2; }
.cards .stat:nth-child(6)::before { background: #db2777; }
.cards .stat:nth-child(7)::before { background: #65a30d; }
.cards .stat:nth-child(8)::before { background: #dc2626; }
.stat .v { font-size: 24px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .l { color: #6b7280; font-size: 13px; }

/* 表格 */
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 4px 16px rgba(15,23,42,.05); margin-bottom: 18px; }
th, td { padding: 11px 14px; text-align: left; font-size: 14px; border-bottom: 1px solid #eef0f2; font-variant-numeric: tabular-nums; }
td { word-break: break-word; }
th { background: #f8fafc; color: #64748b; font-weight: 600; white-space: nowrap; }
tbody tr:hover, tr:hover td { background: #f8fafc; }
tr:last-child td { border-bottom: none; }

/* 按钮 */
.btn, button { display: inline-block; background: #2563eb; color: #fff; border: none; border-radius: 7px; padding: 8px 16px; font-size: 14px; cursor: pointer; transition: all .15s; }
.btn:hover, button:hover { background: #1d4ed8; color: #fff; }
.btn.gray, button.gray { background: #6b7280; }
.btn.gray:hover, button.gray:hover { background: #4b5563; }
.btn.red, button.red { background: #dc2626; }
.btn.red:hover, button.red:hover { background: #b91c1c; }
.btn.green, button.green { background: #059669; }
.btn.green:hover, button.green:hover { background: #047857; }
.btn.orange, button.orange { background: #ea580c; }
.btn.orange:hover, button.orange:hover { background: #c2410c; }
.btn.mini, button.mini { padding: 4px 10px; font-size: 13px; }
button:disabled, .btn.disabled { opacity: .45; cursor: not-allowed; }
button:disabled:hover { background: inherit; }
button.green:disabled:hover { background: #059669; }

/* 表单 */
input[type=text], input[type=password], input[type=number], input[type=date], select { width: 100%; padding: 9px 11px; border: 1px solid #d1d5db; border-radius: 7px; font-size: 14px; transition: border .15s, box-shadow .15s; background: #fff; }
input:focus, select:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
label.f { display: block; font-size: 13px; color: #6b7280; margin: 12px 0 5px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.inline-form { display: inline; }

/* 状态徽章 */
.pill { padding: 2px 10px; border-radius: 20px; font-size: 12px; white-space: nowrap; }
.s0 { background: #fef3c7; color: #92400e; }
.s1 { background: #d1fae5; color: #065f46; }
.s2 { background: #e5e7eb; color: #374151; }
.s3, .s5 { background: #fee2e2; color: #991b1b; }
.s4 { background: #f3f4f6; color: #6b7280; }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.online { background: #10b981; box-shadow: 0 0 0 3px rgba(16,185,129,.18); }
.offline { background: #9ca3af; }

/* 其他 */
.code-big { font-size: 34px; letter-spacing: 8px; font-weight: 700; text-align: center; padding: 18px 0; color: #2563eb; }
.qrbox { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.muted { color: #9ca3af; font-size: 13px; }
.logview { background: #0f172a; color: #a7f3d0; border-radius: 8px; padding: 12px 14px; font-size: 13px; max-height: 320px; overflow: auto; white-space: pre-wrap; font-family: "SFMono-Regular", Consolas, monospace; }
.switch { font-size: 14px; }

/* ========== 登录页 ========== */
.auth-body { min-height: 100vh; background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 55%, #2563eb 100%); display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 14px; padding: 34px 34px 28px; box-shadow: 0 20px 60px rgba(2,6,23,.35); }
.auth-logo { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 6px; }
.auth-logo .logo-badge { width: 40px; height: 40px; font-size: 19px; border-radius: 10px; }
.auth-logo .t { font-size: 20px; font-weight: 700; }
.auth-sub { text-align: center; color: #9ca3af; font-size: 13px; margin-bottom: 22px; }
.auth-tabs { display: flex; background: #f3f4f6; border-radius: 9px; padding: 4px; margin-bottom: 6px; }
.auth-tabs a { flex: 1; text-align: center; padding: 8px 0; border-radius: 7px; font-size: 14px; color: #6b7280; transition: all .15s; }
.auth-tabs a.on { background: #fff; color: #2563eb; font-weight: 600; box-shadow: 0 1px 3px rgba(15,23,42,.1); }
.auth-links { margin-top: 16px; text-align: center; font-size: 13px; }

/* 弹窗 */
.modal-mask { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 100; align-items: center; justify-content: center; padding: 20px; }
.modal-mask.show { display: flex; }
.modal { background: #fff; border-radius: 12px; padding: 22px 24px; width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(2,6,23,.3); }
.modal-mask.show .modal { animation: modalIn .18s ease-out; }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 6px; }

/* 页脚 */
.foot { text-align: center; color: #b0b7c3; font-size: 12px; padding: 8px 0 4px; }

/* 开关胶囊 */
.pill-switch { display: inline-flex; }
.pill-switch input { position: absolute; opacity: 0; pointer-events: none; }
.pill-switch span { padding: 8px 20px; border: 1.5px solid #d1d5db; border-radius: 20px; font-size: 14px; cursor: pointer; transition: all .15s; background: #fff; }
.pill-switch input:checked + span { background: #2563eb; border-color: #2563eb; color: #fff; box-shadow: 0 2px 6px rgba(37,99,235,.25); }

/* 分页 */
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: -6px; }

/* 收银台金额快捷按钮 */
.amt-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.amt-btn { padding: 13px 0; border: 1.5px solid #d1d5db; border-radius: 9px; background: #fff; color: #1f2937; font-size: 16px; font-weight: 600; transition: all .15s; }
.amt-btn:hover { border-color: #2563eb; color: #2563eb; background: #fff; }
.amt-btn.on { background: #2563eb; border-color: #2563eb; color: #fff; box-shadow: 0 2px 8px rgba(37,99,235,.3); }

/* 出单模式选择 */
.mode-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-opt { position: relative; }
.mode-opt input { position: absolute; opacity: 0; pointer-events: none; }
.mode-opt span { display: block; text-align: center; padding: 11px 0; border: 1.5px solid #d1d5db; border-radius: 9px; font-size: 15px; font-weight: 600; color: #374151; background: #fff; cursor: pointer; transition: all .15s; }
.mode-opt span:hover { border-color: #2563eb; color: #2563eb; }
.mode-opt input:checked + span { background: #2563eb; border-color: #2563eb; color: #fff; box-shadow: 0 2px 8px rgba(37,99,235,.3); }

/* 可展开收起列表 */
.collapsible > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 16px 22px; user-select: none; font-weight: 600; font-size: 15px; color: #1f2937; }
.collapsible > summary::-webkit-details-marker { display: none; }
.collapsible > summary:hover { background: #f8fafc; }
.collapsible .badge-cnt { background: #2563eb; color: #fff; font-size: 12px; font-weight: 700; min-width: 20px; height: 20px; line-height: 20px; text-align: center; border-radius: 10px; padding: 0 6px; }
.collapsible .caret { margin-left: auto; color: #9ca3af; transition: transform .2s; }
.collapsible[open] .caret { transform: rotate(180deg); }

/* 收银卡片更显眼 */
.cashier-card { box-shadow: 0 6px 24px rgba(15,23,42,.08); }

/* 高危操作红色弹窗 */
.danger-mask { background: rgba(127,29,29,.45); }
.danger-modal { max-width: 440px; border: 1.5px solid #fecaca; }
.danger-head { background: #dc2626; color: #fff; font-weight: 700; font-size: 15px; padding: 8px 16px; border-radius: 8px; display: inline-block; margin-bottom: 12px; letter-spacing: 1px; }
.danger-body { color: #4b5563; font-size: 14px; line-height: 1.7; margin: 0 0 14px; }
.danger-check { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; padding: 10px 12px; cursor: pointer; }
.danger-check input { margin-top: 2px; accent-color: #dc2626; }
.btn.red:disabled { background: #fca5a5; cursor: not-allowed; opacity: .8; }

/* ========== 活码系统 ========== */
/* 域名复选组 */
.dom-check-list { max-height: 230px; overflow-y: auto; border: 1px solid #e5e7eb; border-radius: 9px; padding: 6px 10px; background: #fafbfc; }
.dom-check { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid #f1f2f4; cursor: pointer; font-size: 14px; }
.dom-check:last-child { border-bottom: none; }
.dom-check input { width: 16px; height: 16px; accent-color: #2563eb; flex-shrink: 0; }
.dom-check .dom-host { flex: 1; font-weight: 600; color: #1f2937; word-break: break-all; }

/* 点卡类型三选 */
.pt-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

/* 活码卡片 */
.lc-card { max-width: 720px; }
.lc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.lc-amount { font-size: 24px; font-weight: 700; color: #2563eb; }
.lc-stats { display: flex; gap: 18px; flex-wrap: wrap; margin: 12px 0; padding: 10px 14px; background: #f8fafc; border-radius: 8px; font-size: 13px; color: #4b5563; }
.lc-stats b { color: #1f2937; font-size: 15px; }
.lc-url-list { display: grid; gap: 12px; }
.lc-url-row { display: flex; gap: 14px; align-items: center; padding: 12px; border: 1px solid #eef0f2; border-radius: 10px; background: #fff; }
.lc-qr { flex-shrink: 0; width: 96px; height: 96px; display: flex; align-items: center; justify-content: center; background: #fff; }
.lc-qr canvas, .lc-qr img { width: 96px !important; height: 96px !important; border-radius: 6px; }
.lc-url-main { min-width: 0; flex: 1; }
.lc-host { font-weight: 700; font-size: 14px; color: #1f2937; display: flex; align-items: center; gap: 8px; }
.lc-url { font-size: 12px; color: #6b7280; word-break: break-all; margin-top: 3px; }

/* 待支付列表"活码分发中"角标 */
.occ-pill { font-variant-numeric: tabular-nums; }

/* ========== 批量量产 ========== */
.batch-bar { height: 10px; background: #eef2ff; border-radius: 6px; overflow: hidden; margin-bottom: 12px; }
.batch-bar > div { height: 100%; width: 0; background: linear-gradient(90deg,#3b82f6,#2563eb); border-radius: 6px; transition: width .3s; }
.batch-rows { max-height: 260px; overflow-y: auto; border: 1px solid #eef0f2; border-radius: 9px; }
.batch-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid #f3f4f6; font-size: 13px; }
.batch-row:last-child { border-bottom: none; }
.batch-row .b-idx { width: 48px; color: #6b7280; flex-shrink: 0; }
.batch-row .b-no { width: 70px; color: #9ca3af; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.batch-row .b-st { flex: 1; }
.b-st.wait { color: #2563eb; }
.b-st.ok { color: #059669; font-weight: 600; }
.b-st.ok a { font-weight: 400; margin-left: 4px; }
.b-st.fail { color: #dc2626; font-weight: 600; }
.b-st.warn { color: #d97706; }
.b-st.warn a { font-weight: 400; margin-left: 4px; }

/* ========== 响应式 ========== */
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .logo { height: 52px; }
  .menu { display: flex; padding: 8px 10px; overflow-x: auto; }
  .menu a { white-space: nowrap; margin-bottom: 0; }
  .side-foot { display: none; }
  .topbar { padding: 0 14px; }
  .content { padding: 14px 12px 32px; }
  table { display: block; overflow-x: auto; }
  .lc-url-row { flex-direction: row; }
  .lc-qr, .lc-qr canvas, .lc-qr img { width: 76px !important; height: 76px !important; }
  .pt-row { grid-template-columns: 1fr; }
}

/* 活码卡片池子下拉 */
.pool-box{border-top:1px dashed #e5e7eb;margin-top:12px;padding:0 2px 4px;overflow-x:auto}
.pool-box table{min-width:460px}
.pool-remain{font-variant-numeric:tabular-nums;font-weight:600}
/* 可用订单数量徽章 */
.pool-n{display:inline-block;min-width:20px;padding:0 6px;margin:0 2px;border-radius:999px;background:#059669;color:#fff;font-size:12px;font-weight:700;line-height:18px;text-align:center}
button.mini.gray .pool-n{background:#059669}
.pool-n.zero{background:#d1d5db;color:#4b5563}
