:root {
  color-scheme: light;
  --ink: #173b57;
  --ink-deep: #0d293e;
  --paper: #f6f4ed;
  --white: #fffef9;
  --line: #d7ddd9;
  --muted: #667780;
  --healthy: #16845b;
  --healthy-soft: #dff2e9;
  --running: #c97820;
  --running-soft: #f7ead8;
  --danger: #bb3a3a;
  --danger-soft: #f7dfdc;
  --radius: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink-deep);
  background: var(--paper);
  font-family: "Aptos", "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.masthead {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; font-weight: 750; letter-spacing: -0.02em; }
.live-indicator { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 0.88rem; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--healthy); }

main, footer { width: min(1180px, calc(100% - 48px)); margin-inline: auto; }

.overview {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  min-height: 390px;
  align-items: center;
  gap: 64px;
}

.context { margin: 0 0 18px; color: var(--muted); font-size: 0.95rem; }
h1 { margin: 0; max-width: 700px; color: var(--ink); font-size: clamp(3.25rem, 7vw, 6rem); line-height: 0.92; letter-spacing: -0.065em; font-weight: 720; }
.lede { max-width: 540px; margin: 26px 0 0; color: var(--muted); font-size: 1.15rem; line-height: 1.6; }

.overall-status {
  background: var(--ink);
  color: var(--white);
  border-radius: 50% 50% 18px 18px;
  min-height: 250px;
  padding: 54px 34px 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.overall-status p { color: #c7d4dc; margin: 0 0 8px; font-size: 0.88rem; }
.overall-status strong { display: block; font-size: 1.75rem; letter-spacing: -0.035em; line-height: 1.15; }
.overall-status[data-status="down"] { background: var(--danger); }
.overall-status[data-status="degraded"] { background: var(--running); }
.signal { display: flex; align-items: flex-end; gap: 5px; height: 44px; }
.signal span { display: block; width: 8px; border-radius: 5px; background: #54d49f; }
.signal span:nth-child(1) { height: 16px; }
.signal span:nth-child(2) { height: 29px; }
.signal span:nth-child(3) { height: 44px; }
.overall-status[data-status="down"] .signal span, .overall-status[data-status="degraded"] .signal span { background: var(--white); }

.summary-strip { display: grid; grid-template-columns: repeat(4, 1fr); border-block: 1px solid var(--line); }
.summary-strip div { padding: 26px 24px; display: flex; flex-direction: column; gap: 5px; border-right: 1px solid var(--line); }
.summary-strip div:first-child { padding-left: 0; }
.summary-strip div:last-child { border-right: 0; }
.summary-strip strong { color: var(--ink); font-size: 1.75rem; letter-spacing: -0.04em; }
.summary-strip span { color: var(--muted); font-size: 0.85rem; }

.fleet { padding: 70px 0 90px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
h2 { margin: 0 0 8px; color: var(--ink); font-size: 2rem; letter-spacing: -0.04em; }
.section-heading p { margin: 0; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 16px; color: var(--muted); font-size: 0.78rem; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; }
.legend-dot.healthy { background: var(--healthy); }
.legend-dot.running { background: var(--running); }
.legend-dot.failing { background: var(--danger); }

.fleet-tools { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 0 0 18px; }
.search-field { width: min(100%, 470px); min-height: 48px; padding: 0 15px; display: flex; align-items: center; gap: 11px; color: var(--muted); background: var(--white); border: 1px solid var(--line); border-radius: 14px; }
.search-field:focus-within { border-color: var(--ink); outline: 3px solid #dce7ec; }
.search-field > svg { display: block; width: 19px; min-width: 19px; max-width: 19px; height: 19px; flex: 0 0 19px; }
.search-field input { width: 100%; border: 0; outline: 0; color: var(--ink-deep); background: transparent; font: inherit; font-size: 0.9rem; }
.search-field input::placeholder { color: #87949a; }
.search-result { min-width: 180px; margin: 0; color: var(--muted); font-size: 0.8rem; text-align: right; }

.instances { display: grid; gap: 18px; }
.instance { overflow: hidden; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.instance-header { padding: 24px 26px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 18px; border-bottom: 1px solid var(--line); }
.instance-identity { display: flex; align-items: center; gap: 14px; min-width: 0; }
.instance-icon { width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 12px; color: var(--ink); background: #e7edf0; }
.instance-icon svg { width: 21px; }
.instance-name { margin: 0; font-size: 1.05rem; overflow-wrap: anywhere; }
.instance-meta { margin: 4px 0 0; color: var(--muted); font-size: 0.78rem; }
.instance-state { display: inline-flex; align-items: center; gap: 8px; font-size: 0.82rem; font-weight: 650; }
.instance-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.state-operational { color: var(--healthy); }
.state-degraded { color: var(--running); }
.state-down { color: var(--danger); }

.service-head, .service-row { display: grid; grid-template-columns: minmax(190px, 1.4fr) minmax(170px, 1fr) 145px 100px; gap: 18px; align-items: center; }
.service-head { padding: 12px 26px; color: var(--muted); font-size: 0.72rem; border-bottom: 1px solid var(--line); }
.service-row { padding: 17px 26px; border-bottom: 1px solid #e9ece8; }
.service-row:last-child { border-bottom: 0; }
.service-identity { min-width: 0; display: flex; align-items: center; gap: 11px; }
.service-icon { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; color: var(--muted); background: #eef1ef; border-radius: 10px; }
.service-icon svg { width: 18px; }
.service-name { min-width: 0; }
.service-name strong { display: block; margin-bottom: 3px; font-size: 0.92rem; overflow-wrap: anywhere; }
.service-name span, .service-image, .service-restarts { color: var(--muted); font-size: 0.75rem; overflow-wrap: anywhere; }
.status-pill { justify-self: start; display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 680; }
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-healthy { color: var(--healthy); background: var(--healthy-soft); }
.status-running, .status-starting { color: var(--running); background: var(--running-soft); }
.status-failing { color: var(--danger); background: var(--danger-soft); }
.empty { padding: 44px 28px; text-align: center; color: var(--muted); background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.empty strong { display: block; color: var(--ink); margin-bottom: 7px; }

footer { min-height: 90px; display: flex; justify-content: space-between; align-items: center; gap: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.8rem; }
footer b { color: inherit; }

@media (max-width: 760px) {
  .masthead, main, footer { width: min(100% - 30px, 1180px); }
  .masthead { min-height: 76px; }
  .live-indicator span:last-child { max-width: 130px; text-align: right; }
  .overview { grid-template-columns: 1fr; min-height: 0; padding: 70px 0 38px; gap: 38px; }
  h1 { font-size: clamp(3rem, 16vw, 4.8rem); }
  .overall-status { min-height: 210px; border-radius: 100px 100px 18px 18px; }
  .summary-strip { grid-template-columns: 1fr 1fr; }
  .summary-strip div { padding: 20px 14px; border-bottom: 1px solid var(--line); }
  .summary-strip div:nth-child(2) { border-right: 0; }
  .summary-strip div:nth-child(3) { padding-left: 0; border-bottom: 0; }
  .summary-strip div:nth-child(4) { border-bottom: 0; }
  .section-heading { align-items: start; flex-direction: column; }
  .legend { justify-content: flex-start; }
  .fleet-tools { align-items: flex-start; flex-direction: column; }
  .search-field { width: 100%; }
  .search-result { min-width: 0; text-align: left; }
  .instance-header { padding: 20px; }
  .service-head { display: none; }
  .service-row { grid-template-columns: 1fr auto; padding: 17px 20px; gap: 10px 16px; }
  .service-image { grid-column: 1 / -1; padding-left: 45px; }
  .service-restarts { text-align: right; }
  footer { flex-direction: column; align-items: flex-start; justify-content: center; }
}

@media (prefers-reduced-motion: no-preference) {
  .live-dot { animation: breathe 2.4s ease-in-out infinite; }
  @keyframes breathe { 50% { opacity: 0.35; } }
}

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