/* =========================================================================
   AUVRYX · La web como aplicación
   Se carga después de styles.css y v3.css.
   Capas: fondo de escritorio → ventana de la app → barra y secciones → paneles y avisos.
   ========================================================================= */

:root {
  --desk: #050508;          /* «escritorio» alrededor de la ventana */
  --win: #0b0b10;           /* ventana */
  --win-line: rgba(255, 255, 255, 0.09);
  --bar-h: 56px;
  --win-gap: 12px;
  --tabbar-h: 64px;
}
body {
  background:
    radial-gradient(900px 600px at 85% -10%, rgba(124, 58, 237, 0.22), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(91, 33, 182, 0.18), transparent 60%),
    var(--desk);
  background-attachment: fixed;
}
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 3px; }

/* =========================================================================
   APERTURA
   ========================================================================= */
html.boot-run .display.is-split .w > span { animation-play-state: paused; }

/* =========================================================================
   VENTANA DE LA APP
   ========================================================================= */
.app {
  position: relative; max-width: 1480px; min-height: calc(100vh - var(--win-gap) * 2);
  margin: var(--win-gap) auto; background: var(--win);
  border: 1px solid var(--win-line); border-radius: 22px; overflow: clip;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 50px 120px -40px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(0, 0, 0, 0.6);
  display: flex; flex-direction: column;
}
@media (min-width: 1504px) { .app { margin-inline: auto; } }
@media (max-width: 1503px) and (min-width: 768px) { .app { margin-inline: var(--win-gap); } }

