:root {
  --primary: #3b6ef6;
  --primary-weak: #eaf0ff;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #e5484d;
  --text: #1a1d26;
  --text-2: #5a6274;
  --text-3: #9aa1b1;
  --line: #e9ecf2;
  --bg: #f5f6fa;
  --side: #1f2937;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  display: flex;
  min-height: 100vh;
}

/* ---------------- 侧栏 ---------------- */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--side);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b6ef6, #5b8cff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
}

.brand-name {
  font-size: 15px;
  font-weight: 600;
}

.brand-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 2px;
}

.nav {
  padding: 12px 10px;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  display: block;
  padding: 10px 14px;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 2px;
  cursor: pointer;
}

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

.nav-item.active {
  background: var(--primary);
  color: #fff;
  font-weight: 500;
}

.sidebar-foot {
  padding: 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
  line-height: 1.7;
}

.hint {
  color: rgba(255, 255, 255, 0.3);
}

/* ---------------- 主区 ---------------- */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 26px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

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

.badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 100px;
  background: #f1f2f5;
  color: var(--text-3);
}

.badge.on {
  background: #e8f7ee;
  color: var(--ok);
}

.btn-ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text-2);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}

.btn-ghost:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.content {
  padding: 22px 26px 40px;
}

.loading,
.empty {
  color: var(--text-3);
  padding: 40px 0;
  text-align: center;
}

/* ---------------- 登录门 ----------------
   服务端设了 ADMIN_TOKEN 才会显示。密码不对时后端返回 401。 */
.gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: linear-gradient(180deg, #eef3ff 0%, #f7f8fc 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gate[hidden] {
  display: none;
}

.gate-box {
  width: 320px;
  background: #fff;
  border-radius: 16px;
  padding: 32px 28px 24px;
  box-shadow: 0 18px 50px rgba(26, 29, 38, 0.12);
  text-align: center;
}

.gate-logo {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, #3b6ef6, #5b8cff);
  color: #fff;
  font-size: 24px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gate-title {
  font-size: 17px;
  font-weight: 600;
}

.gate-sub {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-3);
}

.gate-box input {
  width: 100%;
  margin-top: 18px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  outline: none;
}

.gate-box input:focus {
  border-color: var(--primary);
}

.gate-err {
  min-height: 18px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--danger);
}

.gate-btn {
  width: 100%;
  height: 42px;
  margin-top: 4px;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}

.gate-btn:hover {
  filter: brightness(0.96);
}

.gate-tip {
  margin-top: 16px;
  font-size: 11px;
  color: #b3b9c6;
  line-height: 1.6;
}

/* ---------------- 备案号 ---------------- */
.beian {
  margin-top: auto;
  padding: 16px 26px 22px;
  text-align: center;
  font-size: 12px;
}

.beian a {
  color: var(--text-3);
  text-decoration: none;
}

.beian a:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* ---------------- 卡片与网格 ---------------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 16px 18px;
  border: 1px solid var(--line);
}

.card-label {
  font-size: 12px;
  color: var(--text-3);
}

.card-value {
  font-size: 26px;
  font-weight: 700;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

.card-value small {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-3);
  margin-left: 4px;
}

.card-hint {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 6px;
}

/* ---------------- 表格 ---------------- */
.panel {
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--line);
  overflow: hidden;
  margin-bottom: 20px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-title {
  font-size: 14px;
  font-weight: 600;
}

.panel-note {
  font-size: 12px;
  color: var(--text-3);
}

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

th {
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  padding: 10px 18px;
  background: #fafbfd;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td {
  padding: 12px 18px;
  border-bottom: 1px solid #f4f6fa;
  font-size: 13px;
  color: var(--text);
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: #fafbff;
}

tr.clickable {
  cursor: pointer;
}

.mono {
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--text-3);
  font-size: 12px;
}

.right {
  text-align: right;
}

/* ---------------- 标签 ---------------- */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
}

.t-pending {
  background: #eef3ff;
  color: var(--primary);
}

.t-live {
  background: #fdf1de;
  color: var(--warn);
}

.t-done {
  background: #e8f7ee;
  color: var(--ok);
}

.t-off {
  background: #f1f2f5;
  color: #8a90a0;
}

/* ---------------- 详情抽屉 ---------------- */
.drawer-mask {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 35, 0.35);
  z-index: 50;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 520px;
  max-width: 92vw;
  background: #fff;
  z-index: 51;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 32px rgba(20, 24, 35, 0.12);
}

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

.drawer-title {
  font-size: 15px;
  font-weight: 600;
}

.drawer-body {
  padding: 18px 20px;
  overflow-y: auto;
  flex: 1;
}

.close {
  border: none;
  background: none;
  font-size: 20px;
  line-height: 1;
  color: var(--text-3);
  cursor: pointer;
  padding: 4px 8px;
}

.close:hover {
  color: var(--text);
}

.kv {
  display: flex;
  padding: 8px 0;
  border-bottom: 1px solid #f6f7fa;
  font-size: 13px;
}

.kv:last-child {
  border-bottom: none;
}

.kv-k {
  width: 110px;
  color: var(--text-3);
  flex-shrink: 0;
}

.kv-v {
  flex: 1;
}

/* ---------------- 其它 ---------------- */
.row-tools {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

select,
input[type='text'] {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  outline: none;
}

select:focus,
input[type='text']:focus {
  border-color: var(--primary);
}

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

.chip {
  padding: 6px 14px;
  border-radius: 100px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
}

.chip.on {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.tool-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #f4f6fa;
}

.tool-item:last-child {
  border-bottom: none;
}

.btn-primary {
  border: none;
  background: var(--primary);
  color: #fff;
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}

.btn-primary:hover {
  filter: brightness(0.95);
}
