:root {
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  color: #0f172a;
  background: #f4f8f6;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: #f4f8f6; color: #0f172a; }
button, input { font: inherit; }
a { color: inherit; }

.platform-nav {
  position: fixed;
  top: 18px;
  right: 24px;
  z-index: 1000;
  display: flex;
  gap: 8px;
  padding: 5px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 16px;
  background: rgba(4,42,31,.62);
  box-shadow: 0 10px 30px rgba(0,0,0,.16);
  backdrop-filter: blur(14px);
}
.platform-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 11px;
  color: #d1fae5;
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
  transition: .2s ease;
}
.platform-nav a:hover { background: rgba(255,255,255,.12); color: white; }
.platform-nav a.active { background: #fff; color: #065f46; box-shadow: 0 4px 14px rgba(0,0,0,.12); }

.page { min-height: 100vh; }
.hero {
  min-height: 425px;
  padding: 78px 28px 42px;
  color: white;
  background:
    linear-gradient(105deg, rgba(2,44,32,.92), rgba(4,90,65,.72), rgba(3,64,48,.42)),
    url('/static/smart-agri-2/hero-bg.jpg') center/cover no-repeat;
}
.hero-inner { width: min(1280px, 100%); margin: 0 auto; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid rgba(167,243,208,.28);
  border-radius: 999px;
  background: rgba(3,40,30,.44);
  color: #d1fae5;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
}
.eyebrow::before { content:""; width:8px; height:8px; border-radius:50%; background:#34d399; box-shadow:0 0 12px #34d399; }
.hero h1 { margin: 22px 0 10px; font-size: clamp(34px, 5vw, 58px); line-height: 1.05; letter-spacing: -1.4px; }
.hero .sub { max-width: 760px; margin: 0; color: #d9f6e9; font-size: 15px; line-height: 1.8; font-weight: 600; }
.hero-status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 14px;
  margin-top: 34px;
}
.hero-status {
  padding: 18px 20px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 19px;
  background: rgba(3,40,30,.55);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.hero-status .label { color:#d1fae5; font-size:12px; font-weight:700; margin-bottom:7px; }
.hero-status .value { font-size:20px; font-weight:900; }
.hero-status .value.good { color:#fff; }
.hero-status .value.warn { color:#fbbf24; }

.content { width: min(1280px, calc(100% - 48px)); margin: -32px auto 0; padding-bottom: 70px; position: relative; z-index: 2; }
.section { margin-top: 24px; }
.section-head { display:flex; justify-content:space-between; gap:16px; align-items:end; margin: 0 2px 14px; }
.section-head h2 { margin:0; font-size:22px; letter-spacing:-.4px; }
.section-head p { margin:4px 0 0; color:#64748b; font-size:12px; font-weight:600; }

.site-grid { display:grid; grid-template-columns: 1.25fr 1fr 1fr; gap:18px; }
.site-card {
  overflow: hidden;
  background:#fff;
  border:1px solid rgba(226,232,240,.9);
  border-radius:28px;
  box-shadow:0 18px 42px -24px rgba(15,76,61,.28);
}
.site-card.main { border-color: rgba(167,243,208,.85); }
.site-card-head { padding:22px 24px 16px; display:flex; justify-content:space-between; align-items:center; }
.site-title { display:flex; gap:12px; align-items:center; }
.site-dot { width:12px; height:12px; border-radius:50%; background:#10b981; box-shadow:0 0 0 6px rgba(16,185,129,.08); }
.site-title h3 { margin:0; font-size:18px; }
.site-title small { display:block; color:#94a3b8; margin-top:3px; font-size:10px; font-weight:700; }
.pump-badge { padding:7px 10px; border-radius:999px; font-size:11px; font-weight:900; background:#f1f5f9; color:#64748b; }
.pump-badge.on { background:#dcfce7; color:#047857; }
.metrics { padding: 0 22px 22px; display:grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap:10px; }
.site-card.main .metrics { grid-template-columns: repeat(3,minmax(0,1fr)); }
.metric { padding:15px; border-radius:17px; background:#f8fafc; border:1px solid #f1f5f9; min-height:82px; }
.metric .m-label { color:#64748b; font-size:11px; font-weight:750; }
.metric .m-value { margin-top:6px; font-size:23px; font-weight:900; letter-spacing:-.5px; }
.metric .m-unit { color:#94a3b8; font-size:10px; font-weight:700; margin-left:3px; }
.soil-box { margin:0 22px 22px; padding:18px; border-radius:18px; background:linear-gradient(145deg,#f0fdf4,#f8fffc); border:1px solid #bbf7d0; }
.soil-row { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.soil-row + .soil-row { margin-top:9px; }
.soil-row span { color:#64748b; font-size:12px; font-weight:700; }
.soil-row strong { font-size:15px; }
.soil-progress { height:8px; border-radius:999px; background:#e2e8f0; overflow:hidden; margin-top:12px; }
.soil-progress > div { height:100%; border-radius:inherit; background:linear-gradient(90deg,#059669,#34d399); transition:width .3s ease; }
.soil-progress.dry > div { background:linear-gradient(90deg,#d97706,#fbbf24); }

.control-grid { display:grid; grid-template-columns: 1.2fr 1fr; gap:18px; }
.panel { background:#fff; border:1px solid rgba(226,232,240,.9); border-radius:28px; padding:26px; box-shadow:0 18px 42px -26px rgba(15,76,61,.25); }
.panel-title-row { display:flex; justify-content:space-between; align-items:center; gap:14px; margin-bottom:18px; }
.panel h3 { margin:0; font-size:19px; }
.panel .hint { color:#94a3b8; font-size:11px; font-weight:650; margin-top:4px; }
.mode-controls { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:14px; padding:12px 14px; border-radius:15px; background:#f0fdf4; border:1px solid #bbf7d0; }
.mode-status { color:#475569; font-size:12px; }
.mode-status strong { color:#0f172a; }
.mode-buttons { display:flex; gap:8px; }
.pump-controls { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.pump-card { padding:18px; border-radius:18px; background:#f8fafc; border:1px solid #e2e8f0; }
.pump-card strong { display:block; font-size:14px; margin-bottom:5px; }
.pump-card small { display:block; color:#64748b; font-size:10px; line-height:1.5; min-height:30px; }
.toggle-btn { width:100%; margin-top:13px; height:38px; border:0; border-radius:11px; cursor:pointer; font-size:12px; font-weight:900; background:#0f172a; color:white; transition:.2s ease; }
.toggle-btn.on { background:#ef4444; }
.toggle-btn:disabled { opacity:.55; cursor:wait; }

.threshold-list { display:grid; gap:10px; }
.threshold-item { display:grid; grid-template-columns: 1fr 90px 28px 112px; align-items:center; gap:10px; padding:13px 14px; border-radius:15px; background:#f8fafc; border:1px solid #f1f5f9; }
.threshold-item label { color:#475569; font-size:12px; font-weight:750; }
.threshold-item input { width:90px; padding:8px 10px; border:1px solid #cbd5e1; border-radius:10px; text-align:center; color:#0f172a; font-weight:850; outline:none; background:white; }
.threshold-item .unit { color:#94a3b8; font-size:11px; font-weight:700; }
.threshold-send { min-width:112px; white-space:nowrap; }
.btn-row { display:flex; gap:10px; margin-top:14px; }
.btn { height:40px; padding:0 16px; border-radius:11px; border:1px solid #cbd5e1; background:white; color:#475569; cursor:pointer; font-size:12px; font-weight:850; }
.btn.primary { border:0; background:#10b981; color:white; }
.btn.dark { border:0; background:#0f172a; color:white; }
.btn:disabled { opacity:.55; cursor:wait; }
.source-note { margin-top:12px; padding:10px 12px; border-radius:12px; background:#ecfdf5; color:#047857; font-size:10px; line-height:1.6; font-weight:700; }

.chart-panel { background:#fff; border:1px solid rgba(226,232,240,.9); border-radius:28px; padding:26px; box-shadow:0 18px 42px -26px rgba(15,76,61,.25); }
.chart-wrap { min-height:300px; border-radius:18px; background:#f8fafc; border:1px solid #f1f5f9; padding:14px; }
.chart-legend { display:flex; gap:18px; flex-wrap:wrap; margin-bottom:10px; }
.legend-item { display:flex; align-items:center; gap:7px; color:#64748b; font-size:11px; font-weight:800; }
.legend-swatch { width:20px; height:3px; border-radius:999px; background:#0f766e; }
.legend-swatch.s2 { background:#0284c7; }
.legend-swatch.s3 { background:#d97706; }
#soilChart { width:100%; height:260px; display:block; }

.logs { width:100%; min-height:145px; resize:vertical; padding:16px; border:1px solid #cbd5e1; border-radius:15px; background:#f8fafc; color:#334155; font:12px/1.7 Consolas, Monaco, monospace; outline:none; }

.toast { position:fixed; left:50%; bottom:24px; transform:translate(-50%,20px); z-index:2000; padding:12px 16px; border-radius:12px; background:#0f172a; color:#fff; font-size:12px; font-weight:800; opacity:0; pointer-events:none; transition:.25s ease; box-shadow:0 14px 34px rgba(0,0,0,.2); }
.toast.show { opacity:1; transform:translate(-50%,0); }
.toast.error { background:#991b1b; }

@media (max-width: 1000px) {
  .hero-status-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .site-grid { grid-template-columns:1fr; }
  .site-card.main .metrics { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .control-grid { grid-template-columns:1fr; }
}
@media (max-width: 680px) {
  .platform-nav { top:10px; right:10px; left:10px; overflow-x:auto; justify-content:flex-end; }
  .platform-nav a { white-space:nowrap; font-size:11px; min-height:34px; padding:0 10px; }
  .hero { padding:76px 16px 36px; min-height:480px; }
  .hero-status-grid { grid-template-columns:1fr 1fr; }
  .content { width:min(100% - 24px, 1280px); }
  .site-card.main .metrics, .metrics { grid-template-columns:1fr 1fr; }
  .pump-controls { grid-template-columns:1fr; }
  .threshold-item { grid-template-columns: 1fr 78px 24px 104px; }
  .threshold-item input { width:78px; }
  .threshold-send { min-width:104px; }
  .panel, .chart-panel { padding:18px; border-radius:22px; }
}


/* ============================================================
   Smart-Agri-2 自动化中心（参考智慧农业1的清爽卡片式设计）
   ============================================================ */
.automation-center {
  padding: 28px;
  border: 1px solid #d8f3e7;
  border-radius: 30px;
  background: linear-gradient(145deg, #effcf7 0%, #f7fffb 58%, #ffffff 100%);
  box-shadow: 0 20px 48px -28px rgba(5, 109, 79, .26);
}
.automation-center-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}
.automation-heading-line { display:flex; align-items:center; gap:10px; }
.automation-heading-line h2 { margin:0; font-size:22px; color:#065f46; letter-spacing:-.3px; }
.automation-gear { font-size:21px; filter:saturate(.9); }
.automation-center-head p { margin:5px 0 0 31px; color:#6b8f83; font-size:12px; font-weight:650; }
.automation-refresh-btn {
  height: 38px;
  padding: 0 15px;
  border: 1px solid #bdebd8;
  border-radius: 11px;
  background: rgba(255,255,255,.85);
  color: #047857;
  cursor: pointer;
  font-size: 12px;
  font-weight: 850;
}
.automation-refresh-btn:hover { background:#fff; transform:translateY(-1px); }

.automation-device-grid {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 16px;
}
.automation-device-card {
  position: relative;
  min-height: 214px;
  padding: 22px;
  border: 1px solid #dfeee8;
  border-radius: 23px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 12px 30px -24px rgba(15,76,61,.32);
  transition: .22s ease;
}
.automation-device-card:hover { transform:translateY(-2px); box-shadow:0 18px 34px -24px rgba(15,76,61,.36); }
.automation-device-card.running { border-color:#a7f3d0; box-shadow:0 16px 34px -25px rgba(5,150,105,.45); }
.automation-device-top { display:flex; justify-content:space-between; align-items:center; }
.automation-icon { font-size:34px; line-height:1; }
.automation-live-dot { width:9px; height:9px; border-radius:50%; background:#cbd5e1; box-shadow:0 0 0 5px rgba(203,213,225,.18); }
.automation-live-dot.on { background:#10b981; box-shadow:0 0 0 5px rgba(16,185,129,.12), 0 0 12px rgba(16,185,129,.7); }
.automation-device-card h4 { margin:16px 0 5px; font-size:17px; color:#064e3b; }
.automation-status { color:#059669; font-size:13px; font-weight:850; }
.automation-status.on { color:#047857; }
.automation-meta { margin-top:7px; color:#7c928b; font-size:11px; font-weight:650; }
.automation-meta span { margin:0 4px; color:#bbcec7; }
.automation-card-actions { display:flex; gap:8px; margin-top:16px; }
.auto-mini-btn {
  min-width:64px;
  height:36px;
  padding:0 13px;
  border:0;
  border-radius:11px;
  background:#d1fae5;
  color:#065f46;
  cursor:pointer;
  font-size:12px;
  font-weight:900;
  transition:.18s ease;
}
.auto-mini-btn:hover { transform:translateY(-1px); background:#bbf7d0; }
.auto-mini-btn.start.active { background:#10b981; color:white; }
.auto-mini-btn.stop.active { background:#ecfdf5; color:#047857; box-shadow:inset 0 0 0 1px #a7f3d0; }
.auto-mini-btn.settings { background:#e6f8f1; }
.auto-mini-btn:disabled { opacity:.55; cursor:wait; transform:none; }

.automation-current-plans {
  margin-top:20px;
  padding:18px 20px;
  border:1.5px dashed #86efac;
  border-radius:18px;
  background:rgba(255,255,255,.68);
}
.automation-plan-head { display:flex; justify-content:space-between; align-items:center; gap:14px; margin-bottom:12px; }
.automation-plan-head > div { display:flex; flex-direction:column; gap:3px; }
.automation-plan-head strong { color:#0f513c; font-size:14px; }
.automation-plan-head span { color:#7b938a; font-size:10px; font-weight:650; }
.automation-plan-count { padding:6px 9px; border-radius:999px; background:#dcfce7; color:#047857 !important; font-size:10px !important; font-weight:900 !important; }
.automation-empty-plan { display:flex; align-items:center; gap:12px; padding:7px 0 2px; }
.automation-empty-icon { width:38px; height:38px; border-radius:12px; display:grid; place-items:center; background:#ecfdf5; }
.automation-empty-plan strong { display:block; color:#334155; font-size:12px; }
.automation-empty-plan span { display:block; margin-top:3px; color:#94a3b8; font-size:10px; }
.automation-plan-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.automation-plan-card { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 13px; border:1px solid #e2eee9; border-radius:14px; background:#fff; }
.automation-plan-card.disabled { opacity:.68; }
.automation-plan-main { display:flex; align-items:center; gap:10px; min-width:0; }
.automation-plan-pump { min-width:42px; height:34px; padding:0 8px; border-radius:10px; display:grid; place-items:center; background:#d1fae5; color:#047857; font-size:11px; font-weight:950; }
.automation-plan-main strong { display:block; color:#334155; font-size:11px; }
.automation-plan-main span { display:block; margin-top:3px; color:#7c8f88; font-size:9px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.automation-plan-right { display:flex; align-items:center; gap:8px; flex-shrink:0; }
.automation-plan-state { padding:5px 7px; border-radius:999px; background:#ecfdf5; color:#059669; font-size:9px; font-weight:900; }
.automation-delete-btn { height:30px; padding:0 9px; border:1px solid #fecaca; border-radius:9px; background:#fff; color:#b91c1c; cursor:pointer; font-size:9px; font-weight:850; }
.automation-delete-btn:hover { background:#fef2f2; }

.automation-modal {
  position:fixed;
  inset:0;
  z-index:3000;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
  background:rgba(15,23,42,.30);
  backdrop-filter:blur(8px);
  opacity:0;
  pointer-events:none;
  transition:.2s ease;
}
.automation-modal.show { opacity:1; pointer-events:auto; }
.automation-modal-card {
  position:relative;
  width:min(610px,100%);
  max-height:calc(100vh - 40px);
  overflow:auto;
  padding:26px;
  border:1px solid #d9eee6;
  border-radius:26px;
  background:#fff;
  box-shadow:0 30px 80px rgba(15,23,42,.22);
  transform:translateY(12px) scale(.985);
  transition:.2s ease;
}
.automation-modal.show .automation-modal-card { transform:translateY(0) scale(1); }
.automation-modal-close { position:absolute; right:18px; top:16px; width:34px; height:34px; border:0; border-radius:50%; background:#f1f5f9; color:#64748b; cursor:pointer; font-size:22px; line-height:1; }
.automation-modal-head { display:flex; align-items:center; gap:13px; padding-right:38px; }
.automation-modal-icon { width:50px; height:50px; border-radius:16px; display:grid; place-items:center; background:linear-gradient(145deg,#dcfce7,#ecfdf5); font-size:26px; }
.automation-modal-head h3 { margin:0; color:#064e3b; font-size:19px; }
.automation-modal-head p { margin:5px 0 0; color:#94a3b8; font-size:11px; font-weight:650; }
.automation-tabs { display:flex; gap:7px; margin:22px 0 18px; padding:5px; border-radius:13px; background:#f1f5f9; }
.automation-tab { flex:1; height:38px; border:0; border-radius:9px; background:transparent; color:#64748b; cursor:pointer; font-size:12px; font-weight:850; }
.automation-tab.active { background:#fff; color:#047857; box-shadow:0 3px 10px rgba(15,23,42,.08); }
.automation-pane { display:none; }
.automation-pane.active { display:block; }
.automation-form-grid { display:grid; grid-template-columns:1.2fr 1fr 1fr; gap:12px; }
.automation-form-grid.two { grid-template-columns:1fr 1fr; }
.automation-field { display:block; color:#475569; font-size:11px; font-weight:800; }
.automation-field > span { display:block; margin-bottom:6px; }
.automation-field input, .automation-field select { width:100%; height:42px; padding:0 11px; border:1px solid #dbe5e1; border-radius:11px; background:#fbfefd; color:#0f172a; outline:none; font-weight:800; }
.automation-field input:focus, .automation-field select:focus { border-color:#6ee7b7; box-shadow:0 0 0 3px rgba(16,185,129,.09); }
.automation-extra { margin-top:14px; padding:14px; border-radius:14px; background:#f8fcfa; border:1px solid #edf5f1; }
.automation-field-title { margin-bottom:9px; color:#475569; font-size:11px; font-weight:850; }
.automation-weekdays { display:flex; gap:8px; flex-wrap:wrap; }
.automation-weekdays label input { display:none; }
.automation-weekdays label span { width:34px; height:34px; border-radius:10px; display:grid; place-items:center; border:1px solid #d9e8e2; background:#fff; color:#64748b; cursor:pointer; font-size:11px; font-weight:850; }
.automation-weekdays label input:checked + span { border-color:#6ee7b7; background:#d1fae5; color:#047857; }
.automation-modal-note { margin-top:14px; padding:10px 12px; border-radius:11px; background:#ecfdf5; color:#4f796b; font-size:10px; line-height:1.55; font-weight:650; }
.automation-save-btn { width:100%; height:44px; margin-top:14px; border:0; border-radius:12px; background:#10b981; color:white; cursor:pointer; font-size:12px; font-weight:900; box-shadow:0 10px 20px -12px rgba(5,150,105,.65); }
.automation-save-btn:hover { background:#059669; }
.automation-save-btn:disabled { opacity:.55; cursor:wait; }
.automation-delay-hero { padding:17px; border-radius:16px; background:linear-gradient(145deg,#f0fdf4,#f8fffc); border:1px solid #d8f3e7; margin-bottom:14px; }
.automation-delay-hero > div { font-size:24px; }
.automation-delay-hero strong { display:block; margin-top:7px; color:#065f46; font-size:13px; }
.automation-delay-hero span { display:block; margin-top:4px; color:#7c938a; font-size:10px; line-height:1.6; }
.automation-input-unit { display:grid; grid-template-columns:1fr 48px; align-items:center; border:1px solid #dbe5e1; border-radius:11px; background:#fbfefd; overflow:hidden; }
.automation-input-unit input { border:0 !important; border-radius:0 !important; box-shadow:none !important; }
.automation-input-unit b { color:#94a3b8; font-size:10px; text-align:center; }

@media (max-width: 900px) {
  .automation-device-grid { grid-template-columns:1fr; }
  .automation-plan-grid { grid-template-columns:1fr; }
}
@media (max-width: 680px) {
  .automation-center { padding:18px; border-radius:22px; }
  .automation-center-head { align-items:flex-start; }
  .automation-center-head p { margin-left:0; }
  .automation-device-card { min-height:auto; }
  .automation-form-grid, .automation-form-grid.two { grid-template-columns:1fr; }
  .automation-plan-head { align-items:flex-start; }
  .automation-plan-card { align-items:flex-start; }
  .automation-plan-main span { white-space:normal; }
}
