/* Eco-Nexus Design System: Dark Glassmorphism, Modern Typography & Ecological Aesthetics */

:root {
  --bg-dark: #070b12;
  --bg-card: rgba(16, 24, 39, 0.75);
  --bg-card-hover: rgba(24, 36, 58, 0.85);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(16, 185, 129, 0.3);
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  --accent-green: #10b981;
  --accent-green-glow: rgba(16, 185, 129, 0.25);
  --accent-cyan: #06b6d4;
  --accent-blue: #3b82f6;
  --accent-amber: #f59e0b;
  --accent-flame: #f97316;
  --accent-red: #ef4444;
  --accent-purple: #8b5cf6;

  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  line-height: 1.5;
}

/* Ambient Backlight Glows */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}
.glow-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.15), transparent 70%);
  top: -100px;
  left: -100px;
}
.glow-2 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.12), transparent 70%);
  bottom: -150px;
  right: -150px;
}
.glow-3 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, rgba(249, 115, 22, 0.08), transparent 70%);
  top: 40%;
  left: 45%;
}

/* Header */
.app-header {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 36px;
  background: rgba(10, 15, 26, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #10b981, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}
.eco-leaf {
  width: 26px;
  height: 26px;
  color: #fff;
}

.brand-title {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.tag-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
  letter-spacing: 0.06em;
}

.brand-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  gap: 8px;
  background: rgba(16, 24, 39, 0.6);
  padding: 5px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.nav-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
  background: rgba(16, 185, 129, 0.15);
  color: #fff;
  border: 1px solid rgba(16, 185, 129, 0.35);
  box-shadow: 0 2px 12px rgba(16, 185, 129, 0.2);
}

.tab-icon {
  font-size: 1rem;
}

.tab-stat {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.35);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent-green);
}

.benchmark-tab.active {
  background: rgba(6, 182, 212, 0.15);
  border-color: rgba(6, 182, 212, 0.4);
}

/* Main Sim Layout */
.sim-container {
  position: relative;
  z-index: 5;
  max-width: 1440px;
  margin: 24px auto;
  padding: 0 24px;
}

.sim-pane {
  display: none;
  animation: fadeIn 0.3s ease forwards;
}

.sim-pane.active {
  display: block;
}

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

.pane-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 1080px) {
  .pane-grid {
    grid-template-columns: 1fr;
  }
}

/* Glass Cards */
.canvas-card, .sidebar-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
  gap: 16px;
}

