/* ═══════════════════════════════════════════════════════════
   骨架：侧栏 + 顶栏 + 内容区
   ═══════════════════════════════════════════════════════════ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: 100%;
}

/* ── 侧栏 ── */
.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-1);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--topbar-h);
  padding: 0 14px;
  border-bottom: 1px solid var(--line-soft);
  flex: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(145deg, #e5484d, #a12a2e);
  box-shadow: 0 2px 8px rgba(229, 72, 77, 0.35);
  flex: none;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text b { font-size: 13.5px; letter-spacing: 0.02em; }
.brand-text small { font-size: 10.5px; color: var(--fg-2); }

.nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 8px 16px;
}

.nav-group { margin-bottom: 4px; }

.nav-group-title {
  padding: 12px 8px 5px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--fg-3);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  margin-bottom: 1px;
  border-radius: var(--r-sm);
  color: var(--fg-1);
  cursor: pointer;
  user-select: none;
  transition: background 0.12s, color 0.12s;
  position: relative;
}

.nav-item:hover { background: var(--bg-hover); color: var(--fg-0); text-decoration: none; }

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

.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 15px;
  border-radius: 2px;
  background: var(--accent);
}

.nav-item svg { flex: none; opacity: 0.78; }
.nav-item.active svg { opacity: 1; color: var(--accent); }
.nav-item span { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-badge {
  flex: none;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 9px;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 17px;
  text-align: center;
  color: var(--fg-1);
  background: var(--bg-3);
}
.nav-item.active .nav-badge { background: var(--accent-dim); color: #fff; }
.nav-badge.live { background: var(--ok-soft); color: var(--ok); }

.sidebar-foot {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-top: 1px solid var(--line-soft);
  font-size: 11.5px;
  color: var(--fg-2);
}

.srv { display: flex; align-items: center; gap: 6px; flex: 1 1 auto; min-width: 0; }
.srv span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

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

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar-h);
  padding: 0 16px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--line);
  flex: none;
}

.crumb {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 550;
  overflow: hidden;
}
.crumb .sep { color: var(--fg-3); font-weight: 400; }
.crumb .tail { color: var(--fg-2); font-weight: 400; }

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

.refresh-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  color: var(--fg-2);
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
}

.spin {
  width: 10px;
  height: 10px;
  border: 1.5px solid var(--fg-3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  opacity: 0;
  transition: opacity 0.2s;
}
.spin.on { opacity: 1; }

@keyframes spin { to { transform: rotate(360deg); } }

.who {
  display: flex;
  align-items: center;
  gap: 7px;
  padding-left: 9px;
  border-left: 1px solid var(--line);
  font-size: 12px;
  color: var(--fg-1);
}

.avatar {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 10.5px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(145deg, var(--accent), var(--accent-dim));
  flex: none;
}

.view {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
}

/* ── 移动端 ── */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 40;
}

.only-mobile { display: none !important; }

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

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .sidebar.open { transform: none; }

  .only-mobile { display: inline-grid !important; }

  .view { padding: 12px; }
  .crumb { font-size: 13px; }
}

/* ── 页头（每个视图顶部） ── */
.page-head {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.page-head h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 620;
  letter-spacing: -0.01em;
}

.page-head p {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--fg-2);
}

.page-head .spacer { flex: 1 1 auto; }

/* ── 栅格 ── */
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 1180px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
}
