/* ============================================================
   九圣运力管理平台 · 经营控制台样式（浅色主题）
   —— 两级导航（业务线分组 + 视图子导航）
   ============================================================ */
:root {
  --bg: #f1f5f9;
  --panel: #ffffff;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #1d4ed8;
  --primary-dark: #1e40af;
  --primary-soft: #eff6ff;
  --up: #dc2626;      /* 涨 / 增加 —— 中国股市惯例 */
  --down: #16a34a;    /* 跌 / 减少 */
  --warn: #d97706;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.dim { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* ---------------- 登录 ---------------- */
.login-layer {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(140deg, #0f172a 0%, #1e3a8a 55%, #0c4a6e 100%);
  z-index: 50;
}
.login-card {
  width: 380px;
  background: #fff;
  border-radius: 16px;
  padding: 34px 32px 26px;
  box-shadow: 0 24px 60px rgba(2, 6, 23, .35);
}
.login-card h1 { margin: 14px 0 4px; font-size: 20px; letter-spacing: .5px; }
.login-card .sub { margin: 0 0 22px; color: var(--muted); font-size: 12.5px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, #1d4ed8, #0ea5e9);
  color: #fff; font-weight: 700; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: 1px;
}
.login-card label { display: block; margin-bottom: 14px; font-size: 12.5px; color: var(--muted); }
.login-card input {
  display: block; width: 100%; margin-top: 6px;
  padding: 10px 12px; border: 1px solid var(--border-strong);
  border-radius: 8px; font-size: 14px; color: var(--text); background: #fff;
}
.login-card input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.login-card .hint { margin: 16px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.7; }
.err { color: var(--up); font-size: 12.5px; min-height: 18px; margin: 10px 0 0; }

/* ---------------- 按钮 ---------------- */
.btn {
  border: 1px solid transparent; border-radius: 8px;
  padding: 8px 16px; font-size: 13.5px; cursor: pointer;
  background: #fff; color: var(--text); transition: all .15s;
  font-family: inherit;
}
.btn:hover { border-color: var(--border-strong); }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn.danger { background: #fff; color: var(--up); border-color: #fecaca; }
.btn.danger:hover { background: #fef2f2; border-color: var(--up); }
.btn.ghost { background: transparent; border-color: var(--border-strong); color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: #fff; }
.btn.sm { padding: 6px 12px; font-size: 12.5px; }
.btn.block { width: 100%; padding: 11px; font-size: 14.5px; margin-top: 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------------- 布局 ---------------- */
.app { min-height: 100%; display: flex; flex-direction: column; }
.topbar {
  height: 58px; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 22px; gap: 22px;
  position: sticky; top: 0; z-index: 20;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.topbar .logo {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, #1d4ed8, #0ea5e9);
  color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.topbar .title { font-weight: 600; font-size: 15px; letter-spacing: .3px; white-space: nowrap; }

/* 一级导航：业务线分组 */
.groups { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.gbtn {
  padding: 8px 14px; border-radius: 8px; cursor: pointer;
  color: var(--muted); font-size: 13.5px; user-select: none;
  display: flex; align-items: center; gap: 6px; white-space: nowrap;
}
.gbtn:hover { background: #f8fafc; color: var(--text); }
.gbtn.active { background: #0f172a; color: #fff; font-weight: 600; }
.gbtn.active .badge { background: #fff; color: #0f172a; }
.badge {
  background: var(--up); color: #fff; border-radius: 9px;
  padding: 1px 7px; font-size: 11px; font-weight: 600;
}
.user { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; flex-shrink: 0; }

/* 二级导航：当前分组下的视图 */
.subnav {
  display: flex; gap: 6px; padding: 9px 22px;
  background: #fff; border-bottom: 1px solid var(--border);
  position: sticky; top: 58px; z-index: 19; flex-wrap: wrap;
}
.pill {
  padding: 6px 13px; border-radius: 999px; font-size: 13px; color: var(--muted);
  cursor: pointer; user-select: none; border: 1px solid transparent;
  display: flex; align-items: center; gap: 6px; white-space: nowrap;
}
.pill:hover { background: #f1f5f9; color: var(--text); }
.pill.active { background: var(--primary-soft); color: var(--primary); border-color: #bfdbfe; font-weight: 600; }
.pill b { font-weight: 600; }

main { padding: 20px 22px 40px; flex: 1; }
.view { display: none; }
.view.active { display: block; }

.toolbar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.toolbar label { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 7px; }
.toolbar input, .toolbar select {
  padding: 7px 10px; border: 1px solid var(--border-strong);
  border-radius: 8px; font-size: 13px; background: #fff; color: var(--text);
  font-family: inherit;
}
.toolbar input:focus, .toolbar select:focus { outline: none; border-color: var(--primary); }
.scope { color: var(--muted); font-size: 12.5px; margin-left: auto; }
.scope b { color: var(--text); }

/* ---------------- 生产模式：隐藏业务说明性提示 ----------------
   静态说明文案（.scope / .hint 中不带 id 的）全部隐藏，界面只呈现数据；
   带 id 的 .scope / .hint 是 JS 动态填充的数据，必须保留。 */
.scope:not([id]),
.hint:not([id]) { display: none !important; }
/* 卡片标题内的规格信息：属数据非提示，保留展示 */
.card h3 .meta { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 6px; }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card h3 { margin: 0 0 14px; font-size: 14px; font-weight: 600; }
.card h3 .hint { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1080px) { .grid2 { grid-template-columns: 1fr; } }

.chart { width: 100%; height: 280px; }
.chart.small { height: 220px; }

/* ---------------- KPI ---------------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.kpi::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--primary);
}
.kpi.up::before { background: var(--up); }
.kpi.down::before { background: var(--down); }
.kpi .k-label { color: var(--muted); font-size: 12.5px; }
.kpi .k-value { font-size: 25px; font-weight: 650; margin-top: 7px; letter-spacing: -.4px; }
.kpi .k-sub { color: var(--muted); font-size: 12px; margin-top: 5px; }

/* ---------------- 表格 ---------------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; padding: 10px 12px; color: var(--muted);
  font-weight: 500; font-size: 12.5px; border-bottom: 1px solid var(--border);
  background: #f8fafc; white-space: nowrap;
}
tbody td { padding: 11px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
tbody tr:hover { background: #f8fafc; }
tbody tr.clickable { cursor: pointer; }
tbody tr:last-child td { border-bottom: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.amount-up { color: var(--up); font-weight: 600; }
.amount-down { color: var(--down); font-weight: 600; }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.empty { text-align: center; color: var(--muted); padding: 34px 0; font-size: 13px; }
.act { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------------- 标签 ---------------- */
.tag {
  display: inline-block; padding: 2px 9px; border-radius: 6px;
  font-size: 11.5px; line-height: 18px; background: #f1f5f9; color: var(--muted);
  white-space: nowrap;
}
.tag.blue { background: var(--primary-soft); color: var(--primary); }
.tag.green { background: #f0fdf4; color: var(--down); }
.tag.red { background: #fef2f2; color: var(--up); }
.tag.amber { background: #fffbeb; color: var(--warn); }
.tag.gray { background: #f1f5f9; color: var(--muted); }
.tag.dark { background: #0f172a; color: #fff; }

/* ---------------- 分段控件 ---------------- */
.seg { display: inline-flex; background: #e2e8f0; border-radius: 9px; padding: 3px; gap: 3px; }
.seg-btn {
  border: none; background: transparent; padding: 7px 14px; border-radius: 7px;
  font-size: 13px; color: var(--muted); cursor: pointer; font-family: inherit;
  display: flex; align-items: center; gap: 6px;
}
.seg-btn.active { background: #fff; color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.seg-btn b { font-weight: 600; }

/* ---------------- 列表（待办） ---------------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.todo {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 18px; display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow);
}
.todo .t-main { flex: 1; min-width: 0; }
.todo .t-title { font-weight: 590; font-size: 13.8px; margin-bottom: 5px; }
.todo .t-meta { color: var(--muted); font-size: 12px; display: flex; gap: 14px; flex-wrap: wrap; }
.todo .t-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.summary { display: flex; flex-wrap: wrap; gap: 10px; }
.summary .s-item {
  border: 1px solid var(--border); border-radius: 9px; padding: 11px 15px;
  min-width: 116px; background: #f8fafc;
}
.summary .s-item .l { color: var(--muted); font-size: 12px; }
.summary .s-item .v { font-size: 20px; font-weight: 620; margin-top: 5px; }

/* ---------------- 表单（M7 业务办理） ---------------- */
.form-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(196px, 1fr));
  gap: 12px 16px;
}
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { color: var(--muted); font-size: 12px; }
.field input, .field select {
  padding: 7px 10px; border: 1px solid var(--border-strong);
  border-radius: 8px; font-size: 13px; background: #fff; color: var(--text);
  font-family: inherit; width: 100%;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.form-actions {
  margin-top: 15px; padding-top: 14px; border-top: 1px dashed var(--border);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.cost-preview { color: var(--muted); font-size: 12.5px; margin-left: auto; }
.cost-preview b { color: var(--text); font-size: 14px; }

/* 红线提示卡 */
.card.redline { border-color: #fecaca; background: linear-gradient(0deg, #fff, #fffafb); }
.card.redline h3 { color: var(--up); margin-bottom: 10px; }
.redline-body { display: flex; flex-direction: column; gap: 8px; }
.rl-item { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rl-item b { color: var(--text); }

/* 权属日志时间线 */
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item {
  border-left: 2px solid var(--border-strong); padding: 6px 0 12px 14px;
  font-size: 12.5px; color: var(--muted); position: relative;
}
.tl-item::before {
  content: ''; position: absolute; left: -5px; top: 11px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--primary);
}
.tl-item:last-child { padding-bottom: 0; }
.tl-item b { color: var(--text); }

/* 流水线步骤 */
.steps { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.step {
  display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted);
  padding: 4px 10px; border: 1px dashed var(--border-strong); border-radius: 999px;
}
.step.done { color: var(--down); border-style: solid; border-color: #bbf7d0; background: #f0fdf4; }
.step.now { color: var(--warn); border-style: solid; border-color: #fde68a; background: #fffbeb; font-weight: 600; }

/* ---------------- toast ---------------- */
.toast {
  position: fixed; right: 24px; bottom: 26px; z-index: 80;
  background: #0f172a; color: #f8fafc; padding: 12px 18px;
  border-radius: 9px; font-size: 13.5px; box-shadow: 0 12px 30px rgba(2, 6, 23, .28);
  max-width: 460px; line-height: 1.6;
}
.toast.err { background: #b91c1c; }
.toast.ok { background: #15803d; }
