/* Shared permission-aware Kara assistant widget */
.kara-assistant-widget {
  font-family: inherit;
}

.kara-assistant-launcher {
  position: fixed;
  right: auto;
  left: 24px;
  bottom: 24px;
  z-index: 1160;
  display: inline-flex;
  min-height: 58px;
  align-items: center;
  gap: 11px;
  border: 1px solid rgba(94, 234, 212, 0.42);
  border-radius: 999px;
  background: linear-gradient(135deg, #0b5f58, #0f8f83);
  color: #fff;
  padding: 8px 10px 8px 17px;
  box-shadow: 0 16px 40px rgba(7, 61, 56, 0.28);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.kara-assistant-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 46px rgba(7, 61, 56, 0.34);
}

.kara-assistant-launcher:focus-visible,
.kara-assistant-close:focus-visible,
.kara-assistant-suggestions button:focus-visible,
.kara-assistant-form textarea:focus-visible,
.kara-assistant-form button:focus-visible {
  outline: 3px solid rgba(45, 212, 191, 0.38);
  outline-offset: 3px;
}

.kara-assistant-launcher-icon {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
}

.kara-assistant-launcher-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kara-assistant-launcher-copy {
  display: grid;
  gap: 1px;
  text-align: right;
}

.kara-assistant-launcher-copy strong {
  font-size: 0.82rem;
  line-height: 1.5;
}

.kara-assistant-launcher-copy small {
  color: rgba(236, 253, 245, 0.82);
  font-size: 0.61rem;
  line-height: 1.45;
}

.kara-assistant-widget.is-open .kara-assistant-launcher {
  pointer-events: none;
  opacity: 0;
  transform: translateY(8px);
}

.kara-assistant-panel[hidden] {
  display: none !important;
}

.kara-assistant-panel {
  position: fixed;
  right: auto;
  left: 24px;
  bottom: 24px;
  z-index: 1170;
  display: flex;
  width: min(430px, calc(100vw - 48px));
  height: min(680px, calc(100dvh - 48px));
  max-height: calc(100vh - 48px);
  overflow: hidden;
  flex-direction: column;
  border: 1px solid #cfe4e0;
  border-radius: 22px;
  background: #f7fbfa;
  color: #173b37;
  box-shadow: 0 24px 70px rgba(7, 45, 42, 0.3);
  opacity: 0;
  transform: translateY(18px) scale(0.98);
  transform-origin: bottom left;
  transition: opacity 180ms ease, transform 180ms ease;
}

.kara-assistant-panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.kara-assistant-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 17px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(135deg, #123e38, #0f766e);
  color: #fff;
}

.kara-assistant-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.kara-assistant-identity > span {
  display: grid;
  width: 39px;
  height: 39px;
  flex: 0 0 39px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.13);
  font-size: 1rem;
  font-weight: 950;
}

