@import url('https://fonts.googleapis.com/css2?family=Prompt:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&family=Outfit:wght@500;600;700;800&display=swap');

/* ═════════════════════════════════════════════════════════════
   1. DESIGN TOKENS & SYSTEM FOUNDATIONS (Modern SaaS Standard)
   ═════════════════════════════════════════════════════════════ */
:root, [data-theme="dark"] {
  --bg: #090d16;
  --bg2: #0e1526;
  --panel: rgba(15, 23, 42, 0.78);
  --panel-solid: #0f172a;
  --panel2: rgba(22, 33, 58, 0.82);
  --panel-elevated: rgba(30, 45, 76, 0.7);
  --glass: rgba(255, 255, 255, 0.04);
  --glass-hover: rgba(255, 255, 255, 0.075);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --line-subtle: rgba(255, 255, 255, 0.04);
  --rim-light: inset 0 1px 0 0 rgba(255, 255, 255, 0.12);
  
  --text: #ffffff;
  --text-dim: #e2e8f0;
  --muted: #cbd5e1;
  --muted-light: #94a3b8;
  
  --cyan: #06b6d4;
  --cyan-hover: #22d3ee;
  --cyan-glow: rgba(6, 182, 212, 0.35);
  --cyan-tint: rgba(6, 182, 212, 0.12);
  
  --violet: #8b5cf6;
  --violet-glow: rgba(139, 92, 246, 0.35);
  --violet-tint: rgba(139, 92, 246, 0.12);
  
  --green: #10b981;
  --green-hover: #34d399;
  --green-glow: rgba(16, 185, 129, 0.35);
  --green-tint: rgba(16, 185, 129, 0.12);
  
  --orange: #f97316;
  --orange-hover: #fb923c;
  --orange-glow: rgba(249, 115, 22, 0.35);
  --orange-tint: rgba(249, 115, 22, 0.12);
  
  --red: #ef4444;
  --red-glow: rgba(239, 68, 68, 0.35);
  --red-tint: rgba(239, 68, 68, 0.12);
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, 0.65);
  --shadow-modal: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 40px rgba(6, 182, 212, 0.12);
  
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg: #f8fafc;
  --bg2: #f1f5f9;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-solid: #ffffff;
  --panel2: rgba(248, 250, 252, 0.95);
  --panel-elevated: #ffffff;
  --glass: rgba(0, 0, 0, 0.025);
  --glass-hover: rgba(0, 0, 0, 0.05);
  --line: rgba(15, 23, 42, 0.08);
  --line-strong: rgba(15, 23, 42, 0.16);
  --line-subtle: rgba(15, 23, 42, 0.04);
  --rim-light: inset 0 1px 0 0 rgba(255, 255, 255, 0.9);
  
  --text: #090d16;
  --text-dim: #1e293b;
  --muted: #475569;
  --muted-light: #64748b;
  
  --cyan: #0891b2;
  --cyan-hover: #06b6d4;
  --cyan-glow: rgba(8, 145, 178, 0.25);
  --cyan-tint: rgba(8, 145, 178, 0.1);
  
  --violet: #7c3aed;
  --violet-glow: rgba(124, 58, 237, 0.2);
  --violet-tint: rgba(124, 58, 237, 0.08);
  
  --green: #059669;
  --green-hover: #10b981;
  --green-glow: rgba(5, 150, 105, 0.25);
  --green-tint: rgba(5, 150, 105, 0.1);
  
  --orange: #ea580c;
  --orange-hover: #f97316;
  --orange-glow: rgba(234, 88, 12, 0.25);
  --orange-tint: rgba(234, 88, 12, 0.1);
  
  --red: #dc2626;
  --red-glow: rgba(220, 38, 38, 0.25);
  --red-tint: rgba(220, 38, 38, 0.1);
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, 0.12);
  --shadow-modal: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 30px rgba(8, 145, 178, 0.08);
}

/* ═════════════════════════════════════════════════════════════
   2. GLOBAL RESET & BROWSER POLISH
   ═════════════════════════════════════════════════════════════ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Prompt', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  background-color: var(--bg);
  background-image: 
    radial-gradient(ellipse 65% 45% at 20% 0%, rgba(249, 115, 22, 0.08) 0%, transparent 70%),
    radial-gradient(ellipse 60% 45% at 85% 15%, rgba(6, 182, 212, 0.08) 0%, transparent 70%),
    radial-gradient(ellipse 50% 35% at 50% 85%, rgba(139, 92, 246, 0.05) 0%, transparent 70%);
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--text);
  overflow-x: hidden;
  min-height: 100vh;
  transition: background-color 0.25s var(--ease-out), color 0.25s var(--ease-out);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[data-theme="light"] body {
  background-color: #f8fafc;
  background-image: 
    radial-gradient(ellipse 65% 45% at 20% 0%, rgba(249, 115, 22, 0.04) 0%, transparent 70%),
    radial-gradient(ellipse 60% 45% at 85% 15%, rgba(6, 182, 212, 0.04) 0%, transparent 70%),
    radial-gradient(ellipse 50% 35% at 50% 85%, rgba(139, 92, 246, 0.03) 0%, transparent 70%);
}

::selection {
  background: var(--cyan);
  color: #ffffff;
}

::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: var(--radius-full);
  transition: background 0.2s var(--ease-out);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* Tabular numbers for clean, aligned telemetry figures */
.hero-value,
.statgrid article strong,
.cards article strong,
code,
.fs-stat-item strong,
.diag-item strong,
.badge-elapsed,
.profile-item strong {
  font-variant-numeric: tabular-nums;
}
td {
  font-variant-numeric: tabular-nums;
}

/* (Ambient orbs removed — clean solid background) */

/* ═════════════════════════════════════════════════════════════
   4. SIDEBAR NAVIGATION & APP SHELL
   ═════════════════════════════════════════════════════════════ */
aside {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 260px;
  background: var(--panel-solid);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s var(--ease-out);
}

.brand {
  padding: 22px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}
.brand-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--violet), var(--cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 14px var(--cyan-glow);
  flex-shrink: 0;
}
.brand h1 {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
}
.brand small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

