/* ==========================================================================
   InstruVerse - PID Controller Laboratory Simulator Stylesheet
   Design Standard: Academic / Industrial Virtual Instrumentation Laboratory
   Palette: White (#ffffff), Light Grey (#f8fafc / #f1f5f9), Engineering Navy (#0f172a / #1e3a8a)
   ========================================================================== */

:root {
  --bg-main: #f8fafc;
  --panel-bg: #ffffff;
  --panel-border: #e2e8f0;
  --panel-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  
  --navy-primary: #0f172a;
  --navy-header: #1e3a8a;
  --navy-accent: #2563eb;
  
  --text-main: #1e293b;
  --text-muted: #64748b;
  
  --accent-blue: #0284c7;
  --accent-green: #16a34a;
  --accent-amber: #d97706;
  --accent-red: #dc2626;
  --accent-purple: #9333ea;

  --water-blue: #38bdf8;
  --water-blue-dark: #0284c7;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

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

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

/* Subscript baseline alignment fix */
sub {
  font-size: 0.75em;
  line-height: 0;
  vertical-align: baseline;
  position: relative;
  bottom: -0.15em;
}

/* Header */
.lab-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
  color: #ffffff;
  padding: 0.85rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  border-bottom: 4px solid var(--accent-blue);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  min-width: 0;
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.brand-name {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
  white-space: nowrap;
}

.brand-name span {
  color: #38bdf8;
}

.experiment-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: #cbd5e1;
  border-left: 2px solid rgba(255, 255, 255, 0.2);
  padding-left: 0.75rem;
  white-space: nowrap;
}

.header-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
}

.badge-diploma {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.badge-diploma:hover {
  background: rgba(56, 189, 248, 0.25);
  color: #7dd3fc;
}

.badge-status {
  background: #16a34a;
  color: #ffffff;
}

.badge-status.stopped {
  background: #dc2626;
}

.badge-autotune {
  font-size: 0.72rem;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 4px;
  padding: 3px 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: all 0.3s ease;
  white-space: nowrap;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.badge-status-resp {
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(56, 189, 248, 0.15);
  color: #0284c7;
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 4px;
  padding: 3px 8px;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.03em;
}

.schematic-subtitle {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Main Layout */
.lab-container {
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  flex: 1;
}

.lab-workspace {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 1.25rem;
  align-items: start;
}

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

/* Left Column */
.left-column {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Panel Styles */
.lab-panel {
  background-color: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  box-shadow: var(--panel-shadow);
  overflow: hidden;
}

.panel-header {
  background-color: #f1f5f9;
  border-bottom: 1px solid var(--panel-border);
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.panel-header h2 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--navy-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.panel-body {
  padding: 1rem;
}

/* Left Side - SVG Schematic */
.schematic-card {
  display: flex;
  flex-direction: column;
}

.svg-viewport {
  width: 100%;
  background: radial-gradient(circle at center, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.svg-viewport svg {
  width: 100%;
  height: auto;
  display: block;
}

/* Right Side - Controls */
.controls-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Control Buttons */
.btn-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.btn {
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  white-space: nowrap;
  transition: all 0.15s ease-in-out;
}

.btn-start {
  background-color: #16a34a;
  color: #ffffff;
}

.btn-start:hover {
  background-color: #15803d;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.3);
}

.btn-stop {
  background-color: #dc2626;
  color: #ffffff;
}

.btn-stop:hover {
  background-color: #b91c1c;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.3);
}

.btn-reset {
  background-color: #f1f5f9;
  color: #334155;
  border-color: #cbd5e1;
}

.btn-reset:hover {
  background-color: #e2e8f0;
  color: #0f172a;
}

/* Mode Selector Switch */
.mode-switch-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: #f1f5f9;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  flex-wrap: wrap;
}

.mode-label {
  font-weight: 600;
  font-size: 0.825rem;
  color: var(--text-main);
  white-space: nowrap;
}

.toggle-group {
  display: flex;
  background: #cbd5e1;
  border-radius: 4px;
  padding: 2px;
  gap: 2px;
}

.toggle-btn {
  padding: 0.3rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 700;
  border: none;
  background: transparent;
  color: #475569;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.toggle-btn.active {
  background: var(--navy-header);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* Sliders Section */
.control-grid {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.control-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background: #fafafa;
  padding: 0.65rem 0.85rem;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.control-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.control-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--navy-primary);
  white-space: nowrap;
}

.num-input-group {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.num-input {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  background: var(--navy-primary);
  color: #38bdf8;
  border: 1px solid #334155;
  border-radius: 4px;
  padding: 0.2rem 0.4rem;
  width: 72px;
  text-align: right;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -moz-appearance: textfield;
}

.num-input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25);
}

.num-input::-webkit-inner-spin-button,
.num-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.unit-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #38bdf8;
}

.slider-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.range-slider {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  background: #cbd5e1;
  border-radius: 3px;
  outline: none;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--navy-header);
  border: 2px solid #ffffff;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: transform 0.1s;
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  background: var(--navy-accent);
}

.slider-range-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  padding: 0 2px;
  gap: 0.25rem;
}

.slider-range-labels span {
  white-space: nowrap;
}

.slider-range-labels span:nth-child(2) {
  text-align: center;
  flex: 1;
  padding: 0 4px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Disturbance Switch */
.disturbance-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  padding: 0.75rem 1rem;
  border-radius: 6px;
}

.disturbance-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.disturbance-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #9a3412;
  white-space: nowrap;
}

.disturbance-desc {
  font-size: 0.75rem;
  color: #c2410c;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-toggle {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: .2s;
  border-radius: 24px;
}

.slider-toggle:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .2s;
  border-radius: 50%;
}

