/* 后台管理界面样式（在 style.css 基础上叠加） */

.wrap.wide { max-width: 1080px; }

/* 登录 */
.login-view {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 380px;
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 30px 26px;
  text-align: center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 12px 40px rgba(4, 8, 18, .5), inset 0 1px 0 rgba(255,255,255,.05);
}
.login-logo {
  width: 52px; height: 52px; margin: 0 auto 16px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  font-weight: 800; font-size: 11px; letter-spacing: 1px; color: #04121a;
  box-shadow: 0 6px 22px rgba(34, 211, 238, .4);
}
.login-card h1 { margin: 0 0 6px; font-size: 20px; }
.login-sub { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.login-card .input { width: 100%; text-align: center; margin-bottom: 12px; }
.btn.full { width: 100%; }
.login-hint { margin: 18px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.8; text-align: left; }
.login-hint code { background: rgba(6, 11, 20, .6); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line); }

/* 头部 */
.head.between { justify-content: space-between; align-items: flex-start; }
.head-left { display: flex; align-items: center; gap: 14px; }
.head-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.head .logo {
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  box-shadow: 0 6px 22px rgba(34, 211, 238, .38);
  font-size: 11px;
}
.link { color: var(--accent); text-decoration: none; }
.link:hover { text-decoration: underline; }

/* 统计 */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.stat {
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 12px 14px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.stat span { display: block; font-size: 11px; color: var(--muted); margin-bottom: 5px; }
.stat strong { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat.ok strong { color: var(--green); }
.stat.warn strong { color: var(--amber); }

/* 生成区 */
.gen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.gen-grid .span2 { grid-column: span 2; }
.field label em { font-style: normal; color: var(--muted); font-size: 11px; }
.gen-actions { display: flex; align-items: center; gap: 14px; }
.msg.inline { margin: 0; }

.gen-result { margin-top: 14px; }
.gen-result .gr-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--muted); margin-bottom: 8px;
}
.gen-codes { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; }
.gen-code {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: rgba(6, 11, 20, .62); border: 1px solid rgba(34, 211, 238, .28);
  border-radius: 9px; padding: 9px 12px;
}
.gen-code code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px; font-weight: 700; letter-spacing: 2px; color: var(--accent);
  text-shadow: 0 0 12px rgba(34, 211, 238, .35);
}
/* 新生成码旁的分区标签：靠右挤到按钮前，与码值留出间距 */
.gen-region {
  flex: 1 1 auto; margin-right: auto; margin-left: 10px;
  font-size: 11.5px; color: var(--muted); white-space: nowrap;
}

/* 列表中的「适用分区」单元格 */
.tbl td.region-cell { color: var(--text); font-size: 12.5px; white-space: nowrap; }
.tbl td.region-cell.all { color: var(--muted); }

/* 编辑弹窗的分区复选框组 */
.region-checks {
  display: flex; flex-wrap: wrap; gap: 8px 16px;
  background: rgba(6, 11, 20, .55);
  border: 1px solid var(--line); border-radius: 9px;
  padding: 10px 12px;
}
.region-checks label {
  display: flex; align-items: center; gap: 7px;
  font-size: 13.5px; color: var(--text); cursor: pointer; margin: 0;
}
.region-checks input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }

/* 列表工具 */
.list-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.input.small { padding: 7px 10px; font-size: 13px; border-radius: 8px; flex: 0 1 auto; min-width: 120px; }
select.input.small { cursor: pointer; }

