:root {
  --brand: #7c1f1f;
  --brand-soft: #fdf3f0;
  --bg: #f5f2ec;
  --card: #ffffff;
  --text: #3b2f2f;
  --muted: #9a8a7a;
  --line: #e8ddd0;
}

* { box-sizing: border-box; }

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

.boot-loading { padding: 120px 0; text-align: center; color: var(--muted); }

/* ---------- 顶栏 ---------- */
.topbar {
  background: linear-gradient(135deg, #a8322a, #7c1f1f);
  color: #fff;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar .logo { font-size: 18px; font-weight: bold; letter-spacing: 4px; }
.topbar .who { font-size: 12px; opacity: 0.9; }
.topbar button {
  margin-left: 12px;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  border-radius: 999px;
  padding: 4px 14px;
  cursor: pointer;
}

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: calc(100vh - 54px); }
.sidebar {
  width: 180px;
  background: var(--card);
  border-right: 1px solid var(--line);
  padding: 18px 0;
}
.nav-item {
  padding: 12px 22px;
  cursor: pointer;
  color: #6a5a4a;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--brand-soft); }
.nav-item.active {
  border-left-color: var(--brand);
  color: var(--brand);
  font-weight: bold;
  background: var(--brand-soft);
}
.main { flex: 1; padding: 24px 32px; max-width: 1100px; }
.main .msg { margin: 0 0 12px; text-align: left; }
.main .msg.ok, .main .msg.err { border-radius: 8px; padding: 9px 14px; }
.main .msg.ok { background: #eafaf0; }
.main .msg.err { background: #fdeceb; }

/* ---------- 登录/门禁 ---------- */
.gate {
  max-width: 400px;
  margin: 80px auto;
  background: var(--card);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 8px 30px rgba(124,31,31,0.1);
}
.gate h2 { margin: 0 0 6px; color: var(--brand); text-align: center; }
.gate .sub { color: var(--muted); font-size: 12px; text-align: center; margin-bottom: 18px; }
.tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab {
  flex: 1; text-align: center; padding: 10px 0; cursor: pointer;
  color: var(--muted); border-bottom: 2px solid transparent;
}
.tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: bold; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 14px; font-family: inherit;
}
.field textarea { min-height: 72px; resize: vertical; }
.row2 { display: flex; gap: 8px; }
.row2 .field { flex: 1; }
.btn {
  width: 100%; padding: 11px 0; border: none; border-radius: 999px;
  background: linear-gradient(135deg, #a8322a, #7c1f1f);
  color: #fff; font-size: 15px; cursor: pointer; margin-top: 6px;
}
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.ghost { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.msg { margin-top: 12px; font-size: 13px; text-align: center; min-height: 18px; }
.msg.err { color: #c0392b; }
.msg.ok { color: #1e8449; }
.gate .hint { background: var(--brand-soft); border-radius: 8px; padding: 10px 14px; font-size: 12px; color: #8a6d3b; margin-top: 14px; line-height: 1.7; }

/* ---------- 列表 ---------- */
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-head h3 { margin: 0; color: var(--brand); }
.btn.small { width: auto; padding: 8px 20px; margin: 0; font-size: 13px; }
table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 12px; overflow: hidden; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
th { background: var(--brand-soft); color: var(--brand); font-weight: normal; }
tr:hover td { background: #fbf8f3; }
td .actions button {
  border: none; background: none; cursor: pointer; color: var(--brand);
  padding: 2px 6px; font-size: 13px;
}
td .actions button.danger { color: #c0392b; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; color: #fff; }
.stat-grid { display: flex; gap: 16px; flex-wrap: wrap; }
.stat-card {
  flex: 1; min-width: 160px; background: var(--card); border-radius: 12px;
  padding: 20px; text-align: center; border: 1px solid var(--line);
}
.stat-card .num { font-size: 30px; font-weight: bold; color: var(--brand); }
.stat-card .label { color: var(--muted); font-size: 12px; margin-top: 6px; }

/* ---------- 面板 / 提示条 / 广告缩略图 ---------- */
.panel {
  background: var(--card);
  border-radius: 12px;
  padding: 20px 24px;
  border: 1px solid var(--line);
}
.hint-bar {
  background: var(--brand-soft);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 12px;
  color: #8a6d3b;
  line-height: 1.8;
  margin-bottom: 14px;
}
.muted { color: var(--muted); font-size: 12px; }
.ad-thumb {
  display: block;
  max-width: 180px;
  max-height: 60px;
  border-radius: 6px;
  border: 1px solid var(--line);
  object-fit: cover;
}
.ad-preview {
  display: block;
  max-width: 100%;
  max-height: 140px;
  border-radius: 8px;
  border: 1px dashed var(--line);
  background: #fbf8f3;
}
.ad-preview[src=""] { display: none; }

/* ---------- 弹层 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(40,20,10,0.45);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal {
  background: #fff; border-radius: 14px; width: 560px; max-width: 92vw;
  max-height: 86vh; overflow: auto; padding: 24px 28px;
}
.modal h3 { margin: 0 0 16px; color: var(--brand); }
.modal .modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal .modal-actions .btn { flex: 1; margin-top: 0; }

/* ---------- 概览页 · 两端客户端入口 ---------- */
.client-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 4px;
  border-bottom: 1px dashed #e8ddd0;
}
.client-row:last-child { border-bottom: none; }
.client-name { font-size: 15px; font-weight: bold; color: #4a3226; }
.client-desc { font-size: 12px; color: #9a8a78; margin-top: 3px; }
.client-url { font-size: 13px; text-align: right; word-break: break-all; }

/* ---------- 登录页引导说明 ---------- */
.gate .gate-tip {
  margin-top: 16px;
  padding: 10px 14px;
  background: #fdf8f2;
  border: 1px dashed #e8ddd0;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.8;
  color: #9a8a78;
}
