/* Widget assistente "Saldo" (draghetto brucia-debiti). Stile coerente con resolve.css:
   lime brand #a4c639, verde scuro #1e3a2f, bottoni radius 30px. Nessuno stile inline (CSP). */

.rs-bot-launcher {
  position: fixed;
  right: 22px;
  bottom: 18px;
  width: 66px;
  height: 66px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rs-bot-launcher:focus-visible { outline: 3px solid #1e3a2f; outline-offset: 3px; border-radius: 12px; }

.rs-bot-egg {
  display: block;
  width: 60px;
  height: 60px;
  filter: drop-shadow(0 4px 2px rgba(30, 58, 47, 0.28));
  transition: filter 0.2s;
}
.rs-bot-launcher:hover .rs-bot-egg { filter: drop-shadow(0 6px 3px rgba(30, 58, 47, 0.38)) brightness(1.05); }
.rs-bot-egg svg {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.rs-bot-mascot { display: block; }
.rs-bot-mascot svg {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.rs-bot-mascot-hd {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  padding: 3px;
  background: #eef6d0;
  border-radius: 50%;
}

.rs-bot-panel {
  position: fixed;
  right: 20px;
  bottom: 96px;
  width: 328px;
  max-width: calc(100vw - 40px);
  max-height: 72vh;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid #e6ecd6;
  border-radius: 16px;
  box-shadow: 0 14px 44px rgba(30, 58, 47, 0.22);
}
.rs-bot-panel[hidden] { display: none; }

.rs-bot-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #1e3a2f;
  color: #ffffff;
}
.rs-bot-title { flex: 1; font-size: 16px; font-weight: 700; }
.rs-bot-close {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #ffffff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s;
}
.rs-bot-close:hover { background: rgba(255, 255, 255, 0.16); }
.rs-bot-close:focus-visible { outline: 2px solid #a4c639; outline-offset: 1px; }

.rs-bot-body {
  flex: 1;
  min-height: 168px;
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f7faef;
}

.rs-bot-msg {
  align-self: flex-start;
  max-width: 100%;
  padding: 10px 12px;
  background: #ffffff;
  border: 1px solid #e6ecd6;
  border-radius: 12px;
  border-top-left-radius: 4px;
  font-size: 14px;
  line-height: 1.5;
  color: #1e1e1e;
}

.rs-bot-options { display: flex; flex-direction: column; gap: 8px; }

.rs-bot-opt {
  min-height: 44px;
  padding: 10px 12px;
  text-align: left;
  border: 2px solid #a4c639;
  border-radius: 12px;
  background: #ffffff;
  color: #3d6210;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.rs-bot-opt:hover { background: #a4c639; color: #ffffff; }
.rs-bot-opt:focus-visible { outline: 3px solid #1e3a2f; outline-offset: 1px; }

.rs-bot-cta {
  display: block;
  min-height: 44px;
  padding: 11px 14px;
  text-align: center;
  text-decoration: none;
  border: 2px solid #a4c639;
  border-radius: 30px;
  background: #ffffff;
  color: #a4c639;
  font-size: 14px;
  font-weight: 700;
  transition: background 0.2s, color 0.2s;
}
.rs-bot-cta.primary { background: #a4c639; color: #ffffff; }
.rs-bot-cta:hover { background: #a4c639; color: #ffffff; }
.rs-bot-cta.primary:hover { background: #8faf2f; border-color: #8faf2f; }
.rs-bot-cta:focus-visible { outline: 3px solid #1e3a2f; outline-offset: 2px; }

.rs-bot-restart {
  align-self: flex-start;
  min-height: 32px;
  padding: 6px 2px;
  border: 0;
  background: transparent;
  color: #6a6a6a;
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
}

.rs-bot-typing {
  align-self: flex-start;
  display: inline-flex;
  gap: 4px;
  padding: 12px 12px;
  background: #ffffff;
  border: 1px solid #e6ecd6;
  border-radius: 12px;
}
.rs-bot-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a4c639;
  animation: rsbotblink 1s infinite;
}
.rs-bot-typing span:nth-child(2) { animation-delay: 0.2s; }
.rs-bot-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes rsbotblink { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }

@media (max-width: 480px) {
  .rs-bot-launcher { right: 14px; bottom: 14px; }
  .rs-bot-panel { right: 10px; left: 10px; width: auto; max-width: none; bottom: 86px; }
}

@media (prefers-reduced-motion: reduce) {
  .rs-bot-typing span { animation: none; opacity: 0.7; }
  .rs-bot-launcher { transition: none; }
}