nav {
  padding: 20px 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}
nav button {
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s var(--ease-out);
  text-align: left;
  position: relative;
}
nav button svg {
  width: 18px; height: 18px;
  flex-shrink: 0;
  transition: transform 0.2s var(--ease-out), color 0.2s var(--ease-out);
}
nav button:hover {
  background: var(--glass-hover);
  color: var(--text);
  border-color: var(--line-subtle);
  transform: translateX(2px);
}
nav button.active {
  background: var(--cyan-tint);
  color: var(--cyan);
  font-weight: 600;
  border-color: rgba(6, 182, 212, 0.25);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
nav button.active::before {
  content: '';
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  background: var(--cyan);
  border-radius: 0 4px 4px 0;
  box-shadow: 0 0 10px var(--cyan);
}

.side-status {
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel2);
}
.status-dot-wrap {
  position: relative;
  width: 12px; height: 12px;
  flex-shrink: 0;
}
.status-dot-wrap i {
  position: absolute;
  top: 1px; left: 1px;
  width: 10px; height: 10px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 2s infinite;
  box-shadow: 0 0 8px var(--green);
}
.side-status b {
  font-size: 13px;
  display: block;
  font-weight: 600;
  color: var(--text);
}
.side-status small {
  font-size: 12px;
  color: var(--muted);
  display: block;
  margin-top: 1px;
}

/* ═════════════════════════════════════════════════════════════
   5. MAIN SHELL & TOP HEADER
   ═════════════════════════════════════════════════════════════ */
.shell {
  margin-left: 260px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--panel-solid);
  border-bottom: 1px solid var(--line);
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
header p {
  font-size: 13.5px;
  color: var(--muted);
  margin-top: 2px;
}
.head-controls {
  display: flex;
  align-items: center;
  gap: 14px;
}
.head-controls label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
}
#theme {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  background: var(--glass);
  border: 1px solid var(--line);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
}
#theme:hover {
  background: var(--glass-hover);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}
#theme:active {
  transform: scale(0.95);
}

/* ═════════════════════════════════════════════════════════════
   6. PAGES & HERO METRIC CARDS (Modern SaaS Standard)
   ═════════════════════════════════════════════════════════════ */
.page {
  display: none;
  padding: 32px;
  flex: 1;
}
.page.shown {
  display: block;
  animation: pageEnter 0.35s var(--ease-out) forwards;
}

@keyframes pageEnter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 28px;
}
.hero-card {
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s var(--ease-out), border-color 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out);
}
.hero-card:hover {
  transform: translateY(-3px);
}

.hero-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.hero-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
}
.hero-icon-box {
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s var(--ease-out);
}
.hero-card:hover .hero-icon-box {
  transform: scale(1.08);
}

.hero-badge {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 3px 9px;
  border-radius: var(--radius-full);
}

/* ── Hero Temperature ── */
.hero-card.hero-temp {
  background: linear-gradient(150deg, rgba(249, 115, 22, 0.1) 0%, rgba(15, 23, 42, 0.92) 55%);
  border: 1px solid rgba(249, 115, 22, 0.26);
  border-top: 3px solid var(--orange);
  box-shadow: 0 8px 24px -6px rgba(249, 115, 22, 0.16);
}
.hero-card.hero-temp:hover {
  border-color: rgba(249, 115, 22, 0.5);
  box-shadow: 0 16px 36px -8px rgba(249, 115, 22, 0.32);
}
.hero-temp .hero-icon-box {
  background: rgba(249, 115, 22, 0.16);
  border: 1px solid rgba(249, 115, 22, 0.35);
  color: var(--orange);
}
.hero-temp .hero-label span {
  color: #fdba74;
}
.hero-temp .badge-temp {
  background: rgba(249, 115, 22, 0.15);
  color: var(--orange);
  border: 1px solid rgba(249, 115, 22, 0.3);
}
.hero-temp .hero-unit {
  color: var(--orange);
  font-weight: 700;
}

