/* Capcut 充值系统 · 后台 UI v0.2（侧边栏布局） */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; background: #eef2f7; color: #1f2328; min-height: 100vh; }

/* ===== 整体布局：左栏 + 主区 ===== */
.layout { display: flex; min-height: 100vh; }

.sidebar { width: 200px; min-width: 200px; background: #fff; border-right: 1px solid #e2e8f0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { padding: 16px 16px 14px; font-weight: 700; color: #1d4ed8; font-size: 15px; border-bottom: 1px solid #eef2f7; white-space: nowrap; }
.side-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.side-nav a { display: block; padding: 9px 12px; border-radius: 8px; color: #475569; text-decoration: none; font-size: 13px; margin-bottom: 4px; }
.side-nav a:hover { background: #f1f5f9; }
.side-nav a.active { background: #2563eb; color: #fff; font-weight: 600; }
.side-foot { padding: 12px 16px; border-top: 1px solid #eef2f7; font-size: 12px; color: #94a3b8; line-height: 1.9; }
.side-foot .logout { color: #dc2626; cursor: pointer; text-decoration: none; }

.main { flex: 1; min-width: 0; padding: 16px 20px 30px; }
.main-narrow { max-width: 860px; margin: 0 auto; }

/* ===== 顶栏卡 ===== */
.topbar-card { background: #fff; border-radius: 10px; padding: 12px 16px; box-shadow: 0 1px 3px rgba(0,0,0,.06); display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 8px; }
.topbar-card .ttl { font-size: 15px; font-weight: 700; }
.topbar-card .sub { font-size: 12px; color: #94a3b8; margin-left: 6px; font-weight: 400; }
.topbar-card .st { font-size: 12px; color: #64748b; }
.topbar-card .st .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #22c55e; margin-right: 6px; }

/* ===== 卡片 ===== */
.card { background: #fff; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.06); padding: 16px; margin-bottom: 14px; }
.card h3 { font-size: 14px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.hint { color: #94a3b8; font-size: 12px; font-weight: 400; }

/* ===== KPI ===== */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: #fff; border-radius: 10px; padding: 14px 16px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.kpi .label { font-size: 12px; color: #64748b; margin-bottom: 6px; }
.kpi .num { font-size: 24px; font-weight: 700; color: #2563eb; }
.kpi .num.green { color: #16a34a; }
.kpi .num.orange { color: #ea580c; }
.kpi .num.red { color: #dc2626; }

/* ===== 双栏 ===== */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 10px; margin-bottom: 14px; }

/* ===== 表单 ===== */
input, select { width: 100%; padding: 9px 12px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 13px; margin-bottom: 10px; background: #fff; outline: none; }
input:focus, select:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
button { padding: 9px 14px; border: none; border-radius: 8px; background: #2563eb; color: #fff; font-size: 13px; cursor: pointer; }
button:hover { background: #1d4ed8; }
button:disabled { background: #93c5fd; cursor: not-allowed; }
button.btn-ghost { background: #f8fafc; color: #475569; border: 1px solid #e2e8f0; }
.form-row { display: flex; gap: 8px; flex-wrap: wrap; }
.form-row input, .form-row select { flex: 1; min-width: 130px; margin-bottom: 0; }
.form-row button { width: auto; }
.err { color: #dc2626; font-size: 13px; margin-top: 8px; min-height: 0; }

/* ===== 快捷操作 ===== */
.quick-ops { display: flex; gap: 8px; flex-wrap: wrap; }
.quick-ops span { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; border-radius: 8px; padding: 8px 12px; font-size: 12px; cursor: pointer; }
.quick-ops span:hover { background: #dbeafe; }

/* ===== 快捷操作 chip / 表格内 mini 按钮 ===== */
.chip { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; border-radius: 8px; padding: 8px 12px; font-size: 12px; cursor: pointer; text-align: center; display: inline-block; }
.chip:hover { background: #dbeafe; }
button.mini { padding: 4px 9px; font-size: 12px; border-radius: 6px; background: #f8fafc; color: #475569; border: 1px solid #e2e8f0; margin-right: 4px; }
button.mini:hover { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }

/* ===== 表格 ===== */
table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
th, td { padding: 9px 8px; border-bottom: 1px solid #eef2f7; text-align: left; white-space: nowrap; }
th { color: #64748b; font-weight: 600; background: #f8fafc; }
tbody tr:hover td { background: #f8fafc; }
tr.clickable { cursor: pointer; }
tr.member-row td { background: #f8fafc; padding: 6px; }
.inner-table { margin-top: 0; }
.inner-table td { background: #fbfdff; }
.code-cell { font-family: Consolas, monospace; font-size: 12px; }
.msg-cell { max-width: 240px; white-space: normal; word-break: break-all; }
.empty { color: #94a3b8; text-align: center; padding: 18px; }

/* ===== 徽标 ===== */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.b-green { background: #dcfce7; color: #16a34a; }
.b-red { background: #fee2e2; color: #dc2626; }
.b-orange { background: #ffedd5; color: #ea580c; }
.b-blue { background: #dbeafe; color: #2563eb; }
.b-gray { background: #f1f5f9; color: #64748b; }

/* ===== 发卡结果 ===== */
.code-box { margin-top: 12px; padding: 10px 12px; border: 1px dashed #93c5fd; border-radius: 8px; background: #eff6ff; font-family: Consolas, monospace; font-size: 12px; white-space: pre-wrap; word-break: break-all; }

/* ===== 隐藏 / 通用 ===== */
.hidden { display: none !important; }

/* ===== 登录页 ===== */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #eff6ff, #eef2f7); }
.login-card { width: 340px; background: #fff; border-radius: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.08); padding: 28px 24px; text-align: center; }
.login-card h2 { color: #1d4ed8; margin-bottom: 4px; font-size: 18px; }
.login-card .sub { color: #94a3b8; font-size: 12px; margin-bottom: 18px; }
.login-card input { margin-bottom: 12px; }
.login-card button { width: 100%; padding: 11px; }

/* ===== 卡密公开使用页（终端客户免登录） ===== */
.use-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #eff6ff, #eef2f7); padding: 16px; }
.use-card { width: 420px; max-width: 100%; background: #fff; border-radius: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.08); padding: 28px 24px; }
.use-card h2 { color: #1d4ed8; margin-bottom: 4px; font-size: 18px; }
.use-card .sub { color: #94a3b8; font-size: 12px; margin-bottom: 18px; }

/* 自助扫码系统风格 */
.use-title { font-size: 20px; font-weight: 700; color: #1e293b; margin: 4px 0 8px; }
.use-status { min-height: 22px; }
.use-tip { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; padding: 9px 12px; font-size: 12px; color: #1d4ed8; line-height: 1.6; margin-top: 8px; }
.use-btn { width: 100%; padding: 12px; font-size: 15px; font-weight: 600; background: linear-gradient(135deg, #2563eb, #1d4ed8); border-radius: 10px; }
.use-btn:disabled { background: #93c5fd; }
.use-meta { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 16px; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px; background: #f8fafc; }
.meta-item { text-align: center; }
.meta-label { font-size: 11px; color: #94a3b8; margin-bottom: 4px; }
.meta-val { font-size: 13px; font-weight: 600; color: #334155; word-break: break-all; }
@media (max-width: 420px) {
  .use-meta { grid-template-columns: 1fr; }
}
.use-card .sub { color: #94a3b8; font-size: 12px; margin-bottom: 18px; }

/* ===== 响应式：窄屏侧边栏折叠为顶部 ===== */
@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; min-width: 0; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; border-right: none; border-bottom: 1px solid #e2e8f0; }
  .brand { padding: 12px 14px; border-bottom: none; }
  .side-nav { display: flex; flex-wrap: wrap; padding: 8px 10px; flex: 1; }
  .side-nav a { margin: 2px 2px; padding: 7px 10px; }
  .side-foot { display: none; }
  .main { padding: 12px 12px 24px; }
  .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
}
