/* ============================================================
   TSCRIC-LoRa — Enterprise Dashboard
   Dark Precision Theme | Production Grade | v5.0
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=JetBrains+Mono:wght@300;400;500;600&family=Inter:wght@300;400;500;600&display=swap');

:root {
  /* Core palette */
  --bg-void:       #060a0f;
  --bg-base:       #090d14;
  --bg-surface:    #0d1420;
  --bg-elevated:   #111b2a;
  --bg-card:       #141f30;
  --bg-hover:      #1a2840;

  /* Borders */
  --border-dim:    rgba(255,255,255,0.04);
  --border-subtle: rgba(255,255,255,0.07);
  --border-mid:    rgba(255,255,255,0.11);
  --border-bright: rgba(255,255,255,0.18);

  /* Brand colors */
  --accent-cyan:   #00d4ff;
  --accent-green:  #00ff88;
  --accent-amber:  #ffb800;
  --accent-red:    #ff4757;
  --accent-purple: #a855f7;
  --accent-blue:   #3b82f6;

  /* Dimmer variants */
  --cyan-dim:      rgba(0,212,255,0.12);
  --green-dim:     rgba(0,255,136,0.10);
  --amber-dim:     rgba(255,184,0,0.10);
  --red-dim:       rgba(255,71,87,0.12);
  --purple-dim:    rgba(168,85,247,0.10);

  /* Text */
  --text-primary:  #e8f0fe;
  --text-secondary:#8fa8c4;
  --text-muted:    #4a6280;
  --text-dim:      #2a3a50;

  /* Typography */
  --font-display:  'Syne', sans-serif;
  --font-mono:     'JetBrains Mono', monospace;
  --font-body:     'Inter', sans-serif;

  /* Layout */
  --sidebar-w:     260px;
  --header-h:      64px;
  --radius-sm:     6px;
  --radius-md:     10px;
  --radius-lg:     16px;
  --radius-xl:     20px;

  /* Shadows */
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.5);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg:     0 8px 32px rgba(0,0,0,0.5);
  --shadow-glow-cyan:   0 0 20px rgba(0,212,255,0.15);
  --shadow-glow-green:  0 0 20px rgba(0,255,136,0.12);
  --shadow-glow-amber:  0 0 20px rgba(255,184,0,0.12);
  --shadow-glow-red:    0 0 20px rgba(255,71,87,0.18);

  /* Transitions */
  --ease-out:      cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring:   cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── RESET ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg-void);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── SCROLLBAR ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-bright); }

/* ── GLOBAL BACKGROUND MESH ────────────────────────────────── */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse 80% 60% at 10% 0%, rgba(0,212,255,0.04) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 90% 100%, rgba(0,255,136,0.03) 0%, transparent 60%),
    radial-gradient(ellipse 40% 30% at 50% 50%, rgba(168,85,247,0.02) 0%, transparent 70%);
  pointer-events: none;
}

/* ══════════════════════════════════════════════════════════════
   LOGIN SCREEN
══════════════════════════════════════════════════════════════ */
.login-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-void);
  animation: loginFadeIn 0.6s var(--ease-out);
}

@keyframes loginFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.login-bg-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(0,212,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,212,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
}

.login-bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
}
.login-bg-orb-1 {
  width: 400px; height: 400px;
  top: -100px; left: -100px;
  background: radial-gradient(circle, rgba(0,212,255,0.07) 0%, transparent 70%);
  animation: orbFloat 8s ease-in-out infinite;
}
.login-bg-orb-2 {
  width: 300px; height: 300px;
  bottom: -50px; right: -50px;
  background: radial-gradient(circle, rgba(0,255,136,0.05) 0%, transparent 70%);
  animation: orbFloat 10s ease-in-out infinite reverse;
}
@keyframes orbFloat {
  0%,100% { transform: translateY(0px) scale(1); }
  50%     { transform: translateY(-30px) scale(1.05); }
}

.login-box {
  position: relative; z-index: 2;
  width: 420px; max-width: calc(100vw - 32px);
  background: var(--bg-surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(0,212,255,0.06);
  animation: loginSlideUp 0.7s var(--ease-out) 0.1s both;
}
@keyframes loginSlideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.login-wordmark {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 32px;
}
.login-wordmark-icon {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, rgba(0,212,255,0.15), rgba(0,255,136,0.10));
  border: 1px solid rgba(0,212,255,0.25);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  box-shadow: var(--shadow-glow-cyan);
  flex-shrink: 0;
}
.login-wordmark-text h1 {
  font-family: var(--font-display);
  font-size: 1.4em;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.login-wordmark-text p {
  font-size: 0.72em;
  color: var(--text-muted);
  margin-top: 2px;
  font-family: var(--font-mono);
}

.login-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 0 0 28px;
}

.login-label {
  display: block;
  font-size: 0.72em;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.login-input-wrap {
  position: relative;
  margin-bottom: 20px;
}
.login-input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 1em;
  padding: 13px 16px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.login-input::placeholder { color: var(--text-muted); }
.login-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0,212,255,0.1);
}

.login-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, rgba(0,212,255,0.15), rgba(0,255,136,0.10));
  border: 1px solid rgba(0,212,255,0.3);
  border-radius: var(--radius-md);
  color: var(--accent-cyan);
  font-family: var(--font-display);
  font-size: 0.95em;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  position: relative; overflow: hidden;
}
.login-btn::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(0,212,255,0.1), transparent);
  opacity: 0; transition: opacity 0.2s;
}
.login-btn:hover { border-color: rgba(0,212,255,0.5); box-shadow: var(--shadow-glow-cyan); }
.login-btn:hover::after { opacity: 1; }
.login-btn:active { transform: scale(0.99); }

.login-error {
  background: rgba(255,71,87,0.1);
  border: 1px solid rgba(255,71,87,0.25);
  border-radius: var(--radius-sm);
  color: #ff8fa0;
  font-size: 0.8em;
  padding: 10px 14px;
  margin-bottom: 16px;
  display: none;
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 0.68em;
  color: var(--text-dim);
}
.login-footer strong { color: var(--text-muted); }

/* ══════════════════════════════════════════════════════════════
   LAYOUT — SIDEBAR + MAIN
══════════════════════════════════════════════════════════════ */
.app-shell {
  display: none;
  min-height: 100vh;
}
.app-shell.visible { display: flex; }

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-base);
  border-right: 1px solid var(--border-dim);
  display: flex; flex-direction: column;
  position: fixed; left: 0; top: 0; bottom: 0;
  z-index: 200;
  transition: transform 0.3s var(--ease-out);
}

.sidebar-logo {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-dim);
}
.sidebar-logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, rgba(0,212,255,0.15), rgba(0,255,136,0.10));
  border: 1px solid rgba(0,212,255,0.2);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.sidebar-logo-text {
  font-family: var(--font-display);
  font-size: 1em; font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.sidebar-logo-sub {
  font-family: var(--font-mono);
  font-size: 0.6em;
  color: var(--text-muted);
  margin-top: 1px;
}

.sidebar-section-label {
  font-size: 0.6em;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 16px 20px 6px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.85em; font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
  position: relative;
  margin-bottom: 1px;
}
.nav-item:hover { background: var(--border-dim); color: var(--text-primary); }
.nav-item.active {
  background: rgba(0,212,255,0.08);
  color: var(--accent-cyan);
  border: 1px solid rgba(0,212,255,0.12);
}
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 25%; bottom: 25%;
  width: 2px; border-radius: 2px;
  background: var(--accent-cyan);
}
.nav-icon {
  width: 20px; text-align: center;
  font-size: 14px; flex-shrink: 0;
}
.nav-badge {
  margin-left: auto;
  font-size: 0.65em; font-weight: 700;
  font-family: var(--font-mono);
  background: rgba(255,71,87,0.15);
  color: var(--accent-red);
  padding: 2px 6px; border-radius: 10px;
  min-width: 18px; text-align: center;
}

