/* ============================================================
   NexaOmni · Status — tema claro (padrão Atlassian Statuspage /
   status.claude.com). Sóbrio, limpo, minimalista, muito respiro.
   CSS vanilla, sem build.
   ============================================================ */

:root {
  --page-bg:   #fafbfc;   /* fundo da página, cinza levíssimo */
  --surface:   #ffffff;   /* cards / superfícies */
  --surface-2: #fafbfc;   /* cabeçalho de grupo / sutil */
  --border:    #e5e8ec;   /* bordas finas */

  --text:      #172b4d;   /* texto principal (cinza-escuro azulado) */
  --muted:     #6b778c;   /* texto secundário */

  --brand:     #3d63ff;   /* acento de marca (azul) */

  --ok:        #2fcc66;   /* verde barra */
  --ok-text:   #1e8e3e;   /* verde texto */
  --amber:     #f5a623;   /* âmbar */
  --amber-text:#b26a00;   /* âmbar texto */
  --red:       #e74c3c;   /* vermelho barra */
  --red-text:  #d64545;   /* vermelho texto */
  --nodata:    #e5e8ec;   /* cinza sem-dados */

  --radius:    10px;
  --radius-sm: 8px;
  --maxw:      960px;

  --font: -apple-system, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.tabular { font-variant-numeric: tabular-nums; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  z-index: 100;
}
.skip-link:focus { left: 12px; top: 12px; }

/* ---------- Header ---------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 68px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo {
  height: 30px;
  width: auto;
  display: block;
}
.brand-status {
  color: var(--muted);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
  padding-left: 12px;
  border-left: 1px solid var(--border);
  line-height: 1;
}

.subscribe-btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 550;
  cursor: pointer;
  transition: border-color .12s ease, color .12s ease, background .12s ease;
}
.subscribe-btn:hover,
.subscribe-btn[aria-expanded="true"] {
  text-decoration: none;
  border-color: var(--brand);
  color: var(--brand);
  background: #f5f7ff;
}

/* ---------- Popover de assinatura ---------- */
.subscribe { position: relative; }

.subscribe-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: min(340px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(23, 43, 77, 0.14);
  padding: 16px 18px;
  z-index: 60;
}

.subscribe-hint {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
}

.subscribe-row { display: flex; gap: 8px; }

.subscribe-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
}
.subscribe-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(61, 99, 255, 0.18);
}
.subscribe-input:disabled { opacity: .6; }

