:root {
  --bg: #0e1214;
  --card: #171e21;
  --border: #29343a;
  --text: #ece6d8;
  --muted: #98a39f;
  --accent: #d9a441;
  --accent-text: #1b1406;
  --ok: #5cbf86;
  --warn: #d9a441;
  --danger: #c0463c;
  --danger-text: #fff;
  --radius: 12px;
}

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

[hidden] {
  display: none !important;
}

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

body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 16px;
  background: radial-gradient(ellipse at top, #1d272b 0%, var(--bg) 60%);
  background-color: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.card {
  width: 100%;
  max-width: 420px;
  /* Let the grid item shrink below its content so long emails ellipsize
     instead of widening the card past the screen. */
  min-width: 0;
  padding: 28px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 20px 50px rgb(0 0 0 / 0.35);
}

.card-header {
  margin-bottom: 24px;
}

h1 {
  margin: 0;
  font-size: 1.6rem;
  letter-spacing: 0.02em;
}

.subtitle {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.view > p:first-child {
  margin-top: 0;
}

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

/* Status indicator */
.status {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.35rem;
  font-weight: 600;
}

.status-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}

.status[data-state="running"] .status-dot {
  background: var(--ok);
  box-shadow: 0 0 0 4px rgb(92 191 134 / 0.2);
}

.status[data-state="stopped"] .status-dot {
  background: var(--danger);
}

.status[data-state="pending"] .status-dot,
.status[data-state="stopping"] .status-dot,
.status[data-state="shutting-down"] .status-dot {
  background: var(--warn);
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

.status-detail {
  min-height: 1.5em;
  margin: 6px 0 0;
  font-size: 0.9rem;
}

.auto-stop {
  margin: 4px 0 0;
  font-size: 0.9rem;
}

.auto-stop:empty {
  margin: 0;
}

/* Buttons */
.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 22px;
}

.btn {
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn:focus-visible,
.btn-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

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

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

#view-signed-out .btn,
#view-loading .btn {
  width: 100%;
}

.btn-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
}

.message {
  margin: 20px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgb(255 255 255 / 0.04);
  font-size: 0.9rem;
}

.message[data-kind="error"] {
  border-color: rgb(212 90 79 / 0.5);
  background: rgb(212 90 79 / 0.12);
}

/* Collapsed but still rendered, so it stays in the accessibility tree. */
.message:empty {
  margin: 0;
  padding: 0;
  border: 0;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}

#user-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .status-dot {
    animation: none !important;
  }
}