.sidebar-bottom {
  padding: 16px 12px;
  border-top: 1px solid var(--border-dim);
}
.logout-btn {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  background: none;
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.82em; font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-body);
}
.logout-btn:hover {
  border-color: rgba(255,71,87,0.3);
  color: var(--accent-red);
  background: rgba(255,71,87,0.06);
}

/* MAIN AREA */
.main-area {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex; flex-direction: column;
  min-height: 100vh;
  position: relative; z-index: 1;
}

/* TOPBAR */
.topbar {
  height: var(--header-h);
  background: rgba(9,13,20,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-dim);
  display: flex; align-items: center;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 100;
  gap: 16px;
}
.topbar-title {
  font-family: var(--font-display);
  font-size: 1em; font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}
.topbar-title span {
  font-family: var(--font-mono);
  font-size: 0.75em;
  color: var(--text-muted);
  margin-left: 10px;
  font-weight: 400;
}

.connection-pill {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 0.75em; font-weight: 600;
  font-family: var(--font-mono);
  border: 1px solid;
  transition: all 0.3s;
  cursor: default;
}
.connection-pill.online {
  background: rgba(0,255,136,0.07);
  border-color: rgba(0,255,136,0.2);
  color: var(--accent-green);
}
.connection-pill.offline {
  background: rgba(255,184,0,0.08);
  border-color: rgba(255,184,0,0.2);
  color: var(--accent-amber);
}
.connection-pill.error {
  background: rgba(255,71,87,0.08);
  border-color: rgba(255,71,87,0.2);
  color: var(--accent-red);
}
.conn-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor;
}
.conn-dot.pulse { animation: dotPulse 2s ease-in-out infinite; }
@keyframes dotPulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(0.8); }
}

.topbar-time {
  font-family: var(--font-mono);
  font-size: 0.72em;
  color: var(--text-muted);
}

/* ── PAGE CONTENT ──────────────────────────────────────────── */
.page-content {
  padding: 28px;
  flex: 1;
}
.page { display: none; }
.page.active { display: block; animation: pageFadeIn 0.3s var(--ease-out); }
@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page-header {
  margin-bottom: 24px;
}
.page-header h2 {
  font-family: var(--font-display);
  font-size: 1.4em; font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.page-header p {
  font-size: 0.8em;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── BANNERS ───────────────────────────────────────────────── */
.banner {
  display: none;
  align-items: center; gap: 12px;
  padding: 11px 18px;
  border-radius: var(--radius-md);
  font-size: 0.82em; font-weight: 600;
  margin-bottom: 16px;
  border: 1px solid;
}
.banner.visible { display: flex; }
.banner-offline {
  background: rgba(255,184,0,0.07);
  border-color: rgba(255,184,0,0.25);
  color: var(--accent-amber);
}
.banner-safe {
  background: rgba(255,71,87,0.07);
  border-color: rgba(255,71,87,0.25);
  color: #ff8fa0;
  animation: bannerBlink 2.5s ease-in-out infinite;
}
.banner-device-nc {
  background: rgba(168,85,247,0.07);
  border-color: rgba(168,85,247,0.2);
  color: var(--accent-purple);
}
@keyframes bannerBlink {
  0%,100% { border-color: rgba(255,71,87,0.25); }
  50%      { border-color: rgba(255,71,87,0.6); box-shadow: var(--shadow-glow-red); }
}

/* ── SECTION / CARD ────────────────────────────────────────── */
.section {
  margin-bottom: 24px;
}
.section-title {
  font-family: var(--font-display);
  font-size: 0.78em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}
.section-title::after {
  content: '';
  flex: 1; height: 1px;
  background: var(--border-dim);
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.card:hover { border-color: var(--border-mid); }

/* ── GRID UTILITIES ────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }

/* ── KPI TILES ─────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.kpi-tile {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  position: relative; overflow: hidden;
  transition: transform 0.2s var(--ease-out), border-color 0.2s, box-shadow 0.2s;
  cursor: default;
}
.kpi-tile::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--tile-accent, rgba(0,212,255,0.4)), transparent);
  opacity: 0; transition: opacity 0.3s;
}
.kpi-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-tile:hover::before { opacity: 1; }
.kpi-tile:hover { border-color: var(--tile-accent, rgba(0,212,255,0.2)); }

.kpi-label {
  font-size: 0.63em;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}
.kpi-value {
  font-family: var(--font-mono);
  font-size: 2em;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 6px;
  transition: color 0.3s;
}
.kpi-unit {
  font-size: 0.5em;
  color: var(--text-muted);
  font-weight: 400;
}
.kpi-sub {
  font-size: 0.68em;
  color: var(--text-muted);
}
.kpi-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--tile-accent, var(--accent-cyan));
  flex-shrink: 0;
}

/* ── AI HERO SCORE ─────────────────────────────────────────── */
.ai-hero-wrap {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 24px;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 24px 28px;
  margin-bottom: 24px;
  position: relative; overflow: hidden;
}
.ai-hero-wrap::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at 15% 50%, rgba(0,212,255,0.04) 0%, transparent 60%);
  pointer-events: none;
}

.ai-ring-wrap {
  position: relative;
  width: 110px; height: 110px; flex-shrink: 0;
}
.ai-ring-svg {
  width: 110px; height: 110px;
  transform: rotate(-90deg);
}
.ai-ring-bg { fill: none; stroke: var(--border-mid); stroke-width: 5; }
.ai-ring-fill {
  fill: none; stroke: var(--accent-cyan); stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 283;
  stroke-dashoffset: 283;
  transition: stroke-dashoffset 1s var(--ease-out), stroke 0.5s;
  filter: drop-shadow(0 0 6px rgba(0,212,255,0.5));
}
.ai-ring-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.ai-score-number {
  font-family: var(--font-mono);
  font-size: 1.8em; font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
}
.ai-score-label {
  font-size: 0.55em;
  color: var(--text-muted);
  margin-top: 2px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ai-metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}
.ai-metric {
  text-align: center;
}
.ai-metric-val {
  font-family: var(--font-mono);
  font-size: 1.2em; font-weight: 600;
  color: var(--accent-cyan);
}
.ai-metric-key {
  font-size: 0.62em;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 4px;
}
.ai-metric-unit {
  font-size: 0.55em;
  color: var(--text-dim);
}

/* ── SOIL DEPTH BARS ───────────────────────────────────────── */
.depth-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.depth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  text-align: center;
  transition: border-color 0.2s;
}
.depth-label {
  font-size: 0.65em;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.depth-bar-outer {
  width: 100%;
  height: 120px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  position: relative; overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid var(--border-dim);
}
.depth-bar-fill {
  position: absolute; bottom: 0; left: 0; right: 0;
  border-radius: var(--radius-sm);
  transition: height 0.8s var(--ease-out), background 0.5s;
  background: linear-gradient(180deg, var(--accent-cyan) 0%, rgba(0,212,255,0.3) 100%);
}
.depth-val {
  font-family: var(--font-mono);
  font-size: 1.4em; font-weight: 600;
  color: var(--text-primary);
}
.depth-card.csmi-card {
  border-color: rgba(0,212,255,0.2);
  background: linear-gradient(135deg, var(--bg-card), rgba(0,212,255,0.03));
}
.depth-card.csmi-card .depth-bar-fill {
  background: linear-gradient(180deg, var(--accent-cyan) 0%, rgba(0,255,136,0.4) 100%);
  box-shadow: 0 0 15px rgba(0,212,255,0.3);
}

/* ── SENSOR GRID ───────────────────────────────────────────── */
.sensor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.sensor-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  text-align: center;
  transition: all 0.2s;
  position: relative; overflow: hidden;
}
.sensor-card:hover { border-color: var(--border-mid); transform: translateY(-2px); }
.sensor-icon-wrap {
  width: 44px; height: 44px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.sensor-value {
  font-family: var(--font-mono);
  font-size: 1.8em; font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
}
.sensor-unit {
  font-size: 0.55em;
  color: var(--text-muted);
  font-weight: 400;
}
.sensor-label {
  font-size: 0.65em;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-top: 8px;
}
.sensor-compare {
  font-size: 0.65em;
  color: var(--text-dim);
  margin-top: 6px;
  font-family: var(--font-mono);
}

/* ── STATUS HEALTH GRID ────────────────────────────────────── */
.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}
.health-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
  transition: border-color 0.2s;
}
.health-item.ok    { border-color: rgba(0,255,136,0.12); }
.health-item.warn  { border-color: rgba(255,184,0,0.2); }
.health-item.error { border-color: rgba(255,71,87,0.2); }
.health-item.nc    { border-color: var(--border-dim); }

