/* ── Buttons ───────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), opacity var(--transition);
  white-space: nowrap;
  user-select: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--surface2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--surface3); }
.btn-danger   { background: var(--red-dim); color: var(--red); border-color: var(--red); }
.btn-danger:hover:not(:disabled) { background: var(--red); color: #fff; }
.btn-ghost    { background: transparent; color: var(--text2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface2); color: var(--text); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon { padding: 6px; border-radius: var(--radius); background: transparent; border: none; cursor: pointer; color: var(--text2); display: inline-flex; align-items: center; justify-content: center; transition: background var(--transition), color var(--transition); }
.btn-icon:hover { background: var(--surface2); color: var(--text); }
.btn-icon.loading { pointer-events: none; opacity: 0.6; }

/* ── Form ──────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--text2); }
.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  padding: 8px 12px;
  transition: border-color var(--transition);
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-select option { background: var(--surface2); }
.form-hint { font-size: 12px; color: var(--text3); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--red); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }
.form-checkbox { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.form-checkbox input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

/* ── Badge ─────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge-red    { background: var(--red-dim);   color: var(--red);   border-color: rgba(239,68,68,0.3); }
.badge-green  { background: var(--green-dim); color: var(--green); border-color: rgba(34,197,94,0.3); }
.badge-amber  { background: var(--amber-dim); color: var(--amber); border-color: rgba(245,158,11,0.3); }
.badge-blue   { background: var(--blue-dim);  color: var(--blue);  border-color: rgba(59,130,246,0.3); }
.badge-indigo { background: var(--accent-dim);color: var(--accent);border-color: rgba(99,102,241,0.3); }
.badge-gray   { background: var(--surface3);  color: var(--text2); border-color: var(--border); }

/* ── Modal ─────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 150ms ease-out;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 150ms ease-out;
}
.modal-lg { max-width: 720px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-body  { padding: 20px 24px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ── Toast ─────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  min-width: 260px;
  max-width: 360px;
  box-shadow: var(--shadow-lg);
  animation: slideLeft 200ms ease-out;
  pointer-events: all;
  font-size: 13px;
}
.toast-success { border-left: 3px solid var(--green); }
.toast-error   { border-left: 3px solid var(--red); }
.toast-warning { border-left: 3px solid var(--amber); }
.toast-info    { border-left: 3px solid var(--accent); }
.toast-icon { flex-shrink: 0; margin-top: 1px; }
.toast.hiding { animation: slideRight 200ms ease-out forwards; }

/* ── Drawer (task/bug detail) ──────────────── */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 150;
}
.drawer {
  position: fixed;
  top: 0; right: 0;
  width: 480px;
  max-width: 100vw;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 151;
  display: flex;
  flex-direction: column;
  animation: slideInRight 200ms ease-out;
  overflow: hidden;
}
.drawer-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 24px; }

/* ── Step stepper ──────────────────────────── */
.stepper {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.stepper-progress {
  background: var(--surface3);
  height: 4px;
  border-radius: 2px;
  margin-bottom: 20px;
  overflow: hidden;
}
.stepper-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 300ms ease-out;
}
.stepper-counter { font-size: 12px; color: var(--text2); margin-bottom: 4px; }
.stepper-action  { font-size: 16px; font-weight: 500; margin-bottom: 8px; }
.stepper-expected { font-size: 13px; color: var(--text2); margin-bottom: 16px; }
.stepper-actions { display: flex; gap: 8px; margin-top: 16px; }

/* ── Empty state ───────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text2);
  text-align: center;
  gap: 12px;
}
.empty-state svg { opacity: 0.3; }
.empty-state h3 { font-size: 15px; color: var(--text); }
.empty-state p  { font-size: 13px; max-width: 280px; }

/* ── Skeleton ──────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface2) 25%, var(--surface3) 50%, var(--surface2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}
.skeleton-text  { height: 14px; margin-bottom: 8px; }
.skeleton-card  { height: 80px; border-radius: var(--radius-lg); margin-bottom: 12px; }

/* ── Divider ───────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ── Animations ────────────────────────────── */
@keyframes fadeIn    { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp   { from { opacity: 0; transform: translateY(16px) } to { opacity: 1; transform: translateY(0) } }
@keyframes slideLeft { from { opacity: 0; transform: translateX(24px) } to { opacity: 1; transform: translateX(0) } }
@keyframes slideRight{ from { opacity: 1; transform: translateX(0) } to { opacity: 0; transform: translateX(24px) } }
@keyframes slideInRight { from { transform: translateX(100%) } to { transform: translateX(0) } }
@keyframes shimmer   { from { background-position: 200% 0 } to { background-position: -200% 0 } }
