.webhooks-page {
  max-width: 1040px;
}

.webhooks-header,
.webhook-list-header,
.webhook-actions,
.webhook-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.page-subtext,
.webhook-list-header p,
.webhook-meta,
.webhook-empty {
  color: var(--text-muted);
}

.webhook-panel {
  margin-top: 2rem;
  padding: 1.5rem;
  border: 1px solid var(--outline);
  border-radius: var(--radius-lg);
  background: var(--card);
}

.webhook-notice {
  margin: 0.6rem 0 1.25rem;
  padding: 0.8rem 1rem;
  border-left: 3px solid var(--primary);
  background: rgba(255, 102, 0, 0.08);
  color: var(--text-muted);
}

.webhook-form {
  display: grid;
  grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.3fr);
  gap: 1rem;
}

.webhook-field {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
}

.webhook-field span {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 650;
}

.webhook-field input,
.webhook-secret-row input {
  width: 100%;
  min-height: 45px;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--outline);
  border-radius: var(--radius);
  background: var(--bg-muted);
  color: var(--text);
}

.webhook-field input:focus-visible,
.webhook-secret-row input:focus-visible {
  outline: 1px solid var(--primary);
  outline-offset: 1px;
}

.webhook-field-wide {
  grid-column: 1 / -1;
}

.webhook-actions {
  justify-content: flex-start;
}

.webhook-secret {
  margin-top: 1.25rem;
  padding: 1rem;
  border: 1px solid rgba(255, 126, 41, 0.6);
  border-radius: var(--radius);
  background: rgba(255, 126, 41, 0.08);
}

.webhook-secret p {
  margin: 0 0 0.75rem;
}

.webhook-secret-row {
  display: flex;
  align-items: stretch;
  gap: 0.6rem;
}

.webhook-secret-row input {
  min-width: 0;
  font-family: var(--font-mono, monospace);
}

.webhook-list {
  display: grid;
  gap: 0.85rem;
  margin-top: 1rem;
}

.webhook-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--outline);
  border-radius: var(--radius);
  background: var(--bg-muted);
}

.webhook-card h3 {
  margin: 0 0 0.35rem;
}

.webhook-url {
  display: block;
  overflow-wrap: anywhere;
  color: var(--text);
  font-family: var(--font-mono, monospace);
  font-size: 0.88rem;
}

.webhook-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
  margin-top: 0.45rem;
  font-size: 0.88rem;
}

.webhook-history-status {
  margin: 1rem 0 0;
  color: var(--text-muted);
}

.webhook-history {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.webhook-history-card {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--outline);
  border-radius: var(--radius);
  background: var(--bg-muted);
}

.webhook-history-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.webhook-history-heading h3 {
  margin: 0;
}

.webhook-state {
  flex: none;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--outline);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.webhook-state-delivered {
  border-color: rgba(34, 255, 136, 0.45);
  color: #22cc77;
}

.webhook-state-failed {
  border-color: rgba(255, 51, 51, 0.5);
  color: #ff6666;
}

.webhook-state-delivering,
.webhook-state-queued {
  border-color: rgba(255, 126, 41, 0.55);
  color: var(--primary-light);
}

.webhook-history-job {
  display: block;
  margin-top: 0.5rem;
  overflow-wrap: anywhere;
  color: var(--text);
  font-family: var(--font-mono, monospace);
  font-size: 0.82rem;
}

.webhook-history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
  margin-top: 0.5rem;
  color: var(--text-muted);
  font-size: 0.84rem;
}

.webhook-history-more {
  margin-top: 1rem;
}

@media (max-width: 760px) {
  .webhooks-header,
  .webhook-list-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .webhook-form {
    grid-template-columns: 1fr;
  }

  .webhook-field-wide {
    grid-column: auto;
  }

  .webhook-card {
    grid-template-columns: 1fr;
  }

  .webhook-card-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .webhook-secret-row {
    flex-wrap: wrap;
  }

  .webhook-secret-row input {
    flex-basis: 100%;
  }

  .webhook-history-heading {
    align-items: flex-start;
  }
}