/* ── Hero Humidity ── */
.hero-card.hero-hum {
  background: linear-gradient(150deg, rgba(6, 182, 212, 0.1) 0%, rgba(15, 23, 42, 0.92) 55%);
  border: 1px solid rgba(6, 182, 212, 0.26);
  border-top: 3px solid var(--cyan);
  box-shadow: 0 8px 24px -6px rgba(6, 182, 212, 0.16);
}
.hero-card.hero-hum:hover {
  border-color: rgba(6, 182, 212, 0.5);
  box-shadow: 0 16px 36px -8px rgba(6, 182, 212, 0.32);
}
.hero-hum .hero-icon-box {
  background: rgba(6, 182, 212, 0.16);
  border: 1px solid rgba(6, 182, 212, 0.35);
  color: var(--cyan);
}
.hero-hum .hero-label span {
  color: #67e8f9;
}
.hero-hum .badge-hum {
  background: rgba(6, 182, 212, 0.15);
  color: var(--cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
}
.hero-hum .hero-unit {
  color: var(--cyan);
  font-weight: 700;
}

/* ── Hero Status ── */
.hero-card.hero-status {
  background: linear-gradient(150deg, rgba(16, 185, 129, 0.1) 0%, rgba(15, 23, 42, 0.92) 55%);
  border: 1px solid rgba(16, 185, 129, 0.26);
  border-top: 3px solid var(--green);
  box-shadow: 0 8px 24px -6px rgba(16, 185, 129, 0.16);
}
.hero-card.hero-status:hover {
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 16px 36px -8px rgba(16, 185, 129, 0.32);
}
.hero-status .hero-icon-box {
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: var(--green);
}
.hero-status .hero-label span {
  color: #6ee7b7;
}
.hero-status .badge-status {
  background: rgba(16, 185, 129, 0.15);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Light Theme Hero Adjustments */
[data-theme="light"] .hero-card.hero-temp {
  background: linear-gradient(150deg, rgba(249, 115, 22, 0.08) 0%, #ffffff 65%);
  border-color: rgba(249, 115, 22, 0.28);
}
[data-theme="light"] .hero-temp .hero-label span {
  color: #ea580c;
}

[data-theme="light"] .hero-card.hero-hum {
  background: linear-gradient(150deg, rgba(6, 182, 212, 0.08) 0%, #ffffff 65%);
  border-color: rgba(6, 182, 212, 0.28);
}
[data-theme="light"] .hero-hum .hero-label span {
  color: #0891b2;
}

[data-theme="light"] .hero-card.hero-status {
  background: linear-gradient(150deg, rgba(16, 185, 129, 0.08) 0%, #ffffff 65%);
  border-color: rgba(16, 185, 129, 0.28);
}
[data-theme="light"] .hero-status .hero-label span {
  color: #059669;
}

.hero-value {
  font-family: 'Prompt', 'Outfit', sans-serif;
  font-size: 44px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text);
}
.hero-unit {
  font-size: 20px;
  font-weight: 600;
  color: var(--muted);
  margin-left: 5px;
}
.hero-sub {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  font-weight: 700;
  font-size: 20px;
}
.status-row i {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 50%;
  animation: pulse 2s infinite;
  flex-shrink: 0;
}
.status-row i.green { background: var(--green); box-shadow: 0 0 12px var(--green); }
.status-row i.red { background: var(--red); box-shadow: 0 0 12px var(--red); }
.status-row i.orange { background: var(--orange); box-shadow: 0 0 12px var(--orange); }

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.85; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.85; }
}

.btn-hero-check {
  margin-top: 14px;
  background: var(--green-tint);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.18s var(--ease-out);
  width: 100%;
  justify-content: center;
}
.btn-hero-check:hover {
  background: rgba(16, 185, 129, 0.22);
  border-color: var(--green);
  box-shadow: 0 4px 14px var(--green-glow);
  transform: translateY(-1px);
}
.btn-hero-check svg {
  flex-shrink: 0;
}

/* Alert Banner */
.alert-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 22px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, rgba(6, 182, 212, 0.05) 50%, var(--panel-solid) 100%);
  border: 1px solid rgba(139, 92, 246, 0.26);
  border-radius: var(--radius);
  margin-bottom: 28px;
  box-shadow: 0 6px 22px -4px rgba(139, 92, 246, 0.14);
  flex-wrap: wrap;
  gap: 14px;
}
.alert-bar-info {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.alert-bar-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  background: rgba(139, 92, 246, 0.16);
  border: 1px solid rgba(139, 92, 246, 0.35);
  color: #c4b5fd;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.alert-bar-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
}
.alert-pill {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(6, 182, 212, 0.2));
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.4);
}
.alert-status-tag {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--cyan);
  background: var(--cyan-tint);
  border: 1px solid rgba(6, 182, 212, 0.28);
  padding: 2px 9px;
  border-radius: var(--radius-full);
}
.alert-bar-text {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.4;
}
.alert-bar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.btn-alert-sim {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(6, 182, 212, 0.18));
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: #ffffff;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  white-space: nowrap;
}
.btn-alert-sim:hover {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.35), rgba(6, 182, 212, 0.3));
  border-color: var(--cyan);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.3);
}

/* ═════════════════════════════════════════════════════════════
   7. SECTION HEADERS & STAT GRIDS
   ═════════════════════════════════════════════════════════════ */
.section-header {
  margin: 28px 0 14px;
}
.section-header h4 {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
}

.statgrid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.statgrid article {
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease-out), border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}
.statgrid article:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.statgrid article span {
  font-size: 12.5px;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.statgrid article strong {
  font-size: 22px;
  font-weight: 700;
  font-family: 'Prompt', 'Outfit', sans-serif;
  color: var(--text);
}
.statgrid article small {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 500;
}

/* Semantic Card Colors */
.statgrid article:nth-child(1),
.statgrid article.stat-records {
  border-top: 3px solid var(--violet);
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.08) 0%, var(--panel-solid) 100%);
}
.statgrid article:nth-child(1) span,
.statgrid article.stat-records span {
  color: #c4b5fd;
}
.statgrid article:nth-child(1):hover,
.statgrid article.stat-records:hover {
  border-color: rgba(139, 92, 246, 0.45);
  box-shadow: 0 8px 24px -4px rgba(139, 92, 246, 0.25);
}

.statgrid article:nth-child(2),
.statgrid article.stat-avg-temp {
  border-top: 3px solid var(--orange);
  background: linear-gradient(180deg, rgba(249, 115, 22, 0.08) 0%, var(--panel-solid) 100%);
}
.statgrid article:nth-child(2) span,
.statgrid article.stat-avg-temp span {
  color: #fdba74;
}
.statgrid article:nth-child(2):hover,
.statgrid article.stat-avg-temp:hover {
  border-color: rgba(249, 115, 22, 0.45);
  box-shadow: 0 8px 24px -4px rgba(249, 115, 22, 0.25);
}

.statgrid article:nth-child(3),
.statgrid article.stat-minmax-temp {
  border-top: 3px solid #fb923c;
  background: linear-gradient(180deg, rgba(251, 146, 60, 0.08) 0%, var(--panel-solid) 100%);
}
.statgrid article:nth-child(3) span,
.statgrid article.stat-minmax-temp span {
  color: #fed7aa;
}
.statgrid article:nth-child(3):hover,
.statgrid article.stat-minmax-temp:hover {
  border-color: rgba(251, 146, 60, 0.45);
  box-shadow: 0 8px 24px -4px rgba(251, 146, 60, 0.25);
}

.statgrid article:nth-child(4),
.statgrid article.stat-avg-hum {
  border-top: 3px solid var(--cyan);
  background: linear-gradient(180deg, rgba(6, 182, 212, 0.08) 0%, var(--panel-solid) 100%);
}
.statgrid article:nth-child(4) span,
.statgrid article.stat-avg-hum span {
  color: #67e8f9;
}
.statgrid article:nth-child(4):hover,
.statgrid article.stat-avg-hum:hover {
  border-color: rgba(6, 182, 212, 0.45);
  box-shadow: 0 8px 24px -4px rgba(6, 182, 212, 0.25);
}

