:root {
  color-scheme: light;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --navy: #0b4f87;
  --navy-dark: #10233f;
  --blue-gray: #61728b;
  --page: #f3f6f9;
  --surface: #ffffff;
  --border: #dbe4ed;
  --healthy: #078944;
  --healthy-soft: #edf9f2;
  --danger: #c32d3c;
  --danger-soft: #fff0f2;
  --unknown: #68798b;
  --unknown-soft: #eff4f8;
  --shadow: 0 2px 8px rgba(18, 40, 67, 0.05);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--page);
}

body {
  display: flex;
  flex-direction: column;
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--page);
  color: var(--navy-dark);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.35;
}

button,
select,
input {
  font: inherit;
}

button,
select,
a {
  -webkit-tap-highlight-color: transparent;
}

.site-header {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  padding: 0 18px;
  background: var(--navy);
  box-shadow: 0 1px 5px rgba(5, 31, 60, 0.18);
  color: #fff;
}

.brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  object-fit: contain;
}

.brand-copy {
  min-width: 0;
}

.brand-copy strong {
  display: block;
  overflow: hidden;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy small {
  display: none;
}

.toolbar-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.dashboard-header-context {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.header-last-checked {
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  white-space: nowrap;
}

.toolbar-form {
  margin: 0;
}

.toolbar-button {
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 6px;
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.toolbar-button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.toolbar-button:focus-visible,
.target-environment-selector select:focus-visible,
.login-card input:focus-visible,
.login-card button:focus-visible {
  outline: 3px solid rgba(74, 163, 255, 0.35);
  outline-offset: 2px;
}

.toolbar-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.toolbar-button span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.page-shell {
  flex: 1 0 auto;
  width: calc(100% - 32px);
  max-width: 1380px;
  margin: 16px auto;
}

.dashboard-page {
  display: grid;
  gap: 12px;
}

.system-alert,
.environment-group {
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.system-alert {
  padding: 10px 14px;
  border-color: #efc4ca;
  background: var(--danger-soft);
  color: #8b1d2b;
}

.monitoring-pause {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.status-icon {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
}

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

.status-icon-small {
  width: 24px;
  height: 24px;
}

.status-healthy {
  color: var(--healthy);
}

.status-unhealthy {
  color: var(--danger);
}

.status-unknown,
.status-disabled,
.status-timedout {
  color: var(--unknown);
}

.status-icon.status-healthy {
  background: var(--healthy);
  color: #fff;
}

.status-icon.status-unhealthy {
  background: var(--danger-soft);
}

.status-icon.status-unknown,
.status-icon.status-disabled,
.status-icon.status-timedout {
  background: var(--unknown-soft);
}

.status-pill {
  display: inline-flex;
  min-height: 20px;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.status-pill.status-healthy {
  background: var(--healthy-soft);
}

.status-pill.status-unhealthy {
  background: var(--danger-soft);
}

.status-pill.status-unknown,
.status-pill.status-disabled,
.status-pill.status-timedout {
  background: var(--unknown-soft);
}

.target-environment-selector {
  display: flex;
  min-width: 0;
  align-items: center;
  margin: 0;
}

.target-environment-selector select {
  width: 126px;
  height: 32px;
  padding: 0 28px 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 5px;
  background: #fff;
  color: var(--navy-dark);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.environment-list {
  display: grid;
  gap: 12px;
}

.environment-group {
  overflow: hidden;
}

.environment-group > summary {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 14px;
  cursor: pointer;
  list-style: none;
}

.environment-group > summary::-webkit-details-marker {
  display: none;
}

.environment-summary-main {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.environment-summary-main h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.environment-uptime {
  color: var(--blue-gray);
  font-size: 12px;
  white-space: nowrap;
}

.environment-chevron {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--blue-gray);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  transition: transform 120ms ease;
}

.environment-group[open] .environment-chevron {
  transform: rotate(180deg);
}

.application-list {
  border-top: 1px solid var(--border);
}

.application-list-item {
  display: grid;
  min-height: 52px;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 7px 14px;
  border-bottom: 1px solid var(--border);
}

.application-list-item:last-child {
  border-bottom: 0;
}

.application-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
}

.application-identity h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.008em;
}

.application-name {
  font-weight: 600;
}

.application-version {
  color: var(--blue-gray);
  font-size: 0.82em;
  font-weight: 400;
}

.application-failure {
  color: var(--danger);
  font-size: 12px;
  white-space: nowrap;
}

.release-version {
  flex: 0 0 auto;
  padding: 8px 16px 12px;
  color: var(--blue-gray);
  font-size: 11px;
  text-align: center;
}

.login-body {
  background: #fff;
}

.login-page-shell {
  display: grid;
  width: 100%;
  flex: 1 0 auto;
  padding: 32px 24px;
  place-items: center;
}

.login-card {
  width: min(100%, 360px);
}

.login-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 48px;
}

.login-logo img {
  width: 110px;
  max-width: 100%;
  height: auto;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.login-form {
  display: flex;
  flex-direction: column;
}

.login-field + .login-field {
  margin-top: 14px;
}

.login-control {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid #c7d3e0;
  border-radius: 4px;
  background: #fff;
  color: #24374d;
  font-size: 15px;
  line-height: 22px;
}

.login-control::placeholder {
  color: #6d7f92;
}

.password-input {
  position: relative;
}

.password-input .login-control {
  padding-right: 52px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 12px;
  display: flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  padding: 0;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: #1f2937;
  cursor: pointer;
}

.password-toggle svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.password-toggle svg[hidden] {
  display: none;
}

.login-button {
  width: 100%;
  min-height: 48px;
  margin-top: 24px;
  padding: 14px 16px;
  border: 0;
  border-radius: 8px;
  background: #0d4a8c;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  line-height: 18px;
  cursor: pointer;
}

.login-button:hover {
  background: #144a88;
}

.login-control:focus,
.password-toggle:focus-visible,
.login-button:focus-visible {
  outline: none;
  border-color: #0d4a8c;
  box-shadow: 0 0 0 0.1rem #fff, 0 0 0 0.2rem rgba(13, 74, 140, 0.2);
}

.validation {
  color: var(--danger);
  font-size: 12px;
}

.login-field > .validation {
  display: block;
  padding-top: 6px;
}

.validation-summary-errors {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--danger-soft);
}

.validation-summary-errors ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (max-width: 760px) {
  .site-header {
    display: grid;
    min-height: 48px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 8px 10px;
  }

  .brand {
    gap: 8px;
  }

  .brand-mark {
    width: 26px;
    height: 26px;
  }

  .brand-copy strong {
    font-size: 14px;
  }

  .toolbar-actions {
    gap: 6px;
    margin-left: 0;
  }

  .dashboard-header-context {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: space-between;
  }

  .toolbar-button {
    width: 32px;
    height: 32px;
  }

  .toolbar-button svg {
    width: 18px;
    height: 18px;
  }

  .page-shell {
    width: calc(100% - 16px);
    margin: 8px auto;
  }

  .dashboard-page,
  .environment-list {
    gap: 8px;
  }

  .header-environment-selector {
    margin: 0;
  }

  .header-environment-selector select {
    width: 100%;
  }

  .environment-group > summary {
    min-height: 48px;
    gap: 8px;
    padding: 8px 10px;
  }

  .environment-summary-main {
    gap: 6px;
    flex-wrap: wrap;
  }

  .environment-summary-main h2 {
    font-size: 15px;
  }

  .environment-uptime {
    font-size: 11px;
  }

  .application-list-item {
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 8px;
    padding: 7px 10px;
  }

  .status-icon-small {
    width: 22px;
    height: 22px;
  }

  .status-icon-small svg {
    width: 13px;
    height: 13px;
  }

  .application-identity h3 {
    font-size: 13px;
  }

  .login-page-shell {
    padding: 24px;
  }
}

@media (max-width: 390px) {
  .brand-copy strong {
    max-width: 190px;
  }

  .status-pill {
    padding-inline: 6px;
    font-size: 10px;
  }

  .dashboard-header-context {
    gap: 8px;
  }

  .header-last-checked {
    font-size: 11px;
  }

  .environment-uptime {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
