/* ==========================================================================
   BRT Labs (https://brt-labs.tech) - PowerQ Runtime
   Vercel-Inspired Dark Industrial Design System
   ========================================================================== */

:root {
  color-scheme: dark;
  --bg-primary: #000000;
  --bg-secondary: #0a0a0a;
  --bg-tertiary: #111111;
  --bg-elevated: #161616;
  --bg-card: #0d0d0e;
  --bg-card-hover: #121214;
  
  --border-subtle: #1f1f23;
  --border-muted: #2b2b30;
  --border-highlight: #3e3e46;
  --border-focus: #52525e;

  --text-primary: #ededed;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --text-dim: #52525b;

  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.15);
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;

  /* Industrial OT States */
  --state-running: #10b981;
  --state-running-bg: rgba(16, 185, 129, 0.1);
  --state-running-border: rgba(16, 185, 129, 0.3);
  --state-running-glow: rgba(16, 185, 129, 0.4);

  --state-idle: #f59e0b;
  --state-idle-bg: rgba(245, 158, 11, 0.1);
  --state-idle-border: rgba(245, 158, 11, 0.3);
  --state-idle-glow: rgba(245, 158, 11, 0.4);

  --state-fault: #ef4444;
  --state-fault-bg: rgba(239, 68, 68, 0.1);
  --state-fault-border: rgba(239, 68, 68, 0.3);
  --state-fault-glow: rgba(239, 68, 68, 0.4);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", "Geist", system-ui, sans-serif;
  --font-mono: "Geist Mono", "JetBrains Mono", SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --transition-fast: 150ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 250ms cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  overflow-x: hidden !important;
  width: 100% !important;
  max-width: 100vw !important;
  position: relative !important;
}

html {
  color-scheme: dark;
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  color-scheme: dark;
  min-height: 100vh;
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(120, 119, 198, 0.15), transparent),
    radial-gradient(circle at 100% 10%, rgba(6, 182, 212, 0.08), transparent 30%);
  background-attachment: fixed;
  line-height: 1.6;
}

/* Container */
.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ==========================================================================
   Navigation Bar
   ========================================================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(0, 0, 0, 0.75);
  border-bottom: 1px solid var(--border-subtle);
  transition: border-color var(--transition-fast);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.brand-logo-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ffffff 0%, #a1a1aa 100%);
  border-radius: var(--radius-sm);
  color: #000;
  font-weight: 800;
  font-size: 0.95rem;
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.2);
}

.brand-badge {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-muted);
  color: var(--accent-cyan);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  letter-spacing: 0.05em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  list-style: none;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.nav-link:hover {
  color: var(--text-primary);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

/* ==========================================================================
   Buttons & Pills (Vercel Style)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  white-space: nowrap;
  font-family: inherit;
}

.btn-primary {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.15);
}

.btn-primary:hover {
  background: #eaeaea;
  box-shadow: 0 0 30px rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--border-muted);
}

.btn-secondary:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-highlight);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  border-radius: var(--radius-md);
}

.btn-emerald {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.4);
}
.btn-emerald:hover {
  background: rgba(16, 185, 129, 0.25);
  border-color: #10b981;
}

.btn-amber {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.4);
}
.btn-amber:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: #f59e0b;
}

.btn-crimson {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
}
.btn-crimson:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
}

/* Badge Pill */
.pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  backdrop-filter: blur(8px);
  margin-bottom: 1.5rem;
}

.pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan);
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero-section {
  padding: 5rem 0 3.5rem;
  text-align: center;
  position: relative;
}

.hero-title {
  font-size: clamp(2.5rem, 5.5vw, 4.25rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: var(--hero-letter-spacing, -0.04em);
  max-width: 960px;
  margin: 0 auto 1.5rem;
  color: #ffffff;
  text-shadow: 0 0 1px rgba(255, 255, 255, 0.9), 0 2px 20px rgba(255, 255, 255, 0.18);
  /* Top starts out crisp bright white (#ffffff) at 0-55%, transitioning to platinum #d4d4d8 */
  background-image: linear-gradient(
    180deg,
    #ffffff 0%,
    #ffffff var(--hero-white-stop, 55%),
    var(--hero-bottom-color, #d4d4d8) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  filter: drop-shadow(0 2px var(--hero-glow-blur, 16px) rgba(255, 255, 255, var(--hero-glow-alpha, 0.12)));
  transform: translateY(var(--hero-scroll-y, 0px));
  opacity: var(--hero-scroll-opacity, 1);
  will-change: transform, opacity, filter;
  animation: heroTitleDrop 1.1s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Opera GX / Forced Dark Mode text rendering protection */
@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .hero-title {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
  }
}

@keyframes heroTitleDrop {
  0% {
    opacity: 0;
    transform: translateY(-25px);
    filter: drop-shadow(0 4px 30px rgba(255, 255, 255, 0.45));
  }
  60% {
    opacity: 0.95;
    filter: drop-shadow(0 3px 22px rgba(255, 255, 255, 0.25));
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    filter: drop-shadow(0 2px 16px rgba(255, 255, 255, 0.12));
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-title {
    animation: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
}

.hero-subtitle {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  color: var(--text-secondary);
  max-width: 740px;
  margin: 0 auto 2.25rem;
  line-height: 1.55;
  font-weight: 400;
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
}

/* Terminal / Code install box */
.terminal-snippet {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-md);
  padding: 0.65rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-primary);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.terminal-prompt {
  color: var(--text-muted);
  user-select: none;
}

.terminal-copy-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 0.25rem;
  border-radius: 4px;
  transition: all var(--transition-fast);
}

.terminal-copy-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* Quick Metrics Strip */
.metrics-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  max-width: 1040px;
  margin: 3.5rem auto 1rem;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(10px);
}

.metric-item {
  text-align: center;
}

.metric-val {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #ffffff;
  font-family: var(--font-mono);
}

.metric-lbl {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* ==========================================================================
   Interactive Live Sandbox (Centerpiece App Test)
   ========================================================================== */
.sandbox-section {
  padding: 3rem 0 5rem;
  position: relative;
}

.section-header {
  text-align: center;
  max-width: 680px;
  margin: 0 auto 2.5rem;
}

.section-tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-cyan);
  margin-bottom: 0.5rem;
  display: block;
}

.section-title {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #ffffff;
  margin-bottom: 0.75rem;
}

.section-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* App Console Window */
.app-console {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05), 0 30px 60px rgba(0, 0, 0, 0.75);
  overflow: hidden;
  position: relative;
}

/* Top bar of App Console */
.console-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 0.75rem;
}

.console-area-badge {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.console-area-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--state-running);
  box-shadow: 0 0 8px var(--state-running);
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.connection-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border-muted);
  color: var(--text-secondary);
}

.connection-status-pill.active {
  border-color: var(--state-running-border);
  color: #34d399;
}

/* Console Navigation Tabs */
.console-tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0.6rem 1.25rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.console-tabs::-webkit-scrollbar {
  display: none;
}

.console-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.825rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  font-family: inherit;
}

.console-tab-btn:hover {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
}

.console-tab-btn.active {
  color: #ffffff;
  background: var(--bg-elevated);
  border-color: var(--border-muted);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* Main Dashboard Inside Console */
.console-body {
  padding: 1.5rem;
}

/* Primary State Header Card */
.area-state-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 2rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-subtle);
  transition: all var(--transition-normal);
  background: var(--bg-card);
  flex-wrap: wrap;
  gap: 1.5rem;
}

.area-state-banner.state-running {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.08) 0%, rgba(13, 13, 14, 0.8) 100%);
  border-color: var(--state-running-border);
  box-shadow: 0 0 40px rgba(16, 185, 129, 0.1);
}

.area-state-banner.state-idle {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.08) 0%, rgba(13, 13, 14, 0.8) 100%);
  border-color: var(--state-idle-border);
  box-shadow: 0 0 40px rgba(245, 158, 11, 0.1);
}

.area-state-banner.state-fault {
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.12) 0%, rgba(13, 13, 14, 0.8) 100%);
  border-color: var(--state-fault-border);
  box-shadow: 0 0 40px rgba(239, 68, 68, 0.15);
}

.state-meta-left {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.state-indicator-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.state-indicator-badge.running {
  color: #10b981;
  background: var(--state-running-bg);
  border-color: var(--state-running-border);
}

.state-indicator-badge.idle {
  color: #f59e0b;
  background: var(--state-idle-bg);
  border-color: var(--state-idle-border);
}

.state-indicator-badge.fault {
  color: #ef4444;
  background: var(--state-fault-bg);
  border-color: var(--state-fault-border);
  animation: fault-pulse 1s infinite alternate;
}

@keyframes fault-pulse {
  from { box-shadow: 0 0 10px rgba(239, 68, 68, 0.3); }
  to { box-shadow: 0 0 25px rgba(239, 68, 68, 0.6); }
}

.state-desc-group h4 {
  font-size: 1.15rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.01em;
}

.state-desc-group p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  margin-top: 0.15rem;
}

