:root {
  --ink: #12170f;
  --moss: #1f3d2a;
  --leaf: #7cff9b;
  --sand: #e7dfc8;
  --clay: #c45c26;
  --fog: rgba(231, 223, 200, 0.12);
  --line: rgba(231, 223, 200, 0.22);
  --danger: #ff7a66;
  --ok: #7cff9b;
  --font-display: "Bricolage Grotesque", Georgia, serif;
  --font-body: "Source Sans 3", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--sand);
  font-family: var(--font-body);
  background: var(--ink);
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(196, 92, 38, 0.35), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 10%, rgba(31, 61, 42, 0.8), transparent 50%),
    linear-gradient(165deg, #0d120c 0%, #162116 42%, #0f1410 100%);
  pointer-events: none;
}

.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.08;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1080px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 3.5rem 0 4rem;
}

.brand-block {
  margin-bottom: 2.25rem;
  animation: rise 700ms ease-out both;
}

.eyebrow {
  margin: 0 0 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(231, 223, 200, 0.65);
}

h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.8rem, 8vw, 5rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--sand);
}

.lede {
  margin: 1rem 0 0;
  max-width: 38rem;
  font-size: 1.1rem;
  line-height: 1.5;
  color: rgba(231, 223, 200, 0.82);
}

.panel {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.5rem;
  animation: rise 900ms 80ms ease-out both;
}

form, .status-rail {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(18, 23, 15, 0.72), rgba(18, 23, 15, 0.45));
  backdrop-filter: blur(10px);
  padding: 1.35rem;
}

.field {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 1.1rem;
}

.field.compact { max-width: 8rem; }

.field span {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.field em {
  font-style: normal;
  color: rgba(231, 223, 200, 0.45);
  margin-left: 0.35rem;
}

input, select, button {
  font: inherit;
}

input, select {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  color: var(--sand);
  padding: 0.85rem 0.9rem;
  border-radius: 0;
}

input:focus, select:focus {
  outline: 2px solid rgba(124, 255, 155, 0.45);
  outline-offset: 1px;
}

.inline {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
}

.hint {
  margin: 0;
  font-size: 0.92rem;
  color: rgba(231, 223, 200, 0.7);
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  color: var(--leaf);
}

.check {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0.4rem 0 1.25rem;
  color: rgba(231, 223, 200, 0.85);
}

.primary, .ghost {
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.primary {
  width: 100%;
  padding: 0.95rem 1rem;
  background: var(--clay);
  color: #fff8ef;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
}

.primary:hover { transform: translateY(-1px); background: #d4682d; }
.primary:disabled { opacity: 0.55; cursor: wait; transform: none; }

.ghost {
  padding: 0 1rem;
  background: transparent;
  border-color: var(--line);
  color: var(--sand);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.ghost:hover { border-color: var(--leaf); color: var(--leaf); }

.watcher {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.watcher strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.1rem;
}

.watcher p {
  margin: 0.25rem 0 0;
  font-size: 0.92rem;
  color: rgba(231, 223, 200, 0.7);
}

.dot {
  width: 0.7rem;
  height: 0.7rem;
  margin-top: 0.35rem;
  border-radius: 50%;
  background: #666;
  flex: 0 0 auto;
}

.dot.live {
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(124, 255, 155, 0.6);
  animation: pulse 1.8s infinite;
}

.dot.down { background: var(--danger); }

.result, .logs {
  margin-bottom: 1rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  font-size: 0.95rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.result.ok { border-color: rgba(124, 255, 155, 0.45); }
.result.error { border-color: rgba(255, 122, 102, 0.55); color: #ffd2ca; }

.logs {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: rgba(231, 223, 200, 0.75);
  max-height: 10rem;
  overflow: auto;
}

.events h2 {
  margin: 0 0 0.65rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.events ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
  max-height: 18rem;
  overflow: auto;
}

.events li {
  display: grid;
  gap: 0.15rem;
  padding: 0.55rem 0.65rem;
  border-left: 2px solid var(--line);
  background: var(--fog);
  font-size: 0.9rem;
}

.events li.provision_success,
.events li.deploy_succeeded,
.events li.deploy_fix_ready { border-left-color: var(--ok); }
.events li.provision_failed,
.events li.watcher_error,
.events li.deploy_failed,
.events li.deploy_fix_failed,
.events li.deploy_monitor_error { border-left-color: var(--danger); }
.events li.repo_detected,
.events li.deploy_started { border-left-color: var(--clay); }

.event-link {
  display: inline-block;
  margin-top: 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.event-hint {
  display: block;
  margin-top: 0.2rem;
  color: rgba(255, 210, 202, 0.85);
  font-size: 0.8rem;
}

.events time {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: rgba(231, 223, 200, 0.5);
}

.hidden { display: none; }

a { color: var(--leaf); }

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

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(124, 255, 155, 0.55); }
  70% { box-shadow: 0 0 0 10px rgba(124, 255, 155, 0); }
  100% { box-shadow: 0 0 0 0 rgba(124, 255, 155, 0); }
}

@media (max-width: 820px) {
  .panel { grid-template-columns: 1fr; }
  .shell { padding-top: 2rem; }
}

.login-shell {
  max-width: 560px;
}

.login-panel {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(18, 23, 15, 0.72), rgba(18, 23, 15, 0.45));
  backdrop-filter: blur(10px);
  padding: 1.35rem;
  animation: rise 900ms 80ms ease-out both;
}

.login-panel input {
  letter-spacing: 0.35em;
  font-family: var(--font-mono);
  font-size: 1.35rem;
  text-align: center;
}

.topbar-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

.topbar-actions button {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--sand);
  cursor: pointer;
}

.topbar-actions button:hover {
  border-color: var(--leaf);
  color: var(--leaf);
}
