.button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.01em;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.12s ease;
}

.button:hover {
  box-shadow: 0 8px 18px rgba(32, 38, 46, 0.08);
}

.button:active {
  transform: translateY(1px);
}

.button:disabled {
  cursor: wait;
  opacity: 0.68;
  transform: none;
  box-shadow: none;
}

.button-primary {
  background: var(--primary);
  color: var(--text-invert);
}

.button-primary:hover {
  background: var(--primary-dark);
}

.button-secondary {
  border-color: var(--border);
  color: var(--text-soft);
}

.button-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.button-danger {
  background: var(--danger);
  color: var(--text-invert);
}

.button-danger:hover {
  background: #ad3832;
}

.button-ghost {
  background: transparent;
  color: var(--text-muted);
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: var(--text-soft);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 41px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  padding: 0 12px;
  outline: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.textarea {
  min-height: 84px;
  padding: 10px 12px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 111, 63, 0.16);
}

.file-upload-control {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  text-transform: none;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

.file-upload-control:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 111, 63, 0.12);
  background: #fbfcfb;
}

.file-upload-button {
  flex: 0 0 auto;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  background: linear-gradient(180deg, #ffffff 0%, #f5f7f4 100%);
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.035em;
  text-transform: none;
  white-space: nowrap;
}

.file-upload-control:hover .file-upload-button {
  border-color: var(--primary);
  color: var(--primary);
}

.file-upload-control:active .file-upload-button {
  transform: translateY(1px);
}

.file-upload-name {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.01em;
  text-transform: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.form-error {
  min-height: 18px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
}

.status-badge {
  min-width: 78px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
}

.status-available {
  background: var(--success-soft);
  border-color: rgba(79, 139, 106, 0.34);
  color: #2f7653;
}

.status-sold {
  background: var(--danger-soft);
  border-color: rgba(200, 70, 62, 0.34);
  color: #a83731;
}

.status-pre_contract {
  background: var(--info-soft);
  border-color: rgba(75, 115, 159, 0.34);
  color: #365f8b;
}

.status-reserved {
  background: var(--warning-soft);
  border-color: rgba(201, 144, 24, 0.34);
  color: #92650e;
}

.status-inactive {
  background: var(--inactive-soft);
  border-color: rgba(123, 131, 140, 0.34);
  color: #5f6872;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(16, 20, 24, 0.42);
  backdrop-filter: blur(4px);
}

.modal-overlay.is-open {
  display: grid;
}

.modal {
  width: min(880px, 100%);
  max-height: min(88vh, 780px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(216, 221, 226, 0.9);
  background: var(--popup-bg);
  box-shadow: var(--shadow-modal);
}

.modal-head {
  padding: 17px 24px 15px;
  border-bottom: 1px solid var(--border);
}

.modal-title-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  margin-bottom: 12px;
}

.modal-title-row h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-align: center;
}

.modal-close-button {
  position: absolute;
  top: 50%;
  right: 0;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transform: translateY(-50%);
  border: 1px solid rgba(200, 70, 62, 0.36);
  border-radius: 50%;
  background: linear-gradient(180deg, #fffafa 0%, #fdf1f0 100%);
  color: var(--danger);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  font-family: Arial, sans-serif;
  text-align: center;
  box-shadow: 0 5px 14px rgba(200, 70, 62, 0.08);
}

.modal-close-button:hover {
  border-color: rgba(200, 70, 62, 0.55);
  color: #a83731;
  box-shadow: 0 8px 18px rgba(200, 70, 62, 0.16);
}

.modal-close-button:active {
  transform: translateY(-50%) scale(0.96);
}

.account-modal {
  width: min(430px, calc(100vw - 24px));
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(216, 221, 226, 0.92);
  background: var(--popup-bg);
  box-shadow: var(--shadow-modal);
}

.account-modal-head {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 62px;
  padding: 18px 64px 16px;
  border-bottom: 1px solid var(--border);
}

.account-modal-head .modal-close-button,
.document-preview-head .modal-close-button {
  right: 14px;
}

.account-modal-head h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.account-form {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.account-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.account-actions .button {
  min-width: 80px;
}

.confirm-overlay {
  z-index: 70;
}

.confirm-dialog {
  width: min(390px, calc(100vw - 28px));
  display: grid;
  justify-items: center;
  gap: 13px;
  padding: 22px;
  border: 1px solid rgba(216, 221, 226, 0.95);
  border-radius: var(--radius-lg);
  background: var(--popup-bg);
  box-shadow: var(--shadow-modal);
}

.confirm-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(200, 70, 62, 0.09);
  color: var(--danger);
}

.confirm-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.confirm-dialog h2 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-align: center;
}

.confirm-dialog p {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.45;
  text-align: center;
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 7px;
}

.confirm-actions .button {
  min-height: 38px;
}

.modal-summary {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding-top: 2px;
}

.modal-lot-code {
  font-size: 29px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.025em;
}

.toast-region {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  display: grid;
  gap: 10px;
  pointer-events: none;
}

.toast {
  min-width: 220px;
  max-width: 340px;
  padding: 12px 14px;
  border: 1px solid rgba(216, 221, 226, 0.96);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  box-shadow: var(--shadow-modal);
  animation: toast-in 0.18s ease-out;
}

.toast-success {
  border-left: 4px solid var(--success);
}

.toast-danger {
  border-left: 4px solid var(--danger);
}

.toast.is-hiding {
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-villa-type {
  justify-self: end;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0.01em;
}

.modal-body {
  min-height: 0;
  overflow: hidden;
  padding: 18px 22px 20px;
}

@media (max-width: 720px) {
  .modal-overlay {
    align-items: start;
    padding: 12px;
    overflow: auto;
  }

  .modal {
    width: 100%;
    max-height: none;
    min-height: auto;
    overflow: visible;
  }

  .modal-head {
    padding: 16px 18px 14px;
  }

  .modal-close-button {
    right: 0;
  }

  .account-modal-head .modal-close-button,
  .document-preview-head .modal-close-button {
    right: 12px;
  }

  .modal-summary {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 10px;
  }

  .modal-villa-type {
    justify-self: start;
  }

  .modal-body {
    overflow: visible;
    padding: 14px;
  }

  .account-modal,
  .document-preview-modal {
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 520px) {
  .button {
    min-height: 40px;
    padding-inline: 12px;
  }

  .modal-overlay {
    padding: 8px;
  }

  .modal-title-row {
    justify-content: flex-start;
    padding-right: 44px;
  }

  .modal-title-row h2 {
    text-align: left;
  }

  .modal-lot-code {
    font-size: 26px;
  }

  .account-form {
    padding: 16px;
  }

  .account-actions,
  .confirm-actions {
    grid-template-columns: 1fr;
    display: grid;
  }
}
