/* ExCards — виджет готовых ответов. Светлая тема сайта: изумруд #0B6E4F на #FAFAF7. */
.xh {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  font-family: "Inter", "Inter Fallback", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #3A3A36;
}

.xh [hidden] { display: none !important; }

.xh__launcher {
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 999px;
  background: #0B6E4F;
  color: #FFFFFF;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 32px rgba(11, 110, 79, .32);
}
.xh__launcher:hover { background: #0A6144; }

.xh button:focus-visible,
.xh a:focus-visible,
.xh input:focus-visible {
  outline: 3px solid #0B6E4F;
  outline-offset: 2px;
}
.xh__launcher:focus-visible { outline-color: #0A0A0A; }
.xh__q:focus { outline: none; }
.xh__q:focus-visible { outline: 3px solid #0B6E4F; outline-offset: 2px; }

.xh__panel {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: min(400px, calc(100vw - 24px));
  max-height: min(640px, calc(100vh - 110px));
  display: flex;
  flex-direction: column;
  background: #FAFAF7;
  border: 1px solid #E4E4DF;
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(10, 10, 10, .16);
  overflow: hidden;
}

.xh__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 12px 8px 18px;
}
.xh__title {
  margin: 0;
  font-family: "Gerhaus", system-ui, sans-serif;
  font-size: 20px;
  line-height: 1.2;
  color: #0A0A0A;
}
.xh__subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  color: #767670;
}
.xh__close {
  flex: none;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #0A0A0A;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.xh__close:hover { background: rgba(11, 110, 79, .08); }

.xh__search { padding: 4px 18px 10px; }
.xh__input {
  width: 100%;
  box-sizing: border-box;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid #CDCDC8;
  border-radius: 12px;
  background: #FFFFFF;
  color: #0A0A0A;
  font: inherit;
  font-size: 16px;
}
.xh__input::placeholder { color: #8A8A84; }

.xh__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.xh__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 18px 12px;
}
.xh__status:empty { display: none; }
.xh__status { margin: 8px 0; font-size: 14px; color: #5E5E58; }

.xh__heading {
  margin: 4px 0 8px;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #767670;
}
.xh__list { list-style: none; margin: 0; padding: 0; }
.xh__list li { margin: 0 0 6px; }
.xh__item {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid #E4E4DF;
  border-radius: 12px;
  background: #FFFFFF;
  color: #0A0A0A;
  font: inherit;
  font-size: 15px;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}
.xh__item:hover { border-color: #0B6E4F; background: rgba(11, 110, 79, .05); }

.xh__q {
  margin: 6px 0 8px;
  font-family: inherit;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
  color: #0A0A0A;
  letter-spacing: 0;
}
.xh__a { margin: 0 0 10px; font-size: 15px; line-height: 1.5; color: #3A3A36; }
.xh__source { margin: 0 0 12px; font-size: 14px; color: #5E5E58; }
.xh__source-link { color: #0B6E4F; font-weight: 600; text-decoration: underline; }
.xh__back {
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid #CDCDC8;
  border-radius: 12px;
  background: #FFFFFF;
  color: #0A0A0A;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.xh__back::before { content: "← "; }
.xh__back:hover { border-color: #0B6E4F; }

.xh__empty { padding: 12px 0; }
.xh__empty-title { margin: 0 0 4px; font-size: 16px; font-weight: 600; color: #0A0A0A; }
.xh__empty-hint { margin: 0 0 12px; font-size: 14px; color: #5E5E58; }

.xh__footer {
  padding: 10px 18px 16px;
  border-top: 1px solid #E4E4DF;
  background: #FFFFFF;
}
.xh__support {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  box-sizing: border-box;
  padding: 10px 16px;
  border-radius: 12px;
  background: #0B6E4F;
  color: #FFFFFF !important;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}
.xh__support:hover { background: #0A6144; }
.xh__support--inline { display: inline-flex; background: transparent; color: #0B6E4F !important; border: 1px solid #0B6E4F; }
.xh__support--inline:hover { background: rgba(11, 110, 79, .08); }

@media (prefers-reduced-motion: no-preference) {
  .xh__launcher { transition: background-color .15s ease, transform .15s ease; }
  .xh__launcher:active { transform: scale(.96); }
  .xh__panel { animation: xh-in .18s ease-out; }
  @keyframes xh-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
}

/* Телефон: панель — нижний лист на всю ширину */
@media (max-width: 600px) {
  .xh { right: 12px; bottom: 12px; }
  .xh__panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 85vh;
    max-height: 85dvh;
    border-radius: 18px 18px 0 0;
    border-bottom: 0;
  }
  .xh__footer { padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .xh--open .xh__launcher { visibility: hidden; }
  @media (prefers-reduced-motion: no-preference) {
    .xh__panel { animation-name: xh-sheet; }
    @keyframes xh-sheet { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
  }
}
