/* ============================================================
   汇媒宝复刻版 · 设计系统
   ============================================================ */
:root {
  --brand: #3b6ef5;
  --brand-dark: #2c56d4;
  --brand-light: #eaf0ff;
  --brand-grad: linear-gradient(135deg, #4b7bff 0%, #3b5ef5 100%);

  --text: #1d2129;
  --text-2: #4e5969;
  --text-3: #86909c;
  --text-4: #c9cdd4;

  --bg: #f5f7fb;
  --bg-card: #ffffff;
  --bg-hover: #f7f8fa;
  --border: #e5e8ef;
  --border-2: #eef1f6;

  --success: #00b42a;
  --warning: #ff7d00;
  --danger: #f53f3f;
  --purple: #7c5cf5;
  --pink: #f5508f;

  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(20, 40, 90, 0.06);
  --shadow: 0 4px 16px rgba(20, 40, 90, 0.08);
  --shadow-lg: 0 12px 40px rgba(20, 40, 90, 0.14);

  --header-h: 56px;
  --sidebar-w: 208px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; outline: none; }
ul, ol { list-style: none; }
img { display: block; max-width: 100%; }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d5dae3; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #b8bfcc; }

/* ============================================================
   顶栏
   ============================================================ */
.topbar {
  height: var(--header-h);
  background: linear-gradient(90deg, #3b52e0 0%, #4a6cf7 50%, #5b7cff 100%);
  display: flex;
  align-items: center;
  padding: 0 20px;
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  color: #fff;
  box-shadow: 0 2px 12px rgba(50, 80, 200, 0.25);
}

.topbar .logo {
  display: flex; align-items: center; gap: 8px;
  font-size: 19px; font-weight: 700; letter-spacing: 0.5px;
  margin-right: 32px; cursor: pointer; flex-shrink: 0;
}
.topbar .logo .mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: #fff; color: var(--brand);
  display: grid; place-items: center;
  font-size: 17px; font-weight: 800;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}

.topbar .main-nav { display: flex; align-items: center; gap: 2px; flex: 1; }
.topbar .nav-item {
  position: relative;
  padding: 8px 16px; border-radius: 6px;
  font-size: 14px; cursor: pointer;
  display: flex; align-items: center; gap: 5px;
  transition: background .18s;
  white-space: nowrap;
}
.topbar .nav-item:hover { background: rgba(255,255,255,.14); }
.topbar .nav-item.active { background: rgba(255,255,255,.22); font-weight: 600; }
.topbar .nav-item .badge-new {
  position: absolute; top: -2px; right: -2px;
  background: linear-gradient(135deg,#ff4d6a,#ff2d55);
  font-size: 9px; font-weight: 700; padding: 1px 4px;
  border-radius: 6px 6px 6px 0; line-height: 1.3;
  box-shadow: 0 1px 4px rgba(255,45,85,.5);
}

.topbar .right { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.topbar .icon-btn {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  position: relative; transition: background .18s;
}
.topbar .icon-btn:hover { background: rgba(255,255,255,.18); }
.topbar .icon-btn .dot {
  position: absolute; top: 5px; right: 6px;
  width: 6px; height: 6px; border-radius: 50%;
  background: #ff4d4f; border: 1.5px solid #4a6cf7;
}
.topbar .avatar-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px; border-radius: 20px; cursor: pointer;
  background: rgba(255,255,255,.14); transition: background .18s;
}
.topbar .avatar-btn:hover { background: rgba(255,255,255,.24); }
.topbar .avatar-btn img, .topbar .avatar-btn .ph {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg,#ffd66b,#ffb340);
  display: grid; place-items: center; font-size: 13px; font-weight: 700; color: #8a5a00;
}

/* 下拉 */
.dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: #fff; color: var(--text);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  min-width: 180px; padding: 6px; z-index: 200;
  display: none;
}
.dropdown.show { display: block; }
.dropdown .dd-item {
  padding: 9px 12px; border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; gap: 8px; font-size: 13px;
}
.dropdown .dd-item:hover { background: var(--bg-hover); }
.dropdown .dd-divider { height: 1px; background: var(--border-2); margin: 5px 0; }

/* ============================================================
   布局
   ============================================================ */
.layout { padding-top: var(--header-h); min-height: 100vh; }
.layout.with-sidebar { display: flex; }

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: #fff; border-right: 1px solid var(--border);
  min-height: calc(100vh - var(--header-h));
  padding: 12px 10px; position: sticky; top: var(--header-h);
  height: calc(100vh - var(--header-h)); overflow-y: auto;
}
.sidebar .sb-group { margin-bottom: 14px; }
.sidebar .sb-title {
  font-size: 12px; color: var(--text-3); padding: 8px 10px 4px;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; user-select: none;
}
.sidebar .sb-title .arrow { transition: transform .2s; font-size: 10px; }
.sidebar .sb-group.collapsed .arrow { transform: rotate(-90deg); }
.sidebar .sb-group.collapsed .sb-items { display: none; }
.sidebar .sb-item {
  padding: 9px 12px; border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; gap: 9px; font-size: 13.5px;
  color: var(--text-2); margin-bottom: 1px; transition: all .16s;
  position: relative;
}
.sidebar .sb-item:hover { background: var(--bg-hover); color: var(--text); }
.sidebar .sb-item.active { background: var(--brand-light); color: var(--brand); font-weight: 600; }
.sidebar .sb-item .ic { width: 16px; text-align: center; font-size: 14px; }
.sidebar .sb-item .tag-new {
  margin-left: auto; font-size: 9px; font-weight: 700;
  background: linear-gradient(135deg,#ff4d6a,#ff2d55); color: #fff;
  padding: 1px 4px; border-radius: 4px;
}

.main { flex: 1; padding: 20px 24px; min-width: 0; }

/* ============================================================
   通用组件
   ============================================================ */
.card {
  background: var(--bg-card); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); border: 1px solid var(--border-2);
}
.card-head {
  padding: 14px 18px; border-bottom: 1px solid var(--border-2);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-head h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 18px; }

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 16px; flex-wrap: wrap;
}
.page-head h2 { font-size: 19px; font-weight: 600; }
.page-head .sub { font-size: 13px; color: var(--text-3); margin-top: 2px; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 16px; border-radius: 6px; border: 1px solid var(--border);
  background: #fff; cursor: pointer; font-size: 13.5px;
  transition: all .16s; white-space: nowrap; user-select: none;
}
.btn:hover { border-color: #c8d0dd; background: #fafbfd; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary {
  background: var(--brand-grad); border-color: transparent; color: #fff;
  box-shadow: 0 2px 8px rgba(59,110,245,.28);
}
.btn-primary:hover { background: linear-gradient(135deg,#3f6ff0,#2f50e0); border-color: transparent; }
.btn-danger { color: var(--danger); border-color: #ffd5d5; }
.btn-danger:hover { background: #fff5f5; border-color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--bg-hover); border-color: transparent; }
.btn-sm { padding: 4px 11px; font-size: 12.5px; }
.btn-lg { padding: 11px 26px; font-size: 15px; border-radius: 8px; }
.btn-block { width: 100%; }

/* 表单 */
.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 13px; color: var(--text-2);
  margin-bottom: 6px; font-weight: 500;
}
.field label .req { color: var(--danger); margin-left: 2px; }
.field .hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }

.input, .textarea, .select {
  width: 100%; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 6px;
  background: #fff; transition: all .16s; font-size: 13.5px;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(59,110,245,.1);
}
.textarea { resize: vertical; min-height: 90px; line-height: 1.7; }
.select { cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2386909c' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px;
}
.counter { text-align: right; font-size: 12px; color: var(--text-3); margin-top: 3px; }

/* 标签 */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 4px; font-size: 12px;
  background: var(--bg-hover); color: var(--text-2);
}
.tag-blue { background: var(--brand-light); color: var(--brand); }
.tag-green { background: #e8fff0; color: #00933d; }
.tag-orange { background: #fff4e6; color: #e56a00; }
.tag-red { background: #fff0f0; color: #d92d2d; }
.tag-pink { background: #fff0f6; color: #d6336c; }
.tag-purple { background: #f3efff; color: var(--purple); }

/* 复选框 */
.cb {
  width: 16px; height: 16px; border: 1.5px solid var(--text-4);
  border-radius: 4px; cursor: pointer; display: inline-grid; place-items: center;
  transition: all .14s; flex-shrink: 0; background: #fff;
}
.cb.checked { background: var(--brand); border-color: var(--brand); }
.cb.checked::after {
  content: ''; width: 4px; height: 8px;
  border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px,-1px);
}

/* 表格 */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; padding: 11px 14px; font-weight: 600;
  color: var(--text-2); background: #fafbfd; font-size: 12.5px;
  border-bottom: 1px solid var(--border-2); white-space: nowrap;
}
.table td {
  padding: 12px 14px; border-bottom: 1px solid var(--border-2);
  color: var(--text); vertical-align: middle;
}
.table tbody tr:hover { background: #fafbfd; }
.table tbody tr:last-child td { border-bottom: none; }

/* 空状态 */
.empty {
  padding: 56px 20px; text-align: center; color: var(--text-3);
}
.empty .icon { font-size: 44px; opacity: .28; margin-bottom: 12px; }
.empty p { font-size: 13.5px; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,25,60,.45);
  backdrop-filter: blur(2px); z-index: 500;
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 560px;
  max-height: 90vh; display: flex; flex-direction: column;
  animation: modalIn .22s cubic-bezier(.2,.9,.3,1.1);
}
@keyframes modalIn { from { opacity:0; transform: translateY(14px) scale(.97); } }
.modal.wide { max-width: 940px; }
.modal-head {
  padding: 16px 20px; border-bottom: 1px solid var(--border-2);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-head h3 { font-size: 16px; font-weight: 600; }
.modal-head .close {
  width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center;
  cursor: pointer; color: var(--text-3); font-size: 18px; transition: all .16s;
}
.modal-head .close:hover { background: var(--bg-hover); color: var(--text); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-foot {
  padding: 14px 20px; border-top: 1px solid var(--border-2);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* Toast */
.toast-wrap {
  position: fixed; top: 72px; left: 50%; transform: translateX(-50%);
  z-index: 900; display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
  padding: 9px 18px; border-radius: 8px; background: #fff;
  box-shadow: var(--shadow-lg); font-size: 13.5px;
  display: flex; align-items: center; gap: 8px;
  animation: toastIn .24s cubic-bezier(.2,.9,.3,1.1);
  border: 1px solid var(--border-2); max-width: 480px;
}
@keyframes toastIn { from { opacity:0; transform: translateY(-12px); } }
.toast.success { border-color: #b7f0c4; background: #f2fff6; color: #00773a; }
.toast.error { border-color: #ffc9c9; background: #fff5f5; color: #c92424; }
.toast.info { border-color: #c9dcff; background: #f4f8ff; color: #2456b0; }

/* 加载 */
.spinner {
  width: 18px; height: 18px; border: 2px solid rgba(59,110,245,.2);
  border-top-color: var(--brand); border-radius: 50%;
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading {
  padding: 48px; text-align: center; color: var(--text-3); font-size: 13.5px;
}
.loading .spinner { margin-right: 8px; vertical-align: -3px; }

/* 开关 */
.switch {
  width: 38px; height: 21px; border-radius: 11px; background: #d5dae3;
  cursor: pointer; position: relative; transition: background .2s; flex-shrink: 0;
}
.switch::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 17px; height: 17px; border-radius: 50%; background: #fff;
  transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch.on { background: var(--brand); }
.switch.on::after { transform: translateX(17px); }

/* 单选 */
.radio {
  width: 16px; height: 16px; border: 1.5px solid var(--text-4);
  border-radius: 50%; cursor: pointer; display: inline-grid; place-items: center;
  transition: all .14s; flex-shrink: 0; background: #fff;
}
.radio.checked { border-color: var(--brand); border-width: 5px; }

/* 网格 */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* 工具类 */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { display: flex; flex-direction: column; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; }
.gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; }
.ml-auto { margin-left: auto; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; } .mb-20 { margin-bottom: 20px; }
.text-2 { color: var(--text-2); } .text-3 { color: var(--text-3); }
.text-sm { font-size: 12.5px; } .text-xs { font-size: 11.5px; }
.text-lg { font-size: 16px; }
.fw-6 { font-weight: 600; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hidden { display: none !important; }
.w-full { width: 100%; }
.cursor-pt { cursor: pointer; }

/* 平台图标 */
.pf-icon {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center; flex-shrink: 0;
  color: #fff; font-size: 13px; font-weight: 700;
  box-shadow: 0 2px 6px rgba(0,0,0,.1);
}
.pf-icon.sm { width: 22px; height: 22px; border-radius: 6px; font-size: 10px; }
.pf-icon.lg { width: 46px; height: 46px; border-radius: 12px; font-size: 17px; }

/* 响应式 */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .sidebar { display: none; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .topbar .nav-item span.lbl { display: none; }
}

/* ============ 一键扫码登录面板 ============ */
.scan-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #f7faff 0%, #f2f6ff 100%);
  padding: 16px 18px;
}
.scan-head { display: flex; gap: 12px; align-items: flex-start; }
.scan-ico {
  width: 42px; height: 42px; flex-shrink: 0;
  border-radius: 11px; display: grid; place-items: center;
  background: var(--brand-light); font-size: 20px;
}
.scan-status {
  margin-top: 12px; padding: 11px 14px;
  border-radius: var(--radius); font-size: 13px; line-height: 1.7;
  background: #fff; border: 1px solid var(--border);
  color: var(--text-2);
}
.scan-status.ok {
  background: #f0fbf2; border-color: #b7ebc3; color: #1a7f37;
}
.scan-status.err {
  background: #fff3f3; border-color: #ffd4d4; color: #c0392b;
}
.scan-status .spin {
  display: inline-block; width: 12px; height: 12px; vertical-align: -1px;
  border: 2px solid var(--brand); border-top-color: transparent;
  border-radius: 50%; animation: scan-spin .7s linear infinite;
}
@keyframes scan-spin { to { transform: rotate(360deg); } }


/* ---------------- 客户端下载区块（常驻） ---------------- */
.dl-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
  overflow: hidden;
}
.dl-head {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px;
}
.dl-ico {
  width: 44px; height: 44px; flex-shrink: 0;
  border-radius: 12px; display: grid; place-items: center;
  background: var(--brand-light); color: var(--brand);
  font-size: 20px;
}
.dl-txt { flex: 1; min-width: 0; }
.dl-btn { flex-shrink: 0; }
.dl-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 10px 18px;
  border-top: 1px solid var(--border-2);
  background: var(--bg-2);
}
.dl-foot code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px; padding: 1px 5px;
  border-radius: 4px; background: #fff; border: 1px solid var(--border);
}
@media (max-width: 720px) {
  .dl-head { flex-wrap: wrap; }
  .dl-btn { width: 100%; text-align: center; }
}