/* 分页 */
.pagination {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.pagination .page-info { font-size: 12px; color: var(--muted); white-space: nowrap; }
.pagination .page-btns { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pagination .page-dots { font-size: 12px; color: var(--muted); padding: 0 4px; user-select: none; }
.pagination .btn.tiny.active {
  background: rgba(34, 211, 238, .15); border-color: rgba(34, 211, 238, .4); color: var(--accent);
  pointer-events: none;
}
.pagination .btn.tiny.disabled { opacity: .35; pointer-events: none; }

/* 表格 */
.table-wrap { margin-top: 14px; overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td {
  text-align: left; padding: 10px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.tbl th { font-size: 11px; color: var(--muted); font-weight: 500; letter-spacing: .4px; white-space: nowrap; }
.tbl th[data-sort] { cursor: pointer; user-select: none; position: relative; padding-right: 18px; }
.tbl th[data-sort]:hover { color: var(--text); }
.tbl th[data-sort]::after {
  content: '↕';
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  opacity: 0.3;
}
.tbl th.sort-asc::after { content: '↑'; opacity: 1; color: var(--accent); }
.tbl th.sort-desc::after { content: '↓'; opacity: 1; color: var(--accent); }
.tbl th.right, .tbl td.right { text-align: right; }
.tbl tbody tr:hover { background: rgba(34, 211, 238, .05); }
.tbl td.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 1.2px; font-weight: 700; color: var(--accent); white-space: nowrap;
}
.tbl td.note { color: var(--muted); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl td.dim { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl td.otp-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 1.5px; font-weight: 700; color: var(--accent); white-space: nowrap;
}
.row-actions { display: flex; gap: 5px; justify-content: flex-end; flex-wrap: wrap; }
.btn.tiny { padding: 4px 9px; font-size: 11px; border-radius: 7px; }

/* 状态徽章 */
.badge {
  display: inline-block; padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 650; white-space: nowrap;
  border: 1px solid transparent;
}
.badge.ok { color: var(--green); background: rgba(52, 211, 153, .12); border-color: rgba(52, 211, 153, .3); }
.badge.off { color: var(--muted); background: rgba(139, 154, 181, .1); border-color: rgba(139, 154, 181, .25); }
.badge.exp { color: var(--red); background: rgba(251, 113, 133, .1); border-color: rgba(251, 113, 133, .3); }
.badge.used { color: var(--amber); background: rgba(251, 191, 36, .1); border-color: rgba(251, 191, 36, .3); }

/* 危险操作 */
.btn.danger { background: rgba(251, 113, 133, .12); border-color: rgba(251, 113, 133, .35); color: var(--red); }
.btn.danger:hover:not(:disabled) { background: rgba(251, 113, 133, .2); }
.danger-card { border-color: rgba(251, 113, 133, .24); }
.danger-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 0; border-top: 1px solid var(--line); margin-top: 12px;
}
.danger-row:first-of-type { border-top: 0; margin-top: 6px; }
.danger-row strong { font-size: 13px; display: block; margin-bottom: 4px; }
.danger-row .hint { margin: 0; }
.danger-row .btn { flex: 0 0 auto; }

/* 代码块 */
.codeblock {
  background: rgba(6, 11, 20, .7); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; margin: 8px 0 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; line-height: 1.7; color: #9fe8ff;
  overflow-x: auto; white-space: pre; tab-size: 2;
}

/* 弹窗 */
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(4, 8, 16, .68);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 20px;
}
.modal-card {
  width: 100%; max-width: 420px;
  background: var(--card-solid); border: 1px solid var(--line-strong);
  border-radius: 15px; padding: 22px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(4, 8, 18, .6), 0 0 30px rgba(34, 211, 238, .06);
}
.modal-card h2 { margin: 0 0 18px; font-size: 17px; }
.modal-card .field { margin-bottom: 14px; }
.modal-card input[type="text"], .modal-card input[type="number"], .modal-card input[type="datetime-local"] {
  width: 100%; background: rgba(6, 11, 20, .7); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 10px; color: var(--text); font-size: 14px; outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.modal-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(34, 211, 238, .12); }
.mt { margin-top: 8px; }
.checkrow {
  display: flex; align-items: center; gap: 9px;
  font-size: 13.5px; color: var(--text); cursor: pointer; margin-bottom: 10px;
}
.checkrow input { width: 16px; height: 16px; accent-color: var(--accent); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* 轻提示 */
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%);
  background: var(--card-solid); border: 1px solid var(--line-strong);
  border-radius: 11px; padding: 11px 20px;
  font-size: 13px; z-index: 100;
  box-shadow: 0 10px 34px rgba(4, 8, 18, .55);
  animation: toastIn .2s ease-out;
}
.toast.ok { border-color: rgba(52, 211, 153, .4); color: var(--green); }
.toast.err { border-color: rgba(251, 113, 133, .4); color: var(--red); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } }

@media (max-width: 720px) {
  .head.between { flex-direction: column; gap: 12px; }
  .gen-grid .span2 { grid-column: span 1; }
  .list-tools { width: 100%; }
  .list-tools .input.small { flex: 1 1 auto; }
  .danger-row { flex-direction: column; align-items: stretch; }
  .tbl td.note { max-width: 90px; }
}

/* Bulk code management */
.code-selection-bar{display:flex;flex-wrap:wrap;align-items:center;gap:14px;padding:18px;margin:18px 0 0;border:1px solid var(--line);border-radius:9px;background:#c0f66b05}.selection-summary{display:flex;align-items:center;gap:12px;font-size:12px}.selection-summary strong{color:var(--accent);font-weight:600}.selection-summary>span{color:var(--muted);font-size:11px}.selection-actions,.batch-actions{display:flex;flex-wrap:wrap;gap:8px}.batch-actions{margin-left:auto}.selection-hint{flex-basis:100%;margin:0;font-size:10px;line-height:1.9;color:var(--muted)}.selection-cell{width:42px;min-width:42px;text-align:center!important}.selection-cell input{width:16px;height:16px;accent-color:var(--accent);cursor:pointer}.selection-cell input:disabled{cursor:not-allowed}.tbl tbody tr.code-selected{background:#c0f66b0b}.tbl tbody tr.code-selected td:first-child{box-shadow:inset 2px 0 var(--accent)}.code-lock{display:block;width:max-content;font:9px sans-serif;color:#e2c884;margin-top:6px}.code-page-size{display:flex;align-items:center;justify-content:flex-end;gap:10px;margin:14px 0 0;font-size:11px;color:var(--muted)}.code-page-size .input{width:90px;padding:6px 10px}.batch-result{white-space:pre-wrap;overflow-wrap:anywhere;font-size:12px;line-height:1.9;margin:14px 0 0}.batch-actions .btn:disabled,.selection-actions .btn:disabled{opacity:.35;cursor:not-allowed}.tbl .btn:disabled{opacity:.35;cursor:not-allowed}
@media(max-width:800px){.code-selection-bar{padding:14px;gap:12px}.batch-actions{margin-left:0;width:100%}.selection-actions{margin-left:auto}.selection-hint{font-size:9px}.code-selection-bar .btn{font-size:10px;padding:7px 10px}}
@media(max-width:480px){.selection-actions{margin-left:0}.selection-summary{width:100%}.batch-actions .btn{flex:1 0 auto}.selection-cell{position:sticky;left:0;background:var(--card);z-index:1}.code-selected .selection-cell{background:#202b18}}
.tbl{min-width:1120px}.tbl .row-actions{flex-wrap:nowrap;white-space:nowrap}.tbl .row-actions .btn{flex:0 0 auto}.result-head>.label{white-space:nowrap}.selection-cell{position:sticky;left:0;background:var(--card);z-index:1}.code-selected .selection-cell{background:#202b18}.tbl th.selection-cell{z-index:2}.code-selection-bar .btn:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
.batch-confirm{width:min(480px,calc(100vw - 36px));box-sizing:border-box;border:1px solid #c0f66b40;border-radius:14px;background:#131a11;color:var(--text);padding:30px;box-shadow:0 30px 100px #0009}.batch-confirm::backdrop{background:#030604b8;backdrop-filter:blur(5px)}.batch-confirm .eyebrow{font-size:9px}.batch-confirm h2{font-size:21px;line-height:1.6;margin:17px 0}.batch-confirm p{font-size:13px;line-height:1.9;color:var(--muted)}.batch-confirm pre{white-space:pre-wrap;overflow-wrap:anywhere;font:11px/2 var(--mono);padding:15px;background:#090e08;border:1px solid var(--line);border-radius:8px;color:#c9d7bd}.batch-confirm .modal-actions{margin-top:24px}