.statgrid article:nth-child(5),
.statgrid article.stat-minmax-hum {
  border-top: 3px solid #14b8a6;
  background: linear-gradient(180deg, rgba(20, 184, 166, 0.08) 0%, var(--panel-solid) 100%);
}
.statgrid article:nth-child(5) span,
.statgrid article.stat-minmax-hum span {
  color: #5eead4;
}
.statgrid article:nth-child(5):hover,
.statgrid article.stat-minmax-hum:hover {
  border-color: rgba(20, 184, 166, 0.45);
  box-shadow: 0 8px 24px -4px rgba(20, 184, 166, 0.25);
}

/* ═════════════════════════════════════════════════════════════
   8. PANELS, CONTROLS & CHARTS
   ═════════════════════════════════════════════════════════════ */
.panel {
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 28px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: border-color 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out);
}
.panel.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}
.panel-head h3 {
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.title-temp { color: var(--orange); }
.title-hum { color: var(--cyan); }
.panel-head p {
  font-size: 13.5px;
  color: var(--muted);
  margin-top: 3px;
}
.panel-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Dashboard Specific Chart Panels */
.panel-chart-temp {
  border-top: 3px solid var(--orange);
  background: linear-gradient(180deg, rgba(249, 115, 22, 0.04) 0%, var(--panel-solid) 160px);
}
.panel-chart-temp:hover {
  border-color: rgba(249, 115, 22, 0.35);
  box-shadow: 0 12px 36px -8px rgba(249, 115, 22, 0.16);
}

.panel-chart-hum {
  border-top: 3px solid var(--cyan);
  background: linear-gradient(180deg, rgba(6, 182, 212, 0.04) 0%, var(--panel-solid) 160px);
}
.panel-chart-hum:hover {
  border-color: rgba(6, 182, 212, 0.35);
  box-shadow: 0 12px 36px -8px rgba(6, 182, 212, 0.16);
}

.panel-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}
.panel-icon-badge {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.panel-icon-badge.badge-temp {
  background: rgba(249, 115, 22, 0.15);
  border: 1px solid rgba(249, 115, 22, 0.32);
  color: var(--orange);
}
.panel-icon-badge.badge-hum {
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.32);
  color: var(--cyan);
}

.badge-live {
  background: var(--green-tint);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.badge-live::before {
  content: '';
  display: block;
  width: 6px; height: 6px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 1.6s infinite;
  box-shadow: 0 0 6px var(--green);
}
.badge-live.badge-live-cyan {
  background: var(--cyan-tint);
  color: var(--cyan);
  border-color: rgba(6, 182, 212, 0.3);
}
.badge-live.badge-live-cyan::before {
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan);
}
.badge-live.badge-live-orange {
  background: var(--orange-tint);
  color: var(--orange);
  border-color: rgba(249, 115, 22, 0.3);
}
.badge-live.badge-live-orange::before {
  background: var(--orange);
  box-shadow: 0 0 6px var(--orange);
}

/* ═════════════════════════════════════════════════════════════
   9. TACTILE BUTTONS & MODERN CONTROLS
   ═════════════════════════════════════════════════════════════ */
