/* ============================================================
   Apple 风格设计系统
   - 毛玻璃 (backdrop-filter)
   - 大圆角 / 大留白
   - 弹簧动画 (cubic-bezier(.34,1.56,.64,1))
   - SF Pro 字体栈
   ============================================================ */

:root {
  --bg: #f5f5f7;
  --card: rgba(255, 255, 255, .88);
  --card-solid: #ffffff;
  --line: rgba(0, 0, 0, .08);
  --line-strong: rgba(0, 0, 0, .14);
  --text: #1d1d1f;
  --text-2: #3a3a3c;
  --muted: #86868b;
  --muted-2: #aeaeb2;
  --accent: #0071e3;
  --accent-press: #0077ed;
  --accent-soft: rgba(0, 113, 227, .1);
  --green: #34c759;
  --green-deep: #248a3d;
  --green-soft: rgba(52, 199, 89, .14);
  --orange: #ff9500;
  --orange-deep: #c93400;
  --orange-soft: rgba(255, 149, 0, .16);
  --red: #ff3b30;
  --red-deep: #c81e1e;
  --red-soft: rgba(255, 59, 48, .12);
  --amber: #ffcc00;
  --amber-deep: #a16207;
  --amber-soft: rgba(255, 204, 0, .2);
  --purple: #5856d6;
  --purple-soft: rgba(88, 86, 214, .12);
  --teal: #30b0c7;
  --gray-soft: rgba(0, 0, 0, .035);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 12px rgba(0, 0, 0, .04);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, .05), 0 12px 32px rgba(0, 0, 0, .08);
  --shadow-lg: 0 6px 16px rgba(0, 0, 0, .08), 0 24px 64px rgba(0, 0, 0, .16);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

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

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: .01em;
}

::selection { background: var(--accent-soft); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, .18); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, .3); background-clip: content-box; border: 2px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }

.hidden { display: none !important; }

/* ---------- 启动画面 ---------- */
.splash {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  transition: opacity .4s var(--ease);
}
.splash.fade-out { opacity: 0; pointer-events: none; }
.splash .logo { font-size: 52px; animation: splash-pop .6s var(--spring) both; }
.splash .bar {
  width: 140px;
  height: 4px;
  border-radius: 2px;
  background: rgba(0, 0, 0, .08);
  overflow: hidden;
}
.splash .bar i {
  display: block;
  width: 40%;
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
  animation: splash-slide 1.1s ease-in-out infinite;
}
@keyframes splash-pop {
  from { transform: scale(.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes splash-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(360%); }
}

/* ---------- 登录 ---------- */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(0, 113, 227, .10), transparent 60%),
    radial-gradient(1000px 500px at 110% 10%, rgba(88, 86, 214, .10), transparent 55%),
    radial-gradient(900px 600px at 50% 120%, rgba(52, 199, 89, .08), transparent 60%),
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 44px 40px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: spring-in .55s var(--spring) both;
}

