:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --ink: #101a2c;
  --ink-2: #33415c;
  --muted: #7382a0;
  --line: #e7ecf5;
  --primary: #3b6bf6;
  --primary-2: #6d5cf7;
  --emerald: #10b981;
  --amber: #f59e0b;
  --rose: #ef4444;
  --violet: #8b5cf6;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(16, 26, 44, 0.07);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

.hidden {
  display: none !important;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: #cfd8e8;
  border-radius: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

.mono {
  font-family: var(--mono);
}

.dim {
  color: #93a1ba;
}

.strong {
  font-weight: 700;
  color: var(--ink);
}

.num {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--ink);
}

.nowrap {
  white-space: nowrap;
}

.wrap-cell {
  white-space: normal;
  min-width: 220px;
  word-break: break-all;
}

/* ------------------------------------------------------------ 登录 */

.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #08101f;
  overflow: hidden;
}

.login-screen::before,
.login-screen::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(10px);
  pointer-events: none;
}

.login-screen::before {
  width: 760px;
  height: 760px;
  left: -240px;
  top: -300px;
  background: radial-gradient(circle, rgba(59, 107, 246, 0.28), transparent 62%);
}

.login-screen::after {
  width: 640px;
  height: 640px;
  right: -220px;
  bottom: -280px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.24), transparent 64%);
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  padding: 36px 34px 26px;
  background: rgba(16, 27, 46, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(18px);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 28px;
}

.brand-logo {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: linear-gradient(135deg, #3b6bf6, #7d5cf7);
  color: #fff;
  box-shadow: 0 10px 24px rgba(72, 96, 255, 0.35);
}

.login-brand h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: #f2f6ff;
  letter-spacing: 0.01em;
}

.login-brand p {
  margin: 5px 0 0;
  font-size: 12px;
  color: #7c8db0;
}

.login-field {
  display: block;
  margin-bottom: 16px;
}

.login-field span {
  display: block;
  margin-bottom: 8px;
  font-size: 12.5px;
  color: #93a4c4;
}

.login-field input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: #eef3ff;
  font-size: 14px;
  outline: none;
  transition: 0.2s;
}

.login-field input:focus {
  border-color: #5b86ff;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(59, 107, 246, 0.22);
}

.login-error {
  min-height: 18px;
  margin-top: 10px;
  color: #ff9292;
  font-size: 12.5px;
  text-align: center;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 20px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
}

.auth-tab {
  flex: 1;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #8fa2c6;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.16s;
}

.auth-tab.active {
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
}

.login-foot {
  margin-top: 20px;
  color: #4c5d7d;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-align: center;
}

.login-links {
  margin-top: 16px;
  text-align: center;
  font-size: 12px;
}

.login-links a {
  color: #7f92b8;
  text-decoration: none;
  transition: color 0.16s;
}

.login-links a:hover {
  color: #cfe0ff;
}

.login-screen.admin-mode::before {
  background: radial-gradient(circle, rgba(139, 92, 246, 0.3), transparent 62%);
}

.login-screen.admin-mode::after {
  background: radial-gradient(circle, rgba(59, 107, 246, 0.22), transparent 64%);
}