button {
  font-family: inherit;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Tactile press response on all buttons */
button:active,
.btn-tool:active,
.btn-preset:active,
.fs-btn:active,
.controls button:active {
  transform: scale(0.972) !important;
  transition: transform 0.08s var(--ease-out) !important;
}

.btn-tool {
  background: var(--glass);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s var(--ease-out);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  line-height: 1;
}
.btn-tool:hover {
  background: var(--glass-hover);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}
.btn-tool.primary {
  background: var(--cyan);
  border-color: var(--cyan);
  color: #fff;
  box-shadow: 0 2px 10px var(--cyan-glow), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn-tool.primary:hover {
  background: var(--cyan-hover);
  border-color: var(--cyan-hover);
  box-shadow: 0 4px 16px var(--cyan-glow), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transform: translateY(-1px);
}

.controls button {
  background: var(--cyan);
  color: #fff;
  border: 1px solid var(--cyan);
  padding: 0 18px;
  height: 40px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s var(--ease-out);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 2px 10px var(--cyan-glow), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.controls button:hover {
  background: var(--cyan-hover);
  border-color: var(--cyan-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--cyan-glow), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.controls .ghost,
.btn-ghost {
  background: var(--glass);
  border: 1px solid var(--line);
  color: var(--text);
  box-shadow: none;
}
.controls .ghost:hover,
.btn-ghost:hover {
  background: var(--glass-hover);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

/* Form Inputs & Selects */
input, select {
  background: var(--bg2);
  border: 1px solid var(--line);
  color: var(--text);
  height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out), background 0.2s var(--ease-out);
}
input:focus, select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--cyan-glow);
  background: var(--panel2);
}

.chart-wrap {
  position: relative;
  width: 100%;
  height: 280px;
  cursor: pointer;
  transition: transform 0.2s var(--ease-out);
}
.chart-wrap:hover {
  transform: scale(1.006);
}
.chart-wrap.big {
  height: 400px;
}

/* ═════════════════════════════════════════════════════════════
   10. TABLE PAGE & DATA RANGE HINT
   ═════════════════════════════════════════════════════════════ */
.table-range-hint {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 16px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}
.range-hint-badge {
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--cyan-tint);
  color: var(--cyan);
  border: 1px solid rgba(6, 182, 212, 0.25);
}
.range-hint-text {
  font-size: 13.5px;
  color: var(--text-dim);
}
.range-hint-text b {
  color: var(--text);
  font-weight: 700;
}

.table-panel {
  padding: 0;
  overflow: auto;
  border-radius: var(--radius-lg);
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
th {
  background: rgba(0, 0, 0, 0.25);
  padding: 14px 18px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
td {
  padding: 14px 18px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--line-subtle);
  color: var(--text-dim);
}
tr:last-child td {
  border-bottom: none;
}
tr:hover td {
  background: var(--glass-hover);
  color: var(--text);
}

/* ═════════════════════════════════════════════════════════════
   10.1 DEVICE PAGE, SENSOR SPECS & ALERT CONTROLS
   ═════════════════════════════════════════════════════════════ */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.cards article {
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.2s var(--ease-out);
}
.cards article:hover {
  border-color: var(--line-strong);
}
.card-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  background: var(--cyan-tint);
  color: var(--cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
  border: 1px solid rgba(6, 182, 212, 0.25);
}
.card-icon-green {
  background: var(--green-tint);
  color: var(--green);
  border-color: rgba(16, 185, 129, 0.25);
}
.cards article span {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.cards article strong {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}
.cards article small {
  font-size: 12.5px;
  color: var(--muted);
}

/* ═════════════════════════════════════════════════════════════
   10. DEVICE & HARDWARE TELEMETRY MANAGEMENT CENTER
   ═════════════════════════════════════════════════════════════ */

/* Device Hardware Hero Ribbon */
.device-hero-ribbon {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 16px;
}
.device-ribbon-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.device-pulse-indicator {
  position: relative;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.device-ribbon-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.node-id-chip {
  background: var(--cyan-tint);
  color: var(--cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 800;
  font-family: monospace;
}
.device-ribbon-sub {
  font-size: 13.5px;
  color: var(--muted);
  margin-top: 2px;
}
.device-ribbon-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.pill-code {
  font-family: monospace;
  font-size: 12.5px;
  color: var(--cyan);
  font-weight: 600;
}

/* 4-Card Node & Sensor Matrix Grid */
.node-matrix-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.node-card {
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color 0.2s var(--ease-out);
}
.node-card:hover {
  border-color: var(--line-strong);
}
.node-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.node-name {
  display: flex;
  align-items: center;
  gap: 10px;
}
.node-name strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.node-name small {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 1px;
}
.node-type-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--cyan-tint);
  color: var(--cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.node-icon-green {
  background: var(--green-tint);
  color: var(--green);
}
.node-icon-cyan {
  background: var(--cyan-tint);
  color: var(--cyan);
}
.node-icon-orange {
  background: var(--orange-tint);
  color: var(--orange);
}
.node-card-body {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}
.node-stat small {
  font-size: 12px;
  color: var(--muted);
  display: block;
  margin-bottom: 2px;
}
.node-stat strong {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}
.node-badge-elapsed {
  font-size: 12px;
  color: var(--muted);
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg2);
  border: 1px solid var(--line);
}
.node-badge-muted {
  font-size: 12px;
  color: var(--muted);
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg2);
  border: 1px solid var(--line);
}
.node-badge-rate {
  font-size: 12px;
  font-weight: 700;
  color: var(--orange);
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--orange-tint);
  border: 1px solid rgba(249, 115, 22, 0.3);
}

/* 1-Column Device Workbench Grid */
.device-workbench-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
.device-pipeline-panel,
.device-alert-panel {
  padding: 22px;
  display: flex;
  flex-direction: column;
}

/* Embedded 3-Stage Visual Pipeline */
.pipeline-track {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 16px 0 20px 0;
  gap: 8px;
}
.pipe-node {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}
.pipe-node-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  color: var(--cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pipe-node-info strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.pipe-node-info small {
  display: block;
  font-size: 12px;
  color: var(--muted);
}
.pipe-node-status {
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: auto;
}
.pipe-node-status.ok {
  background: var(--green-tint);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.pipe-connector {
  display: flex;
  align-items: center;
  gap: 2px;
  color: var(--muted);
  opacity: 0.5;
}
.pipe-line {
  display: inline-block;
  width: 14px;
  height: 1px;
  background: var(--line-strong);
}

/* Diagnostic Action Buttons Bar */
.diag-action-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

/* Alert Threshold Controls in Right Column */
.threshold-toggle-box {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 16px;
}
.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.toggle-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--cyan);
  cursor: pointer;
}
.toggle-label-text strong {
  display: block;
  font-size: 13.5px;
  color: var(--text);
}
.toggle-label-text small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
}
.threshold-inputs-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.thresh-input-card {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.thresh-card-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.thresh-card-label span {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.thresh-limit-tag {
  font-size: 11.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
}
.thresh-limit-tag.danger {
  background: var(--red-tint);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.thresh-limit-tag.warning {
  background: var(--orange-tint);
  color: var(--orange);
  border: 1px solid rgba(249, 115, 22, 0.3);
}
.input-with-suffix {
  display: flex;
  align-items: center;
  position: relative;
}
.input-with-suffix input {
  width: 100%;
  font-family: monospace;
  font-size: 13px;
  font-weight: 600;
  padding-right: 42px;
}
.input-with-suffix .input-unit {
  position: absolute;
  right: 12px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  pointer-events: none;
}

/* Safe Zone Indicator */
.safe-zone-container {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 18px;
}
.safe-zone-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 8px;
}
.safe-zone-header strong {
  color: var(--green);
  font-family: monospace;
}
.safe-zone-track {
  height: 6px;
  border-radius: 3px;
  display: flex;
  overflow: hidden;
  gap: 2px;
}
.zone-segment {
  height: 100%;
}
.zone-segment.zone-low {
  flex: 1.5;
  background: rgba(249, 115, 22, 0.4);
}
.zone-segment.zone-optimal {
  flex: 5;
  background: var(--green);
  box-shadow: 0 0 6px var(--green-glow);
}
.zone-segment.zone-high {
  flex: 1.5;
  background: rgba(239, 68, 68, 0.4);
}

/* Alert History Log */
.alert-log-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.alert-log-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.alert-log-head h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0;
}
.btn-clear-log {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-clear-log:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
  border-color: rgba(239, 68, 68, 0.3);
}
.alert-history-box {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.alert-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
}
.alert-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.alert-item-body strong {
  display: block;
  color: var(--text);
  font-size: 13px;
}
.alert-item-body small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 1px;
}
.alert-item.alert-danger {
  border-color: rgba(239, 68, 68, 0.3);
}
.alert-item.alert-warning {
  border-color: rgba(249, 115, 22, 0.3);
}

/* ═════════════════════════════════════════════════════════════
   11. REAL HARDWARE LIVE INSPECTOR MODAL
   ═════════════════════════════════════════════════════════════ */
.diag-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(4, 7, 16, 0.76);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s var(--ease-out);
}
.diag-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.diag-modal-content {
  background: var(--panel-solid);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-modal), var(--rim-light);
  display: flex;
  flex-direction: column;
  transform: scale(0.95) translateY(12px);
  transition: transform 0.28s var(--ease-out);
}
.diag-modal-overlay.active .diag-modal-content {
  transform: scale(1) translateY(0);
}

