/* Barra lateral: curva crema con el logo, tarjetas de vidrio abajo, tarjeta de la unidad y luz dorada que sube por el borde derecho.
   Va después de app.css y solo cambia la barra. */
@property --y { syntax: "<percentage>"; inherits: false; initial-value: -30%; }

/* ---------- escritorio ---------- */
@media (min-width: 881px) {
  .rail {
    padding-top: 0; gap: 10px;
    background:
      linear-gradient(180deg, transparent 0, rgb(255 246 208 / .95) var(--y), #c6b06a calc(var(--y) + 12%), transparent calc(var(--y) + 30%)) right top / 3px 100% no-repeat,
      linear-gradient(rgb(198 176 106 / .22), rgb(198 176 106 / .22)) right top / 3px 100% no-repeat,
      radial-gradient(240px 240px at 0% 80%, rgb(198 176 106 / .2), transparent 70%),
      linear-gradient(165deg, light-dark(#44715a, #2f503e), light-dark(#2f4d3b, #243f2f) 55%, light-dark(#243d2e, #1b3024));
    /* separada del contenido por una sombra profunda que «respira» muy despacio (con «reducir movimiento» queda quieta, en el valor medio) */
    border-right: 0;
    box-shadow: 24px 0 49px -11px rgb(8 28 18 / .64), 6px 0 14px -4px rgb(0 0 0 / .37);
    animation: borde-sube 5s linear infinite, respira 5s ease-in-out infinite;
  }
  @keyframes borde-sube { from { --y: -30%; } to { --y: 100%; } }
  @keyframes respira {
    0%, 100% { box-shadow: 18px 0 38px -12px rgb(8 28 18 / .5), 5px 0 12px -4px rgb(0 0 0 / .3); }
    50% { box-shadow: 30px 0 60px -10px rgb(8 28 18 / .78), 8px 0 16px -4px rgb(0 0 0 / .45); }
  }

  /* encabezado: curva crema, logo grande y nombre */
  .brand { position: relative; display: block; flex: none; height: 178px; margin: 0 -14px; padding: 0; border-bottom: 0; text-align: center; transition: height .5s var(--spring), margin .45s var(--spring); }
  .burbuja {
    position: absolute; left: -34%; right: -34%; top: -148px; height: 326px; border-radius: 50%;
    background: radial-gradient(circle at 50% 78%, #fffdf5, #f6f0dc 70%, #efe6c6);
    box-shadow: 0 22px 30px -16px rgb(0 0 0 / .5), 0 0 0 1px rgb(198 176 106 / .35);
    transition: top .5s var(--spring), height .5s var(--spring);
  }
  .brand-logo { position: absolute; left: 50%; top: 18px; width: 80px; height: 80px; transform: translateX(-50%); box-shadow: 0 0 0 4px rgb(198 176 106 / .3), 0 14px 22px -8px rgb(0 0 0 / .55); transition: transform .6s var(--spring), width .5s var(--spring), height .5s var(--spring), top .5s var(--spring); }
  .brand:hover .brand-logo { transform: translateX(-50%) rotate(-6deg) scale(1.04); }
  .brand > div { position: absolute; left: 0; right: 0; top: 108px; max-width: none; padding: 0 12px; }
  .brand b { color: #24432f; font-size: 20px; }
  .brand small { color: #5b5f54; font-size: 12px; }

  /* botones del menú: el activo es una pastilla crema */
  .nav-sec { text-transform: uppercase; letter-spacing: .12em; font-size: 11px; padding-top: 11px; }
  .nav a[aria-current="page"] { background: #fcf9ee; color: #24432f; box-shadow: 0 10px 18px -10px rgb(0 0 0 / .6); }
  .nav a[aria-current="page"]::before { display: none; }
  .nav a[aria-current="page"] .tile { box-shadow: 0 0 0 1.5px rgb(47 79 58 / .22); }
  .nav a[aria-current="page"]:hover { background-image: radial-gradient(130px circle at var(--x, 50%) 50%, rgb(198 176 106 / .45), transparent 72%) !important; }

  /* abajo: tarjetas de vidrio y tarjeta de la unidad */
  .rail-foot { gap: 8px; }
  .foot-lab { margin: 0; padding: 0 8px; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .12em; color: #d8c789; transition: opacity .25s var(--ease); }
  .tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .tl-btn {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 11px 6px 10px; border-radius: 14px; cursor: pointer;
    border: 1px solid rgb(255 255 255 / .16); background: rgb(255 255 255 / .09); color: var(--rail-ink); font-size: 12px; font-weight: 500;
    -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); transition: transform .2s var(--ease), border-color .2s var(--ease), opacity .2s;
  }
  .tl-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .tl-btn:hover { border-color: rgb(198 176 106 / .6); transform: translateY(-1px); background-image: radial-gradient(110px circle at var(--x, 50%) 50%, rgb(198 176 106 / .5), transparent 72%) !important; }
  .tl-btn:active { transform: scale(.97); }
  .tl-btn[aria-pressed="false"] { opacity: .72; }
  .uf-card {
    position: relative; overflow: hidden; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 14px; cursor: pointer; text-align: left;
    background: #fcf9ee; color: #1c2a20; box-shadow: 0 12px 20px -12px rgb(0 0 0 / .6); transition: transform .2s var(--ease);
  }
  .uf-card:hover { transform: translateY(-1px); background-image: radial-gradient(130px circle at var(--x, 50%) 50%, rgb(198 176 106 / .45), transparent 72%) !important; }
  .uf-card:active { transform: scale(.98); }
  .uf-card .av { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; background: linear-gradient(135deg, #5f7a5a, #2f4f3a); color: #f6f0dc; font-weight: 700; font-size: 12.5px; letter-spacing: .02em; }
  .uf-tx b { display: block; font-size: 14px; font-weight: 650; line-height: 1.25; }
  .uf-tx small { display: block; font-size: 11.5px; color: #5b5f54; }
  .rail-foot .priv { background: none; border: 0; padding: 0 6px; font-size: 11px; gap: 6px; }
  .rail-foot .priv svg { width: 14px; height: 14px; }

  @media (min-width: 881px) and (max-height: 1100px) { .rail-foot .priv { display: none; } }
/* pantallas bajas: todo más compacto para que no haga falta desplazar la barra */
@media (min-width: 881px) and (max-height: 820px) {
  .brand { height: 150px; }
  .burbuja { top: -176px; }
  .brand-logo { width: 62px; height: 62px; top: 14px; }
  .brand > div { top: 84px; }
  .brand b { font-size: 18px; }
  .rail-foot .priv { display: none; }
  .tl-btn { flex-direction: row; justify-content: center; padding: 8px 6px; gap: 7px; }
  .tl-btn svg { width: 17px; height: 17px; }
}

/* barra plegada */
  .app[data-rail="min"] .rail { gap: 12px; }
  .app[data-rail="min"] .brand { height: 104px; margin: 0 -15px; }
  .app[data-rail="min"] .burbuja { top: -104px; height: 196px; }
  .app[data-rail="min"] .brand-logo { width: 48px; height: 48px; top: 20px; }
  .app[data-rail="min"] .foot-lab { opacity: 0; height: 0; overflow: hidden; }
  .app[data-rail="min"] .tiles { grid-template-columns: 1fr; }
  .app[data-rail="min"] .tl-btn { padding: 10px 0; }
  .app[data-rail="min"] .tl-btn span { display: none; }
  .app[data-rail="min"] .uf-card { justify-content: center; padding: 6px; }
  .app[data-rail="min"] .uf-tx { display: none; }
}

/* ---------- celular: barra superior simple ---------- */
@media (max-width: 880px) {
  .burbuja { display: none; }
  .brand { display: flex; position: static; height: auto; margin: 0; padding: 0 2px 10px; text-align: left; }
  .brand-logo { position: static; transform: none; box-shadow: 0 0 0 1.5px var(--gold-2); }
  .brand > div { position: static; padding: 0; }
  .brand b { color: var(--deco-crema); font-size: 17px; }
  .brand small { color: var(--rail-muted); }
}

@media (prefers-reduced-motion: reduce) { .rail { animation: none; --y: 35%; } }

/* ---------- encabezado «Doble línea dorada» con relieve (solo barra abierta, escritorio) ----------
   Papel crema con curvas doradas biseladas y olas verdes, dibujado como imagen SVG de fondo. En la barra plegada y en el celular sigue el diseño anterior. */
@media (min-width: 881px) {
  /* --h = alto del encabezado: 236 px en pantallas altas y baja solo lo que hace falta para que la barra no se desplace (el resto escala con él) */
  .app[data-rail="open"] { --h: clamp(118px, calc(100vh - 753px), 236px); }
  .app[data-rail="open"] .brand { height: var(--h); }
  .app[data-rail="open"] .burbuja {
    left: 0; right: 0; top: 0; height: calc(100% + 28px); border-radius: 0; box-shadow: none;
    background: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20262%20264%22%20preserveAspectRatio%3D%22none%22%3E%3Cdefs%3E%3ClinearGradient%20id%3D%22o%22%20x1%3D%220%22%20y1%3D%220%22%20x2%3D%221%22%20y2%3D%220%22%3E%3Cstop%20offset%3D%220%22%20stop-color%3D%22%238f6d1a%22%2F%3E%3Cstop%20offset%3D%22.18%22%20stop-color%3D%22%23e9cd6d%22%2F%3E%3Cstop%20offset%3D%22.38%22%20stop-color%3D%22%23fff1a6%22%2F%3E%3Cstop%20offset%3D%22.55%22%20stop-color%3D%22%23c9a437%22%2F%3E%3Cstop%20offset%3D%22.78%22%20stop-color%3D%22%23f0d77c%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%238f6d1a%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22p%22%20x1%3D%220%22%20y1%3D%220%22%20x2%3D%221%22%20y2%3D%221%22%3E%3Cstop%20offset%3D%220%22%20stop-color%3D%22%23fcf9ef%22%2F%3E%3Cstop%20offset%3D%22.45%22%20stop-color%3D%22%23f1e9d0%22%2F%3E%3Cstop%20offset%3D%22.7%22%20stop-color%3D%22%23fbf7ea%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23ece2c4%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22v1%22%20x1%3D%220%22%20y1%3D%220%22%20x2%3D%221%22%20y2%3D%220%22%3E%3Cstop%20offset%3D%220%22%20stop-color%3D%22%230c3a26%22%2F%3E%3Cstop%20offset%3D%22.5%22%20stop-color%3D%22%231b5c3f%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%230d3b27%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22v2%22%20x1%3D%220%22%20y1%3D%220%22%20x2%3D%221%22%20y2%3D%220%22%3E%3Cstop%20offset%3D%220%22%20stop-color%3D%22%232c7b53%22%2F%3E%3Cstop%20offset%3D%22.5%22%20stop-color%3D%22%2343a173%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%232b7a52%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22f%22%20x1%3D%220%22%20y1%3D%220%22%20x2%3D%220%22%20y2%3D%221%22%3E%3Cstop%20offset%3D%220%22%20stop-color%3D%22%23fff%22%2F%3E%3Cstop%20offset%3D%22.78%22%20stop-color%3D%22%23fff%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23000%22%2F%3E%3C%2FlinearGradient%3E%3Cmask%20id%3D%22m%22%3E%3Crect%20width%3D%22262%22%20height%3D%22264%22%20fill%3D%22url(%23f)%22%2F%3E%3C%2Fmask%3E%3CclipPath%20id%3D%22c%22%3E%3Cpath%20d%3D%22M0%200%20H262%20V170%20C235%20198%20200%20218%20148%20222%20C90%20226%2030%20200%200%20140%20Z%22%2F%3E%3C%2FclipPath%3E%3Cfilter%20id%3D%22r%22%20x%3D%220%22%20y%3D%220%22%20width%3D%22262%22%20height%3D%22264%22%20filterUnits%3D%22userSpaceOnUse%22%3E%3CfeTurbulence%20type%3D%22fractalNoise%22%20baseFrequency%3D%22.85%22%20numOctaves%3D%222%22%20seed%3D%224%22%2F%3E%3CfeColorMatrix%20type%3D%22matrix%22%20values%3D%220%200%200%200%20.45%20%200%200%200%200%20.38%20%200%200%200%200%20.2%20%200%200%200%20.55%200%22%2F%3E%3C%2Ffilter%3E%3Cfilter%20id%3D%22s%22%20x%3D%22-10%25%22%20y%3D%22-10%25%22%20width%3D%22120%25%22%20height%3D%22160%25%22%3E%3CfeDropShadow%20dx%3D%220%22%20dy%3D%225%22%20stdDeviation%3D%224%22%20flood-color%3D%22%2304180e%22%20flood-opacity%3D%22.55%22%2F%3E%3C%2Ffilter%3E%3CradialGradient%20id%3D%22l%22%20cx%3D%22.3%22%20cy%3D%22.1%22%20r%3D%22.9%22%3E%3Cstop%20offset%3D%220%22%20stop-color%3D%22%23fff%22%20stop-opacity%3D%22.85%22%2F%3E%3Cstop%20offset%3D%22.6%22%20stop-color%3D%22%23fff%22%20stop-opacity%3D%220%22%2F%3E%3C%2FradialGradient%3E%3Cfilter%20id%3D%22g%22%20filterUnits%3D%22userSpaceOnUse%22%20x%3D%22-10%22%20y%3D%2290%22%20width%3D%22290%22%20height%3D%22190%22%3E%3CfeDropShadow%20dx%3D%220%22%20dy%3D%222.6%22%20stdDeviation%3D%222%22%20flood-color%3D%22%23021a0f%22%20flood-opacity%3D%22.7%22%2F%3E%3C%2Ffilter%3E%3C%2Fdefs%3E%3Cg%20mask%3D%22url(%23m)%22%3E%3Cpath%20d%3D%22M0%20150%20C30%20212%2092%20238%20148%20233%20C202%20228%20238%20206%20262%20180%20V264%20H0%20Z%22%20fill%3D%22url(%23v1)%22%2F%3E%3Cpath%20d%3D%22M0%20164%20C34%20220%2095%20244%20148%20240%20C204%20236%20240%20215%20262%20192%22%20fill%3D%22none%22%20stroke%3D%22url(%23v2)%22%20stroke-width%3D%226%22%20stroke-linecap%3D%22round%22%20opacity%3D%22.9%22%2F%3E%3C%2Fg%3E%3Cg%20filter%3D%22url(%23g)%22%3E%3Cpath%20d%3D%22M0%20176%20C36%20230%2096%20252%20150%20247%20C206%20243%20242%20224%20262%20202%22%20fill%3D%22none%22%20stroke%3D%22%235e450c%22%20stroke-width%3D%222.4%22%20transform%3D%22translate(0%201)%22%20stroke-linecap%3D%22round%22%20opacity%3D%22.8%22%2F%3E%3Cpath%20d%3D%22M0%20176%20C36%20230%2096%20252%20150%20247%20C206%20243%20242%20224%20262%20202%22%20fill%3D%22none%22%20stroke%3D%22url(%23o)%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%2F%3E%3C%2Fg%3E%3Cg%20filter%3D%22url(%23g)%22%3E%3Cpath%20d%3D%22M0%20118%20C28%20182%2088%20214%20148%20210%20C202%20206%20238%20186%20262%20158%20L262%20161%20C238%20190%20202%20211%20148%20215%20C88%20219%2028%20187%200%20121%20Z%22%20fill%3D%22%235e450c%22%20transform%3D%22translate(0%201.5)%22%20opacity%3D%22.9%22%2F%3E%3Cpath%20d%3D%22M0%20118%20C28%20182%2088%20214%20148%20210%20C202%20206%20238%20186%20262%20158%20L262%20161%20C238%20190%20202%20211%20148%20215%20C88%20219%2028%20187%200%20121%20Z%22%20fill%3D%22url(%23o)%22%2F%3E%3Cpath%20d%3D%22M0%20118%20C28%20182%2088%20214%20148%20210%20C202%20206%20238%20186%20262%20158%20L262%20161%20C238%20190%20202%20211%20148%20215%20C88%20219%2028%20187%200%20121%20Z%22%20fill%3D%22none%22%20stroke%3D%22%23fff8cf%22%20stroke-width%3D%22.7%22%20opacity%3D%22.85%22%20transform%3D%22translate(0%20-.5)%22%2F%3E%3C%2Fg%3E%3Cg%20filter%3D%22url(%23s)%22%3E%3Cpath%20d%3D%22M0%200%20H262%20V170%20C235%20198%20200%20218%20148%20222%20C90%20226%2030%20200%200%20140%20Z%22%20fill%3D%22url(%23p)%22%2F%3E%3C%2Fg%3E%3Cg%20clip-path%3D%22url(%23c)%22%3E%3Crect%20width%3D%22262%22%20height%3D%22264%22%20filter%3D%22url(%23r)%22%20opacity%3D%22.5%22%2F%3E%3C%2Fg%3E%3Cpath%20d%3D%22M0%200%20H262%20V170%20C235%20198%20200%20218%20148%20222%20C90%20226%2030%20200%200%20140%20Z%22%20fill%3D%22url(%23l)%22%20opacity%3D%22.7%22%2F%3E%3Cg%20filter%3D%22url(%23g)%22%3E%3Cpath%20d%3D%22M0%20140%20C30%20200%2090%20226%20148%20222%20C200%20218%20235%20198%20262%20170%20L262%20175%20C235%20203%20200%20225%20148%20229%20C90%20233%2030%20206%200%20144%20Z%22%20fill%3D%22%235e450c%22%20transform%3D%22translate(0%201.5)%22%20opacity%3D%22.9%22%2F%3E%3Cpath%20d%3D%22M0%20140%20C30%20200%2090%20226%20148%20222%20C200%20218%20235%20198%20262%20170%20L262%20175%20C235%20203%20200%20225%20148%20229%20C90%20233%2030%20206%200%20144%20Z%22%20fill%3D%22url(%23o)%22%2F%3E%3Cpath%20d%3D%22M0%20140%20C30%20200%2090%20226%20148%20222%20C200%20218%20235%20198%20262%20170%20L262%20175%20C235%20203%20200%20225%20148%20229%20C90%20233%2030%20206%200%20144%20Z%22%20fill%3D%22none%22%20stroke%3D%22%23fff8cf%22%20stroke-width%3D%22.7%22%20opacity%3D%22.85%22%20transform%3D%22translate(0%20-.5)%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E") 0 0 / 100% 100% no-repeat;
  }
  .app[data-rail="open"] .brand-logo {
    top: calc(var(--h) * .127); width: calc(var(--h) * .39); height: calc(var(--h) * .39); box-sizing: border-box; object-fit: cover; border: clamp(3px, calc(var(--h) * .0212), 5px) solid transparent; border-radius: 50%;
    background: conic-gradient(from 200deg, #8f6d1a, #f0d77c, #c9a437, #fff1a6, #a98424, #e9cd6d, #8f6d1a) border-box;
    box-shadow: 0 0 0 1px rgb(143 109 26 / .6), 0 12px 20px -8px rgb(40 30 0 / .6);
  }
  .app[data-rail="open"] .nav > .nav-sec:first-child { margin-top: calc(20px - var(--h) * .06); } /* el filamento dorado asoma bajo el encabezado: deja aire para que no cruce «Liquidación» */
  .app[data-rail="open"] .brand > div { top: calc(var(--h) * .575); }
  .app[data-rail="open"] .brand b { color: #1f4a33; font-size: clamp(16px, calc(var(--h) * .102), 24px); letter-spacing: -.01em; }
  .app[data-rail="open"] .brand small { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: clamp(11.5px, calc(var(--h) * .055), 13px); }
}
/* el resto de la barra se compacta por tramos de alto; el encabezado toma lo que sobra en cada tramo */
@media (min-width: 881px) and (max-height: 960px) { .app[data-rail="open"] { --h: clamp(118px, calc(100vh - 658px), 236px); } }
@media (min-width: 881px) and (max-height: 820px) { .app[data-rail="open"] { --h: clamp(118px, calc(100vh - 627px), 236px); } }
@media (min-width: 881px) and (max-height: 740px) { .app[data-rail="open"] { --h: clamp(118px, calc(100vh - 558px), 236px); } }

/* ---------- barra lateral en pantallas bajas: con la tarjeta de Sugerencias sumada, todo se compacta para que la barra no tenga que desplazarse ---------- */
@media (min-width: 881px) and (max-height: 960px) {
  .nav a { padding-top: 4px; padding-bottom: 4px; }
  .nav-sec { padding-top: 7px; padding-bottom: 3px; }
  .foot-lab { display: none; }
  .sug-card, .uf-card { padding-top: 6px; padding-bottom: 6px; }
}
@media (min-width: 881px) and (max-height: 740px) {
  .rail { gap: 6px; padding-bottom: 10px; }
  .nav a { padding-top: 2px; padding-bottom: 2px; }
  .nav-sec { padding-top: 4px; }
  .sug-card, .uf-card { padding-top: 4px; padding-bottom: 4px; }
}
@media (min-width: 881px) and (max-height: 760px) {
  .app[data-rail="min"] .rail { gap: 6px; }
  .app[data-rail="min"] .tl-btn { padding: 6px 0; }
  .app[data-rail="min"] .nav a { padding: 3px 0; }
  .app[data-rail="min"] .nav-sec { padding: 6px 0 3px; }
  .app[data-rail="min"] .sug-card, .app[data-rail="min"] .uf-card { padding: 4px; }
}

/* respaldo para navegadores sin light-dark(): la barra lateral conserva su verde */
@supports not (color: light-dark(red, blue)) {
  @media (min-width: 881px) {
    .rail { background:
      linear-gradient(180deg, transparent 0, rgb(255 246 208 / .95) var(--y), #c6b06a calc(var(--y) + 12%), transparent calc(var(--y) + 30%)) right top / 3px 100% no-repeat,
      linear-gradient(rgb(198 176 106 / .22), rgb(198 176 106 / .22)) right top / 3px 100% no-repeat,
      radial-gradient(240px 240px at 0% 80%, rgb(198 176 106 / .2), transparent 70%),
      linear-gradient(165deg, #44715a, #2f4d3b 55%, #243d2e); }
  }
}
