:root {
  --bg: #fafbfc;
  --surface: #ffffff;
  --border: #dfe1e6;
  --text: #172b4d;
  --text-muted: #6b778c;
  --text-subtle: #97a0af;
  --status-operational: #36b37e;
  --status-degraded: #ffab00;
  --status-partial: #ff7452;
  --status-major: #de350b;
  --status-maintenance: #0052cc;
  --status-no-data: #ebecf0;
  --shadow-card: 0 1px 2px rgba(9, 30, 66, 0.08), 0 0 0 1px rgba(9, 30, 66, 0.04);
  --radius: 8px;
  --radius-lg: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: #0052cc; text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  display: flex;
  align-items: center;
}
.brand:hover { text-decoration: none; }
.brand-logo {
  height: 36px;
  width: auto;
  display: block;
}

.header-nav {
  display: flex;
  gap: 20px;
  font-size: 14px;
}
.header-nav a {
  color: var(--text-muted);
  font-weight: 500;
}
.header-nav a:hover { color: var(--text); text-decoration: none; }

/* Banner principal */
.overall-banner {
  margin: 32px 0 24px;
  padding: 24px 28px;
  border-radius: var(--radius-lg);
  background: var(--status-operational);
  color: white;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: 0 6px 16px rgba(9, 30, 66, 0.08);
  transition: background 0.3s;
}
.overall-banner.is-loading { background: var(--text-subtle); }
.overall-banner[data-overall="operational"] { background: var(--status-operational); }
.overall-banner[data-overall="degraded"] { background: var(--status-degraded); }
.overall-banner[data-overall="partial_outage"] { background: var(--status-partial); }
.overall-banner[data-overall="major_outage"] { background: var(--status-major); }
.overall-banner[data-overall="maintenance"] { background: var(--status-maintenance); }

.overall-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  position: relative;
  flex-shrink: 0;
}
.overall-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 8px;
  border-left: 3px solid white;
  border-bottom: 3px solid white;
  transform: translate(-50%, -65%) rotate(-45deg);
}
[data-overall="major_outage"] .overall-icon::after,
[data-overall="partial_outage"] .overall-icon::after,
[data-overall="degraded"] .overall-icon::after {
  width: 18px; height: 18px;
  border: 0;
  border-radius: 0;
  background: none;
  font-size: 26px;
  line-height: 18px;
  text-align: center;
  color: white;
  content: "!";
  font-weight: 900;
  transform: translate(-50%, -55%);
}
[data-overall="maintenance"] .overall-icon::after {
  width: 18px; height: 18px;
  border: 0;
  background: none;
  font-size: 22px;
  color: white;
  content: "\2699";
  transform: translate(-50%, -55%);
  font-weight: 700;
}

.overall-text h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.2px;
}
.overall-subtitle {
  margin: 4px 0 0;
  font-size: 14px;
  opacity: 0.92;
}

/* Manutencao programada */
.maintenance-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--status-maintenance);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.maintenance-card strong {
  display: block;
  font-size: 14px;
  color: var(--text);
}
.maintenance-card p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 14px;
}
.maintenance-icon {
  width: 32px;
  height: 32px;
  background: var(--status-maintenance);
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
}
.maintenance-icon::after {
  content: "\2699";
  color: white;
  font-size: 20px;
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -55%);
}

/* Section header */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.section-legend {
  font-size: 12px;
  color: var(--text-subtle);
}

/* Components */
.components {
  margin-bottom: 36px;
}
.components-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.component-row {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.component-row:last-child { border-bottom: 0; }

.component-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.component-name {
  font-weight: 500;
  color: var(--text);
  font-size: 15px;
}
.component-status {
  font-size: 13px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.component-status[data-status="operational"]    { background: rgba(54,179,126,.12);  color: #006644; }
.component-status[data-status="degraded"]       { background: rgba(255,171,0,.16);  color: #97640e; }
.component-status[data-status="partial_outage"] { background: rgba(255,116,82,.18); color: #b04500; }
.component-status[data-status="major_outage"]   { background: rgba(222,53,11,.14);  color: #b03206; }
.component-status[data-status="maintenance"]    { background: rgba(0,82,204,.12);   color: #0747a6; }
.component-status[data-status="no_data"]        { background: var(--status-no-data); color: var(--text-muted); }

/* Barras de historico */
.history-bars {
  display: flex;
  gap: 2px;
  align-items: flex-end;
  height: 34px;
}
.history-bar {
  flex: 1 1 0;
  height: 100%;
  border-radius: 2px;
  background: var(--status-no-data);
  position: relative;
  transition: transform 0.15s ease, filter 0.15s ease;
  cursor: default;
}
.history-bar[data-status="operational"]    { background: var(--status-operational); }
.history-bar[data-status="degraded"]       { background: var(--status-degraded); }
.history-bar[data-status="partial_outage"] { background: var(--status-partial); }
.history-bar[data-status="major_outage"]   { background: var(--status-major); }
.history-bar[data-status="maintenance"]    { background: var(--status-maintenance); }
.history-bar:hover {
  transform: scaleY(1.18);
  filter: brightness(1.06);
}

/* Tooltip simples */
.history-bar[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: white;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 5;
}

.history-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-subtle);
  margin-top: 6px;
}

/* Incidents */
.incidents {
  margin-bottom: 40px;
}
.incidents-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.incident-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  border-left: 3px solid var(--status-no-data);
}
.incident-card[data-status="resolved"]    { border-left-color: var(--status-operational); }
.incident-card[data-status="investigating"], .incident-card[data-status="open"] {
  border-left-color: var(--status-major);
}
.incident-card[data-status="monitoring"]  { border-left-color: var(--status-degraded); }

.incident-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.incident-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.incident-date {
  font-size: 12px;
  color: var(--text-subtle);
}
.incident-body {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--text-muted);
}
.empty-state {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  color: var(--text-subtle);
  font-size: 14px;
}

/* Footer */
.page-footer {
  border-top: 1px solid var(--border);
  margin-top: 40px;
  padding: 20px 0 32px;
  font-size: 12px;
  color: var(--text-subtle);
  text-align: center;
}
.page-footer p { margin: 0; }

.hidden { display: none !important; }

/* Skeleton de loading */
.skeleton {
  display: inline-block;
  background: linear-gradient(90deg, #ebecf0 0%, #f4f5f7 50%, #ebecf0 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 4px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Responsive */
@media (max-width: 600px) {
  .container { padding: 0 16px; }
  .header-inner { height: 56px; }
  .brand-logo { height: 28px; }
  .overall-banner { padding: 18px 20px; }
  .overall-text h1 { font-size: 20px; }
  .component-top { flex-wrap: wrap; }
  .history-bars { height: 28px; }
  .header-nav { gap: 12px; font-size: 13px; }
}
