/* ============================================================
   管理后台样式。浅色企业工具风格，与大厅保持一致。
   ============================================================ */

.admin-body {
  display: flex;
  min-height: 100vh;
  background: #f4f6fb;
}

/* ---------------- 侧边栏 ---------------- */

.side {
  position: fixed;
  inset: 0 auto 0 0;
  width: 224px;
  background: #12151f;
  color: #cfd4e4;
  display: flex;
  flex-direction: column;
  padding: 22px 14px 16px;
  z-index: 20;
}

.side .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 22px;
}

.side .logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3355ff, #6f8cff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: 15px;
  flex: none;
}

.side .brand b {
  color: #fff;
  font-size: 15px;
  letter-spacing: .3px;
  display: block;
  line-height: 1.3;
}

.side .brand small {
  color: #6b7391;
  font-size: 11px;
}

.side nav { display: flex; flex-direction: column; gap: 4px; }

.side nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  color: #a9b1c9;
  font-size: 14px;
  transition: background .15s, color .15s;
  text-align: left;
}

.side nav button:hover { background: rgba(255, 255, 255, .06); color: #e8ecf7; }

.side nav button.active {
  background: rgba(51, 85, 255, .18);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--brand);
}

.side nav button .ic {
  width: 18px;
  text-align: center;
  font-size: 15px;
  opacity: .9;
}

.side .side-foot {
  margin-top: auto;
  padding: 12px 10px 0;
  border-top: 1px solid rgba(255, 255, 255, .08);
  font-size: 12px;
  color: #626a85;
  line-height: 1.7;
}

/* ---------------- 主区域 ---------------- */

.main {
  flex: 1;
  min-width: 0;
  margin-left: 224px;
  padding: 0 26px 40px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 68px;
  margin: 0 -26px 22px;
  padding: 0 26px;
  background: rgba(244, 246, 251, .88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  font-size: 19px;
  margin: 0;
  font-weight: 650;
  letter-spacing: -.2px;
}

.topbar .spacer { flex: 1; }

.hint { font-size: 12px; color: var(--ink-3); }

.who {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-2);
}

.who .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(18, 160, 106, .14);
}

/* ---------------- 通用卡片 ---------------- */

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(18, 20, 26, .04);
  padding: 18px 20px;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.card-head h2 {
  font-size: 15px;
  margin: 0;
  font-weight: 650;
}

.card-head .spacer { flex: 1; }

.view[hidden] { display: none !important; }

/* ---------------- 指标卡 ---------------- */

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(172px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: 0 1px 2px rgba(18, 20, 26, .04);
}

.metric .label {
  font-size: 12.5px;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 6px;
}

