/*
 * Aurix Design System v3.1
 * 8px Grid · 4-tier depth · Centered nav · Inline SVG icons
 */

:root {
  /*
   * Aurix Design System v4 — "Borderless Elevation"
   * 无边框设计，纯靠亮度差区分层级（参考 Linear / Discord / Spotify）
   */
  --bg:           #101114;   /* 底色：有质感的深灰 */
  --nav:          #101114;   /* 导航栏与底色齐平，靠分割线区分 */
  --surface:      #1A1C22;   /* 卡片：明确浮起，亮度差 ~10 */
  --surface-2:    #23262E;   /* 输入框 / 交互态 */
  --surface-3:    #2D3039;   /* hover / 开关 */

  /* ── 功能色 ── */
  --accent:       #6C8EEF;   /* 偏冷紫蓝，高辨识度 */
  --accent-dim:   rgba(108, 142, 239, 0.12);

  --up:           #3DD68C;
  --up-dim:       rgba(61, 214, 140, 0.12);
  --down:         #F0625D;
  --down-dim:     rgba(240, 98, 93, 0.12);
  --warn:         #F5B731;
  --warn-dim:     rgba(245, 183, 49, 0.10);

  /* ── 文本 ── */
  --t1:           #EDEFF5;   /* 主文本 */
  --t2:           #858DA2;   /* 副文本 */
  --t3:           #505870;   /* 辅助文本 */

  /* ── 线条 ── */
  --divider:      rgba(255, 255, 255, 0.06);
  --divider-bold: rgba(255, 255, 255, 0.10);
  --card-border:  transparent; /* 无边框 —— 核心设计理念 */

  /* ── 圆角 ── */
  --r-card:  14px;
  --r-sm:    10px;
  --r-pill:  999px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
               "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--t1);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  line-height: 1.5;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; }
input { font-family: inherit; }

/* ── 数字字体 ── */
.mono {
  font-family: "SF Mono", "Menlo", "DIN Alternate", "Roboto Mono", monospace;
  font-variant-numeric: tabular-nums;
}

/* ── 文本层级 ── */
.t1 { color: var(--t1); }
.t2 { color: var(--t2); }
.t3 { color: var(--t3); }
.up { color: var(--up); }
.dn { color: var(--down); }

.f12 { font-size: 12px; }
.f13 { font-size: 13px; }
.f14 { font-size: 14px; }
.f15 { font-size: 15px; }
.f16 { font-size: 16px; }
.f18 { font-size: 18px; }
.f20 { font-size: 20px; }
.f24 { font-size: 24px; }
.f28 { font-size: 28px; }
.f32 { font-size: 32px; }

.w4 { font-weight: 400; }
.w5 { font-weight: 500; }
.w6 { font-weight: 600; }
.w7 { font-weight: 700; }

/* ── 导航栏 ── */
.navbar {
  position: sticky;
  top: 0; z-index: 100;
  display: flex;
  align-items: center;
  height: 56px;
  padding: 0 16px;
  background: var(--nav);
  border-bottom: 1px solid var(--divider);
}
.navbar .page-title {
  font-size: 17px;
  font-weight: 600;
  flex: 1;
  text-align: center;
}
.navbar .nav-left,
.navbar .nav-right {
  min-width: 48px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.navbar .nav-left { justify-content: flex-start; }
.navbar .nav-right { justify-content: flex-end; }
.navbar .nav-back {
  display: flex; align-items: center;
  color: var(--t2); font-size: 15px;
  width: 36px; height: 36px;
  justify-content: center;
  border-radius: var(--r-sm);
}
.navbar .nav-back:active { background: rgba(255,255,255,0.04); }
.navbar .nav-back svg { display: block; }

/* ── 页面容器 ── */
.page { padding-bottom: 96px; }
.page-gap { height: 16px; } /* navbar 和内容之间的标准间距 */
.px { padding-left: 20px; padding-right: 20px; }

/* ── 卡片 ── */
.card {
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: var(--r-card);
  margin: 0 16px 12px;
  padding: 16px;
}

/* ── 行布局 ── */
.hstack {
  display: flex;
  align-items: center;
}
.hstack.between { justify-content: space-between; }
.hstack.gap4  { gap: 4px; }
.hstack.gap6  { gap: 6px; }
.hstack.gap8  { gap: 8px; }
.hstack.gap10 { gap: 10px; }
.hstack.gap12 { gap: 12px; }
.hstack.gap16 { gap: 16px; }

.vstack {
  display: flex;
  flex-direction: column;
}
.vstack.gap4  { gap: 4px; }
.vstack.gap8  { gap: 8px; }
.vstack.gap12 { gap: 12px; }
.vstack.gap16 { gap: 16px; }

.flex-1 { flex: 1; }

/* ── 分割线 ── */
.divider {
  height: 1px;
  background: var(--divider);
}

/* ── 标签 Tag ── */
.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.tag.up   { background: var(--up-dim);   color: var(--up); }
.tag.down { background: var(--down-dim); color: var(--down); }
.tag.blue { background: var(--accent-dim); color: var(--accent); }
.tag.gray { background: rgba(255,255,255,0.06); color: var(--t2); }
.tag.warn { background: var(--warn-dim); color: var(--warn); }
.tag.solid { background: var(--t1); color: var(--bg); }

/* ── 按钮 ── */
.btn-primary {
  display: flex; align-items: center; justify-content: center;
  height: 48px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--r-sm);
  font-size: 15px;
  font-weight: 600;
  width: 100%;
  transition: opacity .15s;
}
.btn-primary:active { opacity: 0.85; }

.btn-secondary {
  display: flex; align-items: center; justify-content: center;
  height: 40px;
  background: var(--surface-2);
  color: var(--t1);
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 500;
  padding: 0 16px;
  transition: opacity .15s;
}
.btn-secondary:active { opacity: 0.85; }

.btn-outline {
  display: flex; align-items: center; justify-content: center;
  height: 40px;
  background: transparent;
  color: var(--t2);
  border: 1px solid var(--divider-bold);
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 500;
  padding: 0 16px;
  transition: opacity .15s;
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 6px;
}
.btn-icon {
  width: 40px; height: 40px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2);
  border-radius: var(--r-sm);
}