.login-screen.admin-mode .brand-logo {
  background: linear-gradient(135deg, #8b5cf6, #4f46e5);
  box-shadow: 0 10px 24px rgba(124, 88, 247, 0.35);
}

.login-screen.admin-mode .btn-primary {
  background: linear-gradient(135deg, #7c5cff, #4f46e5);
  box-shadow: 0 8px 18px rgba(109, 78, 235, 0.3);
}

.login-screen.admin-mode .login-field input:focus {
  border-color: #8b76ff;
  box-shadow: 0 0 0 3px rgba(124, 92, 247, 0.22);
}

body.admin-page .nav-item.active {
  background: linear-gradient(90deg, rgba(124, 92, 255, 0.26), rgba(124, 92, 255, 0.05));
  box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.24);
}

body.admin-page .nav-item.active::before {
  background: linear-gradient(180deg, #9d7bff, #4f86ff);
}

a.icon-btn {
  text-decoration: none;
}


/* ------------------------------------------------------------ 布局 */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 238px;
  flex: 0 0 238px;
  height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  padding: 24px 16px 18px;
  background: linear-gradient(180deg, #0b1426 0%, #101d34 100%);
  color: #b9c6dd;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 6px 26px;
}

.brand-logo.sm {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 12px;
}

.brand-name {
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.brand-desc {
  margin-top: 3px;
  font-size: 10.5px;
  color: #5f7194;
  letter-spacing: 0.16em;
}

.nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #93a4c2;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
  transition: 0.16s;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  opacity: 0.9;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #dbe5f7;
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(59, 107, 246, 0.26), rgba(59, 107, 246, 0.05));
  color: #fff;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(94, 132, 255, 0.22);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, #4f86ff, #8261ff);
}

.sidebar-footer {
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px 12px;
}

.avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #22345a, #2f4b7a);
  color: #dfe9ff;
  font-size: 14px;
  font-weight: 700;
}

.sidebar-user .name {
  font-size: 13.5px;
  font-weight: 600;
  color: #e7eefc;
}

.sidebar-user .role {
  margin-top: 1px;
  font-size: 11px;
  color: #7185a6;
}

.logout-btn {
  width: 100%;
  height: 36px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #a9b8d1;
  font-size: 12.5px;
  cursor: pointer;
  transition: 0.16s;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.35);
  color: #ffb4b4;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 26px 30px 8px;
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.topbar p {
  margin: 6px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 3px;
}

.role-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: #eef2fe;
  color: #3f5fd0;
  font-size: 12px;
  font-weight: 600;
}

.role-chip::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3b6bf6;
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: #5a6a88;
  cursor: pointer;
  transition: 0.16s;
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

.icon-btn:hover {
  background: #f2f5fd;
  color: #2f4bd0;
}

.view {
  flex: 1;
  padding: 16px 30px 40px;
}

/* ------------------------------------------------------------ 通用组件 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: 0.18s;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  box-shadow: 0 8px 18px rgba(59, 107, 246, 0.28);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(59, 107, 246, 0.34);
}

.btn-ghost {
  background: #eff3fb;
  border-color: #e3e9f6;
  color: #3b4a66;
}

.btn-ghost:hover:not(:disabled) {
  background: #e6ecf9;
}

.btn-danger {
  background: linear-gradient(135deg, #f05353, #d92c2c);
  color: #fff;
  box-shadow: 0 8px 18px rgba(217, 44, 44, 0.24);
}

.btn-danger-ghost {
  background: #fdeeee;
  border-color: #f5d6d6;
  color: #d33c3c;
}

.btn-danger-ghost:hover:not(:disabled) {
  background: #fbe2e2;
}

.btn-sm {
  height: 30px;
  padding: 0 11px;
  border-radius: 8px;
  font-size: 12px;
  box-shadow: none;
}

.btn-block {
  width: 100%;
}

.input {
  height: 38px;
  min-width: 0;
  padding: 0 12px;
  border: 1px solid #e1e8f4;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  outline: none;
  transition: 0.16s;
}

.input:focus {
  border-color: #8fabff;
  box-shadow: 0 0 0 3px rgba(59, 107, 246, 0.12);
}

select.input {
  padding-right: 28px;
  cursor: pointer;
}

textarea.input {
  height: auto;
  padding: 10px 12px;
  line-height: 1.65;
  resize: vertical;
  font-family: var(--mono);
  font-size: 12.5px;
}

.search-input {
  width: 200px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.toolbar .spacer {
  flex: 1;
}

.toolbar-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-2);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-2);
}

.section-title::before {
  content: "";
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: linear-gradient(180deg, #3b6bf6, #8b5cf6);
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  background: #eef2fa;
  color: #5a6a88;
  font-size: 11.5px;
  font-weight: 600;
}

.badge-soft {
  background: #eef2fe;
  color: #3f5fd0;
}

.badge-success {
  background: #e7f8f0;
  color: #0e9f6e;
}

.badge-muted {
  background: #f1f3f8;
  color: #8593ab;
}

.badge-danger {
  background: #fdecec;
  color: #d33c3c;
}

.badge-violet {
  background: #f2edff;
  color: #7a4ff0;
}

.badge-amber {
  background: #fef3dd;
  color: #b47309;
}

.point-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 23px;
  padding: 0 8px;
  margin: 2px 4px 2px 0;
  border: 1px solid #e4ebfa;
  border-radius: 6px;
  background: #f4f7ff;
  color: #4d5f80;
  font-size: 11.5px;
}

.point-chip b {
  font-weight: 700;
  color: #2743a8;
}

.delta-plus {
  color: #0e9f6e;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.delta-minus {
  color: #d33c3c;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------ 统计卡片 */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
}

