@import url("/css/pages/default.css");

.agreements-page {
  flex: 1;
  min-height: 0;
}

.agreements-main {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 32px;
}

.agreements-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.agreements-title p {
  margin: 4px 0 0;
  max-width: 520px;
  color: #41484c;
  font-size: 16px;
  line-height: 24px;
}

.agreements-toolbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.agreements-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  padding: 8px 16px;
}

.agreements-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.agreements-btn--primary {
  background: #00658f;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  color: #ffffff;
}

.agreements-btn--primary:hover {
  background: #005577;
}

.agreements-stats {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.agreements-notice {
  margin: 0 0 16px;
  padding: 12px 16px;
  border-radius: 12px;
  background: #e8f5e9;
  color: #1b5e20;
  font-size: 14px;
  font-weight: 600;
}

.agreements-notice[hidden] {
  display: none !important;
}

.agreements-stat-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 24px;
  border: 1px solid #e3e6ea;
  border-radius: 12px;
  background: #ffffff;
}

.agreements-stat-card__title {
  color: #41484c;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
}

.agreements-stat-card strong {
  color: #191c1d;
  font-family: "Plus Jakarta Sans", Arial, Helvetica, sans-serif;
  font-size: 32px;
  font-weight: 700;
  line-height: 40px;
}

.agreements-table-card {
  border: 1px solid #e3e6ea;
  border-radius: 12px;
  background: #ffffff;
  overflow: hidden;
}

.agreements-table-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 20px 24px;
  border-bottom: 1px solid #eceef1;
}

.agreements-table-card__title-row h2 {
  margin: 0;
  color: #191c1d;
  font-family: "Plus Jakarta Sans", Arial, Helvetica, sans-serif;
  font-size: 20px;
  font-weight: 600;
  line-height: 28px;
}

.agreements-table-filter {
  display: flex;
  align-items: center;
  gap: 10px;
}

.agreements-table-filter__label {
  color: #41484c;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  white-space: nowrap;
}

.custom-select--agreements-status {
  min-width: 180px;
}

.agreements-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.agreements-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
}

.agreements-table__empty td {
  padding: 32px 20px;
  color: #71787d;
  text-align: center;
  white-space: normal;
}

.agreements-delete-btn {
  display: inline-flex;
  height: 36px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-left: 8px;
  border: 0;
  border-radius: 8px;
  background: #fee2e2;
  color: #b91c1c;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  padding: 8px 16px;
}

.agreements-delete-btn img {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
}

.agreements-table th,
.agreements-table td {
  padding: 12px 10px;
  text-align: left;
  font-size: 13px;
  line-height: 18px;
  border-bottom: 1px solid #eceef1;
  white-space: nowrap;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agreements-table th:nth-child(1),
.agreements-table td:nth-child(1) {
  width: 15%;
  padding-left: 20px;
}

.agreements-table th:nth-child(2),
.agreements-table td:nth-child(2) {
  width: 15%;
}

.agreements-table th:nth-child(3),
.agreements-table td:nth-child(3),
.agreements-table th:nth-child(4),
.agreements-table td:nth-child(4) {
  width: 14%;
}

.agreements-table th:nth-child(5),
.agreements-table td:nth-child(5),
.agreements-table th:nth-child(6),
.agreements-table td:nth-child(6) {
  width: 9%;
}

.agreements-table th:nth-child(7),
.agreements-table td:nth-child(7) {
  width: 8%;
}

.agreements-table th:nth-child(8),
.agreements-table td:nth-child(8) {
  width: 12%;
  padding-left: 16px;
  padding-right: 16px;
  text-align: center;
}

.agreements-table th {
  color: #41484c;
  font-weight: 600;
  background: #fafbfc;
}

[data-i18n="TYPE"] {
  text-transform: lowercase;
}

[data-i18n="TYPE"]::first-letter {
  text-transform: uppercase;
}

.agreements-table td {
  color: #191c1d;
}

.agreements-table td.is-muted {
  color: #71787d;
}

.agreements-table tbody tr:last-child td {
  border-bottom: 0;
}

.agreements-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
  white-space: nowrap;
}

.agreements-table td.is-date {
  color: #41484c;
}

.agreements-table th.is-actions,
.agreements-table td.is-actions {
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
  text-align: center;
}

.agreements-status.is-active {
  background: #e8f5e9;
  color: #2e7d32;
}

.agreements-status.is-pending {
  background: #fff3e0;
  color: #e65100;
}

.agreements-status.is-expired {
  background: #fce8e8;
  color: #b31b25;
}

.agreements-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.agreements-modal[hidden] {
  display: none !important;
}

.agreements-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(25, 28, 29, 0.45);
}

.agreements-modal__panel {
  position: relative;
  z-index: 1;
  display: flex;
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  flex-direction: column;
  overflow: hidden;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 24px 48px rgba(25, 28, 29, 0.18);
}

.agreements-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 24px 0;
  flex-shrink: 0;
}

.agreements-modal__header h2 {
  margin: 0;
  color: #191c1d;
  font-size: 20px;
  font-weight: 700;
}

.agreements-modal__close {
  border: 0;
  background: transparent;
  color: #71787d;
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
}

.agreements-modal__form {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}

.agreements-modal__body {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  padding: 16px 24px 8px;
  overflow: auto;
  overflow-anchor: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.agreements-modal__fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.agreements-modal__body label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: visible;
}

.agreements-modal__row label {
  min-width: 0;
}

.agreements-modal__body label span,
.agreements-field__label {
  color: #41484c;
  font-size: 13px;
  font-weight: 500;
}

.agreements-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.custom-select--agreements-form {
  width: 100%;
}

.agreements-modal .custom-select.is-open {
  z-index: 5;
}

