body.contacts-modal-open {
  overflow: hidden;
}

body.contacts-modal-open #screen-board {
  opacity: 0.74;
  filter: blur(1.2px) saturate(102%);
  -webkit-filter: blur(1.2px) saturate(102%);
  pointer-events: none;
}

.board-menu-button.is-contacts:hover {
  background: #f5f6ff;
  color: var(--accent-bottom);
}

#contacts-modal {
  z-index: 126;
  align-items: center;
  justify-content: center;
  padding: clamp(14px, 3vw, 32px);
}

#contacts-modal .precheckin-modal-backdrop {
  background: rgba(247, 245, 239, 0.18);
  backdrop-filter: blur(1.4px) saturate(102%);
  -webkit-backdrop-filter: blur(1.4px) saturate(102%);
  transition: opacity 0.34s ease;
}

#contacts-modal .contacts-modal-panel {
  width: min(920px, calc(100vw - 36px));
  max-height: calc(100dvh - 36px);
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(26, 51, 96, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 26px 70px rgba(23, 43, 82, 0.14);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.36s ease, transform 0.36s cubic-bezier(0.2, 0.8, 0.2, 1);
}

#contacts-modal.is-open .contacts-modal-panel {
  opacity: 1;
  transform: translateY(0);
}

.contacts-modal-head {
  position: relative;
  display: block;
  padding: 34px 68px 22px;
  text-align: center;
}

.contacts-kicker {
  display: block;
  margin-bottom: 7px;
  color: var(--accent-bottom);
  font-size: 0.72rem;
  font-weight: 820;
  text-transform: uppercase;
}

.contacts-modal-head h3 {
  margin: 0;
  color: var(--ink);
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  font-size: clamp(1.55rem, 3vw, 2rem);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: 0;
}

.contacts-modal-head p {
  max-width: 540px;
  margin: 7px auto 0;
  color: #667493;
  font-size: 0.92rem;
  line-height: 1.5;
  font-weight: 600;
}

.contacts-modal-head .team-drawer-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(39, 68, 125, 0.12);
  border-radius: 8px;
  background: #ffffff;
}

.contacts-modal-body {
  max-height: calc(100dvh - 146px);
  overflow-y: auto;
  padding: 0 34px 34px;
  scrollbar-width: thin;
}

.contacts-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 58px;
  margin-bottom: 14px;
  padding: 10px 0 14px;
  border-bottom: 1px solid rgba(26, 51, 96, 0.09);
}

.contacts-toolbar p {
  margin: 0;
  color: #71809a;
  font-size: 0.8rem;
  font-weight: 680;
}

.contacts-add-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  background: linear-gradient(180deg, var(--accent-top) 0%, var(--accent-bottom) 100%);
  box-shadow: 0 8px 18px rgba(60, 53, 230, 0.14);
  color: #ffffff;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 760;
  cursor: pointer;
}

.contacts-add-button span {
  font-size: 1.1rem;
  line-height: 1;
}

.contacts-form {
  margin: 0 0 18px;
  padding: 22px;
  border: 1px solid rgba(39, 68, 125, 0.1);
  border-radius: 8px;
  background: #f9fafc;
}

.contacts-form[hidden] {
  display: none;
}

.contacts-form-head {
  display: grid;
  gap: 4px;
  margin-bottom: 18px;
}

.contacts-form-head strong {
  color: var(--ink);
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  font-size: 1.2rem;
}

.contacts-form-head span {
  color: #71809a;
  font-size: 0.78rem;
  line-height: 1.45;
  font-weight: 620;
}

.contacts-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.contacts-form-grid .field {
  margin: 0;
}

.contacts-form-grid .field-label {
  margin-bottom: 7px;
  color: #4f5f7b;
  font-size: 0.78rem;
  font-weight: 750;
}

.contacts-form-grid .field-input {
  min-height: 48px;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: none;
}

.contacts-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(26, 51, 96, 0.09);
}

.contacts-form-actions .form-button {
  min-width: 180px;
  min-height: 46px;
}

.contacts-feedback {
  min-height: 20px;
  margin: 0 0 10px;
}

.contacts-feedback.is-success {
  color: #237a58;
}

.contacts-list {
  display: grid;
  gap: 20px;
}

.contacts-category-group {
  display: grid;
  gap: 8px;
}

