/* Tablero de avance · Visit Panamá
   Marca Visit Panamá: colores, tipografías y componentes del tablero original. */

/* ---------- Tipografías de marca ---------- */
@font-face {
  font-family: "VP Panama Sans";
  src: url("../fonts/panama-sans-700-900.woff2") format("woff2");
  font-weight: 700 900;
  font-display: swap;
}
@font-face {
  font-family: "VP Panama Sans";
  src: url("../fonts/panama-sans-500-600.woff2") format("woff2");
  font-weight: 500 600;
  font-display: swap;
}
@font-face {
  font-family: "VP Source Sans";
  src: url("../fonts/source-sans-200-900.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --vp-blue: #004CFD;
  --vp-deep: #020850;
  --vp-red: #FB515F;
  --vp-tint: #E6EEFF;
  --vp-soft: #A8C3FF;
  --vp-turismo: #00AD8F;
  --vp-turismo-lt: #67D1CB;
  --vp-purple: #7D00CC;
  --vp-ok: #1B9E5A;
  --vp-ink: #0B1020;
  --vp-muted: #5A6473;
  --vp-line: #F1F1F1;
  --vp-bg: #F5F5F5;
  --vp-card: #fff;
  --vp-pending: #C9CED6;
  --vp-h: "VP Panama Sans", "Source Sans 3", system-ui, sans-serif;
  --vp-b: "VP Source Sans", "Source Sans 3", system-ui, sans-serif;
  --vp-shadow: 0 1px 0 var(--vp-line), 0 6px 18px rgba(2, 8, 80, .06);
  --vp-gutter: clamp(16px, 3vw, 32px);
}

/* Color por fase del flujo (f0 = sin iniciar … f5 = entregado) */
.f0 { --fase: var(--vp-pending); --fase-tint: #EEF0F3; }
.f1 { --fase: var(--vp-blue);    --fase-tint: #D6E2FF; }
.f2 { --fase: var(--vp-turismo); --fase-tint: #CCF1EA; }
.f3 { --fase: var(--vp-purple);  --fase-tint: #EBD6F7; }
.f4 { --fase: var(--vp-deep);    --fase-tint: #D3D5E6; }
.f5 { --fase: var(--vp-ok);      --fase-tint: #D4EFDF; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--vp-bg); padding: 24px; }
@media (max-width: 640px) { body { padding: 0; } }
img { max-width: 100%; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.vp-saltar {
  position: absolute; left: 16px; top: -48px; z-index: 10;
  background: var(--vp-deep); color: #fff; padding: 10px 16px; border-radius: 8px;
  font: 700 14px var(--vp-h); text-decoration: none;
}
.vp-saltar:focus { top: 16px; }

.vp {
  max-width: 1280px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 28px;
  font-family: var(--vp-b); color: var(--vp-ink); background: var(--vp-bg);
  border-radius: 20px; overflow: hidden; padding-bottom: 28px;
}
.vp main { display: flex; flex-direction: column; gap: 28px; }
.vp .in { padding: 0 var(--vp-gutter); }
.vp h2 { font-family: var(--vp-h); font-weight: 800; font-size: 22px; color: var(--vp-blue); margin: 0 0 12px; }
.vp p { margin: 0; }
.vp ul, .vp ol { margin: 0; padding: 0; list-style: none; }

/* ---------- Encabezado ---------- */
.vp-hero {
  background: var(--vp-blue); color: #fff; position: relative; overflow: hidden;
  padding: 28px var(--vp-gutter) 34px;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: end;
}
.vp-hero .logo { height: 48px; width: auto; display: block; margin-bottom: 22px; }
.vp-hero .eyebrow { font-family: var(--vp-h); font-weight: 700; font-size: 15px; color: var(--vp-soft); margin: 0 0 6px; }
.vp h1 {
  font-family: var(--vp-h); font-weight: 800; font-size: clamp(28px, 4vw, 42px);
  line-height: 1.05; letter-spacing: -.01em; margin: 0; text-wrap: balance; color: #fff;
}
.vp .lede { margin: 12px 0 0; color: #fff; opacity: .92; font-size: 17px; line-height: 1.5; max-width: 62ch; }
.vp .lede b { font-family: var(--vp-h); font-weight: 700; font-variant-numeric: tabular-nums; color: #fff; }

.vp-bar { margin-top: 18px; height: 10px; border-radius: 999px; background: rgba(255, 255, 255, .22); overflow: hidden; max-width: 520px; }
.vp-bar span { display: block; height: 100%; width: var(--avance, 0%); background: #fff; border-radius: 999px; }

/* Píldora de último cambio */
.vp-hero .vp-sync { position: absolute; top: 24px; right: var(--vp-gutter); z-index: 1; max-width: calc(100% - 220px); }
.vp-pill {
  display: flex; align-items: center; gap: 12px; padding: 10px 20px 10px 16px; border-radius: 999px;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .26); color: #fff;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.vp-pill .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--vp-turismo-lt); flex: none; animation: vpPulse 2.4s ease-out infinite; }
.vp-pill .t { font-family: var(--vp-h); font-weight: 700; font-size: 15px; line-height: 1.25; color: #fff; }
.vp-pill .s { font-family: var(--vp-b); font-weight: 600; font-size: 12.5px; color: var(--vp-soft); margin: 3px 0 0; display: flex; flex-wrap: wrap; gap: 2px 8px; }
.vp-pill .s li { display: inline-flex; align-items: center; gap: 5px; }
.vp-pill .s li + li::before { content: '·'; margin-right: 3px; }
.vp-pill .flag { display: block; border-radius: 2px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .35); flex: none; }
.vp-pill .s b { color: #fff; font-weight: 700; font-variant-numeric: tabular-nums; }
.vp-pill .e { font-size: 11.5px; font-weight: 600; color: var(--vp-soft); opacity: .85; margin-top: 3px; font-variant-numeric: tabular-nums; }
.vp-sync[data-estado="error"] .dot { background: var(--vp-red); animation: none; }
@keyframes vpPulse {
  0% { box-shadow: 0 0 0 0 rgba(103, 209, 203, .6); }
  70% { box-shadow: 0 0 0 7px rgba(103, 209, 203, 0); }
  100% { box-shadow: 0 0 0 0 rgba(103, 209, 203, 0); }
}
@media (prefers-reduced-motion: reduce) { .vp-pill .dot { animation: none; } }
@media (max-width: 760px) {
  .vp-hero .vp-sync { position: static; max-width: none; grid-row: 2; margin-top: 18px; }
  .vp-pill { border-radius: 18px; align-items: flex-start; padding: 12px 16px; }
  .vp-pill .dot { margin-top: 5px; }
  .vp-pill .s { gap: 2px 14px; }
  .vp-pill .s li + li::before { content: none; }
}

/* ---------- Indicadores ---------- */
.vp-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.vp-kpi {
  background: var(--vp-card); border-radius: 16px; padding: 18px 18px 16px;
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
  box-shadow: var(--vp-shadow); border-top: 5px solid var(--fase);
}
.vp-kpi .lbl { font-family: var(--vp-h); font-weight: 700; font-size: 13px; color: var(--vp-deep); }
.vp-kpi .val { font-family: var(--vp-h); font-weight: 800; font-size: 40px; line-height: 1; font-variant-numeric: tabular-nums; color: var(--fase); margin-top: 4px; }
.vp-kpi .sub { font-size: 13px; color: var(--vp-muted); }

/* ---------- Gráfico por etapa (HTML + CSS) ---------- */
.vp-panel { background: var(--vp-card); border-radius: 16px; padding: 20px; box-shadow: var(--vp-shadow); }
.vp-chart { display: grid; grid-template-columns: minmax(0, max-content) minmax(0, 1fr); column-gap: 10px; padding-top: 4px; }
.vp-chart li {
  position: relative; grid-column: 1 / -1; display: grid; grid-template-columns: subgrid;
  align-items: center; height: 28px; font-size: 13px; color: var(--vp-muted);
}
.vp-chart li.con-valor { --min: 3px; }
.vp-chart .lbl { text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vp-chart .pista { position: relative; height: 16px; margin-right: 36px; border-radius: 8px; background: var(--vp-line); }
.vp-chart .valor { position: absolute; inset: 0 auto 0 0; width: var(--v); min-width: var(--min, 0); border-radius: 8px; background: var(--fase); }
.vp-chart .n {
  position: absolute; top: 50%; left: calc(var(--v) + 6px); transform: translateY(-50%);
  font-family: var(--vp-h); font-weight: 700; font-variant-numeric: tabular-nums; color: var(--vp-deep);
}
.vp-chart li::after { /* tooltip */
  content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% - 2px); z-index: 2;
  background: var(--vp-deep); color: #fff; border-radius: 8px; padding: 6px 10px; font-size: 13px; white-space: nowrap;
  box-shadow: 0 8px 20px rgba(2, 8, 80, .25); opacity: 0; pointer-events: none; transition: opacity .12s;
}
.vp-chart li:hover::after { opacity: 1; }
@media (max-width: 520px) {
  .vp-chart { grid-template-columns: minmax(0, 66%) minmax(0, 1fr); }
  .vp-chart li { font-size: 10.5px; }
}

.vp-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: 13px; color: var(--vp-muted); }
.vp-legend i { display: inline-block; width: 14px; height: 10px; border-radius: 5px; margin-right: 6px; vertical-align: -1px; background: var(--fase); }

/* ---------- Tabla ---------- */
.vp-note { font-size: 14px; color: var(--vp-muted); margin: -4px 0 12px !important; }
.vp-tablewrap { container-type: inline-size; overflow-x: auto; border-radius: 16px; background: var(--vp-card); box-shadow: var(--vp-shadow); }
.vp-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.vp-table th, .vp-table td { padding: 12px 14px; border-bottom: 1px solid var(--vp-line); text-align: left; vertical-align: middle; }
.vp-table thead th { font-family: var(--vp-h); font-weight: 700; font-size: 12.5px; color: #fff; background: var(--vp-deep); }
.vp-table tbody tr:hover > * { background: #FAFBFF; }
.vp-table tbody tr:last-child > * { border-bottom: 0; }
.vp-table .num { color: var(--vp-blue); font-family: var(--vp-h); font-weight: 700; font-variant-numeric: tabular-nums; width: 2.5em; }
.vp-table .pg { font-family: var(--vp-h); font-weight: 700; color: var(--vp-deep); white-space: nowrap; }

.vp-etq { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--fase-tint); color: var(--vp-deep); white-space: nowrap; }

.vp-progreso { display: flex; gap: 10px; align-items: center; }
.vp-steps { display: flex; gap: 3px; align-items: center; }
.vp-step { width: 20px; height: 10px; border-radius: 5px; background: var(--vp-line); flex: none; }
.vp-step.hecho { background: var(--fase); }
.vp-pct { font-variant-numeric: tabular-nums; color: var(--vp-muted); font-size: 13px; white-space: nowrap; }

.vp-links { display: flex; flex-direction: column; gap: 5px; align-items: flex-start; min-width: 250px; }
.vp-lgrp { display: flex; gap: 5px; align-items: center; white-space: nowrap; }
.vp-lname { font-size: 12px; font-weight: 600; color: var(--vp-deep); width: 96px; flex: none; }
.vp-chip {
  display: inline-flex; justify-content: center; align-items: center; min-width: 84px;
  padding: 3px 9px; border-radius: 999px; border: 1px solid transparent;
  font-size: 12px; font-weight: 600; white-space: nowrap; text-decoration: none;
}
a.vp-chip { color: var(--vp-deep); background: var(--vp-tint); }
a.vp-chip:hover { background: var(--vp-soft); }
a.vp-chip:focus-visible, .vp-saltar:focus-visible, .vp summary:focus-visible { outline: 3px solid var(--vp-blue); outline-offset: 2px; }
span.vp-chip { color: #8A93A3; border: 1px dashed var(--vp-pending); }
.vp-date { color: var(--vp-muted); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* La tabla pasa a tarjetas cuando no entra a lo ancho */
@container (max-width: 1040px) {
  .vp-table thead { display: none; }
  .vp-table, .vp-table tbody { display: block; width: 100%; }
  .vp-table tr { display: grid; grid-template-columns: 2.6em minmax(0, 1fr); gap: 10px 12px; padding: 16px 18px; border-bottom: 1px solid var(--vp-line); }
  .vp-table tbody tr:last-child { border-bottom: 0; }
  .vp-table tr > * { display: block; padding: 0; border: 0; grid-column: 1 / -1; min-width: 0; }
  .vp-table .num { grid-column: 1; }
  .vp-table .pg { grid-column: 2; white-space: normal; }
  .vp-table td[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: 6px;
    font-family: var(--vp-h); font-size: 11px; font-weight: 700; letter-spacing: .02em; color: var(--vp-muted);
  }
  .vp-links { min-width: 0; }
  .vp-lgrp { flex-wrap: wrap; }
  .vp-table tbody tr:hover > * { background: none; }
}

/* ---------- Etapas del flujo ---------- */
.vp details { margin: 0; }
.vp summary { cursor: pointer; font-family: var(--vp-h); font-weight: 700; color: var(--vp-blue); }
.vp ol.stages { margin: 12px 0 0; padding-left: 1.4em; list-style: decimal; display: grid; gap: 6px; color: var(--vp-muted); }
.vp ol.stages b { color: var(--vp-deep); }

/* ---------- Avisos ---------- */
.vp-error { background: #FFE9EB; border-left: 4px solid var(--vp-red); border-radius: 0 12px 12px 0; padding: 14px 18px; color: #8E1520; font-size: 14px; }
.vp-error b { display: block; font-family: var(--vp-h); margin-bottom: 4px; }
.vp-aviso { background: #FFF6E0; border-left: 4px solid #F2B200; border-radius: 0 12px 12px 0; padding: 14px 18px; color: #5C4300; font-size: 14px; }
.vp-aviso b { display: block; font-family: var(--vp-h); margin-bottom: 4px; }
.vp .vp-aviso ul { list-style: disc; padding-left: 1.2em; display: grid; gap: 2px; }
[hidden] { display: none !important; }
.vp-table .pg .vp-nota-pg { display: block; margin-top: 4px; max-width: 34ch; white-space: normal; font-family: var(--vp-b); font-weight: 400; font-size: 13px; color: var(--vp-muted); }

@media (max-width: 640px) {
  .vp { border-radius: 0; }
  .vp-kpi .val { font-size: 32px; }
}
