/* ================================================================
   Qatalyst, dark industrial, purple accents
   ================================================================ */

:root {
  --bg-dark: #0a0a14;
  --bg-card: #141421;
  --bg-panel: #1a1a2e;
  --bg-hover: #22223a;

  --purple: #7B2FBE;
  --purple-light: #9B4DCA;
  --purple-glow: #C084FC;
  --purple-bg: #2a1b4a;

  --accent: #06b6d4;
  --accent-soft: #0891b2;

  --text: #f5f5f7;
  --text-mid: #cbd5e1;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --border: #27273e;
  --border-strong: #3a3a52;

  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;

  --radius: 12px;
  --radius-sm: 6px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg-dark);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
}

body {
  background: radial-gradient(ellipse at top, rgba(123, 47, 190, 0.12) 0%, var(--bg-dark) 60%);
}

a { color: var(--purple-glow); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Nav ---------- */

.qnav {
  display: flex; align-items: center;
  padding: 1rem 2rem;
  background: rgba(10, 10, 20, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}

.qnav-brand {
  display: flex; align-items: center; gap: 0.6rem;
  text-decoration: none; color: var(--text); margin-right: 3rem;
}
.qnav-brand:hover { text-decoration: none; }

.qnav-logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--purple) 0%, var(--purple-light) 100%);
  border-radius: 8px;
  font-weight: 800; font-size: 20px; letter-spacing: 2px; color: #fff;
  box-shadow: 0 0 20px rgba(123, 47, 190, 0.4);
}

.qnav-title { font-weight: 700; letter-spacing: 3px; font-size: 15px; }
.qnav-sub { font-weight: 400; letter-spacing: 2px; font-size: 13px; color: var(--purple-glow); }

.qnav-links { display: flex; list-style: none; margin: 0; padding: 0; gap: 0.3rem; }

.qnav-links a {
  padding: 0.5rem 1rem;
  color: var(--text-mid); font-size: 14px; font-weight: 500;
  border-radius: var(--radius-sm); transition: all 0.15s;
}
.qnav-links a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.qnav-links a.active { background: var(--purple-bg); color: var(--purple-glow); }

.qnav-meta { margin-left: auto; display: flex; align-items: center; gap: 0.7rem; }

/* ---------- Main ---------- */

.qmain {
  max-width: 1320px; margin: 0 auto; padding: 2rem;
  display: flex; flex-direction: column; gap: 1.5rem;
}

/* ---------- Typography ---------- */

h1 { font-size: 2.2rem; margin: 0 0 0.5rem; letter-spacing: -0.5px; line-height: 1.15; }
h2 { font-size: 1.2rem; margin: 0 0 1rem; font-weight: 600; }
h3 { font-size: 1.05rem; margin: 0 0 0.5rem; font-weight: 600; }
p { margin: 0 0 1rem; color: var(--text-mid); }

.muted { color: var(--text-muted); }
.lead { font-size: 1.05rem; color: var(--text-mid); max-width: 62ch; }
.text-center { text-align: center; }
.eyebrow {
  font-size: 12px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--purple-glow); margin-bottom: 0.5rem;
}
code {
  font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 0.9em;
  color: var(--purple-glow); background: var(--bg-panel); padding: 2px 6px; border-radius: 4px;
}

/* ---------- Hero ---------- */

.hero {
  padding: 3rem 2rem; position: relative; overflow: hidden;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-panel) 100%);
  border: 1px solid var(--border);
}
.hero-text { position: relative; z-index: 2; max-width: 720px; }
.hero-text h1 {
  font-size: 2.6rem;
  background: linear-gradient(120deg, #fff 0%, var(--purple-glow) 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-glow {
  position: absolute; top: -50px; right: -50px;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(123, 47, 190, 0.3) 0%, transparent 70%);
  border-radius: 50%; z-index: 1;
}
.hero-ctas { display: flex; gap: 0.7rem; margin-top: 1.5rem; flex-wrap: wrap; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.6rem 1.2rem; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 14px; text-decoration: none; cursor: pointer; border: none;
  transition: all 0.15s; font-family: inherit;
}
.btn:hover { text-decoration: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--purple) 0%, var(--purple-light) 100%);
  color: #fff; box-shadow: 0 0 20px rgba(123, 47, 190, 0.25);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 0 30px rgba(123, 47, 190, 0.45); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border-strong); }
.btn-ghost:hover { background: var(--bg-hover); }

.btn-sm { padding: 0.4rem 0.9rem; font-size: 13px; }
.btn-lg { padding: 0.8rem 1.6rem; font-size: 15px; }

.full-width { width: 100%; justify-content: center; }

/* ---------- Panel ---------- */

.panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
}
.panel-narrow { max-width: 560px; margin: 0 auto; width: 100%; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.panel-head h2 { margin: 0; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

.cta-panel {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1.5rem; flex-wrap: wrap;
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(42, 27, 74, 0.4) 100%);
}

/* ---------- Page head ---------- */

.page-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  padding: 0.5rem 0; flex-wrap: wrap; gap: 1rem;
}

.page-actions { display: flex; align-items: center; gap: 0.5rem; }

