/* ===========================================================
   LIVE OS · 控制台设计系统
   深色为主，强调色 #4f7cff；所有尺寸用 8px 栅格
   =========================================================== */
:root {
  --bg: #0a0d14;
  --bg-soft: #0f131c;
  --panel: #141a25;
  --panel-2: #1a2230;
  --line: #222c3d;
  --line-soft: #1b2432;
  --text: #e8edf7;
  --text-2: #93a1b8;
  --text-3: #5f6d84;
  --brand: #4f7cff;
  --brand-soft: rgba(79, 124, 255, .14);
  --ok: #16c784;
  --ok-soft: rgba(22, 199, 132, .13);
  --warn: #f5a524;
  --warn-soft: rgba(245, 165, 36, .13);
  --danger: #f0554d;
  --danger-soft: rgba(240, 85, 77, .13);
  --radius: 10px;
  --shadow: 0 8px 28px rgba(0, 0, 0, .34);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(79, 124, 255, .35); }

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

/* ---------------- 登录 ---------------- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(79, 124, 255, .22), transparent 60%),
    radial-gradient(700px 400px at 90% 110%, rgba(22, 199, 132, .12), transparent 60%),
    var(--bg);
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 400px;
  background: linear-gradient(180deg, rgba(26, 34, 48, .92), rgba(16, 21, 30, .96));
  border: 1px solid var(--line);
  border-radius: 16px; padding: 32px 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
.brand-mark { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, #4f7cff, #7b5cff);
  display: grid; place-items: center; font-weight: 800; font-size: 15px;
  box-shadow: 0 6px 18px rgba(79, 124, 255, .38);
}
.brand-name { font-size: 17px; font-weight: 700; letter-spacing: .4px; }
.brand-sub { font-size: 11px; color: var(--text-3); letter-spacing: 1.4px; text-transform: uppercase; }

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.input, .select, .textarea {
  width: 100%; background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
.textarea { min-height: 84px; resize: vertical; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 16px) 17px, calc(100% - 11px) 17px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.hint { font-size: 11px; color: var(--text-3); margin-top: 5px; }

.btn {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  padding: 9px 16px; border-radius: 8px; cursor: pointer;
  transition: .15s; font-weight: 500; white-space: nowrap;
}
.btn:hover { border-color: #33415a; background: #202a3a; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: #6089ff; border-color: #6089ff; }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--danger); border-color: rgba(240, 85, 77, .35); background: var(--danger-soft); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-block { width: 100%; }

/* ---------------- 布局 ---------------- */
.app { display: grid; grid-template-columns: 216px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--bg-soft); border-right: 1px solid var(--line-soft);
  padding: 18px 12px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand-mark { padding: 0 8px 18px; margin-bottom: 6px; border-bottom: 1px solid var(--line-soft); }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px; color: var(--text-2);
  cursor: pointer; font-size: 13.5px; transition: .15s;
}
.nav-item:hover { background: rgba(255, 255, 255, .04); color: var(--text); }
.nav-item.active { background: var(--brand-soft); color: #b9caff; font-weight: 600; }
.nav-ico { width: 16px; text-align: center; opacity: .9; }
.nav-group { font-size: 11px; color: var(--text-3); padding: 14px 12px 6px; letter-spacing: .6px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 58px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; border-bottom: 1px solid var(--line-soft);
  background: rgba(10, 13, 20, .82); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 20;
}
.page-title { font-size: 15px; font-weight: 650; }
.page-sub { font-size: 12px; color: var(--text-3); margin-left: 10px; font-weight: 400; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, #4f7cff, #7b5cff);
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
.content { padding: 22px 24px 48px; flex: 1; }

/* ---------------- 卡片 / 栅格 ---------------- */
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

.card {
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 18px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-title { font-size: 13.5px; font-weight: 650; }
.card-desc { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.kpi-value { font-size: 27px; font-weight: 700; letter-spacing: -.5px; line-height: 1.2; }
.kpi-label { font-size: 12px; color: var(--text-3); margin-bottom: 8px; }
.kpi-foot { font-size: 11.5px; color: var(--text-3); margin-top: 8px; }

/* ---------------- 表格 ---------------- */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 11.5px; color: var(--text-3); font-weight: 600;
  padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
  letter-spacing: .3px;
}
.table td { padding: 12px; border-bottom: 1px solid var(--line-soft); font-size: 13px; vertical-align: middle; }
.table tbody tr:hover { background: rgba(255, 255, 255, .022); }
.table-wrap { overflow-x: auto; }

/* ---------------- 标签 ---------------- */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; padding: 2px 8px; border-radius: 20px; font-weight: 500;
}
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tag-danger { background: var(--danger-soft); color: var(--danger); }
.tag-info { background: var(--brand-soft); color: #8eadff; }
.tag-mute { background: rgba(255, 255, 255, .06); color: var(--text-2); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.live-dot { animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* ---------------- 空态 / 加载 ---------------- */
.empty { text-align: center; padding: 44px 20px; color: var(--text-3); font-size: 13px; }
.empty-ico { font-size: 28px; opacity: .45; margin-bottom: 8px; }
.spinner {
  width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, .18);
  border-top-color: var(--brand); border-radius: 50%;
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- 弹窗 ---------------- */
.mask {
  position: fixed; inset: 0; background: rgba(4, 6, 11, .72);
  backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 100; padding: 20px;
}
.modal {
  width: 100%; max-width: 560px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
  max-height: 86vh; display: flex; flex-direction: column;
}
.modal-lg { max-width: 760px; }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--line-soft); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 20px 22px; overflow: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line-soft); display: flex; justify-content: flex-end; gap: 10px; }
.x { cursor: pointer; color: var(--text-3); font-size: 18px; line-height: 1; }
.x:hover { color: var(--text); }

/* ---------------- Toast ---------------- */
.toasts { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--panel-2); border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  padding: 10px 16px; border-radius: 8px; font-size: 13px;
  box-shadow: var(--shadow); animation: slideIn .2s ease;
  max-width: 380px;
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--danger); }
@keyframes slideIn { from { transform: translateX(14px); opacity: 0; } }

