/* Antes iba incrustado en templates/base.html. */
  .ubi-pw-ico { position: absolute; top: 50%; right: 2.6rem; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center;
                width: 1.9rem; height: 1.9rem; border-radius: .6rem; color: #d97706; background: none; border: 0; cursor: help; transition: background-color .15s, color .15s; }
  .ubi-pw-ico[hidden] { display: none; }
  .ubi-pw-ico:hover, .ubi-pw-ico:focus-visible { background: #fffbeb; outline: none; }
  .ubi-pw-ico.is-ok { color: #059669; }
  .ubi-pw-ico.is-ok:hover, .ubi-pw-ico.is-ok:focus-visible { background: #ecfdf5; }
  .ubi-pw-float { position: fixed; z-index: 3000; width: 290px; margin: 0 !important; box-shadow: 0 18px 40px -12px rgba(15,23,42,.28) !important;
                  animation: ubiPwIn .16s ease-out; }
  .ubi-pw-float::before { content: ""; position: absolute; width: 10px; height: 10px; background: inherit; border: inherit; transform: rotate(45deg); }
  .ubi-pw-float[data-side=right]::before  { left: -6px;  top: calc(var(--ay) - 5px); border-top-color: transparent; border-right-color: transparent; }
  .ubi-pw-float[data-side=left]::before   { right: -6px; top: calc(var(--ay) - 5px); border-bottom-color: transparent; border-left-color: transparent; }
  .ubi-pw-float[data-side=bottom]::before { top: -6px;   left: calc(var(--ax) - 5px); border-bottom-color: transparent; border-right-color: transparent; }
  .ubi-pw-float[data-side=top]::before    { bottom: -6px; left: calc(var(--ax) - 5px); border-top-color: transparent; border-left-color: transparent; }
  @keyframes ubiPwIn { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
  html.dark .ubi-pw-ico:hover, html.dark .ubi-pw-ico:focus-visible { background: rgba(217,119,6,.14); }
  html.dark .ubi-pw-ico.is-ok:hover, html.dark .ubi-pw-ico.is-ok:focus-visible { background: rgba(5,150,105,.16); }

  @keyframes ubi-spin { to { transform: rotate(360deg); } }
  /* Entrada de tarjetas/pantallas (STYLEGUIDE §4) */
  @keyframes ubi-fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
  .ubi-fade-in { animation: ubi-fade-in .22s cubic-bezier(.16,1,.3,1) both; }
  @media (prefers-reduced-motion: reduce) { .ubi-fade-in { animation: none; } }
  .ubi-btn-spin {
    display:inline-block; width:15px; height:15px; border-radius:9999px;
    border:2px solid currentColor; border-right-color:transparent;
    animation:ubi-spin .6s linear infinite; vertical-align:-2px;
  }
  .ubi-btn-busy { pointer-events:none; opacity:.7; cursor:progress; }

  #ubi-support { position:fixed; right:22px; bottom:22px; z-index:9998; }
  /* Atajos de teclado: no aplican en pantallas táctiles */
  @media (pointer:coarse) { .hint-kbd { display:none !important; } }

  /* ── Acciones de suscripción y botones de planes (_suscripcion_acciones,
     _plan_boton) ──────────────────────────────────────────────────────── */
  .sub-act {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem; white-space: nowrap;
    padding: .55rem 1rem; border-radius: .75rem; border: 1px solid #e2e8f0; background: #fff;
    font-size: .8rem; font-weight: 700; color: #334155; cursor: pointer;
    transition: background-color .15s, border-color .15s, color .15s, transform .12s;
  }
  .sub-act:hover { background: #f8fafc; border-color: #cbd5e1; }
  .sub-act:active { transform: scale(.97); }
  .sub-act-primary { background: #0072cb; border-color: #0072cb; color: #fff; }
  .sub-act-primary:hover { background: #0059a4; border-color: #0059a4; }
  .sub-act-danger { border-color: transparent; background: transparent; color: #e11d48; }
  .sub-act-danger:hover { background: #fff1f2; border-color: #fecdd3; }
  .plan-btn {
    margin-top: auto; width: 100%; padding: .75rem 1rem; border-radius: .75rem; border: 1px solid #0072cb;
    background: #0072cb; color: #fff; font-size: .875rem; font-weight: 700; cursor: pointer;
    box-shadow: 0 4px 14px -5px rgba(15,23,42,.22); transition: background-color .15s, transform .12s;
  }
  .plan-btn:hover { background: #0059a4; }
  .plan-btn:active { transform: scale(.98); }
  .plan-btn-soft { background: #fff; color: #334155; border-color: #e2e8f0; box-shadow: none; }
  .plan-btn-soft:hover { background: #f8fafc; border-color: #cbd5e1; }
  .plan-note { margin-top: .5rem; font-size: .7rem; color: #64748b; text-align: center; line-height: 1.35; }
  html.dark .sub-act { background: #1e2533; border-color: #2c3340; color: #cbd5e1; }
  html.dark .sub-act:hover { background: #222a39; }
  html.dark .sub-act-primary { background: #0072cb; border-color: #0072cb; color: #fff; }
  html.dark .sub-act-danger { background: transparent; border-color: transparent; color: #fb7185; }
  html.dark .sub-act-danger:hover { background: rgba(244,63,94,.12); }
  html.dark .plan-btn-soft { background: #1e2533; border-color: #2c3340; color: #cbd5e1; }
  html.dark .plan-note { color: #8590a1; }

  /* ── Selector de capas de Leaflet con el estilo de la web ────────────
     (tarjeta redondeada, opciones como filas con radio/check propios y
     títulos de sección; ver ubiLayersControl). */
  .leaflet-control-layers {
    border: 1px solid #e2e8f0 !important; border-radius: 14px !important; background: #fff !important;
    box-shadow: 0 12px 28px -8px rgba(15,23,42,.22), 0 2px 6px rgba(15,23,42,.05) !important;
    font-family: inherit !important; color: #334155;
  }
  .leaflet-control-layers-toggle { width: 38px !important; height: 38px !important; border-radius: 12px !important; background-size: 20px 20px !important; }
  .leaflet-control-layers-expanded { padding: 6px !important; min-width: 190px; }
  .leaflet-control-layers-list { margin: 0; position: relative; }
  .leaflet-control-layers .lc-collapse {
    position: absolute; top: -3.5px; right: 2px; width: 22px; height: 22px; border: 0; border-radius: 7px;   /* centrada con «MAPA BASE» */
    background: transparent; color: #94a3b8; display: flex; align-items: center; justify-content: center; cursor: pointer;
    transition: background-color .15s, color .15s;
  }
  .leaflet-control-layers .lc-collapse:hover { background: #f1f5f9; color: #0059a4; }
  html.dark .leaflet-control-layers .lc-collapse { color: #8590a1; }
  html.dark .leaflet-control-layers .lc-collapse:hover { background: #1e2533; color: #7cc5fd; }
  .leaflet-control-layers .lc-title {
    margin: 4px 8px 4px; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #94a3b8;
  }
  .leaflet-control-layers .lc-hint { display: block; font-size: 11px; font-weight: 500; color: #64748b; line-height: 1.2; margin-top: 1px; }
  .leaflet-control-layers .lc-hint[hidden] { display: none; }
  html.dark .leaflet-control-layers .lc-hint { color: #8590a1; }
  .leaflet-control-layers-separator { border-top: 1px solid #f1f5f9 !important; margin: 6px -6px !important; height: 0 !important; }
  .leaflet-control-layers label { margin: 0 !important; }
  .leaflet-control-layers label > span, .leaflet-control-layers label > div {
    display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 9px;
    font-size: 13px; font-weight: 600; color: #475569; cursor: pointer; transition: background-color .12s, color .12s;
  }
  .leaflet-control-layers label > span:hover, .leaflet-control-layers label > div:hover { background: #f0f7ff; color: #0059a4; }
  .leaflet-control-layers label:has(input:checked) > span, .leaflet-control-layers label:has(input:checked) > div { color: #0059a4; }
  .leaflet-control-layers-base label:has(input:checked) > span, .leaflet-control-layers-base label:has(input:checked) > div { background: #e0efff; }
  .leaflet-control-layers-selector {
    appearance: none; -webkit-appearance: none; margin: 0 !important; top: 0 !important; flex-shrink: 0;
    width: 16px; height: 16px; border: 1.5px solid #cbd5e1; background: #fff; cursor: pointer;
    display: inline-grid; place-content: center; transition: border-color .12s, background-color .12s;
  }
  .leaflet-control-layers-selector[type=radio] { border-radius: 999px; }
  .leaflet-control-layers-selector[type=checkbox] { border-radius: 5px; }
  .leaflet-control-layers-selector:checked { border-color: #0072cb; background: #0072cb; }
  .leaflet-control-layers-selector[type=radio]:checked { box-shadow: inset 0 0 0 3px #fff; }
  .leaflet-control-layers-selector[type=checkbox]:checked::after {
    content: ""; width: 9px; height: 9px; background: #fff;
    -webkit-mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 13l4 4L19 7'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 13l4 4L19 7'/%3E%3C/svg%3E") center / contain no-repeat;
  }
  html.dark .leaflet-control-layers { background: #171d29 !important; border-color: #2c3340 !important; color: #b2bac8; box-shadow: 0 12px 28px -8px rgba(0,0,0,.6) !important; }
  html.dark .leaflet-control-layers label > span, html.dark .leaflet-control-layers label > div { color: #b2bac8; }
  html.dark .leaflet-control-layers label > span:hover, html.dark .leaflet-control-layers label > div:hover,
  html.dark .leaflet-control-layers-base label:has(input:checked) > span, html.dark .leaflet-control-layers-base label:has(input:checked) > div { background: #1c2941; color: #7cc5fd; }
  html.dark .leaflet-control-layers label:has(input:checked) > span, html.dark .leaflet-control-layers label:has(input:checked) > div { color: #7cc5fd; }
  html.dark .leaflet-control-layers-separator { border-top-color: #2c3340 !important; }
  html.dark .leaflet-control-layers-selector { background: #131925; border-color: #3a4354; }
  html.dark .leaflet-control-layers-selector:checked { background: #37a9fb !important; border-color: #37a9fb !important; }
  html.dark .leaflet-control-layers-selector[type=radio]:checked { box-shadow: inset 0 0 0 3px #171d29; }

  /* ── Barra de navegación inferior (móvil y tablet vertical) ─────────── */
  #ubi-bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 9990;
    display: flex; justify-content: space-around; align-items: stretch;
    height: calc(62px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(255,255,255,.96); backdrop-filter: blur(8px);
    border-top: 1px solid #e2e8f0; box-shadow: 0 -4px 16px -8px rgba(15,23,42,.12);
  }
  #ubi-bottom-nav .bn-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; min-width: 64px; border: 0; background: none; color: #64748b;
    font-size: 11px; font-weight: 700; text-decoration: none; cursor: pointer;
    -webkit-tap-highlight-color: transparent; transition: color .15s, transform .12s;
  }
  #ubi-bottom-nav .bn-item svg { width: 23px; height: 23px; }
  #ubi-bottom-nav .bn-item:active { transform: scale(.94); }
  #ubi-bottom-nav .bn-item.is-active { color: #0072cb; }
  #ubi-bottom-nav .bn-icon-wrap { position: relative; display: inline-flex; }
  #ubi-bottom-nav .bn-dot {
    position: absolute; top: -2px; right: -4px; width: 9px; height: 9px;
    border-radius: 999px; background: #ef4444; box-shadow: 0 0 0 2px #fff;
  }
  html.dark #ubi-bottom-nav { background: rgba(23,29,41,.96); border-top-color: #2c3340; }
  html.dark #ubi-bottom-nav .bn-item { color: #8590a1; }
  html.dark #ubi-bottom-nav .bn-item.is-active { color: #7cc5fd; }
  html.dark #ubi-bottom-nav .bn-dot { box-shadow: 0 0 0 2px #171d29; }
  @media (min-width: 1024px) { #ubi-bottom-nav { display: none; } }

  @media (max-width: 1023.98px) {
    /* La barra inferior no debe moverse al hacer scroll en el móvil: sin el
       rebote elástico de la página (que arrastra los elementos fijos en iOS)
       y en su propia capa de composición. */
    html, body { overscroll-behavior-y: none; }
    #ubi-bottom-nav { transform: translate3d(0, 0, 0); -webkit-transform: translate3d(0, 0, 0); backface-visibility: hidden; }
    body.has-bnav { padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px)); }
    /* Soporte: sin burbuja flotante; el panel se abre como hoja inferior
       sobre la barra (la posición guardada al arrastrar no aplica aquí). */
    body.has-bnav #ubi-sup-bubble { display: none !important; }
    body.has-bnav #ubi-support {
      left: 0 !important; right: 0 !important; top: auto !important;
      bottom: calc(62px + env(safe-area-inset-bottom, 0px)) !important;
      pointer-events: none;
    }
    body.has-bnav #ubi-support.open #ubi-sup-panel {
      pointer-events: auto; position: fixed !important;
      left: 8px !important; right: 8px !important; top: auto !important;
      bottom: calc(70px + env(safe-area-inset-bottom, 0px)) !important;
      width: auto !important; max-width: none !important;
      height: min(640px, calc(100dvh - 150px)) !important;
      transform-origin: bottom center !important;
    }
  }

  #ubi-sup-bubble {
    width:56px; height:56px; border-radius:9999px; border:0; cursor:grab;
    background:#0072cb; color:#fff; display:flex; align-items:center;
    justify-content:center; box-shadow:0 8px 22px -8px rgba(15,23,42,.40);
    transition:transform .15s, box-shadow .15s; touch-action:none;
    margin-left:auto;
  }
  #ubi-sup-bubble:hover { transform:translateY(-2px); box-shadow:0 12px 26px -8px rgba(15,23,42,.46); }
  #ubi-sup-bubble:active { cursor:grabbing; transform:scale(.96); }
  #ubi-sup-bubble.dragging { transition:none; }
  #ubi-sup-panel {
    position:absolute; right:0; bottom:70px; width:380px; max-width:calc(100vw - 44px);
    /* Altura FIJA (no max-height): el panel mantiene su tamaño al
       cambiar de pestaña, evitando que botones/acciones queden ocultas
       por debajo del viewport. */
    height:min(620px, calc(100vh - 110px)); display:none; flex-direction:column;
    background:#fff; border:1px solid #e2e8f0; border-radius:18px; overflow:hidden;
    box-shadow:0 24px 60px -12px rgba(15,23,42,.28);
  }
  #ubi-support.open #ubi-sup-panel {
    display:flex;
    transform-origin:bottom right;
    animation:ubiSupIn .22s cubic-bezier(.16,1,.3,1) both;
  }
  @keyframes ubiSupIn {
    from { opacity:0; transform:translateY(8px) scale(.97); }
    to   { opacity:1; transform:none; }
  }
  /* Dirección de apertura del panel según la posición de la bolita */
  #ubi-support.ubi-pos-down #ubi-sup-panel { bottom:auto; top:70px; transform-origin:top right; }
  #ubi-support.ubi-pos-left #ubi-sup-panel { right:auto; left:0; transform-origin:bottom left; }
  #ubi-support.ubi-pos-down.ubi-pos-left #ubi-sup-panel { transform-origin:top left; }
  .ubi-sup-head {
    display:flex; align-items:center; gap:11px; padding:14px 14px 14px 16px; color:#fff;
    background:linear-gradient(135deg,#0a4171 0%,#005baa 55%,#0072cb 100%);
  }
  .ubi-sup-avatar {
    width:38px; height:38px; flex-shrink:0; border-radius:12px; display:inline-flex; align-items:center; justify-content:center;
    background:rgba(255,255,255,.14); border:1px solid rgba(255,255,255,.2); box-shadow:inset 0 1px 0 rgba(255,255,255,.15);
  }
  .ubi-sup-head-txt { flex:1; min-width:0; }
  .ubi-sup-head h3 { margin:0; font-size:15px; font-weight:800; letter-spacing:-.01em; }
  .ubi-sup-head p { margin:2px 0 0; font-size:12px; opacity:.85; display:flex; align-items:center; gap:6px; }
  .ubi-sup-online { width:7px; height:7px; border-radius:999px; background:#6ee7b7; box-shadow:0 0 0 3px rgba(110,231,183,.2); flex-shrink:0; }
  .ubi-sup-close {
    width:32px; height:32px; flex-shrink:0; border:0; border-radius:10px; background:transparent; color:#fff; cursor:pointer;
    display:inline-flex; align-items:center; justify-content:center; opacity:.8; transition:background .15s, opacity .15s;
  }
  .ubi-sup-close:hover { background:rgba(255,255,255,.14); opacity:1; }
  .ubi-sup-body { padding:12px 14px; overflow-y:auto; }
  .ubi-faq { border:1px solid #eef2f7; border-radius:12px; margin:0 0 6px; background:#fff; transition:border-color .15s, box-shadow .15s; }
  .ubi-faq[open] { border-color:#dbe7f5; box-shadow:0 4px 14px -8px rgba(15,23,42,.18); }
  .ubi-faq summary {
    list-style:none; cursor:pointer; padding:10px 12px; font-size:13px;
    font-weight:600; color:#334155; display:flex; gap:9px; align-items:flex-start;
  }
  .ubi-faq summary::-webkit-details-marker { display:none; }
  .ubi-faq summary::before {
    content:'+'; flex-shrink:0; width:18px; height:18px; border-radius:6px; background:#eff6ff; color:#0072cb;
    font-weight:800; font-size:13px; line-height:18px; text-align:center;
  }
  .ubi-faq[open] summary::before { content:'–'; }
  .ubi-faq p, .ubi-faq-a { margin:0 12px 12px 39px; font-size:12.5px; color:#64748b; line-height:1.55; }
  .ubi-faq-a p { margin:0; }
  .ubi-faq-a strong { font-weight:700; color:#334155; }
  .ubi-faq-ver { display:inline-block; margin-top:.4rem; font-weight:700; color:#0072cb; text-decoration:none; }
  .ubi-faq-ver:hover { text-decoration:underline; }
  .ubi-faq-a ol { margin:.3rem 0 0; padding-left:1.05rem; list-style:decimal; }
  .ubi-faq-a li { margin-top:.25rem; padding-left:.1rem; }
  .ubi-faq-a li::marker { color:#0072cb; font-weight:800; }
  .ubi-sup-guias { display:flex; align-items:center; gap:8px; margin:0 0 8px; padding:10px 12px; border-radius:12px; background:#f0f7ff; color:#0059a4;
                   font-size:13px; font-weight:700; text-decoration:none; transition:background .15s; }
  .ubi-sup-guias span:first-of-type { flex:1; }
  .ubi-sup-guias:hover { background:#e0efff; }
  .ubi-sup-cta {
    margin:12px 0 4px; width:100%; background:#0072cb; color:#fff; display:inline-flex; align-items:center; justify-content:center; gap:7px;
    border:0; border-radius:12px; padding:11px; font-size:13px; font-weight:700;
    cursor:pointer; transition:background .15s, transform .1s; box-shadow:0 4px 12px -6px rgba(15,23,42,.25);
  }
  .ubi-sup-cta:hover { background:#005fab; }
  .ubi-sup-cta:active { transform:scale(.98); }
  .ubi-sup-cta:disabled { opacity:.6; cursor:wait; }
  html.dark .ubi-sup-cta { box-shadow:none; }   /* sin glow de color (STYLEGUIDE) */
  .ubi-sup-intro { font-size:12.5px; color:#64748b; margin:2px 0 4px; line-height:1.5; }
  .ubi-sup-form label { display:block; font-size:10.5px; font-weight:700; color:#64748b; margin:12px 0 5px; text-transform:uppercase; letter-spacing:.07em; }
  .ubi-sup-field { position:relative; }
  .ubi-sup-field .ubi-sup-ico { position:absolute; left:11px; top:50%; transform:translateY(-50%); color:#94a3b8; pointer-events:none; transition:color .15s; }
  .ubi-sup-field:focus-within .ubi-sup-ico { color:#0072cb; }
  .ubi-sup-form input, .ubi-sup-form select, .ubi-sup-form textarea {
    width:100%; border:1px solid #e2e8f0; border-radius:12px; padding:10px 12px; background:#fff;
    font-size:13px; outline:none; color:#334155; font-family:inherit; transition:border-color .15s, box-shadow .15s;
  }
  .ubi-sup-field input { padding-left:35px; }
  .ubi-sup-form input::placeholder, .ubi-sup-form textarea::placeholder { color:#64748b; }
  .ubi-sup-form select {
    appearance:none; -webkit-appearance:none; padding-right:34px; cursor:pointer;
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat:no-repeat; background-position:right 11px center; background-size:15px;
  }
  .ubi-sup-form textarea { resize:vertical; min-height:104px; line-height:1.5; }
  .ubi-sup-attach { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-top:8px; }
  .ubi-sup-att-btn { display:inline-flex; align-items:center; gap:6px; border:1px dashed #cbd5e1; background:transparent; color:#475569; border-radius:10px;
                     padding:7px 11px; font:inherit; font-size:12.5px; font-weight:600; cursor:pointer; transition:border-color .15s, color .15s, background-color .15s; }
  .ubi-sup-att-btn svg { width:16px; height:16px; }
  .ubi-sup-att-btn:hover { border-color:#37a9fb; color:#0072cb; background:#f0f7ff; }
  .ubi-sup-att-hint { font-size:11.5px; color:#64748b; }
  html.dark .ubi-sup-att-hint { color:#8590a1; }
  html.dark .ubi-sup-att-btn { border-color:#3a4354; color:#b2bac8; }
  html.dark .ubi-sup-att-btn:hover { border-color:#37a9fb; color:#7cc5fd; background:#1c2941; }
  .ubi-sup-form input:hover, .ubi-sup-form select:hover, .ubi-sup-form textarea:hover { border-color:#cbd5e1; }
  .ubi-sup-form input:focus, .ubi-sup-form select:focus, .ubi-sup-form textarea:focus { border-color:#37a9fb; box-shadow:0 0 0 3px rgba(55,169,251,.15); }
  .ubi-sup-back { background:none; border:0; color:#0072cb; font-size:12px; font-weight:700; cursor:pointer; padding:4px; }
  .ubi-tk-chat-head .ubi-sup-back { display:inline-flex; align-items:center; gap:3px; flex-shrink:0; white-space:nowrap; min-height:34px; margin-left:-6px; border-radius:8px; }
  .ubi-tk-chat-head .ubi-sup-back:hover { background:#eef4fb; }
  html.dark .ubi-tk-chat-head .ubi-sup-back:hover { background:#1c2941; }
  .ubi-sup-tabs { display:flex; gap:3px; margin:10px 12px 2px; padding:3px; border-radius:12px; background:#f1f5f9; flex-shrink:0; }
  .ubi-sup-tabs button {
    flex:1; padding:7px 4px; font-size:12px; font-weight:700; color:#64748b; white-space:nowrap;
    background:none; border:0; border-radius:9px; cursor:pointer; transition:background .15s, color .15s, box-shadow .15s;
  }
  .ubi-sup-tabs button:hover { color:#334155; }
  .ubi-sup-tabs button.active { color:#0f172a; background:#fff; box-shadow:0 1px 3px rgba(15,23,42,.12); }
  #ubi-sup-chat-view { padding:0; display:flex; flex-direction:column; flex:1; min-height:0; }
  .ubi-chat-msgs { display:flex; flex-direction:column; gap:8px; padding:14px; overflow-y:auto; flex:1; min-height:140px; max-height:340px; overscroll-behavior:contain; }
  .ubi-chat-msg { max-width:85%; font-size:12.5px; line-height:1.5; padding:9px 12px; border-radius:14px; }
  .ubi-chat-msg.bot  { background:#f1f5f9; color:#334155; align-self:flex-start; border-bottom-left-radius:4px; border:1px solid #eaeff5; }
  .ubi-chat-msg.user { background:#0072cb; color:#fff; align-self:flex-end; border-bottom-right-radius:4px; }
  .ubi-chat-msg.ubi-chat-typing { opacity:.6; font-style:italic; }
  .ubi-chat-chips { display:flex; flex-wrap:wrap; gap:6px; padding:0 14px 12px; }
  .ubi-chat-chip {
    font-size:11.5px; font-weight:600; color:#0072cb; background:#f8fafc;
    border:1px solid #e2e8f0; border-radius:9999px; padding:5px 10px; cursor:pointer;
    transition:background .15s, border-color .15s, transform .1s;
  }
  .ubi-chat-chip:hover { background:#eef4fb; border-color:#cbd9e8; }
  .ubi-chat-chip:active { transform:scale(.97); }
  .ubi-chat-form { display:flex; gap:8px; padding:10px 12px; border-top:1px solid #e2e8f0; flex-shrink:0; }
  .ubi-chat-form input {
    flex:1; min-width:0; border:1px solid #e2e8f0; border-radius:12px; padding:10px 12px;
    font-size:13px; outline:none; font-family:inherit; color:#334155; transition:border-color .15s, box-shadow .15s;
  }
  .ubi-chat-form input:focus { border-color:#37a9fb; box-shadow:0 0 0 3px rgba(55,169,251,.15); }
  .ubi-chat-form button {
    flex-shrink:0; width:40px; border:0; border-radius:12px; background:#0072cb;
    color:#fff; font-size:16px; font-weight:700; cursor:pointer; display:inline-flex; align-items:center; justify-content:center;
    transition:background .15s, transform .1s;
  }
  .ubi-chat-form button:hover { background:#005fab; }
  .ubi-chat-form button:active { transform:scale(.95); }
  /* Botón de adjuntar dentro del composer: no hereda el azul de "Enviar" */
  .ubi-chat-form .ubi-att-btn { background:#fff; color:#64748b; border:1px solid #e2e8f0; font-size:inherit; }
  .ubi-chat-form .ubi-att-btn:hover { background:#f0f7ff; color:#0072cb; border-color:#93c5fd; }
  html.dark .ubi-chat-form .ubi-att-btn { background:#1e2533; border-color:#2c3340; color:#8590a1; }
  .ubi-chat-cta {
    align-self:flex-start; margin-top:-2px; font-size:11.5px; font-weight:700;
    color:#fff; background:#0072cb; border:0; border-radius:10px;
    padding:7px 12px; cursor:pointer;
  }
  .ubi-chat-cta:hover { background:#005fab; }
  .ubi-chat-cta:active { transform:scale(.97); }

  /* ── "Mis reportes": pestaña + lista + chat embebido ─────────────── */
  .ubi-tab-badge {
    position:absolute; top:-4px; right:-2px;
    background:#dc2626; color:#fff; font-size:9.5px; font-weight:800;
    padding:1px 5px; border-radius:9999px; min-width:14px; text-align:center;
    line-height:1.4;
  }
  .ubi-sup-bubble-dot {
    position:absolute; top:6px; right:6px;
    width:12px; height:12px; background:#dc2626; border-radius:50%;
    border:2px solid #fff; box-shadow:0 0 0 0 rgba(220,38,38,.6);
    animation:ubi-pulse 1.8s ease-out infinite;
  }
  @keyframes ubi-pulse {
    0%   { box-shadow:0 0 0 0   rgba(220,38,38,.5); }
    70%  { box-shadow:0 0 0 8px rgba(220,38,38,0); }
    100% { box-shadow:0 0 0 0   rgba(220,38,38,0); }
  }
  /* Tickets view: ocupa todo el alto restante del panel.
     Cada sub-pane (lista o chat) es flex column que crece. */
  #ubi-sup-tickets-view { padding:0; display:flex; flex-direction:column; flex:1; min-height:0; }
  .ubi-tk-pane { display:flex; flex-direction:column; flex:1; min-height:0; }
  .ubi-tk-loading { padding:30px 14px; min-height:120px; display:flex; align-items:center; justify-content:center; }
  .ubi-tk-loading .spinner { border:3px solid #e2e8f0; border-top-color:#0072cb; border-radius:50%; width:28px; height:28px; animation:ubi-spin .7s linear infinite; }
  html.dark .ubi-tk-loading .spinner { border-color:#2c3340; border-top-color:#37a9fb; }
  .ubi-tk-empty { padding:30px 14px; text-align:center; }
  .ubi-tk-list-items { overflow-y:auto; flex:1; min-height:0; overscroll-behavior:contain; }
  /* Bandeja: cada ticket con su estado, último mensaje, hace cuánto y punto de no leído */
  .ubi-tk-item {
    position:relative; display:flex; align-items:flex-start; gap:8px; width:100%; box-sizing:border-box;
    padding:11px 14px 11px 22px; border:0; border-bottom:1px solid #f1f5f9; cursor:pointer;
    background:#fff; text-align:left; font:inherit; color:inherit; transition:background .15s;
  }
  .ubi-tk-item:hover { background:#f8fafc; }
  .ubi-tk-item:focus-visible { outline:none; box-shadow:inset 0 0 0 2px rgba(55,169,251,.45); }
  .ubi-tk-item:last-child { border-bottom:0; }
  .ubi-tk-item-dot { position:absolute; left:9px; top:17px; width:7px; height:7px; border-radius:999px; background:transparent; }
  .ubi-tk-item.unread .ubi-tk-item-dot { background:#0072cb; }
  .ubi-tk-item-body { flex:1; min-width:0; display:flex; flex-direction:column; gap:2px; }
  .ubi-tk-item-head { display:flex; align-items:baseline; gap:8px; min-width:0; }
  .ubi-tk-item-cat { flex:1; min-width:0; font-size:12.5px; font-weight:600; color:#0f172a; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .ubi-tk-item.unread .ubi-tk-item-cat { font-weight:800; }
  .ubi-tk-item-time { flex-shrink:0; font-size:10.5px; color:#64748b; white-space:nowrap; }
  .ubi-tk-item.unread .ubi-tk-item-time { color:#0072cb; font-weight:700; }
  .ubi-tk-item-preview {
    font-size:11.5px; color:#64748b; line-height:1.4; overflow-wrap:anywhere;
    overflow:hidden; text-overflow:ellipsis; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical;
  }
  .ubi-tk-item.unread .ubi-tk-item-preview { color:#334155; }
  .ubi-tk-item-preview .who { font-weight:700; color:#475569; }
  .ubi-tk-item-foot { display:flex; align-items:center; gap:6px; margin-top:3px; }
  .ubi-tk-item-id { font-family:'Geist Mono',ui-monospace,monospace; font-size:10.5px; color:#64748b; font-weight:600; }
  .ubi-tk-item-unread {
    margin-left:auto; background:#0072cb; color:#fff; font-size:9.5px; font-weight:800;
    padding:1px 6px; border-radius:9999px; min-width:16px; text-align:center; line-height:1.5;
  }

  /* Chat embebido. La cabecera y el composer son flex-shrink:0 — solo el
     hilo (ubiHilo) se reduce/crece. */
  .ubi-tk-chat-head {
    display:flex; align-items:center; gap:10px; padding:9px 10px 9px 14px;
    border-bottom:1px solid #e2e8f0; background:#fafbfc; flex-shrink:0;
  }
  .ubi-tk-chat-meta { flex:1; min-width:0; }
  .ubi-tk-chat-title {
    display:flex; align-items:center; gap:8px; margin:0; font-size:13px; font-weight:800; color:#0f172a;
    font-family:'Geist Mono',ui-monospace,monospace; letter-spacing:-.01em; min-width:0;
  }
  .ubi-tk-chat-title .uh-chip { font-family:'Outfit',system-ui,sans-serif; }
  .ubi-tk-chat-sub {
    margin:2px 0 0; font-size:10.5px; color:#64748b;
    overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  }
  .ubi-tk-full {
    flex-shrink:0; width:34px; height:34px; border-radius:10px; display:inline-flex; align-items:center; justify-content:center;
    color:#64748b; transition:background .15s, color .15s;
  }
  .ubi-tk-full:hover { background:#eef4fb; color:#0072cb; }
  .ubi-tk-chat-msgs { flex:1 1 auto; min-height:0; }
  .ubi-tk-closed {
    flex-shrink:0; margin:8px 12px 10px; text-align:center; color:#64748b; font-size:11.5px;
    padding:8px; background:#f8fafc; border:1px dashed #cbd5e1; border-radius:9px;
  }
  /* Composer con caja que crece (hasta 5 líneas) */
  .ubi-tk-compo { align-items:flex-end; }
  .ubi-tk-compo textarea {
    flex:1; min-width:0; border:1px solid #e2e8f0; border-radius:12px; padding:9px 12px;
    font-size:13px; outline:none; font-family:inherit; color:#334155; background:#fff;
    transition:border-color .15s, box-shadow .15s; min-height:40px;
  }
  .ubi-tk-compo textarea:focus { border-color:#37a9fb; box-shadow:0 0 0 3px rgba(55,169,251,.15); }
  .ubi-tk-compo button { height:40px; }
  #ubi-tk-att-prev { flex-shrink:0; }

  /* Dark mode para los componentes del widget */
  html.dark .ubi-tk-item { background:#171d29 !important; border-bottom-color:#2c3340 !important; }
  html.dark .ubi-tk-item:hover { background:#1e2533 !important; }
  html.dark .ubi-tk-item-cat { color:#c4cbd6 !important; }
  html.dark .ubi-tk-item-preview { color:#9aa5b5 !important; }
  html.dark .ubi-tk-item.unread .ubi-tk-item-preview { color:#cbd5e1 !important; }
  html.dark .ubi-tk-item-preview .who { color:#cbd5e1 !important; }
  html.dark .ubi-tk-item-time, html.dark .ubi-tk-item-id { color:#8590a1 !important; }
  html.dark .ubi-tk-item.unread .ubi-tk-item-time { color:#7cc5fd !important; }
  html.dark .ubi-tk-item.unread .ubi-tk-item-dot { background:#37a9fb; }
  html.dark .ubi-tk-chat-head { background:#1a212e !important; border-bottom-color:#2c3340 !important; }
  html.dark .ubi-tk-chat-title { color:#c4cbd6 !important; }
  html.dark .ubi-tk-chat-sub { color:#9aa5b5 !important; }
  html.dark .ubi-tk-full { color:#9aa5b5; }
  html.dark .ubi-tk-full:hover { background:#1c2941; color:#7cc5fd; }
  html.dark .ubi-tk-closed { background:#1e2533 !important; border-color:#2c3340 !important; color:#9aa5b5 !important; }
  html.dark .ubi-tk-compo textarea { background:#131925 !important; border-color:#313a4a !important; color:#c4cbd6 !important; }
  html.dark .ubi-sup-bubble-dot { border-color:#171d29 !important; }

  /* ── Widget de soporte en dark (taste: superficies tintadas, sin
     blanco, acento brand sólo en cabecera/botones) ─────────────────── */
  html.dark #ubi-sup-panel {
    background:#171d29 !important; border-color:#2c3340 !important;
    box-shadow:0 24px 60px -16px rgba(0,0,0,.7) !important;
  }
  html.dark #ubi-sup-bubble {
    box-shadow:0 8px 22px -8px rgba(0,0,0,.6) !important;
  }
  html.dark .ubi-faq { border-color:#2c3340 !important; background:#1a2130 !important; }
  html.dark .ubi-faq-a { color:#9aa5b5 !important; }
  html.dark .ubi-faq-a strong { color:#c4cbd6; }
  html.dark .ubi-faq-a li::marker { color:#7cc5fd; }
  html.dark .ubi-faq-ver { color:#7cc5fd !important; }
  html.dark .ubi-sup-guias { background:#1c2941 !important; color:#7cc5fd !important; }
  html.dark .ubi-faq[open] { border-color:#33415a !important; }
  html.dark .ubi-faq summary::before { background:#1c2941 !important; }
  html.dark .ubi-sup-intro { color:#9aa5b5 !important; }
  html.dark .ubi-faq summary { color:#cbd5e1 !important; }
  html.dark .ubi-faq summary::before,
  html.dark .ubi-faq[open] summary::before { color:#37a9fb !important; }
  html.dark .ubi-faq p { color:#9aa5b5 !important; }
  html.dark .ubi-sup-form label { color:#9aa5b5 !important; }
  html.dark .ubi-sup-form input,
  html.dark .ubi-sup-form select,
  html.dark .ubi-sup-form textarea {
    background:#131925 !important; border-color:#313a4a !important;
    color:#c4cbd6 !important;
  }
  html.dark .ubi-chat-msg.bot {
    background:#1e2533 !important; color:#cbd5e1 !important; border-color:#2c3340 !important;
  }
  html.dark .ubi-chat-chip {
    background:#1c2330 !important; border-color:#2c3340 !important;
    color:#7cc5fd !important;
  }
  html.dark .ubi-chat-chip:hover {
    background:#1c2941 !important; border-color:#33415a !important;
  }
  html.dark .ubi-chat-form { border-top-color:#2c3340 !important; }
  html.dark .ubi-chat-form input {
    background:#131925 !important; border-color:#313a4a !important;
    color:#c4cbd6 !important;
  }
  html.dark .ubi-sup-back { color:#37a9fb !important; }

  /* ── Popover "Guardar en lista" (creado por JS con background:white
     inline → no lo pillan las reglas de clase) ─────────────────────── */
  html.dark #fav-popover {
    background:#171d29 !important; border-color:#2c3340 !important;
    box-shadow:0 16px 40px -12px rgba(0,0,0,.7) !important;
  }

  /* ── Popup del mapa (Leaflet): buildPopupHtml usa colores hex inline
     oscuros que sobre el fondo oscuro no se leen. Reasignamos por
     atributo de estilo (texto claro + superficies tintadas). ───────── */
  html.dark .leaflet-popup-content [style*="color:#0f172a"] { color:#c4cbd6 !important; }
  html.dark .leaflet-popup-content [style*="color:#334155"] { color:#cbd5e1 !important; }
  html.dark .leaflet-popup-content [style*="color:#64748b"] { color:#9aa5b5 !important; }
  html.dark .leaflet-popup-content [style*="color:#94a3b8"] { color:#8893a4 !important; }
  html.dark .leaflet-popup-content [style*="color:#475569"] { color:#9aa5b5 !important; }
  html.dark .leaflet-popup-content [style*="color:#0059a4"] { color:#37a9fb !important; }
  html.dark .leaflet-popup-content [style*="color:#1e40af"] { color:#60a5fa !important; }
  html.dark .leaflet-popup-content [style*="color:#166534"] { color:#34d399 !important; }
  html.dark .leaflet-popup-content [style*="color:#854d0e"] { color:#fbbf24 !important; }
  html.dark .leaflet-popup-content [style*="color:#6d28d9"] { color:#a78bfa !important; }
  html.dark .leaflet-popup-content [style*="color:#b45309"] { color:#fbbf24 !important; }
  /* Superficies / chips de icono / códigos refcat */
  html.dark .leaflet-popup-content [style*="background:#f1f5f9"] { background:#1e2533 !important; }
  html.dark .leaflet-popup-content [style*="background:#f8fafc"] { background:#1e2533 !important; }
  html.dark .leaflet-popup-content [style*="background:#e0efff"] { background:rgba(55,169,251,.16) !important; }
  html.dark .leaflet-popup-content [style*="background:#f5f3ff"],
  html.dark .leaflet-popup-content [style*="background:#faf5ff"],
  html.dark .leaflet-popup-content [style*="background:#ede9fe"] { background:rgba(139,92,246,.18) !important; }
  html.dark .leaflet-popup-content [style*="background:#ecfdf5"],
  html.dark .leaflet-popup-content [style*="background:#dcfce7"] { background:rgba(16,185,129,.18) !important; }
  html.dark .leaflet-popup-content [style*="background:#fffbeb"],
  html.dark .leaflet-popup-content [style*="background:#fef3c7"],
  html.dark .leaflet-popup-content [style*="background:#fef9c3"] { background:rgba(245,158,11,.18) !important; }
  html.dark .leaflet-popup-content [style*="background:#fef2f2"] { background:rgba(239,68,68,.18) !important; }
  html.dark .leaflet-popup-content [style*="background:#eff6ff"],
  html.dark .leaflet-popup-content [style*="background:#dbeafe"],
  html.dark .leaflet-popup-content [style*="background:#f0f9ff"] { background:rgba(59,130,246,.18) !important; }
  html.dark .leaflet-popup-content [style*="background:#ecfeff"] { background:rgba(6,182,212,.18) !important; }
  html.dark .leaflet-popup-content [style*="background:#eef2ff"] { background:rgba(99,102,241,.18) !important; }

/* ── oscuro: botones azules (generado) ── */
html.dark .sub-act-primary:hover { background:#0060ad; }
html.dark .plan-btn:not(.plan-btn-soft):not(.plan-btn-programado) { background:#006bc0; color:#eef2f7; }
html.dark .plan-btn:not(.plan-btn-soft):not(.plan-btn-programado):hover { background:#0060ad; }
html.dark .sub-act-primary { background:#006bc0; color:#eef2f7; }
html.dark #ubi-sup-bubble { background:#006bc0; color:#eef2f7; }
html.dark .ubi-sup-cta { background:#006bc0; color:#eef2f7; }
html.dark .ubi-chat-msg.user { background:#006bc0; color:#eef2f7; }
html.dark .ubi-chat-form button { background:#006bc0; color:#eef2f7; }
html.dark .ubi-chat-cta { background:#006bc0; color:#eef2f7; }
html.dark .ubi-tk-item-unread { background:#006bc0; color:#eef2f7; }
/* ── fin oscuro: botones azules ── */
