.btn,
.icon-btn {
  position: relative;
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-weight: 800;
  transition:
    transform var(--dur-fast) var(--ease-standard),
    border-color var(--dur-fast) var(--ease-standard),
    background var(--dur-fast) var(--ease-standard),
    opacity var(--dur-fast) var(--ease-standard);
}

.btn {
  padding: 0 var(--space-5);
}

.btn-sm {
  min-height: 40px;
  padding-inline: var(--space-4);
}

.btn:hover,
.icon-btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(145deg, var(--accent), var(--accent-3));
  color: var(--text);
  box-shadow: 0 12px 28px rgba(231, 57, 77, 0.24);
}

.btn-glass {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.btn-danger {
  border-color: rgba(255, 92, 92, 0.38);
  background: rgba(255, 92, 92, 0.16);
  color: #ffdede;
}

.icon-btn {
  width: 44px;
  padding: 0;
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.glass-panel,
.card {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.card {
  overflow: hidden;
}

.form-field {
  display: grid;
  gap: var(--space-2);
  margin-block-end: var(--space-4);
}

.form-field label {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.form-field input,
.form-field select,
.form-field textarea {
  min-width: 0;
  min-height: 46px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: var(--space-3) var(--space-4);
}

.form-field textarea {
  min-height: 120px;
  resize: vertical;
}

.field-error {
  color: #ffd0d0;
  font-size: 0.9rem;
}

.status-badge {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding-inline: var(--space-3);
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.status-badge.is-success {
  border-color: rgba(66, 211, 146, 0.34);
  color: #c8ffe7;
}

.status-badge.is-danger {
  border-color: rgba(255, 92, 92, 0.34);
  color: #ffdede;
}

.empty-state {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-6);
  text-align: center;
  color: var(--muted);
}

.skeleton {
  position: relative;
  overflow: hidden;
  min-height: 96px;
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.08);
}

.skeleton::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  animation: skeleton-sweep 1.4s infinite;
}

@keyframes skeleton-sweep {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

.modal-root:empty {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: var(--space-4);
  background: rgba(0, 0, 0, 0.62);
}

.modal {
  width: min(100%, 560px);
  max-height: min(760px, calc(100vh - var(--space-8)));
  overflow: auto;
  padding: var(--space-5);
}

.modal-header,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.modal-actions {
  justify-content: flex-end;
  margin-block-start: var(--space-5);
}

.toast-root {
  position: fixed;
  z-index: 3000;
  inset: auto var(--space-4) var(--space-4) auto;
  display: grid;
  gap: var(--space-2);
  width: min(360px, calc(100vw - var(--space-8)));
}

.toast {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-strong);
  box-shadow: var(--shadow-tight);
}

.toast.is-error {
  border-color: rgba(255, 92, 92, 0.36);
}

.table-shell {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.05);
}

.table-shell table {
  min-width: 680px;
  width: 100%;
  border-collapse: collapse;
}

.cluster {
  min-width: 0;
}

.cluster > * {
  flex: 0 1 auto;
}

@media (max-width: 560px) {
  .btn {
    width: 100%;
  }

  .modal-backdrop {
    padding: var(--space-2);
  }

  .modal {
    max-height: calc(100dvh - var(--space-4));
    padding: var(--space-4);
  }
}

.table-shell th,
.table-shell td {
  padding: var(--space-3);
  border-bottom: 1px solid var(--border);
  text-align: start;
}

.htmx-progress {
  position: fixed;
  inset: 0 0 auto;
  z-index: 4000;
  height: 3px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease-standard);
}

.htmx-progress span {
  display: block;
  width: 34%;
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--accent));
  transform: translateX(-100%);
}

body.htmx-is-requesting .htmx-progress {
  opacity: 1;
}

body.htmx-is-requesting .htmx-progress span {
  animation: htmx-progress 1s infinite var(--ease-standard);
}

.htmx-request .btn,
.btn.htmx-request,
button.htmx-request {
  opacity: 0.72;
  pointer-events: none;
}

.stack {
  display: grid;
  gap: var(--space-4);
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.split {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.responsive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: var(--space-4);
}

@keyframes htmx-progress {
  from { transform: translateX(-100%); }
  to { transform: translateX(320%); }
}

.released-contact-modal {
  width: min(100%, 700px);
}

.released-contact-modal-header {
  align-items: start;
  margin-block-end: var(--space-4);
}

.released-contact-modal-header h2,
.released-contact-modal-header p,
.released-provider-card h3,
.released-provider-card p {
  margin: 0;
}

.released-contact-modal-list,
.released-provider-card,
.released-provider-contact-list {
  display: grid;
  gap: var(--space-3);
}

.released-provider-card {
  min-width: 0;
  padding: var(--space-4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.045);
}

.released-provider-card-header,
.released-provider-contact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-width: 0;
}

.released-provider-card-header > div,
.released-provider-contact-row > div:first-child {
  min-width: 0;
}

.released-provider-card h3 {
  color: var(--text);
  font-size: 1.08rem;
}

.released-provider-card p,
.released-provider-contact-row span {
  color: var(--muted);
  font-size: 0.86rem;
}

.released-provider-contact-row {
  padding: var(--space-3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-md);
  background: rgba(0, 0, 0, 0.12);
}

.released-provider-contact-row strong {
  display: block;
  overflow-wrap: anywhere;
}

.released-provider-contact-actions {
  justify-content: flex-end;
}

@media (max-width: 620px) {
  .released-contact-modal-header,
  .released-provider-card-header,
  .released-provider-contact-row {
    align-items: stretch;
    flex-direction: column;
  }

  .released-provider-contact-actions,
  .released-provider-contact-actions .btn,
  .released-provider-card > .btn {
    width: 100%;
  }
}