/* ---------------- 代码 / 复制 ---------------- */
.code-box {
  background: #080b11; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; color: #9ec1ff; word-break: break-all; position: relative;
}
.copy {
  position: absolute; right: 8px; top: 8px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text-2);
  border-radius: 5px; font-size: 11px; padding: 2px 7px; cursor: pointer;
}
.copy:hover { color: var(--text); }

/* ---------------- Tabs ---------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-soft); margin-bottom: 18px; overflow-x: auto; }
.tab {
  padding: 8px 14px; font-size: 13px; color: var(--text-2); cursor: pointer;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: #b9caff; border-bottom-color: var(--brand); font-weight: 600; }

/* ---------------- 开关 ---------------- */
.switch { position: relative; display: inline-block; width: 38px; height: 21px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; background: #2a3547; border-radius: 20px;
  cursor: pointer; transition: .2s;
}
.slider:before {
  content: ""; position: absolute; height: 15px; width: 15px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .2s;
}
.switch input:checked + .slider { background: var(--brand); }
.switch input:checked + .slider:before { transform: translateX(17px); }

/* ---------------- 二维码 ---------------- */
.qr-img { width: 176px; height: 176px; background: #fff; border-radius: 10px; padding: 8px; display: block; }
.qr-panel { display: flex; gap: 18px; align-items: flex-start; }
@media (max-width: 520px) { .qr-panel { flex-direction: column; } }

/* ---------------- H5 观众端 ---------------- */
.h5-body { background: #000; }
.player-wrap { position: relative; width: 100%; background: #000; aspect-ratio: 9 / 16; max-height: 100vh; overflow: hidden; }
@media (min-width: 640px) { .player-wrap { aspect-ratio: 16 / 9; } }
.player-wrap video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.player-mask {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  background: linear-gradient(180deg, rgba(0, 0, 0, .1), rgba(0, 0, 0, .6)); padding: 24px;
}
.live-badge {
  position: absolute; left: 12px; top: 12px; z-index: 3;
  background: rgba(240, 85, 77, .92); color: #fff; font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: 20px; display: flex; align-items: center; gap: 5px;
}
.online-badge {
  position: absolute; right: 12px; top: 12px; z-index: 3;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 11px;
  padding: 3px 9px; border-radius: 20px; backdrop-filter: blur(6px);
}
.h5-goods {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 3;
  background: rgba(12, 15, 22, .82); border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 12px; padding: 10px 12px; backdrop-filter: blur(12px);
  display: flex; gap: 10px; align-items: center;
}
.h5-goods img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: #1a2230; }
.h5-goods .g-name { font-size: 13px; font-weight: 600; }
.h5-goods .g-price { font-size: 15px; color: #ff6b6b; font-weight: 700; }
.h5-goods .g-sub { font-size: 11px; color: rgba(255, 255, 255, .5); }
.buy-btn { background: linear-gradient(135deg, #ff5c5c, #ff2d55); border: 0; color: #fff; padding: 8px 16px; border-radius: 20px; font-size: 13px; font-weight: 600; cursor: pointer; }
