/* ==========================================================================
   HomeSystem 2.0 - Design System & Modern Responsive Stylesheet
   ========================================================================== */

:root {
  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;

  /* Color Palette */
  --bg-dark: #0a0e17;
  --bg-gradient: radial-gradient(circle at 15% 15%, #171d2d 0%, #0a0e17 80%);
  --surface-1: rgba(18, 24, 38, 0.75);
  --surface-2: rgba(26, 34, 54, 0.85);
  --surface-hover: rgba(36, 48, 77, 0.95);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-cyan: #38bdf8;
  --accent-blue: #3b82f6;
  --accent-indigo: #6366f1;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-purple: #a855f7;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px rgba(56, 189, 248, 0.25);
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-main);
  background: var(--bg-dark);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 80px; /* Space for mobile nav */
}

a {
  color: var(--accent-cyan);
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* Container & Header */
.app-container {
  max-width: 1380px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem;
  width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

/* System Health Status */
.health-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0;
  border-radius: 0;
  font-size: 0.78rem;
  font-weight: 600;
  background: transparent;
  border: none;
  color: #34d399;
  white-space: nowrap;
  line-height: 1.2;
  flex-shrink: 0;
}

.health-pill.degraded {
  background: transparent;
  border: none;
  color: #fbbf24;
}

.health-pill.initializing {
  background: transparent;
  border: none;
  color: #60a5fa;
}

.health-pill.offline {
  background: transparent;
  border: none;
  color: #fb7185;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: pulse 2s infinite;
}

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

.btn-icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  cursor: pointer;
}

.btn-icon:hover {
  background: var(--surface-hover);
  color: var(--text-main);
  border-color: var(--border-strong);
}

.btn-icon svg {
  width: 20px;
  height: 20px;
}

/* Fault Resiliency Banner */
.status-alert-banner {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.15rem;
  margin-bottom: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fbbf24;
  font-size: 0.88rem;
}

.status-alert-banner:has(+ .kiln-status-banner:not(.hidden)) {
  margin-bottom: 0.6rem;
}

.status-alert-banner.hidden {
  display: none;
}

/* Generic visibility utilities */
.hidden {
  display: none !important;
}

.status-alert-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status-alert-content svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Desktop Navigation Tabs */
.nav-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.35rem;
  min-height: 44px;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 600;
  transition: var(--transition-fast);
  white-space: nowrap;
  cursor: pointer;
}

.tab-btn:hover {
  background: var(--surface-2);
  color: var(--text-main);
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.35);
}

.tab-btn svg {
  width: 16px;
  height: 16px;
}

/* Card Header Action Buttons */
.card-action-btn {
  padding: 0.35rem 0.85rem !important;
  font-size: 0.8rem !important;
  min-height: 32px !important;
  font-weight: 600 !important;
  border-radius: var(--radius-full) !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.4rem !important;
  white-space: nowrap !important;
}

