:root { --bg:#f3f6f3; --panel:#fff; --ink:#17251d; --muted:#68766d; --line:#dfe7e1; --green:#24945e; --green-dark:#176b44; --green-soft:#e8f5ed; --amber:#d88b2d; --red:#d85252; --shadow:0 14px 38px rgba(31,55,40,.09); }
* { box-sizing:border-box; }
body { margin:0; min-height:100vh; background:var(--bg); color:var(--ink); font-family:"DM Sans",sans-serif; }
button, input, select { font:inherit; }
button, a { -webkit-tap-highlight-color:transparent; }
.topbar { height:76px; padding:0 max(24px,calc((100vw - 1440px)/2)); display:flex; align-items:center; justify-content:space-between; gap:24px; background:#0e1b14; color:#fff; }
.brand { display:flex; align-items:center; gap:12px; }
.brand-mark { width:38px; height:38px; display:grid; place-items:center; border-radius:12px; background:var(--green); font-weight:800; }
.brand div { display:grid; }
.brand strong { font-size:1.05rem; }
.brand span:last-child { color:#9eb0a4; font-size:.8rem; }
.topbar-actions { display:flex; align-items:center; gap:14px; }
.last-refresh { color:#a8b7ad; font-size:.82rem; }
.primary-button, .secondary-button, .icon-button { border:0; border-radius:10px; padding:10px 15px; cursor:pointer; text-decoration:none; font-weight:600; }
.primary-button { color:#fff; background:var(--green); }
.primary-button:hover { background:var(--green-dark); }
.secondary-button, .icon-button { color:var(--ink); background:#edf2ee; border:1px solid var(--line); }
.page-shell { width:min(1440px,100%); margin:0 auto; padding:28px 24px 56px; display:grid; gap:24px; }
.summary-row { display:grid; grid-template-columns:repeat(4,1fr); gap:14px; }
.summary-row article { padding:18px 20px; background:var(--panel); border:1px solid var(--line); border-radius:14px; display:grid; gap:4px; }
.summary-row span { color:var(--muted); font-size:.8rem; }
.summary-row strong { font:600 1.65rem "IBM Plex Mono",monospace; }
.panel { background:var(--panel); border:1px solid var(--line); border-radius:18px; box-shadow:var(--shadow); }
.panel-heading, .section-heading, .detail-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:24px; }
.panel-heading { padding:22px 24px 18px; }
.panel-heading h1, .section-heading h2, .detail-heading h2, .dialog-heading h2 { margin:0; letter-spacing:-.035em; }
.panel-heading p:not(.eyebrow), .detail-heading p:not(.eyebrow) { margin:6px 0 0; color:var(--muted); }
.eyebrow { margin:0 0 6px; color:var(--green-dark); text-transform:uppercase; letter-spacing:.15em; font-size:.7rem; font-weight:700; }
.map-tools { display:flex; align-items:end; gap:10px; }
.map-tools label { color:var(--muted); font-size:.75rem; align-self:center; }
select, input { min-height:42px; padding:9px 11px; color:var(--ink); background:#fff; border:1px solid #ccd8cf; border-radius:9px; outline:none; }
select:focus, input:focus { border-color:var(--green); box-shadow:0 0 0 3px rgba(36,148,94,.12); }
.field-map { position:relative; height:520px; border-top:1px solid var(--line); border-bottom:1px solid var(--line); background:#dfe8df; z-index:0; }
.field-map.local-map-background { background-color:#dce8d4; background-image:linear-gradient(28deg,transparent 44%,rgba(255,255,255,.52) 45%,rgba(255,255,255,.52) 47%,transparent 48%),linear-gradient(118deg,transparent 46%,rgba(87,120,72,.16) 47%,rgba(87,120,72,.16) 50%,transparent 51%),repeating-linear-gradient(12deg,rgba(68,128,72,.12) 0,rgba(68,128,72,.12) 68px,rgba(181,154,92,.12) 69px,rgba(181,154,92,.12) 138px); }
.map-provider-status { position:absolute; z-index:500; left:50%; bottom:13px; transform:translateX(-50%); padding:7px 11px; border:1px solid rgba(23,37,29,.14); border-radius:999px; color:#4f6055; background:rgba(255,255,255,.9); box-shadow:0 4px 15px rgba(31,55,40,.12); font-size:.72rem; pointer-events:none; }
.map-legend { display:flex; gap:20px; padding:12px 24px; color:var(--muted); font-size:.78rem; }
.legend-dot, .node-dot { display:inline-block; width:9px; height:9px; margin-right:6px; border-radius:50%; background:var(--amber); }
.legend-dot.online, .node-dot.online { background:var(--green); }
.sensor-map-marker { width:22px; height:22px; border-radius:50%; border:3px solid #fff; background:var(--amber); box-shadow:0 2px 9px rgba(0,0,0,.35); }
.sensor-map-marker.online { background:var(--green); }
.sensor-map-marker.selected { box-shadow:0 0 0 8px rgba(36,148,94,.25),0 2px 9px rgba(0,0,0,.35); }
.sensor-popup { min-width:210px; }
.sensor-popup strong, .sensor-popup span { display:block; }
.sensor-popup .popup-type { margin:3px 0 10px; color:var(--muted); font-size:.75rem; }
.sensor-popup .popup-reading { font-size:1.45rem; color:var(--green-dark); }
.sensor-popup button { margin-top:10px; padding:7px 10px; border:0; border-radius:7px; color:#fff; background:var(--green); cursor:pointer; }
.nodes-section { display:grid; gap:14px; }
.section-heading { align-items:center; }
.status-pill, .node-state { display:inline-flex; padding:7px 11px; border-radius:999px; color:var(--green-dark); background:var(--green-soft); font-size:.8rem; font-weight:600; }
.status-pill.is-error, .node-state.stale { color:#8e5415; background:#fff0dc; }
.sensor-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; }
.sensor-card { min-width:0; min-height:255px; padding:20px; text-align:left; color:var(--ink); background:var(--panel); border:1px solid var(--line); border-radius:16px; cursor:pointer; box-shadow:0 8px 24px rgba(31,55,40,.05); transition:transform .18s,border-color .18s,box-shadow .18s; }
.sensor-card:hover, .sensor-card.is-active { transform:translateY(-3px); border-color:#8dc6a6; box-shadow:var(--shadow); }
.card-top, .card-footer, .chart-heading, .dialog-heading, .coordinate-actions, .dialog-actions, .metric-card-head { display:flex; align-items:center; justify-content:space-between; gap:14px; }
.node-identity { display:flex; align-items:center; min-width:0; }
.sensor-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.sensor-type { padding:5px 8px; border-radius:999px; background:var(--green-soft); color:var(--green-dark); text-transform:uppercase; letter-spacing:.06em; font-size:.66rem; font-weight:700; }
.current-reading { display:grid; gap:4px; margin:24px 0 14px; }
.reading-label { color:var(--muted); font-size:.78rem; }
.reading-value { font:600 2.15rem "IBM Plex Mono",monospace; color:var(--green-dark); }
.reading-list { display:grid; grid-template-columns:1fr auto; gap:5px 12px; min-height:50px; font-size:.82rem; }
.reading-list span:nth-child(odd) { color:var(--muted); }
.reading-list span:nth-child(even) { font-family:"IBM Plex Mono",monospace; text-align:right; }
.card-footer { margin-top:17px; padding-top:13px; border-top:1px solid var(--line); color:var(--muted); font-size:.73rem; }
.empty-state { grid-column:1/-1; padding:34px; text-align:center; color:var(--muted); background:#fff; border:1px dashed #bdcac0; border-radius:14px; }
.detail-section { padding:26px; display:grid; gap:20px; scroll-margin-top:20px; }
.detail-section[hidden] { display:none; }
.back-button, .dialog-close { border:0; padding:0; margin-bottom:16px; color:var(--green-dark); background:none; cursor:pointer; font-weight:600; }
.metric-grid, .charts-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; }
.metric-card, .chart-card, .moisture-chart-card { padding:17px; background:#f8faf8; border:1px solid var(--line); border-radius:13px; }
.metric-card { display:grid; gap:8px; }
.metric-label, .chart-label, .chart-range { color:var(--muted); font-size:.75rem; }
.metric-trend { color:var(--green); font:500 .72rem "IBM Plex Mono",monospace; }
.metric-trend.down { color:var(--red); }
.metric-value, .chart-value { display:block; font:600 1.3rem "IBM Plex Mono",monospace; }
.moisture-chart-card { padding:22px; background:#fff; }
.moisture-chart-card canvas, .chart-card canvas { width:100%; height:auto; margin-top:18px; }
.chart-heading select { max-width:280px; }
.chart-empty { min-height:220px; display:grid; place-items:center; color:var(--muted); }
.chart-empty[hidden] { display:none; }
.charts-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
.error-message { padding:12px 15px; color:#8d2d2d; background:#fdeaea; border:1px solid #f2caca; border-radius:10px; }
.node-dialog { width:min(680px,calc(100vw - 28px)); padding:0; border:0; border-radius:18px; box-shadow:0 28px 80px rgba(8,25,15,.35); }
.node-dialog::backdrop { background:rgba(7,20,12,.58); backdrop-filter:blur(3px); }
.node-dialog form { padding:24px; }
.dialog-close { margin:0; font-size:1.8rem; color:var(--muted); }
.dialog-help { margin:8px 0 20px; color:var(--muted); }
.form-grid { display:grid; grid-template-columns:1fr 1fr; gap:15px; }
.form-grid label { display:grid; gap:6px; color:var(--muted); font-size:.78rem; }
.coordinate-actions { margin-top:15px; color:var(--muted); font-size:.75rem; }
.dialog-actions { justify-content:flex-end; margin-top:22px; }
@media (max-width:1000px) { .sensor-grid{grid-template-columns:repeat(2,1fr)} .metric-grid{grid-template-columns:repeat(2,1fr)} }
@media (max-width:720px) { .topbar{height:auto;padding:14px 16px;align-items:flex-start}.topbar-actions{align-items:flex-end;flex-direction:column}.last-refresh{display:none}.page-shell{padding:18px 14px 40px}.summary-row{grid-template-columns:1fr 1fr}.panel-heading,.section-heading,.detail-heading{flex-direction:column}.map-tools{width:100%;align-items:stretch;flex-direction:column}.field-map{height:430px}.sensor-grid,.metric-grid,.charts-grid,.form-grid{grid-template-columns:1fr}.chart-heading{align-items:flex-start;flex-direction:column}.chart-heading select{max-width:none;width:100%}.sensor-card{min-height:auto}.coordinate-actions{align-items:flex-start;flex-direction:column} }