.health-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.ok    .health-dot { background: var(--accent-green); box-shadow: 0 0 6px rgba(0,255,136,0.5); animation: dotPulse 2s infinite; }
.warn  .health-dot { background: var(--accent-amber); box-shadow: 0 0 6px rgba(255,184,0,0.5); }
.error .health-dot { background: var(--accent-red);   box-shadow: 0 0 6px rgba(255,71,87,0.5); }
.nc    .health-dot { background: var(--text-dim); }

.health-name { font-size: 0.8em; font-weight: 500; color: var(--text-primary); }
.health-stat { font-size: 0.7em; color: var(--text-muted); margin-left: auto; font-family: var(--font-mono); }

/* ── PUMP PANEL ────────────────────────────────────────────── */
.pump-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 24px;
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  position: relative; overflow: hidden;
}
.pump-panel::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at 80% 50%, rgba(0,255,136,0.03) 0%, transparent 60%);
  pointer-events: none;
}
.pump-status-area {
  display: flex; align-items: center; gap: 20px;
}
.pump-indicator {
  width: 60px; height: 60px; border-radius: 50%;
  border: 2px solid var(--border-mid);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  background: var(--bg-elevated);
  transition: all 0.4s;
  position: relative;
}
.pump-indicator.on {
  border-color: rgba(0,255,136,0.4);
  box-shadow: 0 0 0 8px rgba(0,255,136,0.06), 0 0 20px rgba(0,255,136,0.15);
  animation: pumpPulse 2s ease-in-out infinite;
}
.pump-indicator.off { border-color: var(--border-dim); }
.pump-indicator.fault { border-color: rgba(255,71,87,0.4); box-shadow: var(--shadow-glow-red); animation: pumpFault 1s ease-in-out infinite; }
@keyframes pumpPulse {
  0%,100% { box-shadow: 0 0 0 8px rgba(0,255,136,0.06), 0 0 20px rgba(0,255,136,0.12); }
  50%      { box-shadow: 0 0 0 14px rgba(0,255,136,0.03), 0 0 30px rgba(0,255,136,0.2); }
}
@keyframes pumpFault {
  0%,100% { box-shadow: var(--shadow-glow-red); }
  50%      { box-shadow: 0 0 30px rgba(255,71,87,0.4); }
}
.pump-info-text { flex: 1; }
.pump-status-text {
  font-family: var(--font-display);
  font-size: 1.1em; font-weight: 700;
  color: var(--text-primary);
}
.pump-mode-text { font-size: 0.75em; color: var(--text-muted); margin-top: 3px; }

.pump-controls {
  display: flex; gap: 10px; flex-wrap: wrap; margin-left: auto;
}
.pump-btn {
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.82em; font-weight: 600;
  cursor: pointer;
  border: 1px solid;
  transition: all 0.2s var(--ease-out);
  font-family: var(--font-body);
  display: flex; align-items: center; gap: 7px;
  letter-spacing: 0.02em;
}
.pump-btn:active { transform: scale(0.97); }
.pump-btn-on   { background: rgba(0,255,136,0.1); border-color: rgba(0,255,136,0.3); color: var(--accent-green); }
.pump-btn-off  { background: rgba(255,71,87,0.1); border-color: rgba(255,71,87,0.3); color: var(--accent-red); }
.pump-btn-auto { background: rgba(59,130,246,0.1); border-color: rgba(59,130,246,0.3); color: var(--accent-blue); }
.pump-btn-man  { background: rgba(168,85,247,0.1); border-color: rgba(168,85,247,0.3); color: var(--accent-purple); }
.pump-btn:hover { filter: brightness(1.15); transform: translateY(-1px); box-shadow: var(--shadow-sm); }

/* ── FAULT BANNER ──────────────────────────────────────────── */
.fault-banner {
  display: none;
  background: rgba(255,71,87,0.08);
  border: 1px solid rgba(255,71,87,0.3);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  color: #ff8fa0;
  font-size: 0.82em; font-weight: 600;
  margin-top: 12px;
  animation: bannerBlink 2s ease-in-out infinite;
}

/* ── CHARTS ────────────────────────────────────────────────── */
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: hidden;
}
.chart-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-dim);
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--bg-elevated);
  padding: 0 16px;
  gap: 0;
}
.chart-tabs::-webkit-scrollbar { display: none; }
.chart-tab {
  padding: 13px 16px;
  background: none; border: none;
  color: var(--text-muted);
  font-size: 0.76em; font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  font-family: var(--font-body);
  letter-spacing: 0.03em;
  margin-bottom: -1px;
}
.chart-tab:hover { color: var(--text-primary); }
.chart-tab.active { color: var(--accent-cyan); border-bottom-color: var(--accent-cyan); }
.chart-panels { padding: 20px; }
.chart-panel { display: none; }
.chart-panel.active { display: block; animation: pageFadeIn 0.25s var(--ease-out); }
.chart-container { position: relative; height: 220px; width: 100%; }
.chart-header {
  display: flex; align-items: center;
  justify-content: space-between; flex-wrap: wrap;
  gap: 10px; margin-bottom: 14px;
}
.chart-title {
  font-size: 0.72em; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em;
}
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; }
.chart-legend-item { display: flex; align-items: center; gap: 5px; font-size: 0.68em; color: var(--text-muted); }
.chart-legend-dot  { width: 8px; height: 8px; border-radius: 50%; }
.chart-stat-row { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border-dim); }
.chart-stat-val   { font-family: var(--font-mono); font-size: 1.1em; font-weight: 600; color: var(--accent-cyan); }
.chart-stat-label { font-size: 0.63em; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; margin-top: 2px; }

/* ── CONFIG PANEL ──────────────────────────────────────────── */
.config-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: 24px;
}
.config-panel-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-dim);
  background: var(--bg-elevated);
}
.config-panel-title {
  font-family: var(--font-display);
  font-size: 0.9em; font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}
.config-saved-badge {
  font-size: 0.68em; font-weight: 600;
  font-family: var(--font-mono);
  background: rgba(0,255,136,0.1);
  border: 1px solid rgba(0,255,136,0.2);
  color: var(--accent-green);
  padding: 4px 12px; border-radius: 100px;
  display: none;
  animation: popIn 0.3s var(--ease-spring);
}
@keyframes popIn { from{opacity:0;transform:scale(0.85)} to{opacity:1;transform:scale(1)} }
.config-body { padding: 20px; }
.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px; margin-bottom: 16px;
}
.config-field { display: flex; flex-direction: column; gap: 6px; }
.config-label {
  font-size: 0.65em; font-weight: 600;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--text-muted);
}
.config-input, .config-select {
  background: var(--bg-elevated);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}
.config-input:focus, .config-select:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0,212,255,0.08);
}
.config-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.config-input[type=number] { -moz-appearance: textfield; }
.config-sub { font-size: 0.62em; color: var(--text-dim); }

