/* ══ /portal/ — only what belongs to the portal ═════════════════════════
   Everything else (mark, header, WhatsApp button, type, color tokens)
   comes from /styles.css, already loaded. No brand color is redefined
   here: if --signal changes on the site, it changes here too.

   THE ONE IDEA OF THIS PAGE — the phase rail is a GAUGE, not a stepper.
   A transaction isn't a row of on/off lights: you can be 6 of 6 through
   one phase and 1 of 5 through the next. Each segment fills to its real
   ratio, so the rail reads as the actual state of the deal at a glance.
   On load it sweeps left to right, once. That's the whole show; the rest
   of the page stays quiet on purpose.
   ═══════════════════════════════════════════════════════════════════ */

/* ⚠️ `hidden` is NOT enough when a class declares `display`. `.pt-link`
   sets display:inline-block and BEATS the attribute's display:none, so
   the "All my transactions" button showed even when the JS had marked it
   hidden -- and the DOM probe reported it as hidden. Only the screenshot
   caught it. */
[hidden] { display: none !important; }

.pt-main { padding-block: calc(var(--header-h) + 52px) 90px; min-height: 62vh; }
.pt-wrap { max-width: 760px; }

/* ── The mark, three squares ──
   Same geometry as the SVG in the header, rebuilt in CSS so the loading
   state can animate each square on its own. */
.pt-mark {
  display: grid; grid-template-columns: repeat(2, 15px); gap: 4px;
  margin-bottom: 26px;
}
.pt-mark i {
  width: 15px; height: 15px; border-radius: 2px;
  border: 1.6px solid var(--ink); box-sizing: border-box;
}
.pt-mark i:nth-child(2) { grid-column: 1; background: var(--signal); border-color: var(--signal); }
.pt-mark i:nth-child(3) { grid-column: 2; }

/* Loading: the squares take turns holding the signal color. A generic
   spinner would say nothing about who is doing the work. */
.pt-mark--late { margin: 0 auto 14px; }
.pt-mark--late i { animation: pt-latido 1.5s ease-in-out infinite; }
.pt-mark--late i:nth-child(2) { animation-delay: .5s; }
.pt-mark--late i:nth-child(3) { animation-delay: 1s; }
@keyframes pt-latido {
  0%, 66%, 100% { background: transparent; border-color: var(--line-strong); }
  22%, 44%      { background: var(--signal); border-color: var(--signal); }
}

.pt-eyebrow {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .2em;
  text-transform: uppercase; color: var(--sub); margin: 0 0 12px;
}
.pt-h1 {
  font-size: clamp(28px, 4vw, 38px); font-weight: 400; line-height: 1.14;
  letter-spacing: -.015em; margin: 0 0 14px; text-wrap: balance;
}
.pt-sub { font-size: 17px; color: var(--sub); margin: 0 0 28px; max-width: 54ch; }