/* Section visibility */
.dashboard-section {
  display: none;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

.dashboard-section.active {
  display: block;
}

/* Highlights Metric Grid */
.highlights-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
  .highlights-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.highlight-card {
  background: var(--surface-1);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.highlight-card[onclick],
.highlight-card.clickable {
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.highlight-card[onclick]:hover,
.highlight-card.clickable:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

.highlight-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.highlight-icon.power {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
}

.highlight-icon.temp {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
}

.highlight-icon.dusk {
  background: rgba(168, 85, 247, 0.15);
  color: var(--accent-purple);
}

.highlight-icon.planes {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
}

.highlight-icon svg {
  width: 19px;
  height: 19px;
}

.highlight-info {
  display: flex;
  flex-direction: column;
}

.highlight-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  font-weight: 600;
}

.highlight-value {
  font-size: 1.28rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

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

/* Card General Styling */
.card {
  background: var(--surface-1);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-card);
  max-width: 100%;
  box-sizing: border-box;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.card-title-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.card-title-group svg {
  width: 20px;
  height: 20px;
  color: var(--accent-cyan);
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}

.card-badge {
  font-size: 0.78rem;
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.2;
  flex-shrink: 0;
}

/* Energy Dashboard Layout */
.energy-overview-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 900px) {
  .energy-main-metric {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
  }
  .power-counter-col {
    max-width: 340px;
    flex: 1;
  }
  .energy-main-metric .metric-row {
    margin-top: 0;
    min-width: 480px;
  }
}

.energy-main-metric {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.power-counter-col {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.power-big-counter {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fff;
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  margin: 0.4rem 0;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.power-big-counter span.unit {
  font-size: 1.1rem;
  color: var(--accent-cyan);
  font-weight: 600;
}

/* Minimalistic Power Range Meter */
.power-range-meter {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.25rem;
  width: 100%;
}

.power-meter-track {
  position: relative;
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  margin: 0 4px;
}

.power-meter-fill {
  height: 100%;
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.45) 0%, #38bdf8 100%);
  border-radius: var(--radius-full);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 100%;
}

.power-meter-marker {
  position: absolute;
  top: 50%;
  width: 9px;
  height: 9px;
  background: #ffffff;
  border: 2px solid #38bdf8;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.65);
  transform: translate(-50%, -50%);
  transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.power-meter-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  padding: 0 1px;
}

.power-meter-bound {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
}

.power-meter-lbl {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  font-weight: 500;
}

.power-meter-val {
  color: #f1f5f9;
  font-weight: 600;
}

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

.sub-metric-box {
  background: rgba(0, 0, 0, 0.25);
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.sub-metric-label {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-bottom: 0.25rem;
}

.sub-metric-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: #f1f5f9;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* 3-Phase Monitor Box */
.phases-container {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}

.phase-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0.85rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.phase-tag {
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.phase-tag.l1 { background: rgba(56, 189, 248, 0.2); color: var(--accent-cyan); }
.phase-tag.l2 { background: rgba(168, 85, 247, 0.2); color: var(--accent-purple); }
.phase-tag.l3 { background: rgba(245, 158, 11, 0.2); color: var(--accent-amber); }

.phase-power {
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.phase-details {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* SVG Chart wrapper */
.chart-wrapper {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}

.chart-svg {
  width: 100%;
  height: auto;
  max-height: 320px;
  display: block;
}

.comparison-chart-wrapper .chart-svg {
  max-height: 340px;
}

.consumption-chart-wrapper .chart-svg {
  max-height: 410px;
}

.chart-empty-state {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* Power Profile Stats Bar */
.power-stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
}

.power-stat-chip {
  flex: 1 1 calc(25% - 0.75rem);
  min-width: 130px;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.power-stat-chip .label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.power-stat-chip .val {
  font-size: 1.05rem;
  font-weight: 700;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-main);
}

.power-stat-chip.peak .val {
  color: #f43f5e;
}

.power-stat-chip.median .val {
  color: #eab308;
}

.power-stat-chip.min .val {
  color: #10b981;
}

.power-stat-chip.total .val {
  color: #38bdf8;
}

/* Day Selector Ribbon */
.day-selector-ribbon {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding: 0.25rem 0 0.85rem 0;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 189, 248, 0.35) transparent;
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
}

.day-selector-ribbon::-webkit-scrollbar {
  height: 3px;
}

.day-selector-ribbon::-webkit-scrollbar-track {
  background: transparent;
}

.day-selector-ribbon::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.35);
  border-radius: 3px;
}

.day-tab-chip {
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  background: var(--surface-2);
  color: var(--text-muted);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--transition-fast);
  user-select: none;
  flex-shrink: 0;
  touch-action: pan-x;
}

.day-tab-chip:hover {
  border-color: var(--primary);
  color: #fff;
}

.day-tab-chip.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

.day-tab-chip .day-kwh {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  opacity: 0.85;
}

/* 7-Day Energy Consumption Analytics Ribbon */
.energy-7day-stats-ribbon {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.energy-stat-box {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.energy-stat-box.peak {
  border-color: rgba(244, 63, 94, 0.35);
  background: linear-gradient(180deg, rgba(244, 63, 94, 0.08) 0%, var(--surface-1) 100%);
}

.energy-stat-box.median {
  border-color: rgba(251, 191, 36, 0.35);
  background: linear-gradient(180deg, rgba(251, 191, 36, 0.08) 0%, var(--surface-1) 100%);
}

.energy-stat-box.min {
  border-color: rgba(16, 185, 129, 0.35);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.08) 0%, var(--surface-1) 100%);
}

.energy-stat-box.avg {
  border-color: rgba(99, 102, 241, 0.35);
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.08) 0%, var(--surface-1) 100%);
}

.energy-stat-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.energy-stat-icon {
  font-size: 0.75rem;
  line-height: 1;
}

.energy-stat-box.peak .energy-stat-icon { color: #f43f5e; }
.energy-stat-box.median .energy-stat-icon { color: #fbbf24; }
.energy-stat-box.min .energy-stat-icon { color: #10b981; }
.energy-stat-box.avg .energy-stat-icon { color: #818cf8; }

.energy-stat-label {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.energy-stat-val {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.energy-stat-val .unit {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}

.energy-stat-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 3-Phase Electrical Load Monitor */
.phase-balance-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 960px;
  margin: 0 auto;
}

.phase-balance-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.phase-balance-stat {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.phase-balance-stat .label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.phase-balance-stat .val {
  font-size: 1.25rem;
  font-weight: 800;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: #fff;
}

.phase-cols-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.phase-col {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

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

.phase-badge {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}

.phase-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: #f1f5f9;
}

.phase-volts {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
}

.phase-metrics-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.phase-metric {
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.phase-metric-val {
  font-size: 1.05rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #fff;
}

.phase-metric-lbl {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
}

.phase-fuse-bar {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.phase-fuse-track {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.phase-fuse-fill {
  height: 100%;
  border-radius: 4px;
  transition: width var(--transition-normal);
}

.phase-fuse-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* Climate / Floor Sections */
.floor-section {
  margin-bottom: 1.5rem;
}

.floor-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.floor-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}

.floor-subtitle {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
  background: transparent;
  border: none;
  padding: 0;
  white-space: nowrap;
}

.floor-heading .floor-subtitle,
.floor-heading .card-badge {
  background: transparent;
  border: none;
  padding: 0;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  font-family: inherit;
  box-shadow: none;
}

.rooms-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .rooms-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .rooms-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.room-card {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.7rem 0.9rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.room-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-cyan);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.room-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}

.room-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-time {
  font-size: 0.76rem;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--text-dim);
  background: transparent;
  border: none;
  padding: 0;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.room-header .room-time,
.room-header .card-badge {
  background: transparent;
  border: none;
  padding: 0;
  font-size: 0.76rem;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--text-dim);
  box-shadow: none;
}

.room-readings,
.room-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.room-meta-left {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.room-range {
  display: inline-flex;
  align-items: center;
  gap: 0.14rem;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  white-space: nowrap;
}

.room-range .min {
  color: var(--accent-cyan);
}

.room-range .max {
  color: var(--accent-rose);
}

.room-range .sep {
  opacity: 0.55;
}

.room-temp {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 1.48rem;
  font-weight: 800;
  line-height: 1.1;
  color: #fff;
  letter-spacing: -0.02em;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.room-humidity {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--accent-cyan);
  font-size: 0.86rem;
  font-weight: 600;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.room-humidity svg {
  width: 14px;
  height: 14px;
}

/* Temperature Trend Indicators (Warmer / Colder / Steady) */
.temp-trend-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
  cursor: default;
}

.temp-trend-icon svg {
  width: 13px;
  height: 13px;
}

.temp-trend-icon.warmer {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
  border: 1px solid rgba(244, 63, 94, 0.35);
  box-shadow: 0 0 10px rgba(244, 63, 94, 0.2);
}

.temp-trend-icon.colder {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.35);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

.temp-trend-icon.steady {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  border: 1px solid var(--border-subtle);
}

/* Alfred AI Section */
.alfred-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (max-width: 899px) {
  #section-alfred .chat-box {
    order: -1;
  }
}

@media (min-width: 900px) {
  .alfred-container {
    grid-template-columns: minmax(320px, 0.92fr) minmax(0, 1.58fr);
    align-items: center;
    gap: 2rem;
  }
  #section-alfred .chat-box {
    height: clamp(520px, calc(100dvh - 190px), 700px);
    max-height: clamp(520px, calc(100dvh - 190px), 700px);
  }
  #section-alfred .message-bubble {
    max-width: 78%;
  }
}

.news-report-box {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.95));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

.news-report-content {
  font-style: italic;
  font-size: 0.95rem;
  line-height: 1.6;
  color: #e2e8f0;
  margin: 1rem 0;
  flex-grow: 1;
  white-space: pre-line;
}

/* Centered Alfred Daily Dispatch on Overview Page */
#section-overview .news-report-box {
  max-width: 960px;
  margin: 0 auto;
  text-align: center;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 2rem 0 2.25rem;
}

#section-overview .news-report-box .card-header {
  justify-content: center;
  position: relative;
  margin-bottom: 0.5rem;
}

#section-overview .news-report-box .card-title-group {
  justify-content: center;
}

#section-overview .news-report-box .card-badge {
  position: static;
}

@media (min-width: 641px) {
  #section-overview .news-report-box .card-header {
    justify-content: center;
  }
  #section-overview .news-report-box .card-badge {
    position: absolute;
    right: 0;
  }
}

#section-overview .news-report-box .news-report-content {
  text-align: center;
  margin: 0.75rem auto 0;
  max-width: 680px;
}

/* Frameless Centered Hourly Limerick on Alfred Page (matches Overview Dispatch) */
#section-alfred .news-report-box {
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  text-align: center;
  align-items: center;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 1.5rem 0.75rem;
}

#section-alfred .news-report-box .card-header {
  justify-content: center;
  margin-bottom: 0.35rem;
  width: 100%;
}

#section-alfred .news-report-box .card-title-group {
  justify-content: center;
}

#section-alfred .news-report-box .news-report-content {
  text-align: center;
  margin: 0.75rem auto 0;
  max-width: 580px;
  flex-grow: 0;
}

.alfred-limerick-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  margin-top: 1.1rem;
}

#section-alfred #btn-compose-limerick {
  min-height: 36px;
  padding: 0.45rem 0.95rem;
  font-size: 0.8rem;
}

.alfred-limerick-sub {
  font-size: 0.74rem;
  color: var(--text-dim);
  text-align: center;
}

@media (max-width: 899px) {
  #section-alfred .news-report-box {
    padding: 2rem 0.5rem 1.75rem;
  }
}

.limerick-time-badge {
  display: inline-block;
  padding: 0;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
  background: transparent;
  border: none;
  margin-top: 0.25rem;
}

.btn-compose-spinning svg {
  animation: spin 1s linear infinite;
}

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

.chat-box {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  height: 520px;
  max-height: 520px;
  min-height: 0;
  overflow: hidden;
}

.chat-box .card-header {
  flex: 0 0 auto;
  min-height: 56px;
  box-sizing: border-box;
  padding: 1rem 1.25rem;
}

.chat-messages {
  flex: 1 1 0%;
  height: 0;
  min-height: 0;
  max-height: 100%;
  padding: 1.25rem;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.message-bubble {
  max-width: 85%;
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  line-height: 1.5;
  word-break: break-word;
}

.message-bubble.assistant {
  align-self: flex-start;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  color: #f1f5f9;
}

.message-bubble.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
  color: #fff;
}

.preset-queries {
  flex: 0 0 auto;
  height: 52px;
  min-height: 52px;
  max-height: 52px;
  padding: 0.35rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.15);
  position: relative;
  z-index: 2;
  box-sizing: border-box;
}

.preset-queries::-webkit-scrollbar {
  display: none;
}

.preset-chip {
  flex: 0 0 auto;
  padding: 0 1rem;
  height: 36px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  transition: var(--transition-fast);
  cursor: pointer;
}

