:root {
  --ink: #1a1a1a;
  --paper: #f7f5f1;
  --muted: #6b6b6b;
  --line: #d8d4cc;
  --accent: #1a1a1a;
  --error: #9b2c2c;
  --font: "Outfit", "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(ellipse at 20% 10%, rgba(255, 255, 255, 0.9), transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(220, 214, 200, 0.7), transparent 45%),
    var(--paper);
}

/* Public home */

.home-main {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}

.home-title {
  margin: 0;
  font-size: clamp(2.75rem, 8vw, 6.5rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 0.95;
  text-align: center;
  text-wrap: balance;
}

/* Auth + admin */

.auth-main,
.admin-main {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem;
}

.auth,
.admin {
  width: min(100%, 22rem);
}

.auth-title,
.admin-title {
  margin: 0 0 0.35rem;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.auth-kicker,
.admin-copy {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.auth-error {
  margin: 0 0 1rem;
  color: var(--error);
  font-size: 0.9rem;
}

.auth-form {
  display: grid;
  gap: 1rem;
}

.auth-label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 500;
}

.auth-input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
}

.auth-input:focus {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.auth-button {
  margin-top: 0.35rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
}

.auth-button:hover {
  background: #333;
  border-color: #333;
}

.auth-button-secondary {
  background: transparent;
  color: var(--ink);
}

.auth-button-secondary:hover {
  background: rgba(26, 26, 26, 0.06);
  border-color: var(--ink);
  color: var(--ink);
}

.auth-rule {
  margin: 1.75rem 0 1.25rem;
  border: none;
  border-top: 1px solid var(--line);
}

.auth-subtitle {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.admin-logout {
  margin-top: 0.5rem;
}

.admin-nav {
  margin: 0 0 1.25rem;
}

.admin-nav-link {
  color: var(--ink);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.admin-nav-link:hover {
  color: #333;
}

/* Admin health overview */

.admin-health-page .admin-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
}

.admin-top-hi {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
}

.admin-main-content {
  width: min(100%, 52rem);
  margin: 0 auto;
  padding: 0.5rem 1.25rem 3rem;
}

.health-title {
  margin: 0 0 1.5rem;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.health-section-title {
  margin: 0 0 0.85rem;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.health-resources {
  margin-bottom: 2rem;
}

.health-processes {
  margin-bottom: 0;
}

.health-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.resource-panel {
  display: grid;
  gap: 1.1rem;
  padding: 1.1rem 1.15rem 1.15rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
}

.resource-headline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.55rem 0.85rem;
  margin: 0;
}

.resource-percent {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.resource-aside {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 400;
}

.resource-bar {
  height: 0.65rem;
  margin: 0.75rem 0 0;
  background: rgba(26, 26, 26, 0.08);
  overflow: hidden;
}

.resource-bar-fill {
  display: block;
  height: 100%;
  background: #2f6b45;
  transition: width 0.2s ease;
}

.resource-level-warn .resource-bar-fill {
  background: #8a6d1d;
}

.resource-level-alert .resource-bar-fill {
  background: var(--error);
}

.resource-level-warn .resource-percent {
  color: #8a6d1d;
}

.resource-level-alert .resource-percent {
  color: var(--error);
}

.process-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
}

.process-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.process-table th,
.process-table td {
  padding: 0.7rem 0.85rem;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}

.process-table th {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.process-table tbody tr:last-child td {
  border-bottom: 1px solid var(--line);
}

.process-totals td {
  border-bottom: none;
  font-weight: 600;
  background: rgba(26, 26, 26, 0.03);
}

.process-name {
  font-weight: 500;
}

.process-status {
  color: var(--muted);
  font-weight: 500;
}

.process-status.is-online {
  color: #2f6b45;
}

.process-status.is-bad {
  color: var(--error);
}

.health-rule {
  margin: 2rem 0;
  border: none;
  border-top: 1px solid var(--line);
}

.health-pages .health-title {
  margin: 0 0 0.85rem;
}

.pages-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.pages-list a {
  color: var(--ink);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.pages-list a:hover {
  color: #333;
}

.pages-list li + li {
  margin-top: 0.45rem;
}

/* Users page */

.users-list {
  margin-bottom: 2rem;
}

.users-invite-section {
  margin-top: 0.5rem;
}

.users-invite-actions {
  margin-bottom: 1.25rem;
}

.invite-code-cell code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.users-reset-button {
  border: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  cursor: pointer;
  padding: 0;
}

.users-reset-button:hover {
  color: #333;
}

/* Deploy page */

.deploy-page {
  min-height: 100vh;
}

.admin-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
}

.admin-top-back {
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
}

.admin-top-back:hover {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.admin-top-logout button {
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0;
}

.admin-top-logout button:hover {
  color: var(--ink);
}

.deploy-sites {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.deploy-site {
  padding: 0.4rem 0.85rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.deploy-site.is-active {
  color: var(--ink);
  background: rgba(26, 26, 26, 0.06);
}

.deploy-title {
  margin: 0 0 0.35rem;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.deploy-kicker {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.admin-deploy-form {
  margin-bottom: 1.25rem;
}

.admin-deploy-button {
  min-width: 10rem;
  padding: 0.85rem 1.5rem;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.admin-deploy-button:hover:not(:disabled) {
  background: #333;
  border-color: #333;
}

.admin-deploy-button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.admin-deploy-phase {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 500;
}

.admin-deploy-running {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 400;
}

.admin-deploy-phase-starting,
.admin-deploy-phase-deploying,
.admin-deploy-phase-verifying {
  color: #8a6d1d;
}

.admin-deploy-phase-restarting {
  color: #8a6d1d;
  animation: deploy-pulse 1.4s ease-in-out infinite;
}

.admin-deploy-phase-success {
  color: #2f6b45;
}

.admin-deploy-phase-failed {
  color: var(--error);
}

@keyframes deploy-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

.admin-deploy-notice {
  margin: 0 0 1rem;
  font-size: 0.9rem;
}

.admin-deploy-notice-error {
  color: var(--error);
}

.admin-deploy-notice-success {
  color: #2f6b45;
}

.admin-deploy-summary {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.45;
}

.admin-deploy-line {
  margin: 0;
  color: var(--ink);
  font-weight: 400;
}

.admin-deploy-line strong {
  font-weight: 600;
}

.admin-deploy-line-success {
  color: #2f6b45;
}

.admin-deploy-line-failed {
  color: var(--error);
}
