/* ===== 全局变量 ===== */
:root {
  --bg-deep: #060d1c;
  --bg-base: #0a1628;
  --bg-card: rgba(20, 40, 73, 0.6);
  --bg-card-solid: #14294a;
  --bg-input: rgba(10, 25, 50, 0.8);
  --border: rgba(80, 160, 255, 0.18);
  --border-strong: rgba(80, 160, 255, 0.45);
  --primary: #2e9bff;
  --primary-bright: #5fb8ff;
  --primary-glow: rgba(46, 155, 255, 0.5);
  --accent: #00e5ff;
  --accent-glow: rgba(0, 229, 255, 0.4);
  --text-main: #e8f2ff;
  --text-sub: #8aa5c8;
  --text-dim: #5a7393;
  --success: #2bd576;
  --warning: #ffb020;
  --danger: #ff5577;
  --shadow-card: 0 8px 32px rgba(0, 30, 70, 0.4);
  --shadow-glow: 0 0 20px rgba(46, 155, 255, 0.3);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 60px;
}

/* ===== Reset ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg-deep);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  position: fixed;
  left: 0; top: 0; right: 0; bottom: 0;
  overscroll-behavior: none;
}
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: 14px; outline: none; }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }

/* 滚动条隐藏 */
::-webkit-scrollbar { width: 0; height: 0; }

