.som-ai-assistant {
  max-width: 760px;
  margin: 28px auto;
  border: 1px solid #eadfcd;
  border-radius: 24px;
  background: linear-gradient(180deg, #fffaf2 0%, #fff8ee 100%);
  box-shadow: 0 14px 38px rgba(40, 33, 24, 0.08);
  overflow: hidden;
  font-family: inherit;
}

.som-ai-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 22px 24px 18px;
  border-bottom: 1px solid #eadfcd;
  background: linear-gradient(180deg, rgba(255,255,255,0.55) 0%, rgba(255,248,238,0) 100%);
}

.som-ai-header-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.som-ai-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  border: 1px solid #eadfcd;
  box-shadow: 0 4px 14px rgba(40, 33, 24, 0.08);
  flex-shrink: 0;
}

.som-ai-kicker {
  margin: 0 0 4px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6f6659;
}

.som-ai-header h3 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
  color: #2e2a24;
}

.som-ai-subtitle {
  margin: 6px 0 0;
  font-size: 14px;
  line-height: 1.45;
  color: #6f6659;
}

.som-ai-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 84px;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: #eef5ee;
  color: #4e6f53;
  border: 1px solid #d8e5d8;
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}

.som-ai-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 170px;
  max-height: 400px;
  overflow-y: auto;
  padding: 20px 24px 14px;
  background: #fffdf8;
}

.som-ai-message {
  width: fit-content;
  max-width: 88%;
  padding: 13px 15px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.55;
}

.som-ai-message-bot {
  align-self: flex-start;
  background: #f6eddc;
  color: #2e2a24;
  position: relative;
  margin-left: 52px;
}

.som-ai-message-bot::before {
  content: '';
  position: absolute;
  left: -44px;
  top: 2px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff url('somi-avatar.png') center/cover no-repeat;
  border: 1px solid #eadfcd;
  box-shadow: 0 3px 10px rgba(40, 33, 24, 0.08);
}

.som-ai-message-user {
  align-self: flex-end;
  background: #6b8c6e;
  color: #fff;
}

.som-ai-message a {
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
}

.som-ai-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 24px 10px;
  background: #fffdf8;
}

.som-ai-chip {
  border: 1px solid #d9c9ad;
  border-radius: 999px;
  padding: 9px 13px;
  background: #fff;
  color: #2e2a24;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  line-height: 1.2;
  transition: all 0.18s ease;
}

.som-ai-chip:hover {
  background: #6b8c6e;
  border-color: #6b8c6e;
  color: #fff;
  transform: translateY(-1px);
}

.som-ai-chip:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.som-ai-feedback {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(46, 42, 36, 0.12);
  font-size: 13px;
  color: #6f6659;
}

.som-ai-feedback button {
  border: 1px solid #d9c9ad;
  border-radius: 999px;
  padding: 5px 10px;
  background: #fffdf8;
  color: #2e2a24;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.som-ai-feedback button:hover {
  background: #6b8c6e;
  border-color: #6b8c6e;
  color: #fff;
}

.som-ai-feedback button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.som-ai-form {
  display: flex;
  gap: 10px;
  padding: 14px 24px 8px;
  background: #fff8ee;
}

.som-ai-form input {
  flex: 1;
  width: 100%;
  border: 1px solid #d9c9ad;
  border-radius: 999px;
  padding: 14px 16px;
  font: inherit;
  background: #fff;
  color: #2e2a24;
}

.som-ai-form input:focus {
  outline: none;
  border-color: #6b8c6e;
  box-shadow: 0 0 0 3px rgba(107, 140, 110, 0.15);
}

.som-ai-form button {
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  background: #6b8c6e;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  min-width: 118px;
}

.som-ai-form button:hover {
  background: #5e7d61;
}

.som-ai-form button:disabled,
.som-ai-form input:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.som-ai-disclaimer {
  margin: 0;
  padding: 0 24px 18px;
  color: #6f6659;
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 640px) {
  .som-ai-assistant {
    margin: 22px 0;
    border-radius: 18px;
  }

  .som-ai-header,
  .som-ai-messages,
  .som-ai-suggestions,
  .som-ai-form,
  .som-ai-disclaimer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .som-ai-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .som-ai-header-main {
    gap: 12px;
  }

  .som-ai-avatar {
    width: 48px;
    height: 48px;
  }

  .som-ai-header h3 {
    font-size: 22px;
  }

  .som-ai-badge {
    min-width: auto;
  }

  .som-ai-message-bot {
    margin-left: 44px;
    max-width: calc(100% - 44px);
  }

  .som-ai-message-bot::before {
    left: -38px;
    width: 30px;
    height: 30px;
  }

  .som-ai-form {
    flex-direction: column;
  }

  .som-ai-form button {
    width: 100%;
  }
}


