:root {
  color-scheme: light;
  --bg: #f4f9fd;
  --panel: #ffffff;
  --soft: #eef8ff;
  --soft-strong: #e8f5ff;
  --ink: #1f242b;
  --muted: #5d6673;
  --line: #dcebf5;
  --navy: #05426e;
  --blue: #1072ba;
  --sky: #3ba9df;
  --ok: #1072ba;
  --warn: #b7791f;
  --bad: #b42318;
  --maint: #1072ba;
  --shadow: 0 18px 44px rgba(5, 66, 110, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #ffffff 0%, var(--bg) 44%, #ffffff 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

.topbar {
  align-items: center;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid rgba(16, 114, 186, 0.1);
  display: flex;
  justify-content: space-between;
  min-height: 82px;
  padding: 0 clamp(20px, 5vw, 58px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  align-items: center;
  color: var(--navy);
  display: inline-flex;
  gap: 16px;
  font-weight: 800;
  text-decoration: none;
}

.brand img {
  display: block;
  height: 54px;
  max-width: 152px;
  object-fit: contain;
  width: auto;
}

.brand span {
  border-left: 1px solid rgba(5, 66, 110, 0.18);
  color: var(--navy);
  line-height: 1;
  padding-left: 16px;
}

nav {
  align-items: center;
  display: flex;
  gap: 8px;
}

nav a,
.detail a,
.incident a {
  color: var(--navy);
  font-weight: 750;
  text-decoration: none;
}

nav a {
  border-radius: 999px;
  color: rgba(31, 36, 43, 0.75);
  font-size: 14px;
  padding: 10px 14px;
}

nav a:hover,
nav a:focus,
.detail a:hover,
.incident a:hover {
  color: var(--blue);
}

main {
  margin: 0 auto;
  max-width: 1220px;
  padding: 36px clamp(18px, 4vw, 46px);
}

footer {
  background: var(--soft-strong);
  border-top: 1px solid rgba(16, 114, 186, 0.12);
  color: var(--muted);
  font-size: 14px;
  margin-top: 36px;
  padding: 26px clamp(20px, 5vw, 58px) 34px;
}

h1,
h2 {
  letter-spacing: 0;
  line-height: 1.15;
}

h1 {
  color: var(--navy);
  font-size: clamp(34px, 4vw, 48px);
  font-weight: 900;
  margin: 0 0 24px;
}

h2 {
  color: var(--navy);
  font-size: 23px;
  font-weight: 850;
  margin: 0 0 16px;
}

.hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 58%, var(--sky) 100%);
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(5, 66, 110, 0.18);
  color: #fff;
  margin-bottom: 28px;
  overflow: hidden;
  padding: clamp(30px, 5vw, 54px);
  position: relative;
}

.hero::after {
  border: 28px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  content: "";
  height: 260px;
  position: absolute;
  right: -64px;
  top: -82px;
  transform: rotate(-14deg);
  width: 260px;
}

.hero p,
.hero span {
  margin: 0;
  opacity: 0.9;
  position: relative;
  z-index: 1;
}

.hero p {
  font-weight: 800;
}

.hero h1 {
  color: #fff;
  font-size: clamp(42px, 6vw, 68px);
  margin: 8px 0 10px;
  max-width: 820px;
  position: relative;
  text-shadow: 0 10px 28px rgba(5, 66, 110, 0.24);
  z-index: 1;
}

.hero.operational {
  background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 58%, var(--sky) 100%);
}

.hero.degraded,
.hero.maintenance {
  background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 54%, #ffc28c 100%);
}

