:root {
  color-scheme: light;
  --canvas: #edf7f8;
  --canvas-deep: #dcebed;
  --surface: #ffffff;
  --surface-muted: #f4f8f8;
  --ink: #102f36;
  --ink-soft: #34545b;
  --muted: #587077;
  --line: #c5d7da;
  --line-strong: #94afb4;
  --primary: #0b6678;
  --primary-strong: #064a59;
  --primary-soft: #d8eef1;
  --healthy: #0b6b52;
  --healthy-soft: #dcefe8;
  --warning: #815500;
  --warning-soft: #fff0c7;
  --critical: #b42318;
  --critical-soft: #fee4e2;
  --neutral: #5d6870;
  --neutral-soft: #e8edef;
  --focus: #007f9b;
  --shadow: 0 18px 44px rgba(25, 65, 74, 0.1);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --sidebar-width: 252px;
  --font-display: "Bahnschrift SemiCondensed", "Arial Narrow", "Segoe UI", sans-serif;
  --font-body: "Aptos", "Segoe UI", sans-serif;
  --font-data: "Cascadia Mono", "Consolas", monospace;
  --ease-enter: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-exit: cubic-bezier(0.55, 0, 1, 0.45);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}

.redirect-page {
  width: min(620px, calc(100% - 32px));
  margin: 18vh auto 0;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.redirect-page h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 5vw, 2.6rem);
  line-height: 1.1;
}

.redirect-page a {
  color: var(--primary-strong);
  font-weight: 800;
  text-underline-offset: 4px;
}

button,
input,
select {
  font: inherit;
}

button,
a,
input,
select {
  touch-action: manipulation;
}

a {
  color: inherit;
}

button {
  cursor: pointer;
}

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: #fff;
  transform: translateY(-160%);
  transition: transform 180ms ease-out;
}

.skip-link:focus {
  transform: translateY(0);
}

.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;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100dvh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 24px 18px;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--ink);
  color: #e9f6f7;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border: 1px solid rgba(164, 229, 238, 0.42);
  border-radius: 12px;
  object-fit: cover;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}

.brand small {
  margin-top: 1px;
  color: #a9c1c6;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
}

.side-nav {
  display: grid;
  gap: 6px;
  margin-top: 46px;
}

.side-nav a,
.side-nav-action {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  width: 100%;
  min-height: 46px;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #bcd0d4;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  transition: background-color 180ms ease-out, color 180ms ease-out;
}

.side-nav a:hover,
.side-nav-action:hover,
.side-nav a[aria-current="page"] {
  background: rgba(117, 205, 217, 0.12);
  color: #fff;
}

.side-nav-action {
  position: relative;
  margin-top: 10px;
  cursor: pointer;
}

.side-nav-action::before {
  position: absolute;
  top: -6px;
  right: 12px;
  left: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  content: "";
}

.side-nav-action:disabled {
  cursor: wait;
  opacity: 0.58;
}

.side-nav a[aria-current="page"] {
  box-shadow: inset 3px 0 #6fd0de;
}

.side-nav svg {
  width: 22px;
  height: 22px;
}

.nav-count {
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #294a51;
  color: #e8f6f7;
  font-family: var(--font-data);
  font-size: 0.72rem;
  text-align: center;
}

.sidebar-note {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(196, 225, 229, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-note strong {
  display: block;
  margin-top: 6px;
  color: #fff;
  font-size: 0.9rem;
}

.sidebar-note p {
  margin: 7px 0 0;
  color: #afc3c7;
  font-size: 0.76rem;
}

.main-content {
  grid-column: 2;
  width: 100%;
  max-width: 1640px;
  margin: 0 auto;
  padding: 28px clamp(22px, 3vw, 52px) 32px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 44px;
}

.topbar h1,
.section-heading h2,
.panel-heading h2,
.dialog-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 650;
  letter-spacing: -0.025em;
}

.topbar h1 {
  font-size: clamp(1.7rem, 3vw, 2.45rem);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--primary);
  font-family: var(--font-data);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.snapshot-status {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 190px;
  margin-right: 6px;
}

.snapshot-status strong,
.snapshot-status small {
  display: block;
}

.snapshot-status strong {
  font-size: 0.82rem;
}

.snapshot-status small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.72rem;
}

.status-beacon {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 0 3px var(--warning-soft);
}