.som-ai-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.som-ai-close {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px !important;
  min-width: 30px !important;
  height: 30px !important;
  min-height: 30px !important;
  padding: 0 !important;
  border: 1px solid #eadfcd;
  border-radius: 999px;
  background: #fffdf8;
  color: #6f6659;
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
  flex-shrink: 0;
}

.som-ai-close:hover {
  background: #f6eddc;
  border-color: #d9c9ad;
  color: #2e2a24;
}

.som-ai-close:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(107, 140, 110, 0.16);
}

.som-ai-floating {
  position: fixed;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  z-index: 99999;
  font-family: inherit;
}

.som-ai-floating-position-left {
  left: 22px;
}

.som-ai-floating-position-right {
  right: 22px;
}

.som-ai-floating-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #eadfcd;
  border-radius: 999px;
  padding: 10px 15px 10px 10px;
  background: #6b8c6e;
  color: #fff;
  box-shadow: 0 12px 30px rgba(40, 33, 24, 0.18);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.som-ai-floating-button:hover {
  transform: translateY(-2px);
  background: #5e7d61;
  box-shadow: 0 16px 38px rgba(40, 33, 24, 0.22);
}

.som-ai-floating-button img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  border: 1px solid rgba(255,255,255,0.75);
}

.som-ai-floating-panel {
  position: absolute;
  bottom: 66px;
  width: min(430px, calc(100vw - 32px));
  max-height: min(680px, calc(100vh - 110px));
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.som-ai-floating-position-left .som-ai-floating-panel {
  left: 0;
}

.som-ai-floating-position-right .som-ai-floating-panel {
  right: 0;
}

.som-ai-floating.is-open .som-ai-floating-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.som-ai-floating.is-open .som-ai-floating-button {
  display: none;
}

.som-ai-assistant-floating {
  width: 100%;
  max-width: none;
  margin: 0;
  border-radius: 22px;
  box-shadow: 0 18px 48px rgba(40, 33, 24, 0.22);
}

.som-ai-assistant-floating .som-ai-header {
  padding: 16px 16px 14px;
}

.som-ai-assistant-floating .som-ai-avatar {
  width: 46px;
  height: 46px;
}

.som-ai-assistant-floating .som-ai-header h3 {
  font-size: 20px;
}

.som-ai-assistant-floating .som-ai-subtitle {
  font-size: 13px;
}

.som-ai-assistant-floating .som-ai-badge {
  min-width: auto;
  height: 32px;
  font-size: 12px;
}

.som-ai-assistant-floating .som-ai-messages {
  min-height: 210px;
  max-height: min(360px, calc(100vh - 300px));
  padding: 16px;
}

.som-ai-assistant-floating .som-ai-suggestions {
  padding: 0 16px 10px;
}

.som-ai-assistant-floating .som-ai-form {
  padding: 12px 16px 8px;
}

.som-ai-assistant-floating .som-ai-disclaimer {
  padding: 0 16px 14px;
}

@media (max-width: 640px) {
  .som-ai-floating {
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }

  .som-ai-floating-position-left {
    left: 14px;
  }

  .som-ai-floating-position-right {
    right: 14px;
  }

  .som-ai-floating-button span {
    display: none;
  }

  .som-ai-floating-button {
    width: 60px;
    height: 60px;
    justify-content: center;
    padding: 8px;
  }

  .som-ai-floating-button img {
    width: 44px;
    height: 44px;
  }

  .som-ai-floating-panel {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
    max-height: calc(100vh - 20px);
  }

  .som-ai-assistant-floating {
    border-radius: 18px;
  }

  .som-ai-assistant-floating .som-ai-header {
    flex-direction: row;
    align-items: flex-start;
  }

  .som-ai-assistant-floating .som-ai-header-actions {
    align-items: flex-start;
    gap: 6px;
  }

  .som-ai-assistant-floating .som-ai-close {
    width: 30px !important;
    min-width: 30px !important;
    height: 30px !important;
    min-height: 30px !important;
    font-size: 17px;
  }

  .som-ai-assistant-floating .som-ai-badge {
    display: none;
  }

  .som-ai-assistant-floating .som-ai-messages {
    max-height: calc(100vh - 290px);
  }
}
