/* =============================================================
   PORTAL DE CLIENTES — Built Partners
   Estilos del portal de clientes. Hereda tokens de ../styles.css
   ============================================================= */

/* ── Layout base ─────────────────────────────────────────── */
.portal-body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(var(--gold-rgb), 0.06), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(var(--gold-rgb), 0.05), transparent 55%),
    var(--bg);
  display: grid;
  grid-template-columns: 264px 1fr;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.pt-sidebar {
  position: sticky; top: 0; align-self: start;
  height: 100vh;
  display: flex; flex-direction: column;
  padding: 1.6rem 1.1rem;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.015), transparent);
  backdrop-filter: blur(4px);
}
.pt-sidebar-logo {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.2rem 0.4rem 1.2rem;
}
.pt-sidebar-logo img { width: 30px; height: 30px; }

/* ── Marca BP reconstruida en CSS (el PNG trae fondo gris y se aplasta) ── */
.pt-mark {
  flex: none; position: relative;
  display: inline-grid; grid-auto-flow: column; align-items: center; justify-content: center;
  gap: 0.12em;
  border-radius: 50%;
  border: 1.5px solid rgba(var(--gold-rgb), 0.5);
  background: radial-gradient(circle at 50% 42%, rgba(var(--gold-rgb), 0.12), transparent 62%);
  box-shadow: inset 0 0 14px rgba(var(--gold-rgb), 0.10);
}
.pt-mark b {
  font-family: var(--serif); font-weight: 600; line-height: 1;
  background: linear-gradient(140deg, var(--gold-light), var(--gold-mid) 70%, var(--gold-dark));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.pt-mark i { width: 1px; height: 46%; background: linear-gradient(180deg, transparent, rgba(var(--gold-rgb), 0.75), transparent); }
.pt-mark--sm { width: 34px; height: 34px; font-size: 0.74rem; }
.pt-mark--lg { width: 54px; height: 54px; font-size: 1.2rem; }

.pt-sidebar-logo .pt-brand {
  font-family: var(--serif); font-size: 1.2rem; font-weight: 600;
  letter-spacing: 0.01em;
}
.pt-sidebar-logo .pt-brand small {
  display: block; font-family: var(--mono); font-size: 0.56rem;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold-mid);
  margin-top: 2px;
}

.pt-client-card {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.85rem; margin-bottom: 1.4rem;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg-card);
}
.pt-client-avatar {
  width: 42px; height: 42px; flex: none; border-radius: 10px;
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 1.25rem; font-weight: 600; color: var(--bg);
  background: linear-gradient(135deg, var(--gold-light), var(--gold-mid));
  box-shadow: 0 4px 16px rgba(var(--gold-rgb), 0.25);
}
.pt-client-meta { min-width: 0; }
.pt-client-name {
  font-weight: 600; font-size: 0.92rem; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.pt-client-plan {
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.08em;
  color: var(--gold-mid); text-transform: uppercase; margin-top: 1px;
}

.pt-nav { display: flex; flex-direction: column; gap: 0.25rem; }
.pt-nav-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.72rem 0.85rem; border-radius: 10px;
  color: var(--cream-2); font-size: 0.9rem; font-weight: 500;
  text-align: left; width: 100%;
  transition: background 0.25s var(--ease-soft), color 0.25s;
}
.pt-nav-item:hover { background: rgba(255,255,255,0.03); color: var(--cream); }
.pt-nav-item.is-active {
  background: linear-gradient(135deg, rgba(var(--gold-rgb),0.16), rgba(var(--gold-rgb),0.05));
  color: var(--cream);
  box-shadow: inset 0 0 0 1px var(--line);
}
.pt-nav-item .ico { width: 20px; text-align: center; color: var(--gold); font-size: 0.95rem; }

.pt-sidebar-foot { margin-top: auto; padding-top: 1rem; }
.pt-support {
  font-size: 0.74rem; color: var(--cream-3); line-height: 1.5;
  padding: 0.75rem; border: 1px dashed var(--line); border-radius: 10px;
  margin-bottom: 0.8rem;
}
.pt-support a { color: var(--gold-mid); }
.pt-logout {
  width: 100%; padding: 0.65rem; border-radius: 9px;
  border: 1px solid var(--line); color: var(--cream-2);
  font-size: 0.82rem; transition: all 0.25s;
}
.pt-logout:hover { border-color: var(--gold-mid); color: var(--cream); }