.status-beacon.is-ready {
  background: var(--healthy);
  box-shadow: 0 0 0 3px var(--healthy-soft);
}

.status-beacon.is-error {
  background: var(--critical);
  box-shadow: 0 0 0 3px var(--critical-soft);
}

.button,
.icon-button,
.text-button {
  border: 0;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 0.86rem;
  font-weight: 700;
  transition: transform 150ms ease-out, background-color 150ms ease-out, border-color 150ms ease-out, color 150ms ease-out, box-shadow 150ms ease-out;
}

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

.button-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 20px rgba(11, 102, 120, 0.2);
}

.button-primary:hover {
  background: var(--primary-strong);
  box-shadow: 0 10px 24px rgba(11, 102, 120, 0.28);
}

.button-secondary {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
}

.button-secondary:hover {
  border-color: var(--primary);
  background: #fff;
  color: var(--primary-strong);
  box-shadow: 0 6px 16px rgba(25, 65, 74, 0.1);
}

.button-danger {
  border: 1px solid var(--critical);
  background: var(--critical);
  color: #fff;
  box-shadow: 0 8px 20px rgba(180, 35, 24, 0.18);
}

.button-danger:hover {
  border-color: #8f1c14;
  background: #8f1c14;
  box-shadow: 0 10px 24px rgba(180, 35, 24, 0.25);
}

.button:not(:disabled):active,
.icon-button:not(:disabled):active,
.row-action:not(:disabled):active,
.text-button:not(:disabled):active,
.history-all-link:active {
  transform: scale(0.98);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.button.is-loading svg {
  animation: spin 800ms linear infinite;
}

.app-message {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding: 14px 16px;
  border: 1px solid #e9a8a2;
  border-radius: var(--radius-sm);
  background: var(--critical-soft);
  color: #781b14;
}

.app-message[hidden] {
  display: none;
}

.app-message.is-success {
  border-color: #9acbbb;
  background: var(--healthy-soft);
  color: #07513e;
}

.text-button {
  min-height: 40px;
  padding: 6px 10px;
  background: transparent;
  color: inherit;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.section-heading,
.panel-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.section-heading {
  margin-bottom: 18px;
}

.section-heading h2,
.panel-heading h2 {
  font-size: clamp(1.35rem, 2vw, 1.8rem);
}

.section-heading > p,
.monitors-heading > p {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  text-align: right;
}

.overview-section,
.signal-section,
.operations-grid,
.monitors-panel {
  scroll-margin-top: 24px;
}

.overview-section,
.signal-section,
.operations-grid {
  margin-bottom: 34px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric-card {
  position: relative;
  min-height: 142px;
  overflow: hidden;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.8);
}

.metric-card::after {
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: 30px;
  height: 16px;
  border-right: 2px solid var(--line-strong);
  border-bottom: 2px solid var(--line-strong);
  content: "";
  opacity: 0.58;
}

.metric-card-primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.metric-card-primary::after {
  border-color: #9be0e8;
}

.metric-card-muted {
  background: rgba(229, 239, 241, 0.75);
}

.metric-label,
.metric-detail {
  display: block;
}

.metric-label {
  font-size: 0.8rem;
  font-weight: 700;
}

.metric-value {
  display: block;
  margin-top: 7px;
  font-family: var(--font-data);
  font-size: clamp(2rem, 4vw, 3rem);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.metric-detail {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.72rem;
}

.metric-card-primary .metric-detail {
  color: #c4e7ec;
}

.signal-rail {
  position: relative;
  display: grid;
  gap: 10px;
}

.signal-rail::before {
  position: absolute;
  top: 31px;
  bottom: 31px;
  left: 26px;
  z-index: 0;
  border-left: 1px dashed var(--line-strong);
  content: "";
}

.signal-card {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(150px, 0.7fr) minmax(240px, 2fr) minmax(100px, 0.5fr);
  align-items: center;
  gap: 20px;
  min-height: 116px;
  padding: 18px 20px 18px 54px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: 0 7px 22px rgba(31, 73, 82, 0.05);
}

.signal-card::before {
  position: absolute;
  top: 50%;
  left: 20px;
  width: 13px;
  height: 13px;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 2px var(--primary);
  content: "";
  transform: translateY(-50%);
}

.signal-card.is-attention::before {
  background: var(--warning);
  box-shadow: 0 0 0 2px var(--warning);
}

.signal-card.is-critical::before {
  background: var(--critical);
  box-shadow: 0 0 0 2px var(--critical);
}

.signal-name {
  display: flex;
  align-items: center;
  gap: 12px;
}

.signal-index {
  color: var(--primary);
  font-family: var(--font-data);
  font-size: 0.72rem;
  font-weight: 700;
}

.signal-name strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.signal-name small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.72rem;
}

.signal-statuses {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 14px;
  margin-top: 10px;
}

.signal-track meter {
  display: block;
  width: 100%;
  height: 11px;
  border: 0;
  border-radius: 99px;
  background: var(--neutral-soft);
}

.signal-track meter::-webkit-meter-bar {
  border: 0;
  border-radius: 99px;
  background: var(--neutral-soft);
}

.signal-track meter::-webkit-meter-optimum-value {
  border-radius: 99px;
  background: var(--healthy);
}

.signal-track meter::-moz-meter-bar {
  border-radius: 99px;
  background: var(--healthy);
}

.status-key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--neutral);
}