.diag-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--panel2);
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
}
.diag-modal-icon {
  font-size: 22px;
  background: var(--cyan-tint);
  border: 1px solid rgba(6, 182, 212, 0.3);
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.diag-modal-close {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.18s var(--ease-out);
}
.diag-modal-close:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
  border-color: var(--red);
  transform: rotate(90deg);
}
.diag-modal-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 3-Step Hardware Pipeline */
.diag-pipeline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  gap: 8px;
}
.pipeline-step {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}
.step-badge {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--muted);
  font-weight: 800;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s var(--ease-out);
}
.step-badge.step-ok {
  background: var(--green);
  color: #080e1e;
  box-shadow: 0 0 12px var(--green-glow);
}
.step-badge.step-warn {
  background: var(--orange);
  color: #080e1e;
  box-shadow: 0 0 12px var(--orange-glow);
}
.step-badge.step-err {
  background: var(--red);
  color: #ffffff;
  box-shadow: 0 0 12px var(--red-glow);
}
.step-info strong {
  display: block;
  font-size: 13.5px;
  color: var(--text);
  font-weight: 700;
}
.step-info small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
}
.pipeline-arrow {
  color: var(--muted);
  font-size: 14px;
  opacity: 0.4;
}

/* Diagnostic Verdict Banner */
.diag-verdict {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: all 0.25s var(--ease-out);
}
.verdict-loading {
  background: rgba(148, 163, 184, 0.08);
  border-color: rgba(148, 163, 184, 0.2);
}
.verdict-ok {
  background: var(--green-tint);
  border-color: var(--green);
}
.verdict-delayed {
  background: var(--orange-tint);
  border-color: var(--orange);
}
.verdict-err {
  background: var(--red-tint);
  border-color: var(--red);
}

.diag-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.diag-card-box {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.box-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-subtle);
}
.box-head h4 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
}
.box-tag {
  font-size: 11.5px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tag-esp {
  background: var(--cyan-tint);
  color: var(--cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
}
.tag-server {
  background: var(--green-tint);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.box-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.box-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}
.box-row span {
  color: var(--muted);
}
.box-row strong {
  font-weight: 600;
  color: var(--text);
}
.box-row code {
  background: rgba(0, 0, 0, 0.35);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 12.5px;
  color: var(--cyan);
}
.badge-elapsed {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
}

.diag-advice-box {
  background: var(--cyan-tint);
  border: 1px solid rgba(6, 182, 212, 0.22);
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}
.diag-advice-box b {
  color: var(--cyan);
}

.diag-ping-section {
  background: var(--panel2);
  border: 1px solid rgba(6, 182, 212, 0.35);
  border-radius: var(--radius);
  padding: 18px;
  transition: all 0.25s var(--ease-out);
}
.diag-ping-section:hover {
  border-color: var(--cyan);
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.15);
}

.diag-modal-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  background: var(--panel2);
  border-bottom-left-radius: var(--radius-xl);
  border-bottom-right-radius: var(--radius-xl);
  flex-wrap: wrap;
}

/* ═════════════════════════════════════════════════════════════
   12. FULLSCREEN STUDIO OVERLAY
   ═════════════════════════════════════════════════════════════ */
.fs-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: scale(0.985);
  pointer-events: none;
  transition: opacity 0.24s var(--ease-out), transform 0.24s var(--ease-out);
}
.fs-overlay.active {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.fs-header {
  background: var(--panel);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--line);
  padding: 16px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow);
}
.fs-title-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.fs-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.fs-badge {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--panel2);
  border: 1px solid var(--line);
}
.fs-badge.live { background: var(--green-tint); color: var(--green); border-color: rgba(16, 185, 129, 0.3); }
.fs-badge.unit { background: var(--cyan-tint); color: var(--cyan); border-color: rgba(6, 182, 212, 0.3); }
.fs-title-box h2 {
  font-size: 18px;
  font-weight: 700;
}
.fs-title-box p {
  font-size: 13px;
  color: var(--muted);
}

.fs-stats-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 16px;
}
.fs-stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.fs-stat-item span {
  font-size: 11.5px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.fs-stat-item strong {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.fs-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.fs-btn-group {
  display: inline-flex;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
}
.fs-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s var(--ease-out);
}
.fs-btn:hover {
  background: var(--glass-hover);
  color: var(--text);
}
.fs-btn.active {
  background: var(--cyan);
  color: #fff;
  box-shadow: 0 2px 8px var(--cyan-glow);
}
.fs-btn.primary {
  background: var(--cyan);
  color: #fff;
  border: 1px solid var(--cyan);
  box-shadow: 0 2px 10px var(--cyan-glow);
}
.fs-btn.primary:hover {
  background: var(--cyan-hover);
  transform: translateY(-1px);
}
.fs-btn.close {
  background: var(--glass);
  border: 1px solid var(--line);
  color: var(--text);
}
.fs-btn.close:hover {
  background: rgba(239, 68, 68, 0.18);
  color: var(--red);
  border-color: var(--red);
}

.fs-yscale-group {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
}
.fs-group-label {
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--muted);
}
.fs-y-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
}
.fs-y-inputs input {
  width: 54px;
  height: 28px;
  padding: 0 6px;
  font-size: 13px;
  text-align: center;
}
.fs-btn-apply {
  background: var(--cyan);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.fs-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 24px;
  gap: 12px;
  overflow: hidden;
}
.fs-hint-bar {
  font-size: 12.5px;
  color: var(--muted);
  background: var(--panel2);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}
