:root {
  --bg: #ffffff;
  --text: #08090d;
  --muted: #8a8f9c;
  --line: #e7e8ec;
  --line-strong: #d8dbe2;
  --green: #23c29a;
  --green-soft: #d9f7ef;
  --yellow: #ffbe2e;
  --yellow-soft: #fff4d8;
  --orange: #ff7b66;
  --orange-soft: #ffe7e1;
  --red: #e44e4e;
  --red-soft: #ffe2e2;
  --dark: #25252c;
  --font: "Aptos", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
}

body {
  margin: 0;
  border-top: 6px solid #0c5b97;
}

a {
  color: inherit;
}

a:focus-visible {
  outline: 3px solid rgba(12, 91, 151, 0.22);
  outline-offset: 3px;
}

.status-page {
  width: min(930px, calc(100% - 40px));
  margin: 0 auto;
  padding: 36px 0 28px;
}

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

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.58rem;
  font-weight: 780;
  letter-spacing: 0;
  text-decoration: none;
}

.logo img {
  display: block;
  width: 36px;
  height: 36px;
  border-radius: 6px;
}

.status-panel {
  overflow: hidden;
  border: 1px solid var(--green);
  border-radius: 8px;
  background: #fff;
}

.status-panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 60px;
  padding: 15px 20px;
  background: var(--green-soft);
}

.status-panel h1 {
  margin: 0;
  font-size: 1.22rem;
  line-height: 1.2;
}

.status-panel p {
  margin: 0;
  padding: 17px 20px;
  font-size: 1.02rem;
  line-height: 1.35;
}

.status-panel.status-degraded {
  border-color: var(--yellow);
}

.status-panel.status-degraded .status-panel-title {
  background: var(--yellow-soft);
}

.status-panel.status-partialoutage {
  border-color: var(--yellow);
}

.status-panel.status-partialoutage .status-panel-title {
  background: var(--yellow-soft);
}

.status-panel.status-majoroutage {
  border-color: var(--red);
}

.status-panel.status-majoroutage .status-panel-title {
  background: var(--red-soft);
}

.status-panel.status-unknown {
  border-color: var(--line-strong);
}

.status-panel.status-unknown .status-panel-title {
  background: #f4f5f7;
}

.monitoring-panel {
  margin-top: 14px;
  padding: 12px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #f7f8fa;
}

.monitoring-panel.monitoring-stale {
  border-color: var(--yellow);
  background: var(--yellow-soft);
}

.monitoring-panel strong {
  display: block;
  font-size: 0.98rem;
}

.monitoring-panel p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.35;
}

.status-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
}

.status-icon svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

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

.status-icon.status-partialoutage {
  background: var(--yellow);
}

.status-icon.status-majoroutage {
  background: var(--red);
}

.status-icon.status-unknown {
  background: #a9aeb8;
}

.systems-card {
  overflow: hidden;
  margin-top: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 6px rgba(24, 29, 38, 0.1);
}

.systems-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  padding: 15px 20px;
  border-bottom: 1px solid #f0f1f4;
}

.period-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.period-arrow {
  color: #b4b8c2;
  font-size: 1.45rem;
  line-height: 1;
  text-decoration: none;
}

.period-arrow:not(.disabled):hover {
  color: var(--text);
}

.period-arrow.disabled {
  cursor: default;
  opacity: 0.35;
}

.systems-header h2,
.period-heading h2 {
  margin: 0;
  font-size: 1.15rem;
}

.systems-header span,
.system-name span:not(.status-icon),
.uptime {
  color: var(--muted);
}

.systems-header span {
  font-size: 1rem;
}

.system-row {
  padding: 0;
}

.system-row + .system-row {
  border-top: 1px solid #f0f1f4;
}

.system-row > summary {
  display: block;
  padding: 17px 20px 16px;
  cursor: pointer;
  list-style: none;
}

.system-row > summary::-webkit-details-marker {
  display: none;
}

.system-row-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.system-name {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 9px;
  font-size: 1.02rem;
}

.system-name strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.system-name span:not(.status-icon) {
  white-space: nowrap;
}

.chevron {
  width: 8px;
  height: 8px;
  color: var(--text);
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.16s ease;
}

.system-row[open] .chevron {
  transform: rotate(225deg) translate(-2px, -2px);
}

.system-row[open] > summary .uptime-bars {
  display: none;
}

.uptime {
  flex: 0 0 auto;
  font-size: 1rem;
}

.uptime-bars {
  display: grid;
  grid-template-columns: repeat(var(--bar-count), 1fr);
  gap: 1px;
  margin-top: 10px;
}

.uptime-bar {
  display: block;
  min-width: 0;
  height: 16px;
  border-radius: 2px;
  background: var(--green);
}

.uptime-bar:focus-visible {
  outline: 2px solid rgba(12, 91, 151, 0.35);
  outline-offset: 2px;
}

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

.uptime-bar.status-partialoutage {
  background: var(--yellow);
}

.uptime-bar.status-majoroutage {
  background: var(--red);
}

.uptime-bar.status-unknown {
  background: #d8dbe2;
}

