* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #ffffff; --white: #ffffff; --text: #1e293b; --light: #64748b; --border: #e2e8f0;
  --radius: 12px;
  --operational: #006b39; --maintenance: #f0ad4e; --degraded: #f0ad4e;
  --partial: #f0ad85; --major: #d9534f;
}
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
body.template-dark {
  --bg: #0a0a0f; --white: #12121a; --text: #e2e8f0; --light: #64748b; --border: #1e1e2e;
}
.container { max-width: 960px; margin: 0 auto; padding: 0 20px; }

/* Page Header */
.page-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 24px 0;
}
.page-header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.page-header h1 { font-size: 22px; font-weight: 700; color: var(--text); }
.page-header p { font-size: 14px; color: var(--light); margin-top: 2px; }
.logo { height: 36px; }

/* Page Body */
.page-body { padding: 24px 0 48px; }

/* Overall Status */
.overall-status {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 24px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  font-weight: 600;
  font-size: 15px;
}
.overall-status .overall-label { font-size: 12px; font-weight: 500; opacity: 0.7; display: block; }
.overall-status .overall-value { font-size: 16px; font-weight: 700; }
.overall-status .pulse-dot {
  width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.overall-status.operational { background: #dcfce7; color: var(--operational); }
.overall-status.operational .pulse-dot { background: var(--operational); }
.overall-status.under_maintenance { background: #fef9c3; color: #854d0e; }
.overall-status.under_maintenance .pulse-dot { background: #eab308; }
.overall-status.degraded_performance { background: #fef3c7; color: #92400e; }
.overall-status.degraded_performance .pulse-dot { background: #f59e0b; }
.overall-status.partial_outage { background: #ffedd5; color: #9a3412; }
.overall-status.partial_outage .pulse-dot { background: #f97316; }
.overall-status.major_outage { background: #fee2e2; color: #991b1b; }
.overall-status.major_outage .pulse-dot { background: #ef4444; }

/* Incidents Panel */
.incidents-panel {
  border-radius: var(--radius);
  padding: 0;
  margin-bottom: 28px;
  overflow: hidden;
  border: 1px solid;
}
.incidents-panel.impact-critical { border-color: #fecaca; background: #fef2f2; }
.incidents-panel.impact-major { border-color: #fed7aa; background: #fff7ed; }
.incidents-panel.impact-minor { border-color: #fef08a; background: #fefce8; }
.incidents-panel.impact-none { border-color: #e2e8f0; background: #f8fafc; }
.incidents-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid;
  font-size: 14px;
  font-weight: 700;
}
.incidents-panel.impact-critical .incidents-panel-header { border-color: #fecaca; color: #991b1b; }
.incidents-panel.impact-major .incidents-panel-header { border-color: #fed7aa; color: #9a3412; }
.incidents-panel.impact-minor .incidents-panel-header { border-color: #fef08a; color: #854d0e; }
.incidents-panel.impact-none .incidents-panel-header { border-color: #e2e8f0; color: #475569; }
.alert-icon {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.incidents-panel.impact-critical .alert-icon { background: #ef4444; }
.incidents-panel.impact-major .alert-icon { background: #f97316; }
.incidents-panel.impact-minor .alert-icon { background: #eab308; }
.incidents-panel.impact-none .alert-icon { background: #94a3b8; }
.incident-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid;
  gap: 12px;
}
.incident-row:last-child { border-bottom: none; }
.incidents-panel.impact-critical .incident-row { border-color: #fecaca; }
.incidents-panel.impact-major .incident-row { border-color: #fed7aa; }
.incidents-panel.impact-minor .incident-row { border-color: #fef08a; }
.incidents-panel.impact-none .incident-row { border-color: #e2e8f0; }
.incident-row-left {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.incident-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 5px;
}
.incident-dot.impact-critical { background: #ef4444; }
.incident-dot.impact-major { background: #f97316; }
.incident-dot.impact-minor { background: #eab308; }
.incident-dot.impact-none { background: #94a3b8; }
.incident-row-name { font-size: 14px; font-weight: 600; color: var(--text); }
.incident-row-msg { font-size: 13px; color: var(--light); margin-top: 3px; line-height: 1.4; }
.incident-row-badge {
  font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 20px;
  white-space: nowrap; flex-shrink: 0;
}

/* Badges */
.badge-operational { background: #dcfce7; color: var(--operational); }
.badge-under_maintenance { background: #fef9c3; color: #854d0e; }
.badge-degraded_performance { background: #fef3c7; color: #92400e; }
.badge-partial_outage { background: #ffedd5; color: #9a3412; }
.badge-major_outage { background: #fee2e2; color: #991b1b; }
.badge-investigating { background: #fee2e2; color: #991b1b; }
.badge-identified { background: #ffedd5; color: #9a3412; }
.badge-monitoring { background: #fef3c7; color: #92400e; }
.badge-resolved { background: #dcfce7; color: var(--operational); }

/* Component Groups */
.component-group {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  border: 1px solid var(--border);
}
.component-group h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--light);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.component-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.component-row:last-child { border-bottom: none; }
.component-row-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.component-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.component-dot.operational { background: var(--operational); }
.component-dot.under_maintenance { background: #eab308; }
.component-dot.degraded_performance { background: #f59e0b; }
.component-dot.partial_outage { background: #f97316; }
.component-dot.major_outage { background: #ef4444; }
.component-dot.investigating { background: #ef4444; }
.component-dot.identified { background: #f97316; }
.component-dot.monitoring { background: #eab308; }
.component-dot.resolved { background: var(--operational); }
.component-name { font-size: 15px; font-weight: 600; color: var(--text); }
.component-desc { font-size: 13px; color: var(--light); margin-top: 1px; }
.component-badge {
  font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 20px;
  white-space: nowrap; flex-shrink: 0;
}

/* Footer */
footer { text-align: center; padding: 32px 0; color: var(--light); font-size: 13px; }

/* ===== GRID TEMPLATE ===== */
.grid-container { margin-bottom: 24px; }
.grid-group { margin-bottom: 24px; }
.grid-group h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--light);
  margin-bottom: 14px;
  font-weight: 600;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.status-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 8px;
}
.card-name { font-size: 15px; font-weight: 600; color: var(--text); }
.card-status {
  font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 20px;
  white-space: nowrap;
}
.card-desc { font-size: 13px; color: var(--light); line-height: 1.4; }

/* ===== DARK TEMPLATE ===== */
.dark-container { margin-bottom: 24px; }
.dark-group { margin-bottom: 24px; }
.dark-group h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--light);
  margin-bottom: 14px;
  font-weight: 600;
}
.dark-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  background: var(--white);
}
.dark-item:last-child { margin-bottom: 0; }
.dark-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.dark-item-name { font-size: 15px; font-weight: 600; color: var(--text); }
.dark-item-desc { font-size: 13px; color: var(--light); margin-top: 2px; }
.dark-item-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.dark-badge {
  font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 20px;
  white-space: nowrap;
}

/* Header for grid/dark templates */
header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 24px 0;
}
.header-content {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.header-content h1 { font-size: 22px; font-weight: 700; color: var(--text); }
.header-content .subtitle { font-size: 14px; color: var(--light); margin-top: 2px; }

/* Responsive */
@media (max-width: 640px) {
  .card-grid { grid-template-columns: 1fr; }
  .incident-row { flex-direction: column; gap: 8px; }
  .dark-item { flex-direction: column; align-items: flex-start; gap: 10px; }
}