/* Quick KPI Row */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  transition: border-color var(--transition-fast);
}

.kpi-card:hover {
  border-color: var(--border-highlight);
}

.kpi-title {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}

.kpi-unit {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-secondary);
}

/* Timeline & Histogram */
.timeline-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.timeline-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.timeline-legend {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.legend-chip::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.legend-chip.run::before { background: var(--state-running); }
.legend-chip.idl::before { background: var(--state-idle); }
.legend-chip.flt::before { background: var(--state-fault); }

.timeline-canvas-container {
  width: 100%;
  height: 48px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  position: relative;
}

canvas#stateTimelineCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Tab Panels */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 200ms ease-in-out;
}

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

/* ==========================================================================
   Tab 1: Mock Telemetry Controls
   ========================================================================== */
.mock-control-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 1.25rem;
  width: 100%;
}

.control-panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  min-width: 0;
  box-sizing: border-box;
}

.panel-subheading {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quick-injection-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

.slider-group {
  margin-bottom: 1rem;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.slider-input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: #18181b;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  outline: none;
  cursor: pointer;
}

.slider-input::-webkit-slider-runnable-track {
  width: 100%;
  height: 6px;
  background: #18181b;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.slider-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #00d2be;
  cursor: pointer;
  margin-top: -5px;
  box-shadow: 0 0 10px rgba(0, 210, 190, 0.6);
  border: 2px solid #000000;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.slider-input::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 0 14px rgba(0, 210, 190, 0.9);
}

.slider-input::-moz-range-track {
  width: 100%;
  height: 6px;
  background: #18181b;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.slider-input::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #00d2be;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(0, 210, 190, 0.6);
  border: 2px solid #000000;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.slider-input::-moz-range-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 0 14px rgba(0, 210, 190, 0.9);
}

/* Telemetry Table */
.telemetry-table-wrapper {
  overflow-x: auto;
}

.telemetry-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.825rem;
  font-family: var(--font-mono);
}

.telemetry-table th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.telemetry-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.telemetry-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-primary);
}

.val-badge {
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-muted);
  color: #fff;
}

/* ==========================================================================
   Tab 2: Factory PLC Connection Panel
   ========================================================================== */
.plc-config-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-label {
  font-size: 0.775rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-input, .form-select {
  background: var(--bg-primary);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-fast);
}

.form-input:focus, .form-select:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px var(--accent-cyan-glow);
}

.console-log-box {
  background: #040405;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.775rem;
  color: #10b981;
  height: 140px;
  overflow-y: auto;
  white-space: pre-wrap;
  line-height: 1.5;
}

/* Virtual S7 helper callout */
.virtual-plc-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(6, 182, 212, 0.05);
  border: 1px solid rgba(6, 182, 212, 0.2);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  margin-top: 1rem;
  gap: 1rem;
}

.virtual-plc-info h5 {
  font-size: 0.875rem;
  color: #fff;
  font-weight: 600;
}

.virtual-plc-info p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   Tab 3: Claude OT Copilot
   ========================================================================== */
.copilot-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

.copilot-output-card {
  background: var(--bg-card);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text-primary);
}

.copilot-output-card h3 {
  font-size: 1.05rem;
  color: #fff;
  margin-bottom: 0.75rem;
  font-family: var(--font-sans);
}

.copilot-prompt-input {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  font-family: inherit;
  font-size: 0.85rem;
  color: #fff;
  outline: none;
  resize: vertical;
  min-height: 60px;
  margin-bottom: 0.75rem;
}

/* ==========================================================================
   Tab 4: Deterministic Rule Inspector
   ========================================================================== */
.code-editor-preview {
  background: #030304;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.825rem;
  color: #a1a1aa;
  overflow-x: auto;
  line-height: 1.6;
}

.code-keyword { color: #f43f5e; font-weight: 600; }
.code-fn { color: #60a5fa; }
.code-num { color: #fbbf24; }
.code-str { color: #34d399; }
.code-comment { color: #52525b; font-style: italic; }

/* ==========================================================================
   Feature Comparison Matrix (Traditional SCADA vs PowerQ Runtime)
   ========================================================================== */
.comparison-section {
  padding: 5rem 0;
  border-top: 1px solid var(--border-subtle);
}

.table-responsive {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.comparison-table th, .comparison-table td {
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.9rem;
}

.comparison-table th {
  background: var(--bg-tertiary);
  font-weight: 600;
  color: var(--text-primary);
}

.comparison-table th.highlight-col {
  background: rgba(6, 182, 212, 0.08);
  color: var(--accent-cyan);
  border-left: 1px solid rgba(6, 182, 212, 0.2);
  border-right: 1px solid rgba(6, 182, 212, 0.2);
}

.comparison-table td.highlight-col {
  background: rgba(6, 182, 212, 0.03);
  color: #fff;
  font-weight: 500;
  border-left: 1px solid rgba(6, 182, 212, 0.2);
  border-right: 1px solid rgba(6, 182, 212, 0.2);
}

.comparison-table tr:last-child td {
  border-bottom: none;
}

/* Feature Grid Cards */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 3rem;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem 1.75rem;
  position: relative;
  transition: all var(--transition-normal);
}

.feature-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-highlight);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.feature-icon-wrapper {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  color: var(--accent-cyan);
}

.feature-card h3 {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #ffffff;
  margin-bottom: 0.65rem;
}

.feature-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* Architecture Diagram */
.architecture-section {
  padding: 5rem 0;
  border-top: 1px solid var(--border-subtle);
}

.arch-flow-wrapper {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  align-items: center;
  margin-top: 3rem;
}

.arch-node {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem 1rem;
  text-align: center;
  transition: all var(--transition-fast);
}

.arch-node:hover {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 20px var(--accent-cyan-glow);
}

.arch-node-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 0.35rem;
}

.arch-node-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.arch-arrow {
  text-align: center;
  color: var(--border-highlight);
  font-size: 1.5rem;
}

/* ==========================================================================
   Pricing Section
   ========================================================================== */
.pricing-section {
  padding: 5rem 0;
  border-top: 1px solid var(--border-subtle);
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.75rem;
  margin-top: 3rem;
}

.pricing-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2.25rem 2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  transition: all var(--transition-normal);
}

.pricing-card.popular {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 40px var(--accent-cyan-glow);
}

.popular-badge {
  position: absolute;
  top: -12px;
  right: 24px;
  background: var(--accent-cyan);
  color: #000;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
}

.plan-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.5rem;
}

.plan-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  min-height: 42px;
}

.plan-price-group {
  margin: 1.5rem 0;
}

.plan-price {
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: #fff;
  font-family: var(--font-mono);
}

.plan-period {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.plan-features-list {
  list-style: none;
  margin: 1.5rem 0 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.plan-features-list li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.plan-features-list li::before {
  content: "✓";
  color: var(--state-running);
  font-weight: 800;
}

/* ==========================================================================
   FAQ Section
   ========================================================================== */
.faq-section {
  padding: 5rem 0;
  border-top: 1px solid var(--border-subtle);
}

.faq-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.75rem;
  margin-top: 3rem;
}

.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}

.faq-item h4 {
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 0.5rem;
}

.faq-item p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.footer {
  border-top: 1px solid var(--border-subtle);
  padding: 4rem 0 2.5rem;
  background: var(--bg-secondary);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 3rem;
  flex-wrap: wrap;
  gap: 2rem;
}

.footer-brand p {
  margin-top: 0.6rem;
  max-width: 320px;
  color: var(--text-secondary);
}

.footer-links-group {
  display: flex;
  gap: 3.5rem;
}

.footer-col h5 {
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.footer-col a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-col a:hover {
  color: #fff;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 2rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  font-family: var(--font-mono);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1024px) {
  .features-grid, .pricing-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .arch-flow-wrapper {
    grid-template-columns: 1fr;
  }
  .arch-arrow {
    transform: rotate(90deg);
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
  }
  .metrics-strip, .kpi-grid, .plc-config-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .mock-control-grid, .features-grid, .pricing-grid, .faq-grid {
    grid-template-columns: 1fr;
  }
  .footer-links-group {
    flex-wrap: wrap;
    gap: 2rem;
  }
  .footer-bottom {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
}

/* ==========================================================================
   Area Switcher & Freemium Limitation Styles
   ========================================================================== */
.area-dropdown-wrapper {
  position: relative;
}

.area-select-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-card);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.area-select-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--border-highlight);
}

.chevron-down {
  transition: transform var(--transition-fast);
  color: var(--text-muted);
}

.area-select-btn[aria-expanded="true"] .chevron-down {
  transform: rotate(180deg);
}

.area-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 380px;
  max-width: 90vw;
  background: var(--bg-elevated);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.7);
  z-index: 1000;
  overflow: hidden;
}