.unit-input-row {
  display: flex; align-items: stretch;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-md); overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.unit-input-row:focus-within {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0,212,255,0.08);
}
.unit-input-row .config-input {
  border: none; box-shadow: none; border-radius: 0;
}
.unit-input-row .config-input:focus { box-shadow: none; }
.unit-tag {
  background: var(--bg-card);
  border-left: 1px solid var(--border-mid);
  color: var(--text-muted);
  font-size: 0.75em; font-weight: 600;
  padding: 0 12px;
  display: flex; align-items: center;
  white-space: nowrap;
  font-family: var(--font-mono);
}

.btn-primary {
  padding: 11px 22px;
  background: linear-gradient(135deg, rgba(0,212,255,0.15), rgba(0,255,136,0.08));
  border: 1px solid rgba(0,212,255,0.3);
  border-radius: var(--radius-md);
  color: var(--accent-cyan);
  font-size: 0.85em; font-weight: 600;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  font-family: var(--font-body);
  letter-spacing: 0.03em;
}
.btn-primary:hover { filter: brightness(1.1); box-shadow: var(--shadow-glow-cyan); transform: translateY(-1px); }
.btn-primary:active { transform: scale(0.99) translateY(0); }

/* ── PREVIEW CARD ──────────────────────────────────────────── */
.preview-rows { display: flex; flex-direction: column; gap: 6px; }
.preview-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-dim);
  font-size: 0.78em;
}
.preview-row:last-child { border: none; }
.preview-key { color: var(--text-muted); }
.preview-val { color: var(--accent-cyan); font-family: var(--font-mono); font-weight: 600; }

/* ── CROP BANNER ───────────────────────────────────────────── */
.crop-banner {
  display: flex; flex-wrap: wrap; gap: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
}
.crop-info {
  flex: 1; min-width: 120px;
  padding: 14px 18px;
  border-right: 1px solid var(--border-dim);
}
.crop-info:last-child { border-right: none; }
.crop-info label {
  display: block;
  font-size: 0.62em;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.crop-info span {
  font-family: var(--font-mono);
  font-size: 0.88em;
  font-weight: 600;
  color: var(--text-primary);
}

/* ── STATUS PANEL (Online/Offline) ────────────────────────── */
.status-panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.status-block {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
}
.status-block-title {
  font-size: 0.68em; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--text-muted); margin-bottom: 12px;
}
.status-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-dim);
  font-size: 0.78em;
}
.status-row:last-child { border: none; padding-bottom: 0; }
.status-row span:first-child { color: var(--text-muted); }
.status-pill {
  font-family: var(--font-mono);
  font-size: 0.72em; font-weight: 600;
  padding: 3px 9px; border-radius: 100px;
  border: 1px solid;
  background: rgba(0,255,136,0.07);
  border-color: rgba(0,255,136,0.2);
  color: var(--accent-green);
}
.status-pill.offline {
  background: rgba(255,184,0,0.07);
  border-color: rgba(255,184,0,0.2);
  color: var(--accent-amber);
}
.status-pill.error {
  background: rgba(255,71,87,0.07);
  border-color: rgba(255,71,87,0.2);
  color: var(--accent-red);
}
.owm-status { font-family: var(--font-mono); font-size: 0.78em; font-weight: 600; }
.compare-val { font-family: var(--font-mono); font-size: 0.78em; color: var(--text-secondary); }

/* ── RAIN PANEL ────────────────────────────────────────────── */
.rain-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.rain-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 14px; text-align: center;
  transition: all 0.2s;
}
.rain-card:hover { border-color: var(--border-mid); }
.rain-priority {
  font-size: 0.6em; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-dim); margin-bottom: 10px;
}
.rain-icon { font-size: 2em; margin-bottom: 8px; }
.rain-label { font-size: 0.68em; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.06em; }
.rain-val { font-family: var(--font-mono); font-size: 1.1em; font-weight: 600; color: var(--text-primary); }
.rain-card.highlight-rain { border-color: rgba(0,212,255,0.25); background: rgba(0,212,255,0.03); }
.rain-card.highlight-rain .rain-val { color: var(--accent-cyan); }

.rain-prob-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
}
.rain-prob-header {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.78em; font-weight: 600;
  color: var(--text-muted); margin-bottom: 12px;
}
.rain-prob-num {
  font-family: var(--font-mono);
  font-size: 1.4em; font-weight: 700;
  color: var(--accent-cyan);
  margin-left: auto;
}
.rain-cat {
  font-size: 0.65em; font-weight: 700;
  padding: 3px 10px; border-radius: 100px;
  background: rgba(0,212,255,0.1);
  border: 1px solid rgba(0,212,255,0.2);
  color: var(--accent-cyan);
}
.rain-prob-bar-outer {
  width: 100%; height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px; overflow: hidden;
}
.rain-prob-bar {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue));
  transition: width 0.8s var(--ease-out);
}

/* ── TIPPING BUCKET ────────────────────────────────────────── */
.rainfall-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.rainfall-detail-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px; text-align: center;
}
.rainfall-gauge-wrap {
  position: relative; width: 70px; height: 70px;
  margin: 0 auto 10px; border-radius: 50%;
  background: conic-gradient(var(--accent-cyan) 0%, var(--bg-elevated) 0%);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.6s ease;
}
.rainfall-gauge-inner {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--bg-card);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.76em; font-weight: 700;
  color: var(--accent-cyan); font-family: var(--font-mono);
}
.rainfall-detail-val { font-family: var(--font-mono); font-size: 1.2em; font-weight: 600; color: var(--accent-cyan); }
.rainfall-detail-unit { font-size: 0.66em; color: var(--text-muted); }
.rainfall-detail-label { font-size: 0.62em; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; margin-top: 4px; }
.intensity-bar-outer { height: 5px; background: var(--bg-elevated); border-radius: 3px; margin: 8px 0; overflow: hidden; }
.intensity-bar       { height: 100%; border-radius: 3px; background: var(--accent-cyan); transition: width 0.6s var(--ease-out); }

/* ── BUDGET ────────────────────────────────────────────────── */
.budget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.budget-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.budget-card.highlight { border-color: rgba(0,212,255,0.2); background: rgba(0,212,255,0.03); }
.budget-label { font-size: 0.65em; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 6px; }
.budget-val {
  font-family: var(--font-mono);
  font-size: 1.3em; font-weight: 700;
  color: var(--text-primary);
}
.budget-val.rain-val-color { color: var(--accent-cyan); }
.budget-sub { font-size: 0.62em; color: var(--text-dim); margin-top: 4px; }
.budget-bar-outer {
  width: 100%; height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px; overflow: hidden;
  margin-bottom: 8px;
}
.budget-progress {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-green));
  transition: width 0.8s var(--ease-out);
  max-width: 100%;
}
.budget-legend { font-size: 0.68em; color: var(--text-muted); font-family: var(--font-mono); }

/* ── REMAINING ANALYTICS ───────────────────────────────────── */
.rem-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.rem-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px 16px; text-align: center;
  transition: all 0.2s;
}
.rem-card:hover { border-color: var(--border-mid); transform: translateY(-2px); }
.rem-icon { font-size: 2em; margin-bottom: 8px; }
.rem-label { font-size: 0.65em; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 8px; }
.rem-val { font-family: var(--font-mono); font-size: 1.8em; font-weight: 700; color: var(--accent-cyan); }
.rem-sub { font-size: 0.62em; color: var(--text-dim); margin-top: 6px; }

