:root {
  --bg: #09111f;
  --panel: rgba(9, 17, 31, 0.86);
  --panel-soft: rgba(15, 23, 42, 0.76);
  --panel-border: rgba(148, 163, 184, 0.18);
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #22c55e;
  --accent-dark: #15803d;
  --danger: #ef4444;
  --warning: #f59e0b;
  --shadow: 0 28px 60px rgba(2, 6, 23, 0.45);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI", Tahoma, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(34, 197, 94, 0.18), transparent 30%),
    radial-gradient(circle at bottom right, rgba(14, 165, 233, 0.18), transparent 24%),
    linear-gradient(135deg, #020617, #0f172a 40%, #111827);
  color: var(--text);
}

.layout {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0;
}

.hero {
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #86efac;
  font-size: 0.75rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.4rem, 4vw, 4.2rem);
  line-height: 0.95;
}

.subtitle {
  max-width: 620px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 1.05rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.auth-shell {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 260px);
}

.login-card {
  width: min(460px, 100%);
  display: grid;
  gap: 18px;
  padding: 28px;
  border-radius: 28px;
  background:
    linear-gradient(160deg, rgba(8, 47, 73, 0.45), transparent 40%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(2, 6, 23, 0.92));
  border: 1px solid rgba(125, 211, 252, 0.18);
  box-shadow: var(--shadow);
}

.login-card h2 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 2.6rem);
}

.login-copy {
  margin: 10px 0 0;
  color: var(--muted);
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  color: #dbeafe;
  font-size: 0.92rem;
  font-weight: 600;
}

.field input {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(2, 6, 23, 0.58);
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.field input:focus {
  border-color: rgba(34, 197, 94, 0.7);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.14);
  background: rgba(2, 6, 23, 0.82);
}

.login-error {
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  color: #fecaca;
  background: rgba(127, 29, 29, 0.38);
  border: 1px solid rgba(248, 113, 113, 0.24);
}

.login-button {
  justify-self: start;
  min-width: 140px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.panel-header h2,
.app-name {
  margin: 0;
}

.panel-header p,
.app-meta,
.message,
.run-at,
.loading,
.session-badge {
  color: var(--muted);
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.session-badge {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(125, 211, 252, 0.1);
  border: 1px solid rgba(125, 211, 252, 0.12);
}

.ghost-button,
.deploy-button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease, background 160ms ease;
}

.ghost-button {
  background: rgba(148, 163, 184, 0.14);
  color: var(--text);
}

.danger-button {
  background: rgba(239, 68, 68, 0.12);
  color: #fecaca;
}

.deploy-button {
  background: linear-gradient(135deg, var(--accent), #4ade80);
  color: #052e16;
  font-weight: 700;
}

.ghost-button:hover,
.deploy-button:hover {
  transform: translateY(-1px);
}

.ghost-button:disabled,
.deploy-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.app-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
}

.app-card {
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 22px;
  padding: 18px;
  background: linear-gradient(180deg, var(--panel-soft), rgba(2, 6, 23, 0.88));
}

.card-top,
.card-actions {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.app-meta {
  margin: 6px 0 0;
  font-size: 0.9rem;
}

.message {
  min-height: 44px;
  margin: 18px 0;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.status-badge[data-status="idle"] {
  background: rgba(148, 163, 184, 0.16);
  color: #cbd5e1;
}

.status-badge[data-status="running"] {
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
}

.status-badge[data-status="success"] {
  background: rgba(34, 197, 94, 0.16);
  color: #86efac;
}

.status-badge[data-status="failed"] {
  background: rgba(239, 68, 68, 0.16);
  color: #fca5a5;
}

.run-at {
  font-size: 0.85rem;
}

.log-box {
  margin: 18px 0 0;
  padding: 14px;
  min-height: 180px;
  max-height: 240px;
  overflow: auto;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.12);
  color: #dbeafe;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.83rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.loading.error {
  color: #fca5a5;
}

@media (max-width: 720px) {
  .layout {
    width: min(100% - 20px, 1120px);
    padding: 28px 0;
  }

  .panel {
    padding: 18px;
  }

  .panel-header,
  .card-top,
  .card-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .header-actions {
    justify-content: stretch;
  }

  .login-card {
    padding: 22px;
  }

  .login-button,
  .session-badge {
    width: 100%;
    justify-content: center;
  }
}