.kara-assistant-identity > div {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.kara-assistant-identity small {
  color: #a7f3d0;
  font-size: 0.61rem;
  font-weight: 800;
}

.kara-assistant-identity h2 {
  overflow: hidden;
  margin: 0;
  font-size: 0.96rem;
  line-height: 1.55;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kara-assistant-close {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font: inherit;
  font-size: 1.35rem;
  cursor: pointer;
}

.kara-assistant-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.kara-assistant-messages {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px;
  scroll-behavior: smooth;
}

.kara-assistant-message {
  display: grid;
  width: fit-content;
  max-width: 89%;
  gap: 5px;
  border: 1px solid #d9e7e4;
  border-radius: 16px 16px 5px 16px;
  background: #fff;
  padding: 10px 12px;
  box-shadow: 0 5px 15px rgba(15, 59, 54, 0.05);
}

.kara-assistant-message.is-assistant {
  align-self: flex-end;
}

.kara-assistant-message.is-user {
  align-self: flex-start;
  border-color: #0f766e;
  border-radius: 16px 16px 16px 5px;
  background: #0f766e;
  color: #fff;
}

.kara-assistant-message.is-error {
  border-color: #fecaca;
  background: #fff7f7;
  color: #991b1b;
}

.kara-assistant-message-role {
  color: #0f766e;
  font-size: 0.58rem;
  font-weight: 950;
}

.kara-assistant-message.is-user .kara-assistant-message-role {
  color: #ccfbf1;
}

.kara-assistant-message p {
  margin: 0;
  color: inherit;
  font-size: 0.75rem;
  line-height: 1.9;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.kara-assistant-message.is-loading p::after {
  display: inline-block;
  width: 1.2rem;
  content: "•••";
  animation: kara-assistant-pulse 1.1s infinite ease-in-out;
  letter-spacing: 0.12em;
}

.kara-assistant-citations {
  display: grid;
  gap: 6px;
  margin-top: 3px;
  padding-top: 8px;
  border-top: 1px solid #dce9e6;
}

.kara-assistant-citations > strong {
  color: #47645f;
  font-size: 0.61rem;
}

.kara-assistant-citations > div {
  display: grid;
  gap: 5px;
}

.kara-assistant-citations article {
  display: grid;
  gap: 2px;
  border: 1px solid #dce9e6;
  border-radius: 9px;
  background: #f5faf9;
  padding: 6px 8px;
}

.kara-assistant-citations b {
  color: #155e56;
  font-size: 0.61rem;
  line-height: 1.65;
}

.kara-assistant-citations small {
  color: #64748b;
  font-size: 0.56rem;
  line-height: 1.6;
}

.kara-assistant-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 4px;
}

.kara-assistant-actions a {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid #0f766e;
  border-radius: 10px;
  background: #0f766e;
  color: #fff;
  padding: 6px 11px;
  font-size: 0.63rem;
  font-weight: 900;
  line-height: 1.6;
  text-decoration: none;
}

.kara-assistant-actions a:hover {
  border-color: #0c655e;
  background: #0c655e;
  color: #fff;
}

.kara-assistant-actions a:focus-visible {
  outline: 3px solid rgba(45, 212, 191, 0.38);
  outline-offset: 2px;
}

.kara-assistant-workflow-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 7px;
}

.kara-assistant-workflow-choices button {
  min-height: 34px;
  border: 1px solid #5aaea5;
  border-radius: 999px;
  background: #f0fdfa;
  color: #115e59;
  padding: 6px 11px;
  font: inherit;
  font-size: 0.63rem;
  font-weight: 900;
  line-height: 1.6;
  cursor: pointer;
}

.kara-assistant-workflow-choices button:hover {
  border-color: #0f766e;
  background: #ccfbf1;
}

.kara-assistant-workflow-choices button:focus-visible {
  outline: 3px solid rgba(45, 212, 191, 0.38);
  outline-offset: 2px;
}

.kara-assistant-workflow-choices button:disabled {
  cursor: wait;
  opacity: 0.55;
}
.kara-assistant-suggestion-section {
  flex: 0 0 auto;
  padding: 9px 13px 10px;
  border-top: 1px solid #e0ebe9;
  background: #f1f8f6;
}

.kara-assistant-suggestion-section > strong {
  display: block;
  margin-bottom: 7px;
  color: #426b66;
  font-size: 0.64rem;
  font-weight: 900;
  line-height: 1.5;
}

.kara-assistant-suggestions {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 1px 1px 3px;
  scrollbar-width: thin;
}

.kara-assistant-suggestions button {
  flex: 0 0 auto;
  border: 1px solid #b8d9d4;
  border-radius: 999px;
  background: #fff;
  color: #17675f;
  padding: 6px 10px;
  font: inherit;
  font-size: 0.61rem;
  font-weight: 850;
  cursor: pointer;
}

.kara-assistant-suggestions button:hover {
  border-color: #55b3a9;
  background: #e9f8f5;
}

.kara-assistant-suggestions button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.kara-assistant-form {
  display: grid;
  flex: 0 0 auto;
  gap: 7px;
  border-top: 1px solid #d9e7e4;
  background: #fff;
  padding: 12px 13px 11px;
}

.kara-assistant-form textarea {
  width: 100%;
  min-height: 68px;
  max-height: 150px;
  resize: vertical;
  border: 1px solid #cbdedb;
  border-radius: 13px;
  background: #fbfdfd;
  color: #173b37;
  padding: 10px 11px;
  font: inherit;
  font-size: 0.75rem;
  line-height: 1.8;
}

.kara-assistant-form textarea::placeholder {
  color: #829590;
}

.kara-assistant-form textarea:focus {
  border-color: #2b9b90;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1);
}

.kara-assistant-form textarea:disabled {
  cursor: wait;
  opacity: 0.7;
}

.kara-assistant-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.kara-assistant-form-footer > small {
  color: #81938f;
  font-size: 0.56rem;
}

.kara-assistant-form-footer > button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  border-radius: 11px;
  background: #0f766e;
  color: #fff;
  padding: 7px 14px;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 900;
  cursor: pointer;
}

.kara-assistant-form-footer > button:hover {
  background: #0c655e;
}

.kara-assistant-form-footer > button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.kara-assistant-form-footer svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kara-assistant-form-footer > button.is-busy svg {
  animation: kara-assistant-pulse 1s infinite ease-in-out;
}

.kara-assistant-status {
  min-height: 1.25rem;
  margin: 0;
  color: #71847f;
  font-size: 0.56rem;
  line-height: 1.7;
}

.kara-assistant-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

@keyframes kara-assistant-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

@media (max-width: 700px) {
  .kara-assistant-launcher {
    right: auto;
    left: 14px;
    bottom: 14px;
  }

  .kara-assistant-panel {
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    height: min(86dvh, 720px);
    max-height: 86vh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 22px 22px 0 0;
    transform-origin: bottom center;
  }

  .kara-assistant-messages {
    padding: 13px;
  }

  .kara-assistant-message {
    max-width: 94%;
  }
}

@media (max-width: 460px) {
  .kara-assistant-launcher {
    width: 52px;
    height: 52px;
    min-height: 52px;
    justify-content: center;
    padding: 6px;
  }

  .kara-assistant-launcher-icon {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .kara-assistant-launcher-copy {
    display: none;
  }

  .kara-assistant-head {
    padding: 12px 13px;
  }

  .kara-assistant-identity h2 {
    font-size: 0.88rem;
  }

  .kara-assistant-suggestion-section {
    padding-inline: 10px;
  }

  .kara-assistant-form {
    padding: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .kara-assistant-launcher,
  .kara-assistant-panel {
    transition: none;
  }

  .kara-assistant-message.is-loading p::after,
  .kara-assistant-form-footer > button.is-busy svg {
    animation: none;
  }
}

@media print {
  .kara-assistant-widget {
    display: none !important;
  }
}