/* ── Section header ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 12px;
}
.section-header .label {
  font-size: 13px;
  font-weight: 500;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.section-header .action {
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
}

/* ── 列表项 ── */
.cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding: 14px 20px;
}
.cell + .cell {
  border-top: 1px solid var(--divider);
}
.cell:active { background: rgba(255,255,255,0.02); }

/* ── 网格 ── */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.grid-2 .metric {
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: var(--r-card);
  padding: 16px;
}

/* ── Tab Bar ── */
.tab-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 100;
  background: var(--nav);
  border-top: 1px solid var(--divider);
  display: flex;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
}
.tab-bar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 500;
  color: var(--t3);
  padding: 4px 0;
  transition: color .2s;
}
.tab-bar a.active { color: var(--t1); }
.tab-bar a svg { display: block; }

/* ── 表格 ── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th,
.data-table td {
  padding: 12px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--divider);
}
.data-table th {
  color: var(--t3);
  font-weight: 400;
  font-size: 13px;
  text-align: left;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table .text-right { text-align: right; }

/* ── 表单 ── */
.form-group { margin-bottom: 24px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--t3);
  margin-bottom: 8px;
}
.form-input {
  width: 100%;
  height: 48px;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  color: var(--t1);
  font-size: 15px;
  padding: 0 14px;
  outline: none;
  transition: border-color .2s;
}
.form-input:focus {
  border-color: var(--accent);
}

/* 开关 */
.toggle {
  position: relative;
  width: 48px; height: 28px;
  display: inline-block;
}
.toggle input {
  opacity: 0; width: 0; height: 0; position: absolute;
}
.toggle-track {
  position: absolute; inset: 0;
  background: var(--surface-3);
  border-radius: 14px;
  transition: background .2s;
  cursor: pointer;
}
.toggle-track::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 22px; height: 22px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.toggle input:checked + .toggle-track {
  background: var(--accent);
}
.toggle input:checked + .toggle-track::after {
  transform: translateX(20px);
}

/* ── 间距 ── */
.mt4  { margin-top: 4px; }
.mt8  { margin-top: 8px; }
.mt12 { margin-top: 12px; }
.mt16 { margin-top: 16px; }
.mt20 { margin-top: 20px; }
.mt24 { margin-top: 24px; }
.mt32 { margin-top: 32px; }
.mb4  { margin-bottom: 4px; }
.mb8  { margin-bottom: 8px; }
.mb12 { margin-bottom: 12px; }
.mb16 { margin-bottom: 16px; }
.mb24 { margin-bottom: 24px; }
.p16 { padding: 16px; }
.p20 { padding: 20px; }

/* ── 工具 ── */
.text-center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shrink-0 { flex-shrink: 0; }