/* ── Main ────────────────────────────────────────────────── */
.pt-main { padding: 2.2rem clamp(1.2rem, 3vw, 3rem) 4rem; min-width: 0; }

.pt-topbar {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1.5rem; flex-wrap: wrap; margin-bottom: 2rem;
}
.pt-topbar h1 { font-size: clamp(1.7rem, 3vw, 2.4rem); }
.pt-topbar .pt-sub { color: var(--cream-2); font-size: 0.95rem; margin-top: 0.3rem; }

.pt-next-pill {
  display: inline-flex; align-items: center; gap: 0.7rem;
  padding: 0.7rem 1.1rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg-card);
}
.pt-next-pill .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 0 4px rgba(var(--gold-rgb),0.15);
  animation: ptpulse 2.4s var(--ease-soft) infinite;
}
@keyframes ptpulse { 0%,100%{opacity:1} 50%{opacity:0.35} }
.pt-next-pill .lbl { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--cream-3); }
.pt-next-pill .val { font-weight: 600; font-size: 0.95rem; }
.pt-next-pill .val b { color: var(--gold-light); }

/* ── Sections ────────────────────────────────────────────── */
.pt-section { display: none; animation: ptfade 0.5s var(--ease-out); }
.pt-section.is-active { display: block; }
@keyframes ptfade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.pt-section-title {
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--gold-mid);
  margin: 2.4rem 0 1rem;
}
.pt-section-title:first-child { margin-top: 0; }

/* ── Cards / grid ────────────────────────────────────────── */
.pt-card {
  border: 1px solid var(--line); border-radius: 16px;
  background: linear-gradient(180deg, var(--bg-card), var(--bg-card-2));
  padding: 1.4rem 1.5rem;
}
.pt-grid { display: grid; gap: 1rem; }
.pt-grid.kpis { grid-template-columns: repeat(4, 1fr); }
.pt-grid.two   { grid-template-columns: 1.6fr 1fr; }
.pt-grid.cols3 { grid-template-columns: repeat(3, 1fr); }

/* ── KPI tile ────────────────────────────────────────────── */
.pt-kpi { position: relative; overflow: hidden; }
.pt-kpi .kpi-lbl {
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--cream-3);
}
.pt-kpi .kpi-val {
  font-family: var(--serif); font-size: 2.6rem; font-weight: 600;
  line-height: 1; margin: 0.5rem 0 0.35rem;
}
.pt-kpi .kpi-val small { font-size: 1rem; color: var(--cream-3); font-family: var(--sans); }
.pt-delta {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-family: var(--mono); font-size: 0.72rem; font-weight: 500;
  padding: 0.2rem 0.5rem; border-radius: 6px;
}
.pt-delta.up   { color: #7EE0A5; background: rgba(126,224,165,0.10); }
.pt-delta.down { color: #E08A7E; background: rgba(224,138,126,0.10); }
.pt-delta.up.inverse   { color: #7EE0A5; }  /* mejora aunque el número baje (ej. LCP) */
.pt-kpi .kpi-spark { position: absolute; right: 0.9rem; bottom: 0.9rem; width: 92px; height: 34px; opacity: 0.9; }

/* ── Chart card ──────────────────────────────────────────── */
.pt-chart-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem;
}
.pt-chart-head h3 { font-size: 1.35rem; }
.pt-legend { display: flex; gap: 1rem; flex-wrap: wrap; }
.pt-legend button {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.06em;
  color: var(--cream-2); padding: 0.35rem 0.6rem; border-radius: 999px;
  border: 1px solid var(--line); transition: all 0.25s;
}
.pt-legend button.off { opacity: 0.4; }
.pt-legend .swatch { width: 10px; height: 10px; border-radius: 3px; }
.pt-chart-wrap { width: 100%; overflow-x: auto; }
.pt-chart-wrap svg { width: 100%; height: auto; display: block; min-width: 520px; }

/* ── Progress bars (categorías) ──────────────────────────── */
.pt-bars { display: flex; flex-direction: column; gap: 0.95rem; }
.pt-bar-row { display: grid; grid-template-columns: 1fr auto; gap: 0.3rem 0.8rem; align-items: center; }
.pt-bar-lbl { font-size: 0.86rem; color: var(--cream); }
.pt-bar-val { font-family: var(--mono); font-size: 0.82rem; color: var(--gold-light); }
.pt-bar-track {
  grid-column: 1 / -1; height: 8px; border-radius: 999px;
  background: rgba(255,255,255,0.05); overflow: hidden;
}
.pt-bar-fill {
  height: 100%; border-radius: 999px; width: 0;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold), var(--gold-light));
  transition: width 1.1s var(--ease-out);
}

