:root {
  --bg: #f7f3ea;
  --panel: #fffdf7;
  --panel-muted: #fcf8ef;
  --ink: #1f221d;
  --muted: #7a7d74;
  --border: #ddd7c8;
  --green: #78af24;
  --yellow: #d2a120;
  --orange: #ef9428;
  --red: #e25343;
  --gray: #b7b3a6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
}

.page-shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 36px 24px 56px;
}

.page-head {
  display: flex;
  gap: 20px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 18px;
  padding: 22px 30px;
  border: 0;
  border-radius: 18px;
  background: var(--panel);
  position: relative;
  overflow: hidden;
}

.page-head::before {
  content: none;
}

.page-head--operational {
  background: linear-gradient(180deg, #78af24 0%, #71a920 100%);
  color: #f8fff0;
}

.page-head--degraded {
  background: linear-gradient(180deg, #d2a120 0%, #c69618 100%);
  color: #fff8eb;
}

.page-head--partial {
  background: linear-gradient(180deg, #ef9428 0%, #e78617 100%);
  color: #fff7ef;
}

.page-head--major {
  background: linear-gradient(180deg, #e25343 0%, #d84435 100%);
  color: #fff5f3;
}

.page-head--maintenance,
.page-head--neutral {
  background: linear-gradient(180deg, #8f8b7d 0%, #827e72 100%);
  color: #fffdf8;
}

.page-head__main {
  min-width: 0;
}

.page-head__headline-row {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0 0 6px;
  color: inherit;
  opacity: 0.78;
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.page-head h1 {
  margin: 0;
  font-size: clamp(1.9rem, 3.1vw, 2.8rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
}

.page-summary {
  margin: 6px 0 0;
  max-width: 640px;
  color: inherit;
  opacity: 0.9;
  font-size: 0.92rem;
  line-height: 1.45;
}

.page-head__meta {
  display: grid;
  gap: 8px;
  justify-items: end;
  text-align: right;
}

.page-updated {
  margin: 0;
  color: inherit;
  opacity: 0.84;
  font-size: 0.84rem;
  white-space: nowrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill--operational {
  background: rgba(255, 255, 255, 0.18);
  color: #f8fff0;
}

.status-pill--degraded {
  background: rgba(255, 255, 255, 0.18);
  color: #fff8eb;
}

.status-pill--partial {
  background: rgba(255, 255, 255, 0.18);
  color: #fff7ef;
}

.status-pill--major {
  background: rgba(255, 255, 255, 0.18);
  color: #fff5f3;
}

.status-pill--maintenance,
.status-pill--neutral {
  background: rgba(255, 255, 255, 0.18);
  color: #fffdf8;
}

.status-table {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel);
  overflow: visible;
}

.status-table__head {
  display: flex;
  gap: 20px;
  align-items: end;
  justify-content: space-between;
  padding: 16px 22px 12px;
  border-bottom: 1px solid var(--border);
}

.status-table__head h2 {
  margin: 0;
  font-size: 1.02rem;
}

.status-table__head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  max-width: 360px;
  text-align: right;
}

.incidents-section {
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel);
  overflow: hidden;
}

.incidents-section__head {
  display: flex;
  gap: 20px;
  align-items: end;
  justify-content: space-between;
  padding: 16px 22px 12px;
  border-bottom: 1px solid var(--border);
}

.incidents-section__head h2 {
  margin: 0;
  font-size: 1.02rem;
}

.incidents-section__head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  max-width: 360px;
  text-align: right;
}

.incident-groups {
  display: grid;
}

.incident-day-group {
  padding: 16px 22px;
  border-top: 1px solid var(--border);
}

.incident-day-group:first-child {
  border-top: 0;
}

.incident-day-group__heading {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.incident-day-group__list {
  display: grid;
  gap: 10px;
}

.incident-card {
  padding: 11px 14px;
  border: 1px solid rgba(221, 215, 200, 0.72);
  border-radius: 14px;
  background: #fffdf8;
}

.incident-card--major {
  background: linear-gradient(90deg, rgba(226, 83, 67, 0.11) 0%, rgba(226, 83, 67, 0.035) 34%, rgba(255, 253, 248, 1) 100%);
  border-color: rgba(226, 83, 67, 0.16);
  box-shadow: inset 4px 0 0 rgba(226, 83, 67, 0.98);
}

.incident-card--partial {
  background: linear-gradient(90deg, rgba(239, 148, 40, 0.1) 0%, rgba(239, 148, 40, 0.03) 34%, rgba(255, 253, 248, 1) 100%);
  border-color: rgba(239, 148, 40, 0.16);
  box-shadow: inset 4px 0 0 rgba(239, 148, 40, 0.95);
}

.incident-card__header {
  display: flex;
  gap: 12px;
  align-items: start;
  justify-content: space-between;
}

.incident-card__title {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.25;
}

.incident-card__severity {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.incident-card__severity--major {
  background: rgba(226, 83, 67, 0.14);
  color: #bb3226;
}

.incident-card__severity--partial {
  background: rgba(239, 148, 40, 0.15);
  color: #b7680d;
}

.incident-card__detail {
  margin: 6px 0 0;
  color: rgba(31, 34, 29, 0.84);
  font-size: 0.82rem;
  line-height: 1.45;
}

.incident-card__meta {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.4;
}

.incident-empty-state {
  padding: 22px;
  color: var(--muted);
  font-size: 0.9rem;
}

.component-row {
  padding: 16px 22px 18px;
  border-top: 1px solid var(--border);
  position: relative;
  background: transparent;
  transition:
    background-color 140ms ease,
    box-shadow 140ms ease,
    border-color 140ms ease;
}

.component-row:first-child {
  border-top: 0;
}

.component-row--operational {
  background: transparent;
}

.component-row--degraded {
  background: linear-gradient(90deg, rgba(210, 161, 32, 0.1) 0%, rgba(210, 161, 32, 0.03) 38%, rgba(255, 253, 247, 0) 100%);
  box-shadow: inset 4px 0 0 rgba(210, 161, 32, 0.92);
}

.component-row--partial {
  background: linear-gradient(90deg, rgba(239, 148, 40, 0.11) 0%, rgba(239, 148, 40, 0.035) 38%, rgba(255, 253, 247, 0) 100%);
  box-shadow: inset 4px 0 0 rgba(239, 148, 40, 0.95);
}

.component-row--major {
  background: linear-gradient(90deg, rgba(226, 83, 67, 0.12) 0%, rgba(226, 83, 67, 0.04) 40%, rgba(255, 253, 247, 0) 100%);
  box-shadow: inset 5px 0 0 rgba(226, 83, 67, 0.98);
}

.component-row--maintenance,
.component-row--neutral {
  background: linear-gradient(90deg, rgba(183, 179, 166, 0.12) 0%, rgba(183, 179, 166, 0.035) 38%, rgba(255, 253, 247, 0) 100%);
  box-shadow: inset 4px 0 0 rgba(183, 179, 166, 0.92);
}

.component-row__header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
}

.component-row__title {
  margin: 0;
  font-size: clamp(1.12rem, 1.9vw, 1.45rem);
  line-height: 1.16;
}

.component-row__title-line {
  display: flex;
  gap: 10px;
  align-items: center;
}

.component-row__indicator {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex-shrink: 0;
  background: var(--gray);
}

.component-row__indicator--operational {
  background: var(--green);
}

.component-row__indicator--degraded {
  background: var(--yellow);
}

.component-row__indicator--partial {
  background: var(--orange);
}

.component-row__indicator--major {
  background: var(--red);
}

.component-row__indicator--maintenance,
.component-row__indicator--neutral {
  background: var(--gray);
}

.component-row__description {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  max-width: 40rem;
  line-height: 1.45;
  opacity: 0.92;
}

.component-row__status-block {
  display: grid;
  gap: 3px;
  justify-items: center;
  align-content: center;
  text-align: center;
  justify-self: end;
  width: fit-content;
  min-width: 148px;
  max-width: min(196px, 100%);
  padding: 9px 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, #fbf7ee 0%, #f5efe3 100%);
  border: 1px solid rgba(221, 215, 200, 0.92);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    0 6px 16px rgba(31, 34, 29, 0.04);
}

.component-row__status-block--operational {
  background: linear-gradient(180deg, #78af24 0%, #71a920 100%);
  border-color: rgba(101, 153, 23, 0.78);
  color: #f8fff0;
  width: auto;
  min-width: 0;
  max-width: none;
  padding: 8px 18px;
  border-radius: 999px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    0 6px 14px rgba(86, 132, 19, 0.1);
}

.component-row__status-block--degraded {
  background: linear-gradient(180deg, #f0bb33 0%, #d79b17 100%);
  border-color: rgba(186, 132, 16, 0.56);
  color: #fff8eb;
}

.component-row__status-block--partial {
  background: linear-gradient(180deg, #ef9428 0%, #e78617 100%);
  border-color: rgba(212, 118, 11, 0.56);
  color: #fff7ef;
}

.component-row__status-block--major {
  background: linear-gradient(180deg, #e25343 0%, #d84435 100%);
  border-color: rgba(186, 53, 37, 0.56);
  color: #fff5f3;
}

.component-row__status-block--maintenance,
.component-row__status-block--neutral {
  background: linear-gradient(180deg, #8f8b7d 0%, #827e72 100%);
  border-color: rgba(120, 116, 104, 0.56);
  color: #fffdf8;
}

.component-row__status {
  flex-shrink: 0;
  font-size: clamp(0.84rem, 1.05vw, 0.98rem);
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.component-row__status-meta {
  color: inherit;
  opacity: 0.88;
  font-size: 0.68rem;
  line-height: 1.35;
}

.component-row__status--operational {
  color: inherit;
}

.component-row__status--degraded {
  color: inherit;
}

.component-row__status--partial {
  color: inherit;
}

.component-row__status--major {
  color: inherit;
}

.component-row__status--maintenance,
.component-row__status--neutral {
  color: inherit;
}

.component-row__detail {
  margin: 8px 0 0;
  display: flex;
  gap: 8px;
  align-items: start;
  padding: 9px 10px;
  border-left: 3px solid var(--gray);
  border-radius: 0 10px 10px 0;
  background: var(--panel-muted);
  color: rgba(31, 34, 29, 0.84);
  font-size: 0.76rem;
  line-height: 1.38;
  max-width: 44rem;
}

.component-row__detail[hidden] {
  display: none;
}

.component-row__detail-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  background: var(--gray);
  margin-top: 1px;
}

.component-row__detail--degraded {
  border-left-color: var(--yellow);
}

.component-row__detail--degraded .component-row__detail-icon {
  background: var(--yellow);
}

.component-row__detail--partial {
  border-left-color: var(--orange);
}

.component-row__detail--partial .component-row__detail-icon {
  background: var(--orange);
}

.component-row__detail--major {
  border-left-color: var(--red);
}

.component-row__detail--major .component-row__detail-icon {
  background: var(--red);
}

.component-row__detail--maintenance {
  border-left-color: var(--gray);
}

.component-row__detail--maintenance .component-row__detail-icon {
  background: var(--gray);
}

.component-row__history-shell {
  position: relative;
  margin-top: 10px;
}

.history-bars {
  display: grid;
  grid-template-columns: repeat(90, minmax(0, 1fr));
  gap: 4px;
}

.history-bar {
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 2px;
  appearance: none;
  background: var(--gray);
  cursor: default;
}

.history-bar--operational {
  background: var(--green);
}

.history-bar--degraded {
  background: var(--yellow);
}

.history-bar--partial {
  background: var(--orange);
}

.history-bar--major {
  background: var(--red);
}

.history-bar--maintenance,
.history-bar--no_data {
  background: var(--gray);
}

.component-row__timeline {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.8rem;
}

.component-row__timeline span:last-child {
  text-align: right;
}

.component-row__uptime {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.component-row__uptime::before,
.component-row__uptime::after {
  content: "";
  width: clamp(56px, 13vw, 180px);
  height: 1px;
  background: var(--gray);
}

.history-tooltip {
  position: absolute;
  left: 0;
  top: -14px;
  width: min(300px, calc(100vw - 48px));
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 253, 247, 0.98);
  box-shadow: 0 18px 36px rgba(31, 34, 29, 0.12);
  transform: translate(-50%, calc(-100% - 8px));
  z-index: 4;
  pointer-events: none;
}

.history-tooltip[hidden] {
  display: none;
}

.history-tooltip__date {
  margin: 0 0 10px;
  font-size: 0.94rem;
  font-weight: 700;
}

.history-tooltip__state-list {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.history-tooltip__state-list:empty {
  display: none;
}

.history-tooltip__state-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 9px 10px;
  border-radius: 10px;
  background: var(--panel-muted);
  font-size: 0.84rem;
}

.history-tooltip__state-label {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-weight: 700;
}

.history-tooltip__state-icon {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 999px;
}

.history-tooltip__state-icon--operational {
  background: var(--green);
}

.history-tooltip__state-icon--degraded {
  background: var(--yellow);
}

.history-tooltip__state-icon--partial {
  background: var(--orange);
}

.history-tooltip__state-icon--major {
  background: var(--red);
}

.history-tooltip__state-icon--maintenance,
.history-tooltip__state-icon--neutral {
  background: var(--gray);
}

.history-tooltip__duration {
  font-weight: 700;
}

.history-tooltip__summary {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.42;
}

.empty-state,
.error-state {
  padding: 22px;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 980px) {
  .component-row__header,
  .incidents-section__head,
  .status-table__head,
  .page-head {
    flex-direction: column;
    align-items: start;
  }

  .component-row__status-block {
    text-align: center;
    justify-items: center;
    justify-self: start;
    width: fit-content;
    min-width: 0;
    max-width: 100%;
  }

  .history-bars {
    gap: 3px;
  }

  .history-bar {
    height: 22px;
  }

  .component-row__timeline {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .component-row__timeline span:last-child {
    text-align: left;
  }

  .component-row__uptime {
    justify-content: start;
  }

  .component-row__uptime::before,
  .component-row__uptime::after {
    display: none;
  }

  .page-updated {
    white-space: normal;
  }

  .status-table__head p {
    max-width: none;
    text-align: left;
  }

  .incidents-section__head p {
    max-width: none;
    text-align: left;
  }
}

@media (max-width: 640px) {
  .page-shell {
    padding: 24px 16px 40px;
  }

  .status-table__head,
  .incidents-section__head,
  .incident-day-group,
  .component-row {
    padding-left: 16px;
    padding-right: 16px;
  }

  .history-bar {
    height: 18px;
  }

  .history-tooltip {
    width: min(280px, calc(100vw - 32px));
  }

  .incident-card__header {
    flex-direction: column;
  }
}