.fs-canvas-container {
  flex: 1;
  position: relative;
  width: 100%;
  min-height: 0;
}

/* ═════════════════════════════════════════════════════════════
   13. TOAST NOTIFICATION CONTAINER
   ═════════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  top: 20px;
  right: 24px;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 420px;
  background: var(--panel-solid);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow-lg), var(--rim-light);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: toastIn 0.3s var(--ease-out);
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px) scale(0.96); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}
.toast-danger { border-color: rgba(239, 68, 68, 0.4); box-shadow: 0 0 16px rgba(239, 68, 68, 0.12), var(--shadow-lg); }
.toast-warning { border-color: rgba(249, 115, 22, 0.4); box-shadow: 0 0 16px rgba(249, 115, 22, 0.12), var(--shadow-lg); }
.toast-success { border-color: rgba(16, 185, 129, 0.4); box-shadow: 0 0 16px rgba(16, 185, 129, 0.12), var(--shadow-lg); }
.toast-icon { font-size: 18px; flex-shrink: 0; }
.toast-msg { font-size: 13px; font-weight: 500; color: var(--text); flex: 1; line-height: 1.4; }
.toast-close {
  background: transparent; border: none; color: var(--muted);
  font-size: 13px; cursor: pointer; padding: 4px; border-radius: 4px;
}
.toast-close:hover { color: var(--text); background: var(--glass-hover); }

/* ═════════════════════════════════════════════════════════════
   14. API STATUS, WORKBENCH & FAULT INJECTION CONSOLE
   ═════════════════════════════════════════════════════════════ */

