/* -- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 600;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn-primary { background: var(--color-accent); color: #fff; }
.btn-primary:hover { background: var(--color-accent-hover); text-decoration: none; }
.btn-secondary { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border); }
.btn-secondary:hover { background: var(--color-surface-alt); text-decoration: none; }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { filter: brightness(0.92); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--color-text-muted); border-color: transparent; }
.btn-ghost:hover { background: var(--color-surface-alt); text-decoration: none; }
.btn-sm { padding: var(--space-1) var(--space-3); font-size: var(--fs-xs); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* -- Cards ---------------------------------------------------------------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-6);
}
.card + .card { margin-top: var(--space-4); }
/* A <button class="card ..."> (e.g. the theme picker) needs UA-default resets a <div> doesn't. */
button.card { width: 100%; font-family: inherit; color: inherit; font-size: inherit; }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  gap: var(--space-3);
  flex-wrap: wrap;
}

/* -- Badges / pills -------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: 2px var(--space-2);
  border-radius: 999px;
  white-space: nowrap;
}
.badge-success { background: var(--color-success-soft); color: var(--color-success); }
.badge-warning { background: var(--color-warning-soft); color: var(--color-warning); }
.badge-danger { background: var(--color-danger-soft); color: var(--color-danger); }
.badge-info { background: var(--color-info-soft); color: var(--color-info); }
.badge-neutral { background: var(--color-surface-alt); color: var(--color-text-muted); border: 1px solid var(--color-border); }
.badge-accent { background: var(--color-accent-soft); color: var(--color-accent-hover); }

/* -- Job pipeline (CI/CD-style stage progress) ----------------------------- */
.job-pipeline { display: flex; justify-content: space-between; margin: var(--space-4) 0; }
.job-pipeline-stage { display: flex; flex-direction: column; align-items: center; flex: 1; position: relative; text-align: center; }
.job-pipeline-stage:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 11px;
  left: calc(50% + 16px);
  right: calc(-50% + 16px);
  height: 2px;
  background: var(--color-border);
}
.job-pipeline-stage.is-done:not(:last-child)::after { background: var(--color-success); }
.job-pipeline-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-xs);
  font-weight: 600;
  background: var(--color-surface-alt);
  border: 2px solid var(--color-border);
  color: var(--color-text-muted);
  z-index: 1;
}
.job-pipeline-stage.is-done .job-pipeline-dot { background: var(--color-success); border-color: var(--color-success); color: #fff; }
.job-pipeline-stage.is-error .job-pipeline-dot { background: var(--color-danger); border-color: var(--color-danger); color: #fff; }
.job-pipeline-stage.is-current .job-pipeline-dot { border-color: var(--color-info); color: var(--color-info); animation: pipeline-pulse 1.4s ease-in-out infinite; }
@keyframes pipeline-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--color-info-soft); }
  50% { box-shadow: 0 0 0 6px var(--color-info-soft); }
}
.job-pipeline-label { font-size: var(--fs-xs); color: var(--color-text-muted); margin-top: var(--space-1); max-width: 80px; }
.job-pipeline-stage.is-done .job-pipeline-label,
.job-pipeline-stage.is-current .job-pipeline-label { color: var(--color-text); }
.job-pipeline-duration { font-size: var(--fs-xs); color: var(--color-text-muted); }

/* -- Progress bar (capacity offer usage) ------------------------------------ */
.progress-bar { width: 100%; height: 8px; background: var(--color-surface-alt); border-radius: var(--radius-sm); overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--color-accent); border-radius: var(--radius-sm); }

.job-row { cursor: pointer; }

/* -- Forms ---------------------------------------------------------------- */
.field { margin-bottom: var(--space-4); }
.field label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  margin-bottom: var(--space-1);
}
.field-hint { font-size: var(--fs-xs); color: var(--color-text-muted); margin-top: var(--space-1); }
input, select, textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}
textarea { resize: vertical; min-height: 6rem; }
.form-actions { display: flex; gap: var(--space-3); margin-top: var(--space-6); }
.form-error { color: var(--color-danger); font-size: var(--fs-sm); margin-bottom: var(--space-3); }

/* -- Tables ----------------------------------------------------------------*/
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
th, td { text-align: left; padding: var(--space-3); border-bottom: 1px solid var(--color-border); white-space: nowrap; }
th { color: var(--color-text-muted); font-weight: 600; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .03em; }
tbody tr:hover { background: var(--color-surface-alt); }

/* -- Empty state ------------------------------------------------------------ */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  color: var(--color-text-muted);
}

/* -- Auth pages ------------------------------------------------------------- */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
}
.auth-card { width: 100%; max-width: 420px; }
.auth-card .brand { text-align: center; margin-bottom: var(--space-6); }
.auth-card .brand .mark {
  display: inline-block;
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  background: var(--color-accent);
  margin-bottom: var(--space-3);
}
.role-toggle { display: flex; gap: var(--space-2); margin-bottom: var(--space-4); }
.role-toggle label {
  flex: 1;
  text-align: center;
  padding: var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--fs-sm);
}
.role-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.role-toggle input:checked + span { color: var(--color-accent); font-weight: 600; }
.role-toggle label:has(input:checked) { border-color: var(--color-accent); background: var(--color-accent-soft); }

/* -- Modal ------------------------------------------------------------------ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(43,39,36,.45);
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-4);
  z-index: 100;
}
.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  padding: var(--space-6);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal[hidden], .modal-backdrop[hidden] { display: none; }

/* -- Utility --------------------------------------------------------------- */
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.row { display: flex; align-items: center; gap: var(--space-3); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.muted { color: var(--color-text-muted); }
.mono { font-family: var(--font-mono); font-size: var(--fs-sm); }
.copy-snippet {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  white-space: pre-wrap;
  word-break: break-all;
}