.area-menu.show {
  display: block;
  animation: fadeIn 150ms ease-in-out;
}

.area-menu-header {
  padding: 0.65rem 0.9rem;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.area-menu-sub {
  display: block;
  font-size: 0.7rem;
  color: var(--accent-cyan);
  margin-top: 0.15rem;
}

.area-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.area-item:last-child {
  border-bottom: none;
}

.area-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.area-item.active {
  background: rgba(16, 185, 129, 0.06);
}

.area-item-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.status-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-indicator-dot.running {
  background: var(--state-running);
  box-shadow: 0 0 8px var(--state-running);
}

.area-item-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  font-family: var(--font-mono);
}

.area-item-subtitle {
  font-size: 0.725rem;
  color: var(--text-muted);
}

.area-badge-chip {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 0.2rem 0.45rem;
  border-radius: var(--radius-sm);
  letter-spacing: 0.04em;
}

.area-badge-chip.active {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.area-badge-chip.locked {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Modal for Locked Areas */
.modal-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-backdrop.active {
  display: flex;
  animation: fadeIn 150ms ease-out;
}

.modal-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.9);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-tertiary);
}

.modal-title-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.modal-title-row h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.modal-close-btn:hover {
  color: #fff;
}

.modal-body {
  padding: 1.5rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-primary);
}

.modal-meta-box {
  margin-top: 1rem;
  padding: 0.85rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.775rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-tertiary);
}

/* Rule Tester */
.rule-tester-grid {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: 1rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.rule-tester-result {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.rule-result-label {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.rule-tester-logic {
  font-size: 0.825rem;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
  width: 100%;
}

/* Badges & Chips */
.bridge-tag-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.bridge-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border-muted);
}

.bridge-status-indicator.online {
  border-color: rgba(16, 185, 129, 0.4);
  color: #34d399;
}

.bridge-status-indicator.offline {
  border-color: rgba(245, 158, 11, 0.4);
  color: #fbbf24;
}

.bridge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.protocol-chip {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-cyan);
}

.engine-badge {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.quality-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #10b981;
}

.star-badge {
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.spin {
  animation: spin-anim 1s linear infinite;
}

@keyframes spin-anim {
  100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Siemens SIMATIC S7-1200 CPU 1214C Visual Component (Vercel Dark Theme)
   Hardware Digital Twin with Active Polling HUD & Real-time I/O Telemetry
   ========================================================================== */

.s7-visualizer-card {
  position: relative;
  background: linear-gradient(180deg, rgba(14, 15, 18, 0.95) 0%, rgba(8, 9, 11, 0.98) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  overflow: hidden;
  box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.7);
}

.s7-visualizer-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(0, 163, 150, 0.4) 35%, rgba(6, 182, 212, 0.6) 50%, rgba(0, 163, 150, 0.4) 65%, transparent 100%);
  pointer-events: none;
}

.s7-title-group {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
  color: var(--text-primary);
}

.s7-title-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  background: rgba(0, 100, 110, 0.2);
  border: 1px solid rgba(0, 163, 150, 0.35);
  color: #00d2be;
}

.s7-panel-chips {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.s7-hw-chip {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  letter-spacing: 0.02em;
}

.s7-hw-chip-teal {
  color: #2dd4bf;
  background: rgba(0, 163, 150, 0.12);
  border-color: rgba(0, 163, 150, 0.35);
}

.s7-hw-chip-status {
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.s7-hw-chip-status::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
}

/* S7-1200 Chassis Main Enclosure */
.s7-chassis {
  position: relative;
  margin-top: 1rem;
  background: linear-gradient(180deg, #18191e 0%, #121317 25%, #0e0f13 100%);
  border: 1px solid #282a33;
  border-radius: 12px;
  box-shadow:
    0 16px 40px -10px rgba(0, 0, 0, 0.8),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -1px 0 rgba(0, 0, 0, 0.8);
  overflow: hidden;
  user-select: none;
}

/* Top Bevel & Ventilation Louvers */
.s7-chassis-top-bevel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(180deg, #22242c 0%, #17181f 100%);
  padding: 0.5rem 1rem;
  border-bottom: 1px solid #252832;
}

.s7-cooling-slots {
  display: flex;
  gap: 5px;
  align-items: center;
}

.s7-cooling-slots span {
  display: block;
  width: 14px;
  height: 3px;
  background: #090a0d;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 1px;
}

.s7-rating-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* Terminal Bays (Upper & Lower) */
.s7-terminal-bay {
  position: relative;
  background: #101115;
  border-bottom: 1px solid #20222a;
  padding: 0.6rem 0.85rem;
}

.s7-terminal-bay-outputs {
  border-top: 1px solid #20222a;
  border-bottom: none;
}

.s7-bay-ribbon {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.55rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.s7-bay-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #71717a;
}

.s7-bay-legend {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: #00a396;
  font-weight: 600;
}

.s7-terminals-scroll {
  overflow-x: auto;
  padding-bottom: 0.35rem;
  scrollbar-width: thin;
  scrollbar-color: #27272a transparent;
}

.s7-terminals-scroll::-webkit-scrollbar {
  height: 4px;
}

.s7-terminals-scroll::-webkit-scrollbar-thumb {
  background: #27272a;
  border-radius: 4px;
}

.s7-terminals-row {
  display: flex;
  gap: 0.4rem;
  align-items: stretch;
  min-width: max-content;
}

.s7-term-separator {
  width: 1px;
  background: #27272a;
  margin: 0 0.2rem;
  align-self: stretch;
}

/* Terminal Cell */
.s7-terminal-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.35rem;
  background: linear-gradient(180deg, #16171d 0%, #121318 100%);
  border: 1px solid #22242e;
  border-radius: 6px;
  min-width: 44px;
  cursor: default;
  transition: all var(--transition-fast);
}

.s7-terminal-cell:hover {
  background: #1b1d24;
  border-color: #383b48;
}

.s7-terminal-cell.active-polled {
  background: linear-gradient(180deg, rgba(0, 163, 150, 0.15) 0%, rgba(6, 182, 212, 0.08) 100%);
  border-color: #00d2be;
  box-shadow: 0 0 12px rgba(0, 210, 190, 0.25), inset 0 0 8px rgba(0, 210, 190, 0.15);
}

/* Screw Socket */
.s7-terminal-screw {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #424552 0%, #20222a 65%, #131419 100%);
  border: 1px solid #1a1b22;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.8), 0 1px 1px rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.35rem;
}

.s7-screw-cross {
  position: relative;
  width: 8px;
  height: 8px;
}

.s7-screw-cross::before,
.s7-screw-cross::after {
  content: "";
  position: absolute;
  background: #0f1014;
  box-shadow: 0 0.5px 0 rgba(255, 255, 255, 0.2);
}

.s7-screw-cross::before {
  left: 3.5px;
  top: 0;
  width: 1.2px;
  height: 8px;
}

.s7-screw-cross::after {
  top: 3.5px;
  left: 0;
  width: 8px;
  height: 1.2px;
}

/* Terminal Channel LED */
.s7-io-led-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.15rem 0 0.3rem 0;
}

.s7-io-led {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #112015;
  border: 1px solid #1b3522;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.7);
  transition: all 120ms ease;
}

.s7-io-led.active {
  background: #10b981;
  border-color: #6ee7b7;
  box-shadow: 0 0 6px #10b981, 0 0 14px rgba(16, 185, 129, 0.75);
}

.s7-terminal-label {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  color: #ededed;
  line-height: 1;
}

.s7-terminal-sublabel {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: #71717a;
  margin-top: 0.15rem;
}

.s7-pwr-cell .s7-terminal-label {
  color: #f59e0b;
}

.s7-pwr-cell .s7-terminal-sublabel {
  color: #d97706;
}

/* Polling Pulse Halo */
.s7-pin-pulse-halo {
  display: none;
  position: absolute;
  inset: -3px;
  border-radius: 8px;
  border: 1.5px solid #00d2be;
  pointer-events: none;
}

.active-polled .s7-pin-pulse-halo {
  display: block;
  animation: s7PulseHalo 2s cubic-bezier(0.25, 1, 0.5, 1) infinite;
}

@keyframes s7PulseHalo {
  0% {
    transform: scale(0.96);
    opacity: 0.9;
    box-shadow: 0 0 0 0 rgba(0, 210, 190, 0.8);
  }
  70% {
    transform: scale(1.06);
    opacity: 0;
    box-shadow: 0 0 0 10px rgba(0, 210, 190, 0);
  }
  100% {
    transform: scale(0.96);
    opacity: 0;
    box-shadow: 0 0 0 0 rgba(0, 210, 190, 0);
  }
}

/* ==========================================================================
   Siemens Petrol-Teal Brand Strip
   ========================================================================== */
.s7-brand-strip {
  position: relative;
  background: linear-gradient(90deg, #004b53 0%, #00646e 28%, #008176 72%, #004e56 100%);
  border-top: 1px solid rgba(0, 210, 190, 0.45);
  border-bottom: 1px solid rgba(0, 0, 0, 0.7);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 3px 10px rgba(0, 100, 110, 0.3);
  padding: 0.65rem 1.25rem;
}

.s7-brand-accent-line {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #00a396 0%, #00d2be 50%, #00a396 100%);
  box-shadow: 0 0 8px #00d2be;
}

.s7-brand-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.s7-brand-siemens {
  display: flex;
  align-items: baseline;
  gap: 0.85rem;
}

.s7-siemens-logo {
  font-family: var(--font-sans);
  font-weight: 900;
  font-size: 1.15rem;
  letter-spacing: 0.18em;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.s7-simatic-logo {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.05em;
  color: #e2f8f5;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.s7-model-designation {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.s7-model-name {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.95rem;
  color: #ffffff;
  letter-spacing: 0.04em;
}

.s7-model-spec {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.8rem;
  color: #a7f3d0;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(167, 243, 208, 0.35);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

/* ==========================================================================
   S7 Central Core: Diagnostics, RJ45, Signal Board, and Polling HUD
   ========================================================================== */
.s7-core-deck {
  display: grid;
  grid-template-columns: 240px 140px 1fr;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: #0d0e12;
  align-items: stretch;
}

/* Left Column: Status LEDs Cluster & PROFINET */
.s7-core-left {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.s7-diag-cluster {
  background: #14151b;
  border: 1px solid #232530;
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6);
}

.s7-diag-cluster-header {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #71717a;
  margin-bottom: 0.45rem;
  border-bottom: 1px solid #1f212a;
  padding-bottom: 0.25rem;
}

.s7-status-led-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}

.s7-status-led-row:last-child {
  margin-bottom: 0;
}

.s7-led {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.8);
  transition: all 150ms ease;
}

.s7-led-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: #a1a1aa;
  letter-spacing: 0.03em;
}

/* RUN/STOP LED */
.s7-led-run {
  background: #12291a;
  border-color: #1a422a;
}

.s7-led-run.active {
  background: #10b981;
  border-color: #6ee7b7;
  box-shadow: 0 0 8px #10b981, 0 0 16px rgba(16, 185, 129, 0.75);
}

.s7-led-run.amber {
  background: #f59e0b;
  border-color: #fcd34d;
  box-shadow: 0 0 8px #f59e0b, 0 0 16px rgba(245, 158, 11, 0.75);
}

.s7-led-run.off {
  background: #12291a;
  box-shadow: none;
}

/* ERROR LED */
.s7-led-err {
  background: #2b1114;
  border-color: #42161b;
}

.s7-led-err.active {
  background: #ef4444;
  border-color: #fca5a5;
  box-shadow: 0 0 9px #ef4444, 0 0 18px rgba(239, 68, 68, 0.8);
  animation: s7LedBlink 0.8s infinite;
}

/* MAINT LED */
.s7-led-maint {
  background: #2b2210;
  border-color: #423516;
}

.s7-led-maint.active {
  background: #eab308;
  border-color: #fef08a;
  box-shadow: 0 0 8px #eab308, 0 0 16px rgba(234, 179, 8, 0.7);
}

@keyframes s7LedBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* PROFINET Port Cutout */
.s7-profinet-pocket {
  background: #14151b;
  border: 1px solid #232530;
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.7);
}

