:root {
  --bg: #faf9f5;
  --text: #141413;
  --text-light: #87867f;
  --green: #76ad2a;
  --yellow: #e5a530;
  --orange: #e07a3a;
  --red: #d94040;
  --empty: #ccc;
  --border: #dedcd1;
  --font: "Figtree", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 850px;
  margin: 0 auto 70px;
  padding: 12px 20px;
}

/* Header */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 70px 0 0;
  margin-bottom: 70px;
}

.logo {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

/* Status banner */
.status-banner {
  border-radius: 4px;
  padding: 12px 20px;
  margin-bottom: 70px;
  color: #fff;
}

.status-banner.green { background: var(--green); }
.status-banner.yellow { background: var(--yellow); }
.status-banner.red { background: var(--red); }

.status-banner h2 {
  font-size: 20px;
  font-weight: 500;
  color: #fff;
  line-height: 29px;
  margin-bottom: 11.2px;
}

/* Section meta */
.section-meta {
  text-align: right;
  margin-bottom: 0;
  font-size: 13.6px;
  line-height: 24px;
  color: var(--text-light);
}

/* Components container */
.components {
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
}

/* Component row */
.component-row {
  padding: 17.6px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.component-row:last-child {
  border-bottom: none;
}

.component-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.component-name {
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
  color: var(--text);
}

.component-status {
  font-size: 16px;
  font-weight: 400;
}

.component-status.green { color: var(--green); }
.component-status.yellow { color: var(--yellow); }
.component-status.red { color: var(--red); }

/* Bar chart — SVG-based to match exact dimensions */
.bar-chart {
  display: block;
  width: 100%;
  overflow: hidden;
  margin-top: 5px;
}

/* Bar footer (legend) */
.bar-footer {
  display: flex;
  justify-content: space-between;
  align-items: normal;
  position: relative;
  font-size: 14px;
  color: var(--text-light);
  height: 24px;
}

.bar-footer .spacer {
  flex: 1 1 0%;
  height: 1px;
  background: var(--text-light);
  margin: 12px 16px 0;
}

/* Tooltip */
.tooltip {
  position: fixed;
  z-index: 200;
  pointer-events: none;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 12px;
  max-width: 320px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  opacity: 0;
  transition: opacity 0.1s;
  font-size: 13px;
}

.tooltip.visible {
  opacity: 1;
}

.tooltip-date {
  font-size: 11px;
  color: var(--text-light);
  margin-bottom: 3px;
}

.tooltip-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

.tooltip-dot.green { background: var(--green); }
.tooltip-dot.yellow { background: var(--yellow); }
.tooltip-dot.red { background: var(--red); }

.tooltip-text {
  color: var(--text);
  line-height: 1.4;
}

/* Detail panel */
.detail-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 3px;
  margin-top: 16px;
  padding: 20px 24px;
  display: none;
  position: relative;
  animation: slideDown 0.15s ease-out;
}

.detail-panel.open {
  display: block;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}

.detail-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}

.detail-close:hover {
  color: var(--text);
}

.detail-date {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 4px;
}

.detail-category {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.detail-severity-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 3px 10px;
  border-radius: 100px;
  margin-bottom: 12px;
  color: #fff;
}

.detail-severity-badge.green { background: var(--green); }
.detail-severity-badge.yellow { background: var(--yellow); }
.detail-severity-badge.red { background: var(--red); }

.detail-headline {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.4;
}

.detail-summary {
  font-size: 14px;
  color: #555;
  line-height: 1.7;
  margin-bottom: 14px;
}

.detail-sources {
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.detail-sources-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-light);
  margin-bottom: 4px;
}

.detail-sources a {
  display: block;
  font-size: 13px;
  color: #555;
  text-decoration: none;
  padding: 2px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-sources a:hover {
  color: var(--text);
}

/* Past incidents section */
.past-incidents {
  margin-top: 40px;
  padding-bottom: 60px;
}

.incidents-heading {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.incident-day {
  margin-bottom: 24px;
}

.incident-date {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.incident-item {
  padding: 6px 0;
}

.incident-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.incident-title .severity-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.incident-title .severity-dot.green { background: var(--green); }
.incident-title .severity-dot.yellow { background: var(--yellow); }
.incident-title .severity-dot.red { background: var(--red); }

.incident-body {
  font-size: 13px;
  color: #555;
  line-height: 1.6;
  margin-top: 2px;
  padding-left: 14px;
}

.incident-none {
  font-size: 14px;
  color: var(--text-light);
  padding: 4px 0;
}

/* Page footer */
.page-footer {
  text-align: center;
  padding: 20px 0 40px;
  font-size: 13px;
  color: var(--text-light);
}

.page-footer button {
  background: none;
  border: none;
  color: var(--text-light);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
}

.page-footer button:hover {
  color: var(--text);
}

/* Loading / Empty */
.loading, .empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-light);
  font-size: 14px;
}

/* Responsive */
@media (max-width: 640px) {
  .page {
    padding: 0 12px;
  }

  header {
    padding: 24px 0 20px;
  }

  .component-row {
    padding: 12px 14px 10px;
  }
}