/* ---------- Barra superior fina ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--bar-h);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 0 14px 0 18px;
  background: rgba(11, 11, 16, 0.86); backdrop-filter: saturate(150%) blur(16px); -webkit-backdrop-filter: saturate(150%) blur(16px);
  border-bottom: 1px solid var(--win-line);
}
.topbar-logo { justify-self: start; font-size: 15px; letter-spacing: 0.22em; gap: 9px; border-radius: 10px; padding: 6px 8px; margin-left: -8px; }
.topbar-logo .logo-mark-img { height: 22px; }
.topnav { position: relative; display: inline-flex; gap: 2px; padding: 4px; border-radius: 13px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--win-line); isolation: isolate; }
.topnav a {
  position: relative; z-index: 1; padding: 7px 14px; border-radius: 9px; font-size: 14.5px; font-weight: 600;
  color: var(--muted); text-decoration: none; white-space: nowrap; transition: color .18s ease, background-color .18s ease;
}
.topnav a[aria-current="page"] { color: #fff; }
.topnav-thumb {
  position: absolute; z-index: 0; left: 0; top: 4px; bottom: 4px; width: 0; border-radius: 9px;
  background: var(--surface-3); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06) inset, 0 6px 16px -8px rgba(0, 0, 0, 0.8);
  transition: transform 260ms var(--ease-in-out), width 260ms var(--ease-in-out), opacity .2s ease;
}
@media (hover: hover) and (pointer: fine) { .topnav a:not([aria-current="page"]):hover { color: var(--text); background: rgba(255, 255, 255, 0.05); } }
.topnav a:active { transform: scale(0.97); }
.topbar-actions { justify-self: end; display: flex; align-items: center; gap: 8px; }
.topbar-cta { min-height: 38px; padding: 7px 16px; font-size: 14.5px; }

.icon-btn {
  position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; flex: none;
  border: 1px solid var(--win-line); background: rgba(255, 255, 255, 0.03); color: var(--muted); cursor: pointer;
  transition: color .18s ease, border-color .18s ease, background-color .18s ease, transform var(--dur-press) var(--ease-out);
}
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:active { transform: scale(0.95); }
@media (hover: hover) and (pointer: fine) { .icon-btn:hover { color: #fff; border-color: rgba(139, 92, 246, 0.6); background: var(--accent-soft); } }

/* Ayuda emergente: dice qué hace un botón de solo icono (ratón y teclado) */
[data-tip]::after {
  content: attr(data-tip); position: absolute; top: calc(100% + 8px); right: 0; z-index: 60; pointer-events: none;
  padding: 6px 10px; border-radius: 8px; white-space: nowrap; font-size: 13px; font-weight: 600; color: #fff;
  background: #22202d; border: 1px solid var(--line-strong); box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.9);
  opacity: 0; transform: translateY(-3px); transition: opacity 120ms ease, transform 120ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { [data-tip]:hover::after { opacity: 1; transform: none; transition-delay: 350ms; } }
[data-tip]:focus-visible::after { opacity: 1; transform: none; }

/* ---------- Secciones ---------- */
.views { flex: 1; outline: none; }
html.js .view { display: none; }
html.js .view.is-active,
html.js:not(.app-ready)[data-route="inicio"] #view-inicio,
html.js:not(.app-ready)[data-route="servicios"] #view-servicios,
html.js:not(.app-ready)[data-route="demos"] #view-demos,
html.js:not(.app-ready)[data-route="como-trabajo"] #view-como-trabajo,
html.js:not(.app-ready)[data-route="contacto"] #view-contacto { display: block; }
.view { padding: clamp(24px, 3.4vw, 48px) clamp(18px, 4vw, 56px) clamp(40px, 5vw, 72px); max-width: 1360px; margin: 0 auto; width: 100%; }
.view.is-enter-fwd  { animation: step-in-fwd var(--dur-ui) var(--ease-out); }
.view.is-enter-back { animation: step-in-back var(--dur-ui) var(--ease-out); }
.view.is-enter-fade { animation: fade-in 160ms ease; }
.view-head { display: grid; gap: 12px; margin-bottom: clamp(24px, 3vw, 40px); max-width: 820px; }
.view-head h1 { outline: none; }
.view-head h1:focus-visible, .home-title:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 6px; }
.home-title:focus { outline: none; }
.view-sub { color: var(--muted); font-size: 18px; max-width: 46ch; }
.back {
  justify-self: start; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 12px 6px 8px;
  border-radius: 10px; border: 1px solid var(--win-line); color: var(--muted); font-size: 14.5px; font-weight: 600; text-decoration: none;
  transition: color .18s ease, border-color .18s ease, transform var(--dur-press) var(--ease-out);
}
.back svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform var(--dur-ui) var(--ease-out); }
.back:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .back:hover { color: #fff; border-color: var(--line-strong); } .back:hover svg { transform: translateX(-3px); } }

/* =========================================================================
   INICIO — pantalla de inicio de la app
   ========================================================================= */
.view-home { max-width: 1400px; padding-top: clamp(20px, 3vw, 40px); padding-bottom: clamp(24px, 3vw, 40px); }
.home-grid {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: clamp(28px, 4vw, 64px); align-items: center;
  min-height: calc(100vh - var(--win-gap) * 2 - var(--bar-h) - 150px);
}
.home-title { font-size: clamp(36px, 4.5vw, 70px); line-height: 0.94; margin-bottom: 18px; max-width: 13ch; outline: none; }
.home-lead { font-size: clamp(16.5px, 1.35vw, 19px); color: #cfcde0; max-width: 34em; margin-bottom: 26px; }
.view-home .hero3-kicker { margin-bottom: 14px; }
.view-home .showcase-stage { min-height: 372px; }

/* Acciones principales: una lista con jerarquía, no tarjetas iguales */
.actions { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 8px; max-width: 560px; }
.action {
  position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr) 24px; align-items: center; gap: 14px;
  min-height: 64px; padding: 10px 16px 10px 10px; border-radius: 16px; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--win-line);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
  transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease, transform var(--dur-press) var(--ease-out);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.action-ico { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--surface-3); color: var(--accent-text); }
