/* Deployment console — dark, terminal-adjacent, deliberately no framework. */

:root {
  --bg: #0e1116;
  --bg-raised: #161b22;
  --bg-sunken: #0a0d12;
  --border: #262c36;
  --border-soft: #1d232c;
  --text: #e6edf3;
  --text-dim: #9198a1;
  --text-faint: #6b7280;
  --accent: #3d8bfd;
  --accent-dim: #1f4d8f;
  --ok: #3fb950;
  --warn: #d29922;
  --error: #f85149;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --radius: 10px;
}

* { box-sizing: border-box; }

/* Class-level `display` rules (.btn, .panel) outrank the UA stylesheet's
   [hidden] rule, which would leave hidden elements — the Cancel button, the
   console panel — visible. Restate it with priority. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 1.05rem; }
h2 { font-size: 0.95rem; }

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

.mono { font-family: var(--mono); }
.tiny { font-size: 12px; }
.muted { color: var(--text-dim); }
.right { text-align: right; }
.warn-tint { color: var(--warn); }

/* ------------------------------------------------------------------ login */

.login-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(1000px 500px at 50% -10%, #16233a 0%, transparent 70%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.login-card h1 { font-size: 1.35rem; margin-bottom: 20px; }

.hint { margin: 0 0 18px; color: var(--text-dim); font-size: 14px; }

label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
}

input[type="email"],
input[type="text"] {
  width: 100%;
  padding: 11px 13px;
  margin-bottom: 16px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
}

input:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.code-input {
  font-family: var(--mono);
  font-size: 26px;
  letter-spacing: 0.4em;
  text-align: center;
  padding: 14px 13px;
}

.row-between {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.message {
  margin: 18px 0 0;
  padding: 11px 13px;
  border-radius: 8px;
  font-size: 13.5px;
  border: 1px solid var(--border);
  background: var(--bg-sunken);
}
.message.error { border-color: #5c2b28; background: #2a1614; color: #ffb4ae; }
.message.ok    { border-color: #1f4429; background: #102416; color: #7ee295; }

/* ----------------------------------------------------------------- layout */

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-raised);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-left { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 22px; }
.topbar-sub { margin: 2px 0 0; font-size: 12.5px; color: var(--text-dim); }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.who { font-size: 13px; color: var(--text-dim); }

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  gap: 20px;
}

.panel {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
}

.panel-sub { margin: 3px 0 0; font-size: 12.5px; color: var(--text-dim); }

/* ------------------------------------------------------------- apps table */

.table-scroll { overflow-x: auto; }

table.apps {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

table.apps th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 600;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border-soft);
}

table.apps td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
}

table.apps tr:last-child td { border-bottom: none; }
table.apps tr.remote { opacity: 0.62; }
table.apps td.empty { text-align: center; color: var(--text-dim); padding: 32px; }

/* Keep the narrow columns on one line; only the app column may wrap. */
table.apps td:nth-child(2),
table.apps td:nth-child(3),
table.apps td:nth-child(5) { white-space: nowrap; }
table.apps td:first-child { min-width: 260px; }

/* Deep project paths shouldn't be allowed to dominate the row. */
.app-path {
  display: block;
  margin-top: 3px;
  max-width: 46ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-out { display: block; margin-top: 3px; }

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  color: var(--text-dim);
  white-space: nowrap;
}
.pill.running { border-color: #1f4429; background: #102416; color: #7ee295; }
.pill.partial { border-color: #4d3b13; background: #241c0c; color: #e3b341; }
.pill.stopped { border-color: #5c2b28; background: #2a1614; color: #ffb4ae; }
.pill.unknown,
.pill.loading,
.pill.neutral { background: var(--bg-sunken); }

.outcome { font-weight: 600; font-size: 13px; text-transform: capitalize; }
.outcome.succeeded { color: var(--ok); }
.outcome.failed, .outcome.interrupted { color: var(--error); }
.outcome.cancelled { color: var(--text-dim); }
.outcome.degraded { color: var(--warn); }
.outcome.running { color: var(--accent); }

/* --------------------------------------------------------------- buttons */

.btn {
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-sunken);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  white-space: nowrap;
  transition: background 120ms ease, border-color 120ms ease;
}
.btn:hover:not(:disabled) { border-color: #3a424e; background: #1c222b; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.small { padding: 7px 13px; font-size: 13px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #04101f; }
.btn.primary:hover:not(:disabled) { background: #549bff; border-color: #549bff; }
.btn.danger { border-color: #5c2b28; color: #ffb4ae; background: #1e1211; }
.btn.danger:hover:not(:disabled) { background: #2a1614; }
.btn.link {
  border: none;
  background: none;
  color: var(--accent);
  padding: 0;
  font-size: 13px;
}
.btn.link:hover:not(:disabled) { background: none; text-decoration: underline; }

form .btn.primary { width: 100%; padding: 11px 16px; }

/* --------------------------------------------------------------- console */

.console-head { align-items: flex-start; }
.console-actions { display: flex; gap: 8px; }

#banners:not(:empty) { padding: 14px 18px 0; display: grid; gap: 8px; }

.banner {
  padding: 10px 13px;
  border-radius: 8px;
  font-size: 13.5px;
  border: 1px solid var(--border);
  background: var(--bg-sunken);
}
.banner.warn  { border-color: #4d3b13; background: #241c0c; color: #e3b341; }
.banner.error { border-color: #5c2b28; background: #2a1614; color: #ffb4ae; }
.banner.ok    { border-color: #1f4429; background: #102416; color: #7ee295; }

.steps {
  list-style: none;
  margin: 0;
  padding: 16px 18px;
  display: grid;
  gap: 8px;
}

.step {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  align-items: baseline;
  gap: 10px;
  font-size: 14px;
  color: var(--text-dim);
}
.step-icon { font-size: 13px; }
.step-note { font-size: 12px; color: var(--text-faint); font-family: var(--mono); }
.step.running { color: var(--text); }
.step.running .step-icon { color: var(--accent); }
.step.ok .step-icon { color: var(--ok); }
.step.ok { color: var(--text); }
.step.failed { color: #ffb4ae; }
.step.failed .step-icon { color: var(--error); }
.step.cancelled .step-icon { color: var(--text-faint); }

.output-wrap { border-top: 1px solid var(--border-soft); }

.output-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 18px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: var(--bg-raised);
}

.follow {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  text-transform: uppercase;
  cursor: pointer;
}

.output {
  margin: 0;
  padding: 16px 18px;
  max-height: 460px;
  overflow: auto;
  background: var(--bg-sunken);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  color: #c9d1d9;
}

.output .cmd { color: var(--accent); font-weight: 600; display: inline-block; }

@media (max-width: 640px) {
  main { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .login-card { padding: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