.preset-chip:hover {
  background: var(--surface-hover);
  color: #fff;
  border-color: var(--accent-cyan);
}

.chat-input-row {
  flex: 0 0 auto;
  height: 68px;
  min-height: 68px;
  max-height: 68px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-1);
  position: relative;
  z-index: 2;
  box-sizing: border-box;
}

.chat-input {
  flex-grow: 1;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 0.65rem 1.25rem;
  color: #fff;
  font-size: 0.9rem;
  outline: none;
  font-family: inherit;
}

.chat-input:focus {
  border-color: var(--accent-cyan);
}

.chat-send-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
  cursor: pointer;
}

.chat-send-btn:hover {
  transform: scale(1.05);
}

.chat-send-btn svg {
  width: 20px;
  height: 20px;
}

/* Lights Control */
.lights-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.color-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.35rem;
  min-height: 44px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--surface-2);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  transition: transform var(--transition-fast), background var(--transition-fast);
  cursor: pointer;
}

.color-btn:hover {
  transform: translateY(-2px);
  background: var(--surface-hover);
}

.color-btn.active {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.22);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.35);
}

.color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

/* Color Mixer Toggle */
.color-mixer-toggle-row {
  margin-top: 1rem;
  display: flex;
  align-items: center;
}

.btn-toggle-color-mixer {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.6rem 1.15rem;
  min-height: 42px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-toggle-color-mixer:hover {
  background: var(--surface-hover);
  color: #fff;
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.btn-toggle-color-mixer.active {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.4);
}

.mixer-toggle-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  flex-shrink: 0;
}

.mixer-toggle-chevron {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.picker-close-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-dim);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.picker-close-btn:hover {
  background: rgba(244, 63, 94, 0.15);
  color: #f43f5e;
  border-color: rgba(244, 63, 94, 0.35);
}

/* RGB+W Custom Color Studio */
.light-picker-studio {
  margin-top: 1.25rem;
  padding: 1.25rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.picker-title {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.picker-code-pill {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0;
  background: transparent;
  color: #38bdf8;
  border: none;
}

.picker-layout {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 1.25rem;
  align-items: center;
}

.picker-preview-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.picker-swatch {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: var(--radius-lg);
  border: 2px solid rgba(255, 255, 255, 0.2);
  overflow: hidden;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
  background: #000;
}

.swatch-w-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0.45) 55%, rgba(255, 255, 255, 0) 100%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.picker-wheel-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.native-color-input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  inset: 0;
  z-index: 2;
}

.picker-wheel-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--surface-2);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-normal);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.picker-wheel-row:hover .picker-wheel-btn {
  background: var(--surface-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

.picker-sliders-col {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

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

.slider-label {
  width: 20px;
  font-weight: 700;
  font-size: 0.85rem;
  text-align: center;
}

.slider-row.red .slider-label { color: #f43f5e; }
.slider-row.green .slider-label { color: #10b981; }
.slider-row.blue .slider-label { color: #38bdf8; }
.slider-row.white-chan .slider-label { color: #f8fafc; }

.rgb-slider {
  flex: 1;
  height: 10px;
  border-radius: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(15, 23, 42, 0.85);
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6), 0 1px 2px rgba(255, 255, 255, 0.05);
  outline: none;
  cursor: pointer;
  margin: 8px 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.rgb-slider::-webkit-slider-runnable-track {
  height: 10px;
  border-radius: 6px;
}

.rgb-slider::-moz-range-track {
  height: 10px;
  border-radius: 6px;
  background: transparent;
  border: none;
}

.rgb-slider:focus {
  outline: none;
}

.slider-row.red .rgb-slider { border-color: rgba(244, 63, 94, 0.45); }
.slider-row.red .rgb-slider:hover,
.slider-row.red .rgb-slider:focus {
  border-color: rgba(244, 63, 94, 0.85);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6), 0 0 8px rgba(244, 63, 94, 0.35);
}

.slider-row.green .rgb-slider { border-color: rgba(16, 185, 129, 0.45); }
.slider-row.green .rgb-slider:hover,
.slider-row.green .rgb-slider:focus {
  border-color: rgba(16, 185, 129, 0.85);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6), 0 0 8px rgba(16, 185, 129, 0.35);
}

.slider-row.blue .rgb-slider { border-color: rgba(56, 189, 248, 0.45); }
.slider-row.blue .rgb-slider:hover,
.slider-row.blue .rgb-slider:focus {
  border-color: rgba(56, 189, 248, 0.85);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6), 0 0 8px rgba(56, 189, 248, 0.35);
}

.slider-row.white-chan .rgb-slider { border-color: rgba(255, 255, 255, 0.45); }
.slider-row.white-chan .rgb-slider:hover,
.slider-row.white-chan .rgb-slider:focus {
  border-color: rgba(255, 255, 255, 0.9);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6), 0 0 8px rgba(255, 255, 255, 0.35);
}

.rgb-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  background: #ffffff;
  border: 2.5px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  margin-top: -6px;
}

.rgb-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  background: #ffffff;
  border: 2.5px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.rgb-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.rgb-slider::-moz-range-thumb:hover {
  transform: scale(1.15);
}

.rgb-slider::-webkit-slider-thumb:active {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
}

.rgb-slider::-moz-range-thumb:active {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
}

/* WebKit Channel Colors */
.slider-row.red .rgb-slider::-webkit-slider-thumb { background: #f43f5e; }
.slider-row.green .rgb-slider::-webkit-slider-thumb { background: #10b981; }
.slider-row.blue .rgb-slider::-webkit-slider-thumb { background: #38bdf8; }
.slider-row.white-chan .rgb-slider::-webkit-slider-thumb {
  background: #ffffff;
  border-color: #cbd5e1;
}

/* Firefox Channel Colors */
.slider-row.red .rgb-slider::-moz-range-thumb { background: #f43f5e; }
.slider-row.green .rgb-slider::-moz-range-thumb { background: #10b981; }
.slider-row.blue .rgb-slider::-moz-range-thumb { background: #38bdf8; }
.slider-row.white-chan .rgb-slider::-moz-range-thumb {
  background: #ffffff;
  border-color: #cbd5e1;
}

.slider-val {
  width: 36px;
  text-align: right;
  font-family: monospace;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-normal);
}

.picker-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.15rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

.btn-apply-light {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  min-height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid #38bdf8;
  background: rgba(56, 189, 248, 0.18);
  color: #38bdf8;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.btn-apply-light:hover {
  background: rgba(56, 189, 248, 0.3);
  transform: translateY(-1px);
}

.picker-quick-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.picker-mini-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.picker-mini-btn:hover {
  background: var(--surface-hover);
  color: #fff;
}

/* Flight Radar */
/* Flight Radar */
.planes-table-container {
  max-height: 540px;
  overflow-y: auto;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.planes-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  text-align: left;
}

.planes-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(13, 20, 36, 0.96);
  backdrop-filter: blur(8px);
  padding: 0.75rem 0.85rem;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.planes-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
  white-space: nowrap;
}

.planes-table tbody tr[onclick],
#planes-table-body tr {
  cursor: pointer;
  transition: background var(--transition-fast);
}

.planes-table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.015);
}

.planes-table tbody tr[onclick]:hover td,
#planes-table-body tr:hover td {
  background: rgba(56, 189, 248, 0.05);
}

#flight-log-table-body tr {
  cursor: default;
}

.flight-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.flight-cell-info {
  display: flex;
  flex-direction: column;
}

.plane-heading-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: #38bdf8;
  transition: transform 0.3s ease;
}

.plane-static-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: #64748b;
}

.flight-link {
  color: #38bdf8;
  text-decoration: none;
  font-weight: 700;
  transition: color 0.15s ease;
}

.flight-link:hover {
  color: #7dd3fc;
  text-decoration: underline;
}

.alt-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.76rem;
  font-weight: 700;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  border: 1px solid transparent;
  white-space: nowrap;
}

.dist-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  font-weight: 600;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  border: 1px solid transparent;
  white-space: nowrap;
}

