/* 小飞机物流内部系统 · 视觉：深色侧栏 + 浅灰工作区 + 白卡片。只覆盖 Bootstrap 5 的默认，不改结构。 */
:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --border: #e5e8ef;
  --border-strong: #d5dae4;
  --text: #1f2937;
  --text-2: #4b5563;
  --muted: #6b7280;
  --primary: #2f6fed;
  --primary-hover: #245cd0;
  --primary-soft: #eaf1ff;
  --success: #15803d; --success-soft: #e6f6ec;
  --warning: #b45309; --warning-soft: #fff3df;
  --danger: #b91c1c;  --danger-soft: #fde8e8;
  --neutral-soft: #eef1f6;
  --sidebar-bg: #111a2b;
  --sidebar-text: #aab6c8;
  --sidebar-active: #ffffff;
  --sidebar-w: 236px;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --bs-primary: #2f6fed;
  --bs-primary-rgb: 47, 111, 237;
  --bs-body-font-family: var(--font);
  --bs-body-font-size: 14px;
  --bs-body-color: #1f2937;
  --bs-body-bg: #f4f6fa;
  --bs-border-color: #e5e8ef;
  --bs-link-color: #2f6fed;
  --bs-link-hover-color: #245cd0;
}
html, body { height: 100%; }
body { font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0; }

