/* =========================================================================
   styles/admin.css —— 管理端外壳（Web 1440×900）
   结构固定：.screen > .topbar + .sidebar + .main > .page
   V1 的问题：每页各写一套顶栏 / 只靠裸文字做导航 / 内容无栅格 / 底部内容被裁
   V2 的规则：一套外壳 + 一套内容栅格（页头 → KPI → 双栏 → 列表）
   ========================================================================= */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font-sans);
  color: var(--ink-900);
  background: #dfe3dc;
  -webkit-font-smoothing: antialiased;
}
p, h1, h2, h3, h4 { margin: 0; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }

/* ---------- 演示画布：居中显示 1440×900 一屏 ---------- */
.stage {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 28px 20px;
}
.stage__cap { width: 1440px; display: flex; align-items: baseline; justify-content: space-between; font-size: 13px; color: #5c6a60; }
.stage__cap b { color: var(--brand-800); font-size: 15px; }
.stage__nav { display: flex; gap: 6px; }
.stage__nav a {
  padding: 5px 11px; border-radius: var(--r-pill);
  background: #fff; border: 1px solid var(--line-strong); font-size: 12px; color: var(--ink-700);
}
.stage__nav a.is-on { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }

.screen {
  position: relative;
  width: 1440px; height: 900px;
  display: grid;
  grid-template-rows: var(--shell-topbar-h) 1fr;
  grid-template-columns: var(--shell-sidebar-w) 1fr;
  grid-template-areas: "topbar topbar" "sidebar main";
  overflow: hidden;
  border-radius: 10px;
  background: var(--page);
  box-shadow: var(--sh-3);
}

/* ---------- 顶栏 56 ---------- */
.topbar {
  grid-area: topbar;
  display: flex; align-items: center; gap: var(--sp-5);
  padding: 0 var(--sp-5) 0 var(--sp-4);
  background: var(--brand-800); color: #fff;
}
.topbar__brand { display: flex; align-items: center; gap: 10px; min-width: 190px; }
.topbar__logo {
  width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: 9px; background: #255c3f; font-size: 15px; font-weight: 800;
}
.topbar__name { font-size: var(--fs-16); font-weight: 800; letter-spacing: .5px; line-height: 1.1; }
.topbar__sub { font-size: var(--fs-11); color: #a9c2ad; }
.topbar__base {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: var(--r-pill);
  background: #1d5038; font-size: var(--fs-13); color: #dfeadc;
}
.topbar__base::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #7fcf95; }
.topbar__search {
  flex: 1; max-width: 400px; height: 34px;
  display: flex; align-items: center; gap: 8px;
  padding: 0 14px; border-radius: var(--r-pill);
  background: #1d5038; color: #9fb8a2; font-size: var(--fs-13);
}
.topbar__tools { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn {
  position: relative; width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 10px; background: #1d5038; font-size: 14px; color: #dfeadc;
}
.icon-btn__dot {
  position: absolute; top: 4px; right: 4px; min-width: 15px; height: 15px; padding: 0 4px;
  border-radius: var(--r-pill); background: #e0703f; color: #fff;
  font-size: 10px; font-weight: 700; line-height: 15px; text-align: center;
}
.topbar__user {
  display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px;
  border-radius: var(--r-pill); background: #1d5038; font-size: var(--fs-13);
}
.avatar {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: #cfe0c8; color: #16402c; font-size: 12px; font-weight: 800;
}

/* ---------- 侧栏 224 ---------- */
.sidebar {
  grid-area: sidebar;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow: hidden;
}
.sidebar__scroll { flex: 1; min-height: 0; padding: var(--sp-4) var(--sp-3) var(--sp-2); overflow-y: auto; }
.sidebar__scroll::-webkit-scrollbar, .card__body::-webkit-scrollbar,
.col::-webkit-scrollbar, .scroll-y::-webkit-scrollbar { width: 0; }
.nav-group + .nav-group { margin-top: var(--sp-4); }
.nav-group__title {
  padding: 0 10px var(--sp-2);
  font-size: var(--fs-11); font-weight: 700; letter-spacing: .8px; color: var(--ink-300);
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  height: 34px; padding: 0 10px; margin-bottom: 2px;
  border-radius: 9px; font-size: var(--fs-13); color: var(--ink-700);
}
.nav-item__ico { width: 16px; text-align: center; color: var(--ink-300); font-size: 13px; }
.nav-item__text { flex: 1; }
.nav-item__badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pill);
  background: var(--danger-bg); color: var(--danger);
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.nav-item.is-active { background: var(--brand-100); color: var(--brand-600); font-weight: 700; }
.nav-item.is-active .nav-item__ico { color: var(--brand-600); }
.sidebar__foot {
  display: flex; align-items: center; gap: 10px;
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--line);
}
.sidebar__foot .avatar { width: 32px; height: 32px; font-size: 13px; }
.sidebar__foot-name { font-size: var(--fs-13); font-weight: 700; }
.sidebar__foot-role { font-size: var(--fs-11); color: var(--ink-500); }

/* ---------- 主区与内容栅格 ---------- */
.main {
  grid-area: main; min-width: 0;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--page);
}
.page {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; gap: var(--shell-gap);
  padding: var(--sp-5) var(--shell-content-pad) var(--shell-content-pad);
}

