/* ============================================================
   2:1 Multiplexer Virtual Laboratory — Style Sheet
   Virtual Instrumentation Labs Interactive Learning Platform
   ============================================================ */

/* ── Reset & Base Styles ────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Laboratory Colour Palette */
  --lab-bg:           #ffffff;
  --panel-bg:         #f8fafc;
  --panel-border:     #cbd5e1;
  --header-bg:        #0f172a;
  --header-text:      #ffffff;
  
  /* Primary & Accent Colors */
  --accent:           #2563eb;
  --accent-hover:     #1d4ed8;
  --accent-light:     #dbeafe;
  --text-primary:     #0f172a;
  --text-secondary:   #475569;
  --text-muted:       #94a3b8;

  /* Select Line Color Distinction */
  --select-accent:    #8b5cf6;
  --select-accent-bg: #f3e8ff;
  --select-border:    #c084fc;

  /* Signal & Wire Colors */
  --wire-off:         #94a3b8;
  --wire-on:          #2563eb;
  --wire-on-glow:     rgba(37, 99, 235, 0.4);
  --signal-high:      #2563eb;
  --signal-low:       #64748b;

  /* LED Output Colors */
  --led-off-bg:       #475569;
  --led-off-border:   #334155;
  --led-on-bg:        #10b981;
  --led-on-border:    #059669;
  --led-on-glow:      0 0 16px rgba(16, 185, 129, 0.75);

  --success:          #16a34a;
  --success-bg:       #dcfce7;
  --success-border:   #86efac;

  --gate-fill:        #f1f5f9;
  --gate-stroke:      #1e293b;
  --gate-active-fill: #eff6ff;
  --gate-active-stroke:#2563eb;

  --shadow-sm:        0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md:        0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg:        0 10px 25px rgba(0, 0, 0, 0.1);

  --radius-sm:        4px;
  --radius-md:        8px;
  --radius-lg:        12px;

  --font-sans:        'Segoe UI', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:        'Cascadia Code', 'Fira Code', 'Consolas', monospace;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--lab-bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Laboratory Title Bar ──────────────────────────────────── */
.lab-title-bar {
  background: var(--header-bg);
  color: var(--header-text);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
}

.lab-title-container h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.lab-title-bar .lab-subtitle {
  font-size: 0.8rem;
  color: #94a3b8;
  font-weight: 400;
  display: block;
}