.status-dot.is-healthy {
  background: var(--healthy);
}

.status-dot.is-warning {
  background: var(--warning);
}

.status-dot.is-critical {
  background: var(--critical);
}

.signal-total {
  text-align: right;
}

.signal-total strong,
.signal-total span {
  display: block;
}

.signal-total strong {
  font-family: var(--font-data);
  font-size: 1.65rem;
  font-variant-numeric: tabular-nums;
}

.signal-total span {
  color: var(--muted);
  font-size: 0.7rem;
}

.loading-block,
.loading-row {
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--canvas-deep);
}

.loading-block {
  min-height: 116px;
}

.loading-row {
  height: 66px;
}

.loading-block::after,
.loading-row::after {
  display: block;
  width: 30%;
  height: 100%;
  background: rgba(255, 255, 255, 0.45);
  content: "";
  animation: loading 1.3s ease-in-out infinite alternate;
}

.operations-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(270px, 0.8fr);
  gap: 14px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.incidents-panel,
.runbook-panel {
  min-height: 390px;
  padding: 22px;
}

.panel-heading {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.panel-link {
  color: var(--primary-strong);
  font-size: 0.8rem;
  font-weight: 800;
  text-decoration: none;
}

/* Vengeance UI Line Hover Link "slide" pattern, adapted to the native Dashboard. */
.line-hover-label {
  position: relative;
  display: inline-block;
  white-space: nowrap;
}

.line-hover-label::after {
  position: absolute;
  right: 0;
  bottom: -3px;
  left: 0;
  height: 1px;
  background: currentColor;
  content: "";
  pointer-events: none;
  transform: scaleX(0);
  transform-origin: 100% 50%;
  transition: transform 240ms var(--ease-enter);
}

.panel-link:hover .line-hover-label::after,
.panel-link:focus-visible .line-hover-label::after,
.history-all-link:hover .line-hover-label::after,
.history-all-link:focus-visible .line-hover-label::after {
  transform: scaleX(1);
  transform-origin: 0% 50%;
}

.alert-list {
  display: grid;
  gap: 2px;
  margin-top: 10px;
}

.alert-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  padding: 11px 8px;
  border-bottom: 1px solid var(--line);
}

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

.alert-indicator {
  width: 9px;
  height: 30px;
  border-radius: 99px;
  background: var(--warning);
}

.alert-item.is-failed .alert-indicator,
.alert-item.is-critical .alert-indicator {
  background: var(--critical);
}

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

.alert-copy strong,
.alert-copy span {
  display: block;
}

.alert-copy strong {
  overflow: hidden;
  font-size: 0.88rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alert-copy span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
}

.alert-meta {
  text-align: right;
}

.alert-meta time,
.alert-meta span {
  display: block;
}

.alert-meta time {
  color: var(--ink-soft);
  font-family: var(--font-data);
  font-size: 0.68rem;
}

.alert-meta span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.68rem;
}

