/* ═══════════════════════════════════════════════════════════
   base.css — reset、排版、顶栏导航 + 双栏工作台骨架
   ═══════════════════════════════════════════════════════════ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  color-scheme: light;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  background-color: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1,
h2,
h3,
h4 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

h1 {
  font-size: var(--text-xl);
}

h2 {
  font-size: var(--text-lg);
}

h3 {
  font-size: 1.05rem;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}

a:hover {
  color: var(--accent-hover);
}

code,
.mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

::selection {
  background: var(--accent-soft);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═══ 顶栏导航 ═══ */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: var(--space-5);
  padding: 0 var(--space-5);
  position: sticky;
  top: 0;
  z-index: var(--z-topbar);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.logo-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

.logo-heartbeat {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  animation: pulse-dot 2.4s var(--ease) infinite;
  margin-left: var(--space-1);
}

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

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.8rem;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}

.nav-tab:hover {
  color: var(--text-primary);
  background: var(--bg-inset);
}

.nav-tab.active {
  color: var(--accent);
  background: var(--accent-soft);
}

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

/* ═══ 普通页面内容区（配置页等） ═══ */
.main-content {
  flex: 1;
  padding: var(--space-5);
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

/* ═══ 双栏工作台骨架 ═══ */
.workbench {
  display: grid;
  grid-template-columns: var(--list-panel-width) 1fr;
  height: calc(100vh - var(--topbar-height));
  overflow: hidden;
}

.list-panel {
  background: var(--bg-raised);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.detail-panel {
  overflow-y: auto;
  min-width: 0;
  padding: var(--space-5);
}

/* ═══ 工具类 ═══ */
.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-2 {
  gap: var(--space-2);
}

.gap-3 {
  gap: var(--space-3);
}

.mt-3 {
  margin-top: var(--space-3);
}

.mt-4 {
  margin-top: var(--space-4);
}

.text-muted {
  color: var(--text-muted);
}

.text-secondary {
  color: var(--text-secondary);
}

.text-sm {
  font-size: var(--text-sm);
}

.text-xs {
  font-size: var(--text-xs);
}

.text-center {
  text-align: center;
}

/* ═══ 响应式：窄屏列表面板改抽屉 ═══ */
@media (max-width: 860px) {
  .workbench {
    grid-template-columns: 1fr;
  }

  .list-panel {
    position: fixed;
    top: var(--topbar-height);
    bottom: 0;
    left: 0;
    width: min(86vw, var(--list-panel-width));
    z-index: var(--z-drawer);
    transform: translateX(-100%);
    transition: transform var(--dur-normal) var(--ease);
    box-shadow: none;
  }

  .list-panel.open {
    transform: translateX(0);
    box-shadow: var(--shadow-overlay);
  }

  .detail-panel {
    padding: var(--space-4);
  }

  .main-content {
    padding: var(--space-4);
  }

  .logo-text {
    display: none;
  }

  /* 顶栏收窄：导航只留图标，用户菜单只留头像 */
  .topbar {
    gap: var(--space-2);
    padding: 0 var(--space-3);
  }

  .nav-tab {
    font-size: 0;
    gap: 0;
    padding: 0.45rem 0.55rem;
  }

  .nav-tab svg {
    width: 17px;
    height: 17px;
  }

  .user-name {
    display: none;
  }
}