.stat-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stat-card::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -44px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--accent-soft, #eef2ff);
  opacity: 0.7;
}

.stat-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--accent-soft, #eef2ff);
  color: var(--accent, #3b6bf6);
}

.stat-icon svg {
  width: 20px;
  height: 20px;
}

.stat-info {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.stat-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.stat-value {
  display: block;
  margin-top: 4px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.stat-sub {
  display: block;
  margin-top: 3px;
  font-size: 11.5px;
  color: #8b99b4;
}

.accent-0 {
  --accent: #3b6bf6;
  --accent-soft: #eaf0ff;
}

.accent-1 {
  --accent: #0e9f6e;
  --accent-soft: #e6f7f0;
}

.accent-2 {
  --accent: #f59e0b;
  --accent-soft: #fef3dd;
}

.accent-3 {
  --accent: #8b5cf6;
  --accent-soft: #f1ecff;
}

/* ------------------------------------------------------------ 面板 */

.panel {
  min-width: 0;
  padding: 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-head h3 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.balance-list,
.stock-list {
  display: flex;
  flex-direction: column;
}

.balance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed #eef2f9;
  font-size: 13px;
}

.balance-row:last-child {
  border-bottom: 0;
}

.balance-row .name {
  font-weight: 600;
  color: var(--ink-2);
}

.balance-row .value {
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.stock-row {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 9px 0;
  border-bottom: 1px dashed #eef2f9;
}

.stock-row:last-child {
  border-bottom: 0;
}

.stock-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  color: var(--ink-2);
}

.stock-top strong {
  font-weight: 700;
}

.stock-top .dim {
  font-size: 11.5px;
}

.progress {
  height: 6px;
  overflow: hidden;
  border-radius: 4px;
  background: #eef2f9;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #3b6bf6, #6d5cf7);
}

.mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.mini-table th {
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  color: #8b99b4;
  font-size: 11px;
  font-weight: 600;
  text-align: left;
}

.mini-table td {
  padding: 9px 6px;
  border-bottom: 1px dashed #f0f3fa;
  color: #4a5b7a;
}

.mini-table tbody tr:last-child td {
  border-bottom: 0;
}

.log-list {
  display: flex;
  flex-direction: column;
}

.log-item {
  padding: 10px 0;
  border-bottom: 1px dashed #f0f3fa;
  font-size: 12.5px;
}

.log-item:last-child {
  border-bottom: 0;
}

.log-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #8493ad;
  font-size: 11.5px;
}

.log-detail {
  margin-top: 4px;
  color: #45566f;
  line-height: 1.55;
}

/* ------------------------------------------------------------ 表格 */

.table-card {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.table-scroll {
  overflow-x: auto;
}

.scroll-hint {
  display: none;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--ink-2);
  font-size: 13px;
  white-space: nowrap;
}

.data-table th {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #f8fafd;
  color: #7c8aa5;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f4fa;
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: #fafcff;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table .empty {
  padding: 34px 0;
  color: #93a1ba;
  font-size: 12.5px;
  text-align: center;
}

.row-actions {
  display: flex;
  gap: 6px;
}

.checkbox {
  width: 15px;
  height: 15px;
  accent-color: #3b6bf6;
  cursor: pointer;
}

/* ------------------------------------------------------------ 提取卡密 */

.redeem-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}

.redeem-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: 0.18s;
}

.redeem-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(16, 26, 44, 0.1);
}