/* ---------- 壳子：侧栏 + 内容区 ---------- */
body.has-sidebar { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar-bg); color: var(--sidebar-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; }
.brand:hover { text-decoration: none; color: #fff; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, #3b82f6, #6366f1); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.brand-mark .ico { width: 20px; height: 20px; color: #fff; }
.brand-name { display: block; font-weight: 600; font-size: 14px; line-height: 1.2; }
.brand-sub { display: block; font-size: 11px; color: var(--sidebar-text); margin-top: 2px; }
.nav-groups { padding: 4px 10px; flex: 1; }
.nav-group { margin-bottom: 10px; }
.nav-group-title { font-size: 11px; letter-spacing: .08em; color: #6c7a90; padding: 10px 10px 4px; text-transform: uppercase; }
.nav-item-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--sidebar-text); font-size: 13.5px; margin: 1px 0; position: relative; }
.nav-item-link .ico { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav-item-link:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.nav-item-link.active { background: rgba(59, 130, 246, .18); color: var(--sidebar-active); font-weight: 500; }
.nav-item-link.active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #60a5fa; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid rgba(255, 255, 255, .08); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #2f6fed; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; flex: none; }
.who { flex: 1; min-width: 0; }
.who-name { color: #fff; font-size: 13px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-sub { font-size: 11px; color: #6c7a90; }
.icon-btn { color: var(--sidebar-text); padding: 4px; border-radius: 6px; display: inline-flex; }
.icon-btn .ico { width: 18px; height: 18px; }
.icon-btn:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.sidebar-toggle { display: none; }
.content { padding: 22px 28px 40px; min-width: 0; }
@media (max-width: 900px) {
  body.has-sidebar { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: var(--sidebar-w); transform: translateX(-100%); transition: transform .2s; z-index: 1040; }
  body.sidebar-open .sidebar { transform: none; }
  .sidebar-toggle { display: block; position: fixed; left: 12px; top: 10px; z-index: 1050; border: 1px solid var(--border); background: #fff; border-radius: 8px; padding: 4px 10px; font-size: 16px; }
  .content { padding: 54px 16px 32px; }
}

/* ---------- 页面标题 ---------- */
main h4 { font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 16px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
main h4 small, main h4 .fs-6 { font-size: 12.5px !important; font-weight: 400; color: var(--muted) !important; }
main .d-flex > h4 { margin-bottom: 0; }
main .d-flex.mb-2 { margin-bottom: 14px !important; }
main h5.modal-title { font-size: 15px; font-weight: 600; }

/* ---------- 卡片 ---------- */
.card { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); background: var(--surface); }
.card-header { background: transparent; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 13px; padding: 10px 14px; }
.card-header .text-muted { font-weight: 400; }
.card-body { padding: 14px; }
.card-body dl.row dt { color: var(--muted); font-weight: 500; font-size: 12.5px; }
.card-body dl.row dd { margin-bottom: 6px; }
details.card summary.card-header { cursor: pointer; list-style: none; }
details.card summary.card-header::before { content: "▸ "; color: var(--muted); }
details[open].card summary.card-header::before { content: "▾ "; }
details.card:not([open]) summary.card-header { border-bottom: 0; }

/* ---------- 筛选条 ---------- */
main > form.row, main form.row.g-2 { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px 12px; margin: 0 0 14px; box-shadow: var(--shadow); }
main form.row.g-2 > [class*="col-"] { padding-top: 6px; }
main form.row.g-2 .col-12.text-muted { padding-top: 4px; }

/* ---------- 表单控件 ---------- */
.form-control, .form-select { border-color: var(--border-strong); border-radius: 7px; color: var(--text); }
.form-control-sm, .form-select-sm { min-height: 32px; font-size: 13px; padding: 4px 10px; }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47, 111, 237, .15); }
.form-control::placeholder { color: #9ca3af; }
.form-label { font-size: 12.5px; font-weight: 500; color: var(--text-2); margin-bottom: 4px; }
.form-text { font-size: 12px; }
label.small input[type="checkbox"], label.me-3 input[type="checkbox"], label input[type="radio"] { accent-color: var(--primary); margin-right: 3px; }
textarea.form-control { font-family: var(--mono); font-size: 12.5px; }

/* ---------- 按钮 ---------- */
.btn { border-radius: 7px; font-weight: 500; }
.btn-sm { font-size: 13px; padding: 5px 12px; min-height: 32px; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-outline-secondary { color: var(--text-2); border-color: var(--border-strong); background: var(--surface); }
.btn-outline-secondary:hover { background: var(--neutral-soft); color: var(--text); border-color: var(--border-strong); }
.btn-outline-secondary:disabled { opacity: .55; }
.btn-outline-danger { border-color: #f3b4b4; color: var(--danger); }
.btn-link { padding: 0; }

/* ---------- 表格 ---------- */
.table-responsive { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.table-responsive > .table { margin-bottom: 0; }
main > .table, main > .row .table, .card .table { background: var(--surface); }
main > .table { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.table { --bs-table-striped-bg: #fafbfd; --bs-table-hover-bg: #f2f6ff; font-size: 13px; color: var(--text); }
.table > thead > tr > th { background: #f8fafc; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .02em; border-bottom: 1px solid var(--border); padding: 9px 10px; white-space: nowrap; }
.table > tbody > tr > td { padding: 7px 10px; border-color: #eef1f6; vertical-align: middle; }
table.table-sm td, table.table-sm th { white-space: nowrap; }
.table .text-truncate { white-space: nowrap; }
.table-danger { --bs-table-bg: #fff1f1; --bs-table-striped-bg: #fdecec; --bs-table-hover-bg: #fbe1e1; }
.table-light { --bs-table-bg: #f9fafb; }
.text-muted.small.mb-1 { color: var(--muted) !important; margin-bottom: 8px !important; }
#table.is-loading { opacity: .55; transition: opacity .15s; }

/* ---------- 徽章 / 状态 ---------- */
.badge { border-radius: 999px; font-weight: 500; font-size: 11.5px; padding: 3px 9px; }
.badge.text-bg-success { background: var(--success-soft) !important; color: var(--success) !important; }
.badge.text-bg-secondary { background: var(--neutral-soft) !important; color: var(--text-2) !important; }
.badge.text-bg-warning { background: var(--warning-soft) !important; color: var(--warning) !important; }
.badge.text-bg-danger { background: var(--danger-soft) !important; color: var(--danger) !important; }
.badge.text-bg-light { background: var(--neutral-soft) !important; color: var(--muted) !important; }
.badge.text-bg-dark { background: #1f2937 !important; color: #fff !important; }

/* ---------- 提示 ---------- */
.alert { border-radius: 8px; border: 1px solid transparent; font-size: 13px; }
.alert-danger { background: var(--danger-soft); color: var(--danger); border-color: #f5c2c2; }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: #f7dfb5; }
.alert-info { background: var(--primary-soft); color: #1e4fb8; border-color: #c9dbff; }
.alert-success { background: var(--success-soft); color: var(--success); border-color: #bde5cb; }

/* ---------- 分页 ---------- */
.pagination { margin: 12px 0 0; gap: 4px; }
.page-link { border-radius: 6px !important; border-color: var(--border); color: var(--text-2); font-size: 13px; padding: 4px 10px; }
.page-item.disabled .page-link { background: transparent; color: #9ca3af; }
.page-link:hover { background: var(--primary-soft); color: var(--primary); }

/* ---------- 标签页（打单/订单查询、系统管理） ---------- */
.nav-pills { gap: 2px; background: var(--neutral-soft); padding: 3px; border-radius: 8px; }
.nav-pills .nav-link { border-radius: 6px; color: var(--text-2); font-size: 13px; padding: 4px 12px; }
.nav-pills .nav-link.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-weight: 500; }
.nav-pills .nav-link:hover { text-decoration: none; }

/* ---------- 弹窗 ---------- */
.modal-content { border: 0; border-radius: 12px; box-shadow: 0 20px 50px rgba(16, 24, 40, .25); }
.modal-header { border-bottom: 1px solid var(--border); padding: 14px 18px; }
.modal-body { padding: 16px 18px; }
.modal-body dl.row dt { color: var(--muted); font-weight: 500; }

/* ---------- 看板 ---------- */
.stat-card { display: block; height: 100%; }
.stat-card .card { transition: transform .12s, box-shadow .12s; }
.stat-card:hover { text-decoration: none; }
.stat-card:hover .card { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(16, 24, 40, .08); }
.stat-label { font-size: 12.5px; color: var(--muted); }
.stat-value { font-size: 26px; font-weight: 600; letter-spacing: -.01em; color: var(--text); margin: 2px 0; font-variant-numeric: tabular-nums; }
.stat-value.neg { color: var(--danger); }
.stat-sub { font-size: 12px; color: var(--muted); }
.stat-accent { width: 32px; height: 4px; border-radius: 2px; background: var(--primary); margin-bottom: 10px; }
.stat-accent.warn { background: #f59e0b; } .stat-accent.ok { background: #22c55e; } .stat-accent.info { background: #06b6d4; } .stat-accent.violet { background: #8b5cf6; }

/* ---------- 登录页 ---------- */
body.login-page { background: radial-gradient(1200px 600px at 10% -10%, #dbe7ff 0%, transparent 60%), radial-gradient(900px 500px at 100% 100%, #e9e5ff 0%, transparent 55%), var(--bg); }
body.login-page .content { padding: 0; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 30px 30px 22px; box-shadow: 0 12px 40px rgba(16, 24, 40, .10); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-title { font-size: 17px; font-weight: 600; }
.login-sub { font-size: 12.5px; color: var(--muted); }
.login-card .form-control-lg { font-size: 14px; min-height: 42px; }
.login-card .btn-lg { font-size: 14px; min-height: 42px; }
.login-foot { font-size: 12px; color: var(--muted); margin-top: 16px; text-align: center; }

/* ---------- 工具条（打单记录：额度 + 按钮） ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.quota-strip { display: flex; gap: 8px; flex-wrap: wrap; }
.quota-chip { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; display: flex; align-items: baseline; gap: 8px; box-shadow: var(--shadow); }
.quota-label { font-size: 12px; color: var(--muted); }
.quota-value { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.quota-value.neg { color: var(--danger); }
.toolbar-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.toolbar-actions .btn { white-space: nowrap; }

/* ---------- 小件 ---------- */
main p.text-muted.small { font-size: 12.5px; }
.text-break.small { word-break: break-all; }
.link-plain { color: inherit; }
h4 + .nav-pills, .d-flex > .nav-pills { margin-left: auto; }