.lab-badge {
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  padding: 4px 12px;
  border-radius: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* ── Gate Nav Bar ─────────────────────────────────────────── */
.gate-nav-bar {
  display: none !important;
}

.gate-nav-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.gate-nav-label {
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 8px;
  white-space: nowrap;
}

.gate-nav-link {
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 5px 14px;
  border-radius: 6px;
  white-space: nowrap;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.gate-nav-link:hover {
  color: #ffffff;
  background: rgba(37, 99, 235, 0.2);
  border-color: rgba(37, 99, 235, 0.4);
}

.gate-nav-link.active {
  color: #ffffff;
  background: #2563eb;
  border-color: #3b82f6;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

/* ── Main Layout Container ─────────────────────────────────── */
.lab-main {
  max-width: 1360px;
  margin: 0 auto;
  padding: 24px 20px 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
  flex: 1;
}

/* ── Toolbar & Control Bar ─────────────────────────────────── */
.lab-toolbar {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.toolbar-divider {
  width: 1px;
  height: 28px;
  background: var(--panel-border);
}

/* Button Component Styles */
.btn {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  user-select: none;
}

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

.btn--mode {
  background: #ffffff;
  border-color: var(--panel-border);
  color: var(--text-secondary);
}

.btn--mode:hover {
  background: #f1f5f9;
  color: var(--text-primary);
}

.btn--mode.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.btn--secondary {
  background: #1e293b;
  color: #ffffff;
}

.btn--secondary:hover:not(:disabled) {
  background: #334155;
}

.btn--secondary:disabled {
  background: #e2e8f0;
  color: #94a3b8;
  cursor: not-allowed;
  border-color: #cbd5e1;
}

.btn--outline {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #334155;
}

.btn--outline:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.btn--accent {
  background: #2563eb;
  color: #ffffff;
}

.btn--accent:hover {
  background: #1d4ed8;
}

/* ── Lab Panel Component ───────────────────────────────────── */
.lab-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
}

.lab-panel:hover {
  border-color: #94a3b8;
  box-shadow: var(--shadow-md);
}

.lab-panel__header {
  background: var(--header-bg);
  color: var(--header-text);
  padding: 12px 20px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.lab-panel__header.flex-between {
  justify-content: space-between;
}

.schematic-subtitle {
  font-size: 0.75rem;
  font-weight: 400;
  color: #94a3b8;
  text-transform: none;
}

.lab-panel__body {
  padding: 20px;
  flex: 1;
}

/* ── Top Layout Grid (Controls + Output) ───────────────────── */
.lab-top-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 20px;
}

/* ── Input Section Subtitles ───────────────────────────────── */
.input-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--panel-border);
}

.select-section-header {
  margin-top: 20px;
}

.section-subtitle {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
}

/* ── Input Control Cards ───────────────────────────────────── */
.input-controls-group, .select-controls-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.select-controls-group {
  grid-template-columns: 1fr;
}

.input-control-card {
  background: #ffffff;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  transition: all 0.25 ease;
}

.input-control-card.active-path {
  border-color: #3b82f6;
  background: #eff6ff;
  box-shadow: 0 0 0 1px #3b82f6;
}

.input-control-card.inactive-path {
  opacity: 0.75;
  background: #f8fafc;
}

.card-status-badge {
  position: absolute;
  top: -8px;
  right: 12px;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.5px;
}

.active-path .card-status-badge {
  background: #2563eb;
  color: #ffffff;
}

.inactive-path .card-status-badge {
  background: #94a3b8;
  color: #ffffff;
}

.input-meta {
  display: flex;
  flex-direction: column;
}

.input-symbol {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.select-symbol {
  color: var(--select-accent);
}

.input-role {
  font-size: 0.74rem;
  color: var(--text-secondary);
}

.select-card {
  border-color: var(--select-border);
  background: var(--select-accent-bg);
}

.select-state-desc {
  font-size: 0.76rem;
  font-weight: 600;
  color: #6b21a8;
  background: #ffffff;
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid #e9d5ff;
}

/* Toggle Switch Button Component */
.toggle-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px;
  border-radius: 20px;
}

.toggle-btn__track {
  width: 44px;
  height: 22px;
  background: #cbd5e1;
  border-radius: 11px;
  position: relative;
  transition: background-color 0.2s ease;
}

.toggle-btn__knob {
  width: 18px;
  height: 18px;
  background: #ffffff;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-btn.high .toggle-btn__track {
  background: #2563eb;
}

.toggle-btn.high .toggle-btn__knob {
  transform: translateX(22px);
}

.toggle-btn.select-high .toggle-btn__track {
  background: #8b5cf6;
}

.toggle-btn.select-high .toggle-btn__knob {
  transform: translateX(22px);
}

.toggle-btn__state {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.95rem;
  min-width: 16px;
}

.toggle-btn.high .toggle-btn__state {
  color: #2563eb;
}

.toggle-btn.select-high .toggle-btn__state {
  color: #8b5cf6;
}

.toggle-btn.low .toggle-btn__state {
  color: #64748b;
}

/* ── Output Monitor Layout ─────────────────────────────────── */
.output-monitor-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.selected-channel-card, .output-result-card {
  background: #ffffff;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.selected-channel-card {
  border-color: #93c5fd;
  background: #f0f9ff;
}

.channel-card-label, .result-card-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.6px;
  margin-bottom: 6px;
}

.channel-display {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0;
}

.channel-name {
  font-size: 1.6rem;
  font-weight: 800;
  color: #1e40af;
  font-family: var(--font-mono);
}

.channel-state-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  background: #dbeafe;
  color: #1e40af;
}

.channel-formula {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: #475569;
  font-weight: 600;
}

/* LED Output Indicator Component */
.led-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 0;
}

.led-indicator {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid var(--led-off-border);
  background: var(--led-off-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  position: relative;
}

.led-inner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
}

.led-indicator.on {
  background: var(--led-on-bg);
  border-color: var(--led-on-border);
  box-shadow: var(--led-on-glow);
}

