/* Refresh visual do chat da Flo, sem alterar a lógica clínica do SedaFlow. */
.flo-chat-refresh,
.flo-chat-shell {
  grid-template-rows: auto minmax(0, 1fr);
  border-radius: 30px;
  background: radial-gradient(circle at 88% 8%, rgba(85, 157, 245, 0.16), transparent 30%), rgba(255, 255, 255, 0.98);
  box-shadow: 0 26px 52px rgba(28, 62, 122, 0.18);
}

.flo-chat-refresh .flo-chat-header,
.flo-chat-shell .flo-chat-header {
  padding: 14px;
  gap: 12px;
  background: rgba(244, 249, 255, 0.9);
  backdrop-filter: blur(18px);
}

.flo-chat-tabs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border-radius: 999px;
  border: 1px solid rgba(184, 207, 244, 0.72);
  background: rgba(226, 238, 255, 0.72);
}

.flo-tab-input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.flo-tab-pill {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border-radius: 999px;
  color: #5675a7;
  font-weight: 800;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.flo-tab-input:checked + .flo-tab-pill {
  background: #ffffff;
  color: #173b70;
  box-shadow: 0 10px 20px rgba(36, 78, 145, 0.12);
}

.flo-chat-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.flo-header-icon-button {
  inline-size: 38px;
  block-size: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  border: 1px solid rgba(184, 207, 244, 0.8);
  background: rgba(255, 255, 255, 0.86);
  color: #2858a6;
  font: inherit;
  font-weight: 900;
  box-shadow: 0 10px 18px rgba(36, 78, 145, 0.08);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
}

.flo-header-icon-button:hover,
.flo-header-icon-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(84, 135, 230, 0.88);
  box-shadow: 0 14px 24px rgba(36, 78, 145, 0.13);
}

.flo-header-icon-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.flo-chat-panel {
  grid-column: 1;
  grid-row: 2;
  min-height: 0;
}

.flo-chat-panel-chat {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
}

.flo-chat-panel-history {
  display: none;
  padding: 18px;
  overflow-y: auto;
  background: radial-gradient(circle at top right, rgba(107, 175, 234, 0.13), transparent 34%), linear-gradient(180deg, rgba(246, 250, 255, 0.96), rgba(238, 245, 255, 0.9));
}

.flo-chat-shell:has(.flo-tab-input[id$="-history"]:checked) .flo-chat-panel-chat {
  display: none;
}

.flo-chat-shell:has(.flo-tab-input[id$="-history"]:checked) .flo-chat-panel-history {
  display: block;
}

.flo-chat-refresh .flo-chat-thread,
.flo-chat-shell .flo-chat-thread {
  gap: 16px;
  padding: 20px;
  background: radial-gradient(circle at top right, rgba(107, 175, 234, 0.13), transparent 34%), linear-gradient(180deg, rgba(249, 252, 255, 0.98), rgba(239, 246, 255, 0.92));
}

.flo-chat-message {
  animation: floMessageIn 180ms ease both;
}

.flo-chat-message.assistant {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  justify-content: start;
}

.flo-chat-message.assistant::before {
  content: "";
  inline-size: 38px;
  block-size: 38px;
  border-radius: 14px;
  border: 1px solid rgba(173, 199, 242, 0.75);
  background: url("/assets/flo-icon.svg") center / 24px 24px no-repeat, linear-gradient(180deg, #eef6ff, #dfeeff);
  box-shadow: 0 10px 18px rgba(36, 78, 145, 0.1);
}

.flo-chat-message.assistant .flo-chat-bubble::before {
  content: "Flo";
  display: block;
  margin-bottom: 4px;
  color: #1b3f74;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

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

.flo-chat-message.user .flo-chat-bubble {
  max-width: min(82%, 560px);
  border-radius: 22px 22px 8px 22px;
  background: linear-gradient(180deg, rgba(231, 240, 255, 0.98), rgba(218, 232, 255, 0.98));
}

.flo-chat-message.assistant .flo-chat-bubble {
  max-width: min(100%, 640px);
  border-radius: 8px 22px 22px 22px;
  background: rgba(255, 255, 255, 0.94);
}

.flo-quick-suggestions {
  display: grid;
  gap: 10px;
  max-width: min(100%, 690px);
  margin-left: 48px;
}

.flo-panel-subtitle {
  margin: 0;
  color: #5472a4;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.flo-quick-suggestion-list,
.flo-history-list {
  display: grid;
  gap: 9px;
}

.flo-quick-suggestion {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 9px 12px;
  border-radius: 17px;
  border: 1px solid rgba(190, 211, 244, 0.82);
  background: rgba(255, 255, 255, 0.82);
  color: #1c4278;
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.flo-quick-suggestion span {
  inline-size: 24px;
  block-size: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(229, 240, 255, 0.9);
  color: #2e62be;
  font-size: 1.15rem;
  font-family: Montserrat, sans-serif;
  font-weight: 900;
}

.flo-quick-suggestion strong {
  font-size: 0.9rem;
  line-height: 1.25;
}

.flo-quick-suggestion:hover,
.flo-quick-suggestion:focus-visible {
  transform: translateY(-1px);
  background: #ffffff;
  border-color: rgba(86, 139, 232, 0.82);
  box-shadow: 0 12px 22px rgba(36, 78, 145, 0.1);
}

.flo-chat-refresh .flo-chat-composer,
.flo-chat-shell .flo-chat-composer {
  padding: 12px 14px 14px;
  gap: 9px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(18px);
}

.flo-chat-refresh .flo-chat-textarea,
.flo-chat-shell .flo-chat-textarea {
  min-height: 56px;
  max-height: 132px;
  border-radius: 22px;
  resize: none;
}

.flo-safety-note {
  margin: 0;
  color: #7489ad;
  font-size: 0.76rem;
  line-height: 1.3;
  text-align: center;
}

.flo-history-empty,
.flo-history-item {
  border-radius: 22px;
  border: 1px solid rgba(190, 211, 244, 0.82);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 12px 22px rgba(36, 78, 145, 0.08);
}

.flo-history-empty {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 280px;
  padding: 26px;
  text-align: center;
  color: #5675a7;
}

.flo-history-empty strong {
  color: #1b3f74;
}

.flo-history-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
}

.flo-history-icon {
  inline-size: 42px;
  block-size: 42px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: rgba(229, 240, 255, 0.96);
  color: #2f63bf;
}

.empty-patient-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

@keyframes floMessageIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 760px), (pointer: coarse) {
  .flo-chat-shell {
    border-radius: 24px;
    min-height: min(620px, calc(100vh - 32px));
  }

  .flo-chat-header {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .flo-chat-header-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .flo-chat-thread {
    padding: 14px;
  }

  .flo-chat-message.assistant {
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 8px;
  }

  .flo-chat-message.assistant::before {
    inline-size: 32px;
    block-size: 32px;
    border-radius: 12px;
    background-size: 20px 20px;
  }

  .flo-quick-suggestions {
    margin-left: 40px;
  }

  .empty-patient-state {
    align-items: stretch;
    flex-direction: column;
  }
}
