.clara-root {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 2147483000;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #26313d;
}

.clara-root,
.clara-root * {
  box-sizing: border-box;
}

.clara-button {
  min-width: 118px;
  height: 46px;
  border: 1px solid rgba(185, 151, 111, 0.34);
  border-radius: 999px;
  background: #fcfbf8;
  color: #203342;
  box-shadow: 0 12px 28px rgba(17, 27, 38, 0.16), 0 2px 7px rgba(185, 151, 111, 0.12);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 17px 0 12px;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.clara-button:hover,
.clara-button:focus-visible {
  background: #fff;
  box-shadow: 0 15px 34px rgba(17, 27, 38, 0.2), 0 0 0 4px rgba(185, 151, 111, 0.13);
  transform: translateY(-2px);
  outline: 0;
}

.clara-root.is-open .clara-button {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

.clara-button-mark {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #203342;
  color: #fcfbf8;
  display: grid;
  place-items: center;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.clara-button-text {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.clara-panel {
  position: fixed;
  top: auto;
  right: 24px;
  bottom: 82px;
  width: min(360px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 122px));
  background: #fcfbf8;
  border: 1px solid rgba(33, 53, 71, 0.08);
  border-left: 1px solid rgba(185, 151, 111, 0.24);
  border-radius: 22px;
  box-shadow: -10px 16px 44px rgba(17, 27, 38, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-22px) scale(0.985);
  transition: opacity 180ms ease, transform 180ms ease;
}

.clara-root.is-open .clara-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0) scale(1);
}

.clara-header {
  padding: 22px 20px 16px;
  background: #fcfbf8;
  color: #172735;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.clara-header-copy {
  min-width: 0;
  padding-top: 2px;
}

.clara-title {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0;
}

.clara-subtitle {
  margin: 8px 0 0;
  max-width: 260px;
  font-size: 14px;
  line-height: 1.45;
  color: #445461;
}

.clara-close {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border: 1px solid rgba(33, 53, 71, 0.09);
  border-radius: 999px;
  background: transparent;
  color: #425260;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: background 160ms ease, border-color 160ms ease;
}

.clara-close:hover,
.clara-close:focus-visible {
  background: #f3efe8;
  border-color: rgba(185, 151, 111, 0.26);
  outline: 0;
}

.clara-welcome {
  padding: 0 20px 12px;
  background: #fcfbf8;
}

.clara-welcome-title {
  margin: 0 0 9px;
  color: #172735;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.35;
}

.clara-welcome-text {
  margin: 0;
  color: #344453;
  font-size: 14px;
  line-height: 1.55;
}

.clara-welcome-note {
  margin: 12px 0 0;
  color: #7a828b;
  font-size: 12px;
  line-height: 1.45;
}

.clara-quick {
  padding: 0 20px 10px;
  display: flex;
  flex-direction: column;
}

.clara-quick button {
  min-height: 42px;
  width: 100%;
  border: 0;
  border-top: 1px solid rgba(33, 53, 71, 0.09);
  border-radius: 0;
  background: transparent;
  color: #26313d;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  line-height: 1.35;
  padding: 10px 2px;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  transition: color 150ms ease, background 150ms ease, padding 150ms ease;
}

.clara-quick button:last-child {
  border-bottom: 1px solid rgba(33, 53, 71, 0.09);
}

.clara-quick button:hover,
.clara-quick button:focus-visible {
  background: rgba(185, 151, 111, 0.08);
  color: #172735;
  padding-left: 10px;
  padding-right: 10px;
  outline: 0;
}

.clara-quick-arrow {
  color: rgba(185, 151, 111, 0.86);
  font-size: 20px;
  line-height: 1;
}

.clara-messages {
  min-height: 52px;
  padding: 2px 20px 10px;
  overflow-y: auto;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
}

.clara-message {
  max-width: 92%;
  border-radius: 16px;
  padding: 11px 12px;
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 1px 0 rgba(17, 27, 38, 0.03);
}

.clara-message-bot {
  align-self: flex-start;
  background: #f1eee7;
  color: #273642;
}

.clara-message-user {
  align-self: flex-end;
  background: #203342;
  color: #fff;
}

.clara-status {
  min-height: 22px;
  padding: 0 20px 8px;
  font-size: 12px;
  color: #7a828b;
}

.clara-form {
  position: relative;
  padding: 12px 16px 18px;
  display: block;
  background: #fcfbf8;
}

.clara-input {
  min-width: 0;
  width: 100%;
  min-height: 50px;
  max-height: 104px;
  resize: none;
  border: 1px solid rgba(33, 53, 71, 0.15);
  border-radius: 999px;
  background: #fff;
  color: #26313d;
  padding: 15px 58px 13px 18px;
  font: inherit;
  font-size: 14px;
  line-height: 1.35;
  box-shadow: 0 10px 26px rgba(17, 27, 38, 0.06);
}

.clara-input::placeholder {
  color: #9aa1a9;
}

.clara-input:focus {
  outline: 0;
  border-color: rgba(185, 151, 111, 0.6);
}

.clara-send {
  position: absolute;
  right: 23px;
  top: 50%;
  width: 38px;
  height: 38px;
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #203342;
  cursor: pointer;
  font-size: 25px;
  line-height: 1;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
  box-shadow: none;
  transition: color 160ms ease, background 160ms ease;
}

.clara-send:hover,
.clara-send:focus-visible {
  background: #f7f2ea;
  color: #9b744e;
  outline: 0;
}

.clara-send:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.clara-note {
  display: none;
}

@media (max-width: 640px) {
  .clara-root {
    right: 14px;
    bottom: 18px;
  }

  .clara-button {
    min-width: 104px;
    height: 44px;
    padding-right: 15px;
  }

  .clara-panel {
    top: auto;
    right: 10px;
    bottom: 10px;
    left: 10px;
    width: auto;
    height: min(74dvh, 560px);
    max-height: calc(100dvh - 20px);
    border-radius: 22px;
    border: 1px solid rgba(33, 53, 71, 0.1);
    box-shadow: 0 -18px 54px rgba(17, 27, 38, 0.2);
    transform: translateY(18px);
  }

  .clara-root.is-open .clara-panel {
    transform: translateY(0);
  }

  .clara-header {
    padding: 21px 19px 17px;
  }

  .clara-welcome {
    padding: 20px 18px 14px;
  }

  .clara-quick {
    padding: 0 18px 10px;
  }

  .clara-quick button {
    min-height: 46px;
  }

  .clara-messages {
    padding: 4px 18px 10px;
  }

  .clara-status {
    padding-right: 18px;
    padding-left: 18px;
  }

  .clara-form {
    padding: 12px 14px 14px;
  }

  .clara-note {
    margin: 0 14px 13px;
    padding: 9px 10px 0;
  }
}

/* CLARA · UI + RESPUESTAS LOCALES · PRIMERA PASADA */
.clara-panel {
  background: linear-gradient(180deg, #fffefa 0%, #fcfbf8 34%, #f9f6f0 100%);
  border-color: rgba(185, 151, 111, 0.22);
  box-shadow: 0 22px 56px rgba(17, 27, 38, 0.18), 0 4px 14px rgba(185, 151, 111, 0.1);
}

.clara-header,
.clara-welcome,
.clara-status,
.clara-form {
  flex-shrink: 0;
}

.clara-header {
  border-bottom: 1px solid rgba(185, 151, 111, 0.12);
  padding-bottom: 15px;
}

.clara-title {
  font-family: Georgia, "Times New Roman", serif;
  color: #273746;
  letter-spacing: 0.01em;
}

.clara-welcome {
  margin: 14px 16px 11px;
  padding: 13px 14px;
  background: rgba(185, 151, 111, 0.07);
  border: 1px solid rgba(185, 151, 111, 0.12);
  border-radius: 14px;
}

.clara-welcome-note {
  margin-top: 8px;
}

.clara-quick {
  flex: 0 1 auto;
  max-height: 218px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(185, 151, 111, 0.4) transparent;
  padding-right: 16px;
  padding-left: 16px;
}

.clara-messages {
  flex: 1 1 72px;
  min-height: 72px;
}

.clara-message-bot {
  background: #f1ece3;
  border: 1px solid rgba(185, 151, 111, 0.1);
}

.clara-message-user {
  background: #294252;
}

.clara-status {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #7a674d;
  opacity: 0;
  transition: opacity 150ms ease;
}

.clara-status.is-active {
  opacity: 1;
}

.clara-status-dot {
  display: block;
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: #b9976f;
  animation: clara-thinking-pulse 1s ease-in-out infinite;
}

@keyframes clara-thinking-pulse {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.18); }
}

.clara-input:focus {
  box-shadow: 0 0 0 3px rgba(185, 151, 111, 0.12), 0 10px 26px rgba(17, 27, 38, 0.06);
}

@media (max-width: 640px) {
  .clara-panel {
    height: min(78dvh, 580px);
  }

  .clara-welcome {
    margin: 12px 14px 10px;
    padding: 12px 13px;
  }

  .clara-quick {
    max-height: min(214px, 30dvh);
  }
}