.output-value-badge {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 800;
}

.output-value-badge.high {
  color: #10b981;
}

.output-value-badge.low {
  color: #64748b;
}

.output-status-text {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

/* Terms Breakdown */
.terms-breakdown-container {
  background: #ffffff;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.terms-title {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-align: center;
}

.terms-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.term-card {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  background: #f8fafc;
}

.term-card.active-term {
  border-color: #3b82f6;
  background: #eff6ff;
}

.term-card.inactive-term {
  opacity: 0.6;
}

.term-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 700;
}

.term-active-tag {
  font-size: 0.6rem;
  padding: 1px 6px;
  border-radius: 8px;
}

.active-term .term-active-tag {
  background: #2563eb;
  color: #fff;
}

.inactive-term .term-active-tag {
  background: #cbd5e1;
  color: #475569;
}

.term-expression {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  margin-top: 4px;
}

.eval-summary-bar {
  background: #f1f5f9;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.eval-label {
  font-weight: 600;
  color: var(--text-secondary);
}

.eval-expression {
  font-family: var(--font-mono);
  color: var(--text-primary);
}

/* ── SVG Schematic Canvas & Views ──────────────────────────── */
.circuit-canvas-container {
  background: #ffffff;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  overflow-x: auto;
  position: relative;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.02);
}

.schematic-view {
  display: none;
  width: 100%;
}

.schematic-view.active {
  display: block;
}

.schematic-view svg {
  width: 100%;
  min-width: 760px;
  height: auto;
  display: block;
}

/* SVG Internal Components & Gate Styling */
.svg-header-text {
  font-size: 10px;
  font-weight: 700;
  fill: #64748b;
  letter-spacing: 0.6px;
}

.svg-input-box {
  fill: #ffffff;
  stroke: #cbd5e1;
  stroke-width: 1.5;
  transition: all 0.2s ease;
}

.svg-switch-interactive:hover .svg-input-box {
  stroke: #2563eb;
  fill: #f0f7ff;
}

.select-box {
  stroke: var(--select-border);
  fill: var(--select-accent-bg);
}

.svg-label-bold {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 14px;
  fill: #0f172a;
}

.select-label {
  fill: #6b21a8;
}

.svg-switch-track {
  fill: #cbd5e1;
  transition: fill 0.2s ease;
}