/* ── AI visibility ───────────────────────────────────────── */
.pt-ai-list { display: flex; flex-direction: column; gap: 0.7rem; }
.pt-ai-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.7rem 0.9rem; border-radius: 11px;
  border: 1px solid var(--line); background: var(--bg-card);
}
.pt-ai-name { display: flex; align-items: center; gap: 0.6rem; font-weight: 500; font-size: 0.9rem; min-width: 0; }
.pt-ai-name .glyph { width: 26px; height: 26px; flex: none; border-radius: 7px; display: grid; place-items: center; font-size: 0.8rem; background: rgba(var(--gold-rgb),0.1); color: var(--gold-light); }
.pt-ai-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.pt-ai-note { font-size: 0.7rem; color: var(--cream-3); font-weight: 400; }
.pt-chip {
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.06em;
  text-transform: uppercase; padding: 0.25rem 0.6rem; border-radius: 999px;
  flex: none; white-space: nowrap; align-self: center;
}
.pt-chip.yes    { color: #7EE0A5; background: rgba(126,224,165,0.12); }
.pt-chip.partial{ color: var(--gold-light); background: rgba(var(--gold-rgb),0.12); }
.pt-chip.no     { color: var(--cream-3); background: rgba(255,255,255,0.05); }

/* ── Timeline informes ───────────────────────────────────── */
.pt-timeline { position: relative; padding-left: 1.5rem; }
.pt-timeline::before {
  content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px;
  background: linear-gradient(180deg, var(--gold), transparent);
}
.pt-tl-item { position: relative; padding: 0 0 1.4rem 0; }
.pt-tl-item::before {
  content: ""; position: absolute; left: -1.5rem; top: 4px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--gold-mid);
}
.pt-tl-item.done::before { background: var(--gold); box-shadow: 0 0 0 4px rgba(var(--gold-rgb),0.15); }
.pt-tl-item.next::before { border-style: dashed; }
.pt-tl-date { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cream-3); }
.pt-tl-title { font-weight: 600; font-size: 0.96rem; margin: 0.15rem 0; }
.pt-tl-note { font-size: 0.82rem; color: var(--cream-2); }

/* ── Archivos / PDFs ─────────────────────────────────────── */
.pt-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.pt-file {
  display: flex; align-items: flex-start; gap: 0.85rem;
  padding: 1.1rem; border-radius: 14px;
  border: 1px solid var(--line); background: var(--bg-card);
  transition: transform 0.3s var(--ease-out), border-color 0.3s;
}
.pt-file:hover { transform: translateY(-3px); border-color: var(--gold-mid); }
.pt-file-ico {
  width: 40px; height: 48px; flex: none; border-radius: 6px;
  display: grid; place-items: center; position: relative;
  background: linear-gradient(160deg, rgba(var(--gold-rgb),0.18), rgba(var(--gold-rgb),0.04));
  border: 1px solid var(--line);
  font-family: var(--mono); font-size: 0.55rem; letter-spacing: 0.04em; color: var(--gold-light);
}
.pt-file-meta { min-width: 0; }
.pt-file-name { font-weight: 600; font-size: 0.88rem; line-height: 1.3; }
.pt-file-info { font-family: var(--mono); font-size: 0.64rem; color: var(--cream-3); margin-top: 0.25rem; letter-spacing: 0.04em; }
.pt-file-dl { margin-top: 0.55rem; font-size: 0.76rem; color: var(--gold-mid); font-weight: 500; }
.pt-file-dl:hover { color: var(--gold-light); }