.dist-chip.close {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.35);
}

.dist-chip.medium {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.3);
}

.dist-chip .plane-bearing,
.dist-badge .plane-bearing {
  font-size: 0.72rem;
  opacity: 0.8;
  margin-left: 0.2rem;
}

.dist-badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: 600;
}

.plane-bearing {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-left: 0.2rem;
}

.vert-rate.climb {
  color: #10b981;
  font-weight: bold;
}

.vert-rate.descend {
  color: #f59e0b;
  font-weight: bold;
}

/* Table Empty State */
.table-empty-cell {
  text-align: center;
  padding: 2.5rem 1rem !important;
}

.table-empty-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.radar-scan-icon {
  width: 38px;
  height: 38px;
  color: #38bdf8;
  opacity: 0.6;
  margin-bottom: 0.35rem;
  animation: radar-icon-pulse 3s infinite ease-in-out;
  filter: drop-shadow(0 0 2px rgba(56, 189, 248, 0.4));
}

@keyframes radar-icon-pulse {
  0% {
    transform: scale(0.96);
    opacity: 0.5;
    filter: drop-shadow(0 0 2px rgba(56, 189, 248, 0.3));
  }
  50% {
    transform: scale(1.12);
    opacity: 0.95;
    filter: drop-shadow(0 0 10px rgba(56, 189, 248, 0.85));
  }
  100% {
    transform: scale(0.96);
    opacity: 0.5;
    filter: drop-shadow(0 0 2px rgba(56, 189, 248, 0.3));
  }
}

.empty-title {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.empty-sub {
  color: var(--text-dim);
  font-size: 0.74rem;
}

/* Live Count Indicator & Pulse Dot */
.live-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #34d399;
  background: transparent;
  border: none;
  padding: 0;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: radar-pulse 2s infinite ease-in-out;
}

@keyframes radar-pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.25); opacity: 1; box-shadow: 0 0 12px #10b981; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* Quick Filter Chips */
.planes-quick-filters {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.quick-filter-chip {
  padding: 0.22rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  color: var(--text-dim);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.quick-filter-chip:hover {
  background: var(--surface-hover);
  color: #fff;
}

.quick-filter-chip.active {
  background: rgba(56, 189, 248, 0.18);
  border-color: #38bdf8;
  color: #38bdf8;
  font-weight: 700;
}

/* Refresh Button Spin */
.is-refreshing svg {
  animation: spin 0.8s linear infinite;
}

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

/* Radar Section: Quick Stats Ribbon */
.radar-stats-ribbon {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.radar-stat-box {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.radar-stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.radar-stat-icon {
  width: 15px;
  height: 15px;
  color: var(--text-dim);
  opacity: 0.7;
  flex-shrink: 0;
}

.radar-stat-label {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.radar-stat-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.radar-stat-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.2;
}

.radar-stat-sub:empty {
  display: none;
}

/* Radar Controls Toolbar */
.radar-controls {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.radar-filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.radar-filter-toggle input[type="checkbox"] {
  accent-color: var(--accent-cyan);
  cursor: pointer;
}

.radar-search {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  outline: none;
  width: 160px;
  transition: var(--transition-fast);
}

.radar-search:focus {
  border-color: var(--accent-cyan);
}

/* Radar Mode Subnav */
.radar-subnav {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.radar-subnav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.radar-subnav-btn:hover {
  background: var(--surface-hover);
  color: #fff;
}

.radar-subnav-btn.active {
  background: rgba(16, 185, 129, 0.15);
  border-color: #10b981;
  color: #10b981;
}

.radar-subnav-btn svg {
  width: 15px;
  height: 15px;
}

/* PPI Radar Scope Toolbar & Controls */
.radar-scope-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.range-selector-ribbon {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  height: 36px;
  box-sizing: border-box;
}

.range-btn {
  background: transparent;
  border: none;
  border-right: 1px solid var(--border-subtle);
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0 0.75rem;
  height: 100%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  box-sizing: border-box;
}

.range-btn:last-child {
  border-right: none;
}

.range-btn:hover {
  background: var(--surface-hover);
  color: #fff;
}

.range-btn.active {
  background: #10b981;
  color: #050b14;
  font-weight: 700;
}

/* Radar Control Buttons (Tags, Home) */
.radar-control-btn,
.map-control-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  height: 36px;
  padding: 0 0.85rem;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-sizing: border-box;
  white-space: nowrap;
}

.radar-control-btn svg,
.map-control-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.radar-control-btn:hover,
.map-control-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  color: #fff;
}

.radar-control-btn.active,
.map-control-btn.active {
  background: rgba(16, 185, 129, 0.18);
  border-color: #10b981;
  color: #10b981;
  font-weight: 700;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

/* PPI Radar Scope Wrapper & Canvas */
.radar-scope-wrapper {
  position: relative;
  width: 100%;
  max-width: 440px;
  margin: 0.5rem auto;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

#flight-radar-canvas {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at center, #091424 0%, #050b14 70%, #02060d 100%);
  box-shadow: 0 0 35px rgba(16, 185, 129, 0.2), inset 0 0 25px rgba(0, 0, 0, 0.9), 0 0 0 2px rgba(16, 185, 129, 0.3);
  cursor: crosshair;
  display: block;
}

/* Target HUD Card Overlay */
.radar-target-hud {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid #10b981;
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  min-width: 200px;
  max-width: 260px;
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  z-index: 10;
  pointer-events: auto;
  transition: opacity 0.2s ease;
}

.radar-target-hud.hidden {
  display: none;
}

.hud-close-btn {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
}

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

.hud-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  padding-right: 14px;
}

.hud-callsign {
  font-weight: 800;
  font-size: 1.05rem;
  color: #fff;
  font-family: var(--font-mono);
}

.hud-hex {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.hud-alt-badge {
  font-size: 0.82rem;
  font-weight: 700;
  color: #10b981;
  margin-bottom: 4px;
}

.hud-history-box {
  font-size: 0.72rem;
  padding: 0.25rem 0.45rem;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-sm);
  color: #a7f3d0;
  margin-bottom: 8px;
  line-height: 1.25;
}

/* Sighting History Chips */
.seen-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.seen-chip.repeat {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.seen-chip.first-time {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.hex-sub {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  margin-top: 2px;
}

.time-dur-sub {
  font-size: 0.68rem;
  color: #94a3b8;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.mobile-only {
  display: none;
}

.seen-chip-mini {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
  margin-left: 0.35rem;
  vertical-align: middle;
}

.seen-chip-mini.new {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.25);
}

.hud-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 8px;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.hud-grid b {
  color: #cbd5e1;
  font-family: var(--font-mono);
}

.hud-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 6px;
  text-align: right;
}

.hud-fr24-btn {
  color: #38bdf8;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
}

.hud-fr24-btn:hover {
  text-decoration: underline;
}

/* Legend Ribbon */
.map-legend-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.85rem;
  padding: 0.6rem 0.85rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text-dim);
}

.map-legend-bar .legend-title {
  font-weight: 600;
  color: var(--text-muted);
}

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

.chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* Selected row in planes table */
.planes-table tr.selected td {
  background: rgba(16, 185, 129, 0.12) !important;
  border-bottom-color: rgba(16, 185, 129, 0.35) !important;
}

.planes-table tr.selected td:first-child {
  box-shadow: inset 4px 0 0 #10b981;
}

.planes-table tr.selected .plane-heading-icon {
  color: #10b981;
  filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.8));
}

/* Hardware & API Diagnostics Hub */
.diagnostic-card {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.diagnostic-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.45rem;
  gap: 0.5rem;
}

.diagnostic-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
}

.diagnostic-hw {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  margin-top: 0.15rem;
}

.diagnostic-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 0.5rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.diagnostic-detail {
  color: #e2e8f0;
}

.diagnostic-time {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.system-runtime-banner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  margin-top: 1rem;
  border: 1px solid var(--border-subtle);
}