/* Top System Health Ribbon */
.api-hero-ribbon {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 16px;
}
.api-ribbon-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.api-pulse-indicator {
  position: relative;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pulse-core {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
}
.pulse-ring {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.3);
  animation: pulse 2s infinite;
}
.api-ribbon-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.api-ribbon-sub {
  font-size: 13.5px;
  color: var(--muted);
  margin-top: 2px;
}
.api-ribbon-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.ribbon-meta-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 12px;
}
.pill-label {
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.pill-value {
  font-weight: 600;
  color: var(--text);
}
.badge-mode-live {
  background: var(--green-tint);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
}
.badge-mode-mock {
  background: var(--orange-tint);
  color: var(--orange);
  border: 1px solid rgba(249, 115, 22, 0.3);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
}

/* 4 Service Health Cards Matrix */
.service-matrix-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.service-card {
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color 0.2s var(--ease-out);
}
.service-card:hover {
  border-color: var(--line-strong);
}
.service-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.service-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}
.service-type-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--cyan-tint);
  color: var(--cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.service-card-body {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}
.service-stat small {
  font-size: 12px;
  color: var(--muted);
  display: block;
  margin-bottom: 2px;
}
.service-stat strong {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}
.service-badge-muted {
  font-size: 12px;
  color: var(--muted);
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg2);
  border: 1px solid var(--line);
}
.btn-xs {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

/* 2-Column API Workbench Grid */
.api-workbench-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 20px;
}
.api-explorer-col, .api-console-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* API Config Card */
.api-config-panel {
  padding: 20px;
}
.api-key-config-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.api-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.api-input-wrap label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.input-with-action {
  position: relative;
  display: flex;
  align-items: center;
}
.input-with-action input {
  font-family: monospace;
  font-size: 13px;
  width: 100%;
  padding-right: 56px;
  background: var(--bg2);
}
.btn-copy-input {
  position: absolute;
  right: 6px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-copy-input:hover {
  background: var(--cyan-tint);
  color: var(--cyan);
  border-color: rgba(6, 182, 212, 0.4);
}
.api-security-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  padding: 8px 12px;
  background: var(--bg2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}
.api-security-notice code {
  font-family: monospace;
  color: var(--cyan);
}

/* Endpoints Explorer List */
.api-endpoints-panel {
  padding: 20px;
}
.endpoints-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}
.endpoint-card-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s ease;
}
.endpoint-card-item:hover {
  border-color: var(--line-strong);
  background: var(--panel2);
}
.endpoint-card-item.active {
  border-color: var(--cyan);
  background: rgba(6, 182, 212, 0.06);
}
.ep-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ep-method {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  font-family: monospace;
}
.ep-get {
  background: var(--cyan-tint);
  color: var(--cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
}
.ep-post {
  background: var(--green-tint);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.ep-detail {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ep-path {
  font-family: monospace;
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
}
.ep-detail small {
  font-size: 12.5px;
  color: var(--muted);
}
.btn-ep-run {
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  background: var(--panel-solid);
  border: 1px solid var(--line);
  color: var(--cyan);
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-ep-run:hover {
  background: var(--cyan);
  color: #fff;
  border-color: var(--cyan);
}
.btn-ep-run.primary {
  color: var(--green);
}
.btn-ep-run.primary:hover {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

/* Right Column: Live Terminal & Inspector */
.api-terminal-panel {
  display: flex;
  flex-direction: column;
  background: #030712;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 400px;
  padding: 0;
}
.terminal-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: #080f1e;
  border-bottom: 1px solid var(--line);
}
.terminal-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}
.dot-red, .dot-yellow, .dot-green {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}
.dot-red { background: #ef4444; }
.dot-yellow { background: #f59e0b; }
.dot-green { background: #10b981; }
.terminal-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.05em;
  margin-left: 6px;
}
.terminal-actions {
  display: flex;
  gap: 6px;
}
.btn-term-action {
  font-size: 12px;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-term-action:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.12);
}
.api-result-box {
  flex: 1;
  padding: 18px;
  font-family: monospace;
  font-size: 12.5px;
  overflow-y: auto;
  max-height: 480px;
  background: #030712;
}
.terminal-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}
.placeholder-icon {
  margin-bottom: 12px;
  opacity: 0.35;
  color: var(--cyan);
}
.terminal-placeholder strong {
  font-size: 14px;
  color: var(--text);
  margin-bottom: 6px;
}
.terminal-placeholder p {
  font-size: 13px;
  color: var(--muted);
  max-width: 320px;
  line-height: 1.5;
}

.terminal-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px;
  color: var(--muted);
  font-family: inherit;
  font-size: 13.5px;
}
.loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.api-result-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.api-badge {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
}
.api-badge-ok { background: var(--green-tint); color: var(--green); border: 1px solid rgba(16, 185, 129, 0.4); }
.api-badge-err { background: var(--red-tint); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.4); }
.api-badge-time { background: rgba(255, 255, 255, 0.08); color: var(--muted); border: 1px solid var(--line); }
.api-method { font-weight: 700; color: var(--cyan); font-size: 12.5px; }
.api-url {
  font-size: 12.5px;
  color: var(--muted);
  word-break: break-all;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.api-body-label {
  font-size: 12.5px;
  color: var(--muted);
  text-transform: uppercase;
  margin-top: 10px;
  margin-bottom: 4px;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.api-json {
  font-size: 12.5px;
  color: #38bdf8;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
  background: rgba(0, 0, 0, 0.3);
  padding: 10px 14px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* Fault Injection Card */
.api-fault-panel {
  padding: 20px;
}
.fault-groups-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}
.fault-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fault-group-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.fault-buttons-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.btn-sim-err {
  background: var(--red-tint);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-sim-err:hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: var(--red);
  color: #fff;
}

/* Database Schema Reference Table */
.api-schema-panel {
  padding: 22px;
}
.schema-table-wrap {
  overflow-x: auto;
  margin-top: 14px;
}
.schema-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.schema-table th {
  background: var(--bg2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  letter-spacing: 0.03em;
}
.schema-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
}
.schema-table tr:hover td {
  background: var(--panel2);
}
.schema-table code {
  font-family: monospace;
  font-size: 12.5px;
  color: var(--cyan);
}
.badge-key {
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
}
.badge-key.pk {
  background: rgba(245, 158, 11, 0.15);
  color: var(--orange);
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.badge-key.index {
  background: var(--cyan-tint);
  color: var(--cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

/* ═════════════════════════════════════════════════════════════
   15. HAMBURGER & RESPONSIVE DRAWER (Mobile <= 850px)
   ═════════════════════════════════════════════════════════════ */
.hamburger {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  z-index: 200;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s var(--ease-out), opacity 0.2s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.sidebar-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease-out);
}
.sidebar-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

footer {
  text-align: center;
  padding: 24px;
  color: var(--muted);
  font-size: 13.5px;
  margin-top: auto;
  border-top: 1px solid var(--line);
}

@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; }
  .statgrid { grid-template-columns: repeat(2, 1fr); }
  .cards { grid-template-columns: 1fr; }
  .spec-grid { grid-template-columns: repeat(2, 1fr); }
  .threshold-inputs { grid-template-columns: repeat(2, 1fr); }
  .threshold-inputs-grid { grid-template-columns: repeat(2, 1fr); }
  .fs-header { flex-direction: column; align-items: stretch; }
  .fs-stats-bar { overflow-x: auto; }
  .service-matrix-grid { grid-template-columns: repeat(2, 1fr); }
  .api-workbench-grid { grid-template-columns: 1fr; }
  .api-key-config-row { grid-template-columns: 1fr; }
  .node-matrix-grid { grid-template-columns: repeat(2, 1fr); }
  .device-workbench-grid { grid-template-columns: 1fr; }
}

@media (max-width: 850px) {
  .hamburger { display: flex; }
  aside { transform: translateX(-100%); }
  aside.open { transform: translateX(0); }
  .shell { margin-left: 0; }
  .page { padding: 20px 16px; }
  header { padding: 14px 18px; }
  .diag-cards-grid { grid-template-columns: 1fr; }
  .api-status-grid { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
  .statgrid { grid-template-columns: 1fr; }
  .spec-grid { grid-template-columns: 1fr; }
  .threshold-inputs { grid-template-columns: 1fr; }
  .threshold-inputs-grid { grid-template-columns: 1fr; }
  .hero-value { font-size: 38px; }
  .hero-unit { font-size: 18px; }
  .diag-pipeline { flex-direction: column; align-items: stretch; }
  .pipeline-arrow { text-align: center; transform: rotate(90deg); }
  .service-matrix-grid { grid-template-columns: 1fr; }
  .api-hero-ribbon { flex-direction: column; align-items: flex-start; }
  .api-ribbon-right { width: 100%; justify-content: space-between; }
  .node-matrix-grid { grid-template-columns: 1fr; }
  .device-hero-ribbon { flex-direction: column; align-items: flex-start; }
  .device-ribbon-right { width: 100%; justify-content: space-between; }
  .pipeline-track { flex-direction: column; align-items: stretch; }
  .pipe-connector { justify-content: center; transform: rotate(90deg); margin: 6px 0; }
  .threshold-inputs-grid { grid-template-columns: 1fr; }
}

/* ═════════════════════════════════════════════════════════════
   15.5 TELEGRAM NOTIFICATION HUB STYLES
   ═════════════════════════════════════════════════════════════ */
.telegram-icon-badge {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2AABEE, #229ED9);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(42, 171, 238, 0.35);
  flex-shrink: 0;
}
.tg-pill-quick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(42, 171, 238, 0.12);
  border: 1px solid rgba(42, 171, 238, 0.35);
  color: #38bdf8;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.tg-pill-quick:hover {
  background: rgba(42, 171, 238, 0.22);
  transform: translateY(-1px);
}
.tg-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.telegram-config-grid {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}
.tg-input-card {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tg-input-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.tg-sub-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
}
.input-with-action {
  display: flex;
  gap: 8px;
  align-items: center;
}
.input-with-action input {
  flex: 1;
  font-family: monospace;
  font-size: 13px;
  font-weight: 600;
}
.tg-help-text {
  font-size: 11.5px;
  color: var(--muted);
}
.tg-actions-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 8px;
}

@media (max-width: 900px) {
  .telegram-config-grid {
    grid-template-columns: 1fr;
  }
}

/* ═════════════════════════════════════════════════════════════
   16. ACCESSIBILITY: REDUCED MOTION PREFERENCE
   ═════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
