/* ===========================================================================
   proyectos.css — Cotización por proyectos (pulido visual)
   Diseño de referencia: docs/diseno/cotizacion/cotizacion_lista_diseno.html y
   cotizacion_detalle_diseno.html. TODO lo de este archivo vive scopeado bajo
   .py-app para no cambiar el look de otros módulos (Planificaciones,
   Indicadores, etc.). Namespace de clases: .py-*. Animaciones apagadas con
   prefers-reduced-motion.
   =========================================================================== */

.py-app {
  /* Los tokens del look (color/degradado/sombra/radio) viven ahora en el KIT
     compartido de rs_ui.css (--rsk-*). Acá solo se aliasan, así Cotización y
     Mecanizado comparten una única fuente de verdad y se ven idénticos. Los
     valores computados no cambian respecto a la versión previa de este archivo. */
  --py-ink: var(--rsk-ink);
  --py-ink-soft: var(--rsk-ink-soft);
  --py-muted: var(--rsk-muted);
  --py-muted-2: var(--rsk-muted-2);
  --py-paper: var(--rsk-paper);
  --py-surface: var(--rsk-surface);
  --py-surface-2: var(--rsk-surface-2);
  --py-border: var(--rsk-border);
  --py-border-2: var(--rsk-border-2);
  --py-plum: var(--rsk-plum);
  --py-plum-dark: var(--rsk-plum-dark);
  --py-plum-wash: var(--rsk-plum-wash);
  --py-grad: var(--rsk-grad);
  --py-grad-hero: var(--rsk-grad-hero);
  --py-shadow-card: var(--rsk-shadow-card);
  --py-shadow-hero: var(--rsk-shadow-hero);
  --py-shadow-grad: var(--rsk-shadow-grad);

  /* estados: --dot / --bg / --fg (punto, fondo del pill, texto del pill) */
  --py-cotizando-dot: #0891b2;  --py-cotizando-bg: #cffafe;  --py-cotizando-fg: #155e75;
  --py-ganado-dot: #65a30d;     --py-ganado-bg: #ecfccb;     --py-ganado-fg: #3f6212;
  --py-produccion-dot: #d97706; --py-produccion-bg: #fef3c7; --py-produccion-fg: #92400e;
  --py-perdido-dot: #64748b;    --py-perdido-bg: #e2e8f0;    --py-perdido-fg: #475569;
  --py-anulado-dot: #dc2626;    --py-anulado-bg: #fee2e2;    --py-anulado-fg: #991b1b;

  box-sizing: border-box;
  min-height: 70vh;
  padding: 24px 32px 40px;
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--py-ink);
  display: flex;
  flex-direction: column;
  gap: 18px;
  background:
    radial-gradient(1100px 480px at 15% -10%, rgba(124, 58, 237, .12), transparent 60%),
    radial-gradient(900px 400px at 95% 0%, rgba(219, 39, 119, .09), transparent 60%),
    var(--py-paper);
}
.py-app *, .py-app *::before, .py-app *::after { box-sizing: border-box; }
.py-mono { font-family: Consolas, 'Courier New', monospace; }