/* ===== 启动闪屏 ===== */
.splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 40%, #0d2447 0%, var(--bg-deep) 70%);
  transition: opacity 0.5s, visibility 0.5s;
}
.splash.fade-out {
  opacity: 0;
  visibility: hidden;
}
.splash-inner {
  text-align: center;
  animation: splashIn 0.8s ease;
}
@keyframes splashIn {
  from { opacity: 0; transform: translateY(20px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.splash-logo {
  width: 88px; height: 88px;
  border-radius: 22px;
  box-shadow: 0 0 40px var(--primary-glow);
  margin: 0 auto 16px;
}
.splash-name {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 4px;
  background: linear-gradient(90deg, var(--primary-bright), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.splash-tip {
  font-size: 13px;
  color: var(--text-sub);
  margin-top: 6px;
  letter-spacing: 2px;
}

/* ===== 状态栏安全区 ===== */
.statusbar-safe {
  height: var(--safe-top);
  background: var(--bg-deep);
}

/* ===== App 容器 ===== */
.app {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 20% 0%, rgba(46, 155, 255, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 80% 100%, rgba(0, 229, 255, 0.06) 0%, transparent 40%),
    var(--bg-deep);
}

/* ===== 页面容器 ===== */
.page-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px);
  position: relative;
}
.page {
  min-height: 100%;
  animation: pageIn 0.3s ease;
}
@keyframes pageIn {
  from { opacity: 0; transform: translateX(8px); }
  to { opacity: 1; transform: translateX(0); }
}

/* 页面头部 */
.page-header {
  padding: 12px 16px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.page-title {
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(90deg, #fff, var(--primary-bright));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.page-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}
.header-action {
  width: 36px; height: 36px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--primary-bright);
}

/* ===== 卡片 ===== */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow-card);
  margin: 0 16px 12px;
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.card-title::before {
  content: '';
  width: 3px; height: 12px;
  background: linear-gradient(180deg, var(--primary), var(--accent));
  border-radius: 2px;
}

/* ===== 仪表盘数据卡片 ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 0 16px 12px;
}
.stat-card {
  position: relative;
  background: linear-gradient(135deg, rgba(46, 155, 255, 0.12), rgba(20, 40, 73, 0.6));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: -20px; right: -20px;
  width: 60px; height: 60px;
  background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
  opacity: 0.6;
}
.stat-icon {
  font-size: 20px;
  margin-bottom: 6px;
}
.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  font-feature-settings: "tnum";
}
.stat-label {
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 2px;
}
.stat-card.danger { background: linear-gradient(135deg, rgba(255, 85, 119, 0.15), rgba(20, 40, 73, 0.6)); }
.stat-card.danger .stat-value { color: var(--danger); }
.stat-card.warning { background: linear-gradient(135deg, rgba(255, 176, 32, 0.12), rgba(20, 40, 73, 0.6)); }
.stat-card.warning .stat-value { color: var(--warning); }
.stat-card.success { background: linear-gradient(135deg, rgba(43, 213, 118, 0.12), rgba(20, 40, 73, 0.6)); }
.stat-card.success .stat-value { color: var(--success); }

/* ===== 仓库横幅 ===== */
.banner {
  margin: 8px 16px 12px;
  border-radius: 18px;
  overflow: hidden;
  position: relative;
  height: 120px;
  background: linear-gradient(135deg, #0d2a52, #06182f);
  border: 1px solid var(--border-strong);
}
.banner-bg {
  position: absolute;
  inset: 0;
  background: url('../assets/bg.jpg') center/cover;
  opacity: 0.35;
}
.banner-content {
  position: relative;
  padding: 18px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.banner-store {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}
.banner-desc {
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 4px;
}
.banner-value {
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(90deg, var(--accent), var(--primary-bright));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-top: 6px;
  font-feature-settings: "tnum";
}

/* ===== 快捷入口 ===== */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 0 16px 12px;
}
.quick-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 4px;
  text-align: center;
  transition: transform 0.15s;
}
.quick-item:active { transform: scale(0.94); }
.quick-icon {
  width: 40px; height: 40px;
  margin: 0 auto 6px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: linear-gradient(135deg, rgba(46, 155, 255, 0.2), rgba(0, 229, 255, 0.1));
  border: 1px solid var(--border);
}
.quick-label {
  font-size: 11px;
  color: var(--text-sub);
}

/* ===== 位置查询 ===== */
.loc-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 16px 12px;
}
.loc-mode-tab {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 6px;
  text-align: center;
  transition: all 0.15s;
}
.loc-mode-tab.active {
  background: linear-gradient(135deg, rgba(46, 155, 255, 0.22), rgba(0, 229, 255, 0.12));
  border-color: var(--primary);
  box-shadow: 0 0 12px rgba(46, 155, 255, 0.25);
}
.loc-mode-tab:active { transform: scale(0.96); }
.loc-mode-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
}
.loc-mode-tab.active .loc-mode-title { color: var(--primary-bright); }
.loc-mode-desc {
  font-size: 10px;
  color: var(--text-dim);
}
.loc-search-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.loc-search-input {
  flex: 1;
}
.loc-search-btn {
  flex-shrink: 0;
  min-width: 72px;
}
.loc-sku-hint {
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 10px;
}
.link-btn {
  display: inline-block;
  background: none;
  border: none;
  color: var(--primary-bright);
  font-size: 12px;
  padding: 0 4px;
  cursor: pointer;
}
.loc-tip {
  margin: 8px 16px 0;
  padding: 10px 12px;
  background: rgba(255, 176, 32, 0.08);
  border: 1px solid rgba(255, 176, 32, 0.25);
  border-radius: 10px;
  font-size: 12px;
  color: var(--warning);
}
.loc-result-card {
  margin: 12px 16px 0;
  padding: 14px;
}
.loc-result-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border);
  margin-bottom: 12px;
}
.loc-result-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(46, 155, 255, 0.2), rgba(0, 229, 255, 0.1));
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.loc-result-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}
.loc-result-sub {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-sub);
}
.stock-chip {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.stock-chip.success { background: rgba(43, 213, 118, 0.12); color: var(--success); }
.stock-chip.warning { background: rgba(255, 176, 32, 0.12); color: var(--warning); }
.stock-chip.danger  { background: rgba(255, 85, 119, 0.12); color: var(--danger); }
.loc-path-block {
  background: rgba(46, 155, 255, 0.06);
  border: 1px solid rgba(46, 155, 255, 0.15);
  border-radius: 12px;
  padding: 12px;
}
.loc-path-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}
.loc-path-main {
  font-size: 16px;
  font-weight: 600;
  color: var(--primary-bright);
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px dashed rgba(46, 155, 255, 0.2);
}
.loc-path-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 13px;
}
.loc-path-icon { width: 18px; font-size: 14px; }
.loc-path-label {
  width: 72px;
  color: var(--text-sub);
}
.loc-path-value {
  flex: 1;
  font-weight: 500;
}
.loc-remark {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  color: var(--text-sub);
}
.loc-candidate { margin: 0 4px 6px !important; }

/* ===== 趋势图 ===== */
.chart-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 100px;
  gap: 6px;
  padding-top: 8px;
}
.chart-bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}
.chart-bar-pair {
  display: flex;
  gap: 2px;
  align-items: flex-end;
  height: 70px;
  width: 100%;
  justify-content: center;
}
.chart-bar {
  width: 6px;
  min-height: 2px;
  border-radius: 3px 3px 0 0;
  transition: height 0.6s ease;
}
.chart-bar.in { background: linear-gradient(180deg, var(--success), rgba(43, 213, 118, 0.3)); }
.chart-bar.out { background: linear-gradient(180deg, var(--primary), rgba(46, 155, 255, 0.3)); }
.chart-bar-label {
  font-size: 10px;
  color: var(--text-dim);
}
.chart-legend {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-top: 8px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-sub);
}
.legend-dot {
  width: 8px; height: 8px;
  border-radius: 2px;
}

