/* ============================================================
   茸智云方仓种植管理平台 · 本地版  —— 界面样式
   设计语言：淡色现代（白底 + 薄荷青主色 + 细腻留白），告警用低饱和红橙
   ============================================================ */

:root {
  --bg: #f4f8f6;
  --bg-soft: #ffffff;
  --panel: #ffffff;
  --panel-2: #fbfdfc;
  --panel-hi: #eff6f3;
  --line: rgba(16, 56, 46, .09);
  --line-strong: rgba(16, 56, 46, .18);
  --text: #14302a;
  --muted: #5b756d;
  --dim: #90a69e;
  --accent: #0f9b8e;
  --accent-2: #2f80ed;
  --ok: #1aa06d;
  --warn: #d98514;
  --danger: #e05252;
  --purple: #7a6cf2;
  --radius: 12px;
  --shadow: 0 8px 24px rgba(20, 70, 58, .06);
  --shadow-lg: 0 18px 50px rgba(20, 70, 58, .10);
}

* { box-sizing: border-box; }

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

.num, .mono { font-family: "Bahnschrift", "DIN Alternate", "Consolas", monospace; font-variant-numeric: tabular-nums; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* ---------------- 登录页 ---------------- */
.login-page {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 520px at 16% 10%, rgba(15, 155, 142, .14), transparent 62%),
    radial-gradient(820px 620px at 84% 82%, rgba(47, 128, 237, .10), transparent 64%),
    linear-gradient(160deg, #f2fbf7 0%, #f7fbfa 48%, #eef4ff 100%);
}
.login-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(16, 56, 46, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 56, 46, .045) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 45%, #000 0%, transparent 78%);
}
.login-card {
  position: relative;
  width: 396px;
  padding: 34px 34px 24px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .94);
  border: 1px solid rgba(16, 56, 46, .12);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, .8);
  backdrop-filter: blur(8px);
}
.brand { display: flex; gap: 14px; align-items: center; margin-bottom: 26px; }
.brand-mark {
  width: 46px; height: 46px; border-radius: 12px;
  display: grid; place-items: center;
  font-size: 20px; font-weight: 700; letter-spacing: 1px;
  color: #ffffff;
  background: linear-gradient(145deg, #2ec4b0, #0f9b8e 60%, #2f80ed);
  box-shadow: 0 6px 18px rgba(15, 155, 142, .28);
}
.brand-mark.small { width: 34px; height: 34px; font-size: 15px; border-radius: 9px; }
.brand-text h1 { margin: 0 0 4px; font-size: 17px; letter-spacing: .5px; }
.brand-text p { margin: 0; font-size: 12px; color: var(--muted); }

.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.field input, select, input[type="text"], input[type="number"], input[type="date"], textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.field input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 155, 142, .14);
}
.remember-row { display: flex; align-items: center; gap: 8px; margin: -4px 0 14px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.remember-row input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.btn-primary {
  width: 100%;
  padding: 11px 14px;
  margin-top: 6px;
  border: 0;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .5px;
  color: #ffffff;
  background: linear-gradient(135deg, #18ab9c, #0f9b8e 60%, #2f80ed);
  box-shadow: 0 8px 20px rgba(15, 155, 142, .22);
  transition: transform .12s, box-shadow .18s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(15, 155, 142, .3); }
.btn-primary:active { transform: translateY(0); }
.login-hint { margin: 14px 0 0; font-size: 11.5px; color: var(--dim); text-align: center; }
.login-hint.err { color: var(--danger); }
.login-foot {
  margin-top: 22px; padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex; gap: 8px; justify-content: center;
  font-size: 11px; color: var(--dim);
}

/* ---------------- 主框架 ---------------- */
.shell { display: grid; grid-template-columns: 216px 1fr; min-height: 100vh; }

.sidenav {
  display: flex; flex-direction: column;
  padding: 16px 12px 12px;
  background: #ffffff;
  border-right: 1px solid var(--line);
}
.side-brand { display: flex; gap: 10px; align-items: center; padding: 0 6px 16px; }
.side-brand strong { display: block; font-size: 14px; letter-spacing: .4px; }
.side-brand em { font-style: normal; font-size: 10.5px; color: var(--dim); }

#nav { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
#nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 11px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  transition: background .15s, color .15s;
}
#nav a i { font-style: normal; width: 16px; text-align: center; color: var(--dim); font-size: 13px; }
#nav a:hover { background: rgba(15, 155, 142, .06); color: var(--text); }
#nav a.active {
  color: var(--accent);
  background: linear-gradient(90deg, rgba(15, 155, 142, .12), rgba(15, 155, 142, .02));
  box-shadow: inset 2px 0 0 var(--accent);
  font-weight: 600;
}
#nav a.active i { color: var(--accent); }
.nav-badge {
  margin-left: auto;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px;
  display: grid; place-items: center;
  font-style: normal; font-size: 11px;
  color: #ffffff;
  background: var(--danger);
  opacity: .25;
}
.nav-badge.on { opacity: 1; }

