:root {
  color: #20262d;
  background: #ffffff;
  --brand-blue: #3b8bea;
  --brand-blue-dark: #2c6cb8;
  --brand-blue-soft: #edf5ff;
  font-family: "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #ffffff;
}

button,
input,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
textarea:disabled {
  cursor: wait;
  opacity: 0.58;
}

.support-shell {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  width: 100%;
  max-width: 100%;
  height: 100dvh;
  min-width: 0;
  min-height: 420px;
  overflow-x: clip;
  background: #ffffff;
}

.support-header,
.conversation,
.messages,
.action-panel,
.support-footer,
.composer-tools,
.composer {
  min-width: 0;
  max-width: 100%;
}

.support-header {
  grid-row: 1;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 10px;
  min-height: 66px;
  padding: 10px 12px;
  color: #ffffff;
  background: #27313a;
  border-bottom: 3px solid var(--brand-blue);
}

.brand-mark {
  display: block;
  width: 32px;
  height: 38px;
  overflow: hidden;
}

.brand-mark img {
  display: block;
  width: auto;
  max-width: none;
  height: 38px;
}

.brand-copy {
  min-width: 0;
}

.brand-copy strong,
.brand-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy strong {
  font-size: 15px;
  line-height: 1.3;
}

.brand-copy span {
  margin-top: 2px;
  color: #cbd8df;
  font-size: 12px;
  line-height: 1.25;
}

.icon-button,
.send-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 6px;
}

.icon-button {
  color: #ffffff;
  background: transparent;
}

.icon-button:hover,
.icon-button:focus-visible {
  background: #3a4650;
}

.icon-button svg,
.send-button svg,
.option-icon svg,
.inline-button svg,
.composer-tool svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.network-banner {
  grid-row: 2;
  padding: 7px 12px;
  color: #7a281f;
  background: #fff0ed;
  border-bottom: 1px solid #f2c6be;
  font-size: 12px;
  line-height: 1.35;
}

.network-banner.success {
  color: #205c37;
  background: #eaf7ef;
  border-color: #b8dfc6;
}

.conversation {
  grid-row: 3;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #f3f5f6;
  scrollbar-color: #b6c1c7 transparent;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 100%;
  padding: 14px 12px 12px;
}

.message {
  align-self: flex-start;
  min-width: 0;
  max-width: min(84%, 310px);
}

.message.client {
  align-self: flex-end;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 5px 3px;
  color: #6f7981;
  font-size: 11px;
}

.message.client .message-meta {
  justify-content: flex-end;
}

.message-bubble {
  max-width: 100%;
  padding: 9px 11px;
  color: #20262d;
  background: #ffffff;
  border: 1px solid #dfe4e7;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(31, 42, 49, 0.06);
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.message.client .message-bubble {
  color: #ffffff;
  background: var(--brand-blue-dark);
  border-color: var(--brand-blue-dark);
}

.message.operator .message-bubble {
  border-left: 3px solid #f4c84a;
}

.message-sources {
  margin-top: 6px;
  padding-top: 6px;
  color: #58636b;
  border-top: 1px solid #e2e7e9;
  font-size: 11px;
  white-space: normal;
}

.message-sources > strong {
  display: block;
  color: #3f4b53;
}

.message-sources ol {
  display: grid;
  gap: 5px;
  margin: 5px 0 0;
  padding: 0;
  list-style: none;
}

.message-sources li {
  display: grid;
  grid-template-columns: 27px minmax(0, 1fr);
  gap: 5px;
  align-items: start;
}

.source-number {
  color: var(--brand-blue-dark);
  font-weight: 700;
}

.typing {
  display: flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  margin: 0 12px 12px;
  padding: 8px 10px;
  color: #606a71;
  background: #ffffff;
  border: 1px solid #dfe4e7;
  border-radius: 8px;
  font-size: 11px;
}

.typing[hidden] {
  display: none;
}

.typing span {
  width: 5px;
  height: 5px;
  background: var(--brand-blue);
  border-radius: 50%;
  animation: typing-pulse 1.2s infinite ease-in-out;
}

.typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing span:nth-child(3) {
  animation-delay: 0.3s;
}

.typing b {
  margin-left: 4px;
  font-weight: 500;
}

@keyframes typing-pulse {
  0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}

.action-panel {
  grid-row: 4;
  padding: 0 12px 12px;
  background: #f3f5f6;
}

.action-panel:empty {
  display: none;
}

.action-card {
  padding: 11px;
  background: #ffffff;
  border: 1px solid #d9e0e3;
  border-radius: 8px;
}

.action-card h2 {
  margin: 0 0 9px;
  color: #27313a;
  font-size: 14px;
  line-height: 1.35;
}

.action-card p {
  margin: 0 0 10px;
  color: #5f6970;
  font-size: 12px;
  line-height: 1.4;
}

.option-list {
  display: grid;
  gap: 7px;
}

.option-button {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 48px;
  padding: 7px 9px;
  color: #27313a;
  text-align: left;
  background: #ffffff;
  border: 1px solid #d7dfe3;
  border-radius: 6px;
}

.option-button:hover,
.option-button:focus-visible {
  border-color: var(--brand-blue);
  background: var(--brand-blue-soft);
}

.option-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--brand-blue-dark);
  background: var(--brand-blue-soft);
  border-radius: 6px;
}

