.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background: white;
  border-radius: 12px;
  max-width: 520px;
  width: 100%;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.2);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  font-size: 14px;
}

.form-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

.form-required {
  color: var(--primary);
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: white;
  color: var(--text);
}

textarea.form-control {
  min-height: 92px;
  resize: vertical;
  line-height: 1.6;
}

.portfolio-consent-box {
  align-items: flex-start;
  gap: 10px;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1.5px solid #FCA5A5;
  border-radius: 8px;
  background: #FEF2F2;
  color: #991B1B;
  cursor: pointer;
}

.portfolio-consent-box input {
  margin-top: 3px;
  accent-color: #DC2626;
}

.portfolio-consent-box span {
  display: grid;
  gap: 3px;
}

.portfolio-consent-box strong {
  font-size: 13px;
  font-weight: 800;
}

.consent-applied-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #DC2626;
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.4;
}

.portfolio-consent-box small {
  font-size: 12px;
  line-height: 1.5;
  color: #7F1D1D;
}

.portfolio-consent-box.is-linked-discount {
  border-color: rgba(34, 197, 94, 0.36);
  background: #F0FDF4;
  color: #166534;
}

.portfolio-consent-box.is-linked-discount input {
  accent-color: #16A34A;
}

.portfolio-consent-box.is-linked-discount small {
  color: #166534;
}

.saved-estimates-modal {
  max-width: 720px;
}

.saved-estimate-save-box {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #F8FAFC;
  margin-bottom: 18px;
}

.saved-estimate-save-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.saved-estimate-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 13px;
}

.saved-estimate-list-head span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.saved-estimate-list {
  display: grid;
  gap: 10px;
}

.saved-estimate-empty {
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  text-align: center;
  font-size: 13px;
}

.saved-estimate-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #FFFFFF;
}

.saved-estimate-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.saved-estimate-main strong,
.saved-estimate-main span,
.saved-estimate-main small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.saved-estimate-main strong {
  font-size: 14px;
}

.saved-estimate-main span {
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.saved-estimate-main small {
  color: var(--text-muted);
  font-size: 12px;
}

.saved-estimate-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.saved-estimate-actions .btn {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1E293B;
  color: white;
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 600;
  z-index: 999;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.is-error {
  background: #991B1B;
  max-width: calc(100vw - 32px);
  white-space: normal;
  text-align: center;
  line-height: 1.6;
}

@media (max-width: 640px) {
  .saved-estimate-save-row,
  .saved-estimate-item {
    grid-template-columns: 1fr;
  }
  .saved-estimate-actions {
    justify-content: stretch;
  }
  .saved-estimate-actions .btn {
    flex: 1;
  }
}