.svg-switch-knob {
  fill: #ffffff;
  filter: drop-shadow(0px 1px 2px rgba(0,0,0,0.3));
  transition: cx 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.svg-switch-track.high {
  fill: #2563eb;
}

.svg-switch-track.select-high {
  fill: #8b5cf6;
}

.svg-value-text {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 15px;
}

.svg-value-text.high {
  fill: #2563eb;
}

.svg-value-text.low {
  fill: #64748b;
}

.svg-value-text.select-val {
  fill: #8b5cf6;
}

/* Wires & Signals */
.wire-path {
  fill: none;
  stroke: var(--wire-off);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.2s ease, stroke-width 0.2s ease;
}

.wire-path.active-channel-wire {
  stroke: #2563eb;
  stroke-width: 3.5;
  filter: drop-shadow(0 0 4px rgba(37, 99, 235, 0.6));
}

.wire-path.inactive-channel-wire {
  stroke: #cbd5e1;
  stroke-dasharray: 4 4;
}

.wire-path.select-wire {
  stroke: #8b5cf6;
  stroke-width: 3;
}

.wire-path.select-bar-wire {
  stroke: #a855f7;
  stroke-width: 3;
}

.wire-path.active-term-wire {
  stroke: #2563eb;
  stroke-width: 3.5;
  filter: drop-shadow(0 0 4px rgba(37, 99, 235, 0.6));
}

.wire-path.inactive-term-wire {
  stroke: #94a3b8;
  stroke-dasharray: 4 4;
}

.wire-path.final-out-wire.high {
  stroke: #10b981;
  stroke-width: 4;
}

.wire-path.final-out-wire.low {
  stroke: #64748b;
  stroke-width: 3;
}

.wire-label-text {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  fill: #475569;
}

/* Logic Gates */
.gate-body {
  fill: #f8fafc;
  stroke: #1e293b;
  stroke-width: 2.2;
  stroke-linejoin: round;
  transition: all 0.2s ease;
}

.gate-body.active-gate {
  fill: #eff6ff;
  stroke: #2563eb;
  stroke-width: 2.8;
}

.gate-body.inactive-gate {
  fill: #f1f5f9;
  stroke: #94a3b8;
  opacity: 0.7;
}

.pin-dot {
  fill: #1e293b;
}

.gate-name-text {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 13px;
  fill: #0f172a;
  text-anchor: middle;
}

.gate-symbol-text {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 10px;
  fill: #0f172a;
  text-anchor: middle;
}

.gate-sub-label {
  font-size: 10px;
  font-weight: 700;
  text-anchor: middle;
}

.gate-sub-label.active-tag {
  fill: #2563eb;
}

.gate-sub-label.inactive-tag {
  fill: #94a3b8;
}

/* LED SVG Component */
.svg-led-outer {
  fill: none;
  stroke: #cbd5e1;
  stroke-width: 2;
}

.svg-led-body.off {
  fill: #475569;
}

.svg-led-body.on {
  fill: #10b981;
  filter: url(#glow-led-green);
}

.svg-led-val {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 16px;
  fill: #ffffff;
}

/* Animated Signal Pulse */
.signal-pulse {
  fill: #3b82f6;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.signal-pulse.active {
  opacity: 0.9;
}

/* ── Tables Grid & Styling ─────────────────────────────────── */
.lab-tables-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 20px;
}

.panel-intro-text {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.lab-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  background: #ffffff;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--panel-border);
}

.lab-table th {
  background: #1e293b;
  color: #ffffff;
  font-weight: 700;
  padding: 8px 12px;
  text-align: center;
  font-size: 0.78rem;
}

.lab-table td {
  padding: 8px 12px;
  text-align: center;
  border-bottom: 1px solid #e2e8f0;
  color: var(--text-primary);
}

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

.active-selection-row, .full-truth-table tr.active-row {
  background: #eff6ff !important;
  font-weight: 700;
}

.full-truth-table tr.active-row td {
  border-top: 2px solid #3b82f6;
  border-bottom: 2px solid #3b82f6;
  color: #1e40af;
}

.val-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.78rem;
}

.select-pill {
  background: #f3e8ff;
  color: #6b21a8;
}

.channel-pill {
  background: #dbeafe;
  color: #1e40af;
}

.status-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.5px;
}

.status-badge.active {
  background: #dcfce7;
  color: #15803d;
}

.status-badge.inactive {
  background: #f1f5f9;
  color: #64748b;
}

.tt-out {
  font-family: var(--font-mono);
  font-weight: 800;
}

.table-responsive-wrapper {
  overflow-x: auto;
}

/* ── Educational Theory & Hierarchy Grid ───────────────────── */
.lab-theory-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.full-width-panel {
  grid-column: 1 / -1;
}

.content-article h3 {
  font-size: 0.95rem;
  color: #0f172a;
  margin: 14px 0 6px;
}

.content-article h3:first-child {
  margin-top: 0;
}

.content-article p, .content-article ul {
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 10px;
}

.content-article ul {
  padding-left: 20px;
}

.content-article li {
  margin-bottom: 4px;
}

.formula-box {
  background: #0f172a;
  color: #ffffff;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 1.05rem;
  text-align: center;
  margin: 10px 0;
  letter-spacing: 0.5px;
  box-shadow: var(--shadow-sm);
}

.hierarchy-table tr.highlight-row {
  background: #eff6ff;
}

.badge-active-exp {
  background: #2563eb;
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}