input:checked + .slider-toggle {
  background-color: var(--accent-red);
}

input:checked + .slider-toggle:before {
  transform: translateX(20px);
}

/* Tasks / Objectives Checklist */
.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8rem;
  line-height: 1.35;
  padding: 0.45rem 0.65rem;
  background: #f8fafc;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
  word-break: break-word;
}

.task-checkbox {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.task-item.completed {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.task-item.completed .task-checkbox {
  background: #16a34a;
  border-color: #16a34a;
}

.task-item.completed .task-checkbox::after {
  content: "✓";
  color: white;
  font-size: 10px;
  font-weight: bold;
}

/* Recommendation & Status Cards */
.rec-card, .status-card {
  background: #fafafa;
  border: 1px solid #e2e8f0;
}

.rec-values-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.rec-val-item {
  font-size: 0.75rem;
  font-weight: 600;
  background: #0f172a;
  color: #f1f5f9;
  padding: 0.35rem 0.4rem;
  border-radius: 4px;
  border: 1px solid #334155;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-apply-rec {
  margin-top: 0.5rem;
  width: 100%;
  padding: 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
  color: #ffffff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(2, 132, 199, 0.2);
  transition: all 0.2s ease;
}

.btn-apply-rec:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(2, 132, 199, 0.3);
}

/* Live Telemetry Display Bar */
.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.5rem;
}

@media (max-width: 1400px) {
  .telemetry-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  .telemetry-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.telemetry-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.55rem 0.65rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
}