.option-button.callback .option-icon {
  color: #725914;
  background: #fff5cf;
}

.option-button.specialist .option-icon {
  color: #3e5f48;
  background: #eaf5ed;
}

.option-copy {
  min-width: 0;
}

.option-copy strong,
.option-copy span {
  display: block;
}

.option-copy strong {
  font-size: 13px;
  line-height: 1.3;
}

.option-copy span {
  margin-top: 2px;
  color: #687279;
  font-size: 11px;
  line-height: 1.3;
}

.option-arrow {
  color: #8a959b;
  font-size: 20px;
}

.flow-form {
  display: grid;
  gap: 9px;
}

.field {
  display: grid;
  gap: 4px;
}

.field span {
  color: #465159;
  font-size: 11px;
  font-weight: 600;
}

.field input,
.field textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 9px;
  color: #20262d;
  background: #ffffff;
  border: 1px solid #cbd4d8;
  border-radius: 6px;
  outline: none;
}

.field textarea {
  min-height: 64px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.composer textarea:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(59, 139, 234, 0.16);
}

.consent {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 7px;
  color: #59636a;
  font-size: 11px;
  line-height: 1.35;
}

.consent input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--brand-blue);
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.inline-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 11px;
  color: #27313a;
  background: #ffffff;
  border: 1px solid #cbd4d8;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.inline-button:hover,
.inline-button:focus-visible {
  background: #f3f6f7;
}

.inline-button.primary {
  color: #ffffff;
  background: var(--brand-blue);
  border-color: var(--brand-blue);
}

.inline-button.primary:hover,
.inline-button.primary:focus-visible {
  background: var(--brand-blue-dark);
}

.inline-button.danger {
  color: #8a3025;
  border-color: #e6b8b2;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 9px;
  color: #455159;
  background: #ffffff;
  border: 1px solid #d9e0e3;
  border-radius: 6px;
  font-size: 12px;
  min-width: 0;
}

.status-row .inline-button {
  flex: 0 1 auto;
}

.status-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #4ca66a;
  border-radius: 50%;
}

.status-dot.waiting {
  background: #e1a928;
}

.support-footer {
  grid-row: 5;
  min-height: 0;
  background: #ffffff;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  align-items: end;
  gap: 8px;
  padding: 9px 10px max(9px, env(safe-area-inset-bottom));
  background: #ffffff;
  border-top: 1px solid #dfe4e7;
}

.composer[hidden] {
  display: none;
}

.composer-tools {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 7px;
  padding: 8px 10px;
  background: #ffffff;
  border-top: 1px solid #dfe4e7;
}

.composer-tools[hidden],
.composer-tool[hidden] {
  display: none;
}

.composer-tools:not([hidden]) + .composer {
  padding-top: 0;
  border-top: 0;
}

.composer-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  min-height: 34px;
  padding: 6px 8px;
  color: #465159;
  background: #ffffff;
  border: 1px solid #cbd4d8;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
}

.composer-tool:hover,
.composer-tool:focus-visible {
  background: #f3f6f7;
  border-color: #98a7ae;
}

.composer-tool.handoff {
  color: #8a3025;
  border-color: #e6b8b2;
}

.composer-tool svg {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
}

.composer-tool span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.composer textarea {
  width: 100%;
  min-width: 0;
  max-height: 104px;
  min-height: 40px;
  padding: 9px 10px;
  resize: none;
  color: #20262d;
  background: #f7f8f9;
  border: 1px solid #cbd4d8;
  border-radius: 6px;
  outline: none;
  line-height: 1.4;
}

.send-button {
  width: 40px;
  height: 40px;
  color: #ffffff;
  background: var(--brand-blue);
}

.send-button:hover,
.send-button:focus-visible {
  background: var(--brand-blue-dark);
}

.send-button svg {
  width: 19px;
  height: 19px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 360px) {
  .support-header {
    min-height: 60px;
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    padding: 8px 10px;
  }

  .brand-mark {
    width: 29px;
    height: 34px;
  }

  .brand-mark img {
    height: 34px;
  }

  .icon-button {
    width: 34px;
    height: 34px;
  }

  .messages,
  .action-panel {
    padding-left: 9px;
    padding-right: 9px;
  }

  .message {
    max-width: 90%;
  }

  .status-row {
    align-items: stretch;
    flex-direction: column;
  }

  .status-row .inline-button {
    width: 100%;
  }

}

@media (prefers-reduced-motion: reduce) {
  .typing span {
    animation: none;
  }
}