.runtime-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.runtime-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
}

.runtime-val {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

/* Mobile Bottom Navigation Bar (6 Tabs) */
.mobile-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(62px + env(safe-area-inset-bottom, 0px));
  padding: 0 max(6px, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(6px, env(safe-area-inset-left, 0px));
  background: rgba(10, 14, 23, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
}

@media (min-width: 768px) {
  .mobile-nav {
    display: none;
  }
  body {
    padding-bottom: 2rem;
  }
}

.mobile-nav-btn {
  flex: 1 1 0;
  min-width: 0;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  color: var(--text-dim);
  font-size: clamp(0.62rem, 2.5vw, 0.70rem);
  font-weight: 600;
  padding: 0.35rem 0.1rem;
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
  white-space: nowrap;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-nav-btn:active {
  transform: scale(0.96);
}

.mobile-nav-btn.active {
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.12);
}

.mobile-nav-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Room 24-Hour Sparklines in Room Cards */
.room-sparkline-container {
  margin: 0.4rem 0 0 0;
  width: 100%;
}

.room-sparkline-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
}

.sparkline-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.66rem;
  line-height: 1.1;
  font-family: var(--font-mono);
  color: var(--text-dim);
}

.sparkline-meta .min {
  color: var(--accent-cyan);
}

.sparkline-meta .max {
  color: var(--accent-rose);
}

.sparkline-meta .sparkline-trend {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.35);
}

.room-sparkline-svg {
  width: 100%;
  height: 58px;
  display: block;
  overflow: visible;
}

.room-sparkline-empty {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-align: center;
  padding: 0.35rem 0;
  font-style: italic;
}

/* Multi-Room Climate & Chart Legend Ribbons */
.chart-legend-ribbon {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.65rem 1.15rem;
  margin-bottom: 0.45rem;
  padding: 0.25rem 0 0.15rem 0;
  border-bottom: none;
}

.chart-legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.45rem;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.chart-legend-chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.chart-legend-chip .dash {
  width: 14px;
  height: 3px;
  border-radius: 1.5px;
  flex-shrink: 0;
}

.chart-legend-chip .dash-box {
  width: 12px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.chart-legend-chip .bar-swatch {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex-shrink: 0;
}

.chart-legend-chip .name {
  font-weight: 500;
  color: var(--text-muted);
}

.chart-legend-chip .val {
  font-family: var(--font-mono);
  font-weight: 600;
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-variant-numeric: tabular-nums;
}

.chart-legend-chip .trend-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: var(--radius-full);
}

.chart-legend-chip .trend-mini svg {
  width: 10px;
  height: 10px;
}

.chart-legend-chip .trend-mini.warmer {
  color: var(--accent-rose);
}

.chart-legend-chip .trend-mini.colder {
  color: var(--accent-cyan);
}

.chart-legend-chip .trend-mini.steady {
  color: var(--text-dim);
}

