/* ─────────────────────────────────────────────────────────────────────────
 * TMS 物流小程序 — 共享设计令牌
 * 基于 Neutral Modern 设计系统
 * ─────────────────────────────────────────────────────────────────── */
:root {
  /* ─── Surface ──────────────────────────────────────────────────── */
  --bg: #f5f6f8;
  --surface: #ffffff;

  /* ─── Foreground ────────────────────────────────────────────────── */
  --fg: #111111;
  --muted: #8e8e93;
  --meta: #c7c7cc;

  /* ─── Border ────────────────────────────────────────────────────── */
  --border: #e5e5ea;
  --border-soft: #f2f2f7;

  /* ─── Accent ─────────────────────────────────────────────────────── */
  --accent: #2f6feb;
  --accent-on: #ffffff;
  --accent-hover: color-mix(in oklab, var(--accent), black 8%);
  --accent-active: color-mix(in oklab, var(--accent), black 14%);
  --accent-soft: color-mix(in oklab, var(--accent) 12%, transparent);

  /* ─── Semantic ──────────────────────────────────────────────────── */
  --success: #34c759;
  --success-soft: color-mix(in oklab, var(--success) 14%, transparent);
  --warn: #ff9500;
  --warn-soft: color-mix(in oklab, var(--warn) 14%, transparent);
  --danger: #ff3b30;
  --danger-soft: color-mix(in oklab, var(--danger) 14%, transparent);
  --info: #5ac8fa;

  /* ─── Typography ────────────────────────────────────────────────── */
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Helvetica Neue", sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
  --font-mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, monospace;

  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-lg: 17px;
  --text-xl: 20px;
  --text-2xl: 24px;

  --leading-body: 1.5;
  --leading-tight: 1.2;

  /* ─── Spacing ───────────────────────────────────────────────────── */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  /* ─── Radius ────────────────────────────────────────────────────── */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 9999px;

  /* ─── Nav bar dimensions ────────────────────────────────────────── */
  --nav-height: 44px;
  --tab-height: 40px;
  --status-bar: 54px; /* Dynamic Island area */
  --safe-bottom: 34px;

  /* ─── Motion ────────────────────────────────────────────────────── */
  --motion-fast: 150ms;
  --motion-base: 200ms;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
}

/* ─── Reset & base ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  font-size: var(--text-base);
}
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, h4 { margin: 0; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; padding: 0; }

/* ─── Status bar ──────────────────────────────────────────────────── */
.status-bar {
  height: var(--status-bar);
  background: var(--surface);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 var(--space-6) var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--fg);
}

/* ─── Nav bar ─────────────────────────────────────────────────────── */
.nav-bar {
  height: var(--nav-height);
  background: var(--surface);
  border-bottom: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-4);
  position: relative;
}
.nav-bar .nav-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--fg);
}
.nav-bar .nav-back {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  font-size: var(--text-lg);
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 2px;
}
.nav-bar .nav-action {
  position: absolute;
  right: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  font-size: var(--text-base);
  color: var(--accent);
  font-weight: 500;
}

/* ─── Tab bar ─────────────────────────────────────────────────────── */
.tab-bar {
  min-height: calc(var(--tab-height) + var(--safe-bottom));
  padding: 0 0 var(--safe-bottom) 0;
  background: var(--surface);
  border-top: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
}
.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--muted);
  font-size: 10px;
  transition: color var(--motion-fast) var(--ease-standard);
}
.tab-item.active { color: var(--accent); }
.tab-item .tab-icon { font-size: 22px; line-height: 1; }
.tab-item .tab-label { font-size: 10px; font-weight: 500; }

/* ─── Content area ────────────────────────────────────────────────── */
.content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--space-4);
}

/* ─── Search bar ──────────────────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--border-soft);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-4);
}
.search-bar .search-icon { color: var(--muted); font-size: 15px; }
.search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: var(--text-base);
  color: var(--fg);
  outline: none;
  font-family: var(--font-body);
}
.search-bar input::placeholder { color: var(--meta); }
.search-bar .search-action {
  color: var(--accent);
  font-size: var(--text-base);
  font-weight: 500;
  white-space: nowrap;
}

/* ─── Function card ───────────────────────────────────────────────── */
.func-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  cursor: pointer;
  transition: transform var(--motion-fast) var(--ease-standard);
  border: 0.5px solid var(--border);
}
.func-card:active { transform: scale(0.98); }
.func-card .func-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}
.func-card .func-icon.transport { background: var(--accent-soft); color: var(--accent); }
.func-card .func-icon.warehouse { background: var(--success-soft); color: var(--success); }
.func-card .func-info { flex: 1; min-width: 0; }
.func-card .func-title { font-size: var(--text-lg); font-weight: 600; color: var(--fg); }
.func-card .func-desc { font-size: var(--text-sm); color: var(--muted); margin-top: 2px; }
.func-card .func-arrow { color: var(--meta); font-size: 18px; }

/* ─── List item ───────────────────────────────────────────────────── */
.list-item {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border: 0.5px solid var(--border);
}
.list-item:active { background: var(--border-soft); }
.list-item .item-info { flex: 1; min-width: 0; }
.list-item .item-title {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-item .item-sub {
  font-size: var(--text-sm);
  color: var(--muted);
  margin-top: 2px;
}
.list-item .item-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}
.list-item .item-date { font-size: var(--text-xs); color: var(--meta); }
.list-item .item-arrow { color: var(--meta); font-size: 16px; }

/* ─── Status badge ────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1.6;
}
.badge-pending { background: var(--warn-soft); color: var(--warn); }
.badge-processing { background: var(--accent-soft); color: var(--accent); }
.badge-done { background: var(--success-soft); color: var(--success); }
.badge-cancel { background: var(--danger-soft); color: var(--danger); }

/* ─── Section header ──────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
  margin-top: var(--space-5);
}
.section-header:first-child { margin-top: 0; }
.section-header .section-title {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--fg);
}

/* ─── Empty state ─────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-4);
  color: var(--meta);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: var(--space-3); }
.empty-state .empty-text { font-size: var(--text-base); }

/* ─── Spacing utilities ───────────────────────────────────────────── */
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.gap-3 { display: flex; flex-direction: column; gap: var(--space-3); }
.gap-4 { display: flex; flex-direction: column; gap: var(--space-4); }

/* ─── Page wrapper (fills iPhone frame) ───────────────────────────── */
.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 390px;
  margin: 0 auto;
  background: var(--bg);
}
