.ia-agent-dialog {
  width: min(820px, calc(100vw - 28px));
  max-height: min(88vh, 900px);
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: #f6f8fa;
  border: 0;
  border-radius: 14px;
  box-shadow: 0 28px 80px rgba(6, 25, 45, 0.35);
}

.ia-agent-dialog::backdrop {
  background: rgba(6, 25, 45, 0.55);
  backdrop-filter: blur(2px);
}

.ia-dialog-head {
  display: grid;
  grid-template-columns: 62px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 19px 22px;
  color: white;
  background: linear-gradient(135deg, var(--blue), #1f5689);
}

.ia-dialog-head img {
  width: 62px;
  height: 62px;
  object-fit: cover;
  background: white;
  border: 3px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
}

.ia-dialog-head h3,
.ia-dialog-head p {
  margin: 0;
}

.ia-dialog-head h3 {
  font: 500 27px var(--font-display, Georgia, serif);
}

.ia-dialog-head small,
.ia-dialog-head p {
  color: rgba(255, 255, 255, 0.75);
}

.ia-dialog-head button {
  width: 38px;
  height: 38px;
  color: white;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  font-size: 25px;
}

.ia-dialog-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 18px 0;
  overflow-x: auto;
  background: white;
  border-bottom: 1px solid var(--line);
}

.ia-dialog-tabs button {
  flex: 0 0 auto;
  padding: 11px 14px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  font-size: 12px;
  font-weight: 700;
}

.ia-dialog-tabs button:hover,
.ia-dialog-tabs button:focus-visible,
.ia-dialog-tabs button.active {
  color: var(--blue);
  border-bottom-color: var(--gold);
  outline: none;
}

.ia-dialog-content {
  max-height: calc(88vh - 158px);
  padding: 22px;
  overflow-y: auto;
}

.ia-conversation {
  display: grid;
  gap: 20px;
  padding: 0;
}

.ia-about-intro,
.ia-chat-intro {
  margin-bottom: 18px;
  padding: 18px;
  background: white;
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: 10px;
}

.ia-about-intro small,
.ia-chat-intro small {
  color: var(--gold-strong, #8d682c);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ia-about-intro h4,
.ia-chat-intro h4 {
  margin: 5px 0 6px;
  color: var(--blue);
  font: 500 22px var(--font-display, Georgia, serif);
}

.ia-about-intro p,
.ia-chat-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.ia-dialog-content .agent-job-sheet {
  background: white;
}

.ia-question-form {
  display: grid;
  gap: 14px;
  padding: 18px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.ia-question-form label:first-child {
  display: none;
}

.ia-question-form label,
.ia-question-form input,
.ia-question-form textarea {
  width: 100%;
}

.ia-question-form label {
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.ia-question-form input,
.ia-question-form textarea {
  margin-top: 5px;
}

.ia-question-form button {
  justify-self: end;
}

.ia-dialog-empty {
  margin: 0;
  padding: 36px 24px;
  color: var(--muted);
  text-align: center;
  background: white;
  border: 1px dashed var(--line);
  border-radius: 10px;
}

.ia-conversation-item {
  display: grid;
  gap: 10px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.ia-conversation-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.ia-conversation-item > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.ia-conversation-item > header strong,
.ia-conversation-item > header small {
  display: block;
}

.ia-conversation-item > header small {
  margin-top: 3px;
  color: var(--muted);
}

.ia-conversation-item > header > span {
  padding: 5px 8px;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 14px;
  font-size: 10px;
  font-weight: 700;
}

.ia-message {
  max-width: 88%;
  padding: 12px 14px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 4px 14px 14px;
  box-shadow: 0 3px 10px rgba(24, 43, 67, 0.04);
}

.ia-message p {
  margin: 4px 0 0;
  line-height: 1.5;
  white-space: pre-wrap;
}

.ia-message small {
  color: var(--muted);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ia-message.recommendation {
  border-left: 3px solid var(--gold);
}

.ia-message.supervisor {
  justify-self: end;
  color: #0e3154;
  background: #eaf2fa;
  border-color: #c9dcec;
  border-radius: 14px 4px 14px 14px;
}

.ia-message .compact {
  margin-top: 10px;
}

.ia-delivery-highlight {
  outline: 4px solid rgba(178, 138, 75, 0.42);
  outline-offset: 4px;
  animation: ia-highlight 0.8s ease 2;
}

@keyframes ia-highlight {
  50% {
    outline-color: rgba(178, 138, 75, 0.08);
  }
}

@media (max-width: 720px) {
  .ia-dialog-head {
    grid-template-columns: 50px 1fr auto;
  }

  .ia-dialog-head img {
    width: 50px;
    height: 50px;
  }

  .ia-message {
    max-width: 96%;
  }

  .ia-dialog-content {
    padding: 14px;
  }

  .ia-dialog-tabs {
    display: grid;
    grid-template-columns: 1fr 1.2fr 0.7fr;
    padding-left: 8px;
  }

  .ia-dialog-tabs button {
    padding: 9px 4px;
    font-size: 10px;
    line-height: 1.25;
    white-space: normal;
  }
}
