/* ===== 后台页面共享样式（对标站暗色 Steam 风） ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Microsoft YaHei", sans-serif; background: #0f0f0f; color: #e0e0e0; min-height: 100vh; }

/* 顶部导航（与对标站后台页一致） */
.header { background: linear-gradient(135deg, #1b2838, #2a475e); padding: 16px 32px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #333; position: relative; flex-wrap: wrap; gap: 10px; }
.header h1 { font-size: 22px; color: #66c0f4; }
.header nav { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.header nav a, .header nav button { color: #e0e0e0; text-decoration: none; padding: 7px 14px; border-radius: 4px; background: rgba(255,255,255,0.06); border: 1px solid #444; cursor: pointer; font-size: 13px; transition: all 0.2s; }
.header nav a:hover, .header nav button:hover { background: rgba(255,255,255,0.12); border-color: #66c0f4; }
.hamburger { display: none; background: none; border: none; cursor: pointer; padding: 4px; }
.hamburger span { display: block; width: 22px; height: 2px; background: #e0e0e0; margin: 4px 0; border-radius: 2px; }

.container { max-width: 1200px; margin: 0 auto; padding: 24px 20px; }
.page-title { font-size: 20px; color: #66c0f4; margin-bottom: 18px; display: flex; align-items: center; gap: 10px; }
.muted { color: #888; }
.empty { text-align: center; padding: 40px; color: #666; font-size: 15px; }

/* 通用控件 */
input, select, textarea { background: #0f1a24; border: 1px solid #2a475e; border-radius: 6px; color: #e0e0e0; padding: 9px 12px; font-size: 14px; outline: none; font-family: inherit; }
input:focus, select:focus, textarea:focus { border-color: #66c0f4; }
input[type=file] { padding: 6px 10px; }
label { color: #8fbcbb; font-size: 13px; }
/* 下拉项文字强制黑色（select 本身浅字在白底会看不清） */
select option { color: #000; }
button { font-family: inherit; }

/* 按钮 */
.btn { padding: 8px 18px; background: #66c0f4; color: #000; border: none; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; transition: background 0.2s; }
.btn:hover { background: #7acbf5; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost { background: #2a475e; color: #e0e0e0; border: 1px solid #444; }
.btn-ghost:hover { border-color: #66c0f4; background: #2a475e; }
.btn-danger { background: #c0392b; color: #fff; }
.btn-danger:hover { background: #a93226; }
.btn-primary { background: #66c0f4; color: #000; }

/* 卡片容器 */
.card { background: #1b2838; border: 1px solid #2a475e; border-radius: 10px; padding: 22px; margin-bottom: 20px; }
.card h3 { font-size: 16px; color: #66c0f4; margin-bottom: 14px; }

/* 表单行 */
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.row > .field { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 160px; }
.field label { font-size: 12px; color: #888; }
.field input, .field select, .field textarea { width: 100%; }

/* 统计卡片 */
.summary, .stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-card { background: #1b2838; border: 1px solid #2a475e; border-radius: 10px; padding: 18px; text-align: center; }
.stat-card .num { font-size: 28px; font-weight: 700; color: #66c0f4; }
.stat-card .label { font-size: 12px; color: #888; margin-top: 6px; }

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 13px; background: #1b2838; border-radius: 10px; overflow: hidden; }
th, td { border: 1px solid #2a475e; padding: 9px 12px; text-align: center; white-space: nowrap; }
th { background: #0f0f0f; color: #66c0f4; font-weight: 600; }
td { color: #ddd; }
tr:hover td { background: rgba(102,192,244,0.06); }
.table-wrap { background: #1b2838; border: 1px solid #2a475e; border-radius: 10px; padding: 16px; overflow-x: auto; }
.table-wrap h3 { color: #66c0f4; font-size: 15px; margin-bottom: 10px; }

/* 对标站 code-table 风格（卡密池） */
.code-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.code-table th { text-align: left; padding: 10px 12px; border-bottom: 1px solid #333; color: #888; font-weight: 400; background: transparent; }
.code-table td { padding: 8px 12px; border-bottom: 1px solid #1a1a2e; text-align: left; }
.code-table .used { color: #4caf50; }
.code-table .unused { color: #888; }
.code-table .code-text { font-family: monospace; }

/* 状态徽标 */
.badge { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 11px; }
.badge.in, .badge.sold, .badge.normal { background: rgba(76,175,80,0.15); color: #4caf50; }
.badge.out, .badge.refunded, .badge.banned { background: rgba(255,87,34,0.15); color: #ff5722; }
.badge.unused { background: rgba(158,158,158,0.15); color: #9e9e9e; }
.status-normal { color: #38a169; font-weight: 600; }
.status-banned { color: #e53e3e; font-weight: 600; }
.role-admin { color: #66c0f4; font-weight: 600; }
.role-user { color: #888; }

/* 商品管理：tabs + form */
.product-tabs { display: flex; gap: 0; margin-bottom: 18px; border-bottom: 1px solid #333; overflow-x: auto; padding-bottom: 4px; }
.product-tab { padding: 10px 16px; cursor: pointer; border-bottom: 2px solid transparent; color: #888; font-size: 14px; white-space: nowrap; background: none; border-top: none; border-left: none; border-right: none; }
.product-tab:hover { color: #e0e0e0; }
.product-tab.active { color: #66c0f4; border-bottom-color: #66c0f4; }
.product-form { background: #1b2838; border: 1px solid #2a475e; border-radius: 10px; padding: 20px; margin-bottom: 16px; display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.product-form .field { display: flex; flex-direction: column; gap: 4px; }
.product-form .field label { font-size: 12px; color: #888; }
.product-form .field input, .product-form .field select, .product-form .field textarea { background: #0f0f0f; border: 1px solid #444; border-radius: 4px; color: #fff; padding: 8px 10px; font-size: 13px; min-width: 150px; }
.product-form .field textarea { resize: vertical; height: 40px; }
.product-list { display: flex; flex-wrap: wrap; gap: 8px; }
.product-list-item { background: #1b2838; border: 1px solid #2a475e; border-radius: 6px; padding: 8px 14px; font-size: 13px; display: flex; align-items: center; gap: 10px; }
.product-list-item .cat-tag { font-size: 11px; padding: 1px 7px; border-radius: 8px; background: #2a475e; color: #8fbcbb; }

.toggle-btn { background: rgba(255,255,255,0.06); border: 1px solid #444; color: #888; cursor: pointer; font-size: 13px; padding: 3px 10px; border-radius: 4px; }
.toggle-btn:hover { color: #e0e0e0; border-color: #66c0f4; }

/* 搜索框 */
.search-bar { margin-bottom: 18px; }
.search-bar input { width: 100%; padding: 11px 16px; border-radius: 8px; background: #1b2838; }

/* 折叠面板 */
.panel-header { display: flex; justify-content: space-between; align-items: center; cursor: pointer; user-select: none; padding: 6px 0 12px; border-bottom: 1px solid #2a475e; margin-bottom: 16px; }
.panel-header h3 { margin: 0; }
.panel-header .arrow { color: #66c0f4; font-size: 14px; transition: transform 0.2s; }
.panel-header .arrow.open { transform: rotate(90deg); }

/* 批量结果提示 */
.batch-result { margin-top: 10px; padding: 10px; border-radius: 6px; font-size: 13px; }
.batch-result.ok { background: rgba(76,175,80,0.1); color: #4caf50; border: 1px solid rgba(76,175,80,0.2); }
.batch-result.err { background: rgba(255,87,34,0.1); color: #ff5722; border: 1px solid rgba(255,87,34,0.2); }

/* 充值卡详情卡片 */
.card-detail { background: #162230; border: 1px solid #2a475e; border-radius: 8px; padding: 10px 14px; margin-bottom: 8px; line-height: 1.8; }
.card-detail .row { display: flex; font-size: 13px; }
.card-detail .label { color: #888; min-width: 120px; flex-shrink: 0; }
.card-detail .value { color: #e0e0e0; word-break: break-all; }
.card-detail .value.highlight { color: #66c0f4; font-weight: 600; }

/* 带标签输入（充值码管理） */
.fld { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #fff; }
.fld span { font-weight: 600; }
.fld input, .fld select { width: 100%; }

/* 分页 */
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 14px; font-size: 13px; color: #888; }
.pager button { padding: 6px 14px; background: #2a475e; border: 1px solid #444; color: #e0e0e0; border-radius: 6px; cursor: pointer; font-size: 13px; }
.pager button:disabled { opacity: 0.4; cursor: not-allowed; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,0.85); display: none; align-items: center; justify-content: center; z-index: 1000; }
.modal-mask.show { display: flex; }
.modal { background: #1b2838; border: 1px solid #2a475e; border-radius: 12px; padding: 26px; max-width: 460px; width: 92%; max-height: 88vh; overflow-y: auto; }
.modal h3 { color: #66c0f4; margin-bottom: 14px; font-size: 19px; }
.modal .code { background: #0f0f0f; border: 1px dashed #66c0f4; border-radius: 6px; padding: 12px; word-break: break-all; color: #4caf50; font-family: monospace; margin: 10px 0; }
.modal-actions { text-align: right; margin-top: 16px; display: flex; gap: 10px; justify-content: flex-end; }

/* Toast */
#toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 2000; align-items: center; }
.toast-item { background: #2a475e; color: #fff; padding: 11px 22px; border-radius: 8px; font-size: 14px; box-shadow: 0 4px 16px rgba(0,0,0,0.5); border: 1px solid #3a5a78; }
.toast-item.ok { background: #143a22; border-color: #2e7d4f; }
.toast-item.err { background: #3a1414; border-color: #a93226; }

/* 图表 */
.chart-box { background: #1b2838; border: 1px solid #2a475e; border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.chart-box h3 { color: #66c0f4; font-size: 15px; margin-bottom: 10px; }
.chart-box canvas { display: block; width: 100%; }
.chart-box .empty { color: #666; font-size: 13px; text-align: center; padding: 30px 0; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; font-size: 12px; }
.legend .item { display: flex; align-items: center; gap: 6px; color: #bbb; }
.legend .swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.updated { color: #666; font-size: 12px; text-align: right; margin-top: 12px; }

/* 卡密统计页控件 */
.controls { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.controls label { font-size: 14px; color: #8fbcbb; }
.controls select { padding: 8px 12px; background: #1b2838; color: #e0e0e0; border: 1px solid #444; border-radius: 6px; font-size: 14px; cursor: pointer; min-width: 180px; }
.controls select:focus { outline: none; border-color: #66c0f4; }
.card-no { font-family: Consolas, monospace; color: #8fbcbb; }
.hint { font-size: 12px; color: #666; }

/* 用户管理：对标参考站的行内展开表格 */
.user-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.user-table th { text-align: center; padding: 10px 8px; border-bottom: 1px solid #2a475e; color: #66c0f4; font-weight: 600; background: #101820; }
.user-table td { padding: 10px 8px; border-bottom: 1px solid #1a1a2e; vertical-align: middle; text-align: center; }
.user-table tbody tr:hover { background: #162230; }
.user-table .col-check { width: 36px; }
.user-table .col-user { text-align: left; min-width: 100px; }
.user-table .col-status { width: 70px; }
.user-table .col-role { width: 50px; }
.user-table .col-points { width: 60px; }
.user-table .col-purchases { width: 90px; }
.user-table .col-card { text-align: left; min-width: 240px; }
.user-table .col-time { width: 100px; }
.user-table .col-action { width: 110px; }
.detail-row td { background: #131d28; padding: 0; }
.detail-body { padding: 12px 16px 16px 48px; }
.detail-body .sub-title { color: #66c0f4; font-size: 13px; font-weight: 600; margin-bottom: 8px; }

/* 已购商品卡片 */
.purchase-list { display: flex; flex-wrap: wrap; gap: 10px; }
.purchase-card { background: #0f1620; border: 1px solid #2a475e; border-radius: 8px; padding: 10px 14px; min-width: 220px; flex: 1; max-width: 320px; }
.purchase-card .kv { display: flex; font-size: 12px; line-height: 1.9; }
.purchase-card .k { color: #8fbcbb; min-width: 70px; flex-shrink: 0; }
.purchase-card .v { color: #e0e0e0; word-break: break-all; }
.purchase-card .v.highlight { color: #66c0f4; font-weight: 600; }

/* 充值卡号详情 */
.card-info-panel { background: #0f1620; border: 1px solid #2a475e; border-radius: 8px; padding: 14px 18px; max-width: 520px; }
.card-info-row { display: flex; font-size: 13px; line-height: 2.1; }
.card-info-k { color: #8fbcbb; min-width: 110px; flex-shrink: 0; }
.card-info-v { color: #e0e0e0; word-break: break-all; }
.card-info-v .region-value { color: #66c0f4; }
.card-info-actions { margin-top: 10px; }
.region-select { -webkit-appearance: none; -moz-appearance: none; appearance: none; background: transparent; border: none; border-radius: 0; color: #e0e0e0; font-size: 13px; padding: 0; margin: 0; cursor: pointer; }
.region-select:hover { color: #66c0f4; }
.region-select:focus { outline: none; }
.btn-outline-green { background: transparent; border: 1px solid #4caf50; color: #4caf50; padding: 5px 14px; border-radius: 6px; font-size: 12px; cursor: pointer; }
.btn-outline-green:hover { background: rgba(76,175,80,0.12); }

.sub-table { width: 100%; border-collapse: collapse; font-size: 12px; background: #0f1620; border-radius: 6px; overflow: hidden; }
.sub-table th { text-align: left; padding: 6px 12px; border-bottom: 1px solid #2a475e; color: #888; font-weight: 400; }
.sub-table td { padding: 6px 12px; border-bottom: 1px solid #1a1a2e; color: #cdd; }
.sub-table td.k { color: #8fbcbb; min-width: 110px; white-space: nowrap; }
.link-btn { background: none; border: none; color: #66c0f4; cursor: pointer; font-size: 12px; padding: 0; text-decoration: underline; }
.link-btn:hover { color: #8fbcbb; }
.batch-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; font-size: 13px; color: #cdd; }
.batch-bar #selCount { color: #66c0f4; font-weight: 600; }

/* 响应式 */
@media (max-width: 900px) { .charts { grid-template-columns: 1fr; } }
@media (max-width: 768px) {
  .header { padding: 10px 16px; }
  .header h1 { font-size: 17px; }
  .hamburger { display: block; }
  .header nav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: #1b2838; flex-direction: column; padding: 12px; border-bottom: 1px solid #333; z-index: 200; }
  .header nav.open { display: flex; }
  .header nav a, .header nav button { width: 100%; text-align: center; }
  .product-form { flex-direction: column; }
  .product-form .field, .product-form .field input, .product-form .field select { width: 100%; min-width: 0; }
  table { font-size: 11px; }
  th, td { padding: 6px 8px; }
}
