/* Cajón de ayuda — operador (sin IA). Usa tokens --text, --panel, --border, --ok del tema. */

/* ---- Solapa lateral derecha (fuera del root oculto) ---- */
:root {
  --ayuda-drawer-w: 26.5rem;
}

.ayuda-solapa {
  position: fixed;
  right: 0;
  /* Alineada con la cabecera del panel listado (ej. «Contratos») */
  top: 10.25rem;
  z-index: 10360;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.32rem;
  width: 1.85rem;
  padding: 0.75rem 0.22rem;
  border-radius: 10px 0 0 10px;
  cursor: pointer;
  transition:
    right 0.26s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
  border: 1px solid rgba(110, 231, 183, 0.55);
  border-right: none;
  background: linear-gradient(180deg, rgba(16, 120, 90, 0.96), rgba(6, 78, 59, 1));
  color: #ecfdf5;
  box-shadow: -4px 4px 18px rgba(0, 0, 0, 0.45);
}
.ayuda-solapa:hover {
  filter: brightness(1.1);
  box-shadow: -6px 6px 22px rgba(0, 0, 0, 0.5);
}
.ayuda-solapa__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
}
.ayuda-solapa__text {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
  opacity: 0.95;
}
body.ayuda-drawer-open .ayuda-solapa {
  right: min(100%, var(--ayuda-drawer-w));
  background: linear-gradient(180deg, rgba(20, 140, 105, 0.98), rgba(8, 90, 68, 0.98));
  box-shadow: -2px 0 12px rgba(0, 0, 0, 0.25);
}
.ayuda-solapa[aria-expanded="true"] .ayuda-solapa__icon {
  font-size: 1.1rem;
  font-weight: 400;
}
.ayuda-solapa--hidden {
  display: none !important;
}

html.theme-f5 .ayuda-solapa {
  border-color: rgba(156, 120, 96, 0.45);
  background: linear-gradient(180deg, #b08b74, #8f6f58);
  color: #fff;
  box-shadow: -4px 4px 14px rgba(156, 120, 96, 0.35);
}
html.theme-f5 body.ayuda-drawer-open .ayuda-solapa {
  background: linear-gradient(180deg, #9c7860, #7a5c48);
}

/* ---- Root / backdrop ---- */
.ayuda-drawer-root {
  position: fixed;
  inset: 0;
  z-index: 10355;
  pointer-events: none;
  visibility: hidden;
  transition: visibility 0.22s ease;
}
.ayuda-drawer-root.is-open {
  pointer-events: auto;
  visibility: visible;
}
.ayuda-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 12, 0.55);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.22s ease;
}
.ayuda-drawer-root.is-open .ayuda-drawer-backdrop {
  opacity: 1;
}
html.theme-f5 .ayuda-drawer-backdrop {
  background: rgba(60, 54, 48, 0.35);
}

/* ---- Panel (reset aside global de styles.css: left:0 / width:250px) ---- */
#ayudaDrawer.ayuda-drawer {
  position: absolute;
  top: 0;
  right: 0;
  left: auto;
  bottom: 0;
  width: min(100%, var(--ayuda-drawer-w));
  max-width: 100%;
  height: auto;
  max-height: none;
  padding: 0;
  margin: 0;
  z-index: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--panel) 0%, var(--neo-base, var(--panel)) 100%);
  border-left: 1px solid var(--border);
  border-right: none;
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.35);
  transform: translateX(104%);
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
  color: var(--text);
}
.ayuda-drawer-root.is-open #ayudaDrawer.ayuda-drawer {
  transform: translateX(0);
}

html.theme-f5 #ayudaDrawer.ayuda-drawer {
  background: linear-gradient(165deg, #f3ece4 0%, var(--neo-base) 55%, #ded4c9 100%);
  box-shadow: -10px 0 32px rgba(190, 180, 168, 0.45);
}

/* ---- Header ---- */
.ayuda-drawer__head {
  flex-shrink: 0;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: rgba(110, 231, 183, 0.07);
}
html.theme-f5 .ayuda-drawer__head {
  background: rgba(156, 120, 96, 0.1);
}
.ayuda-drawer__eyebrow {
  margin: 0 0 0.2rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ok);
}
.ayuda-drawer__title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
}
.ayuda-drawer__lead {
  margin: 0.45rem 0 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--muted);
}
.ayuda-drawer__head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}
.ayuda-drawer__close {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}
html.theme-f5 .ayuda-drawer__close {
  background: rgba(60, 54, 48, 0.08);
}
.ayuda-drawer__close:hover {
  background: rgba(255, 255, 255, 0.14);
  color: var(--text);
}
html.theme-f5 .ayuda-drawer__close:hover {
  background: rgba(60, 54, 48, 0.14);
}

/* ---- Search ---- */
.ayuda-drawer__search-wrap {
  flex-shrink: 0;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
}
.ayuda-drawer__search {
  width: 100%;
  box-sizing: border-box;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  font-size: 0.88rem;
}
html.theme-f5 .ayuda-drawer__search {
  background: var(--neo-base);
  box-shadow: inset 4px 4px 9px var(--neo-d), inset -3px -3px 8px var(--neo-l);
  border: none;
}
.ayuda-drawer__search::placeholder {
  color: var(--muted);
  opacity: 0.85;
}
.ayuda-drawer__search:focus {
  outline: 2px solid rgba(110, 231, 183, 0.45);
  outline-offset: 1px;
}
html.theme-f5 .ayuda-drawer__search:focus {
  outline-color: rgba(156, 120, 96, 0.45);
  box-shadow: inset 3px 3px 7px var(--neo-d), inset -2px -2px 6px var(--neo-l), 0 0 0 2px rgba(156, 120, 96, 0.35);
}

