button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 42px;
  padding: 0.68rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  color: var(--text);
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  transition:
    background 150ms ease,
    border-color 150ms ease,
    transform 150ms ease;
}
button:not(:disabled):active,
.button-link:active {
  transform: translateY(1px);
}
.primary {
  background: var(--accent);
  color: #fff;
}
.primary:hover {
  background: var(--accent-hover);
}
.secondary {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}
.secondary:hover {
  border-color: var(--border-strong);
  background: var(--surface-subtle);
}
.danger {
  border-color: color-mix(in srgb, var(--danger), transparent 55%);
  background: var(--danger-soft);
  color: var(--danger);
}
.danger.primary-danger {
  background: var(--danger);
  color: #fff;
}
.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}
.ghost:hover {
  background: var(--surface-subtle);
  color: var(--text);
}
.small {
  min-height: 34px;
  padding: 0.48rem 0.72rem;
  font-size: 0.86rem;
}
.icon-button {
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  font-size: 1.15rem;
}
.icon-button:hover {
  background: var(--surface-subtle);
}
.full-width {
  width: 100%;
}

.field {
  display: grid;
  gap: 0.48rem;
  min-width: 0;
}
.field > span,
.field-label,
legend {
  color: var(--text-soft);
  font-size: 0.88rem;
  font-weight: 750;
}
.field-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}
fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.72rem 0.82rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  line-height: 1.45;
}
textarea {
  min-height: 110px;
  resize: vertical;
}
input:hover,
select:hover,
textarea:hover {
  border-color: var(--border-strong);
}
input[aria-invalid="true"],
textarea[aria-invalid="true"],
select[aria-invalid="true"] {
  border-color: var(--danger);
}
.code,
pre {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}
.check,
.radio {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  color: var(--text-soft);
  line-height: 1.45;
}
.check input,
.radio input {
  width: 1.05rem;
  min-height: 1.05rem;
  margin: 0.18rem 0 0;
  accent-color: var(--accent);
}
.field-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.82rem;
  font-weight: 650;
}
.form-error-summary {
  padding: 0.9rem 1rem;
  border: 1px solid color-mix(in srgb, var(--danger), transparent 50%);
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: var(--danger);
}
.form-error-summary p {
  margin: 0;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.section-card {
  padding: clamp(1rem, 3vw, 1.45rem);
}
.card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}
.card-heading h2,
.card-heading h3 {
  margin-bottom: 0.3rem;
}
.card-heading p {
  margin-bottom: 0;
  color: var(--muted);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  width: fit-content;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--text-soft);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: capitalize;
}
.status-badge::before {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: currentColor;
  content: "";
}
.status-badge[data-status="succeeded"] {
  background: var(--success-soft);
  color: var(--success);
}
.status-badge[data-status="failed"],
.status-badge[data-status="interrupted"] {
  background: var(--danger-soft);
  color: var(--danger);
}
.status-badge[data-status="canceled"] {
  background: var(--surface-subtle);
  color: var(--muted);
}
.status-badge[data-status="running"] {
  background: var(--info-soft);
  color: var(--info);
}
.status-badge[data-status="queued"] {
  background: var(--warning-soft);
  color: var(--warning);
}

.progress-track {
  overflow: hidden;
  height: 8px;
  border-radius: 99px;
  background: var(--surface-strong);
}
.progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #aa78ed);
  transition: width 200ms ease;
}

.empty-state {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--muted);
}
.empty-state-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  border-radius: 14px;
  background: var(--surface-subtle);
  color: var(--accent-text);
  font-size: 1.35rem;
}
.empty-state h2,
.empty-state h3 {
  margin-bottom: 0.4rem;
}
.empty-state p {
  max-width: 480px;
  margin: 0 auto 1.2rem;
}

.notice {
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-subtle);
  color: var(--text-soft);
}
.notice.warning {
  border-color: color-mix(in srgb, var(--warning), transparent 55%);
  background: var(--warning-soft);
  color: var(--warning);
}
.notice.error {
  border-color: color-mix(in srgb, var(--danger), transparent 55%);
  background: var(--danger-soft);
  color: var(--danger);
}
.notice.success {
  border-color: color-mix(in srgb, var(--success), transparent 55%);
  background: var(--success-soft);
  color: var(--success);
}

.toast-region {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 100;
  display: grid;
  gap: 0.65rem;
  width: min(400px, calc(100% - 2rem));
}
.toast {
  padding: 0.9rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-raised);
  box-shadow: var(--shadow-lg);
  color: var(--text);
  animation: toast-in 180ms ease-out;
}
.toast[data-type="success"] {
  border-left: 4px solid var(--success);
}
.toast[data-type="error"] {
  border-left: 4px solid var(--danger);
}
.toast[data-type="warning"] {
  border-left: 4px solid var(--warning);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.confirm-dialog {
  width: min(440px, calc(100% - 2rem));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
.confirm-dialog::backdrop {
  background: rgb(3 7 18 / 0.62);
  backdrop-filter: blur(2px);
}
.confirm-dialog form {
  padding: 1.4rem;
}
.confirm-dialog h2 {
  margin-bottom: 0.65rem;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 1.3rem;
}

.spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 750ms linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