.s7-profinet-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.45rem;
}

.s7-pn-label {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.72rem;
  color: #00d2be;
  letter-spacing: 0.05em;
}

.s7-pn-sub {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: #71717a;
}

.s7-rj45-housing {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  background: #0b0c0f;
  border: 1px solid #1c1d24;
  border-radius: 6px;
  padding: 0.45rem 0.55rem;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.9);
}

.s7-rj45-metal-frame {
  width: 48px;
  height: 38px;
  background: linear-gradient(135deg, #444754 0%, #2a2c35 50%, #1e1f26 100%);
  border: 1px solid #5a5e6d;
  border-radius: 4px;
  padding: 3px;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.2), 0 2px 4px rgba(0, 0, 0, 0.7);
}

.s7-rj45-cavity {
  position: relative;
  width: 100%;
  height: 100%;
  background: #07080a;
  border: 1px solid #15161b;
  border-radius: 2px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.s7-rj45-pins {
  display: flex;
  justify-content: space-evenly;
  padding-top: 2px;
}

.s7-rj45-pins i {
  display: block;
  width: 2px;
  height: 10px;
  background: linear-gradient(180deg, #ffd700 0%, #ca8a04 100%);
  box-shadow: 0 0 2px rgba(255, 215, 0, 0.6);
  border-radius: 0.5px;
}

.s7-rj45-clip-recess {
  width: 18px;
  height: 6px;
  background: #15161d;
  margin: 0 auto;
  border-top: 1px solid #232530;
  border-radius: 1px 1px 0 0;
}

.s7-rj45-led-bay {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.s7-rj45-led-col {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.s7-port-led {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #12291a;
  border: 1px solid #1a422a;
}

.s7-port-led.active {
  background: #10b981;
  border-color: #6ee7b7;
  box-shadow: 0 0 7px #10b981, 0 0 14px rgba(16, 185, 129, 0.7);
  animation: s7PortPulse 1.6s ease-in-out infinite;
}

@keyframes s7PortPulse {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 0.45; }
}

.s7-port-led.flash {
  background: #00d2be !important;
  border-color: #5eead4 !important;
  box-shadow: 0 0 10px #00d2be, 0 0 18px rgba(0, 210, 190, 0.9) !important;
}

.s7-port-led-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  color: #10b981;
}

.s7-rj45-speed-tag {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  color: #71717a;
}

.s7-profinet-subtext {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-dim);
  margin-top: 0.35rem;
  text-align: right;
}

/* Center Column: Signal Board (SB) Bay */
.s7-core-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.s7-sb-bay {
  width: 100%;
  height: 100%;
  background: #13141a;
  border: 1px solid #232530;
  border-radius: 8px;
  padding: 0.65rem 0.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.7);
}

.s7-sb-screws {
  display: flex;
  justify-content: space-between;
}

.s7-sb-screw {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle, #3d404d 0%, #1a1b22 100%);
  border: 1px solid #131419;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.8);
}

.s7-sb-faceplate {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0.4rem 0;
}

.s7-sb-emboss {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  color: #52525b;
  letter-spacing: 0.05em;
  margin-bottom: 0.6rem;
}

.s7-mc-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  background: #090a0d;
  border: 1px solid #1f212a;
  border-radius: 4px;
  padding: 0.35rem 0.5rem;
  width: 85%;
}

.s7-mc-slit {
  display: block;
  width: 32px;
  height: 3px;
  background: #000000;
  border-radius: 1px;
}

.s7-mc-label {
  font-family: var(--font-mono);
  font-size: 0.56rem;
  color: #71717a;
}

.s7-sb-status-dots {
  display: flex;
  gap: 4px;
  margin-top: 0.6rem;
}

.s7-sb-status-dots span {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #232530;
}

/* ==========================================================================
   Right Column: Active Polling Highlight HUD
   ========================================================================== */
.s7-core-right {
  display: flex;
}

.s7-polling-hud {
  width: 100%;
  background: linear-gradient(180deg, rgba(16, 18, 24, 0.9) 0%, rgba(10, 11, 15, 0.95) 100%);
  border: 1px solid rgba(0, 163, 150, 0.35);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  box-shadow:
    0 8px 24px -6px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgba(0, 163, 150, 0.2),
    0 0 16px rgba(0, 163, 150, 0.1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.s7-hud-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.55rem;
}

.s7-hud-radar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.s7-radar-beacon {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00d2be;
  box-shadow: 0 0 8px #00d2be;
  animation: s7PulseRadar 1.5s cubic-bezier(0.24, 0, 0.38, 1) infinite;
}

@keyframes s7PulseRadar {
  0% { transform: scale(0.9); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.6; }
  100% { transform: scale(0.9); opacity: 1; }
}

.s7-hud-title {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #00d2be;
}

.s7-data-type-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #06b6d4;
  background: rgba(6, 182, 212, 0.14);
  border: 1px solid rgba(6, 182, 212, 0.45);
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.25);
  text-transform: uppercase;
}

.s7-data-type-badge[data-type="real"] {
  color: #a855f7;
  background: rgba(168, 85, 247, 0.14);
  border-color: rgba(168, 85, 247, 0.45);
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.25);
}

.s7-data-type-badge[data-type="word"],
.s7-data-type-badge[data-type="int"] {
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.14);
  border-color: rgba(59, 130, 246, 0.45);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.25);
}

.s7-data-type-badge[data-type="bool"] {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.45);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.25);
}

.s7-data-type-badge[data-type="byte"] {
  color: #06b6d4;
  background: rgba(6, 182, 212, 0.14);
  border-color: rgba(6, 182, 212, 0.45);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.25);
}

