/* ==========================================================================
   NEW ENERGY — herramientas.css
   Estilos de las herramientas de IA: wizard solar, comparador, sección
   "Herramientas" de la portada y widget de chat. Depende de styles.css.
   ========================================================================== */

/* ---------- Sección Herramientas (portada) ---------- */
.herr__grid { display: grid; grid-template-columns: 1fr; gap: 18px; }
@media (min-width: 820px) { .herr__grid { grid-template-columns: repeat(2, 1fr); gap: 22px; } }
.herr {
  position: relative; display: flex; flex-direction: column; gap: 14px; min-height: 300px;
  padding: clamp(26px, 3.4vw, 40px); border-radius: var(--r);
  background: rgba(29, 29, 27, .82); border: 1px solid var(--line); overflow: hidden;
  transition: transform .4s var(--ease), border-color .35s, box-shadow .4s;
}
.herr::after {
  content: ""; position: absolute; width: 320px; height: 320px; border-radius: 50%; right: -140px; top: -140px;
  background: radial-gradient(circle, rgba(187, 209, 81, .22), transparent 65%); opacity: .5; transition: opacity .4s;
}
.herr:hover { transform: translateY(-4px); border-color: rgba(187, 209, 81, .4); box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .8); }
.herr:hover::after { opacity: 1; }
.herr__ico { width: 54px; height: 54px; color: var(--lima); position: relative; }
.herr__ico svg { width: 100%; height: 100%; }
.herr h3 { font-size: clamp(24px, 2.4vw, 30px); position: relative; }
.herr p { color: var(--text-2); font-size: 16px; margin: 0; position: relative; flex: 1; }
.herr__go { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-d); color: var(--lima); font-size: 15px; letter-spacing: .02em; position: relative; }
.herr__go::after { content: "→"; transition: transform .3s var(--ease); }
.herr:hover .herr__go::after { transform: translateX(5px); }
.herr__tag { position: absolute; top: 20px; right: 20px; font-family: var(--font-d); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: #141412; background: var(--grad); padding: 5px 10px; border-radius: 999px; }

/* ---------- Página de herramienta: cabecera y wizard ---------- */
.tool { padding: calc(72px + clamp(36px, 6vw, 70px)) 0 clamp(70px, 9vw, 120px); }
.tool__head { max-width: 820px; margin: 0 auto clamp(30px, 4vw, 48px); text-align: center; }
.tool__head .eyebrow { justify-content: center; width: 100%; }
.tool__head .lead { margin: 16px auto 0; max-width: 640px; }

.wiz { max-width: 980px; margin: 0 auto; }
.wiz__bar { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: clamp(22px, 3vw, 34px); }
.wiz__track { position: relative; height: 4px; border-radius: 99px; background: rgba(244, 242, 236, .08); overflow: hidden; }
.wiz__track i { position: absolute; inset: 0 auto 0 0; width: var(--p, 20%); background: var(--grad); border-radius: inherit; transition: width .5s var(--ease); }
.wiz__steps { display: flex; justify-content: space-between; gap: 6px; list-style: none; margin: 0; padding: 0; font-family: var(--font-d); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.wiz__steps li { display: flex; align-items: center; gap: 7px; flex: 1; min-width: 0; }
.wiz__steps li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wiz__steps li::before { content: attr(data-n); display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line-2); font-size: 11px; flex: none; transition: background .3s, color .3s, border-color .3s; }
.wiz__steps li.is-on { color: var(--text); }
.wiz__steps li.is-on::before { background: var(--lima); color: #141412; border-color: var(--lima); }
.wiz__steps li.is-done::before { content: "✓"; background: rgba(187, 209, 81, .18); color: var(--lima); border-color: transparent; }
@media (max-width: 640px) { .wiz__steps li { flex: 0 0 auto; } .wiz__steps li span { display: none; } .wiz__steps li.is-on span { display: inline; } }

.panel {
  display: grid; gap: 18px; padding: clamp(22px, 3.2vw, 38px); border-radius: var(--r);
  background: rgba(29, 29, 27, .86); border: 1px solid var(--line);
  animation: panel-in .5s var(--ease) both;
}
.panel[hidden] { display: none; }
@keyframes panel-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .panel { animation: none; } .wiz__track i { transition: none; } }
.panel__title { font-size: clamp(24px, 2.8vw, 34px); font-weight: 400; letter-spacing: -.015em; }
.panel__sub { color: var(--text-2); margin: -6px 0 0; font-size: 16px; }
.panel__acts { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-top: 6px; }
.panel__acts .btn--ghost { order: -1; }
.btn--ghost.btn--back::before { content: "←"; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn--spin .btn__txt { display: inline-flex; align-items: center; gap: 10px; }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(20, 20, 18, .25); border-top-color: #141412; animation: spin .8s linear infinite; }
.btn--ghost .spin { border-color: rgba(244, 242, 236, .2); border-top-color: var(--lima); }
@keyframes spin { to { transform: rotate(360deg); } }
.msg { margin: 0; font-size: 14.5px; color: var(--text-2); min-height: 1.4em; }
.msg.is-error { color: #e8a090; }
.msg.is-ok { color: var(--lima); }
.privacidad { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--muted); line-height: 1.5; margin: 0; }
.privacidad svg { flex: none; width: 18px; height: 18px; color: var(--verde); margin-top: 2px; }
.privacidad a { text-decoration: underline; text-underline-offset: 3px; color: var(--text-2); }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--lima); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* Dropzone */
.drop {
  position: relative; display: grid; place-items: center; gap: 8px; text-align: center; padding: clamp(30px, 5vw, 54px) 20px;
  border: 1.5px dashed var(--line-2); border-radius: var(--r-sm); background: rgba(20, 20, 18, .5); cursor: pointer;
  transition: border-color .25s, background .25s, transform .25s var(--ease);
}
.drop:hover, .drop.is-over, .drop:focus-within { border-color: var(--lima); background: rgba(187, 209, 81, .05); }
.drop.is-over { transform: scale(1.01); }
.drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.drop__ico { width: 46px; height: 46px; color: var(--lima); }
.drop__ico svg { width: 100%; height: 100%; }
.drop__t { font-family: var(--font-d); font-size: 20px; color: var(--text); }
.drop__s { font-size: 14px; color: var(--muted); margin: 0; }
.drop__btn { margin-top: 6px; pointer-events: none; }
.drop__file { font-size: 14px; color: var(--lima); margin: 0; }
.drop.is-busy { pointer-events: none; }
.drop.is-busy .drop__t::after { content: ""; display: inline-block; width: 14px; height: 14px; margin-left: 10px; border-radius: 50%; border: 2px solid rgba(244, 242, 236, .2); border-top-color: var(--lima); animation: spin .8s linear infinite; vertical-align: middle; }

.form__row { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 640px) { .form__row { grid-template-columns: 1fr 1fr; } .form__row--3 { grid-template-columns: repeat(3, 1fr); } }
.field .unit { position: relative; }
.field .unit input { padding-right: 64px; }
.field .unit b { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-weight: 500; font-size: 13px; color: var(--muted); letter-spacing: 0; text-transform: none; font-family: var(--font-b); }

/* Autocompletar dirección */
.ac { position: relative; }
.ac__list { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 20; margin: 0; padding: 6px; list-style: none; border-radius: 12px; background: #1D1D1B; border: 1px solid var(--line-2); box-shadow: 0 24px 50px -20px rgba(0, 0, 0, .9); max-height: 280px; overflow: auto; }
.ac__list[hidden] { display: none; }
.ac__list li { padding: 11px 12px; border-radius: 8px; cursor: pointer; font-size: 15px; color: var(--text-2); text-transform: none; letter-spacing: 0; font-family: var(--font-b); line-height: 1.35; }
.ac__list li:hover, .ac__list li[aria-selected="true"] { background: rgba(187, 209, 81, .12); color: var(--text); }
.ac__list li.is-empty { color: var(--muted); cursor: default; }
.ac__hint { font-size: 13px; color: var(--muted); margin: 4px 0 0; text-transform: none; letter-spacing: 0; font-family: var(--font-b); }
.elegida { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 12px; border: 1px solid rgba(77, 172, 111, .4); background: rgba(77, 172, 111, .08); font-size: 15px; }
.elegida[hidden] { display: none; }
.elegida svg { flex: none; width: 20px; height: 20px; color: var(--verde); }

/* Mapa */
.mapa { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 900px) { .mapa { grid-template-columns: minmax(0, 1fr) 290px; } }
.mapa__canvas { position: relative; width: 100%; aspect-ratio: 4 / 3; min-height: 320px; max-height: 560px; border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--line-2); background: #0c0f0c; touch-action: none; }
@media (max-width: 640px) { .mapa__canvas { aspect-ratio: 1 / 1; min-height: 340px; } }
.mapa__canvas .leaflet-container { width: 100%; height: 100%; background: #0c0f0c; font-family: var(--font-b); cursor: crosshair; }
.mapa__canvas .leaflet-container a { color: var(--lima); }
.mapa__canvas .leaflet-control-attribution { background: rgba(20, 20, 18, .75); color: var(--muted); font-size: 10px; }
.mapa__canvas .leaflet-control-attribution a { color: var(--text-2); }
.mapa__canvas .leaflet-bar a { background: #1D1D1B; color: var(--text); border-color: var(--line-2); }
.mapa__canvas .leaflet-bar a:hover { background: #2a2a27; }
.mapa__canvas .leaflet-bar { border: 0; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .9); }
.mapa__tip { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 800; padding: 9px 14px; border-radius: 999px; background: rgba(20, 20, 18, .88); border: 1px solid var(--line-2); color: var(--text); font-size: 13.5px; white-space: nowrap; pointer-events: none; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis; backdrop-filter: blur(6px); }
.vertice { width: 14px; height: 14px; border-radius: 50%; background: var(--amarillo); border: 2px solid #141412; box-shadow: 0 0 0 3px rgba(232, 227, 73, .35); }
.vertice--first { background: var(--lima); }
.mapa__side { display: grid; gap: 12px; align-content: start; }
.stat { display: grid; gap: 2px; padding: 14px 16px; border-radius: 12px; background: rgba(20, 20, 18, .6); border: 1px solid var(--line); }
.stat__k { font-family: var(--font-d); font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.stat__v { font-family: var(--font-d); font-size: clamp(24px, 2.4vw, 30px); line-height: 1.1; color: var(--text); font-variant-numeric: tabular-nums; }
.stat__v small { font-size: 14px; color: var(--muted); margin-left: 4px; }
.stat--hi { border-color: rgba(187, 209, 81, .35); background: rgba(187, 209, 81, .06); }
.stat--hi .stat__v { color: var(--lima); }
.mapa__btns { display: flex; gap: 8px; flex-wrap: wrap; }
.mapa__btns .btn { flex: 1; padding: 11px 14px; font-size: 14px; }
.mapa__nota { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.5; }

/* Tarjetas de resultado (estudio solar / oferta) */
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 720px) { .cards { grid-template-columns: repeat(3, 1fr); gap: 16px; } }
.card { display: grid; gap: 6px; padding: 20px 20px 18px; border-radius: 14px; background: rgba(20, 20, 18, .6); border: 1px solid var(--line); position: relative; overflow: hidden; }
.card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--grad); opacity: .5; }
.card--hero { grid-column: 1 / -1; border-color: rgba(187, 209, 81, .4); background: linear-gradient(135deg, rgba(187, 209, 81, .12), rgba(77, 172, 111, .06) 60%, transparent); }
.card--hero::before { opacity: 1; }
.card__k { font-family: var(--font-d); font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.card__v { font-family: var(--font-d); font-size: clamp(26px, 3vw, 40px); line-height: 1.05; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.card--hero .card__v { font-size: clamp(38px, 5.4vw, 64px); color: var(--lima); }
.card__v small { font-size: .45em; color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.card__s { font-size: 13px; color: var(--muted); margin: 0; }

.aviso { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; background: rgba(232, 227, 73, .07); border: 1px solid rgba(232, 227, 73, .3); font-size: 14px; color: var(--text-2); line-height: 1.5; margin: 0; }
.aviso svg { flex: none; width: 20px; height: 20px; color: var(--amarillo); margin-top: 1px; }
.aviso strong { color: var(--amarillo); }
.aviso--warn { background: rgba(224, 122, 95, .08); border-color: rgba(224, 122, 95, .35); }
.aviso--warn svg, .aviso--warn strong { color: #e8a090; }

/* Gráfica antes/después (barras CSS) */
.graf { display: grid; gap: 14px; padding: 22px; border-radius: 14px; background: rgba(20, 20, 18, .6); border: 1px solid var(--line); }
.graf__t { font-family: var(--font-d); font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.graf__row { display: grid; grid-template-columns: 96px 1fr auto; align-items: center; gap: 14px; font-size: 15px; }
.graf__lbl { color: var(--text-2); }
.graf__bar { height: 26px; border-radius: 7px; background: rgba(244, 242, 236, .08); overflow: hidden; }
.graf__bar i { display: block; height: 100%; width: var(--w, 0%); border-radius: inherit; background: rgba(244, 242, 236, .35); transition: width 1s var(--ease); }
.graf__row--ok .graf__bar i { background: var(--grad); }
.graf__val { font-family: var(--font-d); font-variant-numeric: tabular-nums; min-width: 84px; text-align: right; }
.graf__row--ok .graf__val { color: var(--lima); }
@media (max-width: 480px) { .graf__row { grid-template-columns: 70px 1fr auto; gap: 10px; font-size: 14px; } }

.final { display: grid; gap: 14px; padding: clamp(22px, 3vw, 30px); border-radius: 14px; background: rgba(77, 172, 111, .08); border: 1px solid rgba(77, 172, 111, .35); text-align: center; justify-items: center; }
.final h3 { font-size: clamp(22px, 2.6vw, 30px); font-weight: 400; }
.final p { color: var(--text-2); margin: 0; max-width: 560px; }
.final .btn { margin-top: 4px; }

/* ---------- Comparador: revisión editable ---------- */
.rev { display: grid; gap: 22px; }
.rev__grp { display: grid; gap: 12px; }
.rev__grp h3 { font-family: var(--font-d); font-size: 13px; letter-spacing: .16em; text-transform: uppercase; color: var(--lima); font-weight: 500; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.rev__grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 720px) { .rev__grid { grid-template-columns: repeat(3, 1fr); } .rev__grid--4 { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 900px) { .rev__grid--6 { grid-template-columns: repeat(6, 1fr); } }
.rev .field input, .rev .field select { padding: 11px 12px; font-size: 15px; }
.rev .field input::placeholder { color: var(--muted); }
.rev .field--wide { grid-column: 1 / -1; }
.rev .field--check { grid-template-columns: auto 1fr; align-items: center; text-transform: none; letter-spacing: 0; font-family: var(--font-b); font-size: 14px; color: var(--text-2); align-self: end; padding-bottom: 12px; }
.rev .field--check input { width: 18px; height: 18px; accent-color: var(--lima); }
.conf { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--text-2); font-family: var(--font-d); letter-spacing: .06em; text-transform: uppercase; }
.conf::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.conf--alta::before { background: var(--verde); }
.conf--media::before { background: var(--amarillo); }
.conf--baja::before { background: #e07a5f; }

/* Oferta */
.oferta { display: grid; gap: 16px; }
.ofe { position: relative; overflow: hidden; display: grid; gap: 18px; padding: clamp(22px, 3.2vw, 36px); border-radius: var(--r); border: 1px solid rgba(187, 209, 81, .45); background: linear-gradient(140deg, rgba(187, 209, 81, .13), rgba(29, 29, 27, .9) 55%); }
.ofe::after { content: ""; position: absolute; width: 380px; height: 380px; right: -160px; top: -200px; border-radius: 50%; background: radial-gradient(circle, rgba(232, 227, 73, .18), transparent 65%); pointer-events: none; }
.ofe__top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; position: relative; }
.ofe__best { font-family: var(--font-d); font-size: 11.5px; letter-spacing: .18em; text-transform: uppercase; color: #141412; background: var(--grad); padding: 6px 12px; border-radius: 999px; }
.marca-co { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-d); font-weight: 600; letter-spacing: .12em; font-size: 20px; padding: 8px 16px; border-radius: 10px; }
.marca-co--gana { color: #1a1a1a; background: #ffd400; }
.marca-co--net { color: #fff; background: #0a4b8c; }
.marca-co--otra { color: var(--text); background: rgba(244, 242, 236, .1); }
.ofe__name { font-size: clamp(24px, 3vw, 36px); font-weight: 400; letter-spacing: -.015em; position: relative; }
.ofe__name small { display: block; font-size: 14px; color: var(--muted); font-family: var(--font-b); letter-spacing: 0; margin-top: 4px; }
.ofe__kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; position: relative; }
@media (min-width: 720px) { .ofe__kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { display: grid; gap: 4px; padding: 14px 16px; border-radius: 12px; background: rgba(20, 20, 18, .55); border: 1px solid var(--line); }
.kpi__k { font-family: var(--font-d); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.kpi__v { font-family: var(--font-d); font-size: clamp(22px, 2.6vw, 32px); line-height: 1.05; font-variant-numeric: tabular-nums; }
.kpi__v small { font-size: .5em; color: var(--muted); margin-left: 3px; white-space: nowrap; }
.kpi--ahorro { border-color: rgba(187, 209, 81, .4); background: rgba(187, 209, 81, .08); }
.kpi--ahorro .kpi__v { color: var(--lima); }
.kpi--tachado .kpi__v { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.precios { display: grid; gap: 10px; position: relative; }
.precios h4 { font-family: var(--font-d); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.precios table { width: 100%; border-collapse: collapse; font-size: 14.5px; font-variant-numeric: tabular-nums; }
.precios th, .precios td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.precios th { font-family: var(--font-d); font-weight: 500; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.precios td:not(:first-child), .precios th:not(:first-child) { text-align: right; }
.precios td:first-child { color: var(--text-2); }
.tabla-wrap { overflow-x: auto; }
details.desglose { border: 1px solid var(--line); border-radius: 12px; background: rgba(20, 20, 18, .5); position: relative; }
details.desglose summary { cursor: pointer; padding: 14px 18px; font-family: var(--font-d); font-size: 15px; list-style: none; display: flex; justify-content: space-between; align-items: center; }
details.desglose summary::-webkit-details-marker { display: none; }
details.desglose summary::after { content: "+"; font-size: 20px; color: var(--lima); transition: transform .3s var(--ease); }
details[open].desglose summary::after { transform: rotate(45deg); }
details.desglose .tabla-wrap { padding: 0 18px 16px; }
.ofe__acts { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; position: relative; }
.alts { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 720px) { .alts { grid-template-columns: repeat(2, 1fr); } }
.alt { display: grid; gap: 10px; padding: 18px 20px; border-radius: 14px; border: 1px solid var(--line); background: rgba(29, 29, 27, .8); }
.alt__top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.alt .marca-co { font-size: 14px; padding: 5px 10px; letter-spacing: .1em; }
.alt__name { font-family: var(--font-d); font-size: 19px; }
.alt__row { display: flex; justify-content: space-between; gap: 12px; font-size: 14.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.alt__row b { color: var(--text); font-weight: 500; font-family: var(--font-d); font-size: 16px; }
.alt__row .ok { color: var(--lima); }
.alts__t { font-family: var(--font-d); font-size: 13px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin: 6px 0 -4px; }

/* ---------- Chat: Asesor NEW ENERGY ---------- */
.chat-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 60; width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer; padding: 0;
  background: var(--grad); box-shadow: 0 14px 34px -10px rgba(187, 209, 81, .7), 0 2px 10px rgba(0, 0, 0, .4);
  display: grid; place-items: center; transition: transform .3s var(--ease), box-shadow .3s;
}
.chat-fab:hover { transform: translateY(-3px) scale(1.04); }
.chat-fab img { width: 38px; height: 38px; display: block; border-radius: 50%; }
.chat-fab__dot { position: absolute; top: 2px; right: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--amarillo); border: 2px solid #141412; animation: pulse 2.2s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(232, 227, 73, .6); } 60% { box-shadow: 0 0 0 10px rgba(232, 227, 73, 0); } }
.chat-fab[aria-expanded="true"] .chat-fab__dot { display: none; }
.chat-fab__x, .chat-fab[aria-expanded="true"] img { display: none; }
.chat-fab[aria-expanded="true"] .chat-fab__x { display: block; width: 24px; height: 24px; color: #141412; }
.chat {
  position: fixed; right: 20px; bottom: 92px; z-index: 60; width: min(380px, calc(100vw - 24px)); height: min(560px, calc(100vh - 112px));
  display: flex; flex-direction: column; border-radius: 20px; overflow: hidden;
  background: #1D1D1B; border: 1px solid var(--line-2); box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .95);
  transform-origin: bottom right; transition: opacity .3s var(--ease), transform .3s var(--ease), visibility .3s;
}
.chat[hidden] { display: flex; opacity: 0; transform: translateY(12px) scale(.96); visibility: hidden; pointer-events: none; }
@media (max-width: 560px) { .chat { right: 12px; left: 12px; bottom: 88px; width: auto; height: min(620px, calc(100dvh - 104px)); } .chat-fab { right: 14px; bottom: 14px; } }
@media (prefers-reduced-motion: reduce) { .chat, .chat-fab { transition: none; } .chat-fab__dot { animation: none; } }
.chat__head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: rgba(20, 20, 18, .6); }
.chat__head img { width: 36px; height: 36px; border-radius: 50%; background: var(--grad); padding: 3px; }
.chat__head b { font-family: var(--font-d); font-weight: 500; letter-spacing: .06em; display: block; font-size: 15px; }
.chat__head span { font-size: 12px; color: var(--verde); display: flex; align-items: center; gap: 6px; }
.chat__head span::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--verde); }
.chat__close { margin-left: auto; width: 34px; height: 34px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer; font-size: 20px; line-height: 1; display: grid; place-items: center; }
.chat__close:hover { border-color: var(--line-2); color: var(--text); }
.chat__log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; overscroll-behavior: contain; }
.bub { max-width: 86%; padding: 10px 14px; border-radius: 16px; font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.bub--bot { align-self: flex-start; background: rgba(244, 242, 236, .07); border: 1px solid var(--line); border-bottom-left-radius: 6px; color: var(--text); }
.bub--user { align-self: flex-end; background: var(--grad); color: #141412; border-bottom-right-radius: 6px; }
.bub--err { border-color: rgba(224, 122, 95, .4); color: #f0c2b5; }
.bub a { color: var(--lima); text-decoration: underline; text-underline-offset: 2px; }
.bub--user a { color: #141412; }
.bub--typing { display: inline-flex; gap: 5px; align-items: center; padding: 12px 14px; }
.bub--typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.bub--typing i:nth-child(2) { animation-delay: .2s; } .bub--typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .bub--typing i { animation: none; opacity: .6; } }
.chat__sug { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; }
.chat__sug button { font: 13px/1.3 var(--font-b); color: var(--text-2); background: transparent; border: 1px solid var(--line-2); border-radius: 999px; padding: 7px 12px; cursor: pointer; text-align: left; transition: border-color .25s, color .25s; }
.chat__sug button:hover { border-color: var(--lima); color: var(--lima); }
.chat__form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: rgba(20, 20, 18, .6); }
.chat__form textarea { flex: 1; resize: none; min-height: 42px; max-height: 110px; font: 14.5px/1.4 var(--font-b); color: var(--text); background: rgba(244, 242, 236, .05); border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 12px; outline: none; }
.chat__form textarea:focus { border-color: var(--lima); }
.chat__send { width: 42px; height: 42px; flex: none; border-radius: 12px; border: 0; background: var(--grad); color: #141412; cursor: pointer; display: grid; place-items: center; align-self: flex-end; }
.chat__send:disabled { opacity: .5; cursor: default; }
.chat__send svg { width: 20px; height: 20px; }
.chat__foot { font-size: 11px; color: var(--muted); text-align: center; padding: 0 12px 10px; background: rgba(20, 20, 18, .6); margin: 0; }
.aviso[hidden] { display: none; }
.chat__sug[hidden] { display: none; }
.panel__title:focus { outline: none; }
