/* Base and Typography Variables */
:root {
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-title: 'Outfit', var(--font-sans);
  
  /* Color Palette */
  --bg-primary: #090d16;
  --bg-secondary: #0f1626;
  --glass-bg: rgba(17, 25, 40, 0.65);
  --glass-border: rgba(255, 255, 255, 0.07);
  --glass-shadow: rgba(0, 0, 0, 0.3);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-cyan: #06b6d4;
  --accent-cyan-rgb: 6, 182, 212;
  --accent-purple: #8b5cf6;
  --accent-purple-rgb: 139, 92, 246;
  --accent-green: #10b981;
  --accent-green-rgb: 16, 185, 129;
  --accent-red: #ef4444;
  --accent-red-rgb: 239, 68, 68;
  --accent-amber: #f59e0b;
  
  --border-radius-lg: 16px;
  --border-radius-md: 12px;
  --border-radius-sm: 8px;
  
  --transition-normal: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset and Globals */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-title);
  color: var(--text-primary);
  font-weight: 600;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Layout */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100vw;
}

/* Sidebar Styling */
.sidebar {
  width: 260px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
  position: fixed;
  height: 100vh;
  z-index: 100;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
  padding: 0.5rem;
}

.logo-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--border-radius-md);
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
}

.logo-icon i {
  width: 22px;
  height: 22px;
}

.logo-text h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.logo-text span {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Navigation Menu */
.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-grow: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--border-radius-md);
  font-weight: 500;
  font-size: 0.95rem;
  transition: var(--transition-normal);
  border: 1px solid transparent;
}

.nav-item i {
  width: 20px;
  height: 20px;
}

.nav-item:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.03);
}

.nav-item.active {
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.15);
  box-shadow: inset 0 0 10px rgba(6, 182, 212, 0.05);
}

/* Sidebar Footer */
.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--glass-border);
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--border-radius-sm);
  background-color: rgba(255, 255, 255, 0.02);
  font-size: 0.85rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  position: relative;
}

.connection-status.disconnected .status-dot {
  background-color: var(--accent-red);
}

.connection-status.connecting .status-dot {
  background-color: var(--accent-amber);
  animation: pulse-amber 1.5s infinite;
}

.connection-status.connected .status-dot {
  background-color: var(--accent-green);
  animation: pulse-green 1.5s infinite;
}

@keyframes pulse-green {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes pulse-amber {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.status-text {
  font-weight: 500;
}

.connection-status.disconnected .status-text { color: var(--accent-red); }
.connection-status.connecting .status-text { color: var(--accent-amber); }
.connection-status.connected .status-text { color: var(--accent-green); }

/* Main Content Area */
.main-content {
  margin-left: 260px;
  flex-grow: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 2rem;
  overflow-y: auto;
}

/* Header Styling */
.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--glass-border);
}

.header-title h1 {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 0.25rem;
  background: linear-gradient(to right, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-title p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.system-stats {
  display: flex;
  gap: 1.5rem;
}

.stat-item {
  background-color: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  padding: 0.6rem 1rem;
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.stat-item i {
  color: var(--accent-cyan);
  width: 18px;
  height: 18px;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
}

.stat-value {
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Tabs Panel Content */
.content-body {
  flex-grow: 1;
  position: relative;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.4s ease;
}

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

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

/* Glass Panels & Cards */
.card, .glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  box-shadow: 0 8px 32px var(--glass-shadow);
  overflow: hidden;
  transition: var(--transition-normal);
}

.card:hover {
  border-color: rgba(6, 182, 212, 0.25);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.card-header, .panel-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h3, .panel-title {
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-primary);
}

.card-header h3 i, .panel-title i {
  color: var(--accent-cyan);
  width: 20px;
  height: 20px;
}

.card-body {
  padding: 1.5rem;
}

.panel-header .badge {
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 0.25rem 0.6rem;
  border-radius: 30px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Dynamic Devices Grid */
.devices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.5rem;
}

/* Device Card Styling */
.device-card {
  display: flex;
  flex-direction: column;
}

.device-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--glass-border);
  background-color: rgba(255, 255, 255, 0.01);
}

.device-card-title {
  display: flex;
  flex-direction: column;
}

.device-card-title h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.1rem;
}

.device-card-title span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.device-status-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.device-status-badge.online {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.15);
}

.device-status-badge.offline {
  background-color: rgba(148, 163, 184, 0.08);
  color: var(--text-secondary);
  border: 1px solid rgba(148, 163, 184, 0.15);
}

.device-card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Parameters Layout */
.param-row {
  display: grid;
  grid-template-columns: 2fr 1.5fr 1fr;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--border-radius-sm);
  background-color: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.02);
  transition: var(--transition-normal);
}

.param-row:hover {
  background-color: rgba(255, 255, 255, 0.03);
  border-color: rgba(6, 182, 212, 0.15);
}

.param-row.disabled {
  opacity: 0.35;
  background-color: transparent;
  border-color: transparent;
}

