/* 全局基础与布局样式 - 手机端优先设计 */
:root {
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;

  --success: #16a34a;
  --success-light: #f0fdf4;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --frozen-grey: #64748b;
  --frozen-bg: #f1f5f9;
  --frozen-border: #cbd5e1;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --nav-height: 60px;
  --header-height: 56px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 14px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 顶部操作与品牌栏 */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.header-brand svg {
  color: var(--primary);
  width: 22px;
  height: 22px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 主内容容器 */
.app-container {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 14px calc(var(--nav-height) + 24px) 14px;
}

/* 视图面板容器 */
.view-panel {
  display: none;
  animation: fadeIn 0.15s ease-in-out;
}

.view-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 底部移动端固定导航 */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: var(--nav-height);
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  transition: color 0.15s ease;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  margin-bottom: 2px;
  stroke-width: 2;
}

.nav-item.active {
  color: var(--primary);
}

.nav-item.active svg {
  stroke-width: 2.2;
}

/* 桌面端适配 (>= 768px) */
@media (min-width: 768px) {
  body {
    flex-direction: row;
  }

  .app-header {
    display: none;
  }

  .bottom-nav {
    position: sticky;
    top: 0;
    height: 100vh;
    width: 210px;
    flex-direction: column;
    justify-content: flex-start;
    padding: 24px 12px;
    gap: 8px;
    border-top: none;
    border-right: 1px solid var(--border-color);
  }

  .nav-brand-desktop {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
    padding: 0 12px 20px 12px;
    width: 100%;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 12px;
  }

  .nav-item {
    flex: initial;
    width: 100%;
    height: 44px;
    flex-direction: row;
    justify-content: flex-start;
    padding: 0 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    gap: 12px;
  }

  .nav-item svg {
    margin-bottom: 0;
  }

  .nav-item:hover {
    background-color: var(--bg-subtle);
    color: var(--text-main);
  }

  .nav-item.active {
    background-color: var(--primary-light);
    color: var(--primary);
  }

  .app-container {
    padding: 24px 32px;
    overflow-y: auto;
    height: 100vh;
  }
}

@media (max-width: 767px) {
  .nav-brand-desktop {
    display: none;
  }
}
