.portal-dialog {
  background: #f8f6f0;
  color: #25221d;
  border: 1px solid #ded5c3;
  border-radius: 14px;
  box-shadow: 0 26px 100px #0a0908a8;
  width: min(740px, calc(100% - 36px));
  max-width: none;
  max-height: calc(100vh - 36px);
  max-height: calc(100dvh - 36px);
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  text-align: left;
}

.portal-dialog::backdrop {
  background: #14130f9c;
  backdrop-filter: blur(3px);
}

.portal-dialog,
.portal-dialog * {
  box-sizing: border-box;
}

.portal-dialog h2,
.portal-dialog h3,
.portal-dialog h4,
.portal-dialog p {
  margin: 0;
}

.portal-header {
  background: #24211e;
  color: #fffaf0;
  padding: 26px 28px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.portal-header .portal-kicker {
  color: #d7b475;
  margin-bottom: 7px;
  text-transform: uppercase;
  font-size: .8rem;
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: .12em;
}

.portal-header h2 {
  color: inherit;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -.035em;
}

.portal-close,
.portal-tabs button,
.portal-button,
.portal-suggestions button {
  appearance: none;
  min-height: 40px;
  font-family: inherit;
  font-weight: 650;
  cursor: pointer;
  border-radius: 6px;
  line-height: 1.35;
  white-space: normal;
}

.portal-close {
  flex: 0 0 auto;
  min-width: 40px;
  background: transparent;
  border: 1px solid #786852;
  color: #fffaf0;
  font-size: 1.5rem;
}

.portal-close:hover {
  background: #3c342a;
}

.portal-demo {
  background: #ece5d7;
  color: #564838;
  padding: 11px 28px;
  font-size: .875rem;
  line-height: 1.55;
}

.portal-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-bottom: 1px solid #ded5c3;
  padding: 13px 28px;
}

.portal-tabs[hidden] {
  display: none;
}

.portal-tabs button,
.portal-suggestions button {
  background: transparent;
  border: 1px solid #d3c7b4;
  color: #504534;
  padding: 7px 12px;
  font-size: .875rem;
}

.portal-tabs button:hover,
.portal-tabs button[aria-pressed="true"],
.portal-suggestions button:hover {
  background: #2f2921;
  border-color: #2f2921;
  color: #fffaf0;
}

.portal-content {
  padding: 24px 28px 30px;
  display: grid;
  gap: 14px;
}

.portal-content .portal-intro {
  color: #514a3f;
  font-size: 1rem;
  line-height: 1.55;
}

.portal-card {
  min-width: 0;
  border-radius: 8px;
  border: 1px solid #ded5c3;
  background: #fffdf8;
  padding: 18px;
}

.portal-card h3 {
  color: #27231e;
  font-size: 1.19rem;
  font-weight: 700;
  letter-spacing: -.015em;
  line-height: 1.3;
}

.portal-card p {
  color: #544c40;
  font-size: 1rem;
  line-height: 1.55;
  margin-top: 6px;
}

.portal-card .portal-note {
  color: #5c4d39;
  margin-top: 12px;
  overflow-wrap: anywhere;
}

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

.portal-grid-management {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.portal-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  justify-self: start;
  color: #221b12;
  background: #d7b475;
  border: 1px solid #bb9654;
  margin-top: 13px;
  padding: 9px 13px;
  font-size: .875rem;
}

.portal-button:hover {
  background: #e5c48c;
}

.portal-button-secondary {
  background: transparent;
}

.portal-status {
  color: #284730;
  font-size: .875rem;
  font-weight: 650;
}

.portal-status:not(:empty) {
  padding: 12px 28px 0;
}

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

.portal-form-wide,
.portal-form .portal-check,
.portal-form .portal-button {
  grid-column: 1 / -1;
}

.portal-form .portal-button {
  margin-top: 0;
}

.portal-form label {
  display: grid;
  gap: 5px;
  color: #40382d;
  font-size: .875rem;
  font-weight: 650;
  line-height: 1.4;
}