.alert-meta .delivery-badge {
  display: inline-flex;
  min-width: 72px;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.empty-state {
  display: grid;
  min-height: 210px;
  place-items: center;
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  display: block;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.1rem;
}

.empty-state p {
  max-width: 360px;
  margin: 6px auto 0;
  font-size: 0.82rem;
}

.runbook-panel {
  background: var(--primary-soft);
  box-shadow: none;
}

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

.runbook-list li {
  position: relative;
  min-height: 86px;
  padding: 14px 0 14px 50px;
  border-bottom: 1px solid rgba(11, 102, 120, 0.2);
  counter-increment: runbook;
}

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

.runbook-list li::before {
  position: absolute;
  top: 14px;
  left: 0;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(11, 102, 120, 0.28);
  border-radius: 50%;
  color: var(--primary-strong);
  content: counter(runbook, decimal-leading-zero);
  font-family: var(--font-data);
  font-size: 0.67rem;
  font-weight: 800;
}

.runbook-list span {
  font-weight: 800;
}

.runbook-list p {
  margin: 3px 0 0;
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.monitors-panel {
  overflow: hidden;
  box-shadow: none;
}

.monitors-heading {
  align-items: center;
  padding: 22px 24px 18px;
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(150px, 0.8fr));
  align-items: end;
  gap: 10px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
}

.field {
  display: grid;
  gap: 5px;
}

.field label {
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 800;
}

.field input,
.field select {
  width: 100%;
  min-height: 44px;
  padding: 8px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.82rem;
  transition: border-color 150ms ease-out, box-shadow 150ms ease-out, background-color 150ms ease-out;
}

.field input:hover,
.field select:hover {
  border-color: var(--primary);
}

.field input:focus-visible,
.field select:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.field input::placeholder {
  color: #71858a;
}

.table-shell {
  position: relative;
  min-height: 220px;
  overflow-x: auto;
}

.table-update-track {
  position: absolute;
  z-index: 4;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  overflow: hidden;
  pointer-events: none;
}

.table-update-track span {
  display: block;
  width: 34%;
  height: 100%;
  border-radius: 99px;
  background: var(--primary);
  opacity: 0;
  transform: translateX(-120%);
}

.table-shell tbody {
  transition: opacity 180ms ease-out;
}

.table-shell.is-updating .table-update-track span {
  opacity: 1;
  animation: inventory-progress 900ms var(--ease-enter) infinite;
}

.table-shell.is-updating tbody {
  opacity: 0.62;
}

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

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th:first-child,
td:first-child {
  padding-left: 24px;
}

th:last-child,
td:last-child {
  padding-right: 24px;
}

th {
  background: #fbfdfd;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

td {
  color: var(--ink-soft);
  font-size: 0.78rem;
}

tbody tr {
  transition: background-color 150ms ease-out, box-shadow 150ms ease-out;
}

tbody tr:hover,
tbody tr:focus-within {
  background: #f5fafb;
  box-shadow: inset 3px 0 var(--primary);
}

.target-cell {
  max-width: 310px;
}

.target-cell strong,
.target-cell small {
  display: block;
}

.target-cell strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.target-cell small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.68rem;
}

.data-value {
  color: var(--ink);
  font-family: var(--font-data);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
}

.status-badge,
.type-badge,
.delivery-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 27px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-badge::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.status-badge.is-healthy,
.delivery-badge.is-sent {
  background: var(--healthy-soft);
  color: var(--healthy);
}

.status-badge.is-warning,
.delivery-badge.is-pending {
  background: var(--warning-soft);
  color: var(--warning);
}

.status-badge.is-critical,
.delivery-badge.is-failed {
  background: var(--critical-soft);
  color: var(--critical);
}

.status-badge.is-neutral {
  background: var(--neutral-soft);
  color: #47545b;
}

.type-badge {
  border: 1px solid var(--line);
  background: var(--surface-muted);
  color: var(--ink-soft);
  text-transform: capitalize;
}

.row-action {
  min-height: 40px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--primary-strong);
  font-size: 0.72rem;
  font-weight: 800;
  transition: transform 150ms ease-out, border-color 150ms ease-out, background-color 150ms ease-out, box-shadow 150ms ease-out;
}

.row-action:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 5px 14px rgba(25, 65, 74, 0.1);
}

.table-state {
  position: absolute;
  inset: 44px 0 0;
  display: grid;
  min-height: 176px;
  place-items: center;
  padding: 24px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
  font-size: 0.84rem;
  text-align: center;
}

.table-state[hidden] {
  display: none;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 13px;
  min-height: 70px;
  padding: 12px 24px;
}

