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

.sdsmartchat-root {
  --sdsc-blue: #00205b;
  --sdsc-blue-2: #1d4f91;
  --sdsc-white: #ffffff;
  --sdsc-japan-red: #bc002d;
  --sdsc-gray-25: #f7f8fa;
  --sdsc-gray-50: #f1f3f6;
  --sdsc-gray-100: #e4e8ee;
  --sdsc-gray-200: #c9d0da;
  --sdsc-gray-600: #536173;
  --sdsc-gray-800: #1d2733;
  --sdsc-shadow: 0 18px 48px rgba(0, 32, 91, 0.22);
  --sdsc-radius: 22px;
  --sdsc-bottom: 92px;
  --sdsc-right: 14px;

  position: fixed;
  right: var(--sdsc-right);
  bottom: var(--sdsc-bottom);
  z-index: 99990;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--sdsc-blue);
  line-height: 1.45;
}

.sdsmartchat-root [hidden] {
  display: none !important;
}

.sdsmartchat-root button {
  max-width: 100%;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  text-transform: none;
  white-space: normal;
}

.sdsmartchat-root .sdsmartchat-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-width: 54px;
  min-height: 54px;
  padding: 0 18px;
  border: 1px solid var(--sdsc-japan-red);
  border-radius: 999px;
  background: var(--sdsc-japan-red);
  color: var(--sdsc-white);
  box-shadow: 0 12px 30px rgba(188, 0, 45, 0.25);
  cursor: pointer;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: -0.01em;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.sdsmartchat-root .sdsmartchat-toggle:focus,
.sdsmartchat-root .sdsmartchat-toggle[aria-expanded="true"] {
  border-style: solid;
  border-color: var(--sdsc-japan-red);
  background-color: var(--sdsc-japan-red);
  color: var(--sdsc-white);
  outline: none;
}

.sdsmartchat-root .sdsmartchat-toggle:hover,
.sdsmartchat-root .sdsmartchat-toggle:focus-visible {
  border-style: solid;
  border-color: #9e0026;
  background-color: #9e0026;
  color: var(--sdsc-white);
  outline: none;
}

.sdsmartchat-root .sdsmartchat-toggle:active {
  border-style: solid;
  border-color: #870020;
  background-color: #870020;
  color: var(--sdsc-white);
}

.sdsmartchat-root .sdsmartchat-toggle:focus-visible {
  box-shadow: 0 0 0 4px rgba(188, 0, 45, 0.24), 0 12px 30px rgba(188, 0, 45, 0.25);
}

.sdsmartchat-root .sdsmartchat-toggle__icon,
.sdsmartchat-root .sdsmartchat-toggle__label {
  color: inherit;
}

.sdsmartchat-toggle__icon {
  display: inline-flex;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
}

.sdsmartchat-toggle__icon svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.sdsmartchat-toggle__icon svg path {
  fill: currentColor;
}

.sdsmartchat-toggle__label {
  display: none;
  white-space: nowrap;
  font-weight: 900;
}

.sdsmartchat-tooltip {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  width: min(270px, calc(100vw - 28px));
  padding: 11px 13px;
  border: 1px solid var(--sdsc-gray-100);
  border-radius: 14px;
  background: var(--sdsc-white);
  color: var(--sdsc-blue);
  box-shadow: 0 12px 32px rgba(0, 32, 91, 0.16);
  font-size: 13px;
  font-weight: 800;
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
}

.sdsmartchat-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.sdsmartchat-panel {
  position: fixed;
  right: 10px;
  left: 10px;
  bottom: calc(var(--sdsc-bottom) + 66px);
  display: flex;
  width: auto;
  max-width: calc(100vw - 20px);
  height: min(620px, calc(100dvh - var(--sdsc-bottom) - 84px));
  min-height: min(420px, calc(100dvh - var(--sdsc-bottom) - 84px));
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--sdsc-gray-100);
  border-radius: var(--sdsc-radius);
  background: var(--sdsc-gray-25);
  box-shadow: var(--sdsc-shadow);
}

