:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-2: #f1f4f9;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-2: #1d4ed8;
  --danger: #ef4444;
  --green: #10b981;
  --border: #e5e9f0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh;
}
.hidden { display: none !important; }
.msg { color: var(--danger); font-size: 13px; margin-top: 8px; min-height: 18px; }

/* 登录 */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 36px 32px; width: 340px; box-shadow: 0 20px 60px rgba(15,23,42,.12);
}
.login-card h1 { font-size: 22px; }
.login-card .sub { color: var(--muted); margin: 6px 0 22px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
input, select {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); font-size: 14px; outline: none;
}
input:focus, select:focus { border-color: var(--primary); }

/* 按钮 */
.btn {
  padding: 10px 16px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); cursor: pointer; font-size: 14px;
}
.btn:hover { border-color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-2); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.sm { padding: 6px 10px; font-size: 12px; }

/* 布局 */
.layout { display: flex; min-height: 100vh; }
.side {
  flex: 0 0 220px; width: 220px; white-space: nowrap; background: var(--panel); border-right: 1px solid var(--border);
  padding: 22px 16px; display: flex; flex-direction: column; gap: 14px;
}
.logo { font-size: 18px; font-weight: 700; }
nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  color: var(--muted); text-decoration: none; padding: 10px 12px; border-radius: 8px;
}
.nav-item.active, .nav-item:hover { background: var(--panel-2); color: var(--text); }
.side-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.me-info { font-size: 12px; color: var(--muted); padding: 0 4px; }

.content { flex: 1; min-width: 0; padding: 26px; }
.tab { display: none; }
.tab.active { display: block; }

.toolbar { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; align-items: center; }
.toolbar input, .toolbar select { width: auto; }

/* 统计卡片 */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.stat-card .num { font-size: 28px; font-weight: 700; margin-top: 6px; }
.stat-card .label { color: var(--muted); font-size: 13px; }
.stat-card.total .num { color: var(--text); }
.stat-card.use .num { color: var(--green); }
.stat-card.ban .num { color: var(--danger); }
.stat-card.online .num { color: var(--primary); }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.panel h3 { margin-bottom: 14px; font-size: 15px; }

/* 子标签 */
.tabs-sub { display: flex; gap: 8px; margin-bottom: 16px; }
.sub-tab {
  padding: 8px 16px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--muted); cursor: pointer; font-size: 13px;
}
.sub-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* 表格 */
.table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: 12px; white-space: nowrap; }
.table th, .table td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.table th { color: var(--muted); font-weight: 600; text-align: left; }
.table tr:hover td { background: var(--panel-2); }
.status-tag { padding: 3px 10px; border-radius: 999px; font-size: 12px; }
.s0 { background: #f1f5f9; color: #475569; }
.s1 { background: #ecfdf5; color: #059669; }
.s2 { background: #f4f4f5; color: #71717a; }
.s3 { background: #fef2f2; color: #dc2626; }
.ops { display: flex; gap: 6px; flex-wrap: nowrap; }
.table th:last-child, .table td:last-child { position: sticky; right: 0; background: var(--panel); box-shadow: -10px 0 14px -10px rgba(15,23,42,.18); }
.table tr:hover td:last-child { background: var(--panel-2); }
.tab { overflow-x: auto; }
.table-scroll { overflow-x: auto; }
.tag-chip { background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px; font-size: 12px; }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(15,23,42,.35); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 26px; width: 400px; max-height: 90vh; overflow: auto; }
.modal-card h3 { margin-bottom: 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* 买家后台：到期徽标 / 表单切换 / 成功提示 */
.me-expire { margin-top: 6px; padding: 5px 8px; border-radius: 8px; font-size: 12px; color: var(--primary); background: rgba(59,130,246,.10); border: 1px solid rgba(59,130,246,.20); line-height: 1.5; }
.me-expire.off { color: var(--danger); border-color: rgba(239,68,68,.25); background: rgba(239,68,68,.06); }
.switch-line { margin-top: 12px; font-size: 13px; color: var(--muted); }
.switch-line a { color: var(--primary); text-decoration: none; cursor: pointer; }
.msg.ok { color: var(--green); }

.section-title { font-size: 15px; font-weight: 600; margin-right: auto; color: var(--text); }

/* ---------- 软件位 ---------- */
.tip { color: var(--muted); font-size: 13px; line-height: 1.7; margin: -4px 0 14px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12.5px; letter-spacing: .3px; }
.notice-cell { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 36px 0; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; }
.badge.ok { background: rgba(22,163,74,.12); color: #16a34a; }
.badge.off { background: rgba(148,163,184,.18); color: #64748b; }


/* 卡密加时弹窗 */
.row-inline { display: flex; gap: 10px; align-items: center; }
.row-inline input { flex: 1; }
.row-inline select { width: 150px; }
.quick-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.quick-row .btn.sm { margin: 0; }

/* 窄屏压缩：隐藏次数与标签列，保证操作列完整可见 */
@media (max-width: 1320px) {
  .table th:nth-child(7), .table td:nth-child(7),
  .table th:nth-child(8), .table td:nth-child(8) { display: none; }
}