.pagination span {
  color: var(--muted);
  font-family: var(--font-data);
  font-size: 0.72rem;
}

.page-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 2px 0;
  color: var(--muted);
  font-size: 0.7rem;
}

.detail-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: min(860px, calc(100dvh - 32px));
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 28px 80px rgba(11, 42, 49, 0.3);
}

.detail-dialog[open] {
  animation: dialog-enter 220ms var(--ease-enter) both;
}

.detail-dialog[open].is-closing {
  pointer-events: none;
  animation: dialog-exit 160ms var(--ease-exit) both;
}

.detail-dialog::backdrop {
  background: rgba(9, 35, 41, 0.58);
}

.detail-dialog[open]::backdrop {
  animation: backdrop-enter 220ms ease-out both;
}

.detail-dialog[open].is-closing::backdrop {
  animation: backdrop-exit 160ms ease-in both;
}

.dialog-shell {
  display: flex;
  max-height: min(860px, calc(100dvh - 32px));
  flex-direction: column;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}

.dialog-header h2 {
  max-width: 620px;
  overflow: hidden;
  font-size: 1.45rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-muted);
  color: var(--ink);
  transition: transform 150ms ease-out, background-color 150ms ease-out, color 150ms ease-out, box-shadow 150ms ease-out;
}

.icon-button:hover {
  background: var(--primary-soft);
  color: var(--primary-strong);
  box-shadow: 0 6px 16px rgba(25, 65, 74, 0.12);
}

.icon-button svg {
  width: 20px;
  height: 20px;
}

.dialog-body {
  overflow-y: auto;
  padding: 22px 24px 26px;
}

.dialog-body h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
}

.detail-failure {
  padding: 18px;
  border: 1px solid #e9a8a2;
  border-radius: var(--radius-sm);
  background: var(--critical-soft);
  color: #781b14;
}

.detail-summary dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 0;
}

.detail-summary dl > div {
  min-height: 80px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.detail-summary dt {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.detail-summary dd {
  margin: 6px 0 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 0.8rem;
}

.detail-skeleton-card {
  pointer-events: none;
}

.skeleton-line {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 99px;
  background: var(--canvas-deep);
}

.skeleton-line::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent);
  content: "";
  transform: translateX(-100%);
  animation: skeleton-shimmer 1.25s ease-in-out infinite;
}

.skeleton-label {
  width: 48%;
  height: 9px;
}

.skeleton-value {
  width: 68%;
  height: 13px;
}

.detail-skeleton-card:nth-child(3n + 2) .skeleton-label {
  width: 58%;
}

.detail-skeleton-card:nth-child(3n) .skeleton-value {
  width: 82%;
}

.history-section {
  margin-top: 26px;
}

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

.history-heading-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-heading-meta > span {
  color: var(--muted);
  font-family: var(--font-data);
  font-size: 0.7rem;
  white-space: nowrap;
}

.history-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.history-item {
  display: grid;
  grid-template-columns: minmax(130px, 0.7fr) minmax(0, 1.3fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-left: 3px solid var(--neutral);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--surface-muted);
}

.history-skeleton-item {
  pointer-events: none;
}

.skeleton-date {
  width: 76%;
  height: 10px;
}

.skeleton-status {
  width: 82%;
  height: 27px;
}

.skeleton-evidence {
  width: 92px;
  height: 10px;
  justify-self: end;
}

.history-item.is-healthy {
  border-color: var(--healthy);
}

.history-item.is-warning {
  border-color: var(--warning);
}

.history-item.is-critical {
  border-color: var(--critical);
}

.history-item time {
  color: var(--ink-soft);
  font-family: var(--font-data);
  font-size: 0.68rem;
}

.history-evidence {
  color: var(--muted);
  font-size: 0.72rem;
  text-align: right;
}

.history-all-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--primary-strong);
  font-size: 0.76rem;
  font-weight: 800;
  text-decoration: none;
  transition: transform 150ms ease-out, background-color 150ms ease-out, color 150ms ease-out, box-shadow 150ms ease-out;
}

.history-all-link[hidden] {
  display: none;
}

.history-all-link:hover {
  background: var(--primary-soft);
  color: var(--primary-strong);
  box-shadow: 0 5px 14px rgba(25, 65, 74, 0.1);
}