.agreements-modal .custom-select__menu {
  z-index: 50;
}

.agreements-modal__body input,
.agreements-modal__body select,
.agreements-modal__body textarea {
  border: 1px solid #c0c7cc;
  border-radius: 10px;
  padding: 0 12px;
  color: #191c1d;
  font-size: 15px;
  background: #ffffff;
}

.agreements-modal__body input,
.agreements-modal__body select {
  height: 40px;
}

.agreements-modal__body textarea {
  min-height: 72px;
  max-height: 72px;
  padding: 10px 12px;
  resize: none;
  line-height: 1.45;
}

.agreements-modal__field--toggle {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 6px;
}

.agreements-modal__field--toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #00658f;
}

.agreements-modal--confirm .agreements-modal__panel {
  width: min(480px, 100%);
}

.agreements-modal__confirm-body {
  padding: 8px 24px 0;
  gap: 10px;
}

.agreements-modal__confirm-text {
  margin: 0;
  color: #191c1d;
  font-size: 15px;
  line-height: 22px;
}

.agreements-modal__confirm-name {
  margin: 0;
  color: #00658f;
  font-family: "Plus Jakarta Sans", Arial, Helvetica, sans-serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 26px;
}

.agreements-modal__confirm-hint {
  margin: 0;
  color: #71787d;
  font-size: 13px;
  line-height: 18px;
}

.agreements-modal__btn--danger {
  border: 0;
  background: #ba1a1a;
  color: #ffffff;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}

.agreements-modal__btn--danger:hover {
  background: #9b1515;
}

.agreements-modal__btn--danger:disabled,
.agreements-modal__btn--primary:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.agreements-modal__footer--confirm {
  padding: 16px 24px 24px;
  margin-top: 0;
}

.agreements-text-preview {
  display: inline-block;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
  cursor: pointer;
}

.agreements-text-preview:hover,
.agreements-text-preview:focus-visible {
  color: #00658f;
  text-decoration: underline;
  outline: none;
}

.agreements-modal--preview .agreements-modal__panel--preview {
  width: min(560px, 100%);
}

.agreements-modal__preview-body {
  padding: 8px 24px 0;
}

.agreements-modal__preview-text {
  margin: 0;
  color: #191c1d;
  font-size: 15px;
  line-height: 24px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: min(60vh, 420px);
  overflow: auto;
}

.agreements-modal__footer--preview {
  padding: 16px 24px 24px;
  margin-top: 0;
  justify-content: flex-end;
}

.agreements-modal__row {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.agreements-modal__row--compact {
  align-items: end;
}

.agreements-modal__error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 13px;
}

.agreements-modal__error[hidden] {
  display: none;
}

.agreements-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 8px 24px 20px;
  margin-top: 0;
  flex-shrink: 0;
}

.agreements-modal__footer--edit {
  justify-content: space-between;
  align-items: center;
}

.agreements-modal__footer-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.agreements-modal__footer--edit .delete-btn[hidden] {
  display: none;
}

.agreements-modal__btn {
  height: 40px;
  border-radius: 999px;
  padding: 0 18px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.agreements-modal__btn--ghost {
  border: 1px solid #c0c7cc;
  background: #ffffff;
  color: #191c1d;
}

.agreements-modal__btn--primary {
  border: 0;
  background: #00658f;
  color: #ffffff;
}

.agreements-modal__btn--primary:hover {
  background: #005577;
}

@media (max-width: 1100px) {
  .agreements-stats {
    grid-template-columns: 1fr;
  }

  .agreements-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .agreements-modal__row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .agreements-main {
    padding: 20px 16px calc(48px + env(safe-area-inset-bottom, 0px));
  }

  .agreements-toolbar {
    width: 100%;
    align-items: stretch;
  }

  .agreements-toolbar__actions {
    width: 100%;
  }

  .agreements-toolbar__actions .add-btn {
    width: 100%;
    justify-content: center;
  }


  .agreements-pagination.table-pagination-footer {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px 28px;
  }

  .agreements-pagination .table-pagination-footer__meta {
    align-self: auto;
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
  }

  .agreements-pagination .table-pagination-footer__controls {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    align-self: auto;
    justify-content: flex-end;
    gap: 8px;
    margin-left: auto;
    width: auto;
    max-width: 100%;
  }

  .agreements-pagination nav {
    justify-content: flex-end;
    margin-left: 0;
  }

  .agreements-modal:not(.agreements-modal--confirm):not(.agreements-modal--preview) {
    align-items: center;
    justify-content: center;
    padding: max(20px, env(safe-area-inset-top, 0px)) 12px max(20px, env(safe-area-inset-bottom, 0px));
  }

  .agreements-modal:not(.agreements-modal--confirm):not(.agreements-modal--preview) .agreements-modal__panel {
    width: 100%;
    max-height: calc(100vh - 64px);
    max-height: min(82dvh, calc(100dvh - 64px));
  }

  .agreements-modal:not(.agreements-modal--confirm):not(.agreements-modal--preview) .agreements-modal__header {
    padding: 16px 16px 0;
  }

  .agreements-modal:not(.agreements-modal--confirm):not(.agreements-modal--preview) .agreements-modal__body {
    padding: 16px;
  }

  .agreements-modal:not(.agreements-modal--confirm):not(.agreements-modal--preview) .agreements-modal__footer {
    padding: 12px 16px 16px;
  }

  .agreements-table-card__head {
    padding: 16px;
  }

  .agreements-table {
    min-width: 720px;
    table-layout: auto;
  }

  .agreements-table th,
  .agreements-table td {
    padding: 12px 12px;
    font-size: 14px;
    line-height: 20px;
  }
}