.portal-form input:not([type="checkbox"]),
.portal-form select,
.portal-form textarea,
.portal-list select {
  color: #25221d;
  min-width: 0;
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid #beaf96;
  border-radius: 5px;
  background: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.4;
}

.portal-form select,
.portal-list select {
  appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg width='14' height='9' viewBox='0 0 14 9' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m2 2 5 5 5-5' fill='none' stroke='%23634e34' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.portal-form textarea {
  resize: vertical;
}

.portal-form input[type="file"] {
  display: block;
  max-width: 100%;
}

.portal-form .portal-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.portal-check input {
  accent-color: #5b4527;
  margin: 2px 0 0;
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.portal-checklist {
  min-width: 0;
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 12px;
  border: 1px solid #ded5c3;
  border-radius: 5px;
}

.portal-checklist legend {
  padding: 0 5px;
  font-size: .875rem;
  font-weight: 650;
}

.portal-list {
  list-style: none;
  margin: 11px 0 0;
  padding: 0;
}

.portal-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid #ede7db;
  color: #302a21;
  overflow-wrap: anywhere;
}

.portal-list li:last-child {
  border-bottom: 0;
}

.portal-list small {
  display: block;
  margin-top: 3px;
  color: #605646;
  font-size: .875rem;
  line-height: 1.45;
}

.portal-list select {
  flex: 0 1 175px;
  font-size: .875rem;
}

.portal-card .portal-tag,
.portal-tag {
  display: inline-block;
  background: #ece3d0;
  color: #493921;
  border-radius: 4px;
  font-size: .875rem;
  font-weight: 650;
  padding: 4px 9px;
  line-height: 1.45;
  max-width: 100%;
}

.portal-list .portal-tag {
  flex: 0 0 auto;
}

.portal-agreement {
  margin-top: 14px;
  border: 1px solid #ded5c3;
  background: #f8f6f0;
  padding: 14px;
  border-radius: 6px;
}

.portal-agreement h4 {
  color: #403523;
  font-size: 1rem;
}

.portal-agreement + .portal-tag {
  margin-top: 12px;
}

.portal-dialog :focus-visible {
  outline: 2px solid #8c6226;
  outline-offset: 3px;
}

.portal-header :focus-visible {
  outline-color: #ead4ac;
}

.portal-chat {
  background: #f0ebe0;
  border: 1px solid #ded5c3;
  border-radius: 7px;
  padding: 14px;
  max-height: min(340px, 40vh);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.portal-chat-message {
  align-self: flex-start;
  background: #fffdf8;
  border: 1px solid #dcd0bd;
  border-radius: 7px;
  padding: 10px 13px;
  width: fit-content;
  max-width: 90%;
  overflow-wrap: anywhere;
}

.portal-chat-customer {
  align-self: flex-end;
  background: #e9dbbb;
  border-color: #d3c099;
}

.portal-chat-message strong {
  display: block;
  font-size: .875rem;
  font-weight: 650;
  color: #4f402c;
  margin-bottom: 3px;
}

.portal-chat-message p {
  font-size: 1rem;
  line-height: 1.5;
}

.portal-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.portal-chat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-top: 1px solid #ded5c3;
}

.portal-chat-form {
  align-items: end;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-top: 0;
}

.portal-chat-form .portal-button {
  grid-column: auto;
  min-height: 42px;
}

@media (max-width: 600px) {
  .portal-header,
  .portal-content {
    padding: 18px;
  }

  .portal-demo,
  .portal-tabs {
    padding-inline: 18px;
  }

  .portal-status:not(:empty) {
    padding-inline: 18px;
  }

  .portal-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 400px) {
  .portal-dialog {
    width: calc(100% - 16px);
    max-height: calc(100dvh - 16px);
  }

  .portal-card {
    padding: 13px;
  }

  .portal-form:not(.portal-chat-form) {
    grid-template-columns: 1fr;
  }

  .portal-list li {
    align-items: flex-start;
    flex-direction: column;
  }

  .portal-list select {
    flex: auto;
    width: 100%;
  }
}

.portal-photo {
  display: inline-block;
  width: 96px;
  height: 64px;
  object-fit: cover;
  margin: .4rem .4rem 0 0;
  border-radius: 3px;
}