.redeem-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.redeem-name {
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
}

.redeem-stats,
.result-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  background: #f8fafd;
}

.result-summary {
  grid-template-columns: repeat(4, 1fr);
}

.redeem-stats {
  grid-template-columns: repeat(2, 1fr);
}

.stock-ok.mini-value,
.mini-value.stock-ok {
  color: #0e9f6e;
}

.stock-low.mini-value,
.mini-value.stock-low {
  color: #b47309;
}

.stock-out.mini-value,
.mini-value.stock-out {
  color: #d33c3c;
}

.mini-label {
  display: block;
  font-size: 11px;
  color: #8b99b4;
}

.mini-value {
  display: block;
  margin-top: 3px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.redeem-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.redeem-actions .btn {
  flex: 1;
}

.stepper {
  display: flex;
  align-items: center;
  height: 38px;
  overflow: hidden;
  border: 1px solid #e1e8f4;
  border-radius: 10px;
  background: #fff;
}

.step-btn {
  width: 32px;
  height: 100%;
  border: 0;
  background: #f7f9fd;
  color: #5a6a88;
  font-size: 16px;
  cursor: pointer;
  transition: 0.15s;
}

.step-btn:hover:not(:disabled) {
  background: #e9effb;
  color: #2f4bd0;
}

.step-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.step-input {
  width: 46px;
  height: 100%;
  border: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  outline: none;
  appearance: textfield;
  -moz-appearance: textfield;
}

.step-input::-webkit-outer-spin-button,
.step-input::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.card-lines {
  margin-top: 14px;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.card-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid #f1f4fa;
  font-size: 13px;
}

.card-line:last-child {
  border-bottom: 0;
}

.card-line:nth-child(even) {
  background: #fbfcff;
}

.copy-btn {
  height: 26px;
  padding: 0 10px;
  border: 1px solid #e1e8f4;
  border-radius: 7px;
  background: #fff;
  color: #4a5b7a;
  font-size: 11.5px;
  cursor: pointer;
}

.copy-btn:hover {
  background: #eef3ff;
  border-color: #b9ccf8;
  color: #2f4bd0;
}

.card-chip {
  display: inline-flex;
  align-items: center;
  height: 24px;
  margin: 2px 4px 2px 0;
  padding: 0 8px;
  border: 1px solid #dde7fb;
  border-radius: 6px;
  background: #f2f6ff;
  color: #3c5aa8;
  font-size: 12px;
  cursor: pointer;
  transition: 0.15s;
}

.card-chip:hover {
  background: #e6efff;
}

.copyable {
  cursor: pointer;
}

.copyable:hover {
  color: #2f4bd0;
  text-decoration: underline;
}

/* ------------------------------------------------------------ 分页 / 空态 */

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 2px 0;
}

.pager-info {
  font-size: 12px;
  color: var(--muted);
}

.pager-btns {
  display: flex;
  gap: 8px;
}

.empty-state {
  padding: 52px 24px;
  border: 1px dashed #dbe4f3;
  border-radius: 16px;
  background: #fff;
  color: #8493ad;
  font-size: 13px;
  text-align: center;
}

.empty-state svg {
  display: block;
  width: 34px;
  height: 34px;
  margin: 0 auto 10px;
  opacity: 0.35;
}

.loading-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 70px 0;
  color: #8493ad;
  font-size: 13px;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #dbe4f3;
  border-top-color: #3b6bf6;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ------------------------------------------------------------ 弹窗 */

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 15, 28, 0.52);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.16s ease;
}

.modal-panel {
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 22px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(8, 15, 28, 0.28);
  animation: popIn 0.18s ease;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.modal-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}