.history-all-link svg {
  width: 16px;
  height: 16px;
  transition: transform 180ms ease-out;
}

.history-all-link:hover svg {
  transform: translateX(2px);
}

.history-main {
  max-width: 1440px;
}

.history-topbar {
  margin-bottom: 24px;
}

.history-archive {
  overflow: hidden;
  box-shadow: none;
}

.history-archive-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 24px;
  border-bottom: 1px solid var(--line);
}

.history-archive-heading h2,
.history-results-heading h3 {
  margin: 0;
  font-family: var(--font-display);
}

.history-archive-heading h2 {
  overflow-wrap: anywhere;
  font-size: clamp(1.35rem, 2vw, 1.85rem);
}

.history-archive-heading p:last-child {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.archive-total {
  flex: 0 0 auto;
  color: var(--muted);
  font-family: var(--font-data);
  font-size: 0.72rem;
}

.history-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
}

.history-summary > div {
  min-height: 78px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.history-summary dt {
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 800;
}

.history-summary dd {
  margin: 6px 0 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 0.76rem;
}

.history-filter-bar {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) repeat(2, minmax(160px, 0.8fr)) auto;
  align-items: end;
  gap: 10px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
}

.history-clear {
  min-height: 44px;
  color: var(--primary-strong);
}

.history-clear:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.history-results-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 24px 12px;
}

.history-results-heading h3 {
  font-size: 1rem;
}

.history-results-heading span {
  color: var(--muted);
  font-family: var(--font-data);
  font-size: 0.7rem;
}

.history-table-shell {
  min-height: 250px;
}

.history-table td:first-child {
  width: 210px;
}

.history-table td:nth-child(2) {
  width: 180px;
}

.history-table td:last-child {
  width: 120px;
}

.history-evidence-cell {
  color: var(--ink-soft);
}

.history-empty-cell {
  height: 220px;
  color: var(--muted);
  text-align: center;
}

.history-empty-cell strong,
.history-empty-cell span {
  display: block;
}

.history-empty-cell strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.history-empty-cell span {
  margin-top: 6px;
  font-size: 0.8rem;
}