/* ---- Body / nav ---- */
.ayuda-drawer__body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ayuda-drawer__nav {
  flex-shrink: 0;
  display: flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
  padding: 0.55rem 1rem;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  scrollbar-width: thin;
}
.ayuda-drawer__nav-btn {
  flex-shrink: 0;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
html.theme-f5 .ayuda-drawer__nav-btn {
  background: rgba(245, 239, 232, 0.7);
  color: var(--muted);
}
.ayuda-drawer__nav-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}
html.theme-f5 .ayuda-drawer__nav-btn:hover {
  background: rgba(222, 184, 150, 0.22);
}
.ayuda-drawer__nav-btn.is-active {
  border-color: rgba(110, 231, 183, 0.45);
  background: rgba(110, 231, 183, 0.14);
  color: var(--text);
}
html.theme-f5 .ayuda-drawer__nav-btn.is-active {
  border-color: rgba(156, 120, 96, 0.45);
  background: rgba(156, 120, 96, 0.18);
  color: var(--text);
}

.ayuda-drawer__scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem 1rem 1.25rem;
}

/* ---- Intro + cards ---- */
.ayuda-apartado-intro {
  margin: 0 0 1rem;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  background: rgba(110, 231, 183, 0.1);
  border: 1px solid rgba(110, 231, 183, 0.22);
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--text);
}
html.theme-f5 .ayuda-apartado-intro {
  background: rgba(22, 101, 52, 0.08);
  border-color: rgba(22, 101, 52, 0.22);
  color: var(--text);
}

.ayuda-articulo-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.ayuda-articulo-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
html.theme-f5 .ayuda-articulo-card {
  background: rgba(245, 239, 232, 0.85);
  border-color: rgba(60, 54, 48, 0.1);
  box-shadow: 4px 4px 10px rgba(190, 180, 168, 0.25), -2px -2px 8px var(--neo-l);
}
.ayuda-articulo-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(110, 231, 183, 0.3);
}
html.theme-f5 .ayuda-articulo-card:hover {
  background: rgba(222, 184, 150, 0.18);
  border-color: rgba(156, 120, 96, 0.35);
}
.ayuda-articulo-card__title {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--text);
}
.ayuda-articulo-card__teaser {
  display: block;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--muted);
}

/* ---- Artículo detalle ---- */
.ayuda-articulo-detalle {
  animation: ayudaFadeIn 0.2s ease;
}
@keyframes ayudaFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.ayuda-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  padding: 0.25rem 0;
  border: none;
  background: none;
  color: var(--ok);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
html.theme-f5 .ayuda-back {
  color: #166534;
}
.ayuda-back:hover {
  text-decoration: underline;
}
.ayuda-articulo-detalle h3 {
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
  line-height: 1.3;
  color: var(--text);
}
.ayuda-articulo-detalle p {
  margin: 0 0 0.65rem;
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--text);
  opacity: 0.92;
}

.ayuda-steps {
  margin: 0 0 0.85rem;
  padding: 0;
  list-style: none;
  counter-reset: ayuda-step;
}
.ayuda-steps li {
  position: relative;
  margin-bottom: 0.55rem;
  padding-left: 2.1rem;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--text);
  counter-increment: ayuda-step;
}
.ayuda-steps li::before {
  content: counter(ayuda-step);
  position: absolute;
  left: 0;
  top: 0.05rem;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 50%;
  background: rgba(110, 231, 183, 0.18);
  border: 1px solid rgba(110, 231, 183, 0.35);
  color: var(--ok);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.45rem;
  text-align: center;
}
html.theme-f5 .ayuda-steps li::before {
  background: rgba(22, 101, 52, 0.12);
  border-color: rgba(22, 101, 52, 0.3);
  color: #166534;
}

/* ---- Cajas informativas ---- */
.ayuda-box {
  margin: 0.85rem 0;
  padding: 0.7rem 0.8rem;
  border-radius: 8px;
  font-size: 0.82rem;
  line-height: 1.48;
}
.ayuda-box--ok {
  background: rgba(110, 231, 183, 0.12);
  border: 1px solid rgba(110, 231, 183, 0.28);
  color: var(--text);
}
html.theme-f5 .ayuda-box--ok {
  background: rgba(22, 101, 52, 0.1);
  border-color: rgba(22, 101, 52, 0.25);
}
.ayuda-box--tip {
  background: rgba(147, 197, 253, 0.12);
  border: 1px solid rgba(147, 197, 253, 0.28);
  color: var(--text);
}
html.theme-f5 .ayuda-box--tip {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.22);
}
.ayuda-box--warn {
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.3);
  color: var(--text);
}
html.theme-f5 .ayuda-box--warn {
  background: rgba(161, 98, 7, 0.1);
  border-color: rgba(161, 98, 7, 0.28);
}
.ayuda-box strong {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.ayuda-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.85rem;
}
.ayuda-actions .btn {
  font-size: 0.82rem;
  padding: 0.4rem 0.75rem;
}

.ayuda-empty {
  padding: 1.5rem 0.5rem;
  text-align: center;
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.5;
}

.ayuda-drawer__foot {
  flex-shrink: 0;
  padding: 0.55rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.7rem;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 480px) {
  :root {
    --ayuda-drawer-w: 100%;
  }
  .ayuda-solapa {
    top: auto;
    bottom: 6.5rem;
    width: 1.7rem;
    padding: 0.65rem 0.2rem;
  }
  .ayuda-solapa__text {
    font-size: 0.68rem;
  }
  body.ayuda-drawer-open .ayuda-solapa {
    right: 0;
    left: auto;
  }
}

body.ayuda-drawer-open {
  overflow: hidden;
}