/* ===== 列表项 ===== */
.list-item {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin: 0 16px 8px;
  gap: 12px;
  transition: transform 0.15s, background 0.15s;
}
.list-item:active {
  transform: scale(0.98);
  background: rgba(46, 155, 255, 0.08);
}
.list-thumb {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(46, 155, 255, 0.25), rgba(0, 229, 255, 0.15));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.list-body {
  flex: 1;
  min-width: 0;
}
.list-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-sub {
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 2px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.list-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  background: rgba(46, 155, 255, 0.15);
  color: var(--primary-bright);
}
.list-meta {
  text-align: right;
  flex-shrink: 0;
}
.list-num {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  font-feature-settings: "tnum";
}
.list-num.danger { color: var(--danger); }
.list-num.warning { color: var(--warning); }
.list-unit {
  font-size: 11px;
  color: var(--text-dim);
}

/* ===== 搜索栏 ===== */
.searchbar {
  margin: 8px 16px 12px;
  display: flex;
  gap: 8px;
}
.search-input-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}
.search-input-wrap::before {
  content: '🔍';
  position: absolute;
  left: 12px;
  font-size: 14px;
  opacity: 0.7;
}
.search-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px 10px 36px;
  color: var(--text-main);
}
.search-input::placeholder { color: var(--text-dim); }
.search-input:focus { border-color: var(--border-strong); }
.filter-btn {
  padding: 0 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 16px;
}

/* ===== 筛选 chips ===== */
.chip-row {
  display: flex;
  gap: 8px;
  padding: 0 16px 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.chip {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-sub);
  transition: all 0.2s;
}
.chip.active {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-glow);
}

/* ===== 物资选择器(编码/名称联动) ===== */
.mode-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  background: var(--bg-input);
  border-radius: 10px;
  padding: 3px;
}
.mode-tab {
  flex: 1;
  text-align: center;
  padding: 8px 0;
  font-size: 13px;
  color: var(--text-sub);
  border-radius: 8px;
  transition: all 0.2s;
  cursor: pointer;
}
.mode-tab.active {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-weight: 600;
}
.picker-field { position: relative; }
.suggest-list {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  z-index: 50;
  background: var(--bg-card-solid);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  margin-top: 4px;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  display: none;
}
.suggest-list.show { display: block; }
.suggest-item {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}
.suggest-item:last-child { border-bottom: none; }
.suggest-item:active { background: rgba(46, 155, 255, 0.15); }
.suggest-item .sg-icon { font-size: 18px; }
.suggest-item .sg-name { flex: 1; color: var(--text-main); }
.suggest-item .sg-meta { font-size: 11px; color: var(--text-dim); }
.suggest-empty {
  padding: 14px;
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
}
.matched-info {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 8px 10px;
  background: rgba(46, 155, 255, 0.1);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  color: var(--primary-bright);
  display: none;
}
.matched-info.show { display: flex; }
.matched-info .mi-remove {
  margin-left: auto;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 16px;
}

/* ===== 空状态 ===== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
}
.empty-img {
  width: 140px;
  margin: 0 auto 16px;
  opacity: 0.7;
  border-radius: 16px;
}
.empty-text {
  color: var(--text-sub);
  font-size: 14px;
  margin-bottom: 16px;
}

/* ===== 按钮 ===== */
.btn {
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.15s, opacity 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn:active { transform: scale(0.96); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), #1a7fd6);
  color: #fff;
  box-shadow: var(--shadow-glow);
}
.btn-accent {
  background: linear-gradient(135deg, var(--accent), #00b8d4);
  color: #001a26;
  box-shadow: 0 0 20px var(--accent-glow);
}
.btn-ghost {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
}
.btn-danger {
  background: rgba(255, 85, 119, 0.15);
  border: 1px solid rgba(255, 85, 119, 0.4);
  color: var(--danger);
}
.btn-danger-outlined {
  background: #fff;
  border: 1px solid rgba(255,85,119,0.5);
  color: var(--danger);
}
.btn-danger-outlined:active { background: rgba(255,85,119,0.08); }
.btn-block { width: 100%; }

/* ===== FAB 悬浮按钮 ===== */
.fab {
  position: fixed;
  right: 16px;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px);
  width: 52px; height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(46, 155, 255, 0.5);
  z-index: 50;
}
.fab:active { transform: scale(0.92); }