/* ── SOIL HEALTH ───────────────────────────────────────────── */
.soil-health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}
.soil-health-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px 16px; text-align: center;
  transition: all 0.2s;
}
.soil-health-card:hover { border-color: var(--border-mid); }
.soil-health-icon  { font-size: 2em; margin-bottom: 8px; }
.soil-health-val   { font-family: var(--font-mono); font-size: 1.8em; font-weight: 700; color: var(--accent-cyan); }
.soil-health-val.disconnected { color: var(--text-muted); font-size: 1.2em; }
.soil-health-unit  { font-size: 0.65em; color: var(--text-muted); }
.soil-health-label { font-size: 0.62em; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.07em; margin-top: 6px; }
.soil-health-bar-outer { height: 4px; background: var(--bg-elevated); border-radius: 2px; margin: 10px 0 6px; overflow: hidden; }
.soil-health-bar   { height: 100%; border-radius: 2px; transition: width 0.6s var(--ease-out); }
.soil-health-bar.disconnected { background: var(--border-dim); width: 0% !important; }
.soil-health-range { display: flex; justify-content: space-between; font-size: 0.58em; color: var(--text-dim); }
.soil-health-status { font-size: 0.7em; font-weight: 600; margin-top: 8px; padding: 3px 10px; border-radius: 100px; display: inline-block; }
.soil-health-status.optimal     { background: rgba(0,255,136,0.1); color: var(--accent-green); }
.soil-health-status.caution     { background: rgba(255,184,0,0.1); color: var(--accent-amber); }
.soil-health-status.critical    { background: rgba(255,71,87,0.1); color: var(--accent-red); }
.soil-health-status.disconnected{ background: var(--border-dim); color: var(--text-muted); border: 1px dashed var(--border-mid); }

/* ── CALIBRATION ───────────────────────────────────────────── */
.calib-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.calib-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-lg);
  padding: 18px;
}
.calib-card-title { font-size: 0.72em; font-weight: 700; color: var(--text-secondary); margin-bottom: 14px; text-transform: uppercase; letter-spacing: 0.07em; }
.calib-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 0.78em; }
.calib-row label { color: var(--text-muted); }
.calib-input {
  width: 90px; text-align: right;
  background: var(--bg-card);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.85em;
  padding: 5px 8px;
  outline: none;
  transition: border-color 0.2s;
}
.calib-input:focus { border-color: var(--accent-cyan); }
.calib-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.calib-info {
  background: rgba(0,212,255,0.04);
  border: 1px solid rgba(0,212,255,0.1);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 0.76em;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.6;
}

/* ── LORA PANEL ────────────────────────────────────────────── */
.lora-panel {
  background: var(--bg-card);
  border: 1px solid rgba(168,85,247,0.15);
  border-radius: var(--radius-xl);
  overflow: hidden;
}
.lora-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(168,85,247,0.08), var(--bg-elevated));
  border-bottom: 1px solid rgba(168,85,247,0.1);
}
.lora-title { font-size: 0.88em; font-weight: 700; color: #c084fc; }
.lora-badge {
  margin-left: auto;
  font-size: 0.68em; font-weight: 700;
  font-family: var(--font-mono);
  background: rgba(168,85,247,0.1);
  border: 1px solid rgba(168,85,247,0.25);
  color: #a855f7;
  padding: 3px 10px; border-radius: 100px;
}
.lora-body { padding: 18px; }
.lora-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 16px; }
.lora-stat-card {
  background: var(--bg-elevated);
  border: 1px solid rgba(168,85,247,0.12);
  border-radius: var(--radius-md);
  padding: 14px; text-align: center;
}
.lora-stat-val   { font-family: var(--font-mono); font-size: 1.3em; font-weight: 600; color: var(--accent-purple); }
.lora-stat-val.disconnected { color: var(--text-muted); font-size: 1em; }
.lora-stat-label { font-size: 0.62em; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; margin-top: 5px; }
.lora-node-grid  { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.lora-node-card  {
  background: var(--bg-elevated);
  border: 1px solid rgba(168,85,247,0.1);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex; align-items: flex-start; gap: 12px;
}
.lora-node-dot   { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.lora-node-dot.active   { background: var(--accent-green); box-shadow: 0 0 6px rgba(0,255,136,0.5); animation: dotPulse 2s infinite; }
.lora-node-dot.inactive { background: var(--text-dim); }
.lora-node-name  { font-size: 0.8em; font-weight: 600; color: var(--text-primary); }
.lora-node-sub   { font-size: 0.68em; color: var(--text-muted); margin-top: 3px; }
.lora-rssi-bar-outer { height: 3px; background: var(--bg-card); border-radius: 2px; margin: 8px 0; overflow: hidden; }
.lora-rssi-bar   { height: 100%; border-radius: 2px; background: var(--accent-purple); transition: width 0.6s var(--ease-out); }
.signal-quality  { font-size: 0.65em; font-weight: 700; }

/* ── FAULT DIAGNOSTICS ─────────────────────────────────────── */
.fault-diag-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.fault-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px; text-align: center;
  transition: all 0.2s;
}
.fault-card.fault-ok   { border-color: rgba(0,255,136,0.12); }
.fault-card.fault-warn { border-color: rgba(255,184,0,0.2); }
.fault-card.fault-err  { border-color: rgba(255,71,87,0.25); }
.fault-card-icon  { font-size: 2em; margin-bottom: 8px; }
.fault-card-title { font-size: 0.72em; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 8px; }
.fault-card-status { font-size: 0.78em; font-weight: 600; }
.fault-card-status.ok  { color: var(--accent-green); }
.fault-card-status.err { color: var(--accent-red); }
.anomaly-bar-outer { height: 4px; background: var(--bg-elevated); border-radius: 2px; margin: 10px 0 6px; overflow: hidden; }
.anomaly-bar { height: 100%; border-radius: 2px; transition: width 0.6s var(--ease-out); }
.fault-card-score { font-size: 0.65em; color: var(--text-dim); font-family: var(--font-mono); }

/* ── ALERT CENTER ──────────────────────────────────────────── */
.alert-center {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: hidden;
}
.alert-center-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-dim);
}
.alert-center-title { font-size: 0.82em; font-weight: 700; color: var(--text-primary); }
.alert-badge-count {
  font-family: var(--font-mono);
  font-size: 0.72em; font-weight: 700;
  background: rgba(255,71,87,0.15);
  color: var(--accent-red);
  border: 1px solid rgba(255,71,87,0.25);
  padding: 2px 8px; border-radius: 100px;
  min-width: 22px; text-align: center;
  transition: all 0.2s;
}
.alert-badge-count.zero {
  background: rgba(0,255,136,0.08);
  color: var(--accent-green);
  border-color: rgba(0,255,136,0.15);
}
.alert-list { padding: 12px; max-height: 300px; overflow-y: auto; }
.alert-empty { padding: 16px; text-align: center; color: var(--text-muted); font-size: 0.82em; }
.alert-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid;
  margin-bottom: 8px;
  animation: popIn 0.25s var(--ease-spring);
}
.alert-item.info  { background: rgba(0,212,255,0.05); border-color: rgba(0,212,255,0.15); }
.alert-item.warn  { background: rgba(255,184,0,0.05); border-color: rgba(255,184,0,0.2); }
.alert-item.error { background: rgba(255,71,87,0.06); border-color: rgba(255,71,87,0.2); }
.alert-icon { font-size: 1.1em; flex-shrink: 0; margin-top: 1px; }
.alert-body { flex: 1; }
.alert-title { font-size: 0.8em; font-weight: 600; color: var(--text-primary); }
.alert-desc  { font-size: 0.72em; color: var(--text-muted); margin-top: 3px; }
.alert-time  { font-family: var(--font-mono); font-size: 0.62em; color: var(--text-dim); margin-left: auto; white-space: nowrap; }
.btn-clear-all {
  padding: 5px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.72em; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
  font-family: var(--font-body);
}
.btn-clear-all:hover { border-color: rgba(255,71,87,0.3); color: var(--accent-red); }

