:root {
  --bg: #f3f5f9;
  --card: #ffffff;
  --sidebar: #0f172a;
  --sidebar-2: #1e293b;
  --primary: #2354e6;
  --primary-soft: #e8eefc;
  --accent: #d0f971;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --danger: #e11d48;
  --success: #16a34a;
  --warning: #d97706;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "PingFang SC", "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { opacity: 0.85; }

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

.sidebar {
  width: 248px;
  background: linear-gradient(180deg, var(--sidebar) 0%, #162033 100%);
  color: #e2e8f0;
  padding: 0 0 24px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.sidebar .brand {
  padding: 24px 22px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar .brand .logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #d0f971, #588bf8);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 12px;
}

.sidebar .brand h1 {
  margin: 0;
  font-size: 18px;
  color: #fff;
  font-weight: 700;
}

.sidebar .brand p {
  margin: 4px 0 0;
  font-size: 12px;
  color: #94a3b8;
}

.sidebar .nav-group {
  padding: 16px 14px 6px;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #64748b;
  text-transform: uppercase;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 10px;
  padding: 11px 14px;
  color: #cbd5e1;
  text-decoration: none;
  border-radius: 10px;
  font-weight: 500;
}

.sidebar nav a .ico {
  width: 18px;
  text-align: center;
  opacity: 0.8;
}

.sidebar nav a:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}

.sidebar nav a.active {
  background: linear-gradient(90deg, rgba(35,84,230,0.35), rgba(88,139,248,0.15));
  color: #fff;
  box-shadow: inset 3px 0 0 #588bf8;
}

.sidebar .logout-wrap {
  margin-top: auto;
  padding: 16px 14px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar .logout-wrap button,
.sidebar .logout-wrap .btn {
  width: 100%;
}

.sidebar .logout-wrap .account-meta {
  padding: 0 2px 4px;
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.5;
}

.sidebar .logout-wrap .btn.active-account {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

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

.topbar {
  height: 64px;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar .crumb { color: var(--muted); font-size: 13px; }
.topbar .crumb strong { color: var(--text); font-size: 16px; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-ext {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  transition: color .15s, border-color .15s, background .15s;
}

.topbar-ext:hover {
  color: var(--primary);
  border-color: #93c5fd;
  background: var(--primary-soft);
}

.login-foot {
  margin: 18px 0 0;
  text-align: center;
  font-size: 13px;
  color: #888;
  line-height: 1.6;
}

.login-foot a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.login-foot a:hover { text-decoration: underline; }

.topbar .admin-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13px;
}

.topbar .admin-chip .avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.main {
  flex: 1;
  padding: 24px 28px 32px;
  width: 100%;
  max-width: none;
  min-width: 0;
}

.page-title {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-sub {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 13px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 1100px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.card::after {
  content: "";
  position: absolute;
  right: -20px;
  top: -20px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: var(--primary-soft);
  opacity: 0.7;
}

.card .label { color: var(--muted); font-size: 13px; position: relative; z-index: 1; }
.card .value {
  font-size: 30px;
  font-weight: 800;
  color: var(--text);
  margin-top: 8px;
  position: relative;
  z-index: 1;
}
.card .hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  position: relative;
  z-index: 1;
}

.card.accent .value { color: var(--primary); }
.card.warn .value { color: var(--warning); }
.card.ok .value { color: var(--success); }

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.panel-hd {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-hd h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.panel-bd { padding: 0; }

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

@media (max-width: 980px) {
  .grid-2 { grid-template-columns: 1fr; }
  .sidebar { width: 210px; }
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 18px;
}

/* 列表页条件查询条 */
.filter-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 20px;
  flex-wrap: wrap;
  margin: 0 0 16px;
  padding: 16px 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.filter-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 14px;
  flex: 1 1 auto;
  min-width: 0;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 140px;
  flex: 0 1 auto;
}

.filter-field.grow {
  flex: 1 1 220px;
  min-width: 200px;
  max-width: 360px;
}

.filter-field.narrow {
  min-width: 96px;
  width: 110px;
  flex: 0 0 auto;
}

.filter-field label {
  display: block;
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.filter-field input,
.filter-field select {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  appearance: none;
  -webkit-appearance: none;
}

.filter-field select {
  padding-right: 34px;
  background-image:
    linear-gradient(45deg, transparent 50%, #64748b 50%),
    linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position:
    calc(100% - 16px) calc(50% - 2px),
    calc(100% - 11px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.filter-field input::placeholder {
  color: #94a3b8;
}

.filter-field input:hover,
.filter-field select:hover {
  border-color: #cbd5e1;
}

.filter-field input:focus,
.filter-field select:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(35, 84, 230, 0.12);
}

.filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding-bottom: 1px;
}

.filter-actions .btn {
  min-width: 76px;
  height: 38px;
  padding: 0 16px;
}

@media (max-width: 720px) {
  .filter-bar {
    padding: 14px;
  }
  .filter-field,
  .filter-field.grow,
  .filter-field.narrow {
    width: 100%;
    max-width: none;
    min-width: 0;
    flex: 1 1 100%;
  }
  .filter-actions {
    width: 100%;
  }
  .filter-actions .btn {
    flex: 1;
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  transition: 0.15s ease;
}

.btn:hover { filter: brightness(1.05); text-decoration: none; color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn-danger { background: var(--danger); }
.btn-outline {
  background: #fff;
  color: var(--primary);
  border: 1px solid #c7d2fe;
}
.btn-outline:hover { background: var(--primary-soft); color: var(--primary); }
.btn.is-disabled,
.btn.is-disabled:hover {
  opacity: 0.45;
  pointer-events: none;
  cursor: default;
  filter: none;
}
.btn-success { background: var(--success); }
.btn-ghost {
  background: transparent;
  color: #94a3b8;
  border: 1px solid rgba(255,255,255,0.12);
}
.btn-soft {
  background: #fff;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-soft:hover {
  background: #f1f5f9;
  color: var(--text);
  filter: none;
}
.btn-cta {
  background: linear-gradient(90deg, #d0f971, #e7fc7c);
  color: #0f172a;
}

.table-wrap {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th {
  background: #f8fafc;
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
}

tbody tr:hover { background: #f8fafc; }
tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge-on { background: #dcfce7; color: #166534; }
.badge-off { background: #fee2e2; color: #991b1b; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-active { background: #dbeafe; color: #1e40af; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-vip { background: #ede9fe; color: #5b21b6; }

.alert {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-weight: 500;
}

.alert-ok { background: #dcfce7; color: #166534; }
.alert-err { background: #fee2e2; color: #991b1b; }

/* 编辑表单：保持适中宽度，避免单字段拉得过宽 */
.form-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 880px;
  width: 100%;
  box-shadow: var(--shadow);
}

/* 列表 / 日志 / 多列表格：占满主内容区 */
.form-card.wide,
.content-panel {
  max-width: none;
  width: 100%;
}

.content-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.content-panel > h2 {
  font-size: 15px;
  margin: 0 0 12px;
}

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

.form-group { margin-bottom: 0; }
.form-group.full { grid-column: 1 / -1; }
.form-group .hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
  box-sizing: border-box;
}
.form-group input.datetime-local,
.form-group input[type="datetime-local"] {
  max-width: 360px;
  min-height: 42px;
  font-variant-numeric: tabular-nums;
  color-scheme: light;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(35,84,230,0.12);
}

.form-actions { margin-top: 22px; display: flex; gap: 10px; }

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 20% 20%, rgba(208,249,113,0.25), transparent 40%),
    radial-gradient(circle at 80% 10%, rgba(35,84,230,0.2), transparent 35%),
    linear-gradient(160deg, #0f172a 0%, #1e293b 45%, #0f172a 100%);
}

.login-box {
  background: rgba(255,255,255,0.97);
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 20px;
  padding: 36px 34px;
  width: 400px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.35);
}

.login-box .brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.login-box .brand-row .mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #d0f971, #588bf8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #0f172a;
}

.login-box h1 {
  margin: 0;
  font-size: 22px;
}

.login-box .sub {
  color: var(--muted);
  margin: 0 0 24px;
  font-size: 13px;
}

.login-box .form-group { margin-bottom: 14px; }

.actions-cell { display: flex; gap: 6px; align-items: center; }
.actions-cell form { display: inline; margin: 0; }
.actions-cell-wrap { flex-wrap: wrap; max-width: 320px; }

.admin-dialog {
  border: none;
  border-radius: 16px;
  padding: 0;
  width: min(420px, calc(100vw - 32px));
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
}
.admin-dialog::backdrop { background: rgba(15, 23, 42, 0.35); }
.admin-dialog-body { padding: 22px 22px 18px; }
.admin-dialog-body h3 { margin: 0 0 6px; font-size: 18px; }
.admin-dialog-body .form-group { margin: 14px 0 18px; }
.admin-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.empty {
  padding: 36px;
  text-align: center;
  color: var(--muted);
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 22px;
}

.quick-links a {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  box-shadow: var(--shadow);
}

.quick-links a:hover { border-color: #93c5fd; color: var(--primary); }

/* —— 拆分运营页辅助 —— */
.lang-block {
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  padding: 14px 16px;
  background: #fafafa;
}
.lang-block-title { font-weight: 600; margin-bottom: 10px; }
.lang-block-title span { color: #888; font-weight: 400; font-size: 12px; margin-left: 6px; }
.card-title { font-size: 16px; margin: 0 0 12px; }
.check-row { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; white-space: nowrap; }
.channel-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.channel-row .grow { flex: 1; min-width: 220px; }
.ellipsis { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb-sm { width: 72px; height: 40px; object-fit: cover; border-radius: 6px; background: #f3f4f6; }
.break-all { word-break: break-all; font-size: 12px; }

/* 充值通道总览 */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.hub-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 20px;
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.hub-card:hover { border-color: #93c5fd; transform: translateY(-2px); }
.hub-ico { font-size: 28px; margin-bottom: 10px; }
.hub-card h3 { margin: 0 0 8px; font-size: 17px; }
.hub-card p { margin: 0 0 14px; font-size: 13px; color: var(--muted); line-height: 1.5; }
.hub-link { font-size: 13px; font-weight: 700; color: var(--primary); }

/* 媒体上传分步 */
.media-form .form-card { max-width: 960px; margin-bottom: 16px; }
.media-step .step-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.step-num {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #7d76ef, #d63f8c);
  color: #fff; font-weight: 800; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.step-head h2 { margin: 0 0 4px; font-size: 16px; }
.step-head p { margin: 0; font-size: 13px; color: var(--muted); }
.file-pick-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px;
}
.file-label { cursor: pointer; user-select: none; }
/* 原生文件选择必须可见可点，禁止用 opacity/display:none 隐藏 */
.file-input-native,
.file-pick input[type=file],
.upload-panel input[type=file],
.media-form input[type=file] {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: static !important;
  width: 100%;
  max-width: 520px;
  height: auto !important;
  padding: 12px 14px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
  margin: 0 0 10px;
  pointer-events: auto !important;
}
.media-form input[type=file]:focus {
  outline: 2px solid rgba(125, 118, 239, 0.45);
  outline-offset: 1px;
}
.file-drop {
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: #fafafa;
  padding: 14px 16px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  transition: border-color .15s, background .15s;
}
.file-drop.is-dragover {
  border-color: #7d76ef;
  background: rgba(125, 118, 239, 0.08);
  color: var(--text);
}
.file-btn { cursor: pointer; display: inline-flex; align-items: center; }
.file-name { font-size: 13px; color: var(--muted); font-weight: 600; }
.upload-panel { margin-top: 4px; }
.upload-panel[data-kind="video"] .file-drop {
  border-style: solid;
  background: #f7f8fc;
}
.preview-box {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fafafa;
  min-height: 140px;
  display: flex; align-items: center; justify-content: center;
  padding: 12px;
}
.preview-box .hint { color: var(--muted); font-size: 13px; }
.preview-box img,
.preview-box video {
  max-width: 100%; max-height: 280px; border-radius: 10px; object-fit: contain;
}
.preview-box video { background: #111; }
.sticky-actions {
  position: sticky; bottom: 12px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  max-width: 960px;
  z-index: 20;
}
.upload-progress {
  flex-basis: 100%;
  width: 100%;
  margin-top: 10px;
}
.upload-progress-track {
  height: 10px;
  border-radius: 999px;
  background: #e8eaf2;
  overflow: hidden;
}
.upload-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #7d76ef, #d63f8c);
  transition: width .15s ease;
}
.upload-progress-text {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.upload-status {
  flex-basis: 100%;
  margin: 8px 0 0;
  font-size: 13px;
  font-weight: 600;
}
.upload-status.is-ok { color: #15803d; }
.upload-status.is-error { color: #b91c1c; }
.form-actions.sticky-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
