/* 全局重置与基础适配 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

html {
  font-size: 16px;
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background-color: #f5f5f7;
  color: #1d1d1f;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  min-height: 100%;
  padding-bottom: 50px; /* 适配底部固定导航 */
}

/* 手机端屏幕适配 */
@media screen and (max-width: 375px) {
  html { font-size: 14px; }
}
@media screen and (max-width: 320px) {
  html { font-size: 12px; }
}

/* 通用颜色定义（A股红涨绿跌规范） */
:root {
  --color-up: #e53935;
  --color-down: #00b140;
  --color-flat: #86868b;
  --color-primary: #0071e3;
  --color-bg: #f5f5f7;
  --color-card: #ffffff;
  --color-text-primary: #1d1d1f;
  --color-text-secondary: #86868b;
  --color-border: #e8e8ed;
  --color-disable: #c7c7cc;
}

/* 涨跌颜色工具类 */
.text-up { color: var(--color-up) !important; }
.text-down { color: var(--color-down) !important; }
.text-flat { color: var(--color-flat) !important; }
.text-primary { color: var(--color-primary) !important; }
.text-secondary { color: var(--color-text-secondary) !important; }

/* 通用布局类 */
.container {
  width: 100%;
  padding: 0 12px;
  max-width: 430px;
  margin: 0 auto;
}

.flex {
  display: flex;
}
.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.flex-center {
  display: flex;
  justify-content: center;
  align-items: center;
}
.flex-column {
  display: flex;
  flex-direction: column;
}
.flex-1 {
  flex: 1;
  min-width: 0;
}

/* 卡片组件 */
.card {
  background-color: var(--color-card);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* 按钮组件 */
.btn {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn:active {
  opacity: 0.7;
}
.btn-primary {
  background-color: var(--color-primary);
  color: #fff;
}
.btn-up {
  background-color: var(--color-up);
  color: #fff;
}
.btn-down {
  background-color: var(--color-down);
  color: #fff;
}
.btn-disable {
  background-color: var(--color-disable);
  color: #fff;
  pointer-events: none;
}

/* 表单组件 */
.form-item {
  margin-bottom: 20px;
}
.form-label {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
  display: block;
}
.form-input {
  width: 100%;
  height: 48px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 1rem;
  background-color: var(--color-card);
  outline: none;
}
.form-input:focus {
  border-color: var(--color-primary);
}

/* 底部导航栏（手机端专属） */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 50px;
  background-color: var(--color-card);
  border-top: 1px solid var(--color-border);
  display: flex;
  z-index: 999;
}
.tabbar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-decoration: none;
  color: var(--color-text-secondary);
}
.tabbar-item.active {
  color: var(--color-primary);
}
.tabbar-icon {
  font-size: 1.25rem;
  line-height: 1;
  margin-bottom: 2px;
}
.tabbar-text {
  font-size: 0.75rem;
  line-height: 1;
}

/* Toast轻提示 */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 12px 20px;
  background-color: rgba(0, 0, 0, 0.75);
  color: #fff;
  border-radius: 8px;
  font-size: 0.875rem;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  max-width: 80%;
  text-align: center;
}
.toast.show {
  opacity: 1;
}

/* 通用间距 */
.mt-10 { margin-top: 10px; }
.mt-16 { margin-top: 16px; }
.mb-10 { margin-bottom: 10px; }
.mb-16 { margin-bottom: 16px; }
.p-16 { padding: 16px; }

/* 文本溢出 */
.text-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.text-ellipsis-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 页面头部 */
.page-header {
  padding: 12px 0;
  position: sticky;
  top: 0;
  background-color: var(--color-bg);
  z-index: 100;
}
.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text-primary);
}