/* fase3.css — Grids para módulos Fase 3 */

/* ── pay-grid ── */
.pay-grid {
  display: grid;
  grid-template-columns: 2.2fr 1fr 100px 110px 100px 100px 80px;
  align-items: center; gap: 8px;
}
.dl-head.pay-grid { padding: 10px 16px; }
.dl-row.pay-grid  { padding: 10px 16px; min-height: 52px; }
.dl-row.pay-grid:hover { background: var(--surface2); }

@media (max-width: 980px) {
  .dl-head.pay-grid { display: none; }
  .dl-row.pay-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "c1 c1" "c3 c4" "c5 c6" "c7 c7";
    padding: 12px 14px; gap: 6px; min-height: unset;
  }
  .pay-c1 { grid-area: c1; }
  .pay-c2 { display: none; }
  .pay-c3 { grid-area: c3; }
  .pay-c4 { grid-area: c4; text-align: right; }
  .pay-c5 { grid-area: c5; }
  .pay-c6 { grid-area: c6; text-align: right; }
  .pay-c7 { grid-area: c7; border-top: 1px solid var(--border); padding-top: 8px; }
}

/* ── cl-grid ── */
.cl-grid {
  display: grid;
  grid-template-columns: 1.8fr 1.4fr 1fr 1fr 60px 140px;
  align-items: center; gap: 8px;
}
.dl-head.cl-grid { padding: 10px 16px; }
.dl-row.cl-grid  { padding: 10px 16px; min-height: 52px; }
.dl-row.cl-grid:hover { background: var(--surface2); cursor: pointer; }

@media (max-width: 980px) {
  .dl-head.cl-grid { display: none; }
  .dl-row.cl-grid {
    grid-template-columns: 1fr auto;
    grid-template-areas: "c1 c6" "c2 c2" "c3 c4" "c5 c5";
    padding: 12px 14px; gap: 6px; min-height: unset;
  }
  .cl-c1 { grid-area: c1; }
  .cl-c2 { grid-area: c2; font-size: 12px; }
  .cl-c3 { grid-area: c3; font-size: 12px; }
  .cl-c4 { grid-area: c4; font-size: 12px; text-align: right; }
  .cl-c5 { grid-area: c5; font-size: 12px; }
  .cl-c6 { grid-area: c6; }
}

/* ── neg-grid (tarjetas) ── */
.neg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}
.neg-card {
  background: var(--surface1); border: 1.5px solid var(--border);
  border-radius: 16px; padding: 18px;
  display: flex; flex-direction: column; gap: 10px;
  transition: border-color .12s;
}
.neg-card:hover { border-color: var(--accent); }
@media (max-width: 980px) { .neg-grid { grid-template-columns: 1fr; } }

/* ── gan-grid ── */
.gan-grid {
  display: grid;
  grid-template-columns: 2fr 90px 110px 110px 110px 110px 90px;
  align-items: center; gap: 8px;
}
.dl-head.gan-grid { padding: 10px 16px; }
.dl-row.gan-grid  { padding: 10px 16px; min-height: 52px; }
.dl-row.gan-grid:hover { background: var(--surface2); }

@media (max-width: 980px) {
  .dl-head.gan-grid { display: none; }
  .dl-row.gan-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "c1 c1" "c2 c3" "c4 c5" "c6 c7";
    padding: 12px 14px; gap: 6px; min-height: unset; display: grid;
  }
  .gan-c1{grid-area:c1} .gan-c2{grid-area:c2;font-size:11px}
  .gan-c3{grid-area:c3;text-align:right} .gan-c4{grid-area:c4}
  .gan-c5{grid-area:c5;text-align:right} .gan-c6{grid-area:c6}
  .gan-c7{grid-area:c7;text-align:right;font-size:11px}
}

/* ── Proyectos v1 (legacy — se mantiene por si algo lo referencia) ── */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px,1fr)); gap: 12px; }
.proj-card {
  background: var(--surface1); border: 1.5px solid var(--border);
  border-radius: 16px; padding: 18px;
  display: flex; flex-direction: column; gap: 10px;
  transition: border-color .12s;
}
.proj-card:hover { border-color: var(--accent); }
.proj-card[data-status="ejecucion"] { border-left: 4px solid #16A34A; }
.proj-card[data-status="detenido"]  { border-left: 4px solid #CA8A04; }
.proj-card[data-status="terminado"] { border-left: 4px solid var(--accent); }
.proj-progress-bar { height: 6px; border-radius: 99px; background: var(--surface2); }
.proj-progress-fill { height: 100%; border-radius: 99px; background: var(--accent); }
@media (max-width: 980px) { .proj-grid { grid-template-columns: 1fr; } }

/* ════════════════════════════════════════════════════════════
   PROYECTOS v2 — diseño compacto (Fase F)
   Tarjetas livianas · dot de estado · menú 3-puntos · sin borde lateral grueso
   ════════════════════════════════════════════════════════════ */

.proj-grid-v2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
}

.pj-card {
  background: var(--surface1);
  border: 1px solid #DCE6EF;
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  isolation: isolate;
  width: 100%;
  box-sizing: border-box;
}
[data-theme="dark"] .pj-card { border-color: #2E3A4E; }
.pj-card:hover { background: var(--surface2); }

/* Cabecera */
.pj-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.pj-head-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.pj-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  margin-top: 2px;
}
.pj-name {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
  overflow: clip;
  text-overflow: ellipsis;
  line-height: 1.3;
  min-width: 0;
}

/* Botón 3-puntos */
.pj-more-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  flex: none;
  opacity: 0;
}
.pj-card:hover .pj-more-btn { opacity: 1; }
.pj-more-btn:hover { background: var(--surface2); }
@media (max-width: 980px) {
  .pj-more-btn { opacity: 1; }
}

/* Meta (cliente + fecha) */
.pj-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.pj-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}
.pj-meta-item svg { width: 13px; height: 13px; flex: none; color: var(--text-2); }

/* Progreso */
.pj-progress-section { display: flex; flex-direction: column; gap: 4px; }
.pj-progress-bar {
  height: 5px;
  border-radius: 3px;
  background: var(--surface2);
}
.pj-progress-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  /* sin overflow:hidden, sin transition — evitan GPU compositing */
}
.pj-progress-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.pj-prog-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
}
.pj-prog-balance {
  font-size: 11px;
  font-weight: 700;
}
.pj-balance-pending { color: var(--warning); }
.pj-balance-done    { color: var(--success); }

.pj-totals-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 11.5px;
  color: var(--text-2);
  font-weight: 600;
}
.pj-totals-row strong { font-weight: 800; color: var(--text); }

.pj-no-docs {
  font-size: 12px;
  color: var(--text-2);
  font-style: italic;
}

/* Pie de tarjeta */
.pj-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 6px;
  border-top: 1px solid #DCE6EF;
  margin-top: 2px;
}
[data-theme="dark"] .pj-footer { border-top-color: #2E3A4E; }
.pj-status-label {
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* Botón pagar — extra pequeño */
.btn-xs {
  padding: 5px 10px;
  font-size: 11.5px;
  border-radius: 8px;
  gap: 4px;
}
.btn-xs svg { width: 13px; height: 13px; }

@media (max-width: 980px) {
  .proj-grid-v2 { grid-template-columns: 1fr; }
}

/* ── Ganancias extra ── */
.gan-tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.gan-tab {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: 12px;
  border: 1.5px solid var(--border); background: var(--surface1);
  color: var(--text-2); font-weight: 700; font-size: 13px;
  cursor: pointer; font-family: var(--font); transition: all .12s;
  -webkit-tap-highlight-color: transparent;
}
.gan-tab svg { width: 16px; height: 16px; }
.gan-tab:hover { border-color: var(--accent); color: var(--text); }
.gan-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.gan-chart-card { background: var(--surface1); border: 1.5px solid var(--border); border-radius: 16px; padding: 18px; margin-bottom: 12px; }
.gan-chart-title { font-size: 14px; font-weight: 800; color: var(--text); margin-bottom: 14px; }
.gan-bars { display: flex; gap: 6px; align-items: flex-end; height: 120px; overflow-x: auto; padding-bottom: 4px; }
.gan-bar-col { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 44px; flex: 1; }
.gan-bar-val { font-size: 9px; font-weight: 700; color: var(--text-2); text-align: center; white-space: nowrap; }
.gan-bar-wrap { flex: 1; width: 28px; display: flex; align-items: flex-end; background: var(--surface2); border-radius: 6px; overflow: hidden; }
.gan-bar-fill { width: 100%; background: var(--accent); border-radius: 6px; min-height: 4px; }
.gan-bar-lbl  { font-size: 9.5px; font-weight: 700; color: var(--text-2); }

.gan-pending-toggle {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; background: var(--surface1);
  border: 1.5px solid var(--border); border-radius: 12px;
  margin-top: 10px; cursor: pointer; font-size: 13px;
  font-weight: 700; color: var(--text-2); transition: all .12s;
}
.gan-pending-toggle:hover { border-color: var(--accent); color: var(--text); }
.gan-pending-toggle svg { width: 15px; height: 15px; flex: none; }

/* ── Match hero ── */
.match-hero {
  position: relative; overflow: hidden; border-radius: 20px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #0C2D48 0%, #0E7490 50%, #0891B2 100%);
  border: 1px solid rgba(255,255,255,.08);
}
.match-hero-inner { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 28px 30px; flex-wrap: wrap; }
.match-hero-left { flex: 1; min-width: 0; }
.match-hero-kpis { display: flex; align-items: center; gap: 20px; margin-bottom: 14px; }
.match-kpi-val { font-size: 32px; font-weight: 800; color: #fff; line-height: 1; }
.match-kpi-lbl { font-size: 11px; font-weight: 700; color: rgba(255,255,255,.7); text-transform: uppercase; letter-spacing: .05em; margin-top: 4px; }
.match-kpi-sep { width: 1px; height: 40px; background: rgba(255,255,255,.2); }
.match-hero-title { font-size: 22px; font-weight: 800; color: #fff; margin-bottom: 8px; }
.match-hero-sub { font-size: 13.5px; color: rgba(255,255,255,.8); line-height: 1.6; max-width: 480px; font-weight: 500; }
.match-hero-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.match-hero-pill { display: inline-flex; align-items: center; gap: 5px; background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.25); border-radius: 99px; padding: 5px 12px; font-size: 12px; font-weight: 700; color: #fff; }
.match-hero-pill svg { width: 13px; height: 13px; }
.match-hero-cta { background: #fff !important; color: #0C2D48 !important; border-color: rgba(255,255,255,.3) !important; }
.match-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 12px; }
.match-card { background: var(--surface1); border: 1.5px solid var(--border); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.match-parties { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.match-party   { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.match-connector { color: var(--accent); display: flex; padding: 0 6px; flex: none; }
.match-connector svg { width: 18px; height: 18px; }
@media (max-width: 980px) { .match-grid { grid-template-columns: 1fr; } .match-hero-inner { padding: 20px 18px; } .match-kpi-val { font-size: 24px; } }