.status-tooltip {
  position: absolute;
  z-index: 1000;
  width: max-content;
  max-width: min(360px, calc(100vw - 24px));
  padding: 12px 14px;
  border: 1px solid #dde0e7;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 26px rgba(24, 29, 38, 0.14);
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.status-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.status-tooltip-date {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.3;
}

.status-tooltip-body {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin-top: 8px;
}

.status-tooltip-body strong {
  font-size: 1rem;
  line-height: 1.35;
}

.status-tooltip-icon {
  position: relative;
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 999px;
  background: var(--green);
}

.status-tooltip-icon.status-degraded,
.status-tooltip-icon.status-partialoutage {
  background: var(--yellow);
}

.status-tooltip-icon.status-majoroutage {
  background: var(--red);
}

.status-tooltip-icon.status-unknown {
  background: #a9aeb8;
}

.component-details {
  display: grid;
  gap: 14px;
  padding: 0 20px 18px;
}

.component-row {
  padding-left: 0;
}

.component-name {
  font-size: 1rem;
}

.component-bars {
  opacity: 0.92;
}

.history-card {
  overflow: hidden;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  padding: 18px 20px;
  border-bottom: 1px solid #f0f1f4;
}

.history-header h1 {
  margin: 0;
  font-size: 1.24rem;
}

.history-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.current-status-link {
  flex: 0 0 auto;
  color: var(--text);
  font-weight: 720;
  text-decoration: none;
}

.history-section {
  padding: 18px 20px;
}

.history-section + .history-section {
  border-top: 1px solid #f0f1f4;
}

.history-section h2 {
  margin: 0 0 14px;
  font-size: 1.05rem;
}

.history-list {
  display: grid;
  gap: 14px;
}

.history-days {
  display: grid;
  gap: 8px;
}

.history-day {
  border: 1px solid #eef0f4;
  border-radius: 8px;
  background: #fff;
}

.history-day > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 48px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}

.history-day > summary::-webkit-details-marker {
  display: none;
}

.history-day > summary span {
  color: var(--muted);
  white-space: nowrap;
}

.history-day .history-list {
  padding: 0 14px 14px;
}

.history-entry,
.history-empty {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.history-entry.active {
  padding-bottom: 14px;
  border-bottom: 1px solid #f0f1f4;
}

.history-entry-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.history-entry-heading span,
.history-entry time,
.history-empty p {
  color: var(--muted);
}

.history-entry p,
.history-empty p {
  margin: 4px 0;
}

.history-entry time {
  font-size: 0.9rem;
}

.history-empty {
  min-height: 58px;
  align-items: center;
}

.history-action {
  display: flex;
  justify-content: center;
  margin-top: 28px;
}

.history-action a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 16px;
  border: 1px solid #cfd3dc;
  border-radius: 8px;
  background: #fff;
  font-size: 0.98rem;
  font-weight: 720;
  text-decoration: none;
}

.calendar-icon {
  position: relative;
  width: 18px;
  height: 18px;
  border: 2px solid var(--text);
  border-radius: 4px;
}

.calendar-icon::before,
.calendar-icon::after {
  position: absolute;
  top: -6px;
  width: 3px;
  height: 7px;
  border-radius: 999px;
  background: var(--text);
  content: "";
}

.calendar-icon::before {
  left: 4px;
}

.calendar-icon::after {
  right: 4px;
}

.announcement-panel {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.announcement-entry {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
}

.announcement-entry p {
  margin: 4px 0;
  line-height: 1.35;
}

.announcement-entry time {
  color: var(--muted);
  font-size: 0.88rem;
}

.admin-page {
  width: min(980px, calc(100% - 40px));
}

.admin-masthead {
  margin-bottom: 20px;
}

.admin-card {
  margin-top: 18px;
}

.admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  padding: 16px 20px;
  border-bottom: 1px solid #f0f1f4;
}

.admin-card-header h1,
.admin-card-header h2 {
  margin: 0;
  font-size: 1.18rem;
}

.admin-card-header p {
  margin: 5px 0 0;
  color: var(--muted);
}

.admin-section {
  padding: 18px 20px;
}

.admin-section h2 {
  margin: 0 0 14px;
  font-size: 1.04rem;
}

.admin-notice,
.admin-empty {
  padding: 14px 20px;
  color: var(--muted);
}

.admin-empty code {
  color: var(--text);
}

.admin-notice {
  color: #14735f;
  background: var(--green-soft);
}

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

.admin-field {
  display: grid;
  gap: 6px;
}

.admin-field label,
.admin-checkbox {
  font-weight: 680;
}

.admin-field input,
.admin-field textarea,
.admin-field select {
  width: 100%;
  border: 1px solid #cfd3dc;
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.admin-field textarea {
  resize: vertical;
}

.admin-field span {
  color: var(--red);
  font-size: 0.88rem;
}

.admin-form-row {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(160px, 1fr);
  gap: 14px;
  align-items: end;
}

.admin-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
}

.admin-primary-button,
.admin-secondary-button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 8px 13px;
  font: inherit;
  font-weight: 720;
  cursor: pointer;
}

.admin-primary-button {
  justify-self: start;
  background: var(--dark);
  color: #fff;
}

.admin-secondary-button {
  border-color: #cfd3dc;
  background: #fff;
  color: var(--text);
}

.admin-secondary-button.danger {
  color: var(--red);
}

.admin-list {
  display: grid;
}

.admin-list-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 16px 20px;
}

.admin-list-row + .admin-list-row {
  border-top: 1px solid #f0f1f4;
}

.admin-list-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.admin-list-heading span,
.admin-list-row small {
  color: var(--muted);
}

.admin-list-row p {
  margin: 4px 0;
  line-height: 1.35;
}

.admin-row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 760px) {
  .status-page {
    width: min(100% - 24px, 930px);
    padding-top: 26px;
  }

  .masthead,
  .system-row-heading,
  .systems-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .systems-header {
    gap: 6px;
  }

  .history-header,
  .history-entry-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .period-heading {
    flex-wrap: wrap;
  }

  .system-name {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .uptime-bars {
    gap: 0;
  }

  .admin-form-row,
  .admin-list-row {
    grid-template-columns: 1fr;
  }

  .admin-card-header,
  .admin-list-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-row-actions {
    justify-content: flex-start;
  }

}
