:root {
  color-scheme: dark;
  --bg: #0f1216;
  --panel: #171d24;
  --panel-soft: #202832;
  --border: #2d3744;
  --text: #f4f7fb;
  --muted: #9ba8b8;
  --accent: #44c7a1;
  --accent-strong: #2fae89;
  --danger: #e45d5d;
  --warning: #d7a941;
  --unknown: #7b8796;
  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:
    radial-gradient(circle at 20% 0%, rgba(68, 199, 161, 0.14), transparent 32rem),
    linear-gradient(145deg, #0f1216 0%, #121821 100%);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  min-height: 2.45rem;
  border: 0;
  border-radius: 7px;
  padding: 0.65rem 0.9rem;
  background: var(--accent);
  color: #06120f;
  font-weight: 700;
  cursor: pointer;
}

button:hover:not(:disabled) {
  background: var(--accent-strong);
}

button:disabled {
  cursor: progress;
  opacity: 0.62;
}

button.secondary {
  background: var(--panel-soft);
  color: var(--text);
  border: 1px solid var(--border);
}

button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

button.danger {
  background: var(--danger);
  color: #170606;
}

.login-body {
  display: grid;
  place-items: center;
  padding: 1.2rem;
}

.login-shell {
  width: min(100%, 26rem);
}

.login-panel {
  background: rgba(23, 29, 36, 0.94);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 1.2rem 3rem rgba(0, 0, 0, 0.28);
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.7rem, 6vw, 2.4rem);
}

h2 {
  font-size: 1.05rem;
}

h3 {
  font-size: 1rem;
}

.login-form {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

label {
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.93rem;
}

input {
  width: 100%;
  min-height: 2.75rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0.7rem 0.8rem;
  background: #111820;
  color: var(--text);
}

.alert {
  margin-top: 1rem;
  padding: 0.75rem;
  border: 1px solid rgba(228, 93, 93, 0.55);
  border-radius: 7px;
  color: #ffd0d0;
  background: rgba(228, 93, 93, 0.12);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.3rem clamp(1rem, 4vw, 2rem);
  border-bottom: 1px solid var(--border);
  background: rgba(15, 18, 22, 0.82);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 2;
}

.topbar-actions {
  flex-wrap: wrap;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.nav-link,
.button-link {
  min-height: 2.45rem;
  display: inline-grid;
  place-items: center;
  border-radius: 7px;
  padding: 0.65rem 0.9rem;
  color: var(--text);
  text-decoration: none;
  background: var(--panel-soft);
  border: 1px solid var(--border);
  font-weight: 700;
}

.nav-link.is-active {
  color: #06120f;
  background: var(--accent);
  border-color: transparent;
}

.breadcrumb {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}

.dashboard {
  width: min(76rem, 100%);
  margin: 0 auto;
  padding: 1.3rem clamp(1rem, 4vw, 2rem) 2rem;
}

.page-description,
.admin-note {
  margin: 0 0 1rem;
  color: var(--muted);
}

.admin-note,
.panel-warning {
  padding: 0.75rem;
  border: 1px solid rgba(215, 169, 65, 0.45);
  border-radius: 7px;
  color: #ffe5a4;
  background: rgba(215, 169, 65, 0.12);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 21rem), 1fr));
  gap: 1rem;
}

.project-card {
  display: grid;
  gap: 1rem;
  min-height: 17rem;
  background: rgba(23, 29, 36, 0.92);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
}

.project-description {
  margin: 0;
  color: var(--muted);
}

.tag,
.project-owner {
  margin: 0.45rem 0 0;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 800;
}

.service-count {
  align-self: start;
  border-radius: 999px;
  padding: 0.32rem 0.58rem;
  color: var(--text);
  background: var(--panel-soft);
  border: 1px solid var(--border);
  font-size: 0.77rem;
  font-weight: 800;
}

.state-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 0;
}

.state-summary div {
  padding: 0.75rem;
  border-radius: 7px;
  background: #111820;
  border: 1px solid var(--border);
}

.state-summary dt {
  font-size: 0.78rem;
}

.state-summary dd {
  margin-top: 0.25rem;
  font-size: 1.4rem;
  font-weight: 800;
}

.service-section {
  display: grid;
  gap: 0.8rem;
  margin-top: 1.3rem;
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  gap: 1rem;
}

.service-card {
  display: grid;
  gap: 1.1rem;
  min-height: 18rem;
  background: rgba(23, 29, 36, 0.92);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
}

.service-card.is-loading {
  outline: 1px solid rgba(68, 199, 161, 0.5);
}

.card-header {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
}

code {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.status-pill {
  align-self: start;
  border-radius: 999px;
  padding: 0.32rem 0.58rem;
  color: #07100d;
  font-size: 0.77rem;
  font-weight: 800;
}

.status-active {
  background: var(--accent);
}

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

.status-failed {
  background: var(--danger);
}

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

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

.status-not-found {
  background: #b6793f;
}

.service-meta {
  display: grid;
  gap: 0.7rem;
  margin: 0;
}

.service-meta div {
  display: grid;
  grid-template-columns: 5.7rem 1fr;
  gap: 0.75rem;
  align-items: baseline;
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.service-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  align-self: end;
}

.logs-modal {
  width: min(70rem, calc(100vw - 1.5rem));
  max-height: min(42rem, calc(100vh - 1.5rem));
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0;
  background: var(--panel);
  color: var(--text);
}

.logs-modal::backdrop {
  background: rgba(0, 0, 0, 0.68);
}

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

.icon-button {
  width: 2.4rem;
  padding: 0;
}

pre {
  max-height: calc(100vh - 9rem);
  margin: 0;
  padding: 1rem;
  overflow: auto;
  white-space: pre-wrap;
  color: #d7e1ed;
}

@media (max-width: 43rem) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .topbar-actions form,
  .nav-link {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .topbar-actions form {
    display: block;
  }

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

  .card-header {
    flex-direction: column;
  }

  .status-pill {
    justify-self: start;
  }

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