:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --panel: #ffffff;
  --panel-soft: #f1f4f7;
  --text: #050505;
  --muted: #657486;
  --line: #d0d4d9;
  --green: #00856f;
  --green-bg: #e8f6ee;
  --yellow: #f0b429;
  --yellow-bg: #fff3d8;
  --orange: #ff5a1f;
  --red: #d70b2c;
  --red-bg: #fde8e8;
  --blue: #1167ff;
  --blue-bg: #e8f1fb;
  --focus: #1f6feb;
  --shadow: 0 10px 30px rgba(21, 25, 31, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid #1b4f80;
  border-radius: 6px;
  background: #1b4f80;
  color: #fff;
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 700;
}

button.secondary,
.button.secondary {
  border-color: var(--line);
  background: var(--panel);
  color: var(--text);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  padding: 8px 10px;
}

textarea {
  min-height: 112px;
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.site-shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 10;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  padding: 14px clamp(16px, 4vw, 48px);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 800;
}

.brand-mark {
  width: 12px;
  height: 28px;
  border-radius: 4px;
  background: linear-gradient(180deg, #138a47, #2368ad);
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
}

.nav a {
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  padding: 8px 10px;
  white-space: nowrap;
}

.nav a.active,
.nav a:hover {
  background: var(--panel-soft);
  color: var(--text);
}

.app {
  width: min(900px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 56px;
}

.public-status {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 26px;
}

.service-status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.service-status-cell {
  display: grid;
  min-height: 96px;
  grid-template-columns: minmax(0, 1fr) 36px;
  align-items: center;
  gap: 18px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 24px 30px;
}

.service-status-cell:nth-child(2n) {
  border-right: 0;
}

.service-status-cell:nth-last-child(2):nth-child(odd),
.service-status-cell:last-child:nth-child(even) {
  border-bottom: 0;
}

.service-status-cell:last-child:nth-child(odd) {
  grid-column: 1 / -1;
  border-right: 0;
  border-bottom: 0;
}

.service-status-cell h2 {
  min-width: 0;
  margin: 0;
  color: #060606;
  font-size: 25px;
  font-weight: 800;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.status-icon {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  justify-self: end;
  color: var(--muted);
  font-size: 25px;
  font-weight: 900;
  line-height: 1;
}

.status-icon.operational {
  color: var(--green);
}

.status-icon.degraded {
  color: var(--yellow);
  font-size: 30px;
}

.status-icon.partial_outage {
  color: var(--orange);
  font-size: 26px;
}

.status-icon.major_outage {
  color: var(--red);
  font-size: 30px;
}

.status-icon.maintenance {
  color: var(--blue);
  font-size: 22px;
}

.maintenance-strip {
  display: grid;
  gap: 14px;
}

.maintenance-strip h2,
.past-incidents h1 {
  margin: 0;
  color: #000;
  font-size: 42px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.15;
}

.maintenance-strip-list {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.maintenance-status-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  align-items: center;
  gap: 20px;
  border-top: 1px solid var(--line);
  padding: 22px 30px;
}

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

.maintenance-status-row h3 {
  margin: 0 0 6px;
  font-size: 24px;
  line-height: 1.15;
}

.maintenance-status-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 18px;
}

.maintenance-services {
  color: #313b46;
  font-weight: 700;
}

.status-legend {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #080808;
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
}

.legend-item .status-icon {
  justify-self: auto;
}

.legend-control {
  display: flex;
  justify-content: flex-start;
}

.link-button {
  min-height: auto;
  border: 0;
  background: transparent;
  color: #1b4f80;
  padding: 0;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.38);
  padding: 20px;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: min(360px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.2);
  padding: 18px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.modal-head h2 {
  margin: 0;
  font-size: 22px;
}

.icon-button {
  width: 36px;
  min-height: 36px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.past-incidents {
  display: grid;
  gap: 34px;
  padding-top: 36px;
}

.incident-day-list {
  display: grid;
  gap: 60px;
}

.incident-day h2 {
  margin: 0;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  color: #050505;
  font-size: 31px;
  font-weight: 800;
  line-height: 1.15;
}

.incident-day p {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 25px;
  line-height: 1.35;
}

.incident-day .incident-row {
  padding: 18px 0;
}

.incident-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  color: var(--muted);
  font-weight: 800;
}

.incident-pagination a {
  color: #1b4f80;
}

.incident-pagination a.disabled {
  color: var(--muted);
  pointer-events: none;
  opacity: 0.45;
}

.stack {
  display: grid;
  gap: 18px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hero-status,
.panel,
.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero-status {
  display: grid;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: clamp(22px, 4vw, 36px);
}

.hero-status h1,
.page-title h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.06;
}

.hero-status p,
.page-title p {
  margin: 10px 0 0;
  color: var(--muted);
}

.status-light {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--green-bg);
  border: 10px solid #fff;
  box-shadow: 0 0 0 1px var(--line), inset 0 0 0 14px var(--green);
}

.status-major_outage .status-light {
  background: var(--red-bg);
  box-shadow: 0 0 0 1px var(--line), inset 0 0 0 14px var(--red);
}

.status-partial_outage .status-light {
  background: var(--yellow-bg);
  box-shadow: 0 0 0 1px var(--line), inset 0 0 0 14px var(--yellow);
}

.status-maintenance .status-light {
  background: var(--blue-bg);
  box-shadow: 0 0 0 1px var(--line), inset 0 0 0 14px var(--blue);
}

.panel {
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.panel-head h2,
.card h3,
.section-title {
  margin: 0;
}

.section-title {
  font-size: 20px;
}

.card {
  padding: 16px;
}

.admin-session {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.admin-login {
  max-width: 520px;
}

.service-row,
.incident-row,
.maintenance-row,
.update-row {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 14px 0;
}

.incident-row.with-status-timeline {
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 20px;
}

.incident-row-body {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.incident-status-timeline {
  display: grid;
  gap: 0;
  align-content: start;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
}

.incident-status-timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 8px;
  min-height: 32px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  text-transform: capitalize;
}

.incident-status-timeline li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 15px;
  bottom: -1px;
  left: 5px;
  width: 2px;
  background: var(--line);
}

.timeline-marker {
  position: relative;
  z-index: 1;
  width: 12px;
  height: 12px;
  margin-top: 1px;
  border: 2px solid var(--blue);
  border-radius: 50%;
  background: #fff;
}

.incident-status-timeline .resolved .timeline-marker {
  border-color: var(--green);
  background: var(--green);
}

.incident-status-timeline .investigating .timeline-marker {
  border-color: var(--red);
}

.incident-status-timeline .identified .timeline-marker,
.incident-status-timeline .monitoring .timeline-marker {
  border-color: var(--blue);
}

.service-row:first-child,
.incident-row:first-child,
.maintenance-row:first-child,
.update-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.row-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.row-title {
  font-weight: 800;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 13px;
}

.pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 4px 10px;
  white-space: nowrap;
}

.pill.operational,
.pill.resolved,
.pill.completed {
  background: var(--green-bg);
  color: var(--green);
}

.pill.degraded,
.pill.partial_outage,
.pill.minor,
.pill.monitoring,
.pill.scheduled {
  background: var(--yellow-bg);
  color: var(--yellow);
}

.pill.major_outage,
.pill.major,
.pill.critical,
.pill.investigating,
.pill.cancelled {
  background: var(--red-bg);
  color: var(--red);
}

.pill.maintenance,
.pill.identified,
.pill.in_progress {
  background: var(--blue-bg);
  color: var(--blue);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.timeline {
  position: relative;
  display: grid;
  gap: 0;
}

.update-row {
  grid-template-columns: 20px 1fr;
}

.dot {
  width: 12px;
  height: 12px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--blue);
}

.empty,
.notice {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  padding: 18px;
}

.notice.error {
  border-color: #f2b8b8;
  background: var(--red-bg);
  color: var(--red);
}

.form {
  display: grid;
  gap: 14px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.check {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
}

.check input {
  width: auto;
  min-height: auto;
}

.tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
  overflow-x: auto;
}

.tabs a {
  border-radius: 6px 6px 0 0;
  color: var(--muted);
  font-weight: 800;
  padding: 10px 12px;
  white-space: nowrap;
}

.tabs a.active {
  background: var(--panel);
  color: var(--text);
}

.month-group {
  display: grid;
  gap: 12px;
}

@media (max-width: 780px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .hero-status {
    grid-template-columns: 1fr;
  }

  .grid.two,
  .grid.three,
  .checkbox-grid {
    grid-template-columns: 1fr;
  }

  .app {
    width: min(100% - 28px, 900px);
    padding-top: 14px;
  }

  .public-status {
    gap: 28px;
  }

  .service-status-grid {
    grid-template-columns: 1fr;
  }

  .service-status-cell,
  .service-status-cell:nth-child(2n),
  .service-status-cell:nth-last-child(2):nth-child(odd),
  .service-status-cell:last-child:nth-child(even),
  .service-status-cell:last-child:nth-child(odd) {
    min-height: 78px;
    grid-column: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 20px 18px;
  }

  .service-status-cell:last-child {
    border-bottom: 0;
  }

  .service-status-cell h2 {
    font-size: 22px;
  }

  .past-incidents {
    gap: 24px;
    padding-top: 22px;
  }

  .maintenance-strip h2,
  .past-incidents h1 {
    font-size: 34px;
  }

  .incident-day-list {
    gap: 42px;
  }

  .incident-day h2 {
    font-size: 26px;
  }

  .incident-day p {
    font-size: 20px;
  }

  .maintenance-status-row {
    padding: 18px;
  }

  .incident-row.with-status-timeline {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .incident-status-timeline {
    grid-template-columns: repeat(4, minmax(0, max-content));
    gap: 10px;
  }

  .incident-status-timeline li {
    min-height: 0;
  }

  .incident-status-timeline li:not(:last-child)::after {
    display: none;
  }

  .incident-pagination {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-session {
    align-items: stretch;
    flex-direction: column;
  }

  .row-main {
    align-items: flex-start;
    flex-direction: column;
  }
}