/* 页头：面包屑 / 标题 + 副标题 / 右侧主操作 */
.page-head { display: flex; align-items: flex-end; gap: var(--sp-4); flex: none; }
.page-head--wrap { flex-wrap: wrap; align-items: center; }
.page-head--wrap .page-head__info { flex: 1 1 460px; }
.page-head--wrap .page-head__actions { flex: 0 0 auto; margin-left: auto; }
.page-head__info { min-width: 0; }
.crumb { font-size: var(--fs-12); color: var(--ink-500); margin-bottom: 6px; }
.crumb b { color: var(--ink-700); font-weight: 600; }
.page-head__title {
  display: flex; align-items: baseline; gap: var(--sp-3);
  font-size: var(--fs-24); font-weight: 800; letter-spacing: -.2px; line-height: 1.2;
}
.page-head__title small { font-size: var(--fs-13); font-weight: 600; color: var(--ink-500); }
.page-head__sub { margin-top: 4px; font-size: var(--fs-13); color: var(--ink-500); }
.page-head__actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 16px; border-radius: 9px;
  font-size: var(--fs-13); font-weight: 700; border: 1px solid transparent; white-space: nowrap;
}
.btn--primary { background: var(--brand-600); color: #fff; }
.btn--ghost { background: var(--surface); border-color: var(--line-strong); color: var(--ink-700); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--sm { height: 28px; padding: 0 12px; font-size: var(--fs-12); border-radius: 8px; }

/* ---------- 卡片 ---------- */
.card {
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
}
.card__head {
  flex: none;
  display: flex; align-items: center; gap: 10px;
  padding: 13px var(--sp-4) 11px;
  border-bottom: 1px solid var(--line);
}
.card__title { font-size: var(--fs-14); font-weight: 800; }
.card__meta { font-size: var(--fs-12); color: var(--ink-500); }
.card__more { margin-left: auto; font-size: var(--fs-12); font-weight: 700; color: var(--brand-600); }
/* 卡片主体用 grid 撑满（flex 在部分内核下会让内部绝对定位层塌成 0 高） */
.card__body {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; gap: 10px;
  padding: var(--sp-4); overflow: hidden;
}
.card__body--scroll { overflow-y: auto; }
/* .fill：正文区只剩一个子块时，用栅格把它撑满整卡（地图、图表用） */
.card__body.fill { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); padding: 12px; }
.card--flat { box-shadow: none; }

/* ---------- KPI 条（4 等分、等高） ---------- */
.kpis { flex: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-3); }
.kpi {
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px var(--sp-4) 14px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--sh-1);
}
.kpi__label { font-size: var(--fs-12); color: var(--ink-500); }
.kpi__value {
  font-family: var(--font-num);
  font-size: var(--fs-28); font-weight: 800; line-height: 1.1; letter-spacing: -.5px;
}
.kpi__value em { font-size: var(--fs-14); font-style: normal; font-weight: 700; color: var(--ink-500); margin-left: 3px; }
.kpi__foot { display: flex; align-items: center; gap: 6px; font-size: var(--fs-12); }
.kpi__delta { font-weight: 700; color: var(--ok); }
.kpi__delta--warn { color: var(--warn); }
.kpi__delta--danger { color: var(--danger); }
.kpi__note { color: var(--ink-500); }
.kpi--warn { border-color: var(--warn-line); }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 20px; margin-left: auto; }
.spark i { width: 5px; border-radius: 2px; background: var(--brand-200); }
.spark i:nth-child(3n) { background: var(--brand-300); }