/* ── EXPLAINABILITY ENGINE ─────────────────────────────────── */
.ai-explain-section {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: hidden;
}
.ai-explain-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-dim);
}
.ai-explain-title { font-size: 0.85em; font-weight: 700; color: var(--text-primary); flex: 1; }
.ai-explain-body  { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.explain-card {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px; border-radius: var(--radius-md);
  border: 1px solid;
}
.explain-card.explain-ok     { background: rgba(0,255,136,0.04); border-color: rgba(0,255,136,0.12); }
.explain-card.explain-warn   { background: rgba(255,184,0,0.04); border-color: rgba(255,184,0,0.15); }
.explain-card.explain-urgent { background: rgba(255,71,87,0.05); border-color: rgba(255,71,87,0.18); }
.explain-card.explain-info   { background: rgba(0,212,255,0.04); border-color: rgba(0,212,255,0.12); }
.explain-icon { font-size: 1.2em; flex-shrink: 0; margin-top: 1px; }
.explain-title { font-size: 0.82em; font-weight: 700; color: var(--text-primary); margin-bottom: 3px; }
.explain-text  { font-size: 0.76em; color: var(--text-muted); line-height: 1.5; }
.decision-panel {
  background: var(--bg-elevated);
  border: 1px solid rgba(0,212,255,0.12);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin: 0 16px 16px;
}
.decision-title { font-size: 0.72em; font-weight: 700; color: var(--accent-cyan); text-transform: uppercase; letter-spacing: 0.09em; margin-bottom: 6px; }
.decision-text  { font-size: 0.82em; color: var(--text-secondary); line-height: 1.6; }

/* ── AI CHAT ───────────────────────────────────────────────── */
.ai-chat-section {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: 24px;
}
.ai-chat-header {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px;
  padding: 16px 20px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-dim);
}
.ai-chat-header-left { display: flex; align-items: center; gap: 10px; }
.ai-glow-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-cyan); box-shadow: 0 0 6px rgba(0,212,255,0.6);
  animation: dotPulse 2s infinite;
}
.ai-chat-title    { font-family: var(--font-display); font-size: 1em; font-weight: 700; color: var(--text-primary); }
.ai-chat-subtitle { font-size: 0.68em; color: var(--text-muted); }
.ai-chat-header-right { display: flex; align-items: center; gap: 10px; }
.ai-status-badge {
  font-size: 0.72em; font-weight: 700; font-family: var(--font-mono);
  padding: 4px 10px; border-radius: 100px; border: 1px solid;
}
.ai-badge--ready   { background: rgba(0,255,136,0.08); border-color: rgba(0,255,136,0.2); color: var(--accent-green); }
.ai-badge--thinking{ background: rgba(255,184,0,0.08); border-color: rgba(255,184,0,0.2); color: var(--accent-amber); }
.ai-badge--offline { background: rgba(168,85,247,0.08); border-color: rgba(168,85,247,0.2); color: var(--accent-purple); }
.ai-badge--error   { background: rgba(255,71,87,0.08); border-color: rgba(255,71,87,0.2); color: var(--accent-red); }
.ai-btn-clear, .ai-btn-analyse {
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.76em; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
  font-family: var(--font-body);
}
.ai-btn-clear:hover   { border-color: rgba(255,71,87,0.3); color: var(--accent-red); }
.ai-btn-analyse:hover { border-color: rgba(0,212,255,0.3); color: var(--accent-cyan); }

.ai-quick-wrap { padding: 12px 16px; border-bottom: 1px solid var(--border-dim); }
.ai-quick-label { font-size: 0.65em; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; display: block; }
.ai-quick-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-chip {
  padding: 5px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-dim);
  border-radius: 100px;
  color: var(--text-secondary);
  font-size: 0.74em; font-weight: 500;
  cursor: pointer; transition: all 0.15s;
  font-family: var(--font-body);
}
.ai-chip:hover {
  background: rgba(0,212,255,0.08);
  border-color: rgba(0,212,255,0.2);
  color: var(--accent-cyan);
}

.ai-chat-messages {
  height: 320px; overflow-y: auto;
  padding: 16px;
  display: flex; flex-direction: column; gap: 14px;
}
.ai-msg-wrap {
  display: flex; align-items: flex-end; gap: 8px;
}
.ai-msg-wrap--user  { flex-direction: row-reverse; }
.ai-msg-wrap--model { flex-direction: row; }
.ai-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-mid);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.ai-bubble {
  max-width: 72%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.82em;
  line-height: 1.6;
}
.ai-bubble--model {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}
.ai-bubble--user {
  background: rgba(0,212,255,0.1);
  border: 1px solid rgba(0,212,255,0.2);
  color: var(--text-primary);
  border-bottom-right-radius: 4px;
}
.ai-bubble strong { color: var(--accent-cyan); }
.ai-bubble code { font-family: var(--font-mono); font-size: 0.88em; background: var(--bg-card); padding: 1px 5px; border-radius: 3px; }
.ai-bubble .ai-heading { font-weight: 700; color: var(--text-primary); margin-bottom: 6px; }
.ai-bubble .ai-hr { border: none; border-top: 1px solid var(--border-dim); margin: 10px 0; }
.ai-bubble ul, .ai-bubble ol { padding-left: 18px; margin: 6px 0; }
.ai-bubble li { margin-bottom: 3px; }
.ai-timestamp { font-size: 0.6em; color: var(--text-dim); align-self: flex-end; font-family: var(--font-mono); }

.ai-typing-indicator {
  display: none; align-items: center; gap: 8px;
  padding: 0 16px 12px;
}
.ai-typing-dots { display: flex; gap: 4px; }
.ai-typing-dots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-muted);
  animation: typingDot 1.4s ease-in-out infinite both;
}
.ai-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingDot {
  0%,100% { transform: translateY(0); opacity: 0.5; }
  40%      { transform: translateY(-6px); opacity: 1; }
}
.ai-typing-text { font-size: 0.72em; color: var(--text-muted); }

.ai-input-wrap { padding: 12px 16px; border-top: 1px solid var(--border-dim); }
.ai-input-box {
  display: flex; align-items: flex-end; gap: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-lg);
  padding: 8px 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.ai-input-box:focus-within {
  border-color: rgba(0,212,255,0.3);
  box-shadow: 0 0 0 3px rgba(0,212,255,0.06);
}
.ai-textarea {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text-primary); font-family: var(--font-body);
  font-size: 0.85em; line-height: 1.5; resize: none;
  min-height: 22px; max-height: 120px;
}
.ai-textarea::placeholder { color: var(--text-dim); }
.ai-input-actions { display: flex; align-items: flex-end; gap: 8px; }
.ai-char-count { font-size: 0.62em; color: var(--text-dim); font-family: var(--font-mono); }
.ai-send-btn {
  width: 32px; height: 32px;
  background: rgba(0,212,255,0.12);
  border: 1px solid rgba(0,212,255,0.25);
  border-radius: 50%;
  color: var(--accent-cyan);
  font-size: 14px;
  cursor: pointer; transition: all 0.15s;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ai-send-btn:hover { background: rgba(0,212,255,0.2); }
.ai-send-btn:disabled { opacity: 0.4; cursor: default; }
.ai-input-hint { font-size: 0.62em; color: var(--text-dim); margin-top: 6px; }

/* ── HISTORY TABLE ─────────────────────────────────────────── */
.history-table-wrap { overflow-x: auto; }
.history-table {
  width: 100%; border-collapse: collapse;
  font-size: 0.8em;
}
.history-table thead th {
  padding: 10px 14px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-mid);
  text-align: left;
  font-size: 0.68em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  white-space: nowrap;
}
.history-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-dim);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.9em;
}
.history-table tbody tr:hover td { background: var(--border-dim); color: var(--text-primary); }
.history-table tbody tr:last-child td { border-bottom: none; }
.history-table td:first-child { color: var(--text-muted); }