/* Upload zone (visual — la usa BP desde el admin, aquí es demostrativa) */
.pt-upload {
  grid-column: 1 / -1;
  border: 1.5px dashed var(--line); border-radius: 14px;
  padding: 1.6rem; text-align: center; color: var(--cream-3);
  transition: all 0.3s; cursor: default;
}
.pt-upload:hover { border-color: var(--gold-mid); color: var(--cream-2); }
.pt-upload b { color: var(--cream); }

/* ── Note / prototype banner ─────────────────────────────── */
.pt-proto-banner {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.7rem 1rem; margin-bottom: 1.6rem;
  border: 1px solid var(--line); border-radius: 10px;
  background: rgba(var(--gold-rgb), 0.05);
  font-size: 0.8rem; color: var(--cream-2);
}
.pt-proto-banner .tag {
  font-family: var(--mono); font-size: 0.58rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--bg); background: var(--gold); padding: 0.2rem 0.5rem; border-radius: 5px; font-weight: 600;
}

/* ── Login ───────────────────────────────────────────────── */
.pt-login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 2rem;
}
.pt-login-card {
  width: min(400px, 100%); padding: 2.6rem 2.2rem;
  border: 1px solid var(--line); border-radius: 20px;
  background: linear-gradient(180deg, var(--bg-card), var(--bg-card-2));
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}
.pt-login-logo { display: flex; justify-content: center; margin-bottom: 1.4rem; }
.pt-login-logo img { width: 46px; height: 46px; }
.pt-login-card h1 { text-align: center; font-size: 1.9rem; }
.pt-login-card .pt-login-sub { text-align: center; color: var(--cream-2); font-size: 0.9rem; margin: 0.4rem 0 1.8rem; }
.pt-field { position: relative; margin-bottom: 1rem; }
.pt-field input {
  width: 100%; padding: 0.95rem 1rem; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--line); color: var(--cream);
  font-size: 0.92rem; transition: border-color 0.25s;
}
.pt-field input:focus { outline: none; border-color: var(--gold-mid); }
.pt-field label {
  position: absolute; left: 1rem; top: 0.95rem; color: var(--cream-3);
  font-size: 0.9rem; pointer-events: none; transition: all 0.2s;
}
.pt-field input:focus + label,
.pt-field input:not(:placeholder-shown) + label {
  top: -0.55rem; left: 0.7rem; font-size: 0.68rem; padding: 0 0.35rem;
  background: var(--bg-card); color: var(--gold-mid);
}
.pt-login-hint {
  margin-top: 1.3rem; text-align: center; font-size: 0.72rem; color: var(--cream-3);
  font-family: var(--mono); letter-spacing: 0.03em; line-height: 1.6;
}
.pt-login-hint b { color: var(--gold-mid); }
.pt-back { display: block; text-align: center; margin-top: 1.4rem; font-size: 0.8rem; color: var(--cream-3); }
.pt-back:hover { color: var(--cream); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 980px) {
  .pt-grid.kpis  { grid-template-columns: repeat(2, 1fr); }
  .pt-grid.two,
  .pt-grid.cols3 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .portal-body { grid-template-columns: 1fr; }
  .pt-sidebar {
    position: static; height: auto; flex-direction: row; flex-wrap: wrap;
    align-items: center; gap: 0.5rem; border-right: 0; border-bottom: 1px solid var(--line);
  }
  .pt-sidebar-logo { padding: 0.2rem 0.5rem; }
  .pt-client-card { margin: 0; flex: 1 1 auto; }
  .pt-nav { flex-direction: row; flex-wrap: wrap; width: 100%; }
  .pt-nav-item { width: auto; }
  .pt-sidebar-foot { display: none; }
}
@media (max-width: 560px) {
  .pt-grid.kpis { grid-template-columns: 1fr; }
}