.sdsmartchat-panel__header {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 48px;
  gap: 10px;
  align-items: center;
  padding: 14px 14px 13px;
  background: var(--sdsc-blue);
  color: var(--sdsc-white);
}

.sdsmartchat-panel__brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--sdsc-white);
}

.sdsmartchat-panel__brand svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.sdsmartchat-panel__brand svg path {
  fill: currentColor;
}

.sdsmartchat-panel__titlewrap {
  min-width: 0;
}

.sdsmartchat-panel__title {
  color: var(--sdsc-white);
  font-size: 14px;
  font-weight: 950;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.sdsmartchat-panel__subtitle {
  margin-top: 2px;
  color: var(--sdsc-white);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  opacity: 0.92;
}

.sdsmartchat-root .sdsmartchat-panel__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 999px;
  background: var(--sdsc-white);
  color: var(--sdsc-blue);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.sdsmartchat-root .sdsmartchat-panel__close:hover,
.sdsmartchat-root .sdsmartchat-panel__close:focus,
.sdsmartchat-root .sdsmartchat-panel__close:focus-visible,
.sdsmartchat-root .sdsmartchat-panel__close:active {
  border: 0;
  background: var(--sdsc-white);
  color: var(--sdsc-blue);
  outline: none;
}

.sdsmartchat-root .sdsmartchat-panel__close:focus-visible {
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.22);
}

.sdsmartchat-panel__close svg {
  width: 32px;
  height: 32px;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  fill: none;
}

.sdsmartchat-panel__close svg path {
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  fill: none;
}

.sdsmartchat-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.sdsmartchat-message {
  display: flex;
  margin: 0 0 10px;
}

.sdsmartchat-message--bot {
  justify-content: flex-start;
}

.sdsmartchat-message--user {
  justify-content: flex-end;
}

.sdsmartchat-bubble {
  max-width: 92%;
  padding: 11px 12px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

.sdsmartchat-message--bot .sdsmartchat-bubble {
  border: 1px solid var(--sdsc-gray-100);
  border-top-left-radius: 6px;
  background: var(--sdsc-white);
  color: var(--sdsc-blue);
}

.sdsmartchat-message--user .sdsmartchat-bubble {
  border-top-right-radius: 6px;
  background: var(--sdsc-blue-2);
  color: var(--sdsc-white);
}

.sdsmartchat-bubble p {
  margin: 0;
  color: inherit;
}

.sdsmartchat-bubble p + p {
  margin-top: 8px;
}

.sdsmartchat-options {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  min-width: 0;
  gap: 8px;
  margin: 2px 0 12px;
}

.sdsmartchat-root .sdsmartchat-chip {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 44px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  height: auto;
  padding: 10px 13px;
  border: 1px solid var(--sdsc-gray-100);
  border-radius: 14px;
  background: var(--sdsc-white);
  color: var(--sdsc-blue);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 900;
  line-height: 1.25;
  overflow-wrap: anywhere;
  text-align: left;
  white-space: normal;
  word-break: normal;
  -webkit-tap-highlight-color: transparent;
}

.sdsmartchat-root .sdsmartchat-chip:hover,
.sdsmartchat-root .sdsmartchat-chip:focus,
.sdsmartchat-root .sdsmartchat-chip:focus-visible {
  border-color: var(--sdsc-blue-2);
  background: rgba(29, 79, 145, 0.08);
  color: var(--sdsc-blue);
  outline: none;
}

.sdsmartchat-root .sdsmartchat-chip--primary,
.sdsmartchat-root .sdsmartchat-chip--primary:hover,
.sdsmartchat-root .sdsmartchat-chip--primary:focus,
.sdsmartchat-root .sdsmartchat-chip--primary:focus-visible {
  border-color: var(--sdsc-blue);
  background: var(--sdsc-blue);
  color: var(--sdsc-white);
}

.sdsmartchat-formcard {
  margin: 2px 0 12px;
  padding: 12px;
  border: 1px solid var(--sdsc-gray-100);
  border-radius: 18px;
  background: var(--sdsc-white);
}

.sdsmartchat-form {
  display: grid;
  gap: 10px;
}

.sdsmartchat-field {
  display: grid;
  gap: 5px;
}

.sdsmartchat-label {
  color: var(--sdsc-blue);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.25;
}

.sdsmartchat-input,
.sdsmartchat-select,
.sdsmartchat-textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 11px;
  border: 1px solid var(--sdsc-gray-200);
  border-radius: 12px;
  background: var(--sdsc-white);
  color: var(--sdsc-blue);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  outline: none;
}

