/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s, opacity .15s;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary  { background: var(--color-primary); color: #fff; }
.btn-primary:hover:not(:disabled)  { background: var(--color-primary-dark); }

.btn-secondary { background: #fff; color: var(--color-text); border-color: var(--color-border); }
.btn-secondary:hover:not(:disabled) { background: var(--color-bg); }

.btn-danger   { background: var(--color-error); color: #fff; }
.btn-danger:hover:not(:disabled)   { background: #b91c1c; }

.btn-ghost    { background: none; border-color: transparent; color: var(--color-primary); }
.btn-ghost:hover:not(:disabled)    { background: #eff6ff; }

.btn-sm { padding: 4px 10px; font-size: 13px; }

/* Inputs */
.input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--color-text);
  background: #fff;
  outline: none;
  transition: border-color .15s;
}
.input:focus { border-color: var(--color-primary); }
.input::placeholder { color: var(--color-text-muted); }
.input[type="password"] { letter-spacing: .1em; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--color-text-muted); margin-top: 4px; }
.field .error-msg { font-size: 12px; color: var(--color-error); margin-top: 4px; }

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
}
.badge-active      { background: #dcfce7; color: #15803d; }
.badge-inactive    { background: #f3f4f6; color: var(--color-text-muted); }
.badge-ready       { background: #dcfce7; color: #15803d; }
.badge-processing  { background: #fef9c3; color: #854d0e; }
.badge-error       { background: #fee2e2; color: #b91c1c; }

/* Table */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 500; color: var(--color-text-muted); padding: 8px 12px; border-bottom: 1px solid var(--color-border); }
.table td { padding: 12px; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
.table tbody tr { cursor: pointer; transition: background .1s; }
.table tbody tr:hover { background: var(--color-bg); }
.table tbody tr:last-child td { border-bottom: none; }

/* Card */
.card { background: var(--color-bg-card); border: 1px solid var(--color-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-section { padding: 20px 24px; border-bottom: 1px solid var(--color-border); }
.card-section:last-child { border-bottom: none; }
.section-title { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--color-text-muted); margin-bottom: 16px; }

/* Data row */
.data-row { display: flex; padding: 8px 0; gap: 16px; }
.data-row .label { font-size: 13px; color: var(--color-text-muted); width: 160px; flex-shrink: 0; }
.data-row .value { font-size: 13px; }

/* Code block */
.code-block {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  word-break: break-all;
}

/* Modal overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 420px;
  max-width: calc(100vw - 32px);
  box-shadow: var(--shadow-md);
}
.modal-title { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.modal-body  { font-size: 14px; color: var(--color-text-muted); margin-bottom: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 300;
}
.toast {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  box-shadow: var(--shadow-md);
  max-width: 360px;
  animation: toast-in .2s ease;
}
.toast-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.toast-error   { background: #fff1f2; border: 1px solid #fecdd3; color: #b91c1c; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Empty state */
.empty-state { text-align: center; padding: 64px 24px; }
.empty-state p { color: var(--color-text-muted); margin-bottom: 16px; }

/* Checkbox */
.checkbox-row { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.checkbox-row input[type="checkbox"] { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--color-primary); }
.checkbox-row .checkbox-label { font-size: 14px; font-weight: 500; }
.checkbox-row .checkbox-hint  { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; }

/* Danger zone */
.danger-zone { border: 1px solid #fecaca; border-radius: var(--radius-lg); padding: 20px 24px; }
.danger-zone p { font-size: 14px; color: var(--color-text-muted); margin-bottom: 12px; }
