/* ============ 阿强快运 TMS · 基础样式 ============ */
:root {
  --brand: #1f6feb; --brand-dark: #1a5fd0; --sidebar: #101a2b; --sidebar-2: #16233a;
  --bg: #f4f6fa; --card: #fff; --line: #e5e9f0; --text: #1f2a37; --muted: #6b7789;
  --green: #16a34a; --red: #dc2626; --orange: #d97706; --cyan: #0891b2; --purple: #7c3aed;
  --radius: 10px; --shadow: 0 1px 2px rgba(16, 26, 43, .06), 0 4px 16px rgba(16, 26, 43, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.55;
}
a { color: var(--brand); text-decoration: none; }
.hidden { display: none !important; }
.boot { padding: 60px; text-align: center; color: var(--muted); }

/* ---------- 布局 ---------- */
#app { display: flex; min-height: 100vh; }
.sidebar {
  width: 218px; flex: 0 0 218px; background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
  color: #c7d2e3; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px 14px; }
.brand .logo, .login-brand .logo {
  width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff; font-weight: 700; font-size: 18px; display: flex; align-items: center; justify-content: center;
}
.brand-txt { display: flex; flex-direction: column; line-height: 1.2; }
.brand-txt strong { color: #fff; font-size: 15px; letter-spacing: .5px; }
.brand-txt span { font-size: 11px; color: #8fa2bd; }
.nav { padding: 6px 8px 24px; }
.nav-group { color: #61728e; font-size: 11px; padding: 14px 10px 6px; letter-spacing: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: #c7d2e3;
  font-size: 13.5px; margin: 1px 0; transition: .15s;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active { background: linear-gradient(90deg, rgba(59,130,246,.35), rgba(59,130,246,.12)); color: #fff; box-shadow: inset 2px 0 0 var(--brand); }
.nav-icon { width: 16px; text-align: center; opacity: .85; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 58px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center;
  justify-content: space-between; padding: 0 20px; position: sticky; top: 0; z-index: 20;
}
.crumbs { font-weight: 600; font-size: 15px; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.top-link { font-size: 12.5px; color: var(--muted); padding: 4px 8px; border-radius: 6px; }
.top-link:hover { background: #eef2f8; color: var(--brand); }
.backend { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 4px 10px; border-radius: 20px; }
.backend i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.backend-live { background: #e8f7ee; color: var(--green); } .backend-live i { background: var(--green); box-shadow: 0 0 0 3px rgba(22,163,74,.15); }
.backend-offline { background: #fdf2e9; color: var(--orange); } .backend-offline i { background: var(--orange); }
.user { display: flex; align-items: center; gap: 8px; padding-left: 10px; border-left: 1px solid var(--line); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #dbeafe; color: #1d4ed8; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.user-meta { display: flex; flex-direction: column; line-height: 1.15; }
.user-meta strong { font-size: 13px; } .user-meta span { font-size: 11px; color: var(--muted); }
.content { padding: 18px 20px 40px; }

/* ---------- 卡片/统计 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; }
.card-hd { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.card-hd h3 { margin: 0; font-size: 14.5px; }
.card-extra { display: flex; gap: 8px; align-items: center; }
.card-bd { padding: 14px 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat-label { color: var(--muted); font-size: 12.5px; }
.stat-value { font-size: 24px; font-weight: 700; margin: 4px 0 2px; letter-spacing: -.5px; }
.stat-sub { color: var(--muted); font-size: 12px; }
.stat-blue .stat-value { color: var(--brand); } .stat-green .stat-value { color: var(--green); }
.stat-orange .stat-value { color: var(--orange); } .stat-red .stat-value { color: var(--red); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* ---------- 工具条/筛选 ---------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar .spacer { flex: 1; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 12px 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; }
.filter-item { display: flex; flex-direction: column; gap: 4px; }
.filter-label { font-size: 12px; color: var(--muted); }
.filter-actions { display: flex; gap: 8px; margin-left: auto; }

/* ---------- 表单 ---------- */
.input, select.input, textarea.input {
  height: 32px; padding: 0 10px; border: 1px solid #d5dce8; border-radius: 7px; background: #fff;
  font-size: 13px; color: var(--text); outline: none; min-width: 120px; font-family: inherit;
}
select.input { min-width: 130px; }
textarea.input { height: auto; padding: 8px 10px; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31,111,235,.12); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form-grid.cols-1 { grid-template-columns: 1fr; }
.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.form-item { display: flex; flex-direction: column; gap: 5px; }
.form-item.span-2 { grid-column: span 2; }
.field-label { font-size: 12.5px; color: var(--muted); }
.field-hint { font-size: 11.5px; color: #98a2b3; }
.form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.form-err { grid-column: 1 / -1; color: var(--red); font-size: 12.5px; min-height: 18px; }

/* ---------- 按钮 ---------- */
.btn { height: 32px; padding: 0 14px; border-radius: 7px; border: 1px solid transparent; cursor: pointer; font-size: 13px; font-family: inherit; transition: .15s; display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; } .btn-primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn-default { background: #fff; border-color: #d5dce8; color: var(--text); } .btn-default:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.btn-danger { background: #fee2e2; color: var(--red); } .btn-danger:hover { background: #fecaca; }
.btn-success { background: #e8f7ee; color: var(--green); }
.btn-sm { height: 27px; padding: 0 10px; font-size: 12.5px; border-radius: 6px; }
.btn-link { background: none; border: none; color: var(--muted); height: auto; padding: 2px 4px; }
.btn-link:hover { color: var(--brand); }
.btn-block { width: 100%; }

/* ---------- 表格 ---------- */
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { background: #f7f9fc; color: #55637a; font-weight: 600; text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.table td { padding: 9px 12px; border-bottom: 1px solid #f0f3f8; white-space: nowrap; }
.table tbody tr:hover { background: #f8fbff; }
.table .row-click { cursor: pointer; }
.table.compact th, .table.compact td { padding: 6px 10px; }
.ta-right { text-align: right; } .ta-center { text-align: center; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 9px 14px; color: var(--muted); font-size: 12.5px; background: #fff; }
.pager-btns { display: flex; gap: 6px; }

/* ---------- 标签 ---------- */
.tag { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 12px; line-height: 19px; }
.tag-gray { background: #eef1f6; color: #5b667a; } .tag-blue { background: #e7f0ff; color: #1d4ed8; }
.tag-green { background: #e8f7ee; color: var(--green); } .tag-red { background: #fee2e2; color: var(--red); }
.tag-orange { background: #fdf2e9; color: var(--orange); } .tag-cyan { background: #e0f2fe; color: var(--cyan); }
.tag-purple { background: #f1eafe; color: var(--purple); }

/* ---------- 图表 ---------- */
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 88px 1fr 76px; align-items: center; gap: 10px; font-size: 12.5px; }
.bar-label { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 8px; background: #eef2f8; border-radius: 5px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: linear-gradient(90deg, #60a5fa, #1d4ed8); border-radius: 5px; }
.fill-green { background: linear-gradient(90deg, #4ade80, #16a34a); } .fill-orange { background: linear-gradient(90deg, #fbbf24, #d97706); }
.fill-red { background: linear-gradient(90deg, #f87171, #dc2626); }
.bar-value { text-align: right; color: #55637a; }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 90px; }
.spark > span { flex: 1; background: linear-gradient(180deg, #93c5fd, #3b82f6); border-radius: 3px 3px 0 0; min-height: 2px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tab { background: none; border: none; padding: 9px 14px; cursor: pointer; color: var(--muted); font-size: 13.5px; border-bottom: 2px solid transparent; font-family: inherit; }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

/* ---------- 弹窗/提示 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 24px; }
.modal { background: #fff; border-radius: 12px; width: 520px; max-width: 100%; max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(15,23,42,.28); }
.modal-wide { width: 880px; }
.modal-hd { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-hd h3 { margin: 0; font-size: 15px; }
.modal-x { background: none; border: none; font-size: 20px; color: var(--muted); cursor: pointer; line-height: 1; }
.modal-bd { padding: 16px 18px; overflow: auto; }
.modal-ft { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
.toast-wrap { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #111827; color: #fff; padding: 9px 16px; border-radius: 8px; font-size: 13px; box-shadow: var(--shadow); animation: toastIn .2s ease; }
.toast-success { background: #15803d; } .toast-error { background: #b91c1c; } .toast-warn { background: #b45309; }
.toast.out { opacity: 0; transform: translateY(-6px); transition: .3s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }

/* ---------- 加载/空 ---------- */
.loading { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); padding: 40px 0; }
.spinner { width: 16px; height: 16px; border: 2px solid #cbd5e1; border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; color: #98a2b3; padding: 26px 0; }

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(900px 500px at 15% 10%, #dbeafe, transparent), radial-gradient(800px 600px at 85% 90%, #e0e7ff, transparent), #f4f6fa; padding: 24px; }
.login-card { width: 380px; background: #fff; border-radius: 14px; box-shadow: 0 24px 60px rgba(16,26,43,.14); padding: 26px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.login-brand h1 { margin: 0; font-size: 19px; } .login-brand p { margin: 0; color: var(--muted); font-size: 12.5px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); }
.login-form input { height: 36px; padding: 0 11px; border: 1px solid #d5dce8; border-radius: 8px; font-size: 14px; }
.login-form input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31,111,235,.12); }
.login-hint { font-size: 11.5px; color: #98a2b3; line-height: 1.6; }
.login-err { color: var(--red); font-size: 12.5px; min-height: 16px; }

/* ---------- 其它 ---------- */
.hint { color: var(--muted); font-size: 12.5px; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt, .kv .k { color: var(--muted); }
.kv dd, .kv .v { margin: 0; }
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: #e5e9f0; }
.tl-item { position: relative; padding: 0 0 16px; }
.tl-item::before { content: ''; position: absolute; left: -21px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: #cbd5e1; border: 2px solid #fff; box-shadow: 0 0 0 1px #cbd5e1; }
.tl-item.done::before { background: var(--green); box-shadow: 0 0 0 1px var(--green); }
.tl-title { font-size: 13.5px; font-weight: 600; }
.tl-meta { color: var(--muted); font-size: 12px; }
.photos { display: flex; gap: 8px; flex-wrap: wrap; }
.photo { width: 92px; height: 92px; border-radius: 8px; background: #eef2f8; border: 1px dashed #cbd5e1; display: flex; align-items: center; justify-content: center; color: #98a2b3; font-size: 11px; overflow: hidden; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: #eef2f8; color: #55637a; padding: 3px 10px; border-radius: 20px; font-size: 12px; }
.chip-on { background: #e7f0ff; color: var(--brand); }
.map-box { position: relative; height: 360px; border-radius: var(--radius); background:
  linear-gradient(90deg, rgba(148,163,184,.12) 1px, transparent 1px) 0 0 / 40px 40px,
  linear-gradient(rgba(148,163,184,.12) 1px, transparent 1px) 0 0 / 40px 40px, #f8fafc;
  border: 1px solid var(--line); overflow: hidden; }
.map-dot { position: absolute; transform: translate(-50%, -50%); text-align: center; font-size: 11px; color: #334155; }
.map-dot i { display: block; width: 10px; height: 10px; margin: 0 auto 2px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px rgba(31,111,235,.15); }
.map-legend { position: absolute; right: 10px; bottom: 10px; background: rgba(255,255,255,.92); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 11.5px; color: var(--muted); }
.two-col { display: grid; grid-template-columns: 300px 1fr; gap: 16px; }
.list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.list-item { padding: 10px 13px; border-bottom: 1px solid #f0f3f8; cursor: pointer; }
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: #f8fbff; }
.list-item.active { background: #eff5ff; box-shadow: inset 3px 0 0 var(--brand); }
.list-title { font-size: 13.5px; font-weight: 600; }
.list-sub { font-size: 12px; color: var(--muted); }

@media (max-width: 1180px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } .two-col { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  #app { flex-direction: column; } .sidebar { width: 100%; flex: none; height: auto; position: static; }
  .nav { display: flex; overflow-x: auto; } .nav-group { display: none; } .nav-item { white-space: nowrap; }
  .content { padding: 12px; }
}

/* 品牌标志（矢量 logo）：替代原来的文字方块 */
.logo-img { width: 36px; height: 36px; border-radius: 9px; background: #fff; object-fit: contain; flex: none; display: block; }
.brand .logo-img, .login-brand .logo-img { box-shadow: 0 0 0 1px rgba(255,255,255,.14); }
@media print { .logo-img { display: none; } }

/* 运单号 + 打印按钮：单号固定宽度右对齐，按钮列始终对齐，按钮弱化显示 */
.unit-cell { display: inline-flex; align-items: center; gap: 10px; width: 100%; }
.unit-num { min-width: 92px; text-align: right; font-variant-numeric: tabular-nums; color: #1f6feb; font-weight: 600; }
.btn-print {
  background: transparent; border: 1px solid rgba(31,111,235,.22); color: #64809f;
  opacity: .68; font-weight: 500; font-size: 12px; line-height: 1.55; padding: 2px 9px;
  border-radius: 6px; transition: opacity .15s, background .15s, color .15s, border-color .15s;
}
.btn-print:hover { opacity: 1; background: rgba(31,111,235,.07); border-color: rgba(31,111,235,.45); color: #1f6feb; }
tr:hover .btn-print { opacity: .95; }