.s7-terminal-cell.active-channel {
  border-color: rgba(6, 182, 212, 0.5) !important;
  background: rgba(6, 182, 212, 0.08) !important;
}

.s7-hud-target-card {
  background: #08090c;
  border: 1px solid #1f212a;
  border-radius: 6px;
  padding: 0.45rem 0.65rem;
  margin-bottom: 0.55rem;
}

.s7-hud-target-label {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #71717a;
  margin-bottom: 0.2rem;
}

.s7-hud-target-value {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.s7-hud-pulse-ring {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #00d2be;
  box-shadow: 0 0 8px #00d2be;
  animation: s7PulseRadar 1.8s infinite;
}

.s7-hud-pin-text {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  color: #ededed;
  letter-spacing: 0.02em;
}

.s7-hud-live-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  align-items: center;
  background: #0b0c10;
  border: 1px solid #1a1c24;
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.55rem;
}

.s7-hud-metric-label {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #71717a;
  display: block;
  margin-bottom: 0.15rem;
}

.s7-hud-val-flex {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
}

.s7-live-value {
  font-family: var(--font-mono);
  font-size: 1.85rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1;
  text-shadow: 0 0 14px rgba(0, 210, 190, 0.45);
}

.s7-live-unit {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: #00d2be;
  font-weight: 600;
}

.s7-hud-meta-box {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.s7-hud-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.66rem;
}

.s7-meta-k {
  color: #71717a;
}

.s7-meta-v {
  font-weight: 700;
  color: #ededed;
}

.s7-meta-v.state-running {
  color: #10b981;
}

.s7-meta-v.state-idle {
  color: #f59e0b;
}

.s7-meta-v.state-fault {
  color: #ef4444;
}

/* 8-Bit Live Bus Register View */
.s7-hud-bit-register {
  background: #090a0d;
  border: 1px solid #1a1b22;
  border-radius: 6px;
  padding: 0.4rem 0.65rem;
}

.s7-bit-title {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #52525b;
  margin-bottom: 0.35rem;
}

.s7-bit-cells {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 3px;
}

.s7-bit-cell {
  background: #121319;
  border: 1px solid #1f212a;
  border-radius: 3px;
  text-align: center;
  padding: 0.2rem 0;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  color: #52525b;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
  transition: all 120ms ease;
}

.s7-bit-cell span {
  font-weight: 700;
  font-size: 0.68rem;
  color: #71717a;
}

.s7-bit-cell.active {
  background: rgba(0, 210, 190, 0.15);
  border-color: rgba(0, 210, 190, 0.5);
  color: #00d2be;
  box-shadow: 0 0 6px rgba(0, 210, 190, 0.2);
}

.s7-bit-cell.active span {
  color: #00d2be;
  text-shadow: 0 0 6px #00d2be;
}

/* Chassis Bottom Bevel & DIN Clip */
.s7-chassis-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(180deg, #17181f 0%, #111217 100%);
  padding: 0.45rem 1rem;
  border-top: 1px solid #20222a;
}

.s7-din-clip {
  width: 28px;
  height: 8px;
  background: #ea580c;
  border-radius: 2px;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.3), 0 1px 3px rgba(0, 0, 0, 0.8);
  border: 1px solid #c2410c;
  cursor: pointer;
}

.s7-chassis-footer-text {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: #52525b;
  letter-spacing: 0.04em;
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
  .s7-core-deck {
    grid-template-columns: 220px 120px 1fr;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
  }
}

@media (max-width: 860px) {
  .s7-core-deck {
    grid-template-columns: 1fr 1fr;
  }
  .s7-core-right {
    grid-column: span 2;
  }
}

@media (max-width: 600px) {
  .s7-core-deck {
    grid-template-columns: 1fr;
  }
  .s7-core-right {
    grid-column: span 1;
  }
  .s7-core-center {
    display: none;
  }
  .s7-brand-content {
    flex-direction: column;
    align-items: flex-start;
  }
  .s7-hud-live-metrics {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   S7-1200 Visualizer Micro-Animations & Dynamic Telemetry Controller Styles
   ========================================================================== */

/* RUN/STOP Blinking Orange (Connecting / Handshake) */
@keyframes s7LedBlinkAmber {
  0%, 100% {
    background: #f59e0b;
    border-color: #fcd34d;
    box-shadow: 0 0 10px #f59e0b, 0 0 20px rgba(245, 158, 11, 0.85);
    opacity: 1;
  }
  50% {
    background: #2b2210;
    border-color: #423516;
    box-shadow: none;
    opacity: 0.3;
  }
}

.s7-led-run.blink-orange,
.s7-led-run.connecting {
  animation: s7LedBlinkAmber 0.5s ease-in-out infinite !important;
}

/* ERROR Red Pulsing (Fault / Network Error) */
@keyframes s7LedPulseRed {
  0%, 100% {
    background: #ef4444;
    border-color: #fca5a5;
    box-shadow: 0 0 12px #ef4444, 0 0 24px rgba(239, 68, 68, 0.9);
    transform: scale(1.1);
  }
  50% {
    background: #450a0a;
    border-color: #7f1d1d;
    box-shadow: 0 0 4px #ef4444;
    transform: scale(1);
  }
}

.s7-led-err.pulse-red,
.s7-led-err.fault {
  background: #ef4444 !important;
  border-color: #fca5a5 !important;
  animation: s7LedPulseRed 0.6s ease-in-out infinite !important;
}

/* PROFINET Port RJ45 High-Speed Packet Flash */
@keyframes s7LinkPacketFlash {
  0% {
    background: #ffffff;
    border-color: #6ee7b7;
    box-shadow: 0 0 14px #10b981, 0 0 28px rgba(16, 185, 129, 0.95);
    transform: scale(1.4);
  }
  100% {
    background: #10b981;
    border-color: #6ee7b7;
    box-shadow: 0 0 7px #10b981, 0 0 14px rgba(16, 185, 129, 0.7);
    transform: scale(1);
  }
}

.s7-port-led.packet-flash {
  animation: s7LinkPacketFlash 0.18s cubic-bezier(0, 0, 0.2, 1) !important;
}

/* Active Pin Packet Ripple / Pulse Burst */
@keyframes s7PacketBurst {
  0% {
    border-color: #5eead4;
    box-shadow: 0 0 22px rgba(0, 210, 190, 0.9), inset 0 0 14px rgba(0, 210, 190, 0.45);
    transform: translateY(-1px);
  }
  100% {
    border-color: #00d2be;
    box-shadow: 0 0 12px rgba(0, 210, 190, 0.25), inset 0 0 8px rgba(0, 210, 190, 0.15);
    transform: translateY(0);
  }
}

.s7-terminal-cell.packet-burst {
  animation: s7PacketBurst 0.35s ease-out !important;
}

/* Dynamic Data Type Badges */
.s7-data-type-badge.type-byte {
  color: #00d2be;
  border-color: rgba(0, 210, 190, 0.4);
  background: rgba(0, 210, 190, 0.1);
}

.s7-data-type-badge.type-word {
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.4);
  background: rgba(56, 189, 248, 0.1);
}

.s7-data-type-badge.type-int {
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.1);
}

.s7-data-type-badge.type-real {
  color: #a855f7;
  border-color: rgba(168, 85, 247, 0.4);
  background: rgba(168, 85, 247, 0.1);
}

.s7-data-type-badge.type-bool {
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.1);
}

/* CPU State Badge Color Shifts */
.s7-hw-chip-status.active-run {
  color: #34d399 !important;
  border-color: rgba(16, 185, 129, 0.4) !important;
  background: rgba(16, 185, 129, 0.1) !important;
}

.s7-hw-chip-status.active-connecting {
  color: #fbbf24 !important;
  border-color: rgba(245, 158, 11, 0.4) !important;
  background: rgba(245, 158, 11, 0.1) !important;
}

.s7-hw-chip-status.active-stopped {
  color: #a1a1aa !important;
  border-color: rgba(161, 161, 170, 0.3) !important;
  background: rgba(161, 161, 170, 0.08) !important;
}

.s7-hw-chip-status.active-fault {
  color: #f87171 !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
  background: rgba(239, 68, 68, 0.1) !important;
}

/* ==========================================================================
   PLC Tab 2-Column Split Layout
   Left Column: Connection Form (Top) + Direct RFC 1006 Socket Trace (Bottom)
   Right Column: Siemens SIMATIC S7-1200 CPU 1214C Digital Twin (Full Height)
   ========================================================================== */
.plc-split-layout {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(440px, 1.25fr);
  gap: 1.25rem;
  align-items: stretch;
}

.plc-split-left,
.plc-split-right {
  min-width: 0;
  width: 100%;
}