/* Mobile Layout Polishing (Phone Screen Sizes) */
@media (max-width: 767px) {
  /* Hide top navigation menu on mobile - bottom navigation is used instead */
  .nav-tabs {
    display: none !important;
  }

  body {
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }

  /* Container */
  .app-container {
    padding-top: max(0.75rem, env(safe-area-inset-top, 0px));
    padding-bottom: 0.5rem;
    padding-left: max(0.65rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.65rem, env(safe-area-inset-right, 0px));
  }

  .health-pill {
    padding: 0;
    font-size: 0.72rem;
    gap: 0.35rem;
    white-space: nowrap;
    line-height: 1.1;
  }

  /* Cards General */
  .card {
    padding: 0.85rem 0.75rem;
    margin-bottom: 0.85rem;
    border-radius: var(--radius-md);
    max-width: 100%;
    box-sizing: border-box;
  }
  .chart-wrapper {
    max-width: 100%;
    margin: 0;
  }
  .chart-svg {
    max-height: none;
  }
  .comparison-chart-wrapper .chart-svg {
    max-height: none;
  }
  .consumption-chart-wrapper .chart-svg {
    max-height: none;
  }
  .phase-balance-container {
    max-width: 100%;
    margin: 0;
  }
  .dusk-timeline-wrapper {
    max-width: 100%;
    margin: 0;
  }
  .card-header {
    gap: 0.5rem;
    margin-bottom: 0.85rem;
    align-items: flex-start;
  }
  .card-title-group {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
  }
  .card-title-group svg {
    margin-top: 0.15rem;
    flex-shrink: 0;
  }
  .card-title {
    font-size: 0.96rem;
    line-height: 1.35;
    word-break: break-word;
  }
  .card-header > .tab-btn,
  .card-action-btn {
    white-space: nowrap;
    font-size: 0.74rem !important;
    padding: 0.3rem 0.65rem !important;
    min-height: 30px !important;
  }
  .dusk-view-tabs {
    width: 100%;
    display: flex;
    gap: 0.35rem;
    margin-top: 0.35rem;
  }
  .dusk-view-tabs .tab-btn {
    flex: 1;
    justify-content: center;
    padding: 0.35rem 0.4rem !important;
    font-size: 0.74rem !important;
    text-align: center;
  }
  .news-report-box {
    padding: 0.85rem 0.75rem;
    border-radius: var(--radius-md);
  }
  #section-overview .news-report-box {
    padding: 2.15rem 0.5rem 1.625rem;
  }
  .news-report-content {
    font-size: 0.88rem;
    line-height: 1.5;
    margin: 0.65rem 0;
  }

  /* Section 1: Overview - Highlights Grid */
  .highlights-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.85rem;
  }
  .highlight-card {
    padding: 0.65rem 0.55rem;
    gap: 0.45rem;
    min-width: 0;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
  }
  .highlight-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    flex-shrink: 0;
  }
  .highlight-icon svg {
    width: 16px;
    height: 16px;
  }
  .highlight-info {
    min-width: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .highlight-label, .highlight-sub {
    font-size: 0.65rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .highlight-value {
    font-size: clamp(0.92rem, 3.6vw, 1.05rem);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Section 2: Energy */
  .power-big-counter {
    font-size: 2rem;
  }
  .metric-row {
    margin-top: 0.75rem;
    gap: 0.35rem;
  }
  .sub-metric-box {
    padding: 0.45rem 0.3rem;
    text-align: center;
    min-width: 0;
  }
  .sub-metric-label {
    font-size: 0.65rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .sub-metric-value {
    font-size: clamp(0.78rem, 3vw, 0.85rem);
    white-space: nowrap;
  }
  .power-range-meter {
    margin-top: 0.35rem;
    margin-bottom: 0.35rem;
  }
  .power-meter-meta {
    font-size: 0.70rem;
  }
  .energy-main-metric,
  .phases-container {
    padding: 0.85rem 0.75rem;
  }
  .phase-balance-top {
    gap: 0.5rem;
  }
  .phase-name {
    flex: 1;
    margin: 0 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
  }
  .phase-fuse-meta {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
  }
  .phase-row {
    padding: 0.5rem 0.65rem;
    font-size: 0.82rem;
    gap: 0.35rem;
  }
  .phase-details {
    font-size: 0.72rem;
    white-space: nowrap;
  }
  .power-stats-bar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.45rem;
    padding-bottom: 0.5rem;
    margin-bottom: 0.85rem;
  }
  .power-stat-chip {
    min-width: 0;
    padding: 0.4rem 0.55rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
  .power-stat-chip .label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .phase-cols-grid {
    grid-template-columns: 1fr;
  }
  .energy-7day-stats-ribbon {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.45rem;
    margin-bottom: 0.85rem;
  }
  .energy-stat-box {
    padding: 0.55rem 0.65rem;
  }
  .energy-stat-val {
    font-size: 1rem;
  }
  .energy-stat-sub {
    font-size: 0.66rem;
  }

  /* Section 3: Climate */
  .chart-legend-chip {
    padding: 0.15rem 0.35rem;
    font-size: 0.72rem;
  }
  .rooms-grid {
    gap: 0.5rem;
  }
  .floor-section {
    margin-bottom: 0.85rem;
  }
  .floor-heading {
    margin-bottom: 0.55rem;
  }
  .floor-title {
    font-size: 0.96rem;
    color: #fff;
  }
  .floor-subtitle {
    font-size: 0.74rem;
  }
  .room-card {
    padding: 0.6rem 0.78rem;
    border-radius: var(--radius-md);
  }
  .room-header {
    margin-bottom: 0.18rem;
  }
  .room-name,
  .room-header .room-name {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .room-time {
    font-size: 0.70rem;
  }
  .room-temp {
    font-size: 1.28rem;
    font-weight: 700;
  }
  .room-range {
    font-size: 0.68rem;
  }
  .temp-trend-icon {
    width: 18px;
    height: 18px;
  }
  .temp-trend-icon svg {
    width: 11px;
    height: 11px;
  }
  .room-humidity {
    font-size: 0.78rem;
  }
  .room-humidity svg {
    width: 13px;
    height: 13px;
  }
  .room-sparkline-container {
    margin: 0.35rem 0 0 0;
  }
  .room-sparkline-svg {
    height: 50px;
  }

  /* Section 4: Aircraft & Radar */
  .radar-stats-ribbon {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.45rem;
    margin-bottom: 0.85rem;
  }
  .radar-stats-ribbon .radar-stat-box:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
  .radar-stat-box {
    padding: 0.55rem 0.45rem;
    min-width: 0;
    text-align: center;
  }
  .radar-stat-label {
    font-size: 0.66rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .radar-stat-value {
    font-size: clamp(0.82rem, 3.2vw, 1.05rem);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .radar-subnav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem;
    width: 100%;
  }
  .radar-subnav-btn {
    width: 100%;
    justify-content: center;
    padding: 0.5rem 0.25rem;
    font-size: 0.75rem;
    text-align: center;
    white-space: nowrap;
  }
  .radar-scope-wrapper {
    max-width: min(100%, 460px);
    margin: 0.5rem auto;
  }
  .radar-scope-toolbar {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    justify-content: stretch;
  }
  .range-selector-ribbon {
    display: flex;
    flex: 1 1 100%;
    width: 100%;
    height: 38px;
  }
  .range-btn {
    flex: 1;
    text-align: center;
    padding: 0 0.2rem;
    font-size: 0.72rem;
    height: 100%;
  }
  .radar-control-btn,
  .map-control-btn {
    flex: 1;
    height: 38px;
    font-size: 0.78rem;
    justify-content: center;
  }
  /* Target HUD Overlay pinned to bottom of scope circle on mobile without lateral overflow */
  .radar-target-hud {
    position: absolute;
    top: auto;
    bottom: 8px;
    left: 8px;
    right: 8px;
    width: auto;
    max-width: none;
    min-width: 0;
    margin: 0;
    z-index: 20;
    padding: 0.75rem 0.85rem;
    background: rgba(10, 16, 28, 0.96);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.8);
  }
  .hud-grid {
    grid-template-columns: repeat(2, 1fr);
    font-size: 0.75rem;
    gap: 0.35rem 0.5rem;
  }
  .map-legend-bar {
    padding: 0.45rem 0.55rem;
    gap: 0.4rem;
    font-size: 0.7rem;
    justify-content: center;
  }

  /* Table container & Toolbar */
  .radar-controls {
    width: 100%;
    margin-top: 0.35rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    justify-content: stretch;
  }
  .radar-filter-toggle {
    font-size: 0.75rem;
  }
  .radar-search {
    flex: 1 1 100%;
    width: 100%;
    min-height: 38px;
    font-size: 0.78rem;
  }
  #flight-log-sort {
    flex: 1 1 auto;
    width: auto;
    min-height: 38px;
  }

  /* Section 5: Alfred AI */
  .chat-box {
    height: min(520px, 68vh);
    height: min(520px, 68dvh);
    max-height: min(520px, 68vh);
    max-height: min(520px, 68dvh);
    min-height: 0;
    min-width: 0;
    width: 100%;
    overflow: hidden;
  }
  .chat-box .card-header {
    padding: 0.65rem 0.85rem !important;
    margin-bottom: 0 !important;
  }
  .chat-messages {
    flex: 1 1 0%;
    height: 0;
    min-height: 0;
    max-height: 100%;
    padding: 0.85rem;
    gap: 0.75rem;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
  }
  .message-bubble {
    max-width: 90%;
    font-size: 0.85rem;
    padding: 0.75rem 0.85rem;
    word-break: break-word;
  }
  .preset-queries {
    flex: 0 0 auto;
    height: 46px;
    min-height: 46px;
    max-height: 46px;
    padding: 0.3rem 0.65rem;
    gap: 0.4rem;
    align-items: center;
    box-sizing: border-box;
  }
  .preset-chip {
    flex: 0 0 auto;
    height: 32px;
    min-height: 32px;
    padding: 0 0.75rem;
    font-size: 0.75rem;
  }
  .chat-input-row {
    flex: 0 0 auto;
    height: 56px;
    min-height: 56px;
    max-height: 56px;
    padding: 0.5rem 0.65rem;
    gap: 0.4rem;
    align-items: center;
    box-sizing: border-box;
  }
  .chat-input {
    font-size: 16px;
    padding: 0.45rem 0.95rem;
    min-width: 0;
  }
  .chat-send-btn {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
  }
  .chat-send-btn svg {
    width: 17px;
    height: 17px;
  }
  .alfred-limerick-actions {
    margin-top: 0.9rem;
    gap: 0.45rem;
  }

  /* Section 6: Diagnostics & Tools */
  .lights-palette {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
  .color-btn {
    width: 100%;
    justify-content: center;
    padding: 0.55rem 0.75rem;
    font-size: 0.8rem;
    min-height: 40px;
  }
  .color-mixer-toggle-row {
    margin-top: 0.75rem;
  }
  .btn-toggle-color-mixer {
    width: 100%;
    justify-content: center;
    padding: 0.65rem 1rem;
    font-size: 0.82rem;
    min-height: 44px;
  }
  .light-picker-studio {
    padding: 1rem 0.85rem;
  }
  .picker-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .picker-preview-col {
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
  }
  .picker-swatch {
    width: 72px;
    height: 72px;
    flex-shrink: 0;
  }
  .picker-wheel-row {
    flex: 1;
    max-width: 180px;
  }
  .picker-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }
  .btn-apply-light {
    width: 100%;
    justify-content: center;
  }
  .picker-quick-actions {
    display: flex;
    justify-content: space-between;
    width: 100%;
    gap: 0.4rem;
  }
  .picker-mini-btn {
    flex: 1;
    justify-content: center;
    padding: 0.45rem 0.35rem;
    font-size: 0.74rem;
  }
  .rgb-slider {
    margin: 12px 0;
  }
  .diagnostic-header {
    flex-wrap: wrap;
    gap: 0.35rem;
  }
  .diagnostic-name {
    font-size: 0.88rem;
  }
  .diagnostic-hw {
    font-size: 0.72rem;
    word-break: break-all;
  }
  .diagnostic-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    font-size: 0.75rem;
  }
  .system-runtime-banner {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    padding: 0.65rem;
  }
  #price-form input {
    flex: 1 1 100%;
    max-width: 100% !important;
  }
  #price-form button {
    width: 100%;
  }
}

