:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #101828;
  --ink-2: #344054;
  --muted: #667085;
  --muted-2: #98a2b3;
  --line: #e7e9ee;
  --line-strong: #d5d9e2;
  --brand: #0f172a;
  --brand-2: #1d2b45;
  --amber: #f59e0b;
  --amber-soft: #fef3c7;
  --green: #0f9f6e;
  --green-soft: #e6f7f0;
  --red: #d92d20;
  --red-soft: #fee4e2;
  --blue: #2563eb;
  --blue-soft: #e8f0fe;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 4px 16px rgba(16, 24, 40, .06);
  --shadow-lg: 0 18px 50px rgba(16, 24, 40, .16);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  overflow-x: hidden;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ---------------- 登录 ---------------- */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(900px 500px at 15% -10%, #1e293b 0%, transparent 60%),
    radial-gradient(700px 400px at 100% 100%, #24334d 0%, transparent 55%),
    #0b1220;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border-radius: 20px;
  padding: 34px 30px 26px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.login-card h1 { font-size: 21px; margin-bottom: 6px; }
.login-card .muted { margin-bottom: 22px; font-size: 13px; }
.login-card form { text-align: left; }
.login-card .btn { margin-top: 16px; }
.login-foot { margin-top: 18px; font-size: 11.5px; color: var(--muted-2); }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px;
  background: var(--brand); color: var(--amber);
  display: grid; place-items: center;
  font-weight: 700; font-size: 17px; letter-spacing: .02em;
  flex: none;
}
.brand-mark.large { width: 54px; height: 54px; border-radius: 15px; font-size: 24px; margin: 0 auto 14px; }
.error-text { color: var(--red); font-size: 12.5px; margin-top: 10px; min-height: 18px; }

/* ---------------- 框架 ---------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 224px;
  flex: none;
  background: var(--brand);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  padding: 22px 14px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 22px; }
.brand-mark { background: rgba(255,255,255,.08); }
.brand-name { color: #fff; font-weight: 650; font-size: 15px; letter-spacing: .01em; }
.brand-sub { color: #7b8aa3; font-size: 10px; letter-spacing: .14em; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 10px;
  font-size: 13.5px; color: #a9b6ca;
  transition: background .15s, color .15s;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: rgba(245,158,11,.14); color: #fff; }
.nav a.active .nav-ico { color: var(--amber); }
.nav-ico { width: 18px; text-align: center; font-size: 13px; opacity: .9; }

.side-foot { margin-top: auto; padding: 14px 8px 0; border-top: 1px solid rgba(255,255,255,.08); }
.env-badge {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 99px;
  background: rgba(245,158,11,.16); color: #fbbf24;
  border: 1px solid rgba(245,158,11,.28);
  margin-bottom: 12px;
  white-space: nowrap;
}
.env-badge.prod { background: rgba(16,185,129,.16); color: #34d399; border-color: rgba(16,185,129,.3); }
.side-user { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: #93a2b8; }
.side-user .dot { width: 6px; height: 6px; border-radius: 50%; background: #34d399; }
.link-btn { margin-left: auto; background: none; border: 0; color: #93a2b8; font-size: 12px; cursor: pointer; padding: 2px; }
.link-btn:hover { color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 22px 28px 18px;
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar h2 { font-size: 19px; }
.topbar p { margin-top: 2px; }
.top-stats { display: flex; gap: 26px; }
.stat { text-align: right; }
.stat b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 11.5px; color: var(--muted); }

.page { padding: 24px 28px 48px; max-width: 1480px; width: 100%; }

/* ---------------- 通用组件 ---------------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px 0;
}
.card-head h3 { font-size: 14.5px; }
.card-body { padding: 16px 18px 18px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--line-strong);
  background: #fff; color: var(--ink-2);
  font-size: 13.5px; font-weight: 550; cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.btn:hover { border-color: #b9c0cd; background: #fbfcfd; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #1b2740; border-color: #1b2740; }
.btn.amber { background: var(--amber); border-color: var(--amber); color: #231a02; }
.btn.amber:hover { background: #eab308; border-color: #eab308; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: #f2f4f7; color: var(--ink); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn.danger { color: var(--red); border-color: #f3c6c2; }
.btn.danger:hover { background: var(--red-soft); }
.btn.block { width: 100%; }
.btn.lg { height: 46px; font-size: 15px; border-radius: 12px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 99px;
  font-size: 11.5px; font-weight: 550;
  background: #f2f4f7; color: var(--ink-2);
}
.chip.green { background: var(--green-soft); color: #067647; }
.chip.amber { background: var(--amber-soft); color: #92400e; }
.chip.red { background: var(--red-soft); color: #b42318; }
.chip.blue { background: var(--blue-soft); color: #1d4ed8; }
.chip.outline { background: transparent; border: 1px solid var(--line-strong); color: var(--muted); }

/* 表单 */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 12.5px; color: var(--ink-2); font-weight: 550; }
.field > span em { color: var(--red); font-style: normal; margin-left: 2px; }
.field small { color: var(--muted-2); font-size: 11.5px; }
input[type=text], input[type=number], input[type=password], select, textarea {
  width: 100%; height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font-size: 13.5px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23667085' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 30px;
}
textarea { height: auto; min-height: 72px; padding: 9px 11px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: #94a3b8;
  box-shadow: 0 0 0 3px rgba(15, 23, 42, .07);
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 13px; }
.span-2 { grid-column: span 2; }
.inline { display: flex; align-items: center; gap: 8px; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }

/* 开关 */
.switch { position: relative; display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13px; color: var(--ink-2); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 38px; height: 22px; border-radius: 99px; background: #d0d5dd;
  position: relative; transition: background .18s; flex: none;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .18s;
}
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(16px); }

/* ---------------- 下单页 ---------------- */
.order-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(340px, .85fr); gap: 20px; align-items: start; }
.order-form { display: flex; flex-direction: column; gap: 16px; }

.section { padding: 18px; }
.section-title { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.section-title h3 { font-size: 14px; }
.section-title .step {
  width: 20px; height: 20px; border-radius: 6px;
  background: var(--brand); color: #fff;
  font-size: 11px; display: grid; place-items: center; font-weight: 600;
}

.account-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.account-card {
  border: 1px solid var(--line-strong); border-radius: 11px;
  padding: 11px 12px; cursor: pointer; background: #fff;
  transition: all .15s; position: relative;
}
.account-card:hover { border-color: #9aa7bb; }
.account-card.selected { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand), 0 6px 16px rgba(15,23,42,.08); }
.account-card.selected::after {
  content: "✓"; position: absolute; top: 8px; right: 10px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: 10px;
  display: grid; place-items: center;
}
.account-card .ac-name { font-weight: 600; font-size: 13px; margin-bottom: 3px; padding-right: 20px; }
.account-card .ac-meta { font-size: 11.5px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.account-card .ac-price { margin-top: 7px; font-size: 11.5px; color: var(--muted); }
.account-card .ac-price b { color: var(--ink); font-size: 14px; }
.account-card.disabled { opacity: .55; cursor: not-allowed; }

.sender-summary {
  display: flex; align-items: center; gap: 10px;
  background: #f8f9fb; border: 1px dashed var(--line-strong);
  border-radius: 10px; padding: 10px 12px; font-size: 12.5px; color: var(--ink-2);
}
.sender-summary .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.vas-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.vas-item {
  display: inline-flex; align-items: center; gap: 7px;
  white-space: nowrap;
  border: 1px solid var(--line-strong); border-radius: 9px;
  padding: 7px 11px; font-size: 12.5px; cursor: pointer; background: #fff;
  transition: all .15s;
}
.vas-item.on { border-color: var(--brand); background: #f6f7fa; }
.vas-item input[type=checkbox] { accent-color: var(--brand); width: 14px; height: 14px; margin: 0; }
.vas-value { width: 84px; height: 30px; font-size: 12.5px; padding: 0 8px; }
.vas-name { font-size: 12.5px; }

/* 报价面板 */
.quote-panel { position: sticky; top: 92px; display: flex; flex-direction: column; gap: 14px; }
.quote-card {
  border-radius: 16px;
  background:
    radial-gradient(600px 220px at 110% -20%, rgba(245,158,11,.22), transparent 60%),
    linear-gradient(160deg, #111d33 0%, #0b1220 60%, #101828 100%);
  color: #fff;
  padding: 20px;
  box-shadow: 0 16px 36px rgba(15, 23, 42, .22);
}
.quote-top { display: flex; align-items: center; justify-content: space-between; }
.quote-top .label { font-size: 12px; color: #94a3b8; letter-spacing: .04em; }
.quote-amount { display: flex; align-items: baseline; gap: 6px; margin: 6px 0 2px; }
.quote-amount .cur { font-size: 17px; color: var(--amber); font-weight: 600; }
.quote-amount .num { font-size: 40px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.quote-amount .unit { font-size: 12px; color: #94a3b8; }
.quote-sub { font-size: 12px; color: #94a3b8; }
.quote-sub b { color: #fbbf24; }

.quote-lines { margin-top: 16px; border-top: 1px solid rgba(255,255,255,.1); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.quote-line { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; color: #cbd5e1; }
.quote-line b { color: #fff; font-weight: 550; font-variant-numeric: tabular-nums; }
.quote-line .hint { color: #7b8aa3; font-size: 11px; }
.quote-line.strong { color: #fff; }
.quote-line.strong b { color: var(--amber); font-size: 14px; }
.quote-foot { margin-top: 14px; display: flex; gap: 8px; }
.quote-foot .btn { flex: 1; height: 42px; }
.quote-card .btn.amber { width: 100%; }

.quote-empty { text-align: center; padding: 26px 10px; color: #94a3b8; font-size: 12.5px; }

/* 比价 */
.compare-list { display: flex; flex-direction: column; }
.compare-row {
  display: grid; grid-template-columns: 1fr auto; gap: 8px;
  padding: 11px 14px; border-bottom: 1px solid var(--line);
  align-items: center; cursor: pointer; transition: background .15s;
}
.compare-row:last-child { border-bottom: 0; }
.compare-row:hover { background: #fafbfc; }
.compare-row.current { background: #f6f7fa; }
.compare-main { min-width: 0; }
.compare-name { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.compare-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.compare-price { text-align: right; }
.compare-price b { font-size: 16px; font-variant-numeric: tabular-nums; }
.compare-price span { display: block; font-size: 11px; color: var(--green); }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; font-weight: 550; color: var(--muted);
  font-size: 11.5px; letter-spacing: .03em;
  padding: 10px 14px; background: #fafbfc;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: #fafbfc; }
table.data td.num { font-variant-numeric: tabular-nums; }
.empty { text-align: center; padding: 44px 20px; color: var(--muted); font-size: 13px; }
.empty .big { font-size: 26px; margin-bottom: 8px; opacity: .5; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.toolbar .grow { flex: 1; }
.search-input { max-width: 280px; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; font-size: 12.5px; color: var(--muted); }

/* ---------------- 运单查询 ---------------- */
.track-search { padding: 20px; }
.track-input-row { display: flex; gap: 10px; }
.track-input-row input { height: 46px; font-size: 15px; flex: 1; min-width: 0; }
.track-input-row .btn { height: 46px; padding: 0 22px; }
.track-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 16px; margin-top: 16px; }
.track-card .track-head { padding: 16px 18px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.track-no { font-size: 15px; font-weight: 650; letter-spacing: .01em; }

.timeline { padding: 6px 18px 18px; }
.tl-item { position: relative; padding: 12px 0 12px 22px; border-left: 1px solid var(--line-strong); margin-left: 5px; }
.tl-item:last-child { border-left-color: transparent; }
.tl-item::before {
  content: ""; position: absolute; left: -4.5px; top: 17px;
  width: 8px; height: 8px; border-radius: 50%;
  background: #d0d5dd; border: 2px solid #fff;
}
.tl-item:first-child::before { background: var(--amber); box-shadow: 0 0 0 3px rgba(245,158,11,.18); }
.tl-time { font-size: 11.5px; color: var(--muted-2); }
.tl-text { font-size: 13px; margin-top: 2px; }
.tl-addr { font-size: 11.5px; color: var(--muted); margin-top: 1px; }

/* ---------------- 抽屉 ---------------- */
.drawer-mask {
  position: fixed; inset: 0; background: rgba(16,24,40,.42);
  z-index: 60; backdrop-filter: blur(2px);
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(560px, 94vw); background: var(--panel);
  z-index: 61; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  animation: slideIn .22s ease;
}
@keyframes slideIn { from { transform: translateX(30px); opacity: .4; } to { transform: none; opacity: 1; } }
.drawer-head { padding: 20px 22px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.drawer-head h3 { font-size: 17px; }
.drawer-body { padding: 20px 22px 32px; overflow-y: auto; flex: 1; }
.drawer-close { background: #f2f4f7; border: 0; width: 30px; height: 30px; border-radius: 8px; cursor: pointer; color: var(--muted); font-size: 15px; }
.drawer-close:hover { background: #e9ecf1; color: var(--ink); }

.kv { display: grid; grid-template-columns: 96px 1fr; gap: 8px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink); word-break: break-all; }

/* ---------------- 提示 ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  background: #101828; color: #fff; padding: 11px 18px;
  border-radius: 10px; font-size: 13px; z-index: 90;
  box-shadow: var(--shadow-lg); max-width: 80vw;
  animation: toastIn .2s ease;
}
.toast.err { background: #b42318; }
.toast.ok { background: #067647; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } }

.modal {
  position: fixed; inset: 0; background: rgba(16,24,40,.45);
  z-index: 80; display: grid; place-items: center; padding: 20px;
}
.modal-card { background: #fff; border-radius: 16px; padding: 24px; width: min(420px, 100%); box-shadow: var(--shadow-lg); }
.modal-card h3 { font-size: 16px; margin-bottom: 8px; }
.modal-card p { color: var(--muted); font-size: 13px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.skeleton {
  background: linear-gradient(90deg, #eef0f3 25%, #f6f7f9 37%, #eef0f3 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s infinite;
  border-radius: 6px;
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1120px) {
  .order-layout { grid-template-columns: 1fr; }
  .quote-panel { position: static; }
  .top-stats { gap: 16px; }
}
@media (max-width: 820px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: sticky; top: 0; z-index: 30;
    flex-direction: row; align-items: center; gap: 8px;
    padding: 10px 12px;
  }
  .brand { padding: 0; flex: none; }
  .brand > div:last-child { display: none; }
  .brand-mark { width: 32px; height: 32px; border-radius: 9px; font-size: 15px; }
  .nav { flex-direction: row; gap: 2px; flex: none; }
  .nav a { padding: 7px 8px; white-space: nowrap; }
  .nav a span:last-child { display: none; }
  .nav-ico { font-size: 15px; width: 16px; }
  .side-foot { margin: 0 0 0 auto; padding: 0; border: 0; display: flex; align-items: center; gap: 8px; }
  .env-badge { margin: 0; font-size: 10px; padding: 2px 7px; }
  .side-user { gap: 6px; }
  .side-user span:not(.dot) { display: none; }
  .topbar { padding: 14px 16px; flex-direction: column; align-items: flex-start; gap: 10px; position: static; }
  .top-stats { width: 100%; justify-content: space-between; gap: 8px; }
  .stat { text-align: left; }
  .stat b { font-size: 15px; }
  .page { padding: 14px 12px 60px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .account-picker { grid-template-columns: 1fr 1fr; }
  .track-grid { grid-template-columns: 1fr; }
  .track-input-row { flex-direction: column; }
  .track-input-row .btn { width: 100%; }
  .quote-panel { position: static; }
  .quote-amount .num { font-size: 34px; }
  .drawer { width: 100vw; }
  .toolbar { padding: 12px; }
  .search-input { max-width: none; flex: 1; min-width: 140px; }
  .section { padding: 15px; }
  .card-head { padding: 14px 14px 0; }
  .card-body { padding: 14px; }
}

@media (max-width: 430px) {
  .account-picker { grid-template-columns: 1fr; }
  .vas-value { width: 74px; }
  .top-stats .stat:nth-child(3) { display: none; }
}
