.card {
  background: var(--card);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 18px;
  padding: 1.25rem;
  box-shadow: 0 14px 40px rgba(20, 18, 10, 0.1);
}

.hero {
  margin-bottom: 1rem;
}

h1 {
  margin: 0 0 0.45rem;
  font-size: clamp(1.6rem, 3.2vw, 2.4rem);
  line-height: 1.12;
}

h2 {
  margin: 0;
  font-size: clamp(1.25rem, 2.4vw, 1.6rem);
}

.hero>p,
.muted {
  margin: 0;
  color: var(--muted);
}

.tag {
  display: inline-block;
  margin-top: 0.9rem;
  margin-bottom: 1rem;
  font-size: 0.88rem;
  letter-spacing: 0.02em;
  color: var(--accent);
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 999px;
  padding: 0.22rem 0.7rem;
  background: rgba(15, 118, 110, 0.08);
}

.chat-composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
  align-items: center;
}

.chat-composer input {
  width: 100%;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0.85rem 1rem;
  font-size: 0.98rem;
}

.chat-composer button {
  border-radius: 999px;
  border: 1px solid rgba(15, 118, 110, 0.38);
  background: #eef7f6;
  color: var(--ink);
  padding: 0.8rem 1rem;
  font-weight: 600;
  cursor: pointer;
}

.db-resume {
  margin-bottom: 1rem;
}

.db-resume .muted {
  margin-top: 0.35rem;
}

.db-grid {
  margin-top: 0.85rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.db-item {
  background: #fffcf7;
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: 14px;
  padding: 0.85rem;
}

.db-item h3 {
  margin: 0 0 0.45rem;
}

.db-item p {
  margin: 0.25rem 0;
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 760px) {
  .chat-composer {
    grid-template-columns: 1fr;
  }

  .chat-composer button {
    width: 100%;
  }
}

.sticky-bottom-chat {
  position: sticky;
  bottom: 1rem;
  z-index: 10
}

.chevron.rotated {
  transform: rotate(180deg)
}

#stats-loading {
  display: none;
  width: .9rem;
  height: .9rem
}

.htmx-request #stats-loading,
#stats-loading.htmx-request {
  display: inline-block
}

.stats-skeleton-card {
  background-color: #d2d7dd;
  opacity: .8;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: stats-pulse 1.1s ease-in-out infinite
}

.stats-skeleton-spinner {
  width: 1.4rem;
  height: 1.4rem;
  border: 3px solid rgba(15, 118, 110, .22);
  border-top-color: rgba(15, 118, 110, .9);
  border-radius: 50%;
  animation: stats-spin .9s linear infinite
}

.stats-skeleton-spinner-lg {
  width: 2.1rem;
  height: 2.1rem;
  border-width: 4px
}

@keyframes stats-pulse {
  0% {
    opacity: .55
  }

  50% {
    opacity: .9
  }

  100% {
    opacity: .55
  }
}

@keyframes stats-spin {
  to {
    transform: rotate(360deg)
  }
}

@keyframes heartbeat {
  0% {
    transform: scale(1);
    opacity: 1
  }

  30% {
    transform: scale(1.45);
    opacity: .85
  }

  60% {
    transform: scale(.9);
    opacity: 1
  }

  80% {
    transform: scale(1.2);
    opacity: .9
  }

  100% {
    transform: scale(1);
    opacity: 1
  }
}

.bubble-user {
  background: #0f766e;
  color: #fff;
  border-radius: 1.2rem 1.2rem .25rem 1.2rem
}

.bubble-assistant {
  background: #fff;
  border-radius: 1.2rem 1.2rem 1.2rem .25rem
}

.result-card {
  transition: box-shadow .2s
}

.result-card:hover {
  box-shadow: 0 4px 16px rgba(15, 118, 110, .12) !important
}

.step-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--brand-accent, #0f766e);
  display: inline-block;
  flex-shrink: 0;
  animation: heartbeat 1s ease-in-out infinite
}

.step-dot.done {
  animation: none !important;
  background: #22c55e
}

.step-mini-progress {
  display: inline-block;
  position: relative;
  width: 260px;
  max-width: 52vw;
  height: 6px;
  border-radius: 999px;
  background: rgba(15, 118, 110, .16);
  margin-left: .45rem;
  overflow: hidden;
  vertical-align: middle
}

.step-mini-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0f766e, #2bb2a8);
  transition: width .35s ease
}

.home-title-row {
  line-height: 1.05
}

.home-version-badge {
  line-height: 1;
  padding: .4rem .7rem
}


/* Container holding the input text and the send button */
.chat-input-container {
  position: relative;
  /* Crucial anchor for absolute child alignment */
}

/* Floating autocomplete menu for power users commands */
.command-autocomplete-menu {
  position: absolute;
  bottom: 100%;
  /* Opens upwards over the input bar */
  left: 0;
  right: 0;
  background-color: #ffffff;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.12);
  max-height: 220px;
  overflow-y: auto;
  z-index: 1060;
  /* Higher priority layer stack context */
  margin-bottom: 10px;
  /* Elegant gap separator above the text field */
}

/* Individual list item template rows */
.autocomplete-item {
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background-color 0.15s ease;
}

.autocomplete-item:hover,
.autocomplete-item.active {
  background-color: #f8f9fa;
}

.autocomplete-item code {
  font-size: 0.85rem;
}

.autocomplete-item .item-desc {
  font-size: 0.8rem;
  color: #6c757d;
}

/* Ajust per a les estadístiques dins del xat */
.bubble-assistant .stats-chat-wrapper {
  max-width: 100%;
}

.bubble-assistant .stats-chat-wrapper .card {
  /* Reduïm una mica el padding de les targetes perquè encaixin millor */
  padding: 0.5rem;
}