:root {
  color-scheme: light;
  --bg: #f8fafc;
  --panel: #ffffff;
  --panel-soft: #f1f5f9;
  --text: #111827;
  --muted: #64748b;
  --line: #dbe3ee;
  --green: #16a34a;
  --green-bg: #dcfce7;
  --yellow: #d97706;
  --yellow-bg: #fef3c7;
  --red: #dc2626;
  --red-bg: #fee2e2;
  --gray: #64748b;
  --gray-bg: #e2e8f0;
  --focus: #2563eb;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(248, 250, 252, 0.96)),
    radial-gradient(circle at 18% 0%, rgba(20, 184, 166, 0.14), transparent 26%),
    radial-gradient(circle at 88% 12%, rgba(245, 158, 11, 0.12), transparent 28%),
    var(--bg);
  color: var(--text);
}

body.has-modal {
  overflow: hidden;
}

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

.shell {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.topbar,
.overview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.topbar {
  padding: 4px 0 28px;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 14px;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 75px;
  flex: 0 0 75px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f172a;
  color: #ffffff;
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark img {
  width: 80%;
  height: 80%;
  object-fit: contain;
}

.eyebrow,
.section-label {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  overflow-wrap: anywhere;
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  line-height: 1.1;
}

h2 {
  overflow-wrap: anywhere;
  font-size: clamp(1.45rem, 3vw, 2.35rem);
  line-height: 1.1;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  padding: 7px 12px;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
}

.overview {
  margin-bottom: 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 24px 0;
}

.meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: right;
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font: inherit;
}

.icon-button:hover,
.log-link:hover,
.service-name-link:hover,
.expand-button:hover {
  border-color: #94a3b8;
}

.icon-button:focus-visible,
.log-link:focus-visible,
.service-name-link:focus-visible,
.expand-button:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.22);
  outline-offset: 2px;
}

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

.log-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.52);
}

.log-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(860px, 100%);
  max-height: min(720px, calc(100vh - 48px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.22);
}

.log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
}

.log-header h2 {
  font-size: 1rem;
  line-height: 1.2;
}

.log-content {
  min-height: 260px;
  margin: 0;
  overflow: auto;
  background: #0f172a;
  color: #e5e7eb;
  padding: 18px;
  font: 0.86rem/1.55 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.empty-state,
.service-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.06);
}

.empty-state {
  padding: 24px;
  color: var(--muted);
}

.service-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 82px;
  padding: 18px;
}

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

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

.service-name {
  overflow-wrap: anywhere;
  font-size: 1rem;
  font-weight: 800;
}

.service-name-link {
  color: inherit;
  text-decoration: none;
}

.service-description {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.service-actions {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.service-actions .pill {
  order: 2;
}

.service-actions .log-link {
  order: 1;
}

.service-actions .expand-button {
  order: 3;
}

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

.status-up {
  background: var(--green);
}

.status-degraded {
  background: var(--yellow);
}

.status-down {
  background: var(--red);
}

.status-unknown {
  background: var(--gray);
}

.pill.status-up {
  border-color: var(--line);
  background: transparent;
  color: #166534;
}

.pill.status-degraded {
  border-color: var(--line);
  background: transparent;
  color: #92400e;
}

.pill.status-down {
  border-color: var(--line);
  background: transparent;
  color: #991b1b;
}

.pill.status-unknown {
  border-color: var(--line);
  background: transparent;
  color: #334155;
}

.log-link,
.expand-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 750;
  text-decoration: none;
}

.log-link {
  padding: 0 13px;
}

.expand-button {
  width: 38px;
  padding: 0;
  cursor: pointer;
}

.chevron {
  display: inline-block;
  transform: rotate(0deg);
  transition: transform 160ms ease;
}

.expand-button[aria-expanded="true"] .chevron {
  transform: rotate(90deg);
}

.components {
  display: grid;
  gap: 1px;
  border-top: 1px solid var(--line);
  background: var(--line);
}

.component-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  background: rgba(248, 250, 252, 0.9);
  padding: 12px 18px 12px 42px;
}

.component-title {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
  font-size: 0.92rem;
  font-weight: 760;
}

.component-detail {
  color: var(--muted);
  font-size: 0.84rem;
  text-align: right;
}

.hidden {
  display: none;
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 24px, 1080px);
    padding-top: 18px;
  }

  .topbar,
  .overview,
  .service-main,
  .component-row {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .topbar,
  .overview {
    flex-direction: column;
  }

  .meta,
  .service-actions {
    justify-content: flex-start;
  }

  .service-actions {
    max-width: 100%;
    overflow-x: auto;
  }

  .pill {
    justify-content: center;
  }

  .log-link {
    min-width: 68px;
  }

  .component-row {
    padding-left: 18px;
  }

  .component-detail {
    text-align: left;
  }
}
