:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #1b1f24;
  --muted: #667085;
  --line: #d9dee7;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --danger: #b42318;
  --warning: #b54708;
  --ok: #087443;
  --shadow: 0 18px 45px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.shell {
  min-height: 100vh;
}

.topbar {
  align-items: center;
  background: #111827;
  color: #fff;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  min-height: 68px;
  padding: 14px max(18px, calc((100vw - 1180px) / 2));
}

.brand {
  min-width: 0;
}

.brand__title {
  font-size: 18px;
  font-weight: 750;
  line-height: 1.1;
}

.brand__meta {
  color: #cbd5e1;
  font-size: 13px;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar__actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.main {
  display: grid;
  gap: 18px;
  margin: 0 auto;
  max-width: 1180px;
  padding: 18px;
}

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

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

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

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

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

.metric__label,
.section-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.metric__value {
  font-size: 26px;
  font-weight: 780;
  line-height: 1.15;
  margin-top: 12px;
  overflow-wrap: anywhere;
}

.metric__sub {
  color: var(--muted);
  font-size: 13px;
  margin-top: 8px;
  overflow-wrap: anywhere;
}

.panel {
  padding: 18px;
}

.panel__head {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.panel__title {
  font-size: 18px;
  font-weight: 760;
}

.panel__sub {
  color: var(--muted);
  font-size: 14px;
  margin-top: 4px;
}

.project {
  display: flex;
  flex-direction: column;
  min-height: 230px;
  padding: 16px;
}

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

.project__type {
  align-self: flex-start;
  background: #eef6f4;
  border: 1px solid #c8e7e1;
  border-radius: 999px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 9px;
}

.status-pill {
  align-items: center;
  background: #f2f4f7;
  border: 1px solid #d0d5dd;
  border-radius: 999px;
  color: #475467;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 800;
  gap: 6px;
  min-height: 28px;
  padding: 0 9px;
}

.status-pill__dot {
  background: currentColor;
  border-radius: 50%;
  display: block;
  height: 8px;
  width: 8px;
}

.status-pill--running {
  background: #ecfdf3;
  border-color: #abefc6;
  color: var(--ok);
}

.status-pill--stopped,
.status-pill--missing {
  background: #fff1f3;
  border-color: #fecdd6;
  color: var(--danger);
}

.status-pill--unknown {
  background: #f8fafc;
  border-color: #d9dee7;
  color: var(--muted);
}

.project__name {
  font-size: 18px;
  font-weight: 760;
  margin-top: 14px;
}

.project__desc {
  color: var(--muted);
  flex: 1;
  font-size: 14px;
  line-height: 1.45;
  margin-top: 8px;
}

.project__link {
  color: var(--accent-strong);
  display: inline-block;
  font-size: 14px;
  font-weight: 700;
  margin-top: 12px;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.project__hint {
  color: var(--warning);
  font-size: 13px;
  margin-top: 10px;
}

.project__runtime {
  color: var(--muted);
  font-size: 13px;
  margin-top: 10px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.btn {
  align-items: center;
  background: #e9eef5;
  border-radius: 8px;
  color: var(--ink);
  display: inline-flex;
  font-weight: 740;
  gap: 8px;
  justify-content: center;
  min-height: 42px;
  min-width: 42px;
  padding: 0 14px;
  text-decoration: none;
  white-space: nowrap;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
}

.btn--dark {
  background: #1f2937;
  color: #fff;
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.btn--danger {
  background: #fee4e2;
  color: var(--danger);
}

.login {
  align-items: center;
  display: grid;
  min-height: 100vh;
  padding: 20px;
}

.login__card {
  margin: 0 auto;
  max-width: 430px;
  padding: 24px;
  width: 100%;
}

.login__title {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
}

.login__sub {
  color: var(--muted);
  line-height: 1.45;
  margin: 10px 0 22px;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.field label {
  color: #344054;
  font-size: 14px;
  font-weight: 700;
}

.field input {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  min-height: 48px;
  padding: 0 12px;
  width: 100%;
}

.error {
  color: var(--danger);
  font-size: 14px;
  min-height: 20px;
}

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

.status-table th,
.status-table td {
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  padding: 11px 8px;
  text-align: left;
  vertical-align: top;
}

.status-table th {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.empty {
  color: var(--muted);
  font-size: 14px;
  padding: 18px 0 4px;
}

.modal {
  align-items: end;
  background: rgba(17, 24, 39, 0.48);
  display: none;
  inset: 0;
  padding: 18px;
  position: fixed;
  z-index: 10;
}

.modal.is-open {
  display: grid;
}

.modal__panel {
  margin: 0 auto;
  max-height: min(680px, 88vh);
  max-width: 860px;
  overflow: hidden;
  width: 100%;
}

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

.modal__body {
  padding: 16px;
}

pre {
  background: #0f172a;
  border-radius: 8px;
  color: #e2e8f0;
  font-size: 13px;
  line-height: 1.45;
  margin: 0;
  max-height: 52vh;
  overflow: auto;
  padding: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

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

@media (max-width: 920px) {
  .grid--metrics,
  .grid--projects {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .topbar__actions {
    width: 100%;
  }

  .topbar__actions .btn {
    flex: 1;
  }

  .main {
    padding: 14px;
  }

  .grid--metrics,
  .grid--projects {
    grid-template-columns: 1fr;
  }

  .panel__head {
    flex-direction: column;
  }

  .metric__value {
    font-size: 24px;
  }

  .modal {
    padding: 10px;
  }
}
