/* 产品壳层 — App Switcher · 顶栏 · 设置中心 · Command Center */

:root {
  --topbar-height: var(--header-height, 52px);
  --sidebar-width: 248px;
}

/* ========== 顶栏 ========== */
.app-shell {
  --bg-sidebar: #fafbfc;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--topbar-height);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

.app-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  height: 100%;
  padding: 0 var(--space-5);
  max-width: 100%;
}

.app-topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  flex: 1;
}

.app-topbar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
}

.app-topbar-logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary) 0%, #0f766e 100%);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.app-topbar-logo-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  line-height: 1.2;
}

.app-topbar-logo-title {
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.app-topbar-logo-sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-hint);
  white-space: nowrap;
}

.app-topbar-divider {
  width: 1px;
  height: 28px;
  background: var(--border-subtle);
  flex-shrink: 0;
}

.app-switcher {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: #f1f5f9;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  overflow-x: auto;
  max-width: 100%;
  scrollbar-width: none;
}

.app-switcher::-webkit-scrollbar { display: none; }

.app-switcher-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--duration-fast), color var(--duration-fast), box-shadow var(--duration-fast);
}

.app-switcher-label {
  line-height: 1;
}

.app-switcher-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.app-switcher-badge.is-warn {
  background: #fff7ed;
  color: #c2410c;
}

.app-switcher-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.7);
}

.app-switcher-item.is-active {
  background: var(--bg-card);
  color: var(--primary-hover);
  box-shadow: var(--shadow-xs);
}

.app-topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.app-status-strip {
  display: flex;
  align-items: center;
  gap: 6px;
}

.app-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-muted);
  transition: border-color var(--duration-fast);
}

.app-status-pill.is-ok {
  border-color: rgba(16, 185, 129, 0.25);
  color: #047857;
  background: #ecfdf5;
}

.app-status-pill.is-off {
  border-color: rgba(239, 68, 68, 0.2);
  color: #b91c1c;
  background: #fef2f2;
}

.app-status-pill.is-warn {
  border-color: rgba(245, 158, 11, 0.25);
  color: #b45309;
  background: #fffbeb;
}

.app-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.app-topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid transparent;
  transition: background var(--duration-fast), color var(--duration-fast), border-color var(--duration-fast);
}

.app-topbar-btn:hover,
.app-topbar-btn.is-active {
  background: var(--bg-sidebar-hover);
  color: var(--text);
  border-color: var(--border-subtle);
}

.app-topbar-btn-label {
  font-size: var(--text-xs);
  font-weight: 600;
}

/* ========== 布局（顶栏 + 侧栏） ========== */
.app-layout--shell {
  min-height: calc(100vh - var(--topbar-height));
}

.app-layout--shell .app-sidebar {
  top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
}

.brand-link-static {
  display: block;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.brand-subtitle {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-hint);
  font-weight: 500;
}

.sidebar-nav-divider--first {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

/* ========== 设置中心 ========== */
.settings-page .page-header {
  border-bottom: none;
  margin-bottom: var(--space-4);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-5);
}

.settings-card {
  margin-bottom: 0;
}

.settings-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.settings-card-desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin: 0 0 var(--space-4);
}

.settings-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.settings-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.settings-list-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.settings-list-item:first-child {
  padding-top: 0;
}

.settings-list-meta strong {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
}

.settings-list-meta span {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

.settings-list-note {
  font-size: 10px;
  color: var(--text-hint);
  margin-top: 2px;
}

.settings-kpi-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.settings-kpi {
  flex: 1 1 140px;
  padding: var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}

.settings-kpi-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: 4px;
}

.settings-kpi-value {
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.03em;
}

/* ========== Command Center（概览） ========== */
.command-center-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  padding: var(--space-5) var(--space-6);
  background: linear-gradient(135deg, #ffffff 0%, #f0fdfa 100%);
  border: 1px solid rgba(13, 148, 136, 0.12);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.command-center-hero h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin: 0 0 var(--space-2);
}

.command-center-hero .page-desc {
  margin: 0;
  max-width: none;
}

.command-center-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.command-journey {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.command-journey-step {
  padding: var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: transform var(--duration-normal), box-shadow var(--duration-normal), border-color var(--duration-normal);
}

.command-journey-step:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-ring);
}

.command-journey-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-bottom: var(--space-2);
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary-hover);
  font-size: 11px;
  font-weight: 700;
}

.command-journey-step strong {
  display: block;
  font-size: var(--text-sm);
  margin-bottom: 4px;
}

.command-journey-step span {
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.45;
}

/* ========== 响应式 ========== */
@media (max-width: 1280px) {
  .app-topbar-logo-sub {
    display: none;
  }
  .app-switcher-item {
    padding: 6px 10px;
  }
  .app-topbar-btn-label {
    display: none;
  }
}

@media (max-width: 1100px) {
  .command-journey {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .app-status-strip {
    display: none;
  }
}

@media (max-width: 900px) {
  .app-topbar-logo-sub,
  .app-topbar-btn-label {
    display: none;
  }
  .app-topbar-divider {
    display: none;
  }
  .app-topbar-inner {
    padding: 0 var(--space-3);
    gap: var(--space-2);
  }
  .app-topbar-left {
    gap: var(--space-2);
  }
  .app-switcher {
    flex: 1;
    min-width: 0;
    -webkit-overflow-scrolling: touch;
  }
  .app-switcher-item,
  .app-topbar-btn {
    min-height: 40px;
  }
  .app-layout--shell .app-sidebar {
    top: var(--topbar-height, 52px);
    height: calc(100vh - var(--topbar-height, 52px));
    height: calc(100dvh - var(--topbar-height, 52px));
    z-index: var(--z-drawer, 220);
  }
  .app-status-strip {
    display: none;
  }
  .app-body.sidebar-open .sidebar-toggle {
    background: var(--primary-light, #ccfbf1);
    border-color: var(--primary, #0d9488);
  }
}

@media (max-width: 640px) {
  .command-journey {
    grid-template-columns: 1fr;
  }
  .app-topbar-logo-text {
    display: none;
  }
  .app-switcher-item {
    padding: 8px 12px;
    font-size: 11px;
    min-height: 40px;
  }
}

/* PJAX：样式未就绪前隐藏主区，避免无样式内容闪一下 */
.app-main-inner.is-pjax-swapping {
  visibility: hidden;
}