.modal-sub {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.modal-close {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border: 0;
  border-radius: 8px;
  background: #f2f5fb;
  color: #7c8aa5;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  background: #e8edf7;
  color: #3c4b66;
}

.modal-body {
  margin-top: 18px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-grid .field-full {
  grid-column: 1 / -1;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.field-label {
  font-size: 12px;
  font-weight: 600;
  color: #6b7a96;
}

.field-label i {
  margin-left: 2px;
  color: #e04a4a;
  font-style: normal;
}

.field .input {
  width: 100%;
}

.field-hint {
  font-size: 11px;
  color: #8b99b4;
}

.radio-row {
  display: flex;
  gap: 8px;
}

.radio-pill {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  border: 1px solid #e1e8f4;
  border-radius: 10px;
  background: #fbfcff;
  color: #5a6a88;
  font-size: 13px;
  cursor: pointer;
  transition: 0.16s;
}

.radio-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.radio-pill:has(input:checked) {
  border-color: #7ba0ff;
  background: #eef3ff;
  color: #2f4bd0;
  font-weight: 600;
  box-shadow: 0 0 0 3px rgba(59, 107, 246, 0.1);
}

.confirm-text {
  margin: 0;
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.7;
}

.confirm-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: #fdecec;
  color: #d33c3c;
}

.confirm-icon svg {
  width: 22px;
  height: 22px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ------------------------------------------------------------ 提示 */

.toast-root {
  position: fixed;
  top: 20px;
  right: 24px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  min-width: 200px;
  max-width: 360px;
  padding: 12px 16px;
  border-left: 3px solid #4f86ff;
  border-radius: 12px;
  background: #101b30;
  box-shadow: 0 16px 36px rgba(8, 15, 28, 0.28);
  color: #e8effc;
  font-size: 13px;
  line-height: 1.5;
  opacity: 0;
  transform: translateX(16px);
  transition: 0.22s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: none;
}

.toast-success {
  border-left-color: #10b981;
}

.toast-error {
  border-left-color: #ef4444;
}

.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: #eef2f9;
}

.segmented button {
  height: 30px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #7686a3;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.segmented button.active {
  background: #fff;
  color: #2f4bd0;
  box-shadow: 0 2px 6px rgba(16, 26, 44, 0.08);
}

/* ------------------------------------------------------------ 设置开关 */

.settings-panel {
  max-width: 720px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 18px 0 6px;
}

.setting-copy {
  min-width: 0;
}

.setting-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.setting-desc {
  margin-top: 6px;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--muted);
}

.setting-status {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed #eef2f9;
  font-size: 12.5px;
  color: #5a6a88;
}

.switch {
  position: relative;
  width: 48px;
  height: 26px;
  flex: 0 0 48px;
  cursor: pointer;
}

.switch input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
}

.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #dce4f2;
  transition: 0.2s;
}

.switch-track::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(16, 26, 44, 0.2);
  transition: 0.2s;
}