.param-name {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.param-value-container {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 0.2rem;
  text-align: right;
}

.param-value {
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.param-unit {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.param-status {
  font-size: 0.75rem;
  text-align: right;
  font-weight: 600;
}

.param-status.active {
  color: var(--accent-green);
}

.param-status.error {
  color: var(--accent-red);
}

/* Forms & Controls */
.form-group {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-control {
  background-color: rgba(15, 22, 38, 0.8);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 0.65rem 0.85rem;
  border-radius: var(--border-radius-md);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition: var(--transition-normal);
  width: 100%;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
}

.form-control:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.help-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--border-radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-normal);
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  color: var(--text-primary);
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.25);
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.95;
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.4);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-secondary {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
}

.btn-secondary:hover:not(:disabled) {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-outline-cyan {
  background-color: transparent;
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.btn-outline-cyan:hover:not(:disabled) {
  background-color: rgba(6, 182, 212, 0.08);
  border-color: var(--accent-cyan);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none !important;
  transform: none !important;
}

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

.btn-xs {
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  border-radius: var(--border-radius-sm);
}

.btn-xs.active {
  background-color: var(--accent-cyan);
  color: var(--bg-primary);
  border-color: var(--accent-cyan);
}

/* Charts Page Layout */
.charts-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  min-height: 500px;
}

.charts-sidebar {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.charts-sidebar h3 {
  font-size: 1.1rem;
}

.section-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.charts-device-selector {
  flex-grow: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 400px;
  padding-right: 0.25rem;
}

.charts-dev-group {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding-bottom: 0.75rem;
}

.charts-dev-group:last-child {
  border-bottom: none;
}

.charts-dev-header {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-cyan);
  margin-bottom: 0.5rem;
  display: block;
}

.charts-param-options {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-left: 0.5rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input {
  accent-color: var(--accent-cyan);
  width: 14px;
  height: 14px;
}

.chart-controls {
  padding-top: 1rem;
  border-top: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.form-group-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.form-control-sm {
  background-color: rgba(15, 22, 38, 0.8);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 0.25rem 0.5rem;
  border-radius: var(--border-radius-sm);
  outline: none;
}

.chart-canvas-container {
  display: flex;
  flex-direction: column;
}

.chart-panel {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.canvas-wrapper {
  flex-grow: 1;
  padding: 1.5rem;
  position: relative;
  min-height: 400px;
}

.canvas-wrapper-history {
  flex-grow: 1;
  padding: 1.5rem;
  position: relative;
  min-height: 350px;
}

/* History Layout */
.history-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 1.5rem;
}

.span-two-cols {
  grid-column: span 1;
}

@media (min-width: 1200px) {
  .history-grid {
    grid-template-columns: 350px 1fr;
  }
}

.date-picker-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.5rem;
}

.intro-text {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.history-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1.5rem 0;
}

.history-actions button {
  width: 100%;
}

.chart-panel-history {
  min-height: 400px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.chart-empty-state {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  color: var(--text-muted);
  pointer-events: none;
}

.chart-empty-state i {
  width: 48px;
  height: 48px;
}

.chart-empty-state p {
  font-size: 0.9rem;
}

/* Progress Bar */
.progress-container {
  padding: 1rem;
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-md);
  margin-top: 1rem;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.progress-bar-bg {
  height: 8px;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(to right, var(--accent-cyan), var(--accent-purple));
  border-radius: 4px;
  transition: width 0.1s ease;
}

.progress-details {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  text-align: right;
}

.hidden {
  display: none !important;
}

/* Settings Tabs */
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-grid-global {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.device-configs-card {
  display: flex;
  flex-direction: column;
}

.device-settings-tabs-container {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--glass-border);
  border-bottom: 1px solid var(--glass-border);
}

.device-tab-bar {
  display: flex;
  background-color: rgba(15, 22, 38, 0.4);
  overflow-x: auto;
  border-bottom: 1px solid var(--glass-border);
}

.device-tab-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 1rem 1.5rem;
  cursor: pointer;
  transition: var(--transition-normal);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}

.device-tab-btn:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.02);
}

.device-tab-btn.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
  background-color: rgba(6, 182, 212, 0.04);
}

.device-tab-content-container {
  padding: 1.5rem;
  background-color: rgba(255, 255, 255, 0.005);
}

.device-config-pane {
  display: none;
}

.device-config-pane.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

.device-meta-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1.5fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
}

.params-config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.param-config-card {
  background-color: rgba(15, 22, 38, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--border-radius-md);
  padding: 1.25rem;
  transition: var(--transition-normal);
}

.param-config-card:hover {
  border-color: rgba(255, 255, 255, 0.08);
  background-color: rgba(15, 22, 38, 0.6);
}

.param-config-card.disabled {
  opacity: 0.4;
}

.param-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.param-card-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.checkbox-switch {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
}

.checkbox-switch input {
  accent-color: var(--accent-cyan);
}

