:root {
  --green: #2e7d32;
  --green-d: #1b5e20;
  --bg: #f4f6f4;
  --card: #ffffff;
  --line: #e3e8e3;
  --text: #1f2a22;
  --muted: #6b7a6f;
  --danger: #c62828;
  --warn: #ef6c00;
  --blue: #1565c0;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--blue); text-decoration: none; }

/* 登录 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg,#1b5e20,#2e7d32); }
.login-card { width: 360px; background: #fff; border-radius: 14px; padding: 32px 28px; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.login-card h1 { margin: 0 0 4px; font-size: 22px; color: var(--green-d); }
.login-sub { margin: 0 0 18px; color: var(--muted); font-size: 13px; }
.login-card label { display: block; margin: 12px 0 6px; font-size: 13px; color: var(--muted); }
.login-card input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.login-card button { width: 100%; margin-top: 18px; padding: 11px; background: var(--green); color: #fff; border: none; border-radius: 8px; font-size: 15px; cursor: pointer; }
.login-card button:disabled { opacity: .6; }
.msg { margin-top: 10px; font-size: 13px; min-height: 18px; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--green); }
.login-hint { margin-top: 16px; font-size: 12px; color: var(--muted); line-height: 1.7; background: #f1f6f1; padding: 10px 12px; border-radius: 8px; }

/* 主框架 */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 210px; background: #1f2a22; color: #dfe7df; display: flex; flex-direction: column; }
.brand { padding: 20px 18px; font-size: 18px; font-weight: 700; line-height: 1.3; color: #fff; border-bottom: 1px solid #33403a; }
.brand span { font-size: 12px; color: #9fb39f; font-weight: 400; }
.sidebar nav { padding: 10px 0; overflow-y: auto; flex: 1; }
.nav-item { padding: 11px 18px; cursor: pointer; font-size: 14px; border-left: 3px solid transparent; }
.nav-item:hover { background: #2a372e; }
.nav-item.active { background: #2e7d32; border-left-color: #a5d6a7; color: #fff; }
.nav-group { padding: 12px 18px 4px; font-size: 11px; color: #7e9183; text-transform: uppercase; letter-spacing: .5px; }

.main { flex: 1; display: flex; flex-direction: column; }
.topbar { height: 56px; background: var(--card); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 22px; }
.page-title { font-size: 17px; font-weight: 600; }
.user-box { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.role-tag { background: #e8f5e9; color: var(--green-d); padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.content { padding: 22px; overflow-y: auto; }

/* 卡片/表格 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 18px; }
.card h3 { margin: 0 0 14px; font-size: 15px; }
.grid { display: grid; gap: 14px; }
.grid.cols4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .grid.cols4,.grid.cols3,.grid.cols2 { grid-template-columns: 1fr 1fr; } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.stat .num { font-size: 26px; font-weight: 700; color: var(--green-d); }
.stat .lbl { font-size: 12px; color: var(--muted); margin-top: 4px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; background: #f7faf7; }
tr:hover td { background: #f9fcf9; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; }
.tag.g { background: #e8f5e9; color: var(--green-d); }
.tag.r { background: #fdecea; color: var(--danger); }
.tag.y { background: #fff3e0; color: var(--warn); }
.tag.b { background: #e3f2fd; color: var(--blue); }
.tag.o { background: #eceff1; color: #455a64; }

/* 表单/按钮 */
.btn { display: inline-block; padding: 8px 14px; background: var(--green); color: #fff; border: none; border-radius: 8px; cursor: pointer; font-size: 13px; }
.btn:hover { background: var(--green-d); }
.btn.ghost { background: #fff; color: var(--green-d); border: 1px solid var(--green); }
.btn.ghost:hover { background: #e8f5e9; }
.btn.mini { padding: 5px 10px; font-size: 12px; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #9c1f1f; }
.btn.warn { background: var(--warn); }
.btn:disabled { opacity: .55; cursor: default; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.field input, .field select, .field textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit; }
.field.inline { display: inline-block; margin-right: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: end; }
.empty { color: var(--muted); padding: 20px; text-align: center; }
.muted { color: var(--muted); }
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); vertical-align: middle; }
.thumb-link { color: var(--blue); font-size: 12px; }
.right { text-align: right; }
.center { text-align: center; }
.mt { margin-top: 14px; }
.flex { display: flex; gap: 10px; align-items: center; }
.spacer { flex: 1; }

/* 模态 */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { width: 460px; max-width: 92vw; max-height: 88vh; overflow:auto; background: #fff; border-radius: 12px; padding: 22px; }
.modal h3 { margin: 0 0 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.modal-mask.confirm .modal { width: 380px; }

/* toast */
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: #1f2a22; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 13px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 100; max-width: 80vw; }
.toast.show { opacity: 1; }

/* ============================================================
   监控大屏 · 经营驾驶舱
   与后台其余页面共用浅色主题 token，不再用"黑洞式"深色面板。
   12 列栅格 + 显式跨列，四块内容对齐成马赛克，消除大块留白。
   ============================================================ */
.dash { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px; }

/* ---- KPI 指标卡 ---- */
.dash-kpi { grid-column: span 3; position: relative; display: flex; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 15px 16px 15px 19px; overflow: hidden; }
.dash-kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--k, var(--green)); }
.dash-kpi .ic { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: var(--kb, #e8f5e9); color: var(--k, var(--green)); }
.dash-kpi .ic svg { width: 18px; height: 18px; }
.dash-kpi .kmain { min-width: 0; flex: 1; display: flex; flex-direction: column; height: 100%; }
.dash-kpi .k-lbl { font-size: 12px; color: var(--muted); }
.dash-kpi .k-val { font-size: 26px; font-weight: 700; line-height: 1.2; color: var(--text);
  font-variant-numeric: tabular-nums; }
.dash-kpi .k-val small { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 2px; }
/* 四张卡等高（栅格拉伸），把"进度条 + 说明"整体压到底部，避免只有部分卡带进度条时上下错落 */
.dash-kpi .k-foot { margin-top: auto; padding-top: 6px; }
.dash-kpi .k-sub { font-size: 12px; color: var(--muted); margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-kpi.warn { --k: #ef6c00; --kb: #fff3e0; }
.dash-kpi.danger { --k: #c62828; --kb: #fdecea; }

.dash-bar { height: 6px; border-radius: 3px; background: #eef2ee; overflow: hidden; margin-bottom: 2px; }
.dash-bar > i { display: block; height: 100%; border-radius: 3px; background: var(--k, var(--green));
  transition: width .4s ease; }

/* ---- 面板 ---- */
.dash-panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  display: flex; flex-direction: column; overflow: hidden; }
.dash-panel > header { display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; border-bottom: 1px solid var(--line); }
.dash-panel > header h3 { margin: 0; font-size: 14px; font-weight: 600; color: var(--text); }
.dash-panel > header .hint { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 400; }
.dash-panel > .body { padding: 16px; flex: 1; min-width: 0; display: flex; flex-direction: column; }

.dash-map { grid-column: span 8; grid-row: span 2; }
.dash-alerts { grid-column: span 4; }
.dash-members { grid-column: span 4; }
.dash-types { grid-column: span 12; }

/* ---- 空态 ---- */
.dash-empty { display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; min-height: 118px; color: var(--muted); font-size: 13px; text-align: center; }
.dash-empty svg { width: 26px; height: 26px; }
.dash-empty.ok svg { color: var(--green); }
.dash-empty.plain { min-height: 84px; }

/* ---- 告警列表（danger = 异常/超期；warn = 长期无进展） ---- */
.alist { display: flex; flex-direction: column; gap: 8px; }
.aitem { display: flex; gap: 10px; align-items: flex-start; padding: 9px 11px;
  border-radius: 9px; background: #fdecea; border: 1px solid #f8d7d4; }
.aitem.warn { background: #fff7e8; border-color: #fae3bd; }
.aitem .adot { flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; margin-top: 6px; background: var(--danger); }
.aitem.warn .adot { background: var(--warn); }
.aitem .atitle { font-size: 13px; color: #7f1d1d; line-height: 1.5; }
.aitem.warn .atitle { color: #7c4a03; }
.aitem .ameta { font-size: 12px; color: #a1554f; margin-top: 2px; }
.aitem.warn .ameta { color: #a5752f; }

/* ---- 成员状态 ---- */
.msum { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px;
  font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.msum b { color: var(--text); font-weight: 600; }
.msum .sdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px;
  vertical-align: middle; }
.mchips { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 8px; align-content: start; }
.mchip { display: flex; align-items: center; gap: 8px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 9px; background: #fbfdfb; font-size: 13px; min-width: 0; }
.mchip .mdot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: #90a4ae; }
.mchip .mname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.mchip .mstate { flex: 0 0 auto; font-size: 12px; color: var(--muted); }
.mchip.working { border-color: #bbdefb; background: #f4f9ff; }
.mchip.working .mdot { background: var(--blue); }
.mchip.working .mstate { color: var(--blue); }
.mchip.done { border-color: #c8e6c9; background: #f4fbf5; }
.mchip.done .mdot { background: var(--green); }
.mchip.done .mstate { color: var(--green-d); }

/* ---- 热力图 ---- */
.heat-svg { width: 100%; height: auto; display: block; border-radius: 9px; background: #f7faf7; }
.heat-svg text { font-family: inherit; }
.heat-svg .hlbl { font-size: 11px; font-weight: 600; fill: #23331f; paint-order: stroke;
  stroke: #fff; stroke-width: 3.5px; stroke-linejoin: round; }
.heat-svg .hlbl-m { fill: #5d3a00; }
.heat-svg .hleader { stroke: #9db8a0; stroke-width: 1; }
.dash-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.dash-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  margin-right: 5px; vertical-align: middle; }
.dash-legend .sq { display: inline-block; width: 10px; height: 10px; border-radius: 3px;
  margin-right: 5px; vertical-align: middle; background: #a5d6a7; border: 1px solid #66bb6a; }

/* ---- 作业进度（按类型）横向条形 ---- */
.tprog { display: flex; flex-direction: column; gap: 11px; }
.trow { display: grid; grid-template-columns: 84px minmax(120px, 1fr) 50px auto; align-items: center; gap: 12px; }
.trow .tname { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .tbar { height: 9px; border-radius: 5px; background: #eef2ee; overflow: hidden; }
.trow .tbar > i { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg,#66bb6a,#2e7d32);
  transition: width .4s ease; }
.trow .tval { font-size: 13px; font-weight: 600; color: var(--green-d); text-align: right;
  font-variant-numeric: tabular-nums; }
.trow .tmeta { font-size: 12px; color: var(--muted); text-align: right; white-space: nowrap;
  font-variant-numeric: tabular-nums; }
@media (max-width: 1000px) { .trow { grid-template-columns: 70px 1fr 46px; } .trow .tmeta { display: none; } }

/* ---- 响应式 ---- */
@media (max-width: 1180px) {
  .dash-kpi { grid-column: span 6; }
  .dash-map { grid-column: span 12; grid-row: auto; }
  .dash-alerts, .dash-members { grid-column: span 6; }
}
@media (max-width: 760px) {
  .dash-kpi { grid-column: span 12; }
  .dash-alerts, .dash-members { grid-column: span 12; }
}

.nav-badge { display: inline-block; min-width: 16px; height: 16px; line-height: 16px; text-align: center; padding: 0 4px; background: #c62828; color: #fff; border-radius: 9px; font-size: 11px; margin-left: 6px; vertical-align: middle; }
.nav-badge:empty { display: none; }

/* 农事日历 */
.cal-week { display: flex; background: #eef5ee; border-radius: 10px 10px 0 0; }
.cal-week span { flex: 1; text-align: center; padding: 8px 0; font-size: 12px; color: #6b8570; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); background: #fff; border-radius: 0 0 10px 10px; overflow: hidden; }
.cal-cell { min-height: 64px; border: 1px solid #f0f5f0; box-sizing: border-box; padding: 6px; position: relative; }
.cal-cell.out { background: #fafafa; color: #ccc; }
.cal-cell.has { background: #f6fbf6; cursor: pointer; }
.cal-cell.sel { outline: 2px solid #2e7d32; outline-offset: -2px; }
.cal-cell .cd { font-size: 13px; color: #2b3a2b; }
.cal-cell .cdot { position: absolute; top: 6px; right: 8px; width: 9px; height: 9px; border-radius: 50%; }
.cal-cell .cdot.orange { background: #fb8c00; }
.cal-cell .cdot.red { background: #e53935; }
.cal-cell .cdot.green { background: #43a047; }
.cal-cell .cc { position: absolute; bottom: 4px; right: 8px; font-size: 11px; color: #90a4ae; }
.cal-legend { display: flex; gap: 18px; justify-content: center; font-size: 12px; color: #789; margin: 10px 0; }
.cal-legend .cdot { display: inline-block; margin-right: 4px; vertical-align: middle; }
.mt { margin-top: 16px; }

/* 作物模板 */
.tip-bar { background: #eef6ee; color: #3a5a3a; padding: 12px 16px; border-radius: 10px; font-size: 13px; line-height: 1.7; margin-bottom: 16px; }
.tpl { background: #fff; border-radius: 12px; margin-bottom: 14px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.04); }
.tpl-head { display: flex; align-items: center; padding: 16px; cursor: pointer; }
.tpl-emoji { font-size: 26px; margin-right: 12px; }
.tpl-name { flex: 1; font-size: 16px; font-weight: 600; color: #1b3a1b; }
.tpl-name em { font-style: normal; font-size: 12px; color: #8aa; font-weight: 400; margin-left: 8px; }
.tpl-ct { font-size: 12px; color: #90a4ae; margin-right: 12px; }
.tpl-arrow { font-size: 22px; color: #b0c4b0; }
.tpl-stages { border-top: 1px solid #eef5ee; padding: 12px 16px; background: #fafdfa; }
.stg { padding: 7px 0; border-bottom: 1px dashed #e6f0e6; font-size: 13px; color: #2b3a2b; }
.stg b { color: #2e7d32; margin-right: 8px; }
.stg-note { color: #90a4ae; font-size: 12px; margin-left: 8px; }
.chk-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; max-height: 220px; overflow: auto; }
.chk { font-size: 13px; color: #2b3a2b; display: inline-flex; align-items: center; gap: 4px; }
.gen-est { font-size: 13px; color: #6b8570; margin-top: 10px; }

/* 记账统计：趋势对比条（红=收入 / 绿=支出，与全站记账配色一致） */
.bar-cell { width: 160px; }
.mini-bar { display: block; height: 7px; background: #f1f4f2; border-radius: 4px; overflow: hidden; margin: 2px 0; }
.mini-bar i { display: block; height: 7px; border-radius: 4px; min-width: 1px; }

/* 地块档案弹层：四个关键数 + 分类条 */
.pmeta { color: #6b7a72; font-size: 13px; margin-bottom: 10px; }
.pgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 6px; }
.pstat {
  background: #f6f9f7; border-radius: 8px; padding: 10px 8px; text-align: center;
}
.pstat b { display: block; font-size: 17px; color: #1f2d27; }
.pstat span { display: block; font-size: 12px; color: #6b7a72; margin-top: 2px; }
.psec { margin: 14px 0 6px; font-size: 13px; color: #4b5a52; font-weight: 600; }
.pbar { margin-top: 6px; }
.pbarrow { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 13px; }
.pbarrow .pname { flex: none; width: 88px; color: #4b5a52; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pbarrow .ptrack { flex: 1; height: 8px; background: #eef2ef; border-radius: 4px; overflow: hidden; }
.pbarrow .ptrack i { display: block; height: 8px; background: #2f7d46; border-radius: 4px; min-width: 2px; }
.pbarrow .pval { flex: none; width: 118px; text-align: right; color: #6b7a72; }