.telemetry-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.telemetry-value {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--navy-primary);
  margin-top: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.val-sp { color: #0284c7; }
.val-pv { color: #2563eb; }
.val-err { color: #dc2626; }
.val-op { color: #d97706; }
.val-valve { color: #059669; }
.val-pump { color: #dc2626; font-size: 1.05rem; }

/* Live Trend Graph */
.graph-container {
  height: 250px;
  width: 100%;
  position: relative;
}

/* Bottom Grid for Observation Table & Principles */
.bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

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

/* Observation Table */
.table-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-sm {
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 4px;
}

.table-wrapper {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  position: relative;
}

.obs-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.8rem;
  text-align: left;
}

.obs-table th {
  background-color: var(--navy-primary);
  color: #ffffff;
  padding: 0.55rem 0.65rem;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  white-space: nowrap;
}

.obs-table td {
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid #e2e8f0;
  font-family: var(--font-mono);
  white-space: nowrap;
  background-color: #ffffff;
}

.obs-table tr:nth-child(even) td {
  background-color: #f8fafc;
}

.obs-table tr:hover td {
  background-color: #f1f5f9;
}

.rec-table th {
  background: #0f172a !important;
  color: #f8fafc !important;
  font-size: 0.75rem !important;
}

.rec-table td {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-align: center;
  padding: 0.4rem 0.5rem;
}

/* Educational Working Principle Panel */
.tab-header {
  display: flex;
  border-bottom: 1px solid #e2e8f0;
  gap: 0.25rem;
  background: #f8fafc;
  padding: 0.4rem 0.4rem 0 0.4rem;
  overflow-x: auto;
  scrollbar-width: thin;
}

.tab-btn {
  padding: 0.45rem 0.8rem;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid transparent;
  border-bottom: none;
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.tab-btn.active {
  background: #ffffff;
  border-color: #e2e8f0;
  color: var(--navy-primary);
  font-weight: 700;
}

.tab-content {
  display: none;
  padding: 0.85rem 0.25rem;
  font-size: 0.85rem;
  color: #34d399;
  line-height: 1.6;
}

.tab-content.active {
  display: block;
  color: #334155;
}

.tab-content h4 {
  color: var(--navy-primary);
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
}

.formula-box {
  background: #f1f5f9;
  border-left: 3px solid var(--navy-accent);
  padding: 0.5rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  margin: 0.5rem 0;
  border-radius: 0 4px 4px 0;
}

/* SVG Animations & Classes */
.flow-line {
  stroke-dasharray: 8, 4;
  animation: flowAnim 1s linear infinite;
}

@keyframes flowAnim {
  from { stroke-dashoffset: 24; }
  to { stroke-dashoffset: 0; }
}

.signal-line {
  stroke-dasharray: 4, 3;
  animation: signalAnim 1.5s linear infinite;
}

@keyframes signalAnim {
  from { stroke-dashoffset: 14; }
  to { stroke-dashoffset: 0; }
}

/* Footer */
.lab-footer {
  text-align: center;
  padding: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--panel-border);
  background: #ffffff;
  margin-top: auto;
}

/* Responsive Media Queries */
@media (max-width: 1200px) {
  .experiment-title {
    font-size: 0.88rem;
  }
}

@media (max-width: 768px) {
  .lab-header {
    padding: 0.75rem 1rem;
  }
  .experiment-title {
    display: none;
  }
  .btn-group {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 540px) {
  .rec-values-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .btn-group {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   PrayogSetu PID Controller — Black / Dark Mode Theme Overrides
   ========================================================================== */

html[data-theme="dark"],
html.dark {
  --bg-main: #080d18;
  --panel-bg: #0f172a;
  --panel-border: #1e293b;
  --panel-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  
  --navy-primary: #38bdf8;
  --navy-header: #0f172a;
  --navy-accent: #38bdf8;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
}

html[data-theme="dark"] body,
html.dark body {
  background-color: #080d18;
  color: #f8fafc;
}

/* Panels */
html[data-theme="dark"] .lab-panel,
html.dark .lab-panel {
  background-color: #0f172a !important;
  border-color: #1e293b !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35) !important;
}

html[data-theme="dark"] .panel-header,
html.dark .panel-header {
  background-color: #131d31 !important;
  border-bottom: 1px solid #1e293b !important;
}

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

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

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

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

/* Control Loop Mode Box */
html[data-theme="dark"] .mode-switch-container,
html.dark .mode-switch-container {
  background: #141e33 !important;
  border-color: #1e293b !important;
}

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

html[data-theme="dark"] .toggle-group,
html.dark .toggle-group {
  background: #0b1324 !important;
  border: 1px solid #1e293b !important;
}

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

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

html[data-theme="dark"] .toggle-btn.active,
html.dark .toggle-btn.active {
  background: #0284c7 !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4) !important;
}

/* Control Items / Set Point Cards */
html[data-theme="dark"] .control-item,
html.dark .control-item {
  background: #141e33 !important;
  border-color: #1e293b !important;
}

html[data-theme="dark"] .control-item.disabled,
html.dark .control-item.disabled {
  opacity: 0.45 !important;
  background: #0d1526 !important;
  border-color: #162035 !important;
}

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

html[data-theme="dark"] .num-input,
html.dark .num-input {
  background: #080d1a !important;
  color: #38bdf8 !important;
  border-color: #1e293b !important;
}

html[data-theme="dark"] .num-input:focus,
html.dark .num-input:focus {
  border-color: #38bdf8 !important;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25) !important;
}

html[data-theme="dark"] .range-slider,
html.dark .range-slider {
  background: #1e293b !important;
}

html[data-theme="dark"] .range-slider::-webkit-slider-thumb,
html.dark .range-slider::-webkit-slider-thumb {
  background: #38bdf8 !important;
  border: 2px solid #0f172a !important;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.5) !important;
}

html[data-theme="dark"] .range-slider::-moz-range-thumb,
html.dark .range-slider::-moz-range-thumb {
  background: #38bdf8 !important;
  border: 2px solid #0f172a !important;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.5) !important;
}

html[data-theme="dark"] .slider-range-labels,
html.dark .slider-range-labels {
  color: #64748b !important;
}

/* Disturbance Card */
html[data-theme="dark"] .disturbance-card,
html.dark .disturbance-card {
  background: #1a120c !important;
  border-color: #43220a !important;
}

html[data-theme="dark"] .disturbance-title,
html.dark .disturbance-title {
  color: #fb923c !important;
}

html[data-theme="dark"] .disturbance-desc,
html.dark .disturbance-desc {
  color: #ea580c !important;
}

html[data-theme="dark"] .slider-toggle,
html.dark .slider-toggle {
  background-color: #1e293b !important;
}

/* Tasks / Checklist */
html[data-theme="dark"] .task-item,
html.dark .task-item {
  background: #141e33 !important;
  border-color: #1e293b !important;
  color: #cbd5e1 !important;
}

html[data-theme="dark"] .task-checkbox,
html.dark .task-checkbox {
  border-color: #475569 !important;
}

html[data-theme="dark"] .task-item.completed,
html.dark .task-item.completed {
  background: #062b18 !important;
  border-color: #0f5132 !important;
  color: #86efac !important;
}

/* Recommendations and Status Cards */
html[data-theme="dark"] .rec-card,
html[data-theme="dark"] .status-card,
html.dark .rec-card,
html.dark .status-card {
  background: #141e33 !important;
  border-color: #1e293b !important;
}

html[data-theme="dark"] .rec-val-item,
html.dark .rec-val-item {
  background: #0b1324 !important;
  color: #38bdf8 !important;
  border-color: #1e293b !important;
}

/* Live Telemetry Display Bar */
html[data-theme="dark"] .telemetry-card,
html.dark .telemetry-card {
  background: #141e33 !important;
  border-color: #1e293b !important;
}

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

html[data-theme="dark"] .telemetry-value,
html.dark .telemetry-value {
  color: #f8fafc !important;
}

/* P&ID Blueprint SVG Diagram & Elements */
html[data-theme="dark"] .svg-viewport,
html.dark .svg-viewport {
  background: radial-gradient(circle at center, #0b1326 0%, #060a12 100%) !important;
  border-color: #1e293b !important;
}

html[data-theme="dark"] #svgGridPath,
html.dark #svgGridPath {
  stroke: rgba(255, 255, 255, 0.05) !important;
}

html[data-theme="dark"] #svgFloorLine,
html.dark #svgFloorLine {
  stroke: #334155 !important;
}

html[data-theme="dark"] .sump-tank-shell,
html.dark .sump-tank-shell {
  fill: #141e33 !important;
  stroke: #334155 !important;
}

html[data-theme="dark"] .process-tank-shell,
html.dark .process-tank-shell {
  fill: #0c1424 !important;
  stroke: #334155 !important;
}

html[data-theme="dark"] .process-tank-outline,
html.dark .process-tank-outline {
  stroke: #38bdf8 !important;
  opacity: 0.5 !important;
}

html[data-theme="dark"] .process-tank-cap,
html.dark .process-tank-cap {
  fill: #0f1d38 !important;
}

html[data-theme="dark"] #tankGrad stop,
html.dark #tankGrad stop {
  stop-color: #38bdf8 !important;
  stop-opacity: 0.08 !important;
}

html[data-theme="dark"] .tank-scale-mark,
html.dark .tank-scale-mark {
  stroke: #64748b !important;
}

html[data-theme="dark"] .tank-scale-text,
html.dark .tank-scale-text {
  fill: #cbd5e1 !important;
}

html[data-theme="dark"] .lt-bubble-bg,
html.dark .lt-bubble-bg {
  fill: #141e33 !important;
  stroke: #38bdf8 !important;
}

html[data-theme="dark"] .lt-bubble-line,
html.dark .lt-bubble-line {
  stroke: #38bdf8 !important;
}

html[data-theme="dark"] .lt-bubble-text,
html.dark .lt-bubble-text {
  fill: #f1f5f9 !important;
}

html[data-theme="dark"] .disturbance-valve-text,
html.dark .disturbance-valve-text {
  fill: #fb923c !important;
}

/* Observation Table */
html[data-theme="dark"] .table-wrapper,
html.dark .table-wrapper {
  border-color: #1e293b !important;
}

html[data-theme="dark"] .obs-table th,
html.dark .obs-table th {
  background-color: #0b1324 !important;
  color: #38bdf8 !important;
  border-bottom: 1px solid #1e293b !important;
}

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

html[data-theme="dark"] .obs-table tr:nth-child(even) td,
html.dark .obs-table tr:nth-child(even) td {
  background-color: #0e1627 !important;
}

html[data-theme="dark"] .obs-table tr:hover td,
html.dark .obs-table tr:hover td {
  background-color: #17243e !important;
}

/* Educational Principle Tabs */
html[data-theme="dark"] .tab-header,
html.dark .tab-header {
  background: #0b1324 !important;
  border-bottom-color: #1e293b !important;
}

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

html[data-theme="dark"] .tab-btn.active,
html.dark .tab-btn.active {
  background: #141e33 !important;
  border-color: #1e293b !important;
  border-bottom-color: #141e33 !important;
  color: #38bdf8 !important;
}

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

html[data-theme="dark"] .tab-content h4,
html.dark .tab-content h4 {
  color: #38bdf8 !important;
}

html[data-theme="dark"] .formula-box,
html.dark .formula-box {
  background: #0b1324 !important;
  border-left-color: #38bdf8 !important;
  color: #7dd3fc !important;
}

/* Footer */
html[data-theme="dark"] .lab-footer,
html.dark .lab-footer {
  background: #0a0e1a !important;
  border-top-color: #1e293b !important;
  color: #64748b !important;
}