/* ── Botones ───────────────────────────────────────────────────────────── */
.py-btn {
  height: 42px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid var(--py-border);
  background: var(--py-surface);
  color: var(--py-ink-soft);
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}
.py-btn svg { display: block; }
.py-btn--sm { height: 36px; padding: 0 14px; font-size: 12.5px; border-radius: 12px; }
.py-btn--grad {
  border: none;
  background: var(--py-grad);
  color: #fff;
  font-weight: 800;
  box-shadow: var(--py-shadow-grad);
}
.py-btn--white { border: none; background: #fff; color: var(--py-plum); font-weight: 800; box-shadow: 0 10px 24px rgba(0, 0, 0, .2); }
.py-btn--glass { border: 1px solid rgba(255, 255, 255, .4); background: rgba(255, 255, 255, .1); color: #fff; }
.py-btn--dashed { border: 1px dashed #c9bfd9; background: #fff; color: var(--py-plum); font-weight: 800; }
.py-btn--icon { width: 38px; height: 38px; padding: 0; border-radius: 12px; }
.py-btn--icon-sm { width: 32px; height: 32px; padding: 0; border-radius: 10px; border: none; background: #fff; }
.py-btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }

/* ── Hero (cabecera degradada, lista + detalle) ────────────────────────── */
.py-hero {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  padding: 24px 30px;
  background: var(--py-grad-hero);
  box-shadow: var(--py-shadow-hero);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.py-hero::before, .py-hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.py-hero::before { right: -60px; top: -80px; width: 260px; height: 260px; background: rgba(255, 255, 255, .08); }
.py-hero::after { right: 120px; bottom: -120px; width: 220px; height: 220px; background: rgba(255, 255, 255, .06); }
.py-hero > * { position: relative; }
.py-hero-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.py-hero-eyebrow { font-size: 12px; letter-spacing: 1.2px; text-transform: uppercase; color: rgba(255, 255, 255, .78); font-weight: 700; }
.py-hero-title { margin: 0; font-size: 30px; font-weight: 900; letter-spacing: -.5px; line-height: 1.1; }
.py-hero-title.sm { font-size: 26px; }
.py-hero-sub { margin: 0; font-size: 14px; color: rgba(255, 255, 255, .85); max-width: 580px; }
.py-hero-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.py-hero-code { font-family: Consolas, 'Courier New', monospace; font-size: 15px; font-weight: 800; background: rgba(255, 255, 255, .16); padding: 5px 12px; border-radius: 10px; }
.py-breadcrumb { font-size: 12px; color: rgba(255, 255, 255, .8); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.py-breadcrumb a, .py-breadcrumb b { color: #fff; text-decoration: none; font-weight: 700; }

/* 4 cifras del detalle, en vidrio dentro del hero */
.py-hero-stats { margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.py-glass { background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .22); border-radius: 14px; padding: 12px 16px; display: flex; flex-direction: column; gap: 2px; }
.py-glass dt, .py-glass .k { font-size: 11px; color: rgba(255, 255, 255, .78); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.py-glass dd, .py-glass .v { margin: 0; font-size: 20px; font-weight: 900; }

/* ── Tarjetas de resumen (anillo degradado) ────────────────────────────── */
.py-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.py-ring {
  border-radius: 18px;
  padding: 16px 18px;
  border: 2px solid transparent;
  background:
    linear-gradient(var(--py-surface), var(--py-surface)) padding-box,
    var(--ring, var(--py-grad)) border-box;
  box-shadow: var(--py-shadow-card);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.py-ring-k { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; color: var(--ring-fg, var(--py-plum)); }
.py-ring-v { font-size: 32px; font-weight: 900; line-height: 1; }
.py-ring-sub { font-size: 12px; color: var(--py-muted); }

/* ── Aviso de tarifas ──────────────────────────────────────────────────── */
.py-notice { border-radius: 14px; padding: 12px 16px; background: #fff4d6; border: 1px solid #f3d48a; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: 13px; color: #6b4300; }
.py-notice a { font-weight: 800; color: #7c4a03; text-decoration: none; }

/* ── Barra de filtros ──────────────────────────────────────────────────── */
.py-filters { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.py-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.py-chip {
  height: 38px; padding: 0 16px; border-radius: 999px;
  font-size: 13px; font-weight: 700; font-family: inherit; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--py-border); background: #fff; color: var(--py-ink);
}
.py-chip-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.py-chip.is-active { border-color: transparent; background: var(--py-grad); color: #fff; }
.py-chip.is-active .py-chip-dot { background: #fff !important; }

.py-search { display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--py-border); background: #fff; min-width: 280px; }
.py-search input { border: none; outline: none; background: transparent; font-size: 13px; width: 100%; font-family: inherit; color: var(--py-ink); }

.py-toggle { display: inline-flex; padding: 4px; border-radius: 14px; background: #fff; border: 1px solid var(--py-border); gap: 4px; }
.py-toggle button { height: 34px; padding: 0 14px; border-radius: 10px; border: none; cursor: pointer; font-size: 12.5px; font-weight: 800; font-family: inherit; background: transparent; color: var(--py-muted); }
.py-toggle button.is-active { background: var(--py-grad); color: #fff; }

/* ── Pipeline ──────────────────────────────────────────────────────────── */
.py-pipeline { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.py-col { border-radius: 20px; padding: 14px; background: rgba(62, 29, 99, .045); border: 1px solid rgba(62, 29, 99, .10); min-height: 380px; display: flex; flex-direction: column; gap: 12px; transition: opacity .25s ease; }
.py-col.is-dim { opacity: .4; }
.py-col-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 4px; }
.py-col-title { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; letter-spacing: .3px; color: var(--py-ink-soft); }
.py-col-title .py-chip-dot { width: 10px; height: 10px; }
.py-col-count { font-size: 12px; font-weight: 800; padding: 2px 10px; border-radius: 999px; background: #fff; color: var(--py-plum-dark); border: 1px solid var(--py-border); }
.py-col-empty { flex: 1; border-radius: 16px; border: 1px dashed #d6cfe3; display: flex; align-items: center; justify-content: center; font-size: 12.5px; color: var(--py-muted); text-align: center; padding: 20px; }

/* ── Tarjeta de proyecto (pipeline + grilla) ───────────────────────────── */
.py-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.py-card { border-radius: 18px; padding: 16px; background: var(--py-surface); border: 1px solid var(--py-border); box-shadow: var(--py-shadow-card); display: flex; flex-direction: column; gap: 10px; }
.py-card.lg { border-radius: 20px; padding: 18px; }
.py-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.py-code { font-family: Consolas, 'Courier New', monospace; font-size: 13px; font-weight: 800; color: var(--py-plum-dark); background: var(--py-plum-wash); padding: 3px 9px; border-radius: 8px; }
.py-card-name { margin: 0; font-size: 15px; font-weight: 800; line-height: 1.3; }
.py-card.lg .py-card-name { font-size: 17px; line-height: 1.25; }
.py-card-client { font-size: 12px; color: var(--py-muted); font-weight: 600; }

/* pill de estado */
.py-pill { font-size: 11px; font-weight: 800; padding: 4px 10px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.py-pill--cotizando  { background: var(--py-cotizando-bg);  color: var(--py-cotizando-fg); }
.py-pill--ganado     { background: var(--py-ganado-bg);     color: var(--py-ganado-fg); }
.py-pill--produccion { background: var(--py-produccion-bg); color: var(--py-produccion-fg); }
.py-pill--perdido    { background: var(--py-perdido-bg);    color: var(--py-perdido-fg); }
.py-pill--anulado    { background: var(--py-anulado-bg);    color: var(--py-anulado-fg); }
.py-pill .py-chip-dot { width: 8px; height: 8px; }

/* mini-árbol de la tarjeta */
.py-mini { margin: 0; padding: 10px 12px; list-style: none; border-radius: 12px; background: var(--py-surface-2); display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--py-ink-soft); }
.py-mini li { display: flex; align-items: center; gap: 8px; }
.py-mini .dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.py-mini .more { color: var(--py-muted); font-style: italic; }

/* barra de avance */
.py-progress-row { display: flex; flex-direction: column; gap: 6px; }
.py-progress-lab { display: flex; justify-content: space-between; font-size: 11.5px; color: #92400e; font-weight: 700; }
.py-progress { height: 8px; border-radius: 999px; background: var(--py-plum-wash); overflow: hidden; }
.py-progress-bar { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #fbbf24, #f97316); transform-origin: left center; }

.py-meta { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; font-size: 12px; }
.py-meta dt { color: var(--py-muted); font-size: 11px; }
.py-meta dd { margin: 0; font-weight: 700; }
.py-meta dd.ok { font-weight: 800; color: #166534; }
.py-card-actions { display: flex; gap: 8px; padding-top: 4px; }
.py-card-cta { flex: 1; height: 38px; border-radius: 12px; background: var(--py-grad); color: #fff; font-size: 13px; font-weight: 800; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; border: none; cursor: pointer; box-shadow: var(--py-shadow-grad); }

/* ── Pestañas en píldora (detalle) ─────────────────────────────────────── */
.py-tabs { display: inline-flex; align-self: flex-start; padding: 5px; border-radius: 16px; background: #fff; border: 1px solid var(--py-border); gap: 4px; box-shadow: 0 2px 8px rgba(35, 26, 43, .05); max-width: 100%; flex-wrap: wrap; }
.py-tab { height: 40px; padding: 0 18px; border-radius: 12px; border: none; background: transparent; color: var(--py-ink-soft); font-size: 13px; font-weight: 700; font-family: inherit; cursor: pointer; }
.py-tab.is-active { background: var(--py-grad); color: #fff; font-weight: 800; box-shadow: var(--py-shadow-grad); }
.py-tab:disabled { color: var(--py-muted-2); cursor: not-allowed; }

/* ── Sección blanca genérica ───────────────────────────────────────────── */
.py-section { border-radius: 20px; padding: 18px 22px; background: var(--py-surface); border: 1px solid var(--py-border); box-shadow: var(--py-shadow-card); display: flex; flex-direction: column; gap: 12px; }
.py-section-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.py-section-title { margin: 0; font-size: 15px; font-weight: 800; }
.py-section-note { font-size: 12px; color: var(--py-muted); }
.py-cols { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }

/* ── "Dónde cae cada pieza" (resumen por estación) ─────────────────────── */
.py-stations { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px; align-items: center; }
.py-station-name { font-size: 13px; font-weight: 800; }
.py-station-name.off { color: var(--py-muted-2); }
.py-station-track { position: relative; height: 46px; border-radius: 12px; background: #f3f0ea; border: 1px solid var(--py-border-2); overflow: hidden; }
.py-station-load { position: absolute; left: 0; top: 0; bottom: 0; background: repeating-linear-gradient(135deg, rgba(62, 29, 99, .12) 0 10px, rgba(62, 29, 99, .04) 10px 20px); }
.py-station-tag { position: absolute; top: 14px; font-size: 12px; font-weight: 700; color: #4a4152; }
.py-station-bar { position: absolute; top: 6px; bottom: 6px; border-radius: 10px; }
.py-station-bar-lab { position: absolute; top: 14px; font-size: 11px; font-weight: 800; color: #fff; white-space: nowrap; overflow: hidden; }
.py-station-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--py-muted); }

/* ── Árbol del detalle (riel) ──────────────────────────────────────────── */
.py-tree { display: flex; flex-direction: column; gap: 6px; }
.py-node { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--py-surface-2); border: 1px solid var(--py-border-2); cursor: pointer; }
.py-node.is-sel { background: linear-gradient(135deg, rgba(8, 145, 178, .10), rgba(124, 58, 237, .12)); border: 1px solid rgba(8, 145, 178, .55); box-shadow: 0 10px 28px rgba(8, 145, 178, .14); cursor: default; }
.py-node-icon { width: 36px; height: 36px; flex-shrink: 0; border-radius: 12px; background: var(--py-grad); display: inline-flex; align-items: center; justify-content: center; color: #fff; }
.py-node.is-sel .py-node-icon { background: var(--py-cotizando-dot); }
.py-node-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.py-node-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.py-node-name { font-size: 14.5px; font-weight: 800; }
.py-node.is-sel .py-node-name { color: var(--py-cotizando-fg); }
.py-node-sub { font-size: 11.5px; color: var(--py-muted); }
.py-node.is-sel .py-node-sub { color: #4a4152; }
.py-qty { font-size: 11.5px; font-weight: 800; padding: 2px 9px; border-radius: 999px; background: var(--py-plum-wash); color: var(--py-plum-dark); }
.py-node.is-sel .py-qty { background: #fff; }
.py-noplan { font-size: 11px; color: var(--py-muted); border: 1px dashed #d6cfe3; padding: 2px 8px; border-radius: 999px; }
.py-plan-chip { font-family: Consolas, 'Courier New', monospace; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: var(--py-cotizando-bg); color: var(--py-cotizando-fg); }
.py-node-actions { display: inline-flex; gap: 2px; opacity: 0; transition: opacity .15s ease; }
.py-node:hover .py-node-actions, .py-node.is-sel .py-node-actions { opacity: 1; }
.py-node-chevron { color: var(--py-muted-2); flex-shrink: 0; display: block; }
.py-node:hover .py-node-chevron, .py-node.is-sel .py-node-chevron { display: none; }

/* ── Panel del nodo (ruta de materiales/procesos) ──────────────────────── */
.py-node-ruta { font-size: 12px; color: var(--py-muted); }
.py-node-ruta b { color: var(--py-ink); }
.py-node-h { margin: 0; font-size: 22px; font-weight: 900; }
.py-tags { display: flex; gap: 6px; flex-wrap: wrap; font-size: 11.5px; }
.py-tag { padding: 3px 10px; border-radius: 999px; background: var(--py-surface-2); color: var(--py-ink-soft); border: 1px solid var(--py-border); }
.py-tag--type { background: var(--py-cotizando-bg); color: var(--py-cotizando-fg); border: none; font-weight: 800; }
.py-tag.mono { font-family: Consolas, 'Courier New', monospace; }

.py-route-head { margin: 0; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .8px; color: var(--py-muted); }
.py-route { display: grid; grid-template-columns: 118px minmax(0, 1fr) 110px 110px; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 14px; font-size: 13px; }
.py-route--material { border: 1px dashed rgba(37, 99, 235, .4); background: rgba(37, 99, 235, .05); }
.py-route--proceso { border: 1px solid var(--py-border); background: var(--py-surface-2); }
.py-route--externo { border: 1px dashed rgba(217, 119, 6, .4); background: rgba(217, 119, 6, .05); }
.py-route--control { border: 1px dashed rgba(124, 58, 237, .4); background: rgba(124, 58, 237, .05); }
.py-route-tag { font-size: 11px; font-weight: 900; color: #fff; padding: 5px 8px; border-radius: 8px; text-align: center; letter-spacing: .5px; }
.py-route-tag--material { background: linear-gradient(135deg, #2563eb, #60a5fa); }
.py-route-tag--proceso { background: linear-gradient(135deg, #dc2626, #f97316); }
.py-route-tag--externo { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: var(--py-ink); }
.py-route-tag--control { background: linear-gradient(135deg, #7c3aed, #a78bfa); }
.py-route-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.py-route-sub { font-size: 11.5px; color: var(--py-muted); }
.py-route-h { text-align: right; font-weight: 800; }
.py-route-cost { text-align: right; font-weight: 900; color: #166534; }
.py-route-muted { color: var(--py-muted); }

.py-totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.py-mini-stat { border-radius: 14px; padding: 12px 14px; background: var(--py-surface-2); border: 1px solid var(--py-border-2); display: flex; flex-direction: column; gap: 2px; }
.py-mini-stat .k { font-size: 11px; color: var(--py-muted); font-weight: 700; }
.py-mini-stat .v { font-size: 16px; font-weight: 800; }
.py-mini-stat.total { border: 2px solid transparent; background: linear-gradient(var(--py-surface), var(--py-surface)) padding-box, var(--py-grad) border-box; }
.py-mini-stat.total .k { color: var(--py-plum); }

/* ── Tablas (Tiempos / Comparar) ───────────────────────────────────────── */
.py-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.py-table thead tr { background: #fff; border-bottom: 2px solid var(--py-border); text-align: left; }
.py-table th { padding: 8px; font-weight: 800; }
.py-table td { padding: 8px; }
.py-table tbody tr { border-bottom: 1px solid var(--py-border-2); }

/* ── Gantt ─────────────────────────────────────────────────────────────── */
.py-gantt { border: 1px solid var(--py-border); border-radius: 10px; overflow: hidden; min-width: 620px; }
.py-gantt-row { display: flex; align-items: center; border-bottom: 1px solid #f1f0ee; }
.py-gantt-name { width: 140px; flex-shrink: 0; font-size: 12px; font-weight: 700; padding: 6px 8px; }
.py-gantt-track { flex: 1; position: relative; height: 30px; }
.py-gantt-bar { position: absolute; top: 5px; height: 20px; border-radius: 4px; opacity: .9; overflow: hidden; white-space: nowrap; font-size: 10px; color: #fff; padding: 2px 4px; }
.py-gantt-now { position: absolute; top: 0; bottom: 0; width: 2px; background: #dc2626; z-index: 3; }
.py-gantt-axis { display: flex; border-top: 1px solid var(--py-border); }
.py-gantt-axis .lab { flex: 1; display: flex; justify-content: space-between; font-size: 10px; color: var(--py-muted); padding: 2px 4px; }

/* ── Skeleton shimmer ──────────────────────────────────────────────────── */
.py-skel { position: relative; overflow: hidden; background: #ece7df; border-radius: 12px; }
.py-skel::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .6), transparent); transform: translateX(-100%); animation: py-shimmer 1.3s infinite; }
.py-skel-screen { display: flex; flex-direction: column; gap: 14px; }

/* ── Enlaces del módulo ────────────────────────────────────────────────── */
.py-app a { color: var(--py-plum); }
.py-app a:hover { color: var(--py-plum-dark); }
.py-link { font-weight: 800; text-decoration: none; }

/* ===========================================================================
   Animaciones (apagadas con prefers-reduced-motion)
   =========================================================================== */
@keyframes py-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes py-pop { 0% { transform: scale(1); } 50% { transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes py-shine { from { transform: translateX(-120%) skewX(-20deg); } to { transform: translateX(220%) skewX(-20deg); } }
@keyframes py-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes py-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
@keyframes py-shimmer { to { transform: translateX(100%); } }

.py-app header, .py-app section, .py-app .py-animap { animation: py-up .45s cubic-bezier(.2, .8, .2, 1) both; }
.py-cascade > * { animation: py-up .5s cubic-bezier(.2, .8, .2, 1) both; }
.py-cascade > *:nth-child(1) { animation-delay: .05s; }
.py-cascade > *:nth-child(2) { animation-delay: .11s; }
.py-cascade > *:nth-child(3) { animation-delay: .17s; }
.py-cascade > *:nth-child(4) { animation-delay: .23s; }
.py-cascade > *:nth-child(5) { animation-delay: .29s; }
.py-cascade > *:nth-child(6) { animation-delay: .35s; }

.py-app button, .py-app a, .py-app .py-chip, .py-app .py-tab, .py-app .py-card, .py-app .py-node, .py-app .py-col {
  transition: transform .18s cubic-bezier(.2, .8, .2, 1), box-shadow .18s ease, filter .18s ease, background .2s ease, color .2s ease, border-color .22s ease, opacity .25s ease;
}
.py-app button:hover, .py-app a:hover { transform: translateY(-1px); }
.py-app button:active, .py-app a:active { transform: translateY(0) scale(.97); transition-duration: .08s; }
.py-app button:focus-visible, .py-app a:focus-visible, .py-app input:focus-visible { outline: 3px solid rgba(124, 58, 237, .45); outline-offset: 2px; }

.py-lift:hover { transform: translateY(-5px); border-color: rgba(124, 58, 237, .6) !important; box-shadow: 0 20px 44px rgba(124, 58, 237, .2); }
.py-chip:hover { transform: translateY(-1px); filter: brightness(.97); }
.py-chip:active { animation: py-pop .22s ease; }

.py-shine { position: relative; overflow: hidden; }
.py-shine::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 40%; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent); transform: translateX(-120%) skewX(-20deg); pointer-events: none; }
.py-shine:hover::after { animation: py-shine .7s ease; }
.py-shine:hover { filter: brightness(1.08); }

.py-row:hover { background: var(--py-plum-wash) !important; transform: translateX(3px); box-shadow: 0 6px 16px rgba(62, 29, 99, .08); }
.py-ghost:hover { background: var(--py-plum-wash) !important; }

.py-bar { transform-origin: left center; animation: py-grow .7s cubic-bezier(.2, .8, .2, 1) .3s both; }
.py-now-pulse { animation: py-pulse 1.6s ease-in-out infinite; }

/* cross-fade al cambiar de vista/pestaña */
.py-fade { animation: py-up .2s ease both; }

@media (prefers-reduced-motion: reduce) {
  .py-app *, .py-app *::before, .py-app *::after { animation: none !important; transition: none !important; }
}

/* Modales del módulo: van en document.body (fuera de .py-app), así que su
   animación NO se scopea. Entran con overlay fade + card scale .96→1. */
@keyframes py-ov-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes py-card-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.py-modal-ov { animation: py-ov-in .18s ease both; }
.py-modal-card { animation: py-card-in .22s cubic-bezier(.2, .8, .2, 1) both; }
@media (prefers-reduced-motion: reduce) {
  .py-modal-ov, .py-modal-card { animation: none !important; }
}

/* ===========================================================================
   Responsive (<768px) — grids colapsan, hero y stats a 1-2 columnas
   =========================================================================== */
@media (max-width: 768px) {
  .py-app { padding: 16px 12px 32px; }
  .py-summary, .py-pipeline, .py-grid3, .py-hero-stats, .py-totals { grid-template-columns: 1fr; }
  .py-route { grid-template-columns: 1fr; gap: 6px; }
  .py-route-h, .py-route-cost { text-align: left; }
  .py-cols { flex-direction: column; }
  .py-hero-title { font-size: 24px; }
  .py-filters { flex-direction: column; align-items: stretch; }
  .py-search { min-width: 0; }
}
@media (min-width: 540px) and (max-width: 768px) {
  .py-summary, .py-hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