/* Specific Phone Table Column Hiding (<= 640px) */
@media (max-width: 640px) {
  .col-hide-mobile {
    display: none !important;
  }
  .mobile-only {
    display: block !important;
  }
  .planes-table-container {
    max-height: 440px;
    -webkit-overflow-scrolling: touch;
  }
  .planes-table {
    min-width: 540px;
  }
  .planes-table th, .planes-table td {
    padding: 0.45rem 0.35rem;
    font-size: 0.74rem;
    white-space: nowrap;
  }
  .plane-heading-icon {
    width: 13px;
    height: 13px;
  }
  .alt-chip {
    font-size: 0.68rem;
    padding: 0.1rem 0.35rem;
  }
  .dist-chip {
    font-size: 0.7rem;
    padding: 0.1rem 0.35rem;
  }
  .seen-chip {
    font-size: 0.68rem;
    padding: 0.15rem 0.4rem;
  }
  .seen-chip-mini {
    font-size: 0.62rem;
    padding: 0.1rem 0.3rem;
  }
  .planes-quick-filters {
    width: 100%;
    margin-bottom: 0.25rem;
    gap: 0.25rem;
  }
  .quick-filter-chip {
    font-size: 0.68rem;
    padding: 0.18rem 0.5rem;
  }

  /* 7-Day Power Comparison Mobile Optimizations */
  .power-insights-ribbon {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
  .power-insight-card {
    min-width: 0;
    padding: 0.55rem 0.65rem;
  }
  .power-insight-card .insight-val {
    font-size: 0.95rem;
  }
  .power-insight-card .insight-sub {
    font-size: 0.65rem;
  }
  .comparison-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .comparison-mode-switch {
    width: 100%;
    justify-content: center;
  }
  .comp-mode-btn {
    flex: 1;
    justify-content: center;
  }
  .comparison-legend-ribbon {
    justify-content: center;
  }

  /* Power Timeline Mobile Optimizations */
  .timeline-insights-ribbon {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
  .timeline-insight-card {
    min-width: 0;
    padding: 0.55rem 0.65rem;
  }
  .timeline-insight-card .insight-val {
    font-size: 0.95rem;
  }
  .timeline-insight-card .insight-sub {
    font-size: 0.65rem;
  }

  /* 7-Day Consumption Behavior Ribbon Mobile */
  .energy-7day-behavior-ribbon {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.45rem;
  }
  .energy-7day-behavior-ribbon .behavior-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
  .behavior-card {
    padding: 0.50rem 0.60rem;
    gap: 0.25rem;
  }
  .behavior-pill {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
    padding: 0.25rem 0;
    font-size: 0.74rem;
  }
}

/* Modal Dialog */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  max-width: 650px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  position: relative;
  transform: translateY(20px);
  transition: transform var(--transition-normal);
  box-sizing: border-box;
}

#modal-body {
  overflow-y: auto;
  max-height: calc(90vh - 4.5rem);
  padding-right: 0.35rem;
  box-sizing: border-box;
}

.temp-7day-chart-wrapper {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  box-sizing: border-box;
}

.modal-overlay.active .modal-card {
  transform: translateY(0);
}

.modal-close-btn {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.modal-close-btn svg {
  width: 16px;
  height: 16px;
}

@media (max-width: 767px) {
  .modal-card {
    padding: 1rem 0.85rem;
    max-height: 85dvh;
    border-radius: var(--radius-md);
  }
  #modal-body {
    max-height: calc(85dvh - 3.8rem);
    padding-right: 0.2rem;
  }
  #modal-title {
    font-size: 1.05rem;
    padding-right: 2rem;
    word-break: break-word;
  }
  .modal-close-btn {
    top: 0.85rem;
    right: 0.85rem;
    width: 28px;
    height: 28px;
  }
  .modal-close-btn svg {
    width: 14px;
    height: 14px;
  }
}

/* 7-Day Continuous Power Comparison Redesign */
.comparison-chart-wrapper {
  position: relative;
}

.power-insights-ribbon {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

@media (min-width: 768px) {
  .power-insights-ribbon {
    grid-template-columns: repeat(4, 1fr);
  }
}

.power-insight-card {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.power-insight-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.03);
}

