/* ===================== */
/* RESET & BASE STYLES   */
/* ===================== */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: linear-gradient(135deg, #0a0e1a 0%, #1a1f35 100%);
  color: #e8eef6;
  min-height: 100vh;
  line-height: 1.6;
}

.container {
  max-width: 1600px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===================== */
/* HEADER                */
/* ===================== */

header {
  background: linear-gradient(135deg, #141b2d 0%, #1a2332 100%);
  border-bottom: 1px solid rgba(99, 179, 237, 0.1);
  padding: 24px 28px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.header-content {
  margin-bottom: 24px;
}

.title-section {
  margin-bottom: 20px;
}

h1 {
  font-size: 28px;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
  background: linear-gradient(135deg, #63b3ed 0%, #4299e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.icon-dashboard {
  color: #63b3ed;
  -webkit-text-fill-color: #63b3ed;
  filter: drop-shadow(0 2px 4px rgba(99, 179, 237, 0.3));
}

.subtitle {
  font-size: 14px;
  color: #a0aec0;
  margin-left: 40px;
  font-weight: 400;
}

/* ===================== */
/* CONTROLS              */
/* ===================== */

.controls {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control-group label {
  font-size: 12px;
  font-weight: 600;
  color: #a0aec0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.control-group label svg {
  color: #63b3ed;
}

select {
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid rgba(99, 179, 237, 0.2);
  background: rgba(15, 22, 36, 0.8);
  color: #e8eef6;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 160px;
}

select:hover {
  border-color: rgba(99, 179, 237, 0.4);
  background: rgba(15, 22, 36, 1);
}

select:focus {
  outline: none;
  border-color: #63b3ed;
  box-shadow: 0 0 0 3px rgba(99, 179, 237, 0.1);
}

button.btn-refresh {
  padding: 10px 20px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(66, 153, 225, 0.3);
}

button.btn-refresh:hover {
  background: linear-gradient(135deg, #3182ce 0%, #2c5282 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(66, 153, 225, 0.4);
}

button.btn-refresh:active {
  transform: translateY(0);
}

button.btn-threshold {
  padding: 10px 20px;
  border-radius: 10px;
  border: 1px solid rgba(99, 179, 237, 0.3);
  background: rgba(15, 22, 36, 0.8);
  color: #63b3ed;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

button.btn-threshold:hover {
  background: rgba(99, 179, 237, 0.1);
  border-color: #63b3ed;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 179, 237, 0.2);
}

button.btn-threshold:active {
  transform: translateY(0);
}

.icon-refresh {
  transition: transform 0.6s ease;
}

button.btn-refresh:hover .icon-refresh {
  transform: rotate(180deg);
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(15, 22, 36, 0.8);
  border: 1px solid rgba(99, 179, 237, 0.2);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #48bb78;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(72, 187, 120, 0.7);
  }
  50% {
    opacity: 0.8;
    box-shadow: 0 0 0 6px rgba(72, 187, 120, 0);
  }
}

/* ===================== */
/* METRICS GRID          */
/* ===================== */

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.metric-card {
  background: linear-gradient(135deg, rgba(26, 32, 50, 0.8) 0%, rgba(15, 22, 36, 0.8) 100%);
  border: 1px solid rgba(99, 179, 237, 0.15);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  gap: 16px;
  align-items: center;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, currentColor, transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.metric-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  border-color: rgba(99, 179, 237, 0.3);
}

.metric-card:hover::before {
  opacity: 1;
}

.metric-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.metric-card:hover .metric-icon {
  transform: scale(1.1) rotate(5deg);
}

.temp-card { color: #fc8181; }
.temp-card .metric-icon { background: rgba(252, 129, 129, 0.15); }

.humi-card { color: #63b3ed; }
.humi-card .metric-icon { background: rgba(99, 179, 237, 0.15); }

.mois-card { color: #68d391; }
.mois-card .metric-icon { background: rgba(104, 211, 145, 0.15); }

.pir-card { color: #fbd38d; }
.pir-card .metric-icon { background: rgba(251, 211, 141, 0.15); }

.metric-content {
  flex: 1;
}

.metric-label {
  font-size: 13px;
  font-weight: 600;
  color: #a0aec0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.metric-value {
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 2px;
  color: #ffffff;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.metric-unit {
  font-size: 12px;
  color: #718096;
  font-weight: 500;
}

.metric-value-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.trend-arrow {
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  transition: all 0.3s ease;
}

.trend-arrow.up   { color: #48bb78; }
.trend-arrow.down { color: #fc8181; }

#countdown {
  font-weight: 700;
  color: #63b3ed;
  transition: color 0.3s ease;
}

#countdown.urgent { color: #fc8181; }

/* ===================== */
/* CHARTS GRID           */
/* ===================== */

main.charts-grid {
  flex: 1;
  padding: 28px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
  gap: 24px;
  align-content: start;
}

.chart-panel {
  background: linear-gradient(135deg, rgba(26, 32, 50, 0.6) 0%, rgba(15, 22, 36, 0.6) 100%);
  border: 1px solid rgba(99, 179, 237, 0.15);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.chart-panel:hover {
  border-color: rgba(99, 179, 237, 0.3);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  transform: translateY(-2px);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(99, 179, 237, 0.1);
}

.panel-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #718096;
  font-weight: 500;
}

.legend-ewma {
  display: inline-block;
  width: 18px;
  height: 2px;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,0.4) 0, rgba(255,255,255,0.4) 5px, transparent 5px, transparent 8px);
}

.legend-band {
  display: inline-block;
  width: 18px;
  height: 8px;
  background: rgba(99, 179, 237, 0.15);
  border: 1px dashed rgba(99, 179, 237, 0.3);
  border-radius: 2px;
}

.panel-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-header h2 svg {
  color: #63b3ed;
}

.panel-badge {
  font-size: 11px;
  font-weight: 700;
  color: #63b3ed;
  background: rgba(99, 179, 237, 0.15);
  padding: 4px 10px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chart-container {
  position: relative;
  height: 280px;
}

/* ===================== */
/* FOOTER                */
/* ===================== */

footer {
  background: linear-gradient(135deg, #141b2d 0%, #1a2332 100%);
  border-top: 1px solid rgba(99, 179, 237, 0.1);
  padding: 20px 28px;
  margin-top: auto;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-info {
  font-size: 13px;
  color: #a0aec0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-info svg {
  color: #63b3ed;
  opacity: 0.6;
}

/* ===================== */
/* LOADING STATE         */
/* ===================== */

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.loading .metric-value,
.loading .chart-container {
  background: linear-gradient(90deg, 
    rgba(99, 179, 237, 0.1) 0%,
    rgba(99, 179, 237, 0.2) 50%,
    rgba(99, 179, 237, 0.1) 100%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
  border-radius: 8px;
}

/* ===================== */
/* MODAL                 */
/* ===================== */

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.3s ease;
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background: linear-gradient(135deg, #1a2332 0%, #141b2d 100%);
  border: 1px solid rgba(99, 179, 237, 0.2);
  border-radius: 20px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.3s ease;
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 28px;
  border-bottom: 1px solid rgba(99, 179, 237, 0.1);
}

.modal-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
}

.modal-header h2 svg {
  color: #63b3ed;
}

.close-btn {
  background: transparent;
  border: none;
  color: #a0aec0;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  background: rgba(99, 179, 237, 0.1);
  color: #63b3ed;
  transform: rotate(90deg);
}

.modal-body {
  padding: 28px;
}

.threshold-section {
  margin-bottom: 28px;
}

.threshold-section:last-of-type {
  margin-bottom: 20px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.section-title svg {
  color: #63b3ed;
}

.section-title h3 {
  font-size: 16px;
  font-weight: 600;
  color: #e8eef6;
  margin: 0;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-group label {
  font-size: 13px;
  font-weight: 600;
  color: #a0aec0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-group input {
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid rgba(99, 179, 237, 0.2);
  background: rgba(15, 22, 36, 0.8);
  color: #e8eef6;
  font-size: 15px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.input-group input:focus {
  outline: none;
  border-color: #63b3ed;
  background: rgba(15, 22, 36, 1);
  box-shadow: 0 0 0 3px rgba(99, 179, 237, 0.1);
}

.input-group input::placeholder {
  color: #718096;
}

.info-box {
  background: rgba(99, 179, 237, 0.08);
  border: 1px solid rgba(99, 179, 237, 0.2);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.info-box svg {
  color: #63b3ed;
  flex-shrink: 0;
  margin-top: 2px;
}

.info-box p {
  font-size: 13px;
  color: #cbd5e0;
  line-height: 1.6;
  margin: 0;
}

.modal-footer {
  padding: 20px 28px;
  border-top: 1px solid rgba(99, 179, 237, 0.1);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.btn-primary,
.btn-secondary {
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
}

.btn-primary {
  background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(66, 153, 225, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #3182ce 0%, #2c5282 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(66, 153, 225, 0.4);
}

.btn-secondary {
  background: rgba(15, 22, 36, 0.8);
  color: #a0aec0;
  border: 1px solid rgba(99, 179, 237, 0.2);
}

.btn-secondary:hover {
  background: rgba(99, 179, 237, 0.1);
  color: #63b3ed;
  border-color: #63b3ed;
}

/* Threshold warning states */
.metric-value.warning {
  color: #fc8181 !important;
  animation: warningPulse 2s ease-in-out infinite;
}

@keyframes warningPulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* ===================== */
/* RESPONSIVE DESIGN     */
/* ===================== */

@media (max-width: 1200px) {
  main.charts-grid {
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  }
}

@media (max-width: 900px) {
  main.charts-grid {
    grid-template-columns: 1fr;
  }
  
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  h1 {
    font-size: 24px;
  }
  
  .subtitle {
    margin-left: 36px;
  }
}

@media (max-width: 600px) {
  header {
    padding: 20px 16px;
  }
  
  main.charts-grid {
    padding: 16px;
    gap: 16px;
  }
  
  .metrics-grid {
    grid-template-columns: 1fr;
  }
  
  .controls {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  
  .control-group,
  select,
  button.btn-refresh,
  button.btn-threshold,
  .status-badge {
    width: 100%;
  }
  
  h1 {
    font-size: 20px;
  }
  
  .subtitle {
    font-size: 12px;
    margin-left: 32px;
  }
  
  .metric-value {
    font-size: 28px;
  }
  
  .chart-container {
    height: 240px;
  }

  .modal-content {
    width: 95%;
    margin: 20px;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 20px;
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  .modal-footer {
    flex-direction: column;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
  }
}

/* ===================== */
/* AI INSIGHTS PANEL     */
/* ===================== */

.ai-panel {
  margin: 0 28px 0;
  background: linear-gradient(135deg, rgba(99, 179, 237, 0.06) 0%, rgba(159, 122, 234, 0.06) 100%);
  border: 1px solid rgba(99, 179, 237, 0.2);
  border-radius: 18px;
  padding: 24px 28px;
  position: relative;
  overflow: hidden;
}

.ai-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, #63b3ed, #9f7aea, #63b3ed);
  background-size: 200% 100%;
  animation: aiShimmer 3s linear infinite;
}

@keyframes aiShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.ai-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.ai-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-badge {
  background: linear-gradient(135deg, #63b3ed, #9f7aea);
  color: white;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 1px;
}

.ai-title h2 {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
}

.ai-meta {
  display: flex;
  align-items: center;
  gap: 16px;
}

.ai-powered {
  font-size: 12px;
  color: #718096;
  font-style: italic;
}

.ai-status {
  font-size: 12px;
  color: #a0aec0;
  padding: 4px 10px;
  background: rgba(99, 179, 237, 0.1);
  border-radius: 20px;
  border: 1px solid rgba(99, 179, 237, 0.2);
}

.ai-body {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 32px;
  align-items: center;
}

/* Health Score Ring */
.health-score-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.health-ring {
  position: relative;
  width: 140px;
  height: 140px;
}

.health-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.health-track {
  fill: none;
  stroke: rgba(99, 179, 237, 0.1);
  stroke-width: 10;
}

.health-fill {
  fill: none;
  stroke: #63b3ed;
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 314;
  stroke-dashoffset: 314;
  transition: stroke-dashoffset 1s ease, stroke 0.5s ease;
}

.health-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.health-number {
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
  color: #63b3ed;
  transition: color 0.5s ease;
}

.health-label {
  font-size: 12px;
  font-weight: 600;
  color: #a0aec0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.health-caption {
  font-size: 12px;
  color: #718096;
  font-weight: 500;
}

/* Observations */
.ai-insights-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.breach-warning {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(251, 211, 141, 0.1);
  border: 1px solid rgba(251, 211, 141, 0.3);
  border-radius: 10px;
  color: #fbd38d;
  font-size: 14px;
  font-weight: 600;
}

.breach-warning.visible {
  display: flex;
}

.observations {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.observations li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  color: #cbd5e0;
  line-height: 1.5;
  padding: 10px 14px;
  background: rgba(15, 22, 36, 0.4);
  border-radius: 10px;
  border: 1px solid rgba(99, 179, 237, 0.08);
  animation: obsFadeIn 0.4s ease forwards;
}

.observations li::before {
  content: '→';
  color: #63b3ed;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

@keyframes obsFadeIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

.obs-skeleton {
  height: 40px !important;
  background: linear-gradient(90deg,
    rgba(99, 179, 237, 0.05) 0%,
    rgba(99, 179, 237, 0.12) 50%,
    rgba(99, 179, 237, 0.05) 100%
  ) !important;
  background-size: 200% 100% !important;
  animation: skeletonPulse 1.5s ease infinite !important;
  border-radius: 10px !important;
}

.obs-skeleton::before {
  display: none !important;
}

@keyframes skeletonPulse {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Stats Strip */
.stats-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding-top: 18px;
  margin-top: 18px;
  border-top: 1px solid rgba(99, 179, 237, 0.1);
}

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

.stat-group-label {
  font-size: 10px;
  font-weight: 700;
  color: #4a5568;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-right: 2px;
}

.stat-chip {
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding: 5px 10px;
  background: rgba(15, 22, 36, 0.6);
  border: 1px solid rgba(99, 179, 237, 0.1);
  border-radius: 7px;
}

.stat-label {
  font-size: 11px;
  color: #4a5568;
  font-weight: 600;
  font-style: italic;
}

.stat-value {
  font-size: 14px;
  font-weight: 700;
  color: #e8eef6;
  transition: color 0.4s ease;
  font-variant-numeric: tabular-nums;
}

.stat-unit {
  font-size: 10px;
  color: #4a5568;
}

.stat-divider {
  width: 1px;
  height: 28px;
  background: rgba(99, 179, 237, 0.1);
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .ai-panel {
    margin: 0 16px;
  }

  .ai-body {
    grid-template-columns: 1fr;
  }

  .health-score-section {
    flex-direction: row;
    justify-content: center;
    gap: 20px;
  }

  .health-ring {
    width: 100px;
    height: 100px;
  }

  .health-number {
    font-size: 28px;
  }

  .health-caption {
    display: none;
  }

  .ai-panel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* ===================== */
/* TOAST NOTIFICATIONS   */
/* ===================== */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  min-width: 280px;
  max-width: 400px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: toastIn 0.3s ease forwards;
  pointer-events: all;
  backdrop-filter: blur(10px);
}

.toast.success {
  background: rgba(72, 187, 120, 0.15);
  border: 1px solid rgba(72, 187, 120, 0.4);
  color: #68d391;
}

.toast.error {
  background: rgba(245, 101, 101, 0.15);
  border: 1px solid rgba(245, 101, 101, 0.4);
  color: #fc8181;
}

.toast.warning {
  background: rgba(251, 211, 141, 0.15);
  border: 1px solid rgba(251, 211, 141, 0.4);
  color: #fbd38d;
}

.toast.info {
  background: rgba(99, 179, 237, 0.15);
  border: 1px solid rgba(99, 179, 237, 0.4);
  color: #63b3ed;
}

.toast.removing {
  animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

@keyframes toastOut {
  from { transform: translateX(0);    opacity: 1; }
  to   { transform: translateX(110%); opacity: 0; }
}

@media (max-width: 600px) {
  .toast-container {
    bottom: 16px;
    right: 16px;
    left: 16px;
  }

  .toast {
    min-width: unset;
    max-width: unset;
    width: 100%;
  }
}

/* ===================== */
/* PRINT STYLES          */
/* ===================== */

@media print {
  body {
    background: white;
    color: black;
  }
  
  .controls,
  footer {
    display: none;
  }
  
  .chart-panel {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}