:root {
  --bg: #050505;
  --bg-panel: rgba(255, 255, 255, 0.05);
  --bg-modal: rgba(10, 10, 10, 0.96);
  --bg-row: rgba(255, 255, 255, 0.03);
  --bg-overlay: rgba(0, 0, 0, 0.78);
  --text: #f5f7fa;
  --muted: #95a0aa;
  --green: #35d07f;
  --yellow: #f2c94c;
  --red: #ff5d5d;
  --border: rgba(255, 255, 255, 0.08);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #000;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html {
  height: -webkit-fill-available;
}

body {
  min-height: 100vh;
  min-height: -webkit-fill-available;
  min-height: 100dvh;
  background:
    radial-gradient(circle at top, rgba(53, 208, 127, 0.12), transparent 32%),
    radial-gradient(circle at bottom, rgba(255, 93, 93, 0.08), transparent 28%),
    var(--bg);
}

.app {
  position: relative;
  width: 100%;
  height: 100vh;
  height: -webkit-fill-available;
  height: 100dvh;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  min-height: 100dvh;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
      -ms-flex-direction: column;
          flex-direction: column;
  gap: 1.5vh;
  padding: 2.8vh 2.8vw;
  padding-bottom: calc(2.8vh + constant(safe-area-inset-bottom));
  padding-bottom: calc(2.8vh + env(safe-area-inset-bottom, 0px));
  overflow: hidden;
}

.dashboard {
  -webkit-box-flex: 1;
      -ms-flex: 1 1 auto;
          flex: 1 1 auto;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
      -ms-flex-direction: column;
          flex-direction: column;
  min-height: 0;
}

.status-panel,
.details-panel,
.controls-dialog {
  width: 100%;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  backdrop-filter: blur(3px);
}

.status-panel {
  -webkit-box-flex: 0;
      -ms-flex: 0 0 auto;
          flex: 0 0 auto;
  position: relative;
  padding: 4vh 4vw;
  margin-bottom: 2.4vh;
  text-align: center;
}

.status-controls-button {
  position: absolute;
  top: 1.4rem;
  right: 1.4rem;
  width: 52px;
  height: 52px;
  padding: 0;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  -webkit-box-pack: center;
      -ms-flex-pack: center;
          justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #d7dee5;
  cursor: pointer;
}

.status-controls-button:active,
.status-controls-button:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.status-controls-icon {
  width: 24px;
  height: 24px;
  display: block;
  fill: currentColor;
}

.details-panel {
  -webkit-box-flex: 1;
      -ms-flex: 1 1 auto;
          flex: 1 1 auto;
  min-height: 0;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
      -ms-flex-direction: column;
          flex-direction: column;
  padding: 2.2vh 2vw;
  overflow: hidden;
}

.status-label,
.details-header,
.details-count,
.controls-title,
.controls-subtitle,
.controls-section-title,
.meta-label,
.control-field span,
.editor-field span,
.editor-toggle-label {
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.status-label {
  font-size: 16px;
  color: var(--muted);
}

.overall-status {
  margin-top: 1.5vh;
  font-size: 120px;
  line-height: 0.95;
  font-weight: 700;
  animation: pulse 3s ease-in-out infinite;
}

.status-online {
  color: var(--green);
  text-shadow: 0 0 24px rgba(53, 208, 127, 0.25);
}

.status-degraded {
  color: var(--yellow);
  text-shadow: 0 0 24px rgba(242, 201, 76, 0.22);
}

.status-offline {
  color: var(--red);
  text-shadow: 0 0 24px rgba(255, 93, 93, 0.25);
}

.status-checking {
  color: var(--text);
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.15);
}

.status-summary {
  margin-top: 1.2vh;
  font-size: 30px;
  color: #d7dee5;
}

.meta-grid {
  margin-top: 3vh;
  display: -ms-grid;
  display: grid;
  -ms-grid-columns: 1fr 2vw 1fr 2vw 1fr 2vw 1fr;
  grid-template-columns: repeat(4, 1fr);
  gap: 2vw;
}

.meta-card {
  padding: 1.8vh 1vw;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 14px;
}