.card-title-group h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.card-title-group p {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.live-pill {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 4px 10px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulse 1.8s infinite;
}

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

/* Canvas Viewport */
.canvas-wrapper {
  position: relative;
  background: #04070d;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.8);
}

canvas {
  display: block;
  max-width: 100%;
  height: auto;
  cursor: crosshair;
}

.canvas-overlay-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.canvas-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.dot.unburned { background: #2d6a4f; }
.dot.burning { background: #ff4d00; box-shadow: 0 0 6px #ff4d00; }
.dot.burnt { background: #444b54; }
.dot.firebreak { background: #f1c40f; }
.dot.water { background: #3b82f6; }

.dot.tier-emergent { background: #1b4d3e; }
.dot.tier-nitrogen { background: #2d6a4f; }
.dot.tier-subcanopy { background: #52b788; }
.dot.tier-shrub { background: #74c69d; }
.dot.tier-clover { background: #95d5b2; }

.dot.temp-cool { background: #27ae60; }
.dot.temp-mid { background: #f39c12; }
.dot.temp-hot { background: #e67e22; }
.dot.temp-lethal { background: #e74c3c; }

.dot.plastic-pet { background: #3498db; }
.dot.plastic-film { background: #e74c3c; }
.dot.plastic-micro { background: #f1c40f; }
.dot.plastic-net { background: #9b59b6; }
.dot.barrier-boom { background: #00ffcc; box-shadow: 0 0 6px #00ffcc; }

/* Control Sidebar */
.control-section {
  margin-bottom: 24px;
}

.control-section h3, .metrics-section h3 {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.control-row {
  margin-bottom: 14px;
}

.control-row label {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.control-row label span {
  font-family: var(--font-mono);
  color: var(--text-main);
  font-weight: 600;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent-green);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  height: 6px;
}

.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  margin-bottom: 16px;
}

.switch-label {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  font-weight: 600;
}
.switch-label .subtext {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--text-muted);
}

.custom-toggle {
  width: 20px;
  height: 20px;
  accent-color: var(--accent-green);
  cursor: pointer;
}

.btn-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.btn {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-primary {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #059669, #047857);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}
.btn-outline:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}

/* Metrics Section */
.metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.metric-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.metric-val {
  font-size: 1.15rem;
  font-family: var(--font-mono);
  font-weight: 700;
}

.highlight-green { color: var(--accent-green); }
.highlight-blue { color: var(--accent-cyan); }
.highlight-red { color: var(--accent-red); }
.highlight-gold { color: var(--accent-amber); }
.highlight-purple { color: var(--accent-purple); }

.physics-callout {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.45;
  background: rgba(255, 255, 255, 0.02);
  border-left: 2px solid var(--accent-green);
  padding: 10px 12px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Mode toggles inside card header */
.tier-mode-toggle {
  display: flex;
  gap: 6px;
  background: rgba(0, 0, 0, 0.35);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.mode-btn {
  background: transparent;
  border: none;
  font-family: var(--font-sans);
  font-size: 0.76rem;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-btn.active {
  background: rgba(16, 185, 129, 0.2);
  color: #fff;
  border: 1px solid rgba(16, 185, 129, 0.35);
  font-weight: 600;
}

/* Benchmark Tab View */
.benchmark-container {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 36px;
}

.benchmark-header h2 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 6px;
}
.benchmark-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 28px;
}

.benchmark-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.b-card {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: transform 0.2s ease;
}
.b-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
}

.b-badge {
  font-size: 0.68rem;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 8px;
}
.b-badge.fire { background: rgba(249, 115, 22, 0.2); color: var(--accent-flame); }
.b-badge.forest { background: rgba(16, 185, 129, 0.2); color: var(--accent-green); }
.b-badge.urban { background: rgba(6, 182, 212, 0.2); color: var(--accent-cyan); }
.b-badge.river { background: rgba(59, 130, 246, 0.2); color: var(--accent-blue); }

.b-card h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.b-stat-highlight {
  font-size: 1.6rem;
  font-family: var(--font-mono);
  font-weight: 800;
  color: var(--accent-green);
  margin-bottom: 14px;
}

.b-table {
  width: 100%;
  font-size: 0.8rem;
  border-collapse: collapse;
}
.b-table td {
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.b-table td:last-child {
  text-align: right;
  font-family: var(--font-mono);
}
.b-table .bold { font-weight: 700; }
.b-table .red { color: var(--accent-red); }
.b-table .green { color: var(--accent-green); }

.re-run-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.status-verified {
  color: var(--accent-green);
  font-weight: 700;
  font-family: var(--font-mono);
}

/* =========================================================================
   HARDWARE & ARDUINO DIY STYLES
   ========================================================================= */

.hardware-container {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.hardware-header {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 32px;
}

.badge-pill {
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 4px 12px;
  border-radius: 20px;
  display: inline-block;
  margin-bottom: 12px;
  letter-spacing: 0.05em;
}

.hardware-header h2 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.hardware-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 980px;
  line-height: 1.6;
}

/* Photo Gallery Cards */
.hardware-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(440px, 1fr));
  gap: 24px;
}

@media (max-width: 768px) {
  .hardware-gallery {
    grid-template-columns: 1fr;
  }
}

.hw-img-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
  position: relative;
}

.hw-img-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  z-index: 2;
}

.hw-photo {
  width: 100%;
  height: 320px;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.hw-img-card:hover .hw-photo {
  transform: scale(1.02);
}

.hw-img-caption {
  padding: 16px 20px;
  font-size: 0.84rem;
  color: var(--text-muted);
  background: rgba(10, 15, 26, 0.9);
  line-height: 1.5;
  border-top: 1px solid var(--border-subtle);
}

.hw-img-caption strong {
  color: var(--text-main);
}

/* Sections */
.hw-section-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 30px;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 22px;
}

/* Solutions DIY Grid */
.solutions-diy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.diy-step-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 22px;
  position: relative;
  transition: border-color 0.2s ease;
}

.diy-step-box:hover {
  border-color: rgba(16, 185, 129, 0.3);
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-green);
  color: #000;
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.diy-step-box h4 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 14px;
}

.step-list {
  list-style: none;
  font-size: 0.83rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.step-list li {
  position: relative;
  padding-left: 14px;
  line-height: 1.5;
}

.step-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--accent-green);
  font-weight: bold;
}

.step-list strong {
  color: var(--text-main);
}

/* Circuit Simulator Grid */
.circuit-sim-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 960px) {
  .circuit-sim-grid {
    grid-template-columns: 1fr;
  }
}

.sim-buttons-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sim-buttons-panel h4 {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.sim-btn-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.components-status-display {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
}

.components-status-display h4 {
  margin-bottom: 12px;
}

.hw-pin-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.pin-status-item {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.03);
  padding: 6px 10px;
  border-radius: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pin-id {
  color: var(--text-dim);
}

.pin-val {
  color: var(--text-muted);
}

.pin-val.active {
  color: var(--accent-green);
  font-weight: 700;
}

.pin-val.danger {
  color: var(--accent-red);
  font-weight: 700;
  animation: pulse 1s infinite;
}

.pin-val.warning {
  color: var(--accent-amber);
  font-weight: 700;
}

/* Virtual Serial Terminal */
.sim-terminal-panel {
  background: #030712;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 420px;
  box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.8);
}

.terminal-header {
  background: #0b1120;
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.terminal-title {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
  font-weight: 700;
}

.terminal-clear-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-dim);
  font-size: 0.68rem;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
}

.terminal-clear-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.terminal-body {
  padding: 16px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.term-line {
  line-height: 1.4;
  word-break: break-all;
}

.term-line.green { color: #4ade80; }
.term-line.red { color: #f87171; font-weight: bold; }
.term-line.yellow { color: #facc15; }

/* BOM Table */
.bom-table-wrapper {
  overflow-x: auto;
}

.bom-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.bom-table th {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-dim);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.bom-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
}

.bom-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.bom-table td strong {
  color: var(--text-main);
}

/* Code Viewport */
.code-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.code-viewport {
  background: #040814;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 20px;
  overflow-x: auto;
  max-height: 480px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.5;
  color: #38bdf8;
}

/* Quick Summary Box */
.quick-summary-box {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(6, 182, 212, 0.05));
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.summary-bullets {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.s-bullet {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
  background: rgba(0, 0, 0, 0.25);
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-green);
}

.s-bullet strong {
  color: var(--text-main);
  display: block;
  margin-bottom: 2px;
}

/* =========================================================================
   CIRCUITAI STUDIO & INTERACTIVE MAKER WORKBENCH
   ========================================================================= */
.circuitai-studio-container {
  background: radial-gradient(circle at 15% 20%, rgba(56, 189, 248, 0.05), transparent 40%),
              radial-gradient(circle at 85% 80%, rgba(139, 92, 246, 0.05), transparent 40%),
              rgba(13, 21, 39, 0.7);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 32px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.studio-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.studio-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.studio-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 6px;
}

.studio-desc {
  color: var(--text-muted);
  font-size: 0.92rem;
  max-width: 780px;
  line-height: 1.5;
}

.studio-modes-badge {
  display: flex;
  gap: 10px;
}

.mode-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #34d399;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 6px 12px;
  border-radius: 6px;
}

/* Workspace Grid */
.circuitai-workspace-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
}

@media (max-width: 1024px) {
  .circuitai-workspace-grid {
    grid-template-columns: 1fr;
  }
}

/* Chat Card */
.circuitai-chat-card {
  background: rgba(8, 14, 28, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  height: 620px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.chat-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-ai-avatar {
  font-size: 1.4rem;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(139, 92, 246, 0.2));
  border: 1px solid rgba(56, 189, 248, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-header-title h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #f8fafc;
  margin: 0;
}

.chat-status-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.btn-chat-reset {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-chat-reset:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
}

/* Chat Messages */
.circuitai-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.circuitai-messages::-webkit-scrollbar {
  width: 5px;
}
.circuitai-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 90%;
  animation: fadeIn 0.25s ease-out;
}

.chat-msg.user {
  align-self: flex-end;
}

.chat-msg.ai {
  align-self: flex-start;
}

.chat-msg-bubble {
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.55;
  word-break: break-word;
}

.chat-msg.user .chat-msg-bubble {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff;
  border-bottom-right-radius: 2px;
}

.chat-msg.ai .chat-msg-bubble {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(56, 189, 248, 0.2);
  color: #e2e8f0;
  border-bottom-left-radius: 2px;
}

.chat-msg.ai .chat-msg-bubble strong {
  color: #38bdf8;
}

.chat-action-btn {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.chat-action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.45);
}

/* Prompt Chips */
.chat-prompt-chips {
  display: flex;
  gap: 6px;
  padding: 8px 14px;
  overflow-x: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(0, 0, 0, 0.15);
}

.chat-prompt-chips::-webkit-scrollbar {
  height: 3px;
}
.chat-prompt-chips::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
}

.chip-btn {
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-size: 0.72rem;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip-btn:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}

/* Chat Input */
.chat-input-bar {
  display: flex;
  padding: 10px 14px;
  gap: 8px;
  background: rgba(0, 0, 0, 0.25);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-input-bar input {
  flex: 1;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 8px 12px;
  color: #ffffff;
  font-size: 0.85rem;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.chat-input-bar input:focus {
  border-color: #38bdf8;
}

.btn-chat-send {
  background: #0284c7;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s ease;
}

.btn-chat-send:hover {
  background: #0369a1;
}

/* Workbench Card */
.circuitai-workbench-card {
  background: rgba(8, 14, 28, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.workbench-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.workbench-title-group h4 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #f8fafc;
  margin: 0 0 2px 0;
}

.workbench-title-group p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
}

.workbench-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 600;
}

/* Toolbox */
.workbench-toolbox {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  background: rgba(0, 0, 0, 0.3);
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.toolbox-label {
  font-size: 0.74rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: #94a3b8;
  text-transform: uppercase;
}

.toolbox-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tool-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.tool-btn:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  transform: translateY(-1px);
}

.tool-btn.active {
  background: rgba(56, 189, 248, 0.25);
  border-color: #38bdf8;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

/* Workbench Canvas */
.workbench-canvas-wrapper {
  position: relative;
  background: #070b14;
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8);
  min-height: 440px;
}

#breadboardStudioCanvas {
  display: block;
  width: 100%;
  height: auto;
  cursor: crosshair;
}

.workbench-overlay-info {
  position: absolute;
  bottom: 8px;
  left: 12px;
  font-size: 0.72rem;
  color: #94a3b8;
  background: rgba(15, 23, 42, 0.75);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  pointer-events: none;
}

/* Status Bar */
.workbench-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.status-indicator-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
  display: inline-block;
}

.status-dot.active {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulseGreen 1.5s infinite;
}

@keyframes pulseGreen {
  0% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(1); opacity: 0.8; }
}

.status-text {
  font-size: 0.78rem;
  font-weight: 600;
  color: #94a3b8;
}

.status-text.active {
  color: #34d399;
}

.workbench-stats-info {
  display: flex;
  gap: 14px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.workbench-stats-info strong {
  color: #f8fafc;
  font-family: var(--font-mono);
}

/* =========================================================================
   RESPONSIVIDADE MOBILE & TABLET (REFINAMENTO EXAUSTIVO)
   ========================================================================= */
@media (max-width: 768px) {
  .app-header {
    padding: 14px 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .header-left {
    justify-content: flex-start;
  }

  .brand-title {
    font-size: 1.25rem;
  }

  .nav-tabs {
    overflow-x: auto;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }

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

  .nav-tab {
    flex-shrink: 0;
    padding: 8px 12px;
    font-size: 0.8rem;
  }

  .sim-container {
    padding: 14px 12px;
  }

  .pane-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .hardware-gallery {
    grid-template-columns: 1fr;
  }

  .circuitai-studio-container {
    padding: 16px;
  }

  .circuitai-chat-card {
    height: 480px;
  }

  .circuit-sim-grid {
    grid-template-columns: 1fr;
  }

  .workbench-header {
    flex-direction: column;
    align-items: stretch;
  }

  .workbench-actions {
    justify-content: flex-start;
  }

  .toolbox-buttons {
    overflow-x: auto;
    padding-bottom: 4px;
    flex-wrap: wrap;
  }

  .code-viewport {
    font-size: 0.72rem;
    padding: 12px;
  }

  .bom-table {
    font-size: 0.75rem;
  }

  .bom-table th, .bom-table td {
    padding: 8px 6px;
  }
}

/* HiDPI canvas touch optimizations */
canvas {
  touch-action: pan-y pinch-zoom;
  -webkit-tap-highlight-color: transparent;
}

/* =========================================================================
   METRIC PROGRESS TRACKS & ANIMATED BARS
   ========================================================================= */
.metric-progress-track {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  margin-top: 8px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
}

.metric-progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.metric-progress-fill.green {
  background: linear-gradient(90deg, #059669, #10b981);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}
.metric-progress-fill.blue {
  background: linear-gradient(90deg, #0284c7, #38bdf8);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
}
.metric-progress-fill.red {
  background: linear-gradient(90deg, #b91c1c, #ef4444);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}
.metric-progress-fill.gold {
  background: linear-gradient(90deg, #d97706, #fbbf24);
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
}
.metric-progress-fill.purple {
  background: linear-gradient(90deg, #7c3aed, #a78bfa);
  box-shadow: 0 0 8px rgba(167, 139, 250, 0.5);
}

/* =========================================================================
   WORKBENCH SIMULATION CONTROL DOCK
   ========================================================================= */
.workbench-sim-dock {
  background: rgba(15, 23, 42, 0.95);
  border-top: 1px solid rgba(59, 130, 246, 0.25);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sim-dock-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.sim-dock-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.sim-dock-title {
  font-size: 0.85rem;
  color: #f8fafc;
  font-weight: 700;
}

.sim-dock-sub {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-left: 6px;
}

.sim-dock-quick-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-xs {
  font-size: 0.72rem;
  padding: 5px 10px;
  border-radius: 6px;
}

.sim-dock-sliders-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
}

.dock-slider-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dock-slider-box label {
  font-size: 0.72rem;
  color: #cbd5e1;
  display: flex;
  justify-content: space-between;
  font-weight: 600;
}

.dock-slider-box label span {
  color: #38bdf8;
  font-family: var(--font-mono);
}

.dock-slider-box input[type="range"] {
  height: 5px;
  accent-color: #38bdf8;
}

/* =========================================================================
   TOOL CALLING EXECUTION LOGS NO CHAT
   ========================================================================= */
.agent-thinking-box {
  background: rgba(14, 165, 233, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  font-size: 0.78rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.agent-thinking-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: #38bdf8;
}

.tool-step-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #cbd5e1;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 8px;
  border-radius: 4px;
  border-left: 2px solid #10b981;
  animation: fadeIn 0.3s ease;
}

.tool-step-item .tool-tag {
  color: #34d399;
  font-weight: 700;
}

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