/* ===== 迷你按钮 / 角色切换 ===== */
.btn-mini {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1.4;
  white-space: nowrap;
}
.btn-mini.role-btn {
  font-size: 12px;
  padding: 5px 10px;
}
.btn-mini.role-btn:hover,
.btn-mini.role-btn:active {
  background: linear-gradient(135deg, rgba(46, 155, 255, 0.2), rgba(0, 229, 255, 0.1));
  border-color: var(--primary);
  color: var(--primary-bright);
}
.btn-mini.role-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-mini.role-btn.disabled:active {
  background: var(--bg-card);
  border-color: var(--border);
  color: var(--text-sub);
}

.user-card-item {
  align-items: flex-start !important;
  padding-top: 12px !important;
  padding-bottom: 12px !important;
  flex-wrap: wrap;
}
.user-card-item .list-body {
  min-width: 0;
  flex: 1 1 160px;
}
.user-card-item .list-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  line-height: 1.6;
}

/* ===== 底部 Tab 导航 ===== */
.tabbar {
  position: fixed;
  left: 0; right: 0;
  bottom: 0;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(8, 18, 36, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
}
.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 0;
  color: var(--text-dim);
  transition: color 0.2s;
}
.tab-item.active { color: var(--primary-bright); }
.tab-icon { font-size: 20px; line-height: 1; }
.tab-label { font-size: 10px; }
.tab-action {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 0;
}
.tab-action-btn {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(46, 155, 255, 0.6);
  margin-top: -20px;
  border: 3px solid var(--bg-deep);
}
.tab-action-label {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 2px;
  line-height: 1.2;
}
.tab-action.active .tab-action-label { color: var(--primary-bright); }
.tab-action-btn:active { transform: scale(0.9); }

/* ===== 弹窗 Modal ===== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 5, 15, 0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: maskIn 0.2s ease;
}
@keyframes maskIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%;
  max-width: 420px;
  max-height: 85vh;
  background: var(--bg-base);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn 0.3s ease;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title {
  font-size: 16px;
  font-weight: 700;
}
.modal-close {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-sub);
}
.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}
.modal-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
}

/* ===== 底部抽屉 Sheet ===== */
.sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 5, 15, 0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  animation: maskIn 0.2s ease;
}
.sheet {
  width: 100%;
  max-height: 90vh;
  background: var(--bg-base);
  border-top: 1px solid var(--border-strong);
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: sheetIn 0.3s ease;
  padding-bottom: var(--safe-bottom);
}
@keyframes sheetIn {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.sheet-handle {
  width: 36px; height: 4px;
  background: var(--text-dim);
  border-radius: 2px;
  margin: 10px auto 4px;
}
.sheet-header {
  padding: 8px 16px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.sheet-title {
  font-size: 16px;
  font-weight: 700;
}
.sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}
.sheet-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
}

/* ===== 表单 ===== */
.form-group {
  margin-bottom: 14px;
}
.form-label {
  display: block;
  font-size: 12px;
  color: var(--text-sub);
  margin-bottom: 6px;
}
.form-input, .form-textarea, .form-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  color: var(--text-main);
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 2px rgba(46, 155, 255, 0.15);
}
.form-textarea {
  resize: none;
  min-height: 80px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%238aa5c8' d='M6 8L0 0h12z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.form-select option {
  background: var(--bg-base);
  color: var(--text-main);
}

/* ===== Toast ===== */
.toast-root {
  position: fixed;
  top: calc(var(--safe-top) + 60px);
  left: 0; right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 9999;
  pointer-events: none;
  gap: 8px;
}
.toast {
  background: rgba(10, 25, 50, 0.95);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 10px 18px;
  font-size: 13px;
  color: var(--text-main);
  box-shadow: var(--shadow-card);
  animation: toastIn 0.3s ease;
  max-width: 80%;
  text-align: center;
}
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
.toast.out { animation: toastOut 0.3s ease forwards; }
@keyframes toastOut {
  to { opacity: 0; transform: translateY(-10px); }
}

/* ===== 商品详情 ===== */
.detail-hero {
  text-align: center;
  padding: 20px 16px;
  background: linear-gradient(180deg, rgba(46, 155, 255, 0.1), transparent);
}
.detail-icon {
  width: 72px; height: 72px;
  margin: 0 auto 12px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(46, 155, 255, 0.3), rgba(0, 229, 255, 0.2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-glow);
}
.detail-name {
  font-size: 18px;
  font-weight: 700;
}
.detail-sku {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}
.detail-stock {
  font-size: 36px;
  font-weight: 800;
  margin-top: 10px;
  background: linear-gradient(90deg, var(--accent), var(--primary-bright));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-feature-settings: "tnum";
}
.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.detail-row:last-child { border-bottom: none; }
.detail-row-label { color: var(--text-sub); }
.detail-row-value { font-weight: 600; }

/* ===== 操作按钮组 ===== */
.action-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 0 16px 16px;
}

