.appointment-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(15, 23, 42, 0.34);
}

.appointment-dialog {
  width: min(1180px, 100%);
  max-height: calc(100vh - 44px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 28px 72px rgba(15, 23, 42, 0.24);
}

.appointment-head,
.appointment-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: #fbfdfc;
}

.appointment-head strong {
  display: block;
  font-size: 1.05rem;
}

.appointment-head span {
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.appointment-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--border);
  border-bottom: 0;
}

.appointment-body {
  min-height: 0;
  display: grid;
  gap: 14px;
  padding: 16px;
  overflow: auto;
  background: #fff;
}

.appointment-section {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

.appointment-section header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.appointment-section h3 {
  margin: 0;
  font-size: 0.9rem;
}

.appointment-grid,
.appointment-quick-client {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.appointment-section label,
.appointment-quick-client label {
  min-width: 0;
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.appointment-section input,
.appointment-section select,
.appointment-section textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.appointment-section textarea {
  min-height: 92px;
  resize: vertical;
}

.appointment-warning {
  margin: 0 16px;
  padding: 10px 12px;
  border: 1px solid rgba(217, 119, 6, 0.22);
  border-radius: 10px;
  background: #fffbeb;
  color: #92400e;
  font-size: 0.84rem;
  font-weight: 750;
}

.appointment-small-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--primary);
  font-weight: 850;
}

.appointment-add-service {
  display: flex;
  gap: 8px;
  min-width: min(460px, 100%);
}

.appointment-lines {
  display: grid;
  gap: 8px;
}

.appointment-line {
  display: grid;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.service-line {
  grid-template-columns: minmax(150px, 1fr) 96px 110px 34px;
  border-left: 4px solid var(--service-color, var(--primary));
}

.payment-line {
  grid-template-columns: 120px 150px minmax(160px, 1fr) 34px;
}

.appointment-history {
  display: grid;
  gap: 8px;
}

.appointment-history article {
  display: grid;
  gap: 2px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
}

.appointment-history span {
  color: var(--muted);
  font-size: 0.82rem;
}

.appointment-history small {
  color: var(--primary);
  font-size: 0.74rem;
  font-weight: 800;
}

@media (max-width: 860px) {
  .appointment-backdrop {
    padding: 0;
  }

  .appointment-dialog {
    width: 100%;
    min-height: 100vh;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  .appointment-head {
    position: sticky;
    top: 0;
    z-index: 2;
    padding-right: 62px;
  }

  .appointment-head strong,
  .appointment-head span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .appointment-body {
    padding: 12px;
  }

  .appointment-section {
    border-radius: 10px;
    padding: 12px;
  }

  .appointment-actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 12px;
  }

  .appointment-grid,
  .appointment-quick-client,
  .service-line,
  .payment-line {
    grid-template-columns: 1fr;
  }

  .appointment-add-service,
  .appointment-section header {
    align-items: stretch;
    flex-direction: column;
  }
}
