:root {
  --bg: #f5f6f8;
  --side: #111827;
  --side2: #1f2937;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --card: #ffffff;
  --primary: #2563eb;
  --primary2: #1d4ed8;
  --ok: #059669;
  --danger: #dc2626;
  --radius: 10px;
  --side-w: 232px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --ctrl-h: 40px;
  --ctrl-pad-x: 11px;
  --ctrl-radius: 8px;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--primary); text-decoration: none; }

/* 统一输入框 / 下拉框尺寸，避免 select 与 input 高低不一 */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="url"],
input[type="search"],
input[type="tel"],
input[type="date"],
input[type="datetime-local"],
input:not([type]),
select,
.ctrl {
  box-sizing: border-box;
  height: var(--ctrl-h);
  min-height: var(--ctrl-h);
  padding: 0 var(--ctrl-pad-x);
  border: 1px solid var(--line);
  border-radius: var(--ctrl-radius);
  font: inherit;
  font-size: 13px;
  line-height: calc(var(--ctrl-h) - 2px);
  color: var(--text);
  background: #fff;
  vertical-align: middle;
}
select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px 8px;
  cursor: pointer;
}
textarea {
  box-sizing: border-box;
  min-height: 88px;
  height: auto;
  padding: 9px var(--ctrl-pad-x);
  border: 1px solid var(--line);
  border-radius: var(--ctrl-radius);
  font: inherit;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  background: #fff;
  resize: vertical;
}
input:focus, select:focus, textarea:focus {
  outline: 0; border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
input[type="checkbox"],
input[type="radio"],
input[type="file"],
input[type="hidden"],
input[type="submit"],
input[type="button"],
input[type="image"] {
  height: auto;
  min-height: 0;
  padding: initial;
  border: initial;
  border-radius: initial;
  line-height: inherit;
  background: initial;
  box-shadow: none;
}
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--side-w); background: linear-gradient(180deg, var(--side), #0b1220);
  color: #e5e7eb; flex-shrink: 0; display: flex; flex-direction: column;
  transition: transform .2s ease;
}
.brand {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 14px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand strong { font-size: 15px; letter-spacing: .02em; }
.nav { padding: 10px 8px 24px; overflow-y: auto; flex: 1; }

/* Native accordion menu — works without JS */
.nav-acc { border: 0; margin: 2px 0; background: transparent; }
.nav-acc-sum {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: 8px; color: #9ca3af;
  font-size: 12px; font-weight: 700; letter-spacing: .04em;
}
.nav-acc-sum::-webkit-details-marker { display: none; }
.nav-acc-sum::after {
  content: "▾"; font-size: 12px; color: #6b7280;
  transition: transform .15s ease;
}
.nav-acc:not([open]) > .nav-acc-sum::after { transform: rotate(-90deg); }
.nav-acc-sum:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-acc-sub > .nav-acc-sum {
  color: #d1d5db; font-size: 13px; font-weight: 500; padding-left: 18px; letter-spacing: 0;
}
.nav-acc-body { padding: 2px 0 6px; }
.nav-item {
  display: block; padding: 8px 12px 8px 18px; margin: 1px 0; border-radius: 8px;
  color: #e5e7eb; font-size: 13px;
}
.nav-item-root { font-weight: 500; padding-left: 12px; }
.nav-acc-sub .nav-item { padding-left: 28px; font-size: 13px; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.is-active {
  background: rgba(37,99,235,.35); color: #fff;
  box-shadow: inset 3px 0 0 #60a5fa;
}

.sidebar-mask { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 30; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.page-title { margin: 0; font-size: 17px; font-weight: 650; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.user-chip { color: var(--muted); font-size: 13px; }
.link-btn, .icon-btn {
  border: 0; background: transparent; color: var(--text); cursor: pointer;
  padding: 6px 10px; border-radius: 8px; font-size: 13px;
}
.link-btn:hover, .icon-btn:hover { background: #f3f4f6; }
.icon-btn {
  width: 34px; height: 34px; padding: 0; font-size: 13px; line-height: 1;
  color: inherit; display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 34px; position: relative;
}
.top-bell { text-decoration: none; color: inherit; }
.bell-badge {
  position: absolute; top: 2px; right: 0;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: #ef4444; color: #fff;
  font-size: 10px; line-height: 16px; text-align: center; font-weight: 600;
}
.user-menu { position: relative; }
.user-menu-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  border: 0; background: transparent; cursor: pointer;
  padding: 4px 8px 4px 4px; border-radius: 999px; color: var(--text);
}
.user-menu-trigger:hover, .user-menu.open .user-menu-trigger { background: #f3f4f6; }
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%; object-fit: cover;
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 30px;
}
.user-avatar-letter {
  background: #60a5fa; color: #fff; font-size: 13px; font-weight: 650;
}
.user-name { font-size: 13px; max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-caret {
  width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-top: 5px solid #9ca3af; margin-left: 2px;
}
.user-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 50;
  min-width: 168px; padding: 4px 0; background: #fff;
  border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(16,24,40,.12);
}
.user-dropdown a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; color: var(--text); font-size: 13px;
  border-bottom: 1px solid #f3f4f6;
}
.user-dropdown a:last-child { border-bottom: 0; }
.user-dropdown a:hover { background: #f9fafb; }
.udi {
  width: 16px; height: 16px; flex: 0 0 16px; opacity: .75;
  background: currentColor;
  -webkit-mask: no-repeat center / contain; mask: no-repeat center / contain;
}
.udi-refresh { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M21 12a9 9 0 1 1-2.6-6.3'/%3E%3Cpath d='M21 3v6h-6'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M21 12a9 9 0 1 1-2.6-6.3'/%3E%3Cpath d='M21 3v6h-6'/%3E%3C/svg%3E"); }
.udi-user { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 20c1.5-3.5 4.5-5 8-5s6.5 1.5 8 5'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 20c1.5-3.5 4.5-5 8-5s6.5 1.5 8 5'/%3E%3C/svg%3E"); }
.udi-key { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='8' cy='15' r='4'/%3E%3Cpath d='M11.5 13.5 20 5l2 2-3 3 2 2-2.5 1.5'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='8' cy='15' r='4'/%3E%3Cpath d='M11.5 13.5 20 5l2 2-3 3 2 2-2.5 1.5'/%3E%3C/svg%3E"); }
.udi-out { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M10 17H5V7h5'/%3E%3Cpath d='M14 12H5'/%3E%3Cpath d='m17 8 4 4-4 4'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M10 17H5V7h5'/%3E%3Cpath d='M14 12H5'/%3E%3Cpath d='m17 8 4 4-4 4'/%3E%3C/svg%3E"); }
#menuToggle.icon-btn {
  width: 24px; height: 24px; flex: 0 0 24px;
}
.sidebar .icon-btn { color: #e5e7eb; display: none; }
/* 三横线菜单图标（等宽等距方头，小尺寸） */
.i-menu {
  display: block;
  width: 14px;
  height: 10px;
  background:
    linear-gradient(currentColor, currentColor) 0 0 / 100% 1.5px no-repeat,
    linear-gradient(currentColor, currentColor) 0 4px / 100% 1.5px no-repeat,
    linear-gradient(currentColor, currentColor) 0 8px / 100% 1.5px no-repeat;
  box-shadow: none;
}
.icon-btn .i-menu-svg {
  display: block;
  width: 14px;
  height: 11px;
  fill: currentColor;
}
.i-close {
  position: relative; display: block; width: 12px; height: 12px; background: transparent;
}
.i-close::before, .i-close::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 12px; height: 1.5px; background: currentColor; border-radius: 1px;
}
.i-close::before { transform: translate(-50%, -50%) rotate(45deg); }
.i-close::after { transform: translate(-50%, -50%) rotate(-45deg); }
.content { padding: 18px; width: 100%; max-width: 1180px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px;
}
.card h3 { margin: 0 0 14px; font-size: 15px; font-weight: 650; }
.card-section { margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.card-section:last-of-type { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.card-section h4 { margin: 0 0 12px; font-size: 13px; color: var(--muted); font-weight: 600; }

.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: 16px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 16px;
}
.stat .n { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.stat .l { margin-top: 4px; color: var(--muted); font-size: 12px; }

.chart-box { background: #fafafa; border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow-x: auto; }
.chart-svg { display: block; max-width: 100%; height: auto; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 0 0 10px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data th,
table.data td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
table.data th { background: #f9fafb; color: #374151; font-weight: 600; white-space: nowrap; }
table.data tr:hover td { background: #fafafa; }
table.data td.cell-clip,
table.data td.cell-url {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
table.data td.cell-url a,
table.data td.cell-url .file-dl-btn {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}
table.data td.cell-url .inline-dl {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
}
.file-dl-btn {
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
  text-align: left;
}
.file-dl-btn:hover { color: var(--primary2); }
table.data td.ops {
  /* 必须保持 table-cell，不能用 flex，否则整行错位 */
  display: table-cell;
  white-space: nowrap;
  vertical-align: middle;
}
table.data td.ops > a.btn,
table.data td.ops > .btn,
table.data td.ops > form {
  display: inline-block;
  vertical-align: middle;
  margin: 2px 4px 2px 0;
}
table.data td.ops > form {
  padding: 0;
  border: 0;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: #fff; color: var(--text);
  padding: 7px 14px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
.btn:hover { background: #f9fafb; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary2); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-ghost { border-color: transparent; background: transparent; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid > label { display: flex; flex-direction: column; gap: 6px; margin: 0; font-size: 13px; min-width: 0; }
.form-grid .span-2 { grid-column: 1 / -1; }
label.check {
  display: flex; flex-direction: row; align-items: center; gap: 8px;
  margin: 0; cursor: pointer; font-size: 13px;
}
.form-grid input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.form-grid select,
.form-grid textarea,
label > input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
label > select,
label > textarea,
.login-card input:not([type="checkbox"]):not([type="radio"]),
.login-card select,
.toolbar label input,
.toolbar label select,
.goods-buy input,
.goods-buy select {
  width: 100%;
}
label.check > input[type="checkbox"],
label.check > input[type="radio"] {
  width: auto; min-width: 16px; height: 16px; margin: 0; flex: 0 0 auto;
  padding: 0; border: none; box-shadow: none; accent-color: var(--primary, #2563eb);
}
.check-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px 12px;
}
.check-grid label.check { margin: 0; }
textarea { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.code-box {
  display: block; width: 100%; max-width: 100%; min-height: 420px; margin: 0 0 12px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px;
  background: #0b1220; color: #e5e7eb; line-height: 1.45;
  font-family: ui-monospace, Consolas, "Courier New", monospace; font-size: 12px;
  white-space: pre; overflow: auto; resize: vertical;
  box-sizing: border-box;
}
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.page-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border, var(--line));
}
.page-head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.form-stack > label { display: flex; flex-direction: column; gap: 6px; margin: 0; font-size: 13px; }
.html-box {
  min-height: 180px; width: 100%; font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 13px; line-height: 1.5; resize: vertical;
}
/* 非表格场景的操作按钮组（勿用在 td 上改 display） */
.ops-bar {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.ops-bar form {
  display: inline-flex;
  margin: 0;
  padding: 0;
  border: 0;
}
.ops-bar .btn { white-space: nowrap; }
.power-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px; max-height: 480px; overflow: auto; padding: 8px;
  border: 1px solid var(--line); border-radius: 8px; background: #fafafa;
}
.power-list label.check {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; justify-content: flex-start;
}
.power-list label.check:hover { border-color: #93c5fd; background: #f8fbff; }
.inline-redeem { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; flex: 1; }
.inline-redeem label { margin: 0; flex: 1 1 180px; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.act-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.act-item { display: flex; gap: 12px; align-items: flex-start; }
.act-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex: 0 0 auto; background: #60a5fa; }
.act-blue { background: #60a5fa; }
.act-green { background: #34d399; }
.act-red { background: #f87171; }
.act-gray { background: #9ca3af; }
.act-cyan { background: #22d3ee; }
.act-body { flex: 1; min-width: 0; }
.act-title { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 4px; }
.act-time { margin-left: auto; color: var(--muted); font-size: 12px; }
.act-desc { color: var(--muted); font-size: 13px; line-height: 1.5; word-break: break-word; }
.log-content { white-space: pre-wrap; word-break: break-word; max-width: 420px; font-size: 12px; line-height: 1.45; }
.nowrap { white-space: nowrap; }
.feed-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.feed-item { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fafafa; }
.feed-title { font-weight: 600; margin-bottom: 6px; }
.feed-body { font-size: 13px; color: var(--muted); line-height: 1.55; word-break: break-word; }
.feed-link { display: inline-block; margin-top: 8px; font-size: 13px; }
.goods-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.goods-card {
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff;
  display: flex; flex-direction: column;
}
.goods-cover {
  height: 150px; background: #f3f4f6; overflow: hidden;
}
.goods-cover img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.goods-cover.is-empty {
  background: linear-gradient(135deg, #e5e7eb, #f9fafb);
}
.goods-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.goods-name { font-weight: 600; font-size: 15px; }
.goods-desc { font-size: 12px; color: var(--muted); line-height: 1.45; }
.goods-price { color: #dc2626; font-weight: 600; font-size: 16px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.goods-price-now { color: #dc2626; }
.goods-price-old { color: var(--muted); font-size: 13px; font-weight: 500; text-decoration: line-through; }
.goods-buy { display: flex; flex-direction: column; gap: 6px; margin-top: auto; }
.goods-thumb {
  width: 48px; height: 36px; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--line); display: block; background: #f3f4f6;
}
.goods-preview img { max-width: 220px; max-height: 140px; border-radius: 10px; border: 1px solid var(--line); object-fit: cover; }

.alert { padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; font-size: 13px; }
.alert-ok { background: #ecfdf5; color: var(--ok); border: 1px solid #a7f3d0; }
.alert-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.muted { color: var(--muted); font-size: 13px; }
.pager { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  align-items: flex-end;
}
.toolbar form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
  flex: 1 1 auto;
  width: auto;
  max-width: 100%;
  min-width: 0;
}
.toolbar label {
  margin: 0;
  flex: 0 1 200px;
  max-width: 260px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.toolbar label input,
.toolbar label select { width: 100%; }
.toolbar > .btn,
.toolbar > a.btn,
.toolbar form > .btn { flex: 0 0 auto; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.badge-on { background: #ecfdf5; color: var(--ok); }
.badge-off { background: #f3f4f6; color: var(--muted); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }

/* 卡密列表：避免手机端卡密换行错位 */
.key-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.key-table .key-code {
  white-space: nowrap;
  word-break: keep-all;
  font-size: 12px;
  letter-spacing: 0.02em;
}
.key-redeem-bar { flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.inline-redeem { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.inline-redeem .key-redeem-label,
.inline-redeem label { display: flex; flex-direction: column; gap: 4px; min-width: 200px; flex: 1; }
.inline-redeem input { width: 100%; max-width: 360px; }

.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: radial-gradient(1200px 600px at 10% -10%, #dbeafe, transparent),
    radial-gradient(900px 500px at 100% 0%, #e0e7ff, transparent), var(--bg);
}
.login-card {
  width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow); padding: 28px 24px;
}
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.reg-avatar-wrap { display: flex; justify-content: center; margin: 0 0 12px; }
.reg-avatar {
  width: 72px; height: 72px; border-radius: 50%; object-fit: cover;
  border: 2px solid #e5e7eb; background: #f3f4f6; display: block;
}
.reg-avatar-ph {
  display: inline-flex; align-items: center; justify-content: center;
  color: #9ca3af; font-size: 14px; font-weight: 650; letter-spacing: .5px;
}
.reg-avatar[hidden],
.reg-avatar-ph[hidden] {
  display: none !important;
}
.login-card form > label {
  display: flex; flex-direction: column; gap: 6px; margin: 0 0 12px; font-size: 13px;
}
.login-card .login-remember {
  display: block; margin: 2px 0 14px;
}
.login-card .login-remember label.check {
  display: inline-flex !important; flex-direction: row !important; align-items: center;
  gap: 8px; width: auto; margin: 0; font-size: 13px; color: var(--text, #111);
}
.login-card .login-remember input[type="checkbox"] {
  width: 16px !important; height: 16px; min-width: 16px; flex: 0 0 16px;
  margin: 0; padding: 0; border: none; box-shadow: none;
}
.btn-block { display: block; width: 100%; text-align: center; box-sizing: border-box; }
.captcha-row {
  display: flex; gap: 8px; align-items: stretch; width: 100%;
}
.captcha-row input,
.captcha-row select {
  flex: 1; min-width: 0; width: auto !important;
  height: var(--ctrl-h); min-height: var(--ctrl-h);
}
.captcha-img {
  height: var(--ctrl-h); width: auto; min-width: 110px;
  border-radius: var(--ctrl-radius); border: 1px solid var(--line);
  cursor: pointer; flex: 0 0 auto; align-self: stretch; object-fit: cover;
}
.login-links { display: flex; gap: 12px; margin-top: 14px; font-size: 13px; flex-wrap: wrap; }
.oauth-box { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); }
.oauth-title { text-align: center; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.oauth-btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.oauth-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 72px; height: 34px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--text);
  font-size: 13px; text-decoration: none;
}
.oauth-btn:hover { background: #f3f4f6; }
.oauth-btn.oauth-qq { color: #12b7f5; border-color: #b6e9fb; }
.oauth-btn.oauth-wx, .oauth-btn.oauth-wechat { color: #07c160; border-color: #b7ebcf; }
.oauth-btn.oauth-alipay { color: #1677ff; border-color: #91caff; }
.oauth-btn.oauth-sina { color: #e6162d; border-color: #ffccc7; }

.app.sidebar-collapsed .sidebar { margin-left: calc(var(--side-w) * -1); }

@media (max-width: 900px) {
  .form-grid { grid-template-columns: 1fr; }
  .user-chip { display: none; }
  .user-name { display: none; }
  .content { padding: 12px; max-width: 100%; }
  .card { padding: 14px 12px; overflow: visible; }
  .page-head { align-items: flex-start; }
  .toolbar label { flex: 1 1 100%; max-width: none; }
  table.data td.ops { white-space: normal; }
  table.data td.ops > a.btn,
  table.data td.ops > .btn,
  table.data td.ops > form {
    margin: 2px 4px 2px 0;
  }
  .key-table thead { display: none; }
  .key-table, .key-table tbody, .key-table tr, .key-table td { display: block; width: 100%; }
  .key-table tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 8px 10px;
    background: #fff;
  }
  .key-table td {
    border: 0;
    padding: 6px 0;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
  }
  .key-table td::before {
    content: attr(data-label);
    flex: 0 0 64px;
    color: #6b7280;
    font-weight: 600;
  }
  .key-table td.key-code {
    display: block;
  }
  .key-table td.key-code::before { display: block; margin-bottom: 4px; }
  .key-table .key-code { white-space: normal; word-break: break-all; }
  .key-table td.ops { justify-content: flex-end; }
}
@media (max-width: 800px) {
  .sidebar {
    position: fixed; z-index: 40; inset: 0 auto 0 0; height: 100%;
    transform: translateX(-100%); margin: 0;
  }
  .app.sidebar-open .sidebar { transform: translateX(0); }
  .app.sidebar-open .sidebar-mask { display: block; }
  .sidebar .icon-btn { display: inline-flex; }
}