.settings-form-actions {
  padding: 1.5rem;
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

/* Switches */
.switch-small {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 18px;
}

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

.slider-small {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #334155;
  transition: .25s;
  border-radius: 18px;
}

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

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

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

input:disabled + .slider-small {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Console Log Helper */
.console-card {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 12rem);
  min-height: 450px;
}

.console-title {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.console-title h3 {
  margin: 0;
}

#lbl-rx-tx-counter {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.console-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.filter-buttons {
  display: flex;
  gap: 0.35rem;
}

.console-body {
  flex-grow: 1;
  background-color: #05080e;
  border-bottom: 1px solid var(--glass-border);
  font-family: 'Consolas', 'Courier New', Courier, monospace;
  font-size: 0.82rem;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.console-line {
  display: flex;
  gap: 0.5rem;
  line-height: 1.4;
  word-break: break-all;
}

.console-line .time {
  color: var(--text-muted);
  flex-shrink: 0;
}

.console-line .tag {
  font-weight: bold;
  flex-shrink: 0;
}

.console-line.tx {
  color: #38bdf8; /* light blue */
}
.console-line.rx {
  color: #34d399; /* emerald green */
}
.console-line.system-info {
  color: #e2e8f0; /* light gray */
}
.console-line.error {
  color: #f87171; /* light red */
}

.console-footer {
  padding: 1rem;
  background-color: rgba(15, 22, 38, 0.3);
  display: flex;
  gap: 0.75rem;
}

.console-footer .form-control {
  font-family: 'Consolas', 'Courier New', Courier, monospace;
  font-size: 0.85rem;
}

/* Skeleton Loading Placeholder */
.skeleton-loader-grid {
  display: contents;
}

.skeleton-card {
  height: 250px;
  background: linear-gradient(
    90deg,
    rgba(15, 22, 38, 0.4) 25%,
    rgba(30, 41, 59, 0.4) 37%,
    rgba(15, 22, 38, 0.4) 63%
  );
  background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite;
}

@keyframes skeleton-loading {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

.loading-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-style: italic;
}

/* ==========================================================================
   Mobile & Tablet Responsive Styling (Includes Landscape Mode Support)
   ========================================================================== */

@media (max-width: 991px) {
  /* 1. App Layout Stacking */
  .app-container {
    flex-direction: column;
  }

  /* 2. Transform Fixed Sidebar into Sticky Topbar */
  .sidebar {
    width: 100%;
    height: auto;
    position: sticky;
    top: 0;
    padding: 0.75rem 1.25rem;
    border-right: none;
    border-bottom: 1px solid var(--glass-border);
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(10, 15, 30, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1000;
  }

  .logo-area {
    margin-bottom: 0;
    padding: 0;
    gap: 0.5rem;
  }

  .logo-icon {
    width: 36px;
    height: 36px;
  }
  .logo-icon i {
    width: 18px;
    height: 18px;
  }
  
  .logo-text h2 {
    font-size: 1.1rem;
  }
  .logo-text span {
    display: none;
  }

  .sidebar-nav {
    margin-bottom: 0;
  }

  .nav-menu {
    flex-direction: row;
    gap: 0.35rem;
    flex-grow: 0;
    margin-bottom: 0;
  }

  .nav-item {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    gap: 0.4rem;
  }

  .nav-item span {
    display: none; /* Hide text label on mobile, show icon only to save space */
  }

  .sidebar-footer {
    display: none; /* Hide sidebar status footer on mobile topbar */
  }

  /* 3. Main Content adjusts to full-width */
  .main-content {
    margin-left: 0;
    padding: 1.25rem 1rem;
  }

  /* 4. Top Header responsive stacking */
  .top-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
  }

  .header-controls {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  /* 5. Sub-layouts stacking */
  .charts-layout {
    grid-template-columns: 1fr;
  }

  .history-grid {
    grid-template-columns: 1fr;
  }

  .devices-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

/* Specific adjustments for Mobile Landscape Mode (small height) */
@media (max-height: 550px) {
  .sidebar {
    padding: 0.5rem 1rem;
  }
  
  .logo-area {
    display: none; /* Hide logo to save horizontal space on landscape topbar */
  }

  .nav-menu {
    width: 100%;
    justify-content: space-around;
  }

  .top-header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
  }

  .header-title h1 {
    font-size: 1.4rem;
  }

  /* Scale down chart and panel heights to maximize landscape vertical viewport */
  .canvas-wrapper {
    min-height: 250px !important;
  }

  .canvas-wrapper-history {
    min-height: 200px !important;
  }

  .chart-panel-history {
    min-height: 260px !important;
  }
  
  .console-body {
    min-height: 180px !important;
  }
}

/* Tablet / Landscape width adjustments to restore navigation text labels */
@media (min-width: 576px) and (max-width: 991px) {
  .nav-item span {
    display: inline; /* Show text labels next to icons on tablets/wider screens */
  }
}

