:root {
  --bg: #f6f9fc;
  --surface: #ffffff;
  --text: #0a2540;
  --text-secondary: #425466;
  --text-muted: #697386;
  --border: #e3e8ee;
  --border-strong: #c9d4e0;
  --accent: #635bff;
  --accent-hover: #4f46e5;
  --operational: #09825d;
  --operational-bg: #ecfdf5;
  --operational-border: #a7f3d0;
  --outage: #df1b41;
  --outage-bg: #fef2f4;
  --outage-border: #fecdd3;
  --unknown: #697386;
  --unknown-bg: #f6f9fc;
  --unknown-border: #e3e8ee;
  --not-monitored: #8792a2;
  --not-monitored-bg: #f6f9fc;
  --shadow-sm: 0 1px 2px rgba(10, 37, 64, 0.04);
  --shadow-md: 0 4px 12px rgba(10, 37, 64, 0.06);
  --radius: 12px;
  --radius-sm: 8px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --max-width: 880px;
  --transition: 0.25s ease;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.auth-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  background: var(--bg);
}

.auth-gate__card {
  max-width: 420px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.75rem;
  box-shadow: var(--shadow-md);
  text-align: center;
}

.auth-gate__logo {
  display: block;
  margin: 0 auto 1.25rem;
  height: auto;
  width: min(160px, 50vw);
}

.auth-gate__title {
  margin: 0 0 0.75rem;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.auth-gate__message {
  margin: 0 0 0.5rem;
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.auth-gate__hint {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* —— Header —— */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.site-logo {
  display: block;
  width: min(160px, 40vw);
  height: auto;
}

.site-header__label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* —— Hero —— */
.hero {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition), border-color var(--transition);
}

.hero__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 2rem;
}

.hero__status-row {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.hero__indicator {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.hero__title {
  margin: 0;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--text);
}

.hero__subtitle {
  margin: 0.75rem 0 0;
  font-size: 1.0625rem;
  color: var(--text-secondary);
  max-width: 36rem;
}

.hero__meta {
  margin-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

.hero__updated,
.hero__refresh {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.hero--operational {
  background: linear-gradient(180deg, var(--operational-bg) 0%, var(--surface) 100%);
  border-bottom-color: var(--operational-border);
}

.hero--major_outage {
  background: linear-gradient(180deg, var(--outage-bg) 0%, var(--surface) 100%);
  border-bottom-color: var(--outage-border);
}

.hero--unknown,
.hero--not_monitored {
  background: linear-gradient(180deg, var(--unknown-bg) 0%, var(--surface) 100%);
}

/* —— Content —— */
.content__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem;
}

/* —— Incidents —— */
.incidents {
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.incidents--active {
  background: var(--outage-bg);
  border: 1px solid var(--outage-border);
}

.incidents--recovered {
  background: var(--surface);
  border: 1px solid var(--border);
}

.incidents__header {
  padding: 1rem 1.25rem 0.5rem;
}

.incidents__title {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.incidents--active .incidents__title {
  color: var(--outage);
}

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

.incidents__list {
  list-style: none;
  margin: 0;
  padding: 0 0 0.25rem;
}

.incident-row {
  padding: 0.875rem 1.25rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.incidents--recovered .incident-row {
  border-top-color: var(--border);
}

.incidents__list .incident-row:first-child {
  border-top: none;
}

.incident-row__main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.incident-row__name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.incident-row__path {
  margin-top: 0.2rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.incident-row__meta {
  margin-top: 0.45rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.incident-row__badge {
  flex-shrink: 0;
}

.incident-row__duration {
  color: var(--operational);
  font-weight: 500;
}

/* —— Summary cards —— */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.125rem;
  box-shadow: var(--shadow-sm);
}

.summary-card__label {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.summary-card__status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

/* —— Panels —— */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

.field-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
}

.field-input {
  flex: 1 1 220px;
  min-width: 0;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.9375rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.field-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.15);
}

.btn {
  padding: 0.625rem 1.125rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition);
}

.btn:hover {
  background: var(--accent-hover);
}

.btn:active {
  transform: translateY(1px);
}

.legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.75rem;
}

.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.legend__item strong {
  font-weight: 600;
  color: var(--text);
}

.legend__note {
  margin: 0.85rem 0 0;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* —— Status dots & badges —— */
.status-dot {
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot--operational {
  background: var(--operational);
  box-shadow: 0 0 0 3px var(--operational-bg);
}

.status-dot--major_outage {
  background: var(--outage);
  box-shadow: 0 0 0 3px var(--outage-bg);
}

.status-dot--unknown,
.status-dot--not_monitored {
  background: var(--unknown);
  box-shadow: 0 0 0 3px var(--unknown-bg);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
}

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

.status-badge.status-major_outage {
  color: var(--outage);
}

.status-badge.status-unknown,
.status-badge.status-not_monitored {
  color: var(--unknown);
}

.status-icon {
  display: inline-block;
  flex-shrink: 0;
}

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

.hero__indicator .status-icon--operational {
  width: 1.25rem;
  height: 1.25rem;
}

/* —— Component groups —— */
.group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.125rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.group-header h2 {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.component-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.component-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}

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

.component-row__info {
  min-width: 0;
  flex: 1;
}

.component-row__name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.component-row__desc {
  margin-top: 0.2rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.component-row__metrics {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  flex-shrink: 0;
}

.component-row__uptime {
  min-width: 4.5rem;
  text-align: right;
  font-size: 0.875rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  padding-top: 0.1rem;
}

.component-list--with-uptime .component-row__uptime:empty {
  display: none;
}

.component-row__status {
  flex-shrink: 0;
  padding-top: 0.1rem;
}

.component-empty {
  padding: 1.25rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  font-style: italic;
}

.demo-notice {
  margin: 0;
  padding: 0.875rem 1.25rem;
  background: #fffbeb;
  color: #92400e;
  border-bottom: 1px solid #fde68a;
  font-size: 0.8125rem;
}

.hospital-block {
  padding-bottom: 0.25rem;
}

.hospital-block + .hospital-block {
  border-top: 1px solid var(--border);
}

.hospital-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem 0.5rem;
}

.hospital-block-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.hospital-filter-label {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

.onprem-section {
  padding: 0 1.25rem 1rem;
}

.onprem-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin: 0.5rem 0 0.35rem;
}

.onprem-section-header h4 {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.onprem-section .component-list {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.onprem-section .component-row:first-child {
  border-top: none;
}

/* —— Alerts & skeleton —— */
.alert {
  padding: 0.875rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.alert--error {
  background: var(--outage-bg);
  color: var(--outage);
  border: 1px solid var(--outage-border);
}

.skeleton__block {
  height: 120px;
  background: linear-gradient(90deg, var(--border) 0%, #eef2f6 50%, var(--border) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

@keyframes shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

.hidden {
  display: none !important;
}

.is-loading #groups {
  opacity: 0.5;
  pointer-events: none;
}

/* —— Footer —— */
.site-footer {
  margin-top: 2rem;
  padding: 0 1.5rem 2.5rem;
}

.site-footer__inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.site-footer p {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .hero__inner {
    padding: 1.75rem 1.25rem 1.5rem;
  }

  .content__inner {
    padding: 1.25rem;
  }

  .hero__meta {
    flex-direction: column;
    gap: 0.25rem;
  }

  .component-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .component-row__metrics {
    width: 100%;
    justify-content: space-between;
    align-items: center;
  }

  .component-row__uptime {
    text-align: left;
  }

  .site-header__label {
    display: none;
  }
}