.auth-logo {
  width: 76px;
  height: 76px;
  margin: 0 auto 18px;
  border-radius: 22px;
  background: linear-gradient(145deg, #0a84ff, #5e5ce6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  box-shadow: 0 10px 30px rgba(10, 132, 255, .35);
  animation: splash-pop .6s var(--spring) .08s both;
}
.auth-card h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 6px; }
.auth-sub { color: var(--muted); font-size: 13.5px; margin-bottom: 28px; }
.auth-form { text-align: left; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 7px;
  font-weight: 600;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  font-size: 14px;
  background: rgba(255, 255, 255, .8);
  color: var(--text);
  font-family: inherit;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease);
  appearance: none;
  -webkit-appearance: none;
}
.field input::placeholder, .field textarea::placeholder { color: var(--muted-2); }
.field input:hover, .field select:hover, .field textarea:hover { border-color: rgba(0, 0, 0, .24); }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  background: #fff;
}
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2386868b' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.field textarea { min-height: 100px; resize: vertical; font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 13px; line-height: 1.6; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; line-height: 1.6; }
.field .inline { display: flex; gap: 12px; align-items: center; }
.field .inline > * { flex: 1; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: 980px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  transition: transform .14s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease), opacity .18s;
  font-family: inherit;
  white-space: nowrap;
  user-select: none;
  letter-spacing: .01em;
}
.btn:hover { background: var(--accent-press); box-shadow: 0 4px 16px rgba(0, 113, 227, .28); }
.btn:active { transform: scale(.965); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn-block { width: 100%; }
.btn-ghost { background: rgba(255, 255, 255, .6); color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover { background: #fff; box-shadow: var(--shadow-sm); }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: var(--red-deep); box-shadow: 0 4px 16px rgba(255, 59, 48, .3); }
.btn-success { background: var(--green); }
.btn-success:hover { background: var(--green-deep); box-shadow: 0 4px 16px rgba(52, 199, 89, .3); }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-xs { padding: 5px 11px; font-size: 12px; border-radius: 999px; }

/* ---------- 顶栏 ---------- */
.topbar {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(245, 245, 247, .72);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(145deg, #0a84ff, #5e5ce6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 4px 12px rgba(10, 132, 255, .3);
}
.brand-name { font-size: 16px; font-weight: 700; letter-spacing: -.02em; }
.brand-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: rgba(0, 0, 0, .05);
  padding: 3px 10px;
  border-radius: 999px;
}
.topbar-right { display: flex; align-items: center; gap: 14px; }
.global-search {
  width: 210px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .08);
  color: #fff;
  font-size: 13px;
  font-family: inherit;
  transition: background .18s var(--ease), box-shadow .18s var(--ease), width .25s var(--ease);
}
.global-search::placeholder { color: rgba(255, 255, 255, .5); }
.global-search:focus {
  outline: none;
  background: rgba(255, 255, 255, .16);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .14);
  width: 260px;
}
.today-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, .75);
  border: 1px solid var(--line);
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.user-chip .role-badge { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; letter-spacing: .02em; }
.role-badge.admin { background: var(--amber-soft); color: var(--amber-deep); }
.role-badge.user { background: var(--accent-soft); color: var(--accent); }
.role-badge.super { background: linear-gradient(135deg, #f59e0b, #ef4444); color: #fff; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: calc(100vh - 58px); }

.sidebar {
  width: 224px;
  flex-shrink: 0;
  padding: 16px 12px;
  position: sticky;
  top: 58px;
  height: calc(100vh - 58px);
  overflow-y: auto;
  background: rgba(245, 245, 247, .55);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-right: 1px solid var(--line);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  color: var(--text-2);
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 3px;
  user-select: none;
  transition: background .18s var(--ease), color .18s var(--ease), transform .14s var(--ease);
}
.nav-item:hover { background: rgba(0, 0, 0, .045); color: var(--text); }
.nav-item:active { transform: scale(.98); }
.nav-item.active {
  background: rgba(255, 255, 255, .85);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.nav-item .nav-icon { font-size: 17px; width: 24px; text-align: center; }
.nav-sep { height: 1px; background: var(--line); margin: 12px 10px; }

.main {
  flex: 1;
  padding: 26px 32px 60px;
  max-width: 1560px;
  min-width: 0;
  margin: 0 auto;
}

/* 视图切换动画 */
.view-enter { animation: view-in .4s var(--ease) both; }
@keyframes view-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px 24px;
  margin-bottom: 20px;
  transition: box-shadow .25s var(--ease), transform .25s var(--ease);
}
.card-title { font-size: 17px; font-weight: 700; letter-spacing: -.01em; margin-bottom: 5px; }
.card-sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; line-height: 1.6; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-head h2 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.03em;
  background: linear-gradient(120deg, #1d1d1f 30%, #515154);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.page-head .sub { color: var(--muted); font-size: 13.5px; margin-top: 5px; }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- 统计卡 ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--card);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-sm);
  transition: transform .22s var(--spring), box-shadow .22s var(--ease);
  position: relative;
  overflow: hidden;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-card::after {
  content: "";
  position: absolute;
  right: -24px;
  top: -24px;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: var(--tint, rgba(0, 113, 227, .08));
}
.stat-card .num { font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; animation: num-pop .5s var(--spring) both; }
.stat-card .lbl { color: var(--muted); font-size: 12.5px; margin-top: 5px; font-weight: 500; }
@keyframes num-pop {
  from { transform: scale(.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.stat-card.danger { --tint: rgba(255, 59, 48, .12); }
.stat-card.warn { --tint: rgba(255, 149, 0, .16); }
.stat-card.ok { --tint: rgba(52, 199, 89, .14); }
.stat-card.info { --tint: rgba(0, 113, 227, .12); }
.stat-card.gray { --tint: rgba(0, 0, 0, .06); }
.stat-card.clickable { cursor: pointer; }
.stat-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-md);
  transform: translateY(-3px);
}
.badge-btn {
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: transform .12s var(--ease), box-shadow .15s var(--ease);
}
.badge-btn:hover { transform: scale(1.06); box-shadow: 0 2px 8px rgba(0, 0, 0, .12); }

/* ---------- 站点分段控件 ---------- */
.site-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  margin-bottom: 8px;
  scrollbar-width: none;
}
.site-strip::-webkit-scrollbar { display: none; }
.site-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  cursor: pointer;
  white-space: nowrap;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-2);
  box-shadow: var(--shadow-sm);
  transition: transform .18s var(--spring), box-shadow .2s var(--ease), border-color .2s, background .2s;
  user-select: none;
  position: relative;
}
.site-pill:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: rgba(0, 0, 0, .16); }
.site-pill:active { transform: scale(.96); }
.site-pill.active {
  background: #1d1d1f;
  border-color: #1d1d1f;
  color: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .22);
}
.site-pill .cnt {
  font-size: 11px;
  font-weight: 700;
  background: rgba(0, 0, 0, .07);
  color: var(--muted);
  border-radius: 999px;
  padding: 2px 8px;
}
.site-pill.active .cnt { background: rgba(255, 255, 255, .2); color: #fff; }
.site-pill .dot-alert {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 3px var(--red-soft);
}

/* 站点总览卡 */
.site-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.site-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .22s var(--spring), box-shadow .22s var(--ease);
  position: relative;
  overflow: hidden;
}
.site-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.site-card:active { transform: scale(.98); }
.site-card .site-name { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.site-card .site-meta { color: var(--muted); font-size: 12px; margin: 4px 0 12px; }
.site-card .mini-row { display: flex; gap: 12px; flex-wrap: wrap; }
.site-card .mini {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}
.mini.urgent { background: var(--red-soft); color: var(--red-deep); }
.mini.reorder { background: var(--orange-soft); color: var(--orange-deep); }
.mini.out { background: #fff; color: var(--red-deep); border: 1px solid var(--red-soft); }
.mini.safe { background: var(--green-soft); color: var(--green-deep); }
.mini.watch { background: var(--amber-soft); color: var(--amber-deep); }
.mini.total { background: rgba(0, 0, 0, .05); color: var(--text-2); }
.site-card .bar-track {
  height: 6px;
  border-radius: 3px;
  background: rgba(0, 0, 0, .06);
  margin-top: 14px;
  overflow: hidden;
  display: flex;
}
.site-card .bar-track i {
  height: 100%;
  transition: width .5s var(--ease);
}

/* ---------- 表格 ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, .75);
}
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 860px; }
th, td { padding: 11px 13px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th {
  background: rgba(250, 250, 252, .8);
  backdrop-filter: blur(8px);
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .03em;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}
tbody tr { transition: background .12s var(--ease); }
tbody tr:hover td { background: rgba(0, 0, 0, .022); }
tbody tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.center, th.center { text-align: center; }

.sku-cell { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 11.5px; color: var(--muted); word-break: break-all; }
.name-cell { max-width: 240px; }
.name-cell .main { font-weight: 600; color: var(--text); }
.name-cell .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* ---------- 状态徽章 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: .01em;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-safe { background: var(--green-soft); color: var(--green-deep); }
.b-watch { background: var(--amber-soft); color: var(--amber-deep); }
.b-reorder { background: var(--orange-soft); color: var(--orange-deep); }
.b-urgent { background: var(--red-soft); color: var(--red-deep); }
.b-out { background: var(--red); color: #fff; box-shadow: 0 2px 8px rgba(255, 59, 48, .35); }
.b-stagnant { background: rgba(0, 0, 0, .06); color: var(--muted); }

.market-badge {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent);
}

.method-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .16);
}
.method-chip::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: rgba(255, 255, 255, .85); }

/* ---------- 工具条 ---------- */
.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}
.toolbar input[type="search"], .toolbar select {
  padding: 9px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  font-size: 13.5px;
  background: rgba(255, 255, 255, .8);
  font-family: inherit;
  transition: box-shadow .18s var(--ease), border-color .18s var(--ease);
}
.toolbar input[type="search"] { flex: 1; min-width: 220px; }
.toolbar input[type="search"]:focus, .toolbar select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.toolbar select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2386868b' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}
.toolbar .spacer { flex: 1; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .38);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: mask-in .25s var(--ease) both;
}
@keyframes mask-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(30px);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  max-width: 760px;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  animation: spring-in .45s var(--spring) both;
  overflow: hidden;
}
.modal.modal-wide { max-width: 860px; }
@keyframes spring-in {
  from { opacity: 0; transform: translateY(24px) scale(.94); }
  to { opacity: 1; transform: none; }
}
.modal-head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.modal-head h3 { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.modal-close {
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 17px;
  color: var(--muted);
  background: rgba(0, 0, 0, .05);
  border: none;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s var(--ease), transform .15s var(--ease);
}
.modal-close:hover { background: rgba(0, 0, 0, .1); transform: rotate(90deg); }
.modal-body { padding: 22px 24px; overflow-y: auto; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- 通知 ---------- */
#toast-root {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: rgba(28, 28, 30, .88);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  color: #fff;
  padding: 11px 22px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toast-in .4s var(--spring) both;
  max-width: 460px;
  text-align: center;
}
.toast.success { background: rgba(36, 138, 61, .92); }
.toast.error { background: rgba(200, 30, 30, .92); }
.toast.warn { background: rgba(201, 52, 0, .92); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-14px) scale(.92); }
  to { opacity: 1; transform: none; }
}