.metric .value {
  font-size: 27px;
  font-weight: 680;
  letter-spacing: -.6px;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.metric .sub { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.metric.accent { background: linear-gradient(160deg, #eef1ff, #fff 70%); border-color: #dfe4ff; }
.metric.accent .value { color: var(--brand); }
.metric.live .value { color: var(--ok); }

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

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

/* ---------------- 表格 ---------------- */

.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  white-space: nowrap;
}

table.data th {
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: .3px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  background: #fafbfe;
}

table.data th:first-child { border-top-left-radius: 8px; }
table.data th:last-child { border-top-right-radius: 8px; }

table.data td {
  padding: 11px 12px;
  border-bottom: 1px solid #f1f3f8;
  color: var(--ink-2);
}

table.data tbody tr:hover td { background: #fafbff; }
table.data td.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
table.data td.name { color: var(--ink); font-weight: 550; }
table.data .muted { color: var(--ink-3); }

.empty {
  padding: 46px 20px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13.5px;
}

.empty .big { font-size: 30px; display: block; margin-bottom: 8px; opacity: .45; }

/* ---------------- 状态徽标 ---------------- */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 23px;
  padding: 0 9px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 550;
  background: #f0f2f7;
  color: var(--ink-2);
}

.tag::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: .75;
}

.tag.ok { background: #e7f7f0; color: #0c8a5b; }
.tag.live { background: #e7f7f0; color: #0c8a5b; }
.tag.warn { background: #fff4e6; color: #b56a00; }
.tag.bad { background: #fdecec; color: #c02a2f; }
.tag.info { background: #eef1ff; color: #2b46d4; }
.tag.gray { background: #f0f2f7; color: #6b7285; }

/* ---------------- 筛选条 ---------------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  padding-bottom: 16px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 11.5px; color: var(--ink-3); }

.field input,
.field select {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 13px;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.field input:focus,
.field select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(51, 85, 255, .12);
}

.field input[type="date"] { min-width: 148px; }
.field.grow { flex: 1; min-width: 190px; }
.field.grow input { width: 100%; }

.filters .actions { display: flex; gap: 8px; margin-left: auto; }

/* ---------------- 按钮 ---------------- */

.btn.sm { height: 34px; padding: 0 14px; font-size: 13px; border-radius: 9px; }
.btn.xs { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 7px; }

.btn.ghost {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink-2);
}

.btn.ghost:hover { border-color: #ced3e4; background: #fbfcff; }

.btn.danger-ghost {
  background: #fff;
  border: 1px solid #f4d3d4;
  color: var(--danger);
}

.btn.danger-ghost:hover { background: #fdf2f2; }

.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------------- 分页 ---------------- */

.pager {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 14px;
  font-size: 13px;
  color: var(--ink-3);
}

.pager .spacer { flex: 1; }

.pager button {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink-2);
  font-size: 13px;
}

.pager button:hover:not(:disabled) { border-color: #ced3e4; background: #fbfcff; }

/* ---------------- 房间监控列表 ---------------- */

.room-list { display: flex; flex-direction: column; gap: 10px; }

.room-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  transition: border-color .15s, background .15s;
}

.room-row:hover { border-color: #dbe0f2; background: #fcfdff; }

.room-row .rn {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: var(--ink);
  font-weight: 600;
  min-width: 86px;
}

.room-row .subject {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-row .meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.room-row .act { display: flex; gap: 6px; }

/* ---------------- 抽屉 ---------------- */

.drawer-mask {
  position: fixed;
  inset: 0;
  background: rgba(18, 20, 26, .38);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
  z-index: 40;
}

.drawer-mask.show { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 520px;
  max-width: 92vw;
  background: #fff;
  box-shadow: -20px 0 60px rgba(18, 20, 26, .16);
  transform: translateX(100%);
  transition: transform .24s cubic-bezier(.22, .8, .3, 1);
  z-index: 41;
  display: flex;
  flex-direction: column;
}

.drawer.show { transform: none; }

.drawer-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.drawer-head h3 { margin: 0; font-size: 15.5px; font-weight: 650; }
.drawer-head .spacer { flex: 1; }

.drawer-head .x {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--ink-3);
  font-size: 18px;
}

.drawer-head .x:hover { background: #f2f4f9; }

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

.kv {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 8px 12px;
  font-size: 13.5px;
  margin-bottom: 20px;
}

.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; color: var(--ink); }

.drawer-body h4 {
  font-size: 12.5px;
  color: var(--ink-3);
  font-weight: 600;
  letter-spacing: .3px;
  margin: 0 0 10px;
}

.member-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid #f3f5f9;
  font-size: 13px;
}

.member-item .av {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--brand-soft);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex: none;
}

.member-item .nm { flex: 1; min-width: 0; }
.member-item .nm b { font-weight: 600; color: var(--ink); }
.member-item .nm small { display: block; color: var(--ink-3); font-size: 11.5px; }

/* ---------------- 无权限 ---------------- */

.denied {
  max-width: 420px;
  margin: 14vh auto;
  text-align: center;
  color: var(--ink-2);
}

.denied .ic { font-size: 40px; margin-bottom: 12px; }
.denied h2 { font-size: 17px; margin: 0 0 8px; }
.denied p { color: var(--ink-3); font-size: 13.5px; line-height: 1.7; margin: 0 0 20px; }

/* ---------------- 骨架屏 ---------------- */

.sk {
  height: 13px;
  border-radius: 6px;
  background: linear-gradient(90deg, #f0f2f7 25%, #f7f8fc 37%, #f0f2f7 63%);
  background-size: 400% 100%;
  animation: sk 1.3s ease infinite;
}

@keyframes sk {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

@media (max-width: 860px) {
  .side { width: 64px; padding: 18px 7px; }
  .side .brand b, .side .brand small, .side nav button span:not(.ic), .side .side-foot { display: none; }
  .side nav button { justify-content: center; padding: 0; }
  .main { margin-left: 64px; padding: 0 16px 30px; }
  .topbar { margin: 0 -16px 18px; padding: 0 16px; }
  .room-row .meta { display: none; }
}

/* 后台登录视图：全屏覆盖，工号 + 密码 */
.admin-login {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: #f5f7fc;
}
.admin-login .brand-mark {
  width: 44px; height: 44px; border-radius: 12px; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
}
.admin-login .hint { margin-top: 18px; font-size: 12.5px; color: #9aa1b2; text-align: center; line-height: 1.8; }
.admin-login .hint a { color: #3355ff; }
