/* ===== 布局 ===== */
.main-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
  padding-bottom: calc(12px + var(--tabbar-h) + var(--safe-bottom));
  position: relative;
  z-index: 1;
}

/* AI工作台页面专用布局 */
.main-content.chat-page-wrap {
  display: flex;
  flex-direction: column;
  padding: 12px;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom));
}

.main-content.chat-page-wrap .page {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.main-content.chat-page-wrap .chat-page {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

/* ===== 底部Tab栏 ===== */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: linear-gradient(180deg, rgb(19, 47, 76), rgb(10, 25, 41));
  border-top: 1px solid var(--border-soft);
  display: flex;
  z-index: 200;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-dim);
  position: relative;
}

.tab-item.active { color: var(--accent-blue); }

.tab-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 2px;
  background: var(--gradient-accent);
  border-radius: 0 0 2px 2px;
  box-shadow: 0 0 8px var(--accent-blue);
}

.tab-icon { font-size: 20px; line-height: 1; }
.tab-label { font-size: 10px; font-weight: 500; }

/* ===== 响应式断点（移动端优先） ===== */

/* 平板及更宽：body 居中限宽 500px */
@media (min-width: 640px) {
  html, body {
    max-width: 500px;
    margin: 0 auto;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.3);
    height: 100dvh;
  }
  .app-bar { max-width: 500px; left: 50%; transform: translateX(-50%); }
  .global-modal { max-width: 500px; left: 50%; transform: translateX(-50%); }
  .tab-bar { max-width: 500px; left: 50%; transform: translateX(-50%); }
}

/* 小屏手机 */
@media (max-width: 360px) {
  :root { --appbar-h: 50px; --tabbar-h: 50px; }
  .user-info { display: none; }
  .app-bar-title p { display: none; }
  .metric-value { font-size: 17px; }
  .card { padding: 12px; }
}