.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text-dim); transition: background 0.2s; }
.status-dot.running { background: var(--warning); animation: pulse 1s infinite; }
.status-dot.ok { background: var(--success); }
.status-dot.err { background: var(--error); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ---------- Pipeline nodes ---------- */

.pipeline-row, .pipeline-trace {
  display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap;
}
.pipe-node {
  padding: 0.55rem 0.9rem;
  background: var(--purple-bg); color: var(--purple-glow);
  border-radius: var(--radius-sm);
  font-weight: 600; font-size: 13px;
  border: 1px solid var(--purple); transition: all 0.2s;
}
.pipe-node.inactive { background: var(--bg-panel); color: var(--text-dim); border-color: var(--border); }
.pipe-node.active { background: var(--purple); color: #fff; box-shadow: 0 0 15px rgba(123, 47, 190, 0.5); }
.pipe-node.skipped { background: var(--bg-panel); color: var(--text-dim); border-color: var(--border); text-decoration: line-through; opacity: 0.5; }
.pipe-arrow { color: var(--text-dim); font-size: 14px; }
.pipe-branch { background: var(--bg-panel); color: var(--accent); border-color: var(--accent-soft); }

/* ---------- Forms ---------- */

.form-row { margin-bottom: 1rem; }
.form-row label {
  display: block; font-size: 12px; font-weight: 600;
  letter-spacing: 0.5px; color: var(--text-muted);
  text-transform: uppercase; margin-bottom: 0.4rem;
}
.form-row.form-inline {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.2rem;
}
.form-row.form-inline label { margin-bottom: 0; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 560px) { .form-grid-2 { grid-template-columns: 1fr; } }

.input, input[type="text"], input[type="email"], input[type="password"], input[type="number"],
select, textarea {
  width: 100%; padding: 0.7rem 0.9rem;
  background: var(--bg-panel); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: inherit; font-size: 14px;
}
textarea {
  font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 12px; line-height: 1.5; resize: vertical;
}
.input:focus, select:focus, textarea:focus, input:focus {
  outline: none; border-color: var(--purple-light);
  box-shadow: 0 0 0 3px rgba(123, 47, 190, 0.15);
}

.checkbox {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 13px; color: var(--text-mid);
  text-transform: none; letter-spacing: 0;
}
.checkbox input[type="checkbox"] { width: auto; margin: 0; }

.form-err { color: var(--error); font-size: 13px; margin-top: 0.3rem; }

.link-sub { color: var(--text-muted); font-size: 13px; }
.link-sub:hover { color: var(--purple-glow); }

.honeypot { position: absolute; left: -9999px; height: 0; overflow: hidden; }

.auth-shell {
  display: flex; justify-content: center; align-items: flex-start;
  padding: 2rem 0; min-height: 60vh;
}
.auth-switch { text-align: center; margin-top: 1.5rem; margin-bottom: 0; font-size: 14px; }

/* ---------- Flash ---------- */

.flash-container {
  max-width: 1320px; margin: 1rem auto 0; padding: 0 2rem;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.flash {
  padding: 0.8rem 1.2rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-card);
  font-size: 14px;
}
.flash-success { border-color: var(--success); background: rgba(16, 185, 129, 0.08); color: var(--success); }
.flash-error { border-color: var(--error); background: rgba(239, 68, 68, 0.08); color: var(--error); }
.flash-info { border-color: var(--accent-soft); background: rgba(6, 182, 212, 0.08); color: var(--accent); }

/* ---------- KPIs ---------- */

.kpi-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.6rem; }
@media (max-width: 700px) { .kpi-row { grid-template-columns: repeat(2, 1fr); } }

.kpi { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.8rem; text-align: center; }
.kpi-label { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.3rem; }
.kpi-value { font-size: 1.1rem; font-weight: 700; color: var(--text); }

/* ---------- Viz ---------- */

.viz-placeholder {
  min-height: 400px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-panel); border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
}

/* ---------- Cards ---------- */

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .grid-4 { grid-template-columns: 1fr; } }

.card {
  display: block; padding: 1.4rem;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  transition: all 0.2s;
}
.card:hover {
  border-color: var(--purple); transform: translateY(-2px); text-decoration: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), 0 0 20px rgba(123, 47, 190, 0.15);
}
.card.card-static:hover { transform: none; border-color: var(--border); box-shadow: none; }
.card.card-feature { border-color: var(--purple); box-shadow: 0 0 30px rgba(123, 47, 190, 0.15); }

.card-tag {
  display: inline-block; padding: 3px 8px;
  background: var(--purple-bg); color: var(--purple-glow);
  border-radius: 4px;
  font-size: 11px; font-weight: 700; letter-spacing: 1px; margin-bottom: 0.6rem;
}
.card p { font-size: 13px; color: var(--text-muted); }
.card-cta { color: var(--purple-glow); font-size: 13px; font-weight: 600; }

/* ---------- Table ---------- */

.qtable { width: 100%; border-collapse: collapse; }
.qtable th, .qtable td {
  padding: 0.7rem 0.9rem; text-align: left;
  border-bottom: 1px solid var(--border); font-size: 14px;
}
.qtable th {
  font-weight: 600; font-size: 12px; letter-spacing: 1px;
  color: var(--text-muted); text-transform: uppercase;
}
.qtable tbody tr:hover { background: var(--bg-panel); }

.pill {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.5px;
}
.pill-live { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.pill-plan { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); }

/* ---------- Code block ---------- */

.code-block {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 1rem; overflow: auto;
  font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 12px;
  color: var(--text-mid); max-height: 360px; margin: 0;
}

/* ---------- Success glyph ---------- */

.success-glyph {
  display: inline-flex; align-items: center; justify-content: center;
  width: 64px; height: 64px; border-radius: 50%;
  background: rgba(16, 185, 129, 0.12); color: var(--success);
  font-size: 32px; margin-bottom: 1rem;
}

/* ---------- Footer ---------- */

.qfooter {
  max-width: 1320px; margin: 2rem auto; padding: 1.5rem 2rem;
  color: var(--text-dim); font-size: 12px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem;
}