.meta-card-button {
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.meta-card-button:active {
  background: rgba(255, 255, 255, 0.08);
}

.meta-label {
  font-size: 12px;
  color: var(--muted);
}

.meta-value {
  margin-top: 0.8vh;
  font-size: 34px;
  font-weight: 600;
}

.details-header-row {
  -webkit-box-flex: 0;
      -ms-flex: 0 0 auto;
          flex: 0 0 auto;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  -webkit-box-pack: justify;
      -ms-flex-pack: justify;
          justify-content: space-between;
  margin-bottom: 1.2vh;
}

.details-title-group {
  min-width: 0;
}

.details-header,
.details-count {
  font-size: 14px;
  color: var(--muted);
}

.details-count {
  margin-top: 0.5vh;
}

.details-tabs {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -ms-flex-wrap: wrap;
      flex-wrap: wrap;
  gap: 0.8rem;
}

.details-tab-button {
  min-height: 42px;
  padding: 0 1rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: #dbe2e8;
  font: inherit;
  font-size: 15px;
}

.incident-filter-toggle {
  display: -webkit-inline-box;
  display: -ms-inline-flexbox;
  display: inline-flex;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  gap: 0.55rem;
  min-height: 42px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #dbe2e8;
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}

.details-tab-button.active,
.incident-filter-toggle.active {
  color: #ffffff;
}

.incident-filter-checkbox {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #d7dee5;
}

.endpoint-scroll,
.endpoint-editor-scroll,
.incident-scroll {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.endpoint-scroll {
  -webkit-box-flex: 1;
      -ms-flex: 1 1 auto;
          flex: 1 1 auto;
  padding-right: 0.4rem;
}

.endpoint-list {
  display: block;
}

.incident-panel {
  display: none;
  -webkit-box-flex: 1;
      -ms-flex: 1 1 auto;
          flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
      -ms-flex-direction: column;
          flex-direction: column;
}

.details-panel.show-incidents .endpoint-scroll {
  display: none;
}

.details-panel.show-incidents .incident-panel {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
}

.incident-filters {
  -webkit-box-flex: 0;
      -ms-flex: 0 0 auto;
          flex: 0 0 auto;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: end;
      -ms-flex-align: end;
          align-items: flex-end;
  -ms-flex-wrap: wrap;
      flex-wrap: wrap;
  gap: 0.8rem;
  margin-bottom: 1.2vh;
}

.incident-filter-toggle-group {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -ms-flex-wrap: wrap;
      flex-wrap: wrap;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  gap: 0.8rem 1.2rem;
}

.incident-filter-select {
  -webkit-box-flex: 0;
      -ms-flex: 0 0 auto;
          flex: 0 0 auto;
  width: auto;
  min-width: 0;
  max-width: 100%;
  margin-left: auto;
  -webkit-box-align: end;
      -ms-flex-align: end;
          align-items: flex-end;
  align-self: flex-end;
}

.incident-filter-select span {
  white-space: nowrap;
}

.incident-filter-select .control-select {
  width: auto;
  min-width: 0;
  max-width: 100%;
}

.incident-scroll {
  -webkit-box-flex: 1;
      -ms-flex: 1 1 auto;
          flex: 1 1 auto;
  padding-right: 0.4rem;
}

.incident-list {
  display: block;
}

.incident-row {
  margin-top: 1.1vh;
  padding: 1.2vh 1.3vw;
  background: rgba(255, 255, 255, 0.025);
  border-radius: 12px;
}

.incident-row:first-child {
  margin-top: 0;
}

.incident-row-top,
.incident-row-bottom {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  -webkit-box-pack: justify;
      -ms-flex-pack: justify;
          justify-content: space-between;
  gap: 1rem;
}

.incident-row-bottom {
  margin-top: 0.7vh;
}

.incident-name {
  font-size: 22px;
  font-weight: 600;
}

.incident-time,
.incident-reason {
  color: var(--muted);
}

.incident-time {
  font-size: 14px;
  white-space: nowrap;
}

.incident-type,
.incident-latency {
  min-width: 84px;
  font-size: 18px;
  font-weight: 700;
}

.incident-reason {
  -webkit-box-flex: 1;
      -ms-flex: 1;
          flex: 1;
  text-align: right;
  font-size: 16px;
}

.incident-empty-state {
  padding: 2rem 1rem;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 12px;
}

.endpoint-row {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  margin-top: 1.1vh;
  padding: 1.2vh 1.3vw;
  min-height: 78px;
  background: rgba(255, 255, 255, 0.025);
  border-radius: 12px;
}

.endpoint-row:first-child {
  margin-top: 0;
}

.endpoint-name {
  width: 42%;
  min-width: 240px;
  margin-right: 1.5vw;
}

.endpoint-name-main {
  font-size: 24px;
  font-weight: 600;
}

.endpoint-name-sub {
  margin-top: 0.35vh;
  font-size: 14px;
  color: var(--muted);
  word-break: break-all;
}

.endpoint-state,
.endpoint-latency,
.endpoint-checked {
  font-size: 20px;
}

.endpoint-state {
  width: 12%;
  min-width: 90px;
  margin-right: 1.5vw;
  font-weight: 700;
}

.endpoint-latency {
  width: 16%;
  min-width: 100px;
  margin-right: 1.5vw;
}

.endpoint-checked {
  -webkit-box-flex: 1;
      -ms-flex: 1;
          flex: 1;
  text-align: right;
  color: #d2d8de;
}

.ok-text,
.latency-good {
  color: var(--green);
}

.warn-text,
.latency-medium {
  color: var(--yellow);
}

.fail-text,
.latency-slow {
  color: var(--red);
}

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

.details-hidden .details-panel {
  display: none;
}

.details-hidden .dashboard {
  -webkit-box-pack: center;
      -ms-flex-pack: center;
          justify-content: center;
}

.details-hidden .status-panel {
  margin-bottom: 0;
}

.app-footer {
  -webkit-box-flex: 0;
      -ms-flex: 0 0 auto;
          flex: 0 0 auto;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  -webkit-box-pack: center;
      -ms-flex-pack: center;
          justify-content: center;
  pointer-events: none;
}

.app-credit {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
  text-align: center;
}

.app-credit-link {
  color: #d7dee5;
  pointer-events: auto;
  text-decoration: none;
}

.app-credit-link:active,
.app-credit-link:hover {
  color: #ffffff;
  text-decoration: underline;
}

.controls-modal {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: none;
}

.controls-modal.active {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  -webkit-box-pack: center;
      -ms-flex-pack: center;
          justify-content: center;
}

.controls-backdrop {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: var(--bg-overlay);
}

.controls-dialog {
  position: relative;
  z-index: 1;
  width: 94%;
  max-width: 1120px;
  max-height: 86vh;
  padding: 2.2vh 2vw;
  background: var(--bg-modal);
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
      -ms-flex-direction: column;
          flex-direction: column;
  min-height: 0;
}

.controls-header {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: start;
      -ms-flex-align: start;
          align-items: flex-start;
  -webkit-box-pack: justify;
      -ms-flex-pack: justify;
          justify-content: space-between;
  margin-bottom: 1.3vh;
}

.controls-title {
  font-size: 12px;
  color: var(--muted);
}

.controls-subtitle {
  margin-top: 0.6vh;
  font-size: 12px;
  color: #c1c8cf;
}

.controls-row {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -ms-flex-wrap: wrap;
      flex-wrap: wrap;
  margin-right: -0.8vw;
}

.controls-row > * {
  margin-right: 0.8vw;
  margin-bottom: 1vh;
}

.controls-section {
  -webkit-box-flex: 1;
      -ms-flex: 1 1 auto;
          flex: 1 1 auto;
  min-height: 0;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
      -ms-flex-direction: column;
          flex-direction: column;
}

.controls-section-header {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  -webkit-box-pack: justify;
      -ms-flex-pack: justify;
          justify-content: space-between;
  margin-bottom: 1.2vh;
}

.controls-section-title {
  font-size: 12px;
  color: var(--muted);
}

.control-button,
.control-select,
.control-input {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  font: inherit;
}

.control-button {
  min-height: 54px;
  padding: 0 1.2rem;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
}

.control-button:active {
  background: rgba(255, 255, 255, 0.12);
}

.control-button[disabled] {
  opacity: 0.45;
  cursor: default;
}

.control-button-small {
  min-width: 124px;
}

.control-close-button {
  width: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  margin-top: -0.4vh;
  margin-right: -0.3vw;
  background: var(--red);
  color: #000;
  border-radius: 999px;
  font-size: 16px;
  line-height: 36px;
  text-align: center;
}

.control-field,
.editor-field {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
      -ms-flex-direction: column;
          flex-direction: column;
}

.control-field-inline {
  margin-left: auto;
}

.control-field span,
.editor-field span,
.editor-toggle-label {
  margin-bottom: 0.5vh;
  font-size: 12px;
  color: var(--muted);
}

.control-select,
.control-input,
.editor-input {
  min-height: 54px;
  padding: 0 0.85rem;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  font: inherit;
}

.control-select {
  min-width: 180px;
}

.endpoint-editor-scroll {
  -webkit-box-flex: 1;
      -ms-flex: 1 1 auto;
          flex: 1 1 auto;
  padding-right: 0.35rem;
}

.endpoint-editor-row {
  margin-top: 1.1vh;
  padding: 1.2vh 1vw;
  background: var(--bg-row);
  border-radius: 12px;
}

.endpoint-editor-row:first-child {
  margin-top: 0;
}

.editor-row-header,
.editor-fields {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
}

.editor-row-header {
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  margin-bottom: 1vh;
}

.editor-index {
  font-size: 16px;
  font-weight: 600;
  color: #dce3ea;
}

.editor-toggle {
  margin-left: auto;
  margin-right: 0.8vw;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
      -ms-flex-direction: column;
          flex-direction: column;
}

.editor-checkbox-row {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
}

.editor-checkbox {
  width: 22px;
  height: 22px;
  margin: 0 0.45rem 0 0;
}

.control-remove-button {
  min-width: 92px;
}

.editor-fields {
  margin-right: -0.8vw;
}

.editor-field {
  width: 28%;
  margin-right: 0.8vw;
}

.editor-field-wide {
  width: 72%;
}

.editor-input {
  width: 100%;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.015);
    opacity: 0.92;
  }
}