.plc-split-left {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Connection Form Container in Left Column */
.plc-split-left .control-panel-card {
  margin-bottom: 0 !important;
}

.plc-split-left .control-panel-card:first-child {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.plc-split-left .panel-subheading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.plc-split-left .bridge-tag-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

/* 2-Column Responsive Grid for Connection Form (Fits perfectly without horizontal clipping) */
.plc-split-left .plc-config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 0.75rem 0.85rem;
  margin-bottom: 0.85rem;
}

.plc-split-left .virtual-plc-banner {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
}

/* Socket Trace Console (Fixed height, shorter by ~15-55px, fully scrollable, never expands page) */
.plc-socket-trace-card {
  flex-shrink: 0 !important;
  display: flex;
  flex-direction: column;
}

.plc-socket-trace-card .panel-subheading {
  margin-bottom: 0.45rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.console-btn-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-console-action {
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  font-family: var(--font-sans);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-console-action:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border-color: var(--border-muted);
}

.btn-console-action:active {
  transform: scale(0.97);
}

.plc-socket-trace-card .console-log-box {
  height: 185px !important;
  max-height: 185px !important;
  min-height: 185px !important;
  overflow-y: scroll !important;
  overflow-x: hidden !important;
  white-space: pre-wrap !important;
  word-break: break-all !important;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  line-height: 1.45;
  padding: 0.65rem 0.75rem;
  flex: none !important;
  user-select: text !important;
  -webkit-user-select: text !important;
  cursor: text !important;
  scrollbar-width: thin;
  scrollbar-color: #3f3f46 #090a0d;
}

/* Crisp high-contrast selection highlight for console text */
.console-log-box::selection,
.console-log-box *::selection {
  background: rgba(0, 210, 190, 0.35) !important;
  color: #ffffff !important;
  text-shadow: 0 0 6px rgba(0, 210, 190, 0.7) !important;
}

.console-log-box::-moz-selection,
.console-log-box *::-moz-selection {
  background: rgba(0, 210, 190, 0.35) !important;
  color: #ffffff !important;
  text-shadow: 0 0 6px rgba(0, 210, 190, 0.7) !important;
}

.plc-socket-trace-card .console-log-box::-webkit-scrollbar {
  width: 6px;
}

.plc-socket-trace-card .console-log-box::-webkit-scrollbar-track {
  background: #090a0d;
}

.plc-socket-trace-card .console-log-box::-webkit-scrollbar-thumb {
  background: #3f3f46;
  border-radius: 3px;
}

/* Right Column: Full-Height Siemens S7-1200 Digital Twin */
.plc-split-right {
  display: flex;
  flex-direction: column;
}

.plc-split-right .s7-visualizer-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  margin-bottom: 0 !important;
  overflow: hidden;
}

.plc-split-right .s7-chassis {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-width: 0;
}

/* Chassis Bevel & Rating */
.plc-split-right .s7-chassis-top-bevel {
  padding: 0.35rem 0.75rem;
}

.plc-split-right .s7-rating-label {
  font-size: 0.58rem;
}

/* Siemens Petrol-Teal Brand Strip */
.plc-split-right .s7-brand-strip {
  padding: 0.45rem 0.85rem;
}

.plc-split-right .s7-siemens-logo {
  font-size: 0.95rem;
}

.plc-split-right .s7-simatic-logo {
  font-size: 0.8rem;
}

.plc-split-right .s7-model-name {
  font-size: 0.85rem;
}

.plc-split-right .s7-model-spec {
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
}

/* Terminal Bays */
.plc-split-right .s7-terminal-bay {
  padding: 0.45rem 0.75rem;
  min-width: 0;
  overflow: hidden;
}

.plc-split-right .s7-bay-ribbon {
  margin-bottom: 0.35rem;
  padding-bottom: 0.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  overflow: hidden;
}

.plc-split-right .s7-bay-tag,
.plc-split-right .s7-bay-legend {
  font-size: 0.56rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.plc-split-right .s7-terminals-scroll {
  overflow: hidden !important;
  padding-bottom: 0;
  width: 100%;
}

.plc-split-right .s7-terminals-row {
  display: grid;
  grid-template-columns: repeat(16, minmax(0, 1fr));
  gap: 2px;
  width: 100%;
  min-width: 0;
}

.plc-split-right .s7-terminal-bay-outputs .s7-terminals-row {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.plc-split-right .s7-term-separator {
  display: none !important;
}

.plc-split-right .s7-terminal-cell {
  min-width: 0 !important;
  width: 100%;
  padding: 0.3rem 0.08rem;
  border-radius: 4px;
}

.plc-split-right .s7-terminal-sublabel {
  display: none !important;
}

.plc-split-right .s7-terminal-label {
  font-size: clamp(0.5rem, 0.65vw, 0.62rem);
  letter-spacing: -0.02em;
}

.plc-split-right .s7-terminal-screw {
  width: 13px;
  height: 13px;
  margin-bottom: 0.15rem;
}

.plc-split-right .s7-io-led {
  width: 5px;
  height: 5px;
}

.plc-split-right .s7-io-led-wrap {
  margin: 0.1rem 0 0.15rem 0;
}

/* Center Core Deck: 2 Columns (Diagnostics + Polling HUD, hide decorative SB bay) */
.plc-split-right .s7-core-deck {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(170px, 205px) minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  min-width: 0;
}

.plc-split-right .s7-core-left {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.5rem;
}

.plc-split-right .s7-core-center {
  display: none !important;
}

.plc-split-right .s7-diag-cluster {
  padding: 0.45rem 0.65rem;
}

.plc-split-right .s7-profinet-pocket {
  padding: 0.45rem 0.65rem;
}

.plc-split-right .s7-rj45-housing {
  padding: 0.3rem 0.4rem;
  gap: 0.4rem;
}

.plc-split-right .s7-rj45-metal-frame {
  width: 42px;
  height: 32px;
}

.plc-split-right .s7-rj45-pins i {
  height: 8px;
}

/* Polling HUD in Split View */
.plc-split-right .s7-core-right {
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
}

.plc-split-right .s7-polling-hud {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.65rem 0.8rem;
  min-width: 0;
  width: 100%;
}

.plc-split-right .s7-hud-header {
  margin-bottom: 0.4rem;
}

.plc-split-right .s7-hud-target-card {
  padding: 0.35rem 0.5rem;
  margin-bottom: 0.4rem;
}

.plc-split-right .s7-hud-pin-text {
  font-size: 0.78rem;
}

.plc-split-right .s7-hud-live-metrics {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 0.4rem;
  padding: 0.45rem 0.55rem;
  margin-bottom: 0.4rem;
}

.plc-split-right .s7-live-value {
  font-size: 1.55rem;
}

.plc-split-right .s7-hud-meta-row {
  font-size: 0.62rem;
}

.plc-split-right .s7-bit-cells {
  gap: 2px;
}

.plc-split-right .s7-bit-cell {
  padding: 0.15rem 0.15rem;
  font-size: 0.58rem;
}

/* ==========================================================================
   S7 Subnet Discovery Scanner Modal & Radar Visualizer
   ========================================================================== */
.scanner-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 200ms ease;
}

.scanner-modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 820px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 35px rgba(6, 182, 212, 0.15);
}

.scanner-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
}

.scanner-title-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.scanner-title-group h4 {
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
  margin: 0;
}

.scanner-title-group p {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin: 0.15rem 0 0 0;
  font-family: var(--font-mono);
}

.scanner-header-radar-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.scanner-radar-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00d2be;
  box-shadow: 0 0 10px #00d2be;
  animation: pulse-dot 1.5s infinite;
}

.scanner-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background var(--transition-fast);
}

.scanner-close-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.scanner-modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.scanner-controls-bar {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  background: var(--bg-secondary);
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

/* Radar Sweep Animation */
.scanner-radar-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: radial-gradient(circle at 50% 50%, rgba(6, 182, 212, 0.08) 0%, rgba(0, 0, 0, 0.6) 70%);
  border-radius: var(--radius-md);
  border: 1px solid rgba(6, 182, 212, 0.2);
  gap: 1rem;
}

.scanner-radar-screen {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 1.5px solid rgba(0, 210, 190, 0.5);
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle, rgba(0, 30, 35, 0.95) 0%, rgba(4, 10, 15, 0.98) 100%);
  box-shadow: 0 0 25px rgba(0, 210, 190, 0.2), inset 0 0 20px rgba(0, 0, 0, 0.8);
}

.scanner-radar-grid {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 50%;
  background-image: 
    radial-gradient(circle at center, transparent 32%, rgba(0, 210, 190, 0.25) 33%, transparent 35%),
    radial-gradient(circle at center, transparent 65%, rgba(0, 210, 190, 0.25) 66%, transparent 68%),
    linear-gradient(rgba(0, 210, 190, 0.15) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 210, 190, 0.15) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 70px 70px, 70px 70px;
  background-position: center;
}