.power-insight-card .insight-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.power-insight-card .insight-val {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.power-insight-card .insight-val .unit {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
}

.power-insight-card .insight-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.comparison-toolbar {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 0.45rem;
}

.comparison-mode-switch {
  display: inline-flex;
  background: var(--surface-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 0.2rem;
  gap: 0.2rem;
}

.comp-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.comp-mode-btn:hover {
  color: #fff;
}

.comp-mode-btn.active {
  background: #38bdf8;
  color: #0f172a;
}

.comparison-legend-ribbon {
  justify-content: center;
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.chart-legend-chip.interactive-chip {
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.5rem;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.chart-legend-chip.interactive-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.chart-legend-chip.interactive-chip.spotlight-active {
  transform: translateY(-1px);
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.12);
  color: #fff;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.15);
}

.chart-legend-chip.interactive-chip.spotlight-active .name {
  color: #fff;
  font-weight: 600;
}

.comp-curve {
  transition: opacity 0.2s ease, stroke-width 0.2s ease;
}

/* Power Timeline Enhancements */
.timeline-chart-wrapper {
  position: relative;
}

.timeline-insights-ribbon {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

@media (min-width: 768px) {
  .timeline-insights-ribbon {
    grid-template-columns: repeat(4, 1fr);
  }
}

.timeline-insight-card {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.timeline-insight-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.03);
}

.timeline-insight-card .insight-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.timeline-insight-card .insight-val {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.timeline-insight-card .insight-val .unit {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
}

.timeline-insight-card .insight-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Live Pulse Head Animations */
@keyframes livePulseRing {
  0% {
    r: 6;
    opacity: 0.9;
  }
  50% {
    r: 12;
    opacity: 0.2;
  }
  100% {
    r: 15;
    opacity: 0;
  }
}

.live-pulse-head {
  filter: drop-shadow(0 0 4px #38bdf8);
}

.live-pulse-ring {
  animation: livePulseRing 2.2s infinite ease-out;
  transform-origin: center;
}

/* 7-Day Consumption Behavioral Analytics Ribbon */
.consumption-chart-wrapper {
  position: relative;
}

.energy-7day-behavior-ribbon {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.55rem;
  margin-top: 0.5rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

@media (min-width: 768px) {
  .energy-7day-behavior-ribbon {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.65rem;
  }
}

.behavior-card {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.60rem 0.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.35rem;
  min-width: 0;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.behavior-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.03);
}

.behavior-card-header {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 0;
}

.behavior-card .behavior-icon {
  font-size: 0.85rem;
  flex-shrink: 0;
}

.behavior-card .behavior-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
  color: var(--text-dim);
}

.behavior-card .behavior-detail {
  font-size: clamp(0.78rem, 2.8vw, 0.86rem);
  color: var(--text-muted);
  line-height: 1.35;
  word-break: break-word;
}

.behavior-card .behavior-detail b {
  color: #fff;
  font-family: var(--font-mono);
  font-weight: 700;
}

.behavior-card.outdoor-climate .behavior-detail b {
  color: #38bdf8;
}

.behavior-card .behavior-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.behavior-pill {
  background: transparent;
  border: none;
  padding: 0.15rem 0.35rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.behavior-pill .behavior-title {
  font-weight: 600;
  color: var(--text-dim);
}

.behavior-pill .behavior-detail b {
  color: #fff;
  font-family: var(--font-mono);
}

.behavior-delta,
.behavior-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0;
  border: none;
  background: transparent;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.behavior-delta.higher,
.behavior-tag.higher {
  background: transparent;
  color: #f43f5e;
  border: none;
}

.behavior-delta.lower,
.behavior-tag.conserving {
  background: transparent;
  color: #10b981;
  border: none;
}

/* Interactive Bars & Pacing Extensions */
.bar-group.interactive-bar {
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.bar-group.interactive-bar:hover .chart-bar {
  filter: brightness(1.18);
}

.bar-group.is-selected .chart-bar {
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.6));
  stroke: #38bdf8;
  stroke-width: 1.5;
}

.bar-projection-ghost {
  transition: opacity 0.15s ease;
}

.bar-group:hover .bar-projection-ghost {
  fill: rgba(56, 189, 248, 0.22);
}

.behavior-pill.outdoor-climate .behavior-detail b {
  color: #38bdf8;
}

.temp-pill-group rect {
  display: none;
}

/* 7-Day Chart Superimposed Temperature Line & Secondary Axis */
.temp-line-path {
  pointer-events: none;
  filter: drop-shadow(0 1px 3px rgba(245, 158, 11, 0.45));
  transition: opacity 0.2s ease;
}

.temp-area-fill {
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.temp-line-node {
  transition: transform 0.2s ease, r 0.2s ease, stroke-width 0.2s ease;
  cursor: pointer;
}

.temp-node-group:hover .temp-line-node {
  r: 5.5;
  stroke-width: 3;
}

.temp-node-group:hover .temp-pill-group rect {
  stroke-width: 1.5;
  filter: brightness(1.25);
}

.temp-node-label {
  user-select: none;
  pointer-events: none;
}

.freezing-zero-guide line {
  pointer-events: none;
}

.temp-right-axis text {
  user-select: none;
}

.temp-line-swatch svg {
  display: block;
}

/* Benchmark Guide Badges */
.high-demand-guide text,
.median-guide text,
.median-benchmark-guide text {
  user-select: none;
  font-family: var(--font-mono);
}

.high-demand-guide rect,
.median-guide rect,
.median-benchmark-guide rect {
  transition: opacity 0.15s ease;
}

.bar-projection-group rect {
  transition: opacity 0.15s ease, fill 0.15s ease;
}

/* Timeline & Consumption Legend Ribbons */
.timeline-legend-ribbon,
.consumption-legend-ribbon {
  justify-content: center;
  margin-bottom: 0.45rem;
  padding-bottom: 0.15rem;
  border-bottom: none;
}

/* Climate 24h Multi-Room Chart Styles */
.climate-chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.50rem;
}

.climate-zone-switch {
  display: inline-flex;
  background: var(--surface-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 0.2rem;
  gap: 0.2rem;
}

.climate-curve {
  transition: opacity 0.2s ease, stroke-width 0.2s ease;
}

.climate-legend-ribbon {
  justify-content: center;
  margin-bottom: 0.45rem;
  border-bottom: none;
}

.comfort-zone-band text,
.freezing-line-band text {
  user-select: none;
}

/* Dusk Timeline Wrapper */
.dusk-timeline-wrapper {
  max-width: 960px;
  margin: 0 auto;
}

@media (max-width: 640px) {
  .chart-legend-ribbon,
  .timeline-legend-ribbon,
  .consumption-legend-ribbon,
  .climate-legend-ribbon {
    margin-bottom: 0.35rem;
  }
  .comparison-toolbar {
    margin-bottom: 0.35rem;
  }
  .timeline-legend-ribbon,
  .consumption-legend-ribbon {
    gap: 0.35rem 0.75rem;
  }
  .timeline-legend-ribbon .chart-legend-chip,
  .consumption-legend-ribbon .chart-legend-chip {
    padding: 0.15rem 0.35rem;
    font-size: 0.72rem;
  }
  .climate-zone-switch {
    width: 100%;
    justify-content: space-between;
  }
  .climate-zone-switch .comp-mode-btn {
    flex: 1;
    justify-content: center;
    padding: 0.35rem 0.25rem;
    font-size: 0.68rem;
    line-height: 1.25;
    min-height: 36px;
    text-align: center;
  }
}

/* ==========================================================================
   Section & Chart Loading Spinners
   ========================================================================== */
.section-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 2.5rem 1rem;
  min-height: 120px;
  color: var(--text-muted);
  font-size: 0.84rem;
  font-family: var(--font-sans);
  text-align: center;
}

.spinner-ring {
  width: 26px;
  height: 26px;
  border: 2.5px solid rgba(255, 255, 255, 0.12);
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: section-spin 0.85s linear infinite;
}

.spinner-ring.small {
  width: 18px;
  height: 18px;
  border-width: 2px;
}

.spinner-ring.amber {
  border-top-color: #fbbf24;
}

.spinner-ring.rose {
  border-top-color: #f43f5e;
}

.table-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1.5rem 1rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}

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

/* ==========================================================================
   Service Offline & Disabled Interactivity Styling
   ========================================================================== */
.service-disabled {
  opacity: 0.48;
  filter: grayscale(0.85);
  pointer-events: none !important;
  user-select: none;
  cursor: not-allowed !important;
  transition: opacity 0.3s ease, filter 0.3s ease;
}

.service-disabled input,
.service-disabled button,
.service-disabled select,
.service-disabled textarea {
  cursor: not-allowed !important;
  pointer-events: none !important;
}

.service-offline-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  margin-bottom: 0.85rem;
  border-radius: 8px;
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: #fb7185;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.35;
}

.service-offline-banner.hidden {
  display: none !important;
}

.service-offline-banner .offline-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

/* Radar Scope Offline Overlay */
.radar-scope-offline-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(11, 15, 23, 0.75);
  backdrop-filter: blur(2px);
  z-index: 10;
  border-radius: inherit;
  pointer-events: none;
}

.radar-scope-offline-overlay.hidden {
  display: none !important;
}

.offline-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: #fb7185;
}

/* ==========================================================================
   Ceramic Kiln Running Indicator & 24-Hour 3-Phase Timeline
   ========================================================================== */
.kiln-status-banner {
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.16), rgba(234, 88, 12, 0.10));
  border: 1px solid rgba(249, 115, 22, 0.45);
  border-radius: var(--radius-md);
  padding: 0.8rem 1.15rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  color: #fdba74;
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
  box-shadow: 0 4px 20px rgba(249, 115, 22, 0.12);
}

.kiln-status-banner:hover {
  transform: translateY(-1px);
  border-color: rgba(249, 115, 22, 0.7);
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.22), rgba(234, 88, 12, 0.14));
}

.kiln-status-banner.hidden {
  display: none !important;
}

.kiln-banner-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}

.kiln-pulse-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: rgba(249, 115, 22, 0.2);
  color: #fb923c;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  animation: kiln-ember-pulse 2s ease-in-out infinite;
}

.kiln-pulse-icon svg {
  width: 19px;
  height: 19px;
}

@keyframes kiln-ember-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.45); }
  50% { box-shadow: 0 0 12px 3px rgba(249, 115, 22, 0.28); }
}

.kiln-banner-text-group {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.kiln-banner-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #ffedd5;
  letter-spacing: 0.01em;
}

.kiln-banner-detail {
  font-size: 0.8rem;
  color: #fdba74;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.kiln-banner-action {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1;
  color: #fb923c;
  white-space: nowrap;
  flex-shrink: 0;
}

.kiln-banner-action svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.phase-balance-statuses {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.kiln-inline-status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fb923c;
  background: transparent;
  border: none;
  padding: 0;
}

.phase-col.kiln-active {
  border-color: rgba(249, 115, 22, 0.55);
  box-shadow: 0 0 18px rgba(249, 115, 22, 0.14);
}

.kiln-phase-note {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fdba74;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  padding-top: 0.25rem;
  border-top: 1px solid rgba(249, 115, 22, 0.22);
}

.phase-chart-toolbar {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 0.45rem;
}

.phase-legend-ribbon {
  justify-content: center;
  margin-bottom: 0.45rem;
  padding-bottom: 0.15rem;
  border-bottom: none;
}

@media (max-width: 640px) {
  .status-alert-banner {
    padding: 0.65rem 0.85rem;
    margin-bottom: 0.75rem;
    font-size: 0.82rem;
  }
  .status-alert-banner:has(+ .kiln-status-banner:not(.hidden)) {
    margin-bottom: 0.5rem;
  }
  .kiln-status-banner {
    padding: 0.7rem 0.85rem;
    margin-bottom: 0.8rem;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
  }
  .kiln-banner-content {
    gap: 0.6rem;
  }
  .kiln-banner-title {
    font-size: 0.86rem;
  }
  .kiln-banner-action {
    font-size: 0.76rem;
  }
  .kiln-banner-detail {
    font-size: 0.72rem;
    line-height: 1.3;
  }
  .phase-legend-ribbon {
    margin-bottom: 0.35rem;
    gap: 0.35rem 0.75rem;
  }
  .phase-balance-statuses {
    gap: 0.5rem 0.85rem;
  }
}