/* ===== 流水记录条目 ===== */
.record-item {
  display: flex;
  align-items: center;
  padding: 12px;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}
.record-item:last-child { border-bottom: none; }
.record-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.record-icon.in { background: rgba(43, 213, 118, 0.15); color: var(--success); }
.record-icon.out { background: rgba(255, 85, 119, 0.15); color: var(--danger); }
.record-info { flex: 1; min-width: 0; }
.record-title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.record-meta {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}
.record-num {
  font-size: 14px;
  font-weight: 700;
  font-feature-settings: "tnum";
}
.record-num.in { color: var(--success); }
.record-num.out { color: var(--danger); }

/* ===== 设置列表 ===== */
.setting-item {
  display: flex;
  align-items: center;
  padding: 14px;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}
.setting-item:last-child { border-bottom: none; }
.setting-item:active { background: rgba(46, 155, 255, 0.05); }
.setting-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: rgba(46, 155, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.setting-body {
  flex: 1;
}
.setting-title {
  font-size: 14px;
}
.setting-sub {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}
.setting-arrow {
  color: var(--text-dim);
}

/* ===== 进度条 ===== */
.progress {
  height: 6px;
  background: rgba(46, 155, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 3px;
  transition: width 0.6s ease;
}

/* ===== 登录页 ===== */
.login-page {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 20px;
}
.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 20%, rgba(46, 155, 255, 0.2), transparent 50%),
    radial-gradient(circle at 70% 80%, rgba(0, 229, 255, 0.15), transparent 50%),
    var(--bg-deep);
  z-index: -1;
}
.login-box {
  width: 100%;
  max-width: 360px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  padding: 28px 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  text-align: center;
}
.login-logo {
  width: 72px; height: 72px;
  border-radius: 18px;
  margin: 0 auto 14px;
  box-shadow: 0 0 30px var(--primary-glow);
}
.login-title {
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(90deg, var(--primary-bright), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.login-sub {
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 4px;
  margin-bottom: 22px;
}
.login-form { text-align: left; }
.login-form .form-input {
  background: rgba(6, 15, 30, 0.6);
}
.login-tip {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  margin-top: 14px;
  line-height: 1.6;
}
.login-qr {
  margin: 16px auto 6px;
  width: 140px;
  height: 140px;
  background: #fff;
  border-radius: 12px;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-qr img { width: 100%; height: 100%; border-radius: 8px; }
.login-qr-tip {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
}
.login-links {
  text-align: center;
  margin-top: 14px;
  font-size: 13px;
}
.login-links a {
  color: var(--primary-bright);
  cursor: pointer;
  border-bottom: 1px dashed rgba(95, 184, 255, 0.4);
  padding-bottom: 1px;
}
.login-links a:active { opacity: 0.6; }

/* ===== 顶部用户栏 ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 6px;
  border-bottom: 1px solid var(--border);
}
.topbar-store {
  font-size: 14px;
  font-weight: 700;
  background: linear-gradient(90deg, #fff, var(--primary-bright));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.topbar-user {
  font-size: 12px;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  gap: 6px;
}
.topbar-user .role-tag {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  background: rgba(46, 155, 255, 0.15);
  color: var(--primary-bright);
}
.topbar-user .role-tag.admin {
  background: linear-gradient(135deg, var(--accent), var(--primary));
  color: #001a26;
}
.topbar-user .role-tag.super {
  background: linear-gradient(135deg, #ff8a00, #e52e71);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(229, 46, 113, 0.3);
}

/* ===== 大屏适配 ===== */
@media (min-width: 600px) {
  .app {
    max-width: 480px;
    margin: 0 auto;
    position: relative;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.5);
  }
  .tabbar, .fab {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
  }
  .fab { right: auto; left: 50%; margin-left: 208px; }
  .tabbar { transform: translateX(-50%); }
}
@media (min-width: 600px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); max-width: 100%; }
}

/* 防止 iOS 输入框缩放 */
input, textarea, select { font-size: 16px; }
@media (min-width: 600px) {
  input, textarea, select { font-size: 14px; }
}

/* 禁用文字选中(移动体验) */
.list-item, .tab-item, .quick-item, .btn, .chip, .header-action {
  -webkit-user-select: none;
  user-select: none;
}