.scanner-radar-sweep {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg at 50% 50%, rgba(0, 210, 190, 0.45) 0deg, rgba(0, 210, 190, 0) 65deg, transparent 360deg);
  animation: radarSweepAnim 2s linear infinite;
  transform-origin: center;
}

@keyframes radarSweepAnim {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.scanner-radar-blip {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 8px #34d399;
  animation: radarBlipAnim 2s infinite ease-in-out;
}

.scanner-radar-blip.blip-1 {
  top: 35px;
  left: 45px;
  animation-delay: 0.3s;
}

.scanner-radar-blip.blip-2 {
  bottom: 40px;
  right: 48px;
  animation-delay: 1.1s;
}

@keyframes radarBlipAnim {
  0%, 100% { opacity: 0; transform: scale(0.5); }
  50% { opacity: 1; transform: scale(1.3); }
}

.scanner-radar-status {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #00d2be;
  text-align: center;
  letter-spacing: 0.02em;
}

/* Results Section */
.scanner-results-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.scanner-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.scanner-results-count {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.scanner-status-tag {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.scanner-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}

.scanner-pulse-online {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #34d399;
}

.scanner-pulse-online::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 6px #34d399;
}

.scanner-badge-physical {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 0.18rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.scanner-badge-virtual {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: #00d2be;
  background: rgba(0, 210, 190, 0.12);
  border: 1px solid rgba(0, 210, 190, 0.35);
  padding: 0.18rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.scanner-controls-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  background: var(--bg-secondary);
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

#scannerCustomPortGroup {
  animation: fadeInCustomPort 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInCustomPort {
  from {
    opacity: 0;
    transform: translateY(-2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   Mobile Phone Viewport Enhancements (iPhone / Android, 360px - 768px)
   ========================================================================== */

/* 1. Mobile Touch Targets & iOS Zoom Prevention */
@media (max-width: 768px) {
  input.form-input,
  select.form-select,
  textarea.copilot-prompt-input,
  textarea.form-input {
    font-size: 16px !important;
  }
}

/* 2. Mobile Container & Hero Typography */
@media (max-width: 480px) {
  .container {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  .hero-section {
    padding: 3.5rem 0 2.5rem !important;
  }
  .hero-title {
    font-size: clamp(1.85rem, 8.5vw, 2.5rem) !important;
    line-height: 1.15 !important;
    margin-bottom: 1rem !important;
  }
  .hero-subtitle {
    font-size: 0.95rem !important;
    line-height: 1.5 !important;
    margin-bottom: 1.5rem !important;
  }
  .hero-cta-group {
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.75rem !important;
  }
  .hero-cta-group .btn {
    width: 100% !important;
    min-height: 44px !important;
    justify-content: center !important;
  }
  .console-tabs {
    padding: 0.5rem 0.65rem !important;
    gap: 0.35rem !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
  }
  .console-tab-btn {
    flex-shrink: 0 !important;
    padding: 0.45rem 0.7rem !important;
    font-size: 0.78rem !important;
    white-space: nowrap !important;
  }
  .console-body {
    padding: 0.85rem !important;
  }

  /* Primary State Header Card */
  .area-state-banner {
    padding: 1rem 0.85rem !important;
    margin-bottom: 1rem !important;
    gap: 0.75rem !important;
    border-radius: var(--radius-sm) !important;
    flex-direction: column !important;
    align-items: flex-start !important;
  }
  .state-meta-left {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.65rem !important;
    width: 100% !important;
  }
  .state-indicator-badge {
    font-size: 1.15rem !important;
    padding: 0.35rem 0.75rem !important;
    border-radius: var(--radius-sm) !important;
  }
  .state-desc-group {
    width: 100% !important;
    min-width: 0 !important;
  }
  .state-desc-group h4 {
    font-size: 0.95rem !important;
    line-height: 1.3 !important;
    word-break: break-word !important;
    margin-bottom: 0.25rem !important;
  }
  .state-desc-group p {
    font-size: 0.78rem !important;
    line-height: 1.4 !important;
  }
  .state-meta-right {
    width: 100% !important;
    margin-top: 0.2rem !important;
  }
  .engine-badge {
    font-size: 0.62rem !important;
    white-space: normal !important;
    word-break: break-word !important;
    padding: 0.25rem 0.5rem !important;
    display: inline-block !important;
  }

  /* KPI Grid */
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.5rem !important;
    margin-bottom: 1rem !important;
  }
  .kpi-card {
    padding: 0.65rem 0.75rem !important;
  }
  .kpi-title {
    font-size: 0.65rem !important;
    margin-bottom: 0.25rem !important;
  }
  .kpi-value {
    font-size: 1.15rem !important;
  }

  /* Historian Timeline Header & Legend */
  .timeline-card {
    padding: 0.75rem !important;
    margin-bottom: 1rem !important;
  }
  .timeline-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.45rem !important;
    margin-bottom: 0.65rem !important;
  }
  .timeline-title {
    width: 100% !important;
    font-size: 0.78rem !important;
    line-height: 1.3 !important;
  }
  .timeline-legend {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.35rem 0.65rem !important;
    font-size: 0.68rem !important;
    width: 100% !important;
  }

  /* Panel Subheadings & Fault Injection Presets */
  .panel-subheading {
    flex-wrap: wrap !important;
    gap: 0.45rem !important;
    font-size: 0.82rem !important;
    margin-bottom: 0.75rem !important;
    width: 100% !important;
  }
  .panel-subheading span {
    font-size: 0.82rem !important;
  }
  .mock-control-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100% !important;
    gap: 1rem !important;
  }
  .control-panel-card {
    padding: 0.85rem !important;
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
  .telemetry-table-wrapper {
    width: 100% !important;
    min-width: 0 !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  .quick-injection-row {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.45rem !important;
    margin-bottom: 1rem !important;
    width: 100% !important;
  }
  .quick-injection-row .btn {
    white-space: normal !important;
    text-align: center !important;
    font-size: 0.74rem !important;
    line-height: 1.25 !important;
    padding: 0.45rem 0.35rem !important;
    min-height: 44px !important;
    word-break: break-word !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .slider-group {
    margin-bottom: 0.75rem !important;
  }
  .slider-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: baseline !important;
    font-size: 0.74rem !important;
    gap: 0.5rem !important;
    margin-bottom: 0.25rem !important;
    width: 100% !important;
  }
  .slider-header span {
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
  .slider-header strong {
    flex-shrink: 0 !important;
    font-size: 0.76rem !important;
  }
}

/* 3. Mobile Navigation Bar & Drawer */
.nav-item-mobile-only {
  display: none;
}

.mobile-nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
  padding: 0;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  color: #fff;
  transition: all var(--transition-fast);
}

.mobile-nav-toggle .hamburger-bar {
  display: block;
  width: 20px;
  height: 2px;
  background: #ffffff;
  border-radius: 1px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.mobile-nav-toggle[aria-expanded="true"] .hamburger-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.mobile-nav-toggle[aria-expanded="true"] .hamburger-bar:nth-child(2) {
  opacity: 0;
}

.mobile-nav-toggle[aria-expanded="true"] .hamburger-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 768px) {
  .nav-item-mobile-only {
  display: none;
}

.mobile-nav-toggle {
    display: inline-flex;
  }
  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    width: 100%;
    background: rgba(10, 10, 12, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-muted);
    padding: 1rem 1.25rem 1.5rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.85);
    z-index: 999;
  }
  .nav-links.mobile-open {
    display: flex;
    animation: mobileNavSlide 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .nav-link {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0.65rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
  }
  .nav-link:active {
    background: rgba(0, 210, 190, 0.12);
    border-color: rgba(0, 210, 190, 0.3);
    color: #00d2be;
  }
  .brand-badge {
    display: none;
  }
  .nav-actions {
    gap: 0.4rem;
  }
  .nav-actions .btn-secondary {
    display: none !important;
  }
  .nav-actions .btn {
    min-height: 40px;
    padding: 0.35rem 0.65rem;
    font-size: 0.78rem;
  }
  .nav-item-mobile-only {
    display: block;
  }
}

@media (max-width: 380px) {
  .nav-actions .btn-primary {
    font-size: 0.72rem !important;
    padding: 0.35rem 0.5rem !important;
  }
  .brand {
    font-size: 0.95rem !important;
  }
  .brand-logo-icon {
    width: 24px !important;
    height: 24px !important;
  }
}

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

/* 4. Single-Column Layout & Presentation Ordering (Screen <= 880px) */
@media (max-width: 880px) {
  .plc-split-layout {
    display: flex !important;
    flex-direction: column !important;
    gap: 1.25rem !important;
    width: 100% !important;
    min-width: 0 !important;
  }
  .plc-split-left {
    display: contents !important;
  }
  .plc-split-left > .control-panel-card:first-child {
    order: 1 !important;
    width: 100% !important;
    min-width: 0 !important;
  }
  .plc-split-right {
    order: 2 !important;
    width: 100% !important;
    min-width: 0 !important;
  }
  .plc-socket-trace-card {
    order: 3 !important;
    width: 100% !important;
    min-width: 0 !important;
  }
}

/* 5. Mobile Connection Form Controls (Screen <= 480px) */
@media (max-width: 480px) {
  .plc-split-left .plc-config-grid {
    grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
    gap: 0.65rem !important;
  }
  .plc-action-btn-group {
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.5rem !important;
  }
  .plc-action-btn-group .btn {
    width: 100% !important;
    min-height: 44px !important;
    justify-content: center !important;
  }
  .virtual-plc-banner {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.75rem !important;
  }
  .virtual-plc-banner .btn {
    width: 100% !important;
    min-height: 44px !important;
    justify-content: center !important;
  }
}

/* 6. Siemens S7-1200 Digital Twin Mobile Mode (Screen <= 768px) */
@media (max-width: 768px) {
  /* Card and Subheading */
  .plc-split-right .s7-visualizer-card {
    padding: 0.75rem 0.65rem !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }
  .plc-split-right .panel-subheading {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.45rem !important;
    width: 100% !important;
  }

  /* Chassis Enclosure */
  .plc-split-right .s7-chassis {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    margin-top: 0.5rem !important;
    overflow: hidden !important;
  }
  .plc-split-right .s7-chassis-top-bevel {
    padding: 0.35rem 0.5rem !important;
    flex-wrap: wrap !important;
    gap: 0.35rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .plc-split-right .s7-cooling-slots {
    display: none !important;
  }
  .plc-split-right .s7-rating-label {
    font-size: 0.55rem !important;
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1.3 !important;
  }

  /* Terminal Bays: Horizontal smooth swipe with momentum */
  .plc-split-right .s7-terminal-bay {
    padding: 0.4rem 0.5rem !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }
  .plc-split-right .s7-bay-ribbon {
    flex-wrap: wrap !important;
    gap: 0.25rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .plc-split-right .s7-bay-tag,
  .plc-split-right .s7-bay-legend {
    font-size: 0.55rem !important;
  }
  .plc-split-right .s7-terminals-scroll {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    scroll-behavior: smooth !important;
    padding-bottom: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    scrollbar-width: thin;
    scrollbar-color: rgba(6, 182, 212, 0.4) rgba(0, 0, 0, 0.4);
  }
  .plc-split-right .s7-terminals-scroll::-webkit-scrollbar {
    height: 4px;
  }
  .plc-split-right .s7-terminals-scroll::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.4);
  }
  .plc-split-right .s7-terminals-scroll::-webkit-scrollbar-thumb {
    background: rgba(6, 182, 212, 0.4);
    border-radius: 2px;
  }
  .plc-split-right .s7-terminals-row {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 6px !important;
    width: max-content !important;
    min-width: 100% !important;
  }
  .plc-split-right .s7-terminal-cell {
    flex: 0 0 36px !important;
    width: 36px !important;
    min-width: 36px !important;
    padding: 0.35rem 0.15rem !important;
    border-radius: 4px !important;
  }
  .plc-split-right .s7-terminal-label {
    font-size: 0.62rem !important;
    font-weight: 600 !important;
  }
  .plc-split-right .s7-terminal-sublabel {
    display: block !important;
    font-size: 0.48rem !important;
    opacity: 0.65;
  }
  .plc-split-right .s7-terminal-screw {
    width: 14px !important;
    height: 14px !important;
  }
  .plc-split-right .s7-io-led {
    width: 6px !important;
    height: 6px !important;
  }

  /* Petrol-Teal Brand Strip */
  .plc-split-right .s7-brand-strip {
    padding: 0.45rem 0.55rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .plc-split-right .s7-brand-content {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 0.4rem !important;
    width: 100% !important;
  }
  .plc-split-right .s7-brand-siemens {
    gap: 0.4rem !important;
  }
  .plc-split-right .s7-siemens-logo {
    font-size: 0.85rem !important;
  }
  .plc-split-right .s7-simatic-logo {
    font-size: 0.72rem !important;
  }
  .plc-split-right .s7-brand-cpu {
    gap: 0.35rem !important;
  }
  .plc-split-right .s7-model-name {
    font-size: 0.75rem !important;
  }
  .plc-split-right .s7-model-spec {
    font-size: 0.62rem !important;
    padding: 0.1rem 0.3rem !important;
  }

  /* Central Deck: Stack diagnostics and Polling HUD vertically */
  .plc-split-right .s7-core-deck {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.65rem !important;
    padding: 0.5rem !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }
  .plc-split-right .s7-core-left {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    justify-content: space-between !important;
    gap: 0.5rem !important;
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
  .plc-split-right .s7-diag-cluster,
  .plc-split-right .s7-profinet-pocket {
    flex: 1 1 120px !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
  .plc-split-right .s7-core-right {
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
  .plc-split-right .s7-polling-hud {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 0.55rem !important;
    box-sizing: border-box !important;
  }
  .plc-split-right .s7-hud-live-metrics {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.4rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .plc-split-right .s7-hud-metric-box {
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
  .plc-split-right .s7-bit-cells {
    display: grid !important;
    grid-template-columns: repeat(8, minmax(0, 1fr)) !important;
    gap: 2px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .plc-split-right .s7-bit-cell {
    min-width: 0 !important;
    font-size: 0.62rem !important;
    padding: 0.2rem 0 !important;
    text-align: center !important;
  }

  /* S7-1200 Panel Heading and Ribbon Chips */
  .s7-panel-chips {
    flex-wrap: wrap !important;
    gap: 0.35rem !important;
    width: 100% !important;
  }
  .s7-hw-chip {
    font-size: 0.62rem !important;
    padding: 0.12rem 0.35rem !important;
  }
  .s7-chassis-footer-text {
    font-size: 0.52rem !important;
    white-space: normal !important;
    word-break: break-word !important;
    text-align: center !important;
  }
}

/* 7. RFC 1006 Socket Trace Console Mobile Mode */
@media (max-width: 768px) {
  .plc-socket-trace-card .console-log-box {
    height: 220px !important;
    min-height: 220px !important;
    max-height: 240px !important;
    font-size: 12px !important;
    line-height: 1.45 !important;
    word-break: break-all !important;
    white-space: pre-wrap !important;
    padding: 0.65rem !important;
  }
  .console-btn-group .btn-console-action {
    min-height: 38px !important;
    padding: 0.35rem 0.65rem !important;
    font-size: 0.76rem !important;
  }
  .btn-console-action:active {
    transform: scale(0.95);
    background: rgba(0, 210, 190, 0.2);
  }
}

/* 8. Subnet Scanner Modal Mobile Optimization */
@media (max-width: 768px) {
  .scanner-modal-backdrop {
    padding: 12px !important;
    align-items: center !important;
  }
  .scanner-modal-dialog {
    width: calc(100% - 24px) !important;
    max-width: 480px !important;
    margin: 12px auto !important;
    max-height: 90vh !important;
  }
  .scanner-modal-header {
    padding: 0.85rem 1rem !important;
  }
  .scanner-title-group h4 {
    font-size: 0.95rem !important;
  }
  .scanner-modal-body {
    padding: 0.85rem !important;
    gap: 0.85rem !important;
  }
  .scanner-controls-bar {
    padding: 0.75rem !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.65rem !important;
  }
  .scanner-controls-bar .form-group {
    width: 100% !important;
    min-width: 100% !important;
  }
  .scanner-controls-bar #btnExecuteScan {
    width: 100% !important;
    min-height: 44px !important;
  }
  .scanner-table-wrapper {
    background: transparent !important;
    border: none !important;
  }
  .scanner-table-wrapper table,
  .scanner-table-wrapper thead,
  .scanner-table-wrapper tbody,
  .scanner-table-wrapper tr,
  .scanner-table-wrapper td {
    display: block !important;
    width: 100% !important;
  }
  .scanner-table-wrapper thead {
    display: none !important;
  }
  .scanner-table-wrapper tbody tr {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-subtle) !important;
    border-radius: var(--radius-sm) !important;
    padding: 0.85rem !important;
    margin-bottom: 0.75rem !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0.45rem !important;
  }
  .scanner-table-wrapper tbody tr.scanner-empty-row,
  .scanner-table-wrapper tbody tr.scanner-emulated-banner-row {
    padding: 0.75rem !important;
  }
  .scanner-table-wrapper td {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    font-size: 0.825rem !important;
    padding: 0.15rem 0 !important;
    border: none !important;
  }
  .scanner-table-wrapper td code {
    font-size: 0.8rem !important;
  }
  .scanner-table-wrapper td:last-child {
    margin-top: 0.5rem !important;
  }
  .scanner-table-wrapper .btn-connect-discovered {
    width: 100% !important;
    min-height: 44px !important;
    font-size: 0.875rem !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
  }
}