.badge-other-exp {
  background: #e2e8f0;
  color: #475569;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}

.callout-note {
  background: #fffbebfb;
  border: 1px solid #fef3c7;
  border-left: 4px solid #f59e0b;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.8rem;
  color: #92400e;
  margin-top: 14px;
}

/* ── Industrial Applications Grid ──────────────────────────── */
.applications-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.app-card {
  background: #ffffff;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 14px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.app-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #93c5fd;
}

.app-icon {
  font-size: 1.5rem;
  margin-bottom: 6px;
}

.app-card h4 {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.app-card p {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* ── Footer ────────────────────────────────────────────────── */
.lab-footer {
  background: #0f172a;
  color: #94a3b8;
  padding: 20px 24px;
  text-align: center;
  font-size: 0.78rem;
  border-top: 1px solid #1e293b;
  margin-top: auto;
}

.lab-footer p {
  margin-bottom: 4px;
}

.lab-footer .copyright {
  font-size: 0.72rem;
  color: #64748b;
}

/* ── Responsive Design Adjustments ─────────────────────────── */
@media (max-width: 1024px) {
  .lab-top-grid {
    grid-template-columns: 1fr;
  }
  .lab-tables-grid {
    grid-template-columns: 1fr;
  }
  .lab-theory-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .lab-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .toolbar-divider {
    display: none;
  }
  .input-controls-group {
    grid-template-columns: 1fr;
  }
  .output-monitor-layout {
    grid-template-columns: 1fr;
  }
  .terms-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Dark Mode Overrides ────────────────────────────────────── */
html[data-theme="dark"] .selected-channel-card,
html.dark .selected-channel-card,
html[data-theme="dark"] .output-result-card,
html.dark .output-result-card,
html[data-theme="dark"] .terms-breakdown-container,
html.dark .terms-breakdown-container {
  background: #0f172a !important;
  border-color: #1e293b !important;
  color: #f8fafc !important;
}

html[data-theme="dark"] .selected-channel-card,
html.dark .selected-channel-card {
  border-color: #1e40af !important;
  background: rgba(30, 58, 138, 0.2) !important;
}

html[data-theme="dark"] .channel-name,
html.dark .channel-name {
  color: #60a5fa !important;
}

html[data-theme="dark"] .channel-state-pill,
html.dark .channel-state-pill {
  background: rgba(37, 99, 235, 0.25) !important;
  color: #93c5fd !important;
}

html[data-theme="dark"] .channel-formula,
html.dark .channel-formula {
  color: #94a3b8 !important;
}

html[data-theme="dark"] .term-card,
html.dark .term-card {
  background: #1e293b !important;
  border-color: #334155 !important;
}

html[data-theme="dark"] .term-card.active-term,
html.dark .term-card.active-term {
  background: rgba(37, 99, 235, 0.2) !important;
  border-color: #3b82f6 !important;
}

html[data-theme="dark"] .term-card.inactive-term,
html.dark .term-card.inactive-term {
  background: rgba(15, 23, 42, 0.7) !important;
  border-color: #1e293b !important;
}

html[data-theme="dark"] .term-name,
html.dark .term-name {
  color: #cbd5e1 !important;
}

html[data-theme="dark"] .term-expression,
html.dark .term-expression {
  color: #f1f5f9 !important;
}

html[data-theme="dark"] .eval-summary-bar,
html.dark .eval-summary-bar {
  background: #1e293b !important;
  border: 1px solid #334155 !important;
}

html[data-theme="dark"] .eval-label,
html.dark .eval-label {
  color: #94a3b8 !important;
}

html[data-theme="dark"] .eval-expression,
html.dark .eval-expression {
  color: #f1f5f9 !important;
}

html[data-theme="dark"] .terms-title,
html.dark .terms-title,
html[data-theme="dark"] .channel-card-label,
html.dark .channel-card-label,
html[data-theme="dark"] .result-card-label,
html.dark .result-card-label,
html[data-theme="dark"] .output-status-text,
html.dark .output-status-text {
  color: #94a3b8 !important;
}

html[data-theme="dark"] .btn--mode,
html.dark .btn--mode {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #cbd5e1 !important;
}

html[data-theme="dark"] .btn--mode:hover,
html.dark .btn--mode:hover {
  background: #334155 !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .btn--mode.active,
html.dark .btn--mode.active {
  background: #2563eb !important;
  color: #ffffff !important;
  border-color: #3b82f6 !important;
}

html[data-theme="dark"] .lab-table,
html.dark .lab-table {
  background: #111827 !important;
  box-shadow: inset 0 0 0 1px #1e293b !important;
}

html[data-theme="dark"] .lab-table td,
html.dark .lab-table td {
  border-bottom: 1px solid #1e293b !important;
  color: #e2e8f0 !important;
}