.hero.outage {
  background: linear-gradient(135deg, #5b1f28 0%, #b42318 62%, #ea60d5 100%);
}

.grid {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
}

.contact-layout {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(280px, 0.7fr) minmax(0, 1.3fr);
}

.grid > div,
.detail,
.result,
.checker,
.admin-form,
.admin-panel {
  background: var(--panel);
  border: 1px solid rgba(5, 66, 110, 0.08);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.component-list {
  display: grid;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.component-list li {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  min-height: 64px;
  padding: 10px 0;
}

.component-list li:last-child {
  border-bottom: 0;
}

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

small {
  display: block;
  margin-top: 3px;
}

.health-detail-list,
.dns-status-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.health-chip,
.dns-chip {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  gap: 0;
  line-height: 1;
  padding: 6px 8px;
  white-space: nowrap;
}

.health-chip::before,
.dns-chip::before {
  border-radius: 999px;
  content: "";
  display: inline-block;
  height: 7px;
  margin-right: 6px;
  width: 7px;
}

.health-chip.normal,
.dns-chip.operational {
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #166534;
}

.health-chip.normal::before,
.dns-chip.operational::before {
  background: var(--ok);
}

.health-chip.elevated,
.dns-chip.degraded,
.dns-chip.maintenance {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.health-chip.elevated::before,
.dns-chip.degraded::before,
.dns-chip.maintenance::before {
  background: #f59e0b;
}

.health-chip.high,
.health-chip.unavailable,
.dns-chip.outage {
  background: #fff1f0;
  border-color: #ffccc7;
  color: #b42318;
}

.health-chip.high::before,
.health-chip.unavailable::before,
.dns-chip.outage::before {
  background: var(--bad);
}

.dns-chip strong {
  color: inherit;
  font-size: 12px;
  margin-right: 5px;
  text-transform: uppercase;
}

.pill {
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-size: 13px;
  font-weight: 850;
  line-height: 1;
  padding: 8px 11px;
  white-space: nowrap;
}

.pill.operational {
  background: var(--ok);
}

.pill.degraded,
.pill.maintenance {
  background: var(--warn);
}

.pill.outage {
  background: var(--bad);
}

.pill.scheduled {
  background: var(--maint);
}

.incident {
  background: var(--panel);
  border: 1px solid rgba(5, 66, 110, 0.08);
  border-radius: 8px;
  margin-bottom: 12px;
  padding: 16px;
}

.incident:hover {
  border-color: rgba(16, 114, 186, 0.24);
}

.maintenance-block {
  margin-bottom: 24px;
}

.maintenance-block h2 {
  margin-bottom: 12px;
}

.maintenance-item {
  border-color: rgba(245, 158, 11, 0.28);
}

.incident p {
  color: var(--muted);
  margin: 8px 0;
}

.detail p {
  color: var(--muted);
}

.detail h1 {
  margin-bottom: 14px;
}

.detail h2 {
  margin-top: 26px;
}

.back-link {
  display: inline-block;
  margin-bottom: 10px;
}

.incident-meta {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  margin: 0 0 20px;
}

.incident-window {
  color: var(--muted);
  font-weight: 750;
}

.detail-summary {
  font-size: 17px;
  line-height: 1.65;
  margin: 0;
  max-width: 920px;
}

.timeline {
  border-left: 2px solid var(--line);
  list-style: none;
  margin: 16px 0 0 4px;
  padding: 0 0 0 18px;
}

.timeline li {
  margin: 0 0 18px;
}

.timeline strong {
  color: var(--navy);
  display: block;
}

form {
  display: grid;
  gap: 14px;
}

label {
  color: var(--muted);
  display: grid;
  font-weight: 700;
  gap: 6px;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  padding: 11px 12px;
  width: 100%;
}

input {
  min-height: 46px;
}

select {
  min-height: 46px;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(16, 114, 186, 0.14);
  outline: none;
}

button {
  background: linear-gradient(135deg, var(--blue) 0%, var(--navy) 100%);
  border: 0;
  border-radius: 8px;
  box-shadow: 0 12px 26px rgba(16, 114, 186, 0.18);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 850;
  min-height: 46px;
  padding: 11px 18px;
}

button:hover,
button:focus {
  background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 100%);
}

.button-link {
  background: linear-gradient(135deg, var(--blue) 0%, var(--navy) 100%);
  border-radius: 8px;
  box-shadow: 0 12px 26px rgba(16, 114, 186, 0.18);
  color: #fff;
  display: inline-flex;
  font-weight: 850;
  min-height: 42px;
  padding: 10px 16px;
  text-decoration: none;
}

.danger-button {
  background: linear-gradient(135deg, #d92d20 0%, var(--bad) 100%);
  box-shadow: 0 12px 26px rgba(180, 35, 24, 0.16);
}

.danger-button:hover,
.danger-button:focus {
  background: linear-gradient(135deg, var(--bad) 0%, #7a271a 100%);
}

dl {
  display: grid;
  gap: 8px 16px;
  grid-template-columns: 180px 1fr;
  margin: 0;
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
}

.error {
  background: #fff1f0;
  border: 1px solid #ffccc7;
  border-radius: 8px;
  color: var(--bad);
  padding: 12px 14px;
}

.success {
  background: var(--soft);
  border: 1px solid rgba(16, 114, 186, 0.18);
  border-radius: 8px;
  color: var(--navy);
  font-weight: 750;
  padding: 12px 14px;
}

.secret-code {
  background: var(--soft);
  border-radius: 6px;
  color: var(--navy);
  display: inline-block;
  font-size: 13px;
  line-height: 1.5;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 4px 6px;
}

.totp-setup {
  align-items: flex-start;
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(180px, 220px) 1fr;
  margin: 18px 0;
}

.totp-qr-wrap {
  background: #fff;
  border: 1px solid rgba(16, 114, 186, 0.18);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(11, 79, 122, 0.08);
  padding: 14px;
}

.totp-qr {
  aspect-ratio: 1;
  display: block;
  height: auto;
  image-rendering: pixelated;
  width: 100%;
}

.hp-field {
  height: 1px;
  left: -10000px;
  overflow: hidden;
  position: absolute;
  top: auto;
  width: 1px;
}

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

.admin-shell {
  align-items: start;
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
}

.admin-menu {
  background: var(--panel);
  border: 1px solid rgba(5, 66, 110, 0.08);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 18px;
  padding: 20px;
  position: sticky;
  top: 106px;
}

.admin-menu h1 {
  font-size: 32px;
  margin-bottom: 8px;
}

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

.admin-tabs a {
  align-items: center;
  border-radius: 8px;
  color: var(--ink);
  display: flex;
  font-weight: 800;
  justify-content: space-between;
  padding: 11px 12px;
  text-decoration: none;
}

.admin-tabs a:hover,
.admin-tabs a.active {
  background: var(--soft);
  color: var(--navy);
}

.admin-tabs span {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  min-width: 28px;
  padding: 2px 7px;
  text-align: center;
}

.admin-content {
  min-width: 0;
}

.admin-heading {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.inline-form {
  align-items: center;
  display: flex;
  gap: 10px;
}

.inline-form input,
.inline-form select {
  min-width: 0;
}

.admin-table {
  border-collapse: collapse;
  width: 100%;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 8px;
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  color: var(--muted);
  font-size: 13px;
}

.subscriber-table td:last-child {
  width: 1%;
}

.subscriber-table .inline-form {
  justify-content: flex-start;
}

.subscriber-table small,
.email-queue-table small {
  color: var(--muted);
  display: block;
  line-height: 1.45;
  margin-top: 5px;
  max-width: 680px;
}

.email-queue-table {
  table-layout: fixed;
}

.email-queue-table th:nth-child(1),
.email-queue-table td:nth-child(1),
.email-queue-table th:nth-child(4),
.email-queue-table td:nth-child(4) {
  width: 94px;
}

.email-queue-table td {
  overflow-wrap: anywhere;
}

.queue-error {
  color: #9b2c2c;
}

.admin-incident {
  display: grid;
  gap: 16px;
}

.admin-edit-form {
  background: var(--soft);
  box-shadow: none;
}

.admin-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
}

.admin-actions form {
  flex: 1 1 300px;
}

.incident.compact {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding: 16px 20px;
    position: static;
  }

  .brand {
    gap: 12px;
  }

  .brand img {
    height: 44px;
    max-width: 124px;
  }

  .brand span {
    font-size: 14px;
    padding-left: 12px;
  }

  nav {
    flex-wrap: wrap;
    gap: 4px;
  }

  nav a {
    padding: 8px 10px;
  }

  main {
    padding: 24px 16px;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .contact-layout {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 28px 22px;
  }

  dl {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .totp-setup {
    grid-template-columns: 1fr;
  }

  .totp-qr-wrap {
    max-width: 240px;
  }

  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-menu {
    position: static;
  }

  .admin-tabs {
    grid-template-columns: 1fr 1fr;
  }

  .component-list li,
  .admin-heading,
  .inline-form,
  .incident.compact {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-table,
  .admin-table tbody,
  .admin-table tr,
  .admin-table td,
  .admin-table th {
    display: block;
    width: 100%;
  }
}