@media (max-width: 900px) {
  .app {
    padding: 2.2vh 2.2vw;
    padding-bottom: calc(2.2vh + constant(safe-area-inset-bottom));
    padding-bottom: calc(2.2vh + env(safe-area-inset-bottom, 0px));
  }

  .overall-status {
    font-size: 92px;
  }

  .status-controls-button {
    top: 1rem;
    right: 1rem;
    width: 46px;
    height: 46px;
  }

  .status-summary {
    font-size: 24px;
  }

  .meta-grid {
    -ms-grid-columns: 1fr;
    grid-template-columns: 1fr;
    gap: 1.2vh;
  }

  .meta-value {
    font-size: 28px;
  }

  .details-header-row,
  .controls-section-header,
  .editor-row-header,
  .editor-fields,
  .controls-row,
  .controls-header,
  .incident-row-top,
  .incident-row-bottom,
  .incident-filters {
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
        -ms-flex-direction: column;
            flex-direction: column;
    -webkit-box-align: stretch;
        -ms-flex-align: stretch;
            align-items: stretch;
  }

  .details-count,
  .controls-subtitle,
  .details-tabs {
    margin-top: 0.6vh;
  }

  .endpoint-row {
    display: block;
    padding: 1.1vh 1rem;
  }

  .endpoint-name,
  .endpoint-state,
  .endpoint-latency,
  .endpoint-checked,
  .incident-type,
  .incident-latency,
  .incident-reason,
  .incident-time {
    width: auto;
    min-width: 0;
    margin-right: 0;
    text-align: left;
  }

  .endpoint-state,
  .endpoint-latency,
  .endpoint-checked,
  .incident-row-bottom {
    margin-top: 0.7vh;
    font-size: 18px;
  }

  .controls-row > *,
  .editor-field,
  .incident-filter-select {
    margin-right: 0;
    margin-bottom: 1vh;
  }

  .incident-filter-select {
    width: auto;
    max-width: 100%;
    margin-left: auto;
    align-self: flex-end;
  }

  .control-field-inline,
  .editor-toggle {
    margin-left: 0;
  }

  .control-close-button {
    margin-top: 1vh;
    margin-right: 0;
  }

  .editor-toggle {
    margin-right: 0;
    margin-bottom: 1vh;
  }

  .controls-dialog {
    width: 96%;
    max-height: 90vh;
    padding: 2vh 1rem;
  }

  .app-footer {
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
        -ms-flex-direction: column;
            flex-direction: column;
    -webkit-box-align: center;
        -ms-flex-align: center;
            align-items: center;
  }

  .incident-filter-toggle-group {
    width: 100%;
  }

  .incident-filter-toggle {
    width: auto;
  }
}