.contacts-category-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 30px;
  padding: 0 2px;
}

.contacts-category-head h4 {
  margin: 0;
  color: #52617c;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.contacts-category-head span {
  color: #98a2b5;
  font-size: 0.7rem;
  font-weight: 700;
}

.contacts-category-rows {
  display: grid;
  border: 1px solid rgba(39, 68, 125, 0.1);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.contact-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) minmax(170px, 0.48fr) auto;
  align-items: center;
  gap: 13px;
  min-height: 72px;
  padding: 12px 14px;
}

.contact-row + .contact-row {
  border-top: 1px solid rgba(39, 68, 125, 0.08);
}

.contact-category-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #f1f2ff;
  color: #4d57ff;
  font-size: 0.68rem;
  font-weight: 840;
}

.contact-category-mark[data-category="taxi"] {
  background: #fff7e7;
  color: #9b650d;
}

.contact-category-mark[data-category="maintenance"] {
  background: #edf5ff;
  color: #3567a9;
}

.contact-category-mark[data-category="on_call"] {
  background: #f1efff;
  color: #5a48d8;
}

.contact-category-mark[data-category="management"] {
  background: #eef1f6;
  color: #31476f;
}

.contact-category-mark[data-category="security"],
.contact-category-mark[data-category="emergency"] {
  background: #fff0f0;
  color: #bd4747;
}

.contact-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.contact-copy strong {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 790;
}

.contact-copy span {
  overflow-wrap: anywhere;
  color: #7a879e;
  font-size: 0.74rem;
  line-height: 1.4;
  font-weight: 610;
}

.contact-phone {
  width: fit-content;
  max-width: 100%;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid rgba(77, 87, 255, 0.14);
  border-radius: 7px;
  background: #f7f8ff;
  color: #423ce5;
  font-size: 0.8rem;
  font-weight: 760;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.contact-phone:hover,
.contact-phone:focus-visible {
  border-color: rgba(77, 87, 255, 0.28);
  background: #f1f2ff;
}

.contact-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.contact-action {
  min-height: 36px;
  border: 1px solid rgba(39, 68, 125, 0.1);
  border-radius: 7px;
  padding: 0 10px;
  background: #ffffff;
  color: #65738d;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 720;
  cursor: pointer;
}

.contact-action:hover,
.contact-action:focus-visible {
  border-color: rgba(77, 87, 255, 0.22);
  color: var(--accent-bottom);
}

.contact-action.is-delete:hover,
.contact-action.is-delete:focus-visible,
.contact-action.is-confirming {
  border-color: rgba(191, 67, 67, 0.2);
  background: #fff4f4;
  color: #b64141;
}

.contacts-empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 42px 20px;
  border: 1px solid rgba(39, 68, 125, 0.1);
  border-radius: 8px;
  background: #f8f9fc;
  text-align: center;
}

.contacts-empty[hidden] {
  display: none;
}

.contacts-empty strong {
  color: var(--ink);
  font-size: 0.92rem;
}

.contacts-empty span {
  max-width: 450px;
  color: #7a879e;
  font-size: 0.78rem;
  line-height: 1.5;
  font-weight: 620;
}

@media (max-width: 720px) {
  #contacts-modal {
    padding: 10px;
  }

  #contacts-modal .contacts-modal-panel {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
  }

  .contacts-modal-head {
    padding: 28px 52px 18px 20px;
    text-align: left;
  }

  .contacts-modal-head p {
    margin-left: 0;
  }

  .contacts-modal-head .team-drawer-close {
    top: 12px;
    right: 12px;
  }

  .contacts-modal-body {
    max-height: calc(100dvh - 126px);
    padding: 0 16px 18px;
  }

  .contacts-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .contacts-add-button {
    width: 100%;
  }

  .contacts-form {
    padding: 17px;
  }

  .contacts-form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .contacts-form-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .contacts-form-actions .form-button,
  .contacts-form-actions .text-button {
    width: 100%;
  }

  .contact-row {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 10px 12px;
    padding: 13px;
  }

  .contact-phone {
    grid-column: 2;
  }

  .contact-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
    padding-top: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #contacts-modal .contacts-modal-panel,
  #contacts-modal .precheckin-modal-backdrop {
    transition: none;
  }
}