.switch input:checked + .switch-track {
  background: linear-gradient(135deg, #3b6bf6, #6d5cf7);
}

.switch input:checked + .switch-track::before {
  transform: translateX(22px);
}

.switch input:focus-visible + .switch-track {
  box-shadow: 0 0 0 3px rgba(59, 107, 246, 0.18);
}

.switch input:disabled + .switch-track {
  opacity: 0.6;
  cursor: not-allowed;
}

.password-panel {
  max-width: 560px;
}

.password-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

.site-panel {
  max-width: 720px;
}

.site-icon-editor {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.site-icon-preview {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(135deg, #3b6bf6, #7d5cf7);
  box-shadow: 0 10px 24px rgba(72, 96, 255, 0.28);
}

.site-icon-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.site-icon-default {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.08em;
}

.site-icon-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.brand-logo.has-icon {
  background: transparent;
  box-shadow: none;
}

.brand-logo.has-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}

.form-error {
  min-height: 18px;
  margin-top: 10px;
  color: #d33c3c;
  font-size: 12.5px;
}

/* ------------------------------------------------------------ 响应式 */

@media (max-width: 960px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    flex: none;
    padding: calc(12px + env(safe-area-inset-top)) 14px 8px;
  }

  .brand {
    padding: 0 4px 12px;
  }

  .brand-logo.sm {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 10px;
  }

  .brand-name {
    font-size: 16px;
  }

  .nav {
    flex-direction: row;
    gap: 6px;
    padding-bottom: 2px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    flex: 0 0 auto;
    height: 38px;
    padding: 0 13px;
  }

  .sidebar-footer {
    display: none;
  }

  .topbar {
    padding: 18px 16px 2px;
    gap: 10px;
  }

  .topbar h1 {
    font-size: 21px;
  }

  .topbar-right {
    flex: 0 0 auto;
  }

  .view {
    padding: 12px 16px calc(32px + env(safe-area-inset-bottom));
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .result-summary {
    grid-template-columns: repeat(2, 1fr);
  }

  .role-chip {
    display: none;
  }

  .icon-btn {
    width: 38px;
    height: 38px;
  }

  .btn {
    height: 42px;
  }

  .btn-sm {
    height: 34px;
  }

  .input {
    height: 42px;
    font-size: 16px;
  }

  textarea.input {
    font-size: 16px;
    line-height: 1.5;
  }

  .login-field input {
    height: 46px;
    font-size: 16px;
  }

  .stepper {
    height: 42px;
  }

  .step-btn {
    width: 38px;
  }

  .step-input {
    width: 52px;
    font-size: 16px;
  }

  .data-table {
    font-size: 12.5px;
  }

  .data-table th,
  .data-table td {
    padding: 10px 12px;
  }

  .table-scroll {
    -webkit-overflow-scrolling: touch;
  }

  .scroll-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--line);
    background: #f8fafd;
    color: #8b99b4;
    font-size: 11.5px;
  }

  .scroll-hint::before {
    content: "↔";
    font-size: 13px;
    color: #5a6a88;
  }

  .modal-foot .btn {
    flex: 1;
  }

  .card-chip {
    height: auto;
    min-height: 24px;
    max-width: 100%;
    padding: 4px 8px;
    word-break: break-all;
  }
}

@media (max-width: 640px) {
  .modal-mask {
    align-items: flex-end;
    padding: 0;
  }

  .modal-panel {
    width: 100%;
    max-width: none !important;
    max-height: 92vh;
    padding: 20px 16px calc(18px + env(safe-area-inset-bottom));
    border-radius: 18px 18px 0 0;
  }

  .modal-head h3 {
    font-size: 16px;
  }

  .modal-body {
    margin-top: 14px;
  }

  .toast-root {
    left: 12px;
    right: 12px;
    top: calc(12px + env(safe-area-inset-top));
  }

  .toast {
    width: 100%;
    max-width: none;
  }

  .checkbox {
    width: 18px;
    height: 18px;
  }
}

@media (max-width: 560px) {
  .topbar {
    padding: 16px 16px 0;
  }

  .topbar h1 {
    font-size: 19px;
  }

  .topbar p {
    margin-top: 4px;
    font-size: 12px;
  }

  .topbar-right {
    gap: 8px;
    padding-top: 2px;
  }

  .login-screen {
    padding: 16px;
  }

  .login-card {
    padding: 28px 22px 24px;
    border-radius: 18px;
  }

  .login-brand {
    margin-bottom: 22px;
  }

  .login-card .btn-block {
    height: 46px;
    font-size: 15px;
  }

  .search-input {
    width: 100%;
  }

  .toolbar {
    gap: 8px;
    margin-bottom: 12px;
  }

  .toolbar .input {
    flex: 1 1 140px;
  }

  .redeem-grid {
    grid-template-columns: 1fr;
  }

  .redeem-card {
    padding: 16px;
  }

  .redeem-actions {
    flex-wrap: wrap;
  }

  .redeem-stats {
    padding: 10px;
  }

  .redeem-stats .mini-value {
    font-size: 13px;
  }

  .stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
  }

  .stat-card {
    padding: 14px;
    gap: 10px;
  }

  .stat-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 10px;
  }

  .stat-value {
    font-size: 20px;
  }

  .stat-sub {
    font-size: 11px;
  }

  .panel {
    padding: 16px;
  }

  .setting-row {
    align-items: flex-start;
    gap: 16px;
  }

  .password-actions .btn {
    width: 100%;
  }

  .segmented button {
    padding: 0 11px;
  }

  .pager-info {
    width: 100%;
  }

  .pager-btns {
    width: 100%;
  }

  .pager-btns .btn {
    flex: 1;
  }
}