/* ── Forms ── */
.pt-caja { max-width: 440px; animation: pt-entra .5s cubic-bezier(.16,1,.3,1) both; }
.pt-lbl {
  display: block; font-family: var(--font-mono); font-size: 11px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--sub); margin-bottom: 7px;
}
.pt-campo {
  display: block; width: 100%; padding: 13px 15px; font-size: 16px;
  font-family: var(--font-sans); color: var(--ink); background: var(--card);
  border: 1px solid var(--line-strong); border-radius: 5px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.pt-campo:focus-visible {
  outline: none; border-color: var(--signal);
  box-shadow: 0 0 0 3px rgba(31,143,128,.16);
}
.pt-campo--codigo {
  font-family: var(--font-mono); font-size: 26px; letter-spacing: .4em;
  text-align: center; font-variant-numeric: tabular-nums;
}
/* A wrong code shakes with a damped spring -- it settles instead of
   stopping dead, so the correction reads as physical, not as an alarm. */
.pt-campo--sacudir { animation: pt-sacude .45s cubic-bezier(.36,.07,.19,.97); }
@keyframes pt-sacude {
  0%,100% { transform: translateX(0); }
  15% { transform: translateX(-9px); } 30% { transform: translateX(7px); }
  45% { transform: translateX(-4px); } 60% { transform: translateX(2px); }
  80% { transform: translateX(-1px); }
}
.pt-btn {
  display: block; width: 100%; margin-top: 16px; padding: 13px;
  background: var(--signal); color: var(--signal-ink); border: 1px solid var(--signal);
  border-radius: 999px; font-family: var(--font-sans); font-size: 15.5px;
  font-weight: 600; cursor: pointer;
  transition: background-color .15s ease, transform .12s cubic-bezier(.34,1.56,.64,1);
}
.pt-btn:hover:not(:disabled) { background: var(--signal-dark); }
.pt-btn:active:not(:disabled) { transform: scale(.98); }
.pt-btn:disabled { opacity: .55; cursor: not-allowed; }
.pt-btn:focus-visible { outline: 2px solid var(--blueprint); outline-offset: 3px; }
.pt-error { margin: 10px 0 0; font-size: 14.5px; color: var(--redline); line-height: 1.45; }
.pt-pie { margin: 20px 0 0; font-size: 13.5px; color: var(--sub); }
.pt-link {
  display: inline-block; margin-top: 18px; padding: 0; background: none; border: none;
  font-family: var(--font-sans); font-size: 14.5px; color: var(--signal-dark);
  cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.pt-volver { margin: 0 0 22px; }
.pt-cargando { text-align: center; padding: 40px 0; }
.pt-cargando p { font-family: var(--font-mono); font-size: 13px; color: var(--sub); margin: 0; }

/* ── List of transactions ── */
.pt-lista { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.pt-item {
  display: grid; grid-template-columns: 1fr auto; gap: 6px 18px; align-items: center;
  width: 100%; text-align: left; padding: 18px 20px; cursor: pointer;
  background: var(--card); border: 1px solid var(--line-strong); border-radius: 4px;
  font-family: var(--font-sans); color: var(--ink);
  transition: border-color .15s ease, transform .18s cubic-bezier(.34,1.56,.64,1);
  animation: pt-entra .45s cubic-bezier(.16,1,.3,1) both;
}
.pt-item:hover { border-color: var(--signal); transform: translateY(-2px); }
.pt-item:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.pt-item-addr { font-size: 16.5px; font-weight: 600; }
.pt-item-meta {
  grid-column: 1; font-family: var(--font-mono); font-size: 11.5px;
  letter-spacing: .06em; color: var(--sub);
}
.pt-item-pct {
  grid-row: 1 / 3; font-family: var(--font-mono); font-size: 22px; font-weight: 500;
  color: var(--signal-dark); font-variant-numeric: tabular-nums;
}

/* ── Detail header ── */
.pt-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 24px; flex-wrap: wrap; padding-bottom: 20px; border-bottom: 1px solid var(--line);
}
.pt-addr { font-size: 22px; font-weight: 600; margin: 0 0 6px; letter-spacing: -.015em; }
.pt-meta { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .06em; color: var(--sub); margin: 0; }
.pt-precio {
  font-family: var(--font-mono); font-size: 25px; font-weight: 500;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em; white-space: nowrap;
}

/* ── THE GAUGE ──
   .pt-fase-via is the empty track; the <i> inside is the fill, and its
   width is the phase's real ratio (set inline by the JS as --lleno). */
.pt-fases-caja { overflow-x: auto; margin: 28px 0 0; padding-bottom: 4px; }
.pt-fases { display: flex; min-width: 640px; }
.pt-fase { flex: 1; position: relative; padding: 26px 14px 0 0; }
.pt-fase-via {
  position: absolute; top: 7px; left: 0; right: 0; height: 2px;
  background: var(--line-strong); overflow: hidden; border-radius: 2px;
}
.pt-fase-via i {
  display: block; height: 100%; width: var(--lleno, 0%); background: var(--signal);
  transform-origin: left center;
  animation: pt-llena .55s cubic-bezier(.16,1,.3,1) both;
  animation-delay: var(--turno, 0ms);
}
@keyframes pt-llena { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.pt-fase-punto {
  position: absolute; top: 2px; left: 0; width: 12px; height: 12px;
  border-radius: 50%; background: var(--bg); border: 2px solid var(--line-strong);
  box-sizing: border-box;
  animation: pt-brota .34s cubic-bezier(.16,1,.3,1) both;
  animation-delay: var(--turno, 0ms);
}
@keyframes pt-brota { from { transform: scale(.86); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.pt-fase.ok .pt-fase-punto { background: var(--signal); border-color: var(--signal); }
.pt-fase.hoy .pt-fase-punto {
  background: var(--card); border-color: var(--signal);
  box-shadow: 0 0 0 4px rgba(31,143,128,.18);
}
.pt-fase-n {
  display: block; font-family: var(--font-mono); font-size: 10px;
  letter-spacing: .12em; color: var(--sub);
}
.pt-fase-t { display: block; font-size: 13px; font-weight: 500; line-height: 1.3; margin-top: 2px; }
.pt-fase.hoy .pt-fase-t { color: var(--signal-dark); font-weight: 600; }
.pt-fase.pend .pt-fase-t { color: var(--sub); }
.pt-fase-r {
  display: block; font-family: var(--font-mono); font-size: 10.5px;
  color: var(--sub); margin-top: 3px; font-variant-numeric: tabular-nums;
}

/* ── Up next ── */
.pt-next {
  margin-top: 24px; padding: 18px 20px; border: 1px solid var(--signal);
  border-radius: 6px; background: rgba(31,143,128,.06);
  animation: pt-entra .5s cubic-bezier(.16,1,.3,1) both; animation-delay: .34s;
}
.pt-next-lbl {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--signal-dark); margin: 0 0 6px;
}
.pt-next-txt { font-size: 16.5px; font-weight: 600; margin: 0 0 4px; }
.pt-next-sub { font-size: 13.5px; color: var(--sub); margin: 0; }

/* ── Section titles ── */
.pt-sec {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--sub); margin: 36px 0 10px;
  display: flex; align-items: center; gap: 10px;
}
.pt-sec::before { content: ""; width: 22px; height: 1px; background: var(--line-strong); flex: none; }

/* ── Dates ── */
.pt-fechas { display: flex; flex-direction: column; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.pt-fecha {
  display: grid; grid-template-columns: 1fr auto auto; gap: 14px; align-items: center;
  padding: 13px 16px; background: var(--card);
  animation: pt-entra .4s cubic-bezier(.16,1,.3,1) both; animation-delay: var(--turno, 0ms);
}
.pt-fecha.eje .pt-fecha-n { color: var(--ink); font-weight: 650; }
.pt-fecha.eje .pt-fecha-d { font-size: 15px; font-weight: 700; }
.pt-fecha.urg { border-left: 3px solid var(--redline); }
.pt-fecha.soon { border-left: 3px solid #a8761c; }
.pt-fecha-n { font-size: 14.5px; font-weight: 500; }
.pt-fecha-d {
  font-family: var(--font-mono); font-size: 13.5px; color: var(--sub);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.pt-pill {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .06em;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap; border: 1px solid;
}
.pt-pill.venc   { color: var(--redline); border-color: var(--redline); }
.pt-pill.pronto { color: #a8761c; border-color: #a8761c; }
.pt-pill.ok     { color: var(--signal-dark); border-color: var(--signal); }
.pt-pill.gris   { color: var(--sub); border-color: var(--line-strong); }

/* ── Checklist ── */
.pt-grupo { border: 1px solid var(--line); background: var(--card); margin-bottom: 10px; }
.pt-grupo summary {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  padding: 13px 16px; cursor: pointer; list-style: none;
}
.pt-grupo summary::-webkit-details-marker { display: none; }
.pt-grupo summary:focus-visible { outline: 2px solid var(--signal); outline-offset: -2px; }
.pt-grupo-t { font-size: 14.5px; font-weight: 600; }
.pt-grupo-n {
  font-family: var(--font-mono); font-size: 11.5px; color: var(--sub);
  font-variant-numeric: tabular-nums;
}
.pt-pasos { list-style: none; margin: 0; padding: 4px 0 8px; border-top: 1px solid var(--line); }
.pt-grupo[open] .pt-pasos { animation: pt-abre .32s cubic-bezier(.16,1,.3,1) both; }
@keyframes pt-abre { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.pt-paso {
  display: grid; grid-template-columns: 20px 1fr; gap: 11px; align-items: start;
  padding: 7px 16px; font-size: 14.5px;
}
.pt-tick { font-family: var(--font-mono); font-size: 13px; line-height: 1.55; }
.pt-paso.ok .pt-tick { color: var(--signal); }
.pt-paso.ok span:last-child { color: var(--sub); }
.pt-paso.no .pt-tick { color: var(--line-strong); }
.pt-paso.ahora { background: rgba(31,143,128,.06); }
.pt-paso.ahora span:last-child { font-weight: 600; }

/* ── Contacts ── */
.pt-cts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1px; background: var(--line); border: 1px solid var(--line);
}
.pt-ct { background: var(--card); padding: 14px 16px; }
.pt-ct-rol {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--sub);
}
.pt-ct-n { font-size: 15px; font-weight: 600; margin: 4px 0 2px; }
.pt-ct-d { font-family: var(--font-mono); font-size: 12.5px; color: var(--signal-dark); text-decoration: none; }
.pt-ct-d:hover { text-decoration: underline; }

.pt-footer { margin-top: 40px; }

@keyframes pt-entra { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

@media (max-width: 560px) {
  .pt-main { padding-block: calc(var(--header-h) + 30px) 60px; }
  .pt-item { grid-template-columns: 1fr; }
  .pt-item-pct { grid-row: auto; }
}

/* Anyone who asked the system for less motion gets the page at its final
   state, with nothing moving. The gauge still reads correctly -- the fill
   width is set inline, not by the animation. */
@media (prefers-reduced-motion: reduce) {
  .pt-caja, .pt-item, .pt-next, .pt-fecha, .pt-fase-via i,
  .pt-fase-punto, .pt-grupo[open] .pt-pasos, .pt-mark--late i {
    animation: none !important;
  }
  .pt-campo--sacudir { animation: none !important; }
  .pt-item:hover { transform: none; }
}