/* ── TOAST ─────────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
  max-width: 340px;
}
.toast {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.35s var(--ease-spring);
  font-size: 0.82em;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.toast.hiding { animation: toastOut 0.25s var(--ease-out) forwards; }
@keyframes toastOut {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(0.95); }
}
.toast.toast-info    { border-color: rgba(0,212,255,0.2); }
.toast.toast-success { border-color: rgba(0,255,136,0.2); }
.toast.toast-warn    { border-color: rgba(255,184,0,0.2); }
.toast.toast-error   { border-color: rgba(255,71,87,0.2); }
.toast-icon { font-size: 1.1em; flex-shrink: 0; }
.toast-body { flex: 1; }
.toast-title { font-weight: 600; color: var(--text-primary); }
.toast-desc  { color: var(--text-muted); font-size: 0.88em; margin-top: 2px; }
.toast-close {
  background: none; border: none;
  color: var(--text-dim); cursor: pointer; font-size: 14px;
  padding: 0; margin-top: -2px;
  transition: color 0.15s;
}
.toast-close:hover { color: var(--text-primary); }

/* ── ABOUT PAGE ────────────────────────────────────────────── */
.about-hero {
  background: linear-gradient(135deg, rgba(0,212,255,0.06), rgba(0,255,136,0.04), rgba(168,85,247,0.04));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  text-align: center;
  margin-bottom: 24px;
  position: relative; overflow: hidden;
}
.about-hero::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(circle at 30% 30%, rgba(0,212,255,0.05) 0%, transparent 50%),
    radial-gradient(circle at 70% 70%, rgba(0,255,136,0.04) 0%, transparent 50%);
}
.about-hero-icon { font-size: 3.5em; margin-bottom: 16px; position: relative; z-index: 1; }
.about-hero h2 {
  font-family: var(--font-display);
  font-size: 2em; font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  position: relative; z-index: 1;
}
.about-hero h2 span { color: var(--accent-cyan); }
.about-hero p {
  font-size: 0.88em;
  color: var(--text-muted);
  margin-top: 8px;
  position: relative; z-index: 1;
}
.about-badge {
  display: inline-block;
  margin-top: 16px;
  padding: 6px 18px;
  background: rgba(0,212,255,0.1);
  border: 1px solid rgba(0,212,255,0.2);
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 0.78em;
  color: var(--accent-cyan);
  position: relative; z-index: 1;
}

.about-team {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.team-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px 16px; text-align: center;
  transition: all 0.2s;
}
.team-card:hover { border-color: var(--border-mid); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.team-avatar {
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(135deg, rgba(0,212,255,0.15), rgba(0,255,136,0.10));
  border: 1px solid rgba(0,212,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; margin: 0 auto 12px;
}
.team-name { font-weight: 700; font-size: 0.88em; color: var(--text-primary); }
.team-role { font-size: 0.7em; color: var(--text-muted); margin-top: 4px; }
.guide-card {
  background: linear-gradient(135deg, rgba(0,212,255,0.06), rgba(168,85,247,0.04));
  border: 1px solid rgba(0,212,255,0.15);
}

.about-tech {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.tech-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
}
.tech-icon { font-size: 1.5em; flex-shrink: 0; }
.tech-name { font-size: 0.82em; font-weight: 600; color: var(--text-primary); }
.tech-desc { font-size: 0.68em; color: var(--text-muted); margin-top: 2px; }

/* ── FOOTER ────────────────────────────────────────────────── */
.footer {
  padding: 20px 28px;
  border-top: 1px solid var(--border-dim);
  text-align: center;
  font-size: 0.68em;
  color: var(--text-dim);
  line-height: 1.8;
}
.footer strong { color: var(--text-muted); }

/* ── DEVICE NOT CONNECTED OVERLAY ──────────────────────────── */
.device-nc-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 500;
  background: rgba(6,10,15,0.85);
  backdrop-filter: blur(8px);
  align-items: center; justify-content: center;
}
.device-nc-overlay.visible { display: flex; }
.device-nc-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-xl);
  padding: 40px 36px; text-align: center;
  max-width: 400px; width: 90%;
  box-shadow: var(--shadow-lg);
  animation: loginSlideUp 0.4s var(--ease-out);
}
.device-nc-icon { font-size: 3em; margin-bottom: 16px; opacity: 0.5; }
.device-nc-title { font-family: var(--font-display); font-size: 1.3em; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }
.device-nc-desc  { font-size: 0.82em; color: var(--text-muted); line-height: 1.6; }
.device-nc-dots  { display: flex; justify-content: center; gap: 6px; margin: 20px 0; }
.device-nc-dots span {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-dim);
  animation: typingDot 1.4s ease-in-out infinite both;
}
.device-nc-dots span:nth-child(2) { animation-delay: 0.2s; }
.device-nc-dots span:nth-child(3) { animation-delay: 0.4s; }

/* ── WELCOME PAGE ──────────────────────────────────────────── */
.welcome-hero {
  min-height: calc(100vh - 64px);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: 40px 20px;
  position: relative;
}
.welcome-badge {
  font-family: var(--font-mono);
  font-size: 0.72em;
  background: rgba(0,212,255,0.08);
  border: 1px solid rgba(0,212,255,0.2);
  color: var(--accent-cyan);
  padding: 5px 16px; border-radius: 100px;
  margin-bottom: 24px;
  display: inline-flex; align-items: center; gap: 6px;
}
.welcome-hero h1 {
  font-family: var(--font-display);
  font-size: 3.2em; font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 20px;
}
.welcome-hero h1 span { color: var(--accent-cyan); }
.welcome-hero > p {
  max-width: 580px;
  font-size: 1em;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 36px;
}
.welcome-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px; max-width: 540px; width: 100%;
  margin-bottom: 36px;
}
.welcome-stat {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px 14px;
}
.welcome-stat-num {
  font-family: var(--font-mono);
  font-size: 1.8em; font-weight: 700;
  color: var(--accent-cyan);
}
.welcome-stat-label {
  font-size: 0.65em;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-top: 5px;
}
.welcome-btn {
  padding: 14px 32px;
  background: linear-gradient(135deg, rgba(0,212,255,0.15), rgba(0,255,136,0.10));
  border: 1px solid rgba(0,212,255,0.3);
  border-radius: 100px;
  color: var(--accent-cyan);
  font-family: var(--font-display);
  font-size: 0.95em; font-weight: 600;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  letter-spacing: 0.04em;
}
.welcome-btn:hover { box-shadow: var(--shadow-glow-cyan); transform: translateY(-2px); }

/* ── FALLBACK BADGE ────────────────────────────────────────── */
.fallback-badge {
  font-size: 0.68em; font-weight: 700;
  background: rgba(255,184,0,0.1);
  border: 1px solid rgba(255,184,0,0.2);
  color: var(--accent-amber);
  padding: 2px 8px; border-radius: 100px;
}

/* ── VALUE UPDATE FLASH ────────────────────────────────────── */
.val-updated { animation: valFlash 0.5s ease; }
@keyframes valFlash {
  0%   { color: var(--accent-cyan); text-shadow: 0 0 8px rgba(0,212,255,0.5); }
  100% { color: inherit; text-shadow: none; }
}

/* ── SKELETON ──────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-hover) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ── GLOW DOT ──────────────────────────────────────────────── */
.glow-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent-cyan); box-shadow: 0 0 6px rgba(0,212,255,0.6);
  animation: dotPulse 2s infinite; vertical-align: middle;
}
.glow-dot.orange { background: var(--accent-amber); box-shadow: 0 0 6px rgba(255,184,0,0.6); }
.glow-dot.red    { background: var(--accent-red);   box-shadow: 0 0 6px rgba(255,71,87,0.6); }