.sdsmartchat-input::placeholder,
.sdsmartchat-textarea::placeholder {
  color: var(--sdsc-gray-600);
  opacity: 1;
  font-weight: 600;
}

.sdsmartchat-select option {
  color: var(--sdsc-blue);
  background: var(--sdsc-white);
}

.sdsmartchat-textarea {
  min-height: 84px;
  resize: vertical;
}

.sdsmartchat-input:focus,
.sdsmartchat-select:focus,
.sdsmartchat-textarea:focus {
  border-color: var(--sdsc-blue-2);
  box-shadow: 0 0 0 3px rgba(29, 79, 145, 0.16);
}

.sdsmartchat-consent {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  color: var(--sdsc-blue);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.sdsmartchat-consent input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--sdsc-blue);
}

.sdsmartchat-root .sdsmartchat-submit,
.sdsmartchat-root .sdsmartchat-submit:hover,
.sdsmartchat-root .sdsmartchat-submit:focus,
.sdsmartchat-root .sdsmartchat-submit:focus-visible,
.sdsmartchat-root .sdsmartchat-submit:active {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--sdsc-japan-red);
  border-radius: 999px;
  background: var(--sdsc-japan-red);
  color: var(--sdsc-white);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.sdsmartchat-root .sdsmartchat-submit:focus-visible {
  box-shadow: 0 0 0 4px rgba(188, 0, 45, 0.22);
}

.sdsmartchat-root .sdsmartchat-submit:disabled {
  cursor: progress;
  opacity: 0.76;
  background: var(--sdsc-japan-red);
  color: var(--sdsc-white);
}

.sdsmartchat-hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.sdsmartchat-panel__footer {
  flex: 0 0 auto;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--sdsc-gray-100);
  background: var(--sdsc-white);
  color: var(--sdsc-blue);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.4;
}

@media (min-width: 480px) {
  .sdsmartchat-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 768px) {
  .sdsmartchat-root {
    --sdsc-right: 18px;
    --sdsc-bottom: 94px;
  }

  .sdsmartchat-toggle__label {
    display: inline;
  }

  .sdsmartchat-panel {
    right: var(--sdsc-right);
    left: auto;
    bottom: calc(var(--sdsc-bottom) + 70px);
    width: min(420px, calc(100vw - 36px));
    max-width: 420px;
    height: min(640px, calc(100dvh - var(--sdsc-bottom) - 88px));
    min-height: min(520px, calc(100dvh - var(--sdsc-bottom) - 88px));
  }

  .sdsmartchat-messages {
    padding: 16px;
  }

  .sdsmartchat-bubble {
    max-width: 88%;
  }
}

@media (max-width: 380px) {
  .sdsmartchat-panel {
    right: 8px;
    left: 8px;
    max-width: calc(100vw - 16px);
  }

  .sdsmartchat-messages {
    padding: 12px;
  }

  .sdsmartchat-panel__header {
    grid-template-columns: 36px minmax(0, 1fr) 46px;
    padding: 12px;
  }

  .sdsmartchat-panel__brand {
    width: 36px;
    height: 36px;
  }

  .sdsmartchat-panel__close {
    width: 46px;
    height: 46px;
  }

  .sdsmartchat-panel__close svg {
    width: 30px;
    height: 30px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .sdsmartchat-toggle,
  .sdsmartchat-chip,
  .sdsmartchat-panel__close,
  .sdsmartchat-submit,
  .sdsmartchat-tooltip {
    transition:
      background-color 160ms ease,
      border-color 160ms ease,
      color 160ms ease,
      box-shadow 160ms ease,
      opacity 160ms ease,
      transform 160ms ease;
  }
}