.history-pagination {
  border-top: 1px solid var(--line);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes loading {
  from { transform: translateX(-100%); }
  to { transform: translateX(340%); }
}

@keyframes inventory-progress {
  from { transform: translateX(-120%); }
  to { transform: translateX(390%); }
}

@keyframes skeleton-shimmer {
  to { transform: translateX(100%); }
}

@keyframes dialog-enter {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes dialog-exit {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
}

@keyframes backdrop-enter {
  from { background: rgba(9, 35, 41, 0); }
  to { background: rgba(9, 35, 41, 0.58); }
}

@keyframes backdrop-exit {
  from { background: rgba(9, 35, 41, 0.58); }
  to { background: rgba(9, 35, 41, 0); }
}

@media (max-width: 1180px) {
  :root {
    --sidebar-width: 84px;
  }

  .sidebar {
    align-items: center;
    padding-inline: 12px;
  }

  .brand > span:last-child,
  .side-nav a span:not(.nav-count),
  .side-nav-action span,
  .sidebar-note {
    display: none;
  }

  .side-nav {
    width: 100%;
  }

  .side-nav a,
  .side-nav-action {
    grid-template-columns: 1fr;
    justify-items: center;
    padding-inline: 6px;
  }

  .side-nav a[aria-current="page"] {
    box-shadow: inset 0 3px #6fd0de;
  }

  .nav-count {
    position: absolute;
    margin: -30px 0 0 28px;
  }

  .filter-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field-search {
    grid-column: span 2;
  }

  .history-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .snapshot-status {
    margin-right: auto;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .signal-card {
    grid-template-columns: minmax(140px, 0.7fr) minmax(220px, 1.5fr) auto;
  }

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

  .runbook-panel {
    min-height: 0;
  }
}

@media (max-width: 700px) {
  :root {
    --sidebar-width: 0px;
  }

  html {
    scroll-padding-top: 76px;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    inset: 0 0 auto 0;
    width: 100%;
    height: 68px;
    align-items: center;
    flex-direction: row;
    justify-content: space-between;
    padding: 10px 14px;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  }

  .brand-logo {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
  }

  .side-nav {
    display: flex;
    width: auto;
    gap: 2px;
    margin: 0;
  }

  .side-nav a,
  .side-nav-action {
    position: relative;
    width: 44px;
    min-height: 44px;
    border-radius: 8px;
  }

  .side-nav-action {
    margin-top: 0;
  }

  .side-nav-action::before {
    display: none;
  }

  .nav-count {
    position: absolute;
    top: -3px;
    right: -2px;
    min-width: 18px;
    margin: 0;
    padding: 1px 4px;
    font-size: 0.6rem;
  }

  .main-content {
    width: 100%;
    padding: 94px 14px 24px;
  }

  .topbar {
    margin-bottom: 34px;
  }

  .history-topbar .button {
    width: 100%;
  }

  .history-archive-heading {
    align-items: flex-start;
    flex-direction: column;
    padding: 20px 18px;
  }

  .history-summary {
    grid-template-columns: 1fr 1fr;
    padding-inline: 18px;
  }

  .history-filter-bar {
    grid-template-columns: 1fr;
    padding-inline: 18px;
  }

  .history-clear {
    width: 100%;
  }

  .history-results-heading {
    align-items: flex-start;
    flex-direction: column;
    padding-inline: 18px;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .snapshot-status {
    grid-column: span 2;
  }

  .button {
    width: 100%;
  }

  .section-heading,
  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .section-heading > p,
  .monitors-heading > p {
    text-align: left;
  }

  .metric-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .metric-card {
    min-height: 128px;
    padding: 16px;
  }

  .metric-value {
    font-size: 2rem;
  }

  .signal-rail::before {
    left: 22px;
  }

  .signal-card {
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding: 16px 14px 16px 48px;
  }

  .signal-card::before {
    left: 17px;
  }

  .signal-track {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .incidents-panel,
  .runbook-panel {
    padding: 18px;
    border-radius: var(--radius-md);
  }

  .alert-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .alert-meta {
    grid-column: 2;
    text-align: left;
  }

  .alert-meta span {
    display: inline;
    margin-left: 8px;
  }

  .monitors-panel {
    border-radius: var(--radius-md);
  }

  .monitors-heading {
    padding-inline: 18px;
  }

  .filter-bar {
    grid-template-columns: 1fr;
    padding: 16px 18px;
  }

  .field-search {
    grid-column: auto;
  }

  .table-shell {
    overflow: visible;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  thead {
    display: none;
  }

  tbody {
    padding: 8px 12px;
  }

  tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    margin-bottom: 10px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
  }

  td,
  th:first-child,
  td:first-child,
  th:last-child,
  td:last-child {
    padding: 9px 6px;
    border-bottom: 1px solid #e4edef;
  }

  td::before {
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    content: attr(data-label);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  td:nth-child(2) {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  td:last-child {
    grid-column: 1 / -1;
    border-bottom: 0;
  }

  .history-table td {
    width: auto;
  }

  .history-table td:first-child {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .history-table td:nth-child(2) {
    grid-column: 1;
    grid-row: 2;
  }

  .history-table td:nth-child(3) {
    grid-column: 1 / -1;
    grid-row: 3;
  }

  .history-table td:last-child {
    grid-column: 2;
    grid-row: 2;
    border-bottom: 1px solid #e4edef;
  }

  .history-table .history-empty-cell {
    grid-column: 1 / -1;
    grid-row: auto;
    border-bottom: 0;
  }

  .target-cell {
    max-width: none;
  }

  .row-action {
    width: 100%;
  }

  .table-state {
    inset: 0;
  }

  .pagination {
    justify-content: center;
    padding-inline: 14px;
  }

  .pagination .button {
    width: auto;
  }

  .page-footer {
    flex-direction: column;
    gap: 4px;
  }

  .detail-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
  }

  .dialog-shell {
    max-height: calc(100dvh - 16px);
  }

  .dialog-header,
  .dialog-body {
    padding-inline: 18px;
  }

  .detail-summary dl {
    grid-template-columns: 1fr 1fr;
  }

  .history-item {
    grid-template-columns: 1fr auto;
  }

  .history-item time {
    grid-column: 1 / -1;
  }
}

@media (max-width: 420px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 116px;
  }

  .detail-summary dl {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .button:not(:disabled):active,
  .icon-button:not(:disabled):active,
  .row-action:not(:disabled):active,
  .text-button:not(:disabled):active,
  .history-all-link:active {
    transform: none;
  }
}