@media (max-width: 700px) {
  .overall-status {
    font-size: 80px;
  }

  .status-summary {
    font-size: 20px;
  }

  .endpoint-name-main {
    font-size: 20px;
  }
}

@media (min-width: 901px) and (max-height: 900px) {
  .app {
    gap: 1vh;
    padding-top: 2vh;
    padding-bottom: calc(2vh + constant(safe-area-inset-bottom));
    padding-bottom: calc(2vh + env(safe-area-inset-bottom, 0px));
  }

  .status-panel {
    padding: 2.6vh 3vw;
    margin-bottom: 1.4vh;
  }

  .status-controls-button {
    top: 1rem;
    right: 1rem;
    width: 46px;
    height: 46px;
  }

  .status-label {
    font-size: 14px;
  }

  .overall-status {
    margin-top: 1vh;
    font-size: 88px;
  }

  .status-summary {
    margin-top: 0.8vh;
    font-size: 24px;
  }

  .meta-grid {
    margin-top: 2vh;
    gap: 1.2vw;
  }

  .meta-card {
    padding: 1.2vh 0.9vw;
  }

  .meta-label {
    font-size: 11px;
  }

  .meta-value {
    margin-top: 0.5vh;
    font-size: 28px;
  }

  .details-panel {
    padding: 1.6vh 1.6vw;
  }

  .details-header-row,
  .incident-filters {
    margin-bottom: 0.8vh;
  }

  .incident-filter-toggle-group {
    gap: 0.6rem 1rem;
  }

  .incident-filter-select {
    margin-left: auto;
  }

  .details-tab-button {
    min-height: 38px;
    font-size: 14px;
  }

  .incident-filter-toggle {
    min-height: 38px;
    font-size: 14px;
  }

  .control-select {
    min-height: 46px;
    font-size: 16px;
  }

  .incident-name {
    font-size: 20px;
  }

  .incident-type,
  .incident-latency {
    font-size: 16px;
  }
}
