:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #18212b;
  background: #f4f6f8;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 4.5rem;
  padding: 0 2rem;
  color: #fff;
  background: #101820;
  box-shadow: 0 1px 0 #ffffff18;
}

.brand, nav { display: flex; align-items: center; gap: 1rem; }
.brand strong { font-size: 1.15rem; letter-spacing: .01em; }
.brand span { color: #b8c5d0; font-size: .8rem; }
nav { align-self: stretch; }
nav form { display: flex; align-items: center; height: 100%; margin-left: .25rem; }

button {
  border: 0;
  border-radius: .45rem;
  padding: .58rem .9rem;
  cursor: pointer;
}

nav > button, .sign-out {
  align-self: stretch;
  border-radius: 0;
  color: #c8d3dc;
  background: transparent;
  border-bottom: 3px solid transparent;
}

nav > button:hover, nav > button:focus-visible, nav > button.active {
  color: #fff;
  background: #ffffff0d;
  border-bottom-color: #66b2ff;
}

.sign-out { align-self: auto; height: auto; border: 1px solid #526371; border-radius: .45rem; }
.sign-out:hover, .sign-out:focus-visible { color: #fff; background: #263746; }

main { max-width: 1240px; margin: 0 auto; padding: 2.25rem 1.25rem 4rem; }
.toolbar { display: flex; justify-content: flex-end; gap: .75rem; margin-bottom: 1.25rem; }
.toolbar[hidden] { display: none; }

input, select {
  width: 100%;
  max-width: 22rem;
  padding: .68rem .75rem;
  border: 1px solid #cbd4dc;
  border-radius: .45rem;
  color: #18212b;
  background: #fff;
}

select { max-width: 12rem; }
input:focus, select:focus { outline: 3px solid #2d7fc133; border-color: #2d7fc1; }

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 1.75rem; line-height: 1.2; }
h2 { margin-bottom: 1rem; font-size: 1.05rem; }
a { color: #1769aa; text-underline-offset: .15em; }
a:hover { color: #0e4f83; }

.eyebrow {
  margin-bottom: .35rem;
  color: #627384;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.page-heading, .detail-heading, .overview-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.page-heading { margin-bottom: 1.25rem; }
.result-count { color: #627384; font-size: .85rem; }
.overview-heading { max-width: 46rem; margin-bottom: 1.75rem; }
.overview-heading h1 { margin-bottom: .65rem; }
.overview-heading > p:last-child { color: #627384; line-height: 1.55; }

.overview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.overview-panel, .detail-section {
  padding: 1.35rem;
  border: 1px solid #dfe5ea;
  border-radius: .7rem;
  background: #fff;
  box-shadow: 0 2px 8px #17212b0a;
}

.overview-panel-heading { margin-bottom: 1.15rem; }
.overview-panel-heading h2 { margin-bottom: 0; font-size: 1.25rem; }
.total-metric { display: flex; align-items: baseline; gap: .45rem; padding: .4rem .55rem; color: #18212b; background: transparent; }
.total-metric:hover { background: #f0f4f7; }
.total-metric strong { font-size: 1.65rem; }
.total-metric span { color: #627384; font-size: .78rem; text-transform: uppercase; }
.state-grid { display: grid; gap: .55rem; }
.state-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: .72rem .8rem;
  border: 1px solid #e2e7eb;
  color: #263442;
  background: #fafbfc;
}
.state-card:hover, .state-card:focus-visible { border-color: #91abc1; background: #f2f7fb; }
.state-card-label { display: flex; align-items: center; gap: .55rem; text-transform: capitalize; }
.state-card-label .badge { width: .65rem; height: .65rem; padding: 0; font-size: 0; }
.state-card strong { font-size: 1.15rem; }

.table-wrap { overflow-x: auto; border: 1px solid #dfe5ea; border-radius: .65rem; background: #fff; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: .8rem .9rem; border-bottom: 1px solid #e8edf1; text-align: left; vertical-align: top; }
thead th { color: #607080; background: #f8fafb; font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
tbody tr:last-child > * { border-bottom: 0; }
tbody tr:hover { background: #fafcfd; }

.badge { display: inline-block; padding: .2rem .52rem; border-radius: 1rem; color: #425362; background: #e4eaf0; font-size: .76rem; line-height: 1.25; text-transform: capitalize; white-space: nowrap; }
.ready, .running, .healthy, .true { color: #12623c; background: #d8f3e5; }
.failed, .down, .unhealthy, .false { color: #8b1c1c; background: #ffe0e0; }
.stale, .unknown, .pending, .reconciling { color: #754f00; background: #fff0c7; }
.draining, .stopped { color: #325777; background: #dcecf8; }

#error { margin-bottom: 1rem; padding: 1rem; border: 1px solid #efb9b9; border-radius: .5rem; color: #8b1c1c; background: #ffe7e7; }
.empty-state { padding: 2.5rem 1rem; border: 1px dashed #cbd4dc; border-radius: .65rem; color: #627384; background: #fff; text-align: center; }
.muted { color: #748290; }

.back-link { display: inline-block; margin-bottom: 1.3rem; font-size: .88rem; }
.detail-heading { margin-bottom: 1.25rem; }
.detail-heading > .badge { font-size: .82rem; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(18rem, 1fr); gap: 1.25rem; margin-bottom: 1.25rem; align-items: start; }
.detail-grid .detail-section:nth-child(n+3) { grid-column: 1 / -1; }
.detail-section { margin-bottom: 1.25rem; }
.detail-grid .detail-section { margin-bottom: 0; }
.detail-section > h2 { padding-bottom: .8rem; border-bottom: 1px solid #e7ebef; }
.detail-section > .table-wrap { border-radius: .45rem; }
.detail-table th { width: 11rem; color: #607080; background: #f8fafb; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.detail-table td { overflow-wrap: anywhere; }

.login { min-height: 100vh; display: grid; place-items: center; }
.login-card { width: min(26rem, 90vw); padding: 2rem; border-radius: .7rem; background: #fff; box-shadow: 0 8px 30px #0002; }
.login-card input { max-width: none; margin: .75rem 0; }
.login-card button { width: 100%; color: #fff; background: #1769aa; }

@media (max-width: 800px) {
  header { align-items: flex-start; flex-direction: column; padding: 1rem; }
  nav { align-self: stretch; min-height: 3rem; overflow-x: auto; }
  nav > button, .sign-out { padding: .55rem .75rem; }
  .overview-grid, .detail-grid { grid-template-columns: 1fr; }
  .detail-grid .detail-section:nth-child(n+3) { grid-column: auto; }
}

@media (max-width: 560px) {
  main { padding: 1.5rem .75rem 3rem; }
  .toolbar { align-items: stretch; flex-direction: column; }
  input, select { max-width: none; }
  th, td { padding: .65rem; font-size: .82rem; }
  .detail-table th { width: 8rem; white-space: normal; }
  .overview-panel, .detail-section { padding: 1rem; }
}