.subscribe-submit {
  flex: 0 0 auto;
  padding: 8px 14px;
  border: 1px solid var(--brand);
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: #ffffff;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.subscribe-submit:hover { background: #2f52e0; border-color: #2f52e0; }
.subscribe-submit:disabled { opacity: .6; cursor: default; }

.subscribe-error {
  margin: 8px 0 0;
  color: var(--red-text);
  font-size: 13px;
}
.subscribe-success {
  margin: 0;
  color: var(--ok-text);
  font-size: 14px;
  font-weight: 550;
  line-height: 1.5;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Banner de retorno de inscrição (?sub=) ---------- */
.sub-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 24px 0 0;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.sub-banner--ok      { background: #e7f7ec; border-color: #bfe8cc; color: var(--ok-text); }
.sub-banner--neutral { background: #eef1f5; border-color: var(--border); color: #44546f; }
.sub-banner--warn    { background: #fdf1de; border-color: #f3ddb0; color: var(--amber-text); }

.sub-banner-close {
  flex: 0 0 auto;
  background: none;
  border: 0;
  padding: 2px 6px;
  color: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  opacity: .7;
  border-radius: 4px;
}
.sub-banner-close:hover { opacity: 1; }
.sub-banner-close:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; }

/* ---------- Banner de status geral ---------- */
.banner {
  margin: 36px 0 28px;
  padding: 20px 24px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: #ffffff;
  background: var(--muted);
}
.banner-left {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.banner-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.25);
  position: relative;
}
/* check mark desenhado em CSS */
.banner-icon::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 4px;
  width: 5px;
  height: 10px;
  border: solid #ffffff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}
.banner-updated {
  font-size: 13.5px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.88);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.banner--operational { background: var(--ok); }
.banner--degraded    { background: var(--amber); }
.banner--degraded .banner-icon::after,
.banner--outage .banner-icon::after {
  /* bang "!" em vez de check para estados não-operacionais */
  content: "!";
  left: 0; top: 0;
  width: 22px; height: 22px;
  border: 0;
  transform: none;
  font-weight: 800;
  font-size: 15px;
  line-height: 22px;
  text-align: center;
  color: #ffffff;
}
.banner--outage      { background: var(--red); }
.banner--loading     { background: var(--muted); }
.banner--loading .banner-icon { animation: pulse 1.4s ease-in-out infinite; }
.banner--loading .banner-icon::after { display: none; }

@keyframes pulse { 0%,100% { opacity: .45; } 50% { opacity: 1; } }

/* ---------- Faixa de erro ---------- */
.fetch-error {
  margin: 0 0 24px;
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid #f3c9c9;
  background: #fdf0f0;
  color: var(--red-text);
  font-size: 14px;
}

/* ---------- Labels de seção ---------- */
.section-label {
  color: var(--text);
  font-size: 15px;
  font-weight: 650;
  margin: 0 0 16px;
  letter-spacing: -0.01em;
}

/* ---------- Card de componentes ---------- */
.groups {
  margin: 0 0 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.group + .group .group-title {
  border-top: 1px solid var(--border);
}
.group-title {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  margin: 0;
  padding: 16px 24px 10px;
  background: var(--surface-2);
}

/* ---------- Componente (linha) ---------- */
.component {
  padding: 18px 24px 20px;
  border-top: 1px solid var(--border);
}
.group-title + .component { border-top: none; }

.component-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.component-name {
  font-weight: 500;
  font-size: 15px;
  color: var(--text);
}
.component-status {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
}
.component-status--operational { color: var(--ok-text); }
.component-status--degraded    { color: var(--amber-text); }
.component-status--outage      { color: var(--red-text); }

/* ---------- Barra de uptime (a assinatura) ----------
   Janela adaptativa: as células PREENCHEM a largura total da barra
   independente da quantidade — poucas células ficam largas (visual
   "cheio" como a referência); 90 células voltam ao visual fino.
   min-width garante scroll horizontal em telas estreitas com 90 dias. */
.uptime-bar-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding-bottom: 2px;
}
.uptime-bar {
  display: flex;
  gap: 2px;
  min-width: 100%;
  height: 34px;
  align-items: stretch;
}
.cell {
  flex: 1 1 0%;
  min-width: 4px;
  border-radius: 2px;
  background: var(--nodata);
  transition: transform .08s ease, opacity .08s ease;
  cursor: default;
}
.uptime-bar .cell:hover { transform: scaleY(1.08); opacity: .82; }
.uptime-bar .cell:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

.cell--ok       { background: var(--ok); }
.cell--degraded { background: var(--amber); }
.cell--outage   { background: var(--red); }
.cell--nodata   { background: var(--nodata); }

.bar-axis {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  color: var(--muted);
  font-size: 12px;
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}
.bar-axis .bar-axis-mid { color: var(--muted); }

/* ---------- Incidentes abertos ---------- */
.open-incidents {
  margin: 36px 0 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.incident-open {
  border: 1px solid var(--border);
  border-left: 4px solid var(--amber);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 22px;
}
.incident-open.sev-critical { border-left-color: var(--red); }
.incident-open.sev-major    { border-left-color: #ff7a1a; }
.incident-open.sev-minor    { border-left-color: var(--amber); }

/* ---------- Histórico ---------- */
.incident-history { margin: 0 0 56px; }
.incident-list { display: flex; flex-direction: column; }

.incident-day-group { margin-bottom: 26px; }
.incident-day-group:last-child { margin-bottom: 0; }
.incident-day-label {
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
  padding-bottom: 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.incident-item { padding: 4px 0 16px; }
.incident-item:last-child { padding-bottom: 0; }

.incident-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}
.incident-title { font-weight: 600; font-size: 15px; color: var(--text); }

.incident-status-badge {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  padding: 2px 9px; border-radius: 999px;
}
.incident-status-badge.resolved { color: var(--ok-text); background: #e7f7ec; }
.incident-status-badge.ongoing  { color: var(--amber-text); background: #fdf1de; }

.sev-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 2px 9px;
  border-radius: 999px;
  color: var(--muted);
  background: #eef1f5;
}
.sev-badge.sev-minor    { color: var(--muted);      background: #eef1f5; }
.sev-badge.sev-major    { color: #b04a00;           background: #fdeadb; }
.sev-badge.sev-critical { color: var(--red-text);   background: #fdeaea; }

.incident-body { color: var(--muted); font-size: 14px; margin: 4px 0 8px; line-height: 1.6; }
.incident-time { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.incident-empty {
  color: var(--muted);
  font-size: 14px;
  padding: 20px 0;
  text-align: center;
}

/* ---------- Tooltip ---------- */
.tooltip {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  background: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font-size: 12.5px;
  color: #ffffff;
  box-shadow: 0 6px 20px rgba(23, 43, 77, 0.22);
  max-width: 240px;
  transform: translate(-50%, -100%);
  white-space: nowrap;
}
.tooltip .tt-date { color: rgba(255, 255, 255, 0.72); font-size: 11.5px; margin-bottom: 2px; }
.tooltip .tt-value { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Skeleton ---------- */
.skeleton { display: flex; flex-direction: column; }
.skeleton-row {
  height: 92px;
  border-top: 1px solid var(--border);
  background: linear-gradient(90deg, #ffffff 0%, #f1f3f6 50%, #ffffff 100%);
  background-size: 200% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
}
.skeleton-row:first-child { border-top: none; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0 44px;
  color: var(--muted);
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
  text-align: center;
}
.footer-year::before { content: "· "; opacity: .6; }

/* ---------- Responsivo ---------- */
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  body { font-size: 14px; }
  .header-inner { height: 60px; }
  .logo { height: 26px; }
  .brand-status { font-size: 14px; padding-left: 10px; gap: 10px; }
  .subscribe-btn { padding: 7px 12px; font-size: 12.5px; }
  .banner { flex-direction: column; align-items: flex-start; gap: 8px; padding: 18px 18px; }
  .banner-left { font-size: 16px; }
  .component { padding: 16px 16px 18px; }
  .group-title { padding: 14px 16px 10px; }
  .cell { min-width: 3px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition: none !important; }
}