.action-ico svg, .action-go { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.action-ico svg { width: 21px; height: 21px; }
.action-txt { display: grid; gap: 1px; min-width: 0; }
.action-txt strong { font-size: 16.5px; line-height: 1.3; }
.action-txt small { font-size: 14px; color: var(--muted); line-height: 1.35; }
.action-go { width: 22px; height: 22px; color: var(--faint); transition: transform var(--dur-ui) var(--ease-out), color .18s ease; }
.action:active { transform: scale(0.985); }
.action:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.action-primary { background: var(--accent-strong); border-color: rgba(196, 181, 253, 0.5); box-shadow: 0 18px 40px -18px rgba(124, 58, 237, 0.9), 0 1px 0 rgba(255, 255, 255, 0.18) inset; }
.action-primary .action-ico { background: rgba(255, 255, 255, 0.16); color: #fff; }
.action-primary .action-txt small { color: rgba(255, 255, 255, 0.82); }
.action-primary .action-go { color: #fff; }
.action-primary:active { background: #6d28d9; }
@media (hover: hover) and (pointer: fine) {
  .action:hover { background: var(--surface-2); border-color: rgba(139, 92, 246, 0.55); }
  .action:hover .action-go { transform: translateX(3px); color: var(--text); }
  .action-primary:hover { background: #8b4cf7; border-color: #c4b5fd; }
  .action-primary:hover .action-go { color: #fff; }
}
.view-home .hero3-founder { font-size: 14.5px; }

/* =========================================================================
   SERVICIOS
   ========================================================================= */
.svc-rows { list-style: none; margin: 0 0 32px; padding: 0; border-bottom: 1px solid var(--line-strong); }
.svc-rows li { border-top: 1px solid var(--line-strong); }
.svc-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 2px 18px;
  padding: clamp(16px, 2vw, 24px) 6px; color: var(--text); text-decoration: none; border-radius: 10px;
  transition: background-color .2s ease;
}
.svc-row .svc-name { grid-column: 1; font-size: clamp(36px, 5.4vw, 80px); }
.svc-row .svc-sub { grid-column: 1; }
.svc-open {
  grid-column: 2; grid-row: 1 / span 2; align-self: center; display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: 999px; border: 1px solid var(--line-strong); font-weight: 650; font-size: 15px; color: var(--muted);
  transition: color .18s ease, border-color .18s ease, background-color .18s ease;
}
.svc-open svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform var(--dur-ui) var(--ease-out); }
.svc-row:active .svc-open { transform: scale(0.97); }
.svc-row:focus-visible { outline: 2px solid var(--accent-text); outline-offset: -2px; }
@media (hover: hover) and (pointer: fine) {
  .svc-row:hover { background: rgba(255, 255, 255, 0.025); }
  .svc-row:hover .svc-name { color: var(--accent-text); }
  .svc-row:hover .svc-open { color: #fff; border-color: var(--accent); background: var(--accent-soft); }
  .svc-row:hover .svc-open svg { transform: translateX(3px); }
}
#view-servicios .flow { margin: clamp(40px, 6vw, 72px) calc(clamp(18px, 4vw, 56px) * -1) calc(clamp(40px, 5vw, 72px) * -1); border-radius: 0; }
#view-servicios .flow-visual { top: calc(var(--bar-h) + 24px); }

/* =========================================================================
   DEMOS
   ========================================================================= */
.case-switch {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; max-width: 620px; padding: 5px; margin-bottom: 18px;
  border-radius: 16px; background: var(--surface); border: 1px solid var(--win-line); isolation: isolate;
}
.case-switch button {
  position: relative; z-index: 1; display: grid; gap: 1px; text-align: left; padding: 10px 14px; min-height: 58px;
  border: 0; border-radius: 12px; background: transparent; color: var(--muted); cursor: pointer;
  transition: color .2s ease, transform var(--dur-press) var(--ease-out); -webkit-tap-highlight-color: transparent;
}
.case-switch strong { font-size: 16px; }
.case-switch small { font-size: 13.5px; opacity: 0.85; }
.case-switch button[aria-selected="true"] { color: #fff; }
.case-switch button:active { transform: scale(0.98); }
.case-switch button:focus-visible { outline: 2px solid #fff; outline-offset: -3px; }
@media (hover: hover) and (pointer: fine) { .case-switch button[aria-selected="false"]:hover { color: var(--text); } }
.case-switch-thumb {
  position: absolute; z-index: 0; top: 5px; bottom: 5px; left: 5px; width: calc(50% - 5px); border-radius: 12px;
  background: var(--accent-strong); box-shadow: 0 10px 26px -12px var(--accent-glow); transition: transform 280ms var(--ease-in-out);
}
.case-switch[data-active="1"] .case-switch-thumb { transform: translateX(100%); }
#view-demos .case { margin-bottom: 32px; }
#view-demos .case.is-enter-fwd { animation: step-in-fwd var(--dur-ui) var(--ease-out); }
#view-demos .case.is-enter-back { animation: step-in-back var(--dur-ui) var(--ease-out); }
#view-demos .case.is-enter-fade { animation: fade-in 160ms ease; }
#view-demos .case-card { top: calc(var(--bar-h) + 16px); }
#view-demos .demo { scroll-margin-top: calc(var(--bar-h) + 16px); }

/* =========================================================================
   CÓMO TRABAJO
   ========================================================================= */
.path-steps li { padding-right: clamp(12px, 2vw, 28px); }
.path-step {
  display: grid; gap: 10px; padding: 0 0 6px; color: inherit; text-decoration: none; border-radius: 14px;
}
.path-step .path-n { transition: background-color .2s ease, transform var(--dur-press) var(--ease-out), box-shadow .2s ease; }
.path-t { font-size: 19px; color: #dddbe9; max-width: 26ch; }
.path-more { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; font-size: 15px; color: var(--accent-text); }
.path-more::after { content: ""; width: 16px; height: 16px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform var(--dur-ui) var(--ease-out); }
.path-step:active .path-n { transform: scale(0.95); }
.path-step:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 6px; }
@media (hover: hover) and (pointer: fine) {
  .path-step:hover .path-n { background: var(--accent-strong); box-shadow: 0 0 0 6px rgba(139, 92, 246, 0.2); }
  .path-step:hover .path-more::after { transform: translateX(3px); }
}
.view-next { margin-top: clamp(32px, 4vw, 48px); display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; }
.view-next p { font-weight: 650; font-size: 18px; }
@media (max-width: 760px) {
  .path-steps li { padding: 0; }
  .path-step { grid-template-columns: 56px 1fr; column-gap: 16px; align-items: start; }
  .path-step .path-n { grid-row: 1 / span 2; margin: 0; }
}

/* =========================================================================
   CONTACTO
   ========================================================================= */
.contact-hero { display: grid; gap: 18px; max-width: 900px; padding: clamp(8px, 2vw, 24px) 0 clamp(24px, 4vw, 48px); }
.contact-hero .display-l { max-width: 14ch; }
.contact-hero .contact-actions { align-items: flex-start; flex-direction: row; flex-wrap: wrap; margin-top: 10px; }
.view-cases { padding: 0 clamp(18px, 4vw, 56px) 48px; max-width: 1360px; margin: 0 auto; }

.app-foot { display: flex; flex-wrap: wrap; gap: 4px 22px; padding: 18px clamp(18px, 4vw, 56px) 22px; border-top: 1px solid var(--win-line); color: var(--faint); font-size: 13.5px; }

/* =========================================================================
   PANELES LATERALES (detalles y diagnóstico)
   ========================================================================= */
html.panel-locked, html.quiz-locked { overflow: hidden; }
.side-panel, .quiz-dialog {
  position: fixed; inset: var(--win-gap) var(--win-gap) var(--win-gap) auto; margin: 0;
  width: min(500px, calc(100vw - var(--win-gap) * 2)); height: calc(100dvh - var(--win-gap) * 2); max-height: none; max-width: none;
  padding: 0; border: 0; background: transparent; color: var(--text); overflow: visible;
  transform: translateX(calc(100% + 32px)); opacity: 1;
  transition: transform 340ms var(--ease-drawer);
}
.side-panel.is-open, .quiz-dialog.is-open { transform: none; }
.side-panel.is-closing, .quiz-dialog.is-closing { transform: translateX(calc(100% + 32px)); opacity: 1; transition: transform 200ms var(--ease-out); }
.side-panel::backdrop, .quiz-dialog::backdrop {
  background: rgba(3, 2, 8, 0.5); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  opacity: 0; transition: opacity 220ms ease;
}
.side-panel.is-open::backdrop, .quiz-dialog.is-open::backdrop { opacity: 1; }
.quiz-dialog .quiz { height: 100%; max-height: none; border-radius: 22px; }
.side-inner {
  height: 100%; display: flex; flex-direction: column; border-radius: 22px; overflow: hidden;
  background: linear-gradient(180deg, #19182222, transparent 30%), #121118; border: 1px solid rgba(139, 92, 246, 0.35);
  box-shadow: -30px 0 80px -30px rgba(0, 0, 0, 0.9), 0 0 100px -50px var(--accent-glow);
}
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 14px 14px 22px; border-bottom: 1px solid var(--win-line); }
.side-crumb { font-size: 14px; font-weight: 650; color: var(--accent-text); }
.side-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 26px 22px 28px; }
.side-content { display: grid; gap: 16px; }
.side-content.is-swap { animation: step-in-fwd var(--dur-ui) var(--ease-out); }
.side-title { font-family: var(--display); font-weight: 400; font-size: clamp(30px, 3vw, 40px); line-height: 0.98; letter-spacing: -0.03em; outline: none; }
.side-text { font-size: 18px; color: #dddbe9; }
.side-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.side-points li { position: relative; padding: 10px 12px 10px 40px; border-radius: 12px; background: var(--surface); border: 1px solid var(--win-line); font-size: 15.5px; }
.side-points li::before {
  content: ""; position: absolute; left: 12px; top: 12px; width: 18px; height: 18px; border-radius: 50%;
  background: rgba(134, 239, 172, 0.15) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2386efac' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center / 12px no-repeat;
}
.side-budget { font-size: 14.5px; color: var(--muted); padding: 12px 14px; border-radius: 12px; border: 1px dashed rgba(139, 92, 246, 0.5); background: var(--accent-soft); }
.side-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.side-actions .btn { min-height: 46px; padding: 10px 18px; font-size: 15.5px; }

/* =========================================================================
   VALIDACIÓN Y ESTADOS DE ENVÍO (diagnóstico)
   ========================================================================= */
.quiz-need { flex-basis: 100%; font-size: 14px; color: var(--muted); }
.quiz-error { margin-top: 6px; font-size: 14px; color: #fca5a5; }
.quiz-input[aria-invalid="true"] { border-color: #f87171; box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.2); }
.quiz-retry-row { margin-top: 12px; }
.btn.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-busy::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================================================
   AVISOS
   ========================================================================= */
.toasts { position: fixed; z-index: 300; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; pointer-events: none; width: min(440px, calc(100vw - 24px)); }
.toasts-local { position: absolute; bottom: 20px; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 14px; font-size: 15px; font-weight: 600;
  background: #1f1d2a; color: #fff; border: 1px solid var(--line-strong); box-shadow: 0 18px 40px -14px rgba(0, 0, 0, 0.9);
  animation: toast-in 240ms var(--ease-out);
}
.toast::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-text); }
.toast.is-ok::before { background: var(--ok); }
.toast.is-error { border-color: rgba(248, 113, 113, 0.55); }
.toast.is-error::before { background: #f87171; }
.toast.is-leaving { opacity: 0; transform: translateY(4px); transition: opacity 180ms ease, transform 180ms ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }

/* =========================================================================
   MÓVIL: app a pantalla completa con pestañas abajo
   ========================================================================= */
.tabbar { display: none; }
@media (max-width: 767px) {
  body { background: var(--win); }
  .app { margin: 0; border: 0; border-radius: 0; box-shadow: none; min-height: 100vh; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .topbar { grid-template-columns: 1fr auto; padding: 0 10px 0 16px; height: 54px; }
  .topnav { display: none; }
  .topbar-actions .icon-btn { width: 44px; height: 44px; }
  .topbar-cta { min-height: 40px; }
  .view { padding: 20px 16px 36px; }
  .view-sub { font-size: 17px; }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: grid; grid-template-columns: repeat(5, 1fr);
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 6px 4px env(safe-area-inset-bottom);
    background: rgba(11, 11, 16, 0.94); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--win-line);
  }
  .tabbar a {
    display: grid; justify-items: center; align-content: center; gap: 3px; min-height: 48px; border-radius: 12px;
    color: var(--faint); text-decoration: none; font-size: 11.5px; font-weight: 650; -webkit-tap-highlight-color: transparent;
    transition: color .18s ease, transform var(--dur-press) var(--ease-out);
  }
  .tabbar svg { width: 23px; height: 23px; padding: 3px 12px; box-sizing: content-box; border-radius: 999px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; transition: background-color .2s ease; }
  .tabbar a[aria-current="page"] { color: #fff; }
  .tabbar a[aria-current="page"] svg { background: var(--accent-strong); }
  .tabbar a:active { transform: scale(0.94); }
  .tabbar a:focus-visible { outline-offset: -2px; }
  .help-launcher { bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom)) !important; }
  .toasts { bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); }
  .app-foot { padding-bottom: 18px; }

  /* Inicio en móvil: titular, acciones y la demo protagonista */
  .home-grid { grid-template-columns: 1fr; min-height: 0; gap: 22px; }
  .home-title { font-size: clamp(34px, 9.4vw, 44px); max-width: none; }
  .home-lead { margin-bottom: 20px; }
  .actions { max-width: none; }
  .action { min-height: 68px; }

  /* Paneles: hoja que sube desde abajo, ajustada al espacio disponible */
  .side-panel, .quiz-dialog {
    inset: auto 0 0 0; width: 100%; height: auto; max-height: 90dvh;
    transform: translateY(100%); transition: transform 340ms var(--ease-drawer);
  }
  .side-panel.is-open, .quiz-dialog.is-open { transform: none; }
  .side-panel.is-closing, .quiz-dialog.is-closing { transform: translateY(100%); }
  .side-inner, .quiz-dialog .quiz { border-radius: 24px 24px 0 0; max-height: 90dvh; height: auto; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom); }
  .quiz-dialog .quiz { height: 90dvh; }
  .side-head::before { content: ""; position: absolute; left: 50%; top: 7px; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: rgba(255, 255, 255, 0.2); }
  .side-head { position: relative; padding-top: 18px; }
  .side-actions .btn { flex: 1 1 100%; }
  #view-servicios .flow { margin-inline: -16px; }
  .svc-row { grid-template-columns: minmax(0, 1fr) 44px; }
  .svc-row .svc-name { font-size: min(9.4vw, 42px); }
  .svc-open { font-size: 0; padding: 0; width: 44px; height: 44px; justify-content: center; gap: 0; }
  .svc-open svg { width: 20px; height: 20px; }
  .case-switch { max-width: none; }
  .case-switch small { display: none; }
  .case-switch button { min-height: 50px; text-align: center; justify-items: center; }
}
@media (max-width: 380px) { .topbar-cta { padding-inline: 12px; font-size: 14px; } }

/* =========================================================================
   MOVIMIENTO REDUCIDO: sin apertura, sin desplazamientos; fundidos breves
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  .boot { display: none !important; }
  .topnav-thumb, .case-switch-thumb { transition: opacity .2s ease; }
  .side-panel, .quiz-dialog, .side-panel.is-closing, .quiz-dialog.is-closing { transform: none !important; opacity: 0; transition: opacity 160ms ease; }
  .side-panel.is-open, .quiz-dialog.is-open { opacity: 1; }
  .side-content.is-swap { animation: fade-in 160ms ease; }
  #view-demos .case.is-enter-fwd, #view-demos .case.is-enter-back { animation: fade-in 160ms ease; }
  .toast { animation: fade-in 160ms ease; }
  .btn.is-busy::after { animation-duration: 1.4s; }
  .action:active, .tabbar a:active, .back:active { transform: none; }
}

/* Dudas: botón flotante en ordenador; en móvil, icono en la barra superior (no tapa contenido) */
.topbar-help { display: none; }
@media (max-width: 767px) {
  .topbar-help { display: grid; }
  .topbar-wa { display: none; }
  .help-launcher { display: none !important; }
  .help-panel { bottom: calc(var(--tabbar-h) + 10px + env(safe-area-inset-bottom)) !important; max-height: calc(100dvh - var(--tabbar-h) - 80px) !important; z-index: 80; }
  .path-steps li { display: block; }
}