.side-foot { margin-top: auto; padding: 12px 6px 0; border-top: 1px solid var(--line); }
.side-user { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.link-quiet { font-size: 12px; color: var(--dim); }
.link-quiet:hover { color: var(--accent); }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 20;
}
.tb-left h2 { margin: 0; font-size: 17px; letter-spacing: .5px; }
.tb-sub { font-size: 11.5px; color: var(--dim); }
.tb-right { display: flex; align-items: center; gap: 10px; }
.pill {
  display: flex; align-items: baseline; gap: 7px;
  padding: 6px 11px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #ffffff;
}
.pill b { font-size: 15px; letter-spacing: .5px; }
.pill span { font-size: 11px; color: var(--dim); }
.pill.danger { border-color: rgba(224, 82, 82, .3); background: #fffafa; }
.pill.danger b { color: var(--danger); }
.pill.danger.hot { box-shadow: 0 0 0 1px rgba(224, 82, 82, .2), 0 6px 16px rgba(224, 82, 82, .12); }
.btn-ghost {
  padding: 7px 12px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  transition: .15s;
}
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }
.btn-ghost.danger:hover { border-color: var(--danger); color: var(--danger); }

.view { padding: 18px 22px 40px; }

/* ---------------- 通用面板 ---------------- */
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.panel-head h3 { margin: 0; font-size: 13.5px; letter-spacing: .3px; display: flex; align-items: center; gap: 8px; color: var(--text); }
.panel-head h3::before {
  content: ""; width: 3px; height: 13px; border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}
.panel-body { padding: 14px 16px; }
.panel-tools { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }

.sec-title { display: flex; align-items: baseline; gap: 10px; margin: 22px 0 12px; }
.sec-title h3 { margin: 0; font-size: 14px; }
.sec-title span { font-size: 11.5px; color: var(--dim); }

/* ---------------- KPI ---------------- */
.kpi-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.kpi {
  position: relative;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #ffffff;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.kpi::after {
  content: ""; position: absolute; right: -30px; top: -30px;
  width: 90px; height: 90px; border-radius: 50%;
  background: radial-gradient(circle, rgba(15, 155, 142, .10), transparent 70%);
}
.kpi label { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 6px; }
.kpi strong { font-size: 26px; font-weight: 600; letter-spacing: .5px; }
.kpi small { font-size: 11px; color: var(--dim); margin-left: 4px; }
.kpi.big strong { font-size: 32px; }
.kpi.big label { font-size: 12px; }
.kpi.accent strong { color: var(--accent); }
.kpi.warn strong { color: var(--warn); }
.kpi.danger strong { color: var(--danger); }
.kpi .bar { height: 3px; margin-top: 10px; border-radius: 2px; background: rgba(148, 163, 184, .12); overflow: hidden; }
.kpi .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

/* ---------------- 方仓网格 ---------------- */
.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 10px;
}
.room-tile {
  position: relative;
  padding: 11px 12px 9px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #ffffff;
  transition: transform .14s, border-color .18s, box-shadow .18s;
  cursor: pointer;
  overflow: hidden;
}
.room-tile::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--ok);
  opacity: .55;
}
.room-tile.lv2::before { background: var(--warn); opacity: 1; }
.room-tile.lv1::before { background: var(--danger); opacity: 1; }
.room-tile:hover { transform: translateY(-2px); border-color: rgba(15, 155, 142, .35); box-shadow: 0 12px 26px rgba(20, 70, 58, .10); }
.room-tile.flash { animation: flash 1.1s ease-in-out infinite; }
@keyframes flash { 0%, 100% { box-shadow: 0 0 0 0 rgba(224, 82, 82, .0); } 50% { box-shadow: 0 0 0 2px rgba(224, 82, 82, .28); } }