/* ── MOBILE SIDEBAR TOGGLE ─────────────────────────────────── */
.sidebar-toggle {
  display: none;
  position: fixed; top: 14px; left: 14px; z-index: 300;
  width: 36px; height: 36px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-secondary);
  font-size: 16px;
}
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 150;
  background: rgba(0,0,0,0.6);
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  :root { --sidebar-w: 240px; }
  .ai-metrics-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
  }
  .sidebar-overlay.visible { display: block; }
  .sidebar-toggle { display: flex; }
  .main-area { margin-left: 0; }
  .topbar { padding: 0 16px 0 60px; }
  .page-content { padding: 16px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .depth-grid { grid-template-columns: 1fr 1fr; }
  .ai-hero-wrap { grid-template-columns: 1fr; }
  .ai-metrics-grid { grid-template-columns: repeat(3, 1fr); }
  .ai-ring-wrap { margin: 0 auto; }
  .pump-panel { flex-direction: column; }
  .pump-controls { margin-left: 0; width: 100%; justify-content: center; }
  .welcome-hero h1 { font-size: 2.2em; }
  .welcome-stats { grid-template-columns: 1fr 1fr 1fr; }
  #toast-container { left: 16px; right: 16px; max-width: none; bottom: 16px; }
  .about-team { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .depth-grid { grid-template-columns: 1fr 1fr; }
  .kpi-grid   { grid-template-columns: 1fr 1fr; }
  .ai-metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .welcome-stats   { grid-template-columns: 1fr; }
  .about-team      { grid-template-columns: 1fr; }
  .lora-stats-grid { grid-template-columns: 1fr 1fr; }
  .fault-diag-grid { grid-template-columns: 1fr 1fr; }
  .login-box { padding: 32px 24px; }
}

/* ── FAULT CARD AWAITING STATE ─────────────────────────────── */
.fault-card:not(.fault-ok):not(.fault-warn):not(.fault-err) {
  border-color: var(--border-dim);
  opacity: 0.7;
}
.fault-card:not(.fault-ok):not(.fault-warn):not(.fault-err) .fault-card-icon {
  opacity: 0.4;
}

/* ── TEAM LEAD CARD PULSE ──────────────────────────────────── */
.team-card[style*="accent-cyan"] {
  animation: teamLeadGlow 3s ease-in-out infinite;
}
@keyframes teamLeadGlow {
  0%,100% { box-shadow: 0 0 0 1px rgba(0,212,255,0.2); }
  50%      { box-shadow: 0 0 16px rgba(0,212,255,0.15), 0 0 0 1px rgba(0,212,255,0.4); }
}

/* ══ SETUP WIZARD ═══════════════════════════════════════════ */
.setup-wizard-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6,10,15,0.96);
  backdrop-filter: blur(12px);
}
.setup-wizard-box {
  background: var(--surface-1);
  border: 1px solid rgba(0,212,255,0.25);
  border-radius: 18px;
  padding: 36px 32px;
  width: 100%; max-width: 440px;
  box-shadow: 0 0 60px rgba(0,212,255,0.08);
}
.setup-wizard-logo {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 24px;
}
.setup-wizard-title {
  font-size: 1.2rem; font-weight: 800;
  color: var(--text-primary); margin-bottom: 6px;
}
.setup-wizard-sub {
  font-size: 0.78rem; color: var(--text-muted);
  margin-bottom: 24px; line-height: 1.5;
}
.setup-wizard-field { margin-bottom: 18px; }
.setup-wizard-label {
  display: block; font-size: 0.72rem; font-weight: 700;
  color: var(--text-secondary); letter-spacing: 0.06em;
  text-transform: uppercase; margin-bottom: 7px;
}
.setup-wizard-select,
.setup-wizard-input {
  width: 100%; padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-mid);
  border-radius: 8px; color: var(--text-primary);
  font-size: 0.88rem;
  appearance: none; -webkit-appearance: none;
  transition: border-color .2s;
  box-sizing: border-box;
}
.setup-wizard-select:focus,
.setup-wizard-input:focus {
  outline: none; border-color: var(--accent-cyan);
}
.setup-wizard-hint {
  font-size: 0.68rem; color: var(--text-muted); margin-top: 4px;
}
.setup-wizard-btn {
  width: 100%; padding: 13px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-green));
  border: none; border-radius: 10px;
  color: #000; font-size: 1rem; font-weight: 800;
  cursor: pointer; margin-top: 8px;
  transition: opacity .2s, transform .15s;
}
.setup-wizard-btn:hover { opacity: .9; transform: translateY(-1px); }
.setup-wizard-btn:active { transform: translateY(0); }
.setup-wizard-footer {
  text-align: center; margin-top: 18px;
  font-size: 0.7rem; color: var(--text-muted);
  line-height: 1.6;
}

/* ══ PWA INSTALL BUTTON (Topbar) ════════════════════════════ */
.pwa-install-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  background: linear-gradient(135deg, rgba(0,212,255,0.18), rgba(0,255,136,0.12));
  border: 1px solid rgba(0,212,255,0.4);
  border-radius: 20px;
  color: var(--accent-cyan); font-size: 0.75rem; font-weight: 700;
  cursor: pointer; white-space: nowrap;
  transition: background .2s, transform .15s;
  letter-spacing: 0.04em;
}
.pwa-install-btn:hover {
  background: linear-gradient(135deg, rgba(0,212,255,0.28), rgba(0,255,136,0.2));
  transform: scale(1.03);
}
@media (max-width: 600px) {
  .setup-wizard-box { padding: 28px 20px; }
  .pwa-install-btn span:last-child { display: none; }
}

/* ══ APP DOWNLOAD BANNER ════════════════════════════════════ */
.app-download-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, rgba(0,212,255,0.08) 0%, rgba(0,255,136,0.06) 100%);
  border: 1px solid rgba(0,212,255,0.25);
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}
.app-download-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 60%, rgba(0,255,136,0.05));
  pointer-events: none;
}
.app-download-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.app-download-icon {
  font-size: 2rem;
  line-height: 1;
  filter: drop-shadow(0 0 8px rgba(0,212,255,0.4));
}
.app-download-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}
.app-download-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.app-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  background: linear-gradient(135deg, var(--accent-cyan), #00ff88);
  color: #060a0f;
  font-size: 0.82rem;
  font-weight: 800;
  border-radius: 24px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: transform 0.18s, box-shadow 0.18s, filter 0.18s;
  box-shadow: 0 4px 18px rgba(0,212,255,0.3);
  white-space: nowrap;
  flex-shrink: 0;
}
.app-download-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 8px 28px rgba(0,212,255,0.45);
  filter: brightness(1.08);
}
.app-download-btn:active {
  transform: translateY(0) scale(0.98);
}
.app-download-btn-icon {
  font-size: 1rem;
}
@media (max-width: 600px) {
  .app-download-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
  }
  .app-download-btn {
    width: 100%;
    justify-content: center;
    padding: 12px 22px;
    font-size: 0.88rem;
  }
}

/* ══ WELCOME PAGE DOWNLOAD ═══════════════════════════════════ */
.welcome-download-wrap {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.welcome-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 32px;
  background: linear-gradient(135deg, rgba(0,212,255,0.15), rgba(0,255,136,0.10));
  border: 1.5px solid rgba(0,212,255,0.5);
  border-radius: 30px;
  color: var(--accent-cyan);
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.18s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(0,212,255,0.15);
}
.welcome-download-btn:hover {
  background: linear-gradient(135deg, rgba(0,212,255,0.28), rgba(0,255,136,0.18));
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0,212,255,0.3);
}
.welcome-download-btn span {
  font-size: 1.1rem;
}
.welcome-download-note {
  font-size: 0.68rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* ══ OWM DASHBOARD WEATHER CARD ══════════════════════════════ */
.owm-dash-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 600px) {
  .owm-dash-grid { grid-template-columns: repeat(2, 1fr); }
}
.owm-dash-card {
  background: rgba(0,212,255,0.05);
  border: 1px solid rgba(0,212,255,0.18);
  border-radius: 12px;
  padding: 16px 12px;
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
}
.owm-dash-card:hover {
  border-color: rgba(0,212,255,0.35);
  background: rgba(0,212,255,0.09);
}
.owm-dash-icon {
  font-size: 1.5rem;
  margin-bottom: 6px;
}
.owm-dash-val {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 4px;
  min-height: 1.4em;
}
.owm-dash-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.owm-status-val {
  font-size: 0.85rem;
}