/* ---------- 主区双栏：左放态势/图表，右放告警/详情，各自内部滚动 ----------
   用 flex 行 + minmax(0, 1fr) 主栏，避免栅格 auto 行按内容撑高导致底部被裁 */
.split { flex: 1; min-height: 0; display: flex; gap: var(--shell-gap); }
.split > * { flex: 1 1 0; min-width: 0; min-height: 0; }
.split__aside { flex: 0 0 336px; }
.split--aside-360 .split__aside { flex: 0 0 360px; }
.split--aside-400 .split__aside { flex: 0 0 400px; }
.stack { display: flex; flex-direction: column; gap: var(--shell-gap); min-height: 0; }
.stack > .card { min-height: 0; }
.scroll-y { overflow-y: auto; min-height: 0; }

/* ---------- 地块态势图 ---------- */
.map {
  position: relative; flex: 1 1 auto; min-height: 220px;
  border-radius: var(--r-md);
  background:
    linear-gradient(0deg, rgba(47,106,69,.04), rgba(47,106,69,.04)),
    repeating-linear-gradient(0deg, #e3ecdf 0 1px, transparent 1px 34px),
    repeating-linear-gradient(90deg, #e3ecdf 0 1px, transparent 1px 34px),
    #eef4ea;
  overflow: hidden;
}
.map__plot {
  position: absolute;
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 10px; border-radius: 10px;
  border: 2px solid rgba(255,255,255,.7);
  font-size: var(--fs-12); font-weight: 700; color: #16331f;
}
.map__plot b { font-size: var(--fs-13); }
.map__plot span { font-size: var(--fs-11); font-weight: 600; opacity: .82; }
.map__plot.is-ok { background: #a8c98f; }
.map__plot.is-watch { background: #e3bb7c; }
.map__plot.is-alert { background: #e08a70; }
.map__legend {
  position: absolute; left: 12px; bottom: 12px;
  display: flex; gap: 14px; padding: 7px 12px; border-radius: var(--r-pill);
  background: rgba(255,255,255,.94); font-size: var(--fs-11); color: var(--ink-700);
}
.map__legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }
.map__toolbar { position: absolute; right: 12px; top: 12px; display: flex; gap: 6px; }
.chip-sm {
  padding: 5px 10px; border-radius: var(--r-pill);
  background: rgba(255,255,255,.94); border: 1px solid var(--line-strong);
  font-size: var(--fs-11); font-weight: 600; color: var(--ink-700);
}
.chip-sm.is-on { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.map__tag {
  position: absolute; padding: 3px 8px; border-radius: var(--r-pill);
  background: #fff; font-size: var(--fs-11); font-weight: 700; color: var(--ink-700);
  box-shadow: var(--sh-1);
}
.map__tag--danger { background: var(--danger); color: #fff; }

/* ---------- 标签 ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  height: 20px; padding: 0 8px; border-radius: var(--r-pill);
  font-size: var(--fs-11); font-weight: 700; white-space: nowrap;
  background: var(--brand-100); color: var(--brand-600);
}
.tag--warn { background: var(--warn-bg); color: var(--warn); }
.tag--danger { background: var(--danger-bg); color: var(--danger); }
.tag--ok { background: var(--ok-bg); color: var(--ok); }
.tag--info { background: var(--info-bg); color: var(--info); }
.tag--ghost { background: var(--surface-2); color: var(--ink-500); }

/* ---------- 告警卡（带处置按钮 = 告警可闭环） ---------- */
.alert {
  display: flex; flex-direction: column; gap: 5px;
  padding: 11px 12px; border-radius: var(--r-md); border: 1px solid transparent;
}
.alert--danger { background: var(--danger-bg); border-color: var(--danger-line); }
.alert--warn { background: var(--warn-bg); border-color: var(--warn-line); }
.alert__top { display: flex; align-items: center; gap: 6px; }
.alert__time { font-size: var(--fs-11); color: var(--ink-500); margin-left: auto; }
.alert__text { font-size: var(--fs-13); font-weight: 700; }
.alert__note { font-size: var(--fs-12); color: var(--ink-500); }
.alert__actions { display: flex; gap: 8px; margin-top: 3px; }

/* ---------- 列表 ---------- */
.list { display: flex; flex-direction: column; }
.list__row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: var(--fs-13);
}
.list__row:last-child { border-bottom: 0; }
.list__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-300); flex: none; }
.list__dot--danger { background: var(--danger); }
.list__dot--warn { background: var(--warn); }
.list__main { flex: 1; min-width: 0; }
.list__title { font-weight: 700; }
.list__sub { display: block; font-size: var(--fs-12); color: var(--ink-500); }
.list__tail { font-size: var(--fs-12); color: var(--ink-500); white-space: nowrap; align-self: flex-start; }

/* ---------- 横向条形（成本/产量对比） ---------- */
.bars { display: flex; flex-direction: column; gap: 11px; }
.bar-row { display: flex; align-items: center; gap: 10px; font-size: var(--fs-12); }
.bar-row__track { flex: 1 1 auto; min-width: 0; height: 10px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; }
.bar-row__fill { display: block; height: 100%; border-radius: var(--r-pill); background: var(--brand-500); }
.bar-row__fill--warn { background: var(--warn); }
.bar-row__val { flex: 0 0 56px; text-align: right; font-family: var(--font-num); font-weight: 700; }

/* ---------- 柱状图（CSS 拼，后续接 ECharts） ----------
   用 grid 撑高：柱子高度百分比相对图表区高度，避免被 flex 内容压扁 */
.bars-chart { flex: 1 1 auto; min-height: 72px; display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; align-items: end; gap: 10px; }
.bars-chart i { display: block; border-radius: 6px 6px 3px 3px; background: linear-gradient(var(--brand-300), var(--brand-500)); }
.bars-chart i.is-warn { background: linear-gradient(#f0c98a, var(--warn)); }
.chart-x { flex: none; display: flex; gap: 10px; }
.chart-x span { flex: 1; text-align: center; font-size: var(--fs-11); color: var(--ink-500); }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-13); }
.table th {
  padding: 8px 10px; text-align: left; font-size: var(--fs-12); font-weight: 700;
  color: var(--ink-500); background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.table td { padding: 9px 10px; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }
.table .num { font-family: var(--font-num); font-weight: 700; text-align: right; }

/* ---------- 看板（5 列，列内滚动） ---------- */
.kanban { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--sp-3); }
.col {
  display: flex; flex-direction: column; gap: 9px; min-height: 0;
  padding: 10px; border-radius: var(--r-lg);
  background: var(--surface-2); border: 1px solid var(--line); overflow: hidden;
}
.col__head { flex: none; display: flex; align-items: center; gap: 8px; padding: 2px 4px 4px; }
.col__name { font-size: var(--fs-13); font-weight: 800; }
.col__count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill);
  background: #fff; border: 1px solid var(--line-strong);
  font-size: var(--fs-11); font-weight: 800; line-height: 18px; text-align: center; color: var(--ink-700);
}
.col__list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 9px; }
.col--todo { background: #f2f1ec; }
.col--doing { background: var(--brand-50); }
.col--review { background: #fdf8ee; }
.col--back { background: #fbf1ee; }
.col--done { background: #f2f7f1; }
.tcard {
  display: flex; flex-direction: column; gap: 5px;
  padding: 10px 11px; border-radius: var(--r-md);
  background: #fff; border: 1px solid var(--line); box-shadow: var(--sh-1);
}
.tcard__top { display: flex; align-items: center; gap: 6px; }
.tcard__title { font-size: var(--fs-13); font-weight: 800; }
.tcard__meta { font-size: var(--fs-11); color: var(--ink-500); }
.tcard__foot {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 5px; border-top: 1px dashed var(--line);
  font-size: var(--fs-11); color: var(--ink-500);
}
.tcard__money { font-family: var(--font-num); font-weight: 800; color: var(--brand-600); }
.tcard--overdue { border-color: var(--danger-line); background: #fffdfc; }

/* ---------- Tab ---------- */
.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: var(--r-md); background: var(--surface-2); }
.tabs span { padding: 5px 13px; border-radius: var(--r-sm); font-size: var(--fs-13); font-weight: 600; color: var(--ink-500); }
.tabs span.is-on { background: #fff; color: var(--brand-600); font-weight: 800; box-shadow: var(--sh-1); }

/* ---------- 详情栏字段 ---------- */
.kv { display: grid; grid-template-columns: 76px 1fr; gap: 8px 10px; font-size: var(--fs-13); }
.kv dt { color: var(--ink-500); }
.kv dd { margin: 0; font-weight: 600; text-align: right; }
.hero-alert {
  display: flex; flex-direction: column; gap: 5px;
  padding: 13px 14px; border-radius: var(--r-md);
  background: var(--danger-bg); border: 1px solid var(--danger-line);
}
.hero-alert__label { font-size: var(--fs-11); font-weight: 700; color: var(--danger); }
.hero-alert__title { font-size: var(--fs-20); font-weight: 800; }
.hero-alert__note { font-size: var(--fs-12); color: var(--ink-500); }
.stat-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-cell { padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); }
.stat-cell__label { font-size: var(--fs-11); color: var(--ink-500); }
.stat-cell__value { font-family: var(--font-num); font-size: var(--fs-18); font-weight: 800; }
.stat-cell__value small { font-size: var(--fs-11); font-weight: 700; color: var(--ink-500); margin-left: 2px; }

/* ---------- 溯源时间轴 ---------- */
.timeline { display: flex; flex-direction: column; }
.tl-item { position: relative; display: grid; grid-template-columns: 88px 20px 1fr; gap: 10px; padding-bottom: 16px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item__date { font-size: var(--fs-12); color: var(--ink-500); padding-top: 2px; text-align: right; }
.tl-item__node { position: relative; display: flex; justify-content: center; }
.tl-item__dot {
  width: 12px; height: 12px; border-radius: 50%; margin-top: 3px;
  background: var(--brand-600); box-shadow: 0 0 0 4px var(--brand-100);
}
.tl-item__line { position: absolute; top: 15px; bottom: -16px; width: 2px; background: var(--brand-200); }
.tl-item:last-child .tl-item__line { display: none; }
.tl-item__title { font-size: var(--fs-14); font-weight: 800; }
.tl-item__info { font-size: var(--fs-12); color: var(--ink-500); margin-top: 2px; }
.tl-item__extra { display: flex; gap: 6px; margin-top: 7px; }

/* ---------- 质量结论条 ---------- */
.verdict {
  flex: none; display: grid; grid-template-columns: repeat(5, 1fr);
  border-radius: var(--r-lg); border: 1px solid var(--ok-line); background: var(--ok-bg); overflow: hidden;
}
.verdict__cell { padding: 11px var(--sp-4); border-right: 1px solid var(--ok-line); }
.verdict__cell:last-child { border-right: 0; }
.verdict__label { font-size: var(--fs-12); color: var(--ink-500); }
.verdict__value { font-size: var(--fs-16); font-weight: 800; color: var(--ok); }
.verdict__value.is-warn { color: var(--warn); }

/* ---------- 二维码占位 ---------- */
.qr {
  width: 92px; height: 92px; border-radius: 8px; border: 5px solid #fff; box-shadow: var(--sh-1);
  background:
    repeating-linear-gradient(90deg, #1d2a22 0 6px, transparent 6px 12px),
    repeating-linear-gradient(0deg, #1d2a22 0 6px, #ffffff 6px 12px);
}
