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

.uptime-navbar {
  background: #172033;
  box-shadow: 0 2px 12px rgb(15 23 42 / 12%);
}

.uptime-navbar .navbar-brand,
.uptime-navbar .nav-link { color: #f8fafc !important; }
.uptime-navbar .nav-link:hover,
.uptime-navbar .nav-link:focus { color: #bfdbfe !important; }

.uptime-hero {
  background: linear-gradient(135deg, #e0f2fe 0%, #eef2ff 100%);
  color: #172033;
}

.uptime-hero h1,
.uptime-hero .text-body-secondary { color: #334155 !important; }

.uptime-group-header {
  padding: 1rem 1.25rem;
  border-left: 4px solid #2563eb;
  border-radius: .6rem;
  background: #ffffff;
  box-shadow: 0 4px 16px rgb(15 23 42 / 6%);
}

.uptime-group-header h2 {
  color: #172033;
  font-weight: 700;
}

.uptime-hero-heading {
  gap: 1rem;
}

.uptime-hero-copy, .uptime-group-heading { min-width: 0; }

.uptime-summary {
  margin-top: 1.5rem;
}

.uptime-summary-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
  box-sizing: border-box;
  padding: 1rem 1.25rem;
  border: 1px solid rgb(255 255 255 / 70%);
  border-radius: .5rem;
  background: rgb(255 255 255 / 62%);
  box-shadow: 0 4px 16px rgb(15 23 42 / 6%);
}

.uptime-summary-value {
	margin-top: .25rem;
	font-size: 2rem;
	font-weight: 700;
	line-height: 1.1;
	color: #172033;
}

.uptime-dashboard-controls {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) 10rem auto;
  gap: .6rem;
  margin-top: 1rem;
}

.uptime-incident-list {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  border: 1px solid #fecaca;
  border-radius: .6rem;
  background: #fff1f2;
}

.uptime-section-heading,
.uptime-incident {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.uptime-incident {
  padding: .75rem 0;
  border-top: 1px solid #fecaca;
}

.uptime-incident:first-of-type { margin-top: .75rem; }

.uptime-meter {
  height: .35rem;
  margin-top: .65rem;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.uptime-meter-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f59e0b, #22c55e);
  transition: width .25s ease;
}

.uptime-card {
  border-top: 3px solid #94a3b8;
  transition: transform .15s ease, box-shadow .15s ease;
}

.uptime-grid-item {
  display: flex;
}

.uptime-grid-item > .uptime-card {
  width: 100%;
}

.uptime-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgb(15 23 42 / 10%);
}

.uptime-card.status-up { border-top-color: #22c55e; }
.uptime-card.status-down { border-top-color: #ef4444; }
.uptime-card.status-unknown { border-top-color: #f59e0b; }

.uptime-host-heading { gap: .75rem; }

.uptime-host-title {
  display: flex;
  flex: 1 1 12rem;
  min-width: 0;
  align-items: center;
  flex-wrap: wrap;
}

.uptime-host-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.uptime-check-bar {
  display: flex;
  flex: 0 1 9rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .2rem;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.uptime-check-segment {
  display: block;
  flex: 1 1 1.25rem;
  max-width: 2.25rem;
  height: .55rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #cbd5e1;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgb(15 23 42 / 8%);
}

.uptime-check-segment:hover { filter: brightness(.92); }

.uptime-check-segment:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.uptime-check-segment.status-up { background: #22c55e; }
.uptime-check-segment.status-down { background: #ef4444; }
.uptime-check-segment.status-unknown { background: #f59e0b; }

.uptime-check-bar .uptime-check-segment {
  flex: 0 1 1.25rem;
  min-width: .4rem;
}

.uptime-check-history {
  display: flex;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  flex-wrap: wrap;
  gap: .12rem;
  margin-bottom: .45rem;
  overflow: hidden;
}

.uptime-check-history .uptime-check-segment,
.uptime-check-history-empty {
  flex: 1 1 0;
  min-width: 2px;
  max-width: none;
  height: .45rem;
}

.uptime-check-history-empty {
  display: block;
  border-radius: 999px;
  background: #cbd5e1;
}

.uptime-history-modal {
  width: min(52rem, calc(100vw - 2rem));
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: .75rem;
  color: #172033;
  background: #ffffff;
  box-shadow: 0 1.5rem 4rem rgb(15 23 42 / 24%);
}

.uptime-history-modal::backdrop {
  background: rgb(15 23 42 / 58%);
}

.uptime-history-modal-content {
  padding: 1.25rem;
}

.uptime-history-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.uptime-history-modal .table {
  --bs-table-bg: transparent;
  --bs-table-color: #172033;
  --bs-table-border-color: #e5e7eb;
}

.status-label {
	display: inline-flex;
	flex: 0 0 auto;
	width: fit-content;
	max-width: 100%;
	align-items: center;
	box-sizing: border-box;
	padding: .2rem .55rem;
	line-height: 1.2;
	white-space: nowrap;
	border-radius: 999px;
	font-weight: 700;
	letter-spacing: .04em;
  text-transform: uppercase;
}

.status-label.status-up { background: #dcfce7; color: #166534; }
.status-label.status-down { background: #fee2e2; color: #991b1b; }
.status-label.status-unknown { background: #fef3c7; color: #92400e; }

.status-dot {
  display: inline-block;
  width: .55rem;
  height: .55rem;
  margin-right: .35rem;
  border-radius: 50%;
  background: #94a3b8;
  vertical-align: .05em;
}

.status-up .status-dot { background: #22c55e; }
.status-down .status-dot { background: #ef4444; }
.status-unknown .status-dot { background: #f59e0b; }

.uptime-check-list {
  margin: -.25rem 0;
}

.uptime-check-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 12rem);
  gap: 1rem;
  align-items: start;
  padding: .85rem 0;
  border-top: 1px solid #e5e7eb;
}

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

.uptime-check-main,
.uptime-check-result {
  min-width: 0;
}

.uptime-check-result {
  width: 100%;
  min-width: 0;
  text-align: right;
}

.uptime-target {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.uptime-error {
  overflow-wrap: anywhere;
}

@media (prefers-color-scheme: dark) {
  body { background: #111827; }
  .uptime-hero { background: linear-gradient(135deg, #172554 0%, #1e293b 100%); }
  .uptime-hero h1,
  .uptime-hero .text-body-secondary { color: #f8fafc !important; }
  .text-body-secondary { color: #9ca3af !important; }
  .uptime-group-header { background: #1f2937; box-shadow: 0 4px 16px rgb(0 0 0 / 20%); }
  .uptime-group-header h2 { color: #f8fafc; }
	.uptime-summary-card { border-color: rgb(255 255 255 / 10%); background: rgb(15 23 42 / 45%); }
	.uptime-summary-value { color: #f8fafc; }
  .uptime-card { background: #1f2937; color: #e5e7eb; }
  .uptime-incident-list { border-color: #7f1d1d; background: #450a0a; }
  .uptime-incident { border-top-color: #7f1d1d; }
  .uptime-meter { background: #374151; }
  .uptime-history-modal { color: #f8fafc; background: #1f2937; }
  .uptime-history-modal .table { --bs-table-color: #e5e7eb; --bs-table-border-color: #374151; }
  .uptime-history-modal .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }
  .uptime-check-row { border-top-color: #374151; }
  .status-label.status-up { background: #14532d; color: #bbf7d0; }
  .status-label.status-down { background: #7f1d1d; color: #fecaca; }
  .status-label.status-unknown { background: #78350f; color: #fde68a; }
  .uptime-check-segment { background: #475569; }
  .uptime-check-history-empty { background: #475569; }
}

@media (max-width: 639px) {
  .uptime-dashboard-controls {
    grid-template-columns: 1fr;
  }

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

  .uptime-check-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .uptime-check-result {
    min-width: 0;
    text-align: left;
  }

  .uptime-check-history {
    width: 100%;
  }

  .uptime-check-bar {
    flex-basis: 100%;
    justify-content: flex-start;
    max-width: none;
  }
}