/* ---------- 详情 ---------- */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 14px 0;
}
.detail-item {
  background: rgba(0, 0, 0, .03);
  border-radius: 14px;
  padding: 12px 14px;
  transition: transform .2s var(--spring);
}
.detail-item:hover { transform: translateY(-2px); }
.detail-item .k { font-size: 12px; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
.detail-item .v { font-size: 17px; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }

.advice-box {
  border-radius: 16px;
  padding: 14px 16px;
  margin-top: 14px;
  font-size: 13.5px;
  line-height: 1.75;
  border: 1px solid transparent;
}
.advice-box.warn { background: var(--orange-soft); border-color: rgba(255, 149, 0, .3); color: #7c3a00; }
.advice-box.danger { background: var(--red-soft); border-color: rgba(255, 59, 48, .25); color: #7f1d1d; }
.advice-box.ok { background: var(--green-soft); border-color: rgba(52, 199, 89, .3); color: #14532d; }
.advice-box.info { background: var(--accent-soft); border-color: rgba(0, 113, 227, .25); color: #0b3d91; }

.timeline { margin-top: 14px; }
.timeline-item {
  display: flex;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13px;
  align-items: baseline;
}
.timeline-item:last-child { border-bottom: none; }
.timeline-item .t-date { font-weight: 700; min-width: 104px; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ---------- 可视化时间线 ---------- */
.timeline-chart {
  background: rgba(255, 255, 255, .65);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px 10px;
}
.timeline-svg {
  width: 100%;
  height: auto;
  display: block;
  min-height: 230px;
}
.tl-grid { stroke: rgba(0, 0, 0, .055); stroke-width: 1; }
.tl-axis-label { font-size: 10.5px; fill: var(--muted); }
.tl-value-label {
  font-size: 11.5px;
  font-weight: 700;
  fill: var(--text-2);
  paint-order: stroke;
  stroke: rgba(255, 255, 255, .9);
  stroke-width: 3px;
  stroke-linejoin: round;
}
.tl-area { fill: rgba(0, 113, 227, .10); }
.tl-line { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.tl-out-band { fill: rgba(255, 59, 48, .14); }
.tl-arrival-line { stroke: rgba(255, 149, 0, .45); stroke-width: 1; stroke-dasharray: 3 3; }
.tl-arrival-dot { fill: var(--orange); stroke: #fff; stroke-width: 2; }
.tl-today-line { stroke: rgba(0, 0, 0, .35); stroke-width: 1.4; stroke-dasharray: 5 3; }
.tl-today-label { font-size: 10.5px; font-weight: 700; fill: var(--text-2); }
.tl-safety-line { stroke: rgba(134, 134, 139, .55); stroke-width: 1.2; }
.tl-safety-label { font-size: 10px; fill: var(--muted); }
.tl-date-label { font-size: 10px; fill: var(--muted); }
.tl-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--muted);
  padding: 4px 2px 2px;
}
.tl-legend span { display: inline-flex; align-items: center; gap: 5px; }
.tl-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.tl-dash {
  width: 16px;
  height: 0;
  border-top: 2px dashed var(--muted);
  display: inline-block;
}

/* ---------- 批量发货 ---------- */
.batch-preview { margin-top: 14px; }
.parse-note { font-size: 12.5px; color: var(--muted); margin: 8px 0; }
.parse-note .err { color: var(--red-deep); font-weight: 600; }
.batch-preview input[type="number"], .batch-preview input[type="text"] {
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
}
.batch-preview input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- 配置表格 ---------- */
.config-table td input {
  width: 92px;
  padding: 7px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  text-align: right;
  font-variant-numeric: tabular-nums;
  transition: box-shadow .15s var(--ease), border-color .15s;
}
.config-table td input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* iOS 风格开关 */
.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 28px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(120, 120, 128, .28);
  transition: background .22s var(--ease);
  cursor: pointer;
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .25);
  transition: transform .24s var(--spring);
}
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { transform: translateX(18px); }

/* ---------- 其他 ---------- */
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mt8 { margin-top: 8px; }
.mt12 { margin-top: 12px; }
.mb12 { margin-bottom: 12px; }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.flex-end { justify-content: flex-end; }
.grow { flex: 1; }
.empty-state { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty-state .icon { font-size: 40px; margin-bottom: 10px; }
.kbd {
  background: rgba(0, 0, 0, .06);
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 1px 7px;
  font-size: 12px;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* 分段控件（iOS 风格） */
.seg {
  display: inline-flex;
  background: rgba(120, 120, 128, .16);
  border-radius: 12px;
  padding: 3px;
  gap: 2px;
}
.seg button {
  border: none;
  background: transparent;
  padding: 7px 16px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-2);
  font-family: inherit;
  transition: background .2s var(--ease), color .2s, box-shadow .2s;
  white-space: nowrap;
}
.seg button.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .14);
}

/* 响应式 */
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 10px;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .nav-item { margin-bottom: 0; }
  .nav-sep { display: none; }
  .main { padding: 18px 16px 60px; }
  .topbar { padding: 0 14px; }
  .brand-tag, .today-label { display: none; }
  .page-head h2 { font-size: 23px; }
}

@media print {
  .sidebar, .topbar, .toolbar, .page-head .actions, .site-strip { display: none !important; }
  .layout { display: block; }
  .main { padding: 0; }
  body { background: #fff; }
  .card { box-shadow: none; border: none; }
}
