:root {
  --ink: #0e1a1f;
  --ink-soft: #2a3d46;
  --paper: #f3f6f4;
  --mist: #d7e3dc;
  --line: rgba(14, 26, 31, 0.12);
  --accent: #0f6b5c;
  --accent-deep: #0a4a40;
  --accent-glow: rgba(15, 107, 92, 0.22);
  --warn: #9a5b1f;
  --danger: #8b2e2e;
  --ok: #1f6b3a;
  --running: #0f6b5c;
  --stopped: #6b7280;
  --pending: #9a5b1f;
  --radius: 14px;
  --font-display: "Instrument Serif", Georgia, serif;
  --font-body: "DM Sans", sans-serif;
  --shadow: 0 18px 50px rgba(8, 24, 28, 0.14);
}

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

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

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1200px 700px at 12% -10%, rgba(15, 107, 92, 0.18), transparent 55%),
    radial-gradient(900px 600px at 100% 0%, rgba(42, 61, 70, 0.12), transparent 50%),
    linear-gradient(165deg, #e8f0eb 0%, #f3f6f4 42%, #e4ece7 100%);
}

.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.35'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
  pointer-events: none;
}

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
  animation: rise 0.7s ease both;
}

.gate-inner {
  max-width: 28rem;
  text-align: left;
}

.brand,
.brand-mark {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 7vw, 4.2rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--ink);
}

.gate h1 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: clamp(1.1rem, 2.5vw, 1.35rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0.85rem 0 1.25rem;
  color: var(--accent-deep);
}

.lede {
  margin: 0 0 1.75rem;
  color: var(--ink-soft);
  font-size: 1.05rem;
  max-width: 22rem;
}

.fine {
  margin: 1rem 0 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
  opacity: 0.85;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.7rem 1.15rem;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn.primary {
  background: var(--accent);
  color: #f7fffc;
  box-shadow: 0 10px 28px var(--accent-glow);
}

.btn.primary:hover {
  background: var(--accent-deep);
}

.btn.ghost {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.45);
}

.btn.ghost:hover {
  border-color: rgba(14, 26, 31, 0.28);
  background: rgba(255, 255, 255, 0.75);
}

.btn.danger {
  border-color: rgba(139, 46, 46, 0.25);
  color: var(--danger);
  background: rgba(139, 46, 46, 0.06);
}

.app {
  min-height: 100vh;
  animation: rise 0.55s ease both;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  background: rgba(243, 246, 244, 0.72);
  position: sticky;
  top: 0;
  z-index: 5;
}

.top-brand {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
}

.brand-mark {
  font-size: 1.85rem;
}

.brand-sub {
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--accent-deep);
}

.top-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
}

.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  font-size: 0.88rem;
}

.role {
  color: var(--ink-soft);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.main {
  padding: 1.5rem clamp(1rem, 3vw, 2rem) 3rem;
  max-width: 980px;
  margin: 0 auto;
}

.toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.toolbar h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.6rem);
  font-weight: 400;
  letter-spacing: -0.02em;
}

.toolbar-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.status {
  min-height: 1.25rem;
  margin: 0 0 1rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.status.error {
  color: var(--danger);
}

.instance-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.instance {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
  animation: rise 0.45s ease both;
}

.instance-title {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

.instance-title h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.instance-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.meta a {
  color: var(--accent-deep);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(15, 107, 92, 0.35);
}

.meta a:hover {
  border-bottom-color: var(--accent-deep);
}

.state {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--stopped);
}

.state::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: currentColor;
}

.state.running,
.state.pending {
  color: var(--running);
}

.state.pending,
.state.stopping,
.state.starting {
  color: var(--pending);
}

.state.stopped,
.state.stopping {
  color: var(--stopped);
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  align-items: stretch;
  min-width: 8.5rem;
}

.empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--ink-soft);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.35);
}

.sheet {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0;
  width: min(440px, calc(100vw - 2rem));
  box-shadow: var(--shadow);
  background: #f8fbf9;
}

.sheet::backdrop {
  background: rgba(10, 24, 28, 0.45);
  backdrop-filter: blur(3px);
}

.sheet-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.35rem 1.35rem 1.2rem;
}

.sheet-form header h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 400;
}

.sheet-form header p {
  margin: 0.35rem 0 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.sheet-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}

.sheet-form input {
  font: inherit;
  font-weight: 500;
  color: var(--ink);
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
}

.sheet-form input:focus {
  outline: 2px solid rgba(15, 107, 92, 0.35);
  border-color: var(--accent);
}

.sheet-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 720px) {
  .top {
    flex-direction: column;
    align-items: stretch;
  }

  .top-user {
    justify-content: space-between;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .instance {
    grid-template-columns: 1fr;
  }

  .actions {
    flex-direction: row;
    flex-wrap: wrap;
    min-width: 0;
  }
}