.rt-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.rt-code { font-size: 15px; font-weight: 600; letter-spacing: .5px; }
.rt-stage {
  font-size: 10.5px; padding: 2px 7px; border-radius: 20px;
  border: 1px solid var(--line-strong); color: var(--muted);
}
.rt-main { display: flex; align-items: baseline; gap: 6px; }
.rt-main b { font-size: 24px; font-weight: 600; letter-spacing: .5px; }
.rt-main b.lv1 { color: var(--danger); }
.rt-main b.lv2 { color: var(--warn); }
.rt-main span { font-size: 11px; color: var(--dim); }
.rt-sub { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.rt-sub em { font-style: normal; color: var(--dim); }
.rt-spark { margin-top: 6px; height: 22px; }
.rt-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; font-size: 10.5px; color: var(--dim); }
.rt-dot { display: inline-flex; align-items: center; gap: 4px; }
.rt-dot i { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.rt-dot.off i { background: var(--dim); box-shadow: none; }
.rt-fault { color: var(--warn); }

/* ---------------- 大屏布局 ---------------- */
.screen-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 14px;
  align-items: start;
}
.side-col { display: flex; flex-direction: column; gap: 14px; }

.alarm-feed { max-height: 380px; overflow: auto; }
.alarm-item {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 10px; align-items: center;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
}
.alarm-item:last-child { border-bottom: 0; }
.alarm-item .lv {
  font-size: 10px; text-align: center; padding: 2px 0; border-radius: 5px;
  background: rgba(224, 82, 82, .1); color: var(--danger);
}
.alarm-item .lv.l2 { background: rgba(217, 133, 20, .12); color: var(--warn); }
.alarm-item .lv.l3 { background: rgba(47, 128, 237, .1); color: var(--accent-2); }
.alarm-item .txt { font-size: 12px; line-height: 1.45; color: var(--text); }
.alarm-item .txt em { display: block; font-style: normal; font-size: 10.5px; color: var(--dim); margin-top: 2px; }
.alarm-empty { padding: 26px; text-align: center; color: var(--dim); font-size: 12px; }
tr.alarm-detail { display: none; background: #f6faf9; }
tr.alarm-detail.on { display: table-row; }
.alarm-guide { padding: 10px 14px; display: grid; gap: 8px; }
.ag-row { display: grid; grid-template-columns: 72px 1fr; gap: 10px; font-size: 12px; }
.ag-row span { color: var(--dim); }
.ag-row b { font-weight: 500; color: var(--text); line-height: 1.5; }

.event-feed { max-height: 240px; overflow: auto; }
.event-item { display: flex; gap: 8px; padding: 7px 14px; font-size: 11.5px; color: var(--muted); border-bottom: 1px solid var(--line); }
.event-item b { color: var(--accent); font-weight: 500; }
.event-item span { margin-left: auto; color: var(--dim); white-space: nowrap; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data thead th {
  position: sticky; top: 0;
  text-align: left; font-weight: 500;
  color: var(--muted);
  padding: 9px 12px;
  background: #f3f8f6;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data tbody td { padding: 9px 12px; border-bottom: 1px solid var(--line); color: var(--text); white-space: nowrap; }
table.data tbody tr:hover { background: rgba(15, 155, 142, .04); }
table.data tbody tr.clickable { cursor: pointer; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 11px; border: 1px solid var(--line-strong); color: var(--muted); }
.tag.ok { color: var(--ok); border-color: rgba(52, 211, 153, .4); background: rgba(52, 211, 153, .08); }
.tag.warn { color: var(--warn); border-color: rgba(251, 191, 36, .4); background: rgba(251, 191, 36, .08); }
.tag.danger { color: var(--danger); border-color: rgba(248, 113, 113, .4); background: rgba(248, 113, 113, .08); }
.tag.info { color: var(--accent-2); border-color: rgba(56, 189, 248, .4); background: rgba(56, 189, 248, .08); }

/* ---------------- 单仓详情 ---------------- */
.room-hero { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: start; }
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.metric {
  padding: 12px 14px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #ffffff;
  box-shadow: var(--shadow);
}
.metric .mh { display: flex; align-items: baseline; justify-content: space-between; }
.metric .mh label { font-size: 11.5px; color: var(--muted); }
.metric .mh em { font-style: normal; font-size: 10.5px; color: var(--dim); }
.metric .mv { font-size: 27px; font-weight: 600; margin: 2px 0 6px; letter-spacing: .5px; }
.metric .mv small { font-size: 12px; color: var(--dim); margin-left: 3px; }
.metric .mv.bad { color: var(--danger); }
.metric .mv.warnv { color: var(--warn); }
.track { position: relative; height: 5px; border-radius: 3px; background: rgba(16, 56, 46, .08); }
.track .band { position: absolute; top: 0; bottom: 0; background: rgba(26, 160, 109, .2); border-radius: 3px; }
.track .pin { position: absolute; top: -3px; width: 3px; height: 11px; border-radius: 2px; background: var(--accent); }
.metric .mfoot { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--dim); margin-top: 8px; }

.device-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.device-card {
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f9fbfa;
  display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center;
}
.device-card.on { border-color: rgba(15, 155, 142, .35); background: rgba(15, 155, 142, .06); }
.device-card.offline { border-color: rgba(192, 48, 43, .6); background: rgba(192, 48, 43, .06); }
.device-card.offline .dc-meta { color: #c0302b; font-weight: 600; }
.dc-name { font-size: 12.5px; margin-bottom: 3px; }
.dc-meta { font-size: 10.5px; color: var(--dim); }
.dc-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }

.switch {
  position: relative; width: 44px; height: 24px; border-radius: 14px;
  border: 1px solid var(--line-strong); background: rgba(16, 56, 46, .08);
  transition: .18s; padding: 0;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #b9c8c2; transition: .18s;
}
.switch.on { background: rgba(15, 155, 142, .22); border-color: var(--accent); }
.switch.on::after { left: 23px; background: var(--accent); }
.switch:disabled { opacity: .45; cursor: not-allowed; }

.mode-switch { display: flex; gap: 0; border: 1px solid var(--line-strong); border-radius: 9px; overflow: hidden; background: #fff; }
.mode-switch button { padding: 8px 16px; border: 0; background: transparent; color: var(--muted); font-size: 12px; }
.mode-switch button.on { background: rgba(15, 155, 142, .12); color: var(--accent); font-weight: 600; }

/* ---------------- 图表 ---------------- */
.chart-card { position: relative; }
.chart-box { position: relative; width: 100%; height: 260px; }
.chart-box canvas { width: 100%; height: 100%; display: block; }
.report-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.chart-cap { font-size: 11px; color: var(--muted); letter-spacing: .06em; margin-bottom: 6px; }
.panel-note { font-size: 11px; color: var(--dim); line-height: 1.7; padding: 0 18px 14px; }
.chart-legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--muted); }
.chart-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }

/* ---------------- 红外采收 ---------------- */
.ir-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 14px; align-items: start; }
.thermal-wrap { position: relative; border-radius: var(--radius); overflow: hidden; background: #05080e; }
.thermal-wrap canvas { width: 100%; display: block; cursor: crosshair; }
.thermal-hud {
  position: absolute; left: 12px; top: 12px;
  font-size: 11px; color: #dbe7f3;
  text-shadow: 0 1px 3px #000;
  line-height: 1.6;
  pointer-events: none;
}
.thermal-hud b { font-size: 13px; }
.thermal-scale {
  position: absolute; right: 10px; top: 12px; bottom: 12px; width: 12px;
  border-radius: 6px; overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .18);
}
.thermal-readout {
  position: absolute; padding: 3px 6px; border-radius: 5px;
  background: rgba(3, 8, 14, .82); border: 1px solid rgba(148, 163, 184, .3);
  font-size: 11px; color: #e9f2fb; pointer-events: none; transform: translate(10px, -50%);
  white-space: nowrap;
}
.ir-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.palette-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.palette-btns button {
  padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: #ffffff; color: var(--muted); font-size: 11.5px;
}
.palette-btns button.on { border-color: var(--accent); color: var(--accent); background: rgba(15, 155, 142, .09); font-weight: 600; }
.stat-line { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid rgba(148, 163, 184, .08); font-size: 12px; }
.stat-line span { color: var(--muted); }
.stat-line b { font-size: 15px; }
.maturity-ring { position: relative; width: 132px; height: 132px; margin: 6px auto 2px; }
.maturity-ring canvas { width: 132px; height: 132px; }
.maturity-ring .val { position: absolute; inset: 0; display: grid; place-items: center; }
.maturity-ring .val b { font-size: 30px; }
.maturity-ring .val small { display: block; text-align: center; font-size: 10.5px; color: var(--dim); }
.blob-list { max-height: 210px; overflow: auto; }
.blob-row { display: grid; grid-template-columns: 34px 1fr 64px 48px; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid rgba(148, 163, 184, .07); font-size: 11.5px; }
.blob-row .idx { color: var(--dim); }
.blob-row .mini { height: 4px; border-radius: 2px; background: rgba(148, 163, 184, .12); overflow: hidden; }
.blob-row .mini i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }

/* ---------------- 表单与列表 ---------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }
label.small { font-size: 11.5px; color: var(--muted); display: block; margin-bottom: 5px; }

.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filters select, .filters input { width: auto; min-width: 120px; padding: 6px 9px; font-size: 12px; }

.empty { padding: 34px; text-align: center; color: var(--dim); font-size: 12.5px; }

/* ---------------- 提示 ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  padding: 10px 18px; border-radius: 10px;
  background: #ffffff;
  border: 1px solid rgba(15, 155, 142, .35);
  color: var(--text); font-size: 12.5px;
  box-shadow: 0 14px 34px rgba(20, 70, 58, .16);
  opacity: 0; pointer-events: none; transition: .22s;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: rgba(224, 82, 82, .45); color: var(--danger); }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1320px) {
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
  .screen-grid { grid-template-columns: 1fr; }
  .ir-grid { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidenav { flex-direction: row; flex-wrap: wrap; gap: 6px; position: static; }
  #nav { flex-direction: row; flex-wrap: wrap; }
  .side-foot { display: none; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar { flex-direction: column; align-items: flex-start; }
}

/* ---------------- 统一输入控件（含表格内联输入） ---------------- */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
select, textarea {
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  font-family: inherit;
  outline: none;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):focus,
select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 155, 142, .12);
}
table.data input { width: 74px; padding: 5px 7px; font-size: 12.5px; }
table.data input.num { text-align: right; }

/* ============================================================
   增强视图：数字孪生 / 智能农事 / 智能分析 / 数据中台
   ============================================================ */
.adv-kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }

/* ---- 通用小部件 ---- */
.hdr-meta { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.hdr-meta b { color: var(--text); }
.chip {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 11px; border: 1px solid var(--line-strong); color: var(--muted);
  line-height: 1.5;
}
.legend { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); }
.legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.legend-row { display: flex; gap: 14px; margin-top: 8px; justify-content: center; }
.live-dot {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--ok);
}
.live-dot::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok);
  animation: livePulse 1.6s ease-in-out infinite;
}
@keyframes livePulse { 0%, 100% { opacity: .35; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.1); } }
.progress { flex: 1; height: 6px; border-radius: 4px; background: rgba(16, 56, 46, .07); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 4px; }
.hstat { display: grid; grid-template-columns: 1fr 88px 62px; gap: 10px; align-items: center; padding: 6px 0; font-size: 11.5px; }
.hstat span { color: var(--muted); }
.hstat b { text-align: right; font-size: 12px; }
.btn-mini {
  padding: 3px 9px; border-radius: 7px; border: 1px solid rgba(15, 155, 142, .4);
  background: rgba(15, 155, 142, .08); color: var(--accent); font-size: 11px;
}
.btn-mini:hover { background: rgba(15, 155, 142, .16); }
.link-inline { color: var(--accent); }
.kv-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kv-grid.one { grid-template-columns: 1fr; }
.kv {
  padding: 8px 10px; border-radius: 9px; background: #f7faf9; border: 1px solid var(--line);
}
.kv span { display: block; font-size: 10.5px; color: var(--dim); margin-bottom: 2px; }
.kv b { font-size: 15px; font-weight: 600; }
.kv b small { font-size: 10.5px; color: var(--var-dim, #90a69e); font-weight: 400; }
.kv-note { margin-top: 10px; font-size: 11px; color: var(--dim); line-height: 1.7; }

/* ---- 数字孪生 ---- */
.twin-layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 14px; align-items: start; }
.twin-left { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.twin-side { position: sticky; top: 14px; }
.twin-canvas-wrap { padding: 12px; }
.twin-canvas-wrap canvas { width: 100%; display: block; border-radius: 10px; }
.twin-section-wrap { padding: 10px 12px 2px; }
.twin-section-wrap canvas { width: 100%; display: block; }
.dev-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.device-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 20px; font-size: 11px;
  border: 1px solid var(--line); color: var(--dim); background: #fff;
}
.device-chip i { width: 6px; height: 6px; border-radius: 50%; background: #c3d2cd; }
.device-chip.on { color: var(--accent); border-color: rgba(15, 155, 142, .35); background: rgba(15, 155, 142, .06); }
.device-chip.on i { background: var(--accent); }
.gw-strip { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; padding: 14px 16px; }
.gw-card { border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px; background: #fbfdfc; }
.gw-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 3px; }
.gw-head b { font-size: 12.5px; }
.gw-meta { font-size: 10px; color: var(--dim); margin-bottom: 6px; }
.gw-bars { display: flex; gap: 2px; align-items: flex-end; height: 14px; margin-bottom: 6px; }
.gw-bars i { flex: 1; background: #e3ece8; border-radius: 1px; height: 6px; }
.gw-bars i.on { background: linear-gradient(180deg, #2ec4b0, #0f9b8e); height: 14px; }
.gw-foot { font-size: 10px; color: var(--muted); line-height: 1.5; }

/* ---- 智能农事 ---- */
.flow-strip {
  display: flex; align-items: stretch; gap: 8px; margin-bottom: 14px;
  padding: 12px 14px; border-radius: var(--radius);
  border: 1px solid var(--line); background: linear-gradient(90deg, #f7fbfa, #f4f8ff 70%, #f7fbfa);
}
.flow-node { flex: 1; padding: 8px 12px; border-radius: 9px; background: #fff; border: 1px solid var(--line); }
.flow-node b { display: block; font-size: 12.5px; color: var(--accent); margin-bottom: 3px; }
.flow-node span { font-size: 10.5px; color: var(--muted); line-height: 1.5; }
.flow-arrow { display: grid; place-items: center; color: var(--dim); font-size: 14px; }
.adv-split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
.adv-split.wide-right { grid-template-columns: minmax(0, 1fr) 320px; }
.side-stack { display: flex; flex-direction: column; gap: 14px; }
.rule-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 14px 16px; }
.rule-card {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  background: linear-gradient(180deg, #ffffff, #fbfdfc);
  transition: border-color .15s, box-shadow .15s;
}
.rule-card:hover { border-color: rgba(15, 155, 142, .3); box-shadow: 0 8px 20px rgba(20, 70, 58, .07); }
.rule-card.off { opacity: .55; }
.rule-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.rule-pri { font-size: 10px; color: var(--dim); }
.mini-switch { margin-left: auto; position: relative; width: 30px; height: 17px; }
.mini-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.mini-switch i { position: absolute; inset: 0; border-radius: 10px; background: #dfe8e4; transition: .16s; }
.mini-switch i::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px;
  border-radius: 50%; background: #fff; transition: .16s; box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
}
.mini-switch input:checked + i { background: rgba(15, 155, 142, .55); }
.mini-switch input:checked + i::after { left: 15px; }
.rule-name { font-size: 12.5px; font-weight: 600; margin-bottom: 5px; }
.rule-cond { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.rule-cond code {
  font-family: "Consolas", monospace; font-size: 10.5px;
  background: #f1f6f4; padding: 1px 5px; border-radius: 4px; color: #0b6f66;
}
.rule-cond.sub { font-size: 10.5px; color: var(--dim); line-height: 1.55; }
.rule-act { font-size: 11px; color: var(--text); margin: 6px 0; line-height: 1.55; }
.rule-foot {
  display: flex; justify-content: space-between; font-size: 10px; color: var(--dim);
  border-top: 1px dashed var(--line); padding-top: 5px;
}
.queue-list { padding: 8px 0; max-height: 260px; overflow: auto; }
.queue-row {
  display: grid; grid-template-columns: 62px 44px 1fr auto; gap: 8px; align-items: center;
  padding: 6px 14px; font-size: 11.5px;
}
.queue-time { color: var(--dim); font-size: 11px; }
.queue-room { font-weight: 600; }
.queue-name { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot-cat { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 6px; }

/* ---- 智能分析 ---- */
.tabs { display: flex; gap: 6px; align-items: center; margin-bottom: 14px; }
.tab-btn {
  padding: 8px 16px; border-radius: 9px; border: 1px solid var(--line);
  background: #fff; color: var(--muted); font-size: 12.5px;
}
.tab-btn.on { border-color: rgba(15, 155, 142, .45); color: var(--accent); background: rgba(15, 155, 142, .07); font-weight: 600; }
.tab-note { margin-left: auto; font-size: 10.5px; color: var(--dim); }
.score-cell { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.score-cell b { font-size: 13px; width: 34px; }
.grade-badge {
  display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 600;
}
.grade-badge.ga { color: #12734f; background: rgba(26, 160, 109, .12); border: 1px solid rgba(26, 160, 109, .3); }
.grade-badge.gb { color: #a1660c; background: rgba(217, 133, 20, .12); border: 1px solid rgba(217, 133, 20, .3); }
.grade-badge.gc { color: #b93a3a; background: rgba(224, 82, 82, .1); border: 1px solid rgba(224, 82, 82, .3); }
.model-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: 14px; }
.model-card {
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
  padding: 14px 16px; box-shadow: var(--shadow);
}
.model-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.model-status {
  font-size: 10.5px; padding: 2px 8px; border-radius: 20px;
  color: #12734f; background: rgba(26, 160, 109, .1); border: 1px solid rgba(26, 160, 109, .25);
}
.model-name { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.model-task { font-size: 11px; color: var(--muted); margin-bottom: 10px; }
.model-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.model-metrics div { background: #f7faf9; border-radius: 8px; padding: 6px 8px; }
.model-metrics span { display: block; font-size: 9.5px; color: var(--dim); }
.model-metrics b { font-size: 12.5px; }
.model-note { font-size: 10.5px; color: var(--dim); line-height: 1.6; margin-top: 10px; }
.model-foot { font-size: 10px; color: var(--dim); margin-top: 8px; padding-top: 6px; border-top: 1px dashed var(--line); }
.fc-hero { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.fc-hero b { display: block; font-size: 22px; }
.fc-arrow { color: var(--dim); font-size: 16px; }
.method-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; font-size: 11.5px; line-height: 1.7; color: var(--muted); }
.method-grid b { display: block; color: var(--text); font-size: 12.5px; margin-bottom: 4px; }
.heat-wrap { padding: 12px 16px 14px; }
.heat-row { display: grid; grid-template-columns: 40px repeat(22, 1fr); gap: 4px; align-items: center; margin-bottom: 4px; }
.heat-label { font-size: 10.5px; color: var(--muted); }
.heat-cell {
  display: grid; place-items: center; height: 26px; border-radius: 5px;
  font-size: 10px; font-style: normal; color: #10302a; cursor: default;
  transition: transform .12s;
}
.heat-cell:hover { transform: scale(1.06); box-shadow: 0 4px 12px rgba(20, 70, 58, .12); }
.heat-codes { margin-top: 2px; }
.heat-code { font-size: 9px; font-style: normal; color: var(--dim); text-align: center; }

/* ---- 数据中台 ---- */
.dc-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 14px; align-items: start; }
.dc-table-list { max-height: 640px; overflow: auto; padding: 6px; }
.table-item { padding: 8px 10px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; }
.table-item:hover { background: rgba(15, 155, 142, .05); }
.table-item.on { background: rgba(15, 155, 142, .09); border-color: rgba(15, 155, 142, .3); }
.ti-name { font-size: 12px; font-family: "Consolas", monospace; }
.ti-meta { font-size: 10px; color: var(--dim); margin-top: 2px; }
.sql-box {
  width: 100%; min-height: 96px; resize: vertical;
  font-family: "Consolas", "Courier New", monospace; font-size: 12px; line-height: 1.65;
  padding: 10px 12px; background: #fbfdfc;
}
.sql-hint { font-size: 10.5px; color: var(--dim); margin-top: 6px; }
.dict-desc { font-size: 11.5px; color: var(--muted); margin-bottom: 10px; }
.dict-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.dict-item { border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; background: #fbfdfc; }
.dict-item b { font-size: 11.5px; font-family: "Consolas", monospace; }
.dict-item span { font-size: 10px; color: var(--dim); margin-left: 6px; }
.dict-item em { display: block; font-style: normal; font-size: 10.5px; color: var(--muted); margin-top: 2px; }

@media (max-width: 1500px) {
  .rule-grid { grid-template-columns: repeat(2, 1fr); }
  .gw-strip { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1200px) {
  .twin-layout, .adv-split, .dc-layout { grid-template-columns: 1fr; }
  .dict-grid { grid-template-columns: repeat(2, 1fr); }
}
/* ---- 窄窗与文字换行兜底（浅色版收尾） ---- */
.tab-btn { white-space: nowrap; }
.panel-head h3 { white-space: nowrap; }
.panel-head .tb-sub { min-width: 0; }
.legend-row .legend { white-space: nowrap; }
.grade-badge, .chip, .hstat-label { white-space: nowrap; }
@media (max-width: 900px) {
  .adv-kpi-row { grid-template-columns: repeat(2, 1fr); }
  .panel-head { flex-wrap: wrap; gap: 4px; }
}@media (max-width: 1200px) {
  .adv-split, .adv-split.wide-right, .adv-split.wide-left { grid-template-columns: minmax(0, 1fr); }
}
/* ---------------- 产品化增补 ---------------- */
.login-badge {
  margin: 14px auto 0; width: fit-content; padding: 5px 14px; border-radius: 999px;
  font-size: 12px; letter-spacing: .5px; color: #8a6d1f;
  background: linear-gradient(135deg, #f7ecd0, #f3e3b6); border: 1px solid #e7d39a;
}
.login-copy { margin-top: 10px; font-size: 10.5px; color: var(--dim); text-align: center; line-height: 1.7; }
.side-badge {
  margin: 0 6px 10px; padding: 6px 10px; border-radius: 8px; font-size: 11px; text-align: center;
  color: #8a6d1f; background: #f7ecd0; border: 1px solid #e7d39a;
}
.side-copy { margin-top: 8px; font-size: 10px; color: var(--dim); line-height: 1.6; }
.mini-select {
  padding: 5px 8px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: #fff; color: var(--text); font-size: 12px; outline: none;
}
.room-tile { position: relative; }
.tile-remove {
  position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; border-radius: 6px;
  border: 1px solid var(--line-strong); background: #fff; color: var(--muted);
  font-size: 14px; line-height: 1; cursor: pointer;
}
.tile-remove:hover { color: var(--danger); border-color: var(--danger); }
.ledger-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.ledger-form input, .ledger-form select {
  padding: 8px 10px; border-radius: 9px; border: 1px solid var(--line-strong);
  background: #fff; color: var(--text); font-size: 13px; outline: none;
}
.ledger-form .btn-primary { width: auto; margin-top: 0; padding: 9px 16px; }
.cert-row { display: flex; gap: 14px; margin-top: 12px; flex-wrap: wrap; }
.cert-row figure { margin: 0; width: 150px; }
.cert-row img { width: 150px; height: auto; border: 1px solid var(--line); border-radius: 8px; }
.cert-row figcaption { margin-top: 6px; font-size: 10.5px; color: var(--muted); line-height: 1.6; }
