/* ============================================================
   PYM360 · MODULE — Tesorería & Contabilidad v2
   Capa 3 — específico de #pym-view-tesoreria.
   Las clases .tes-* se mantienen (usadas por 5 archivos JS y ~2500 LOC).
   Solo se redefinen para alinearlas al design system v6.
   ============================================================ */

#pym-view-tesoreria{
  padding:var(--pym-space-6) var(--pym-space-8);
  max-width:var(--pym-content-max-w);
  margin:0 auto;
}
@media (max-width:980px){#pym-view-tesoreria{padding:var(--pym-space-4)}}

/* ============================================================
   SHELL HEADER
   ============================================================ */
.tes-shell{display:flex;flex-direction:column;gap:var(--pym-space-4)}

.tes-header h1{
  font-size:var(--pym-fs-2xl);
  font-weight:var(--pym-fw-semibold);
  letter-spacing:-.02em;
  color:var(--pym-color-text);
  display:flex;
  align-items:center;
  gap:10px;
  margin:0;
}
.tes-header > div{
  font-size:var(--pym-fs-base);
  color:var(--pym-color-text-muted);
  margin-top:4px;
}

/* ============================================================
   TABS — convierte .tes-tabs en pym-tabs visualmente
   ============================================================ */
.tes-tabs{
  display:flex;
  gap:0;
  border-bottom:1px solid var(--pym-color-border);
  margin:var(--pym-space-3) 0 var(--pym-space-4);
  flex-wrap:wrap;
  overflow-x:auto;
}
.tes-tab{
  padding:10px 14px;
  font-size:var(--pym-fs-md);
  font-weight:var(--pym-fw-medium);
  color:var(--pym-color-text-muted);
  background:transparent;
  border:none;
  border-bottom:2px solid transparent;
  cursor:pointer;
  font-family:inherit;
  display:inline-flex;
  align-items:center;
  gap:6px;
  margin-bottom:-1px;
  transition:all var(--pym-trans-base);
  white-space:nowrap;
}
.tes-tab:hover{color:var(--pym-color-text-dim)}
.tes-tab.active{
  color:var(--pym-color-text);
  border-bottom-color:var(--pym-color-accent-2);
  font-weight:var(--pym-fw-semibold);
}

/* ============================================================
   CARDS
   ============================================================ */
.tes-card{
  background:var(--pym-color-surface);
  border:1px solid var(--pym-color-border);
  border-radius:var(--pym-radius-xl);
  padding:var(--pym-space-4);
  margin-bottom:var(--pym-space-3);
}
.tes-card--flush{padding:0;overflow:hidden}
.tes-card--accent{
  position:relative;
  border-color:rgba(73,124,251,.2);
  background:linear-gradient(180deg,rgba(73,124,251,.03),transparent 50%);
}

/* ============================================================
   TABLES — .tes-table igual look que pym-table
   ============================================================ */
.tes-table{
  width:100%;
  border-collapse:collapse;
  font-size:var(--pym-fs-base);
  font-family:var(--pym-font-sans);
}
.tes-table thead th,
.tes-table th{
  background:var(--pym-color-bg);
  text-align:left;
  padding:10px 12px;
  font-weight:var(--pym-fw-semibold);
  font-size:var(--pym-fs-xs);
  text-transform:uppercase;
  letter-spacing:.04em;
  color:var(--pym-color-text-muted);
  border-bottom:1px solid var(--pym-color-border);
  white-space:nowrap;
}
.tes-table td{
  padding:10px 12px;
  border-bottom:1px solid var(--pym-color-border);
  color:var(--pym-color-text);
  vertical-align:top;
}
.tes-table tbody tr{transition:background var(--pym-trans-fast)}
.tes-table tbody tr:hover td{background:rgba(255,255,255,.02)}
[data-theme="light"] .tes-table tbody tr:hover td{background:rgba(0,0,0,.02)}
.tes-table tbody tr:last-child td{border-bottom:none}

/* Numeric columns (tabular nums) */
.tes-num{
  text-align:right;
  font-variant-numeric:tabular-nums;
  font-feature-settings:"tnum";
  font-family:var(--pym-font-mono);
}

/* Cuenta column (códigos del plan de cuentas) */
.tes-cuenta{
  font-family:var(--pym-font-mono);
  color:var(--pym-color-text-muted);
  font-size:var(--pym-fs-sm);
}

/* ============================================================
   PILLS — categorías de origen (RCV / manual / cartola)
   ============================================================ */
.tes-pill{
  display:inline-block;
  padding:2px 8px;
  border-radius:var(--pym-radius-md);
  font-size:var(--pym-fs-xs);
  font-weight:var(--pym-fw-semibold);
  background:var(--pym-color-surface-2);
  color:var(--pym-color-text-dim);
  white-space:nowrap;
}
.tes-pill.rcv{background:var(--pym-color-accent-dim);color:var(--pym-color-accent-2)}
.tes-pill.manual{background:var(--pym-color-warning-dim);color:var(--pym-color-warning)}
.tes-pill.cartola{background:var(--pym-color-success-dim);color:var(--pym-color-success)}
.tes-pill.parcial{background:rgba(245,185,85,.18);color:var(--pym-color-warning);border:1px dashed var(--pym-color-warning)}

/* ============================================================
   STATS (KPI strip) — usado en dashboard tab
   ============================================================ */
.tes-stat{
  display:inline-block;
  margin-right:var(--pym-space-6);
  vertical-align:top;
}
.tes-stat-label{
  font-size:var(--pym-fs-xs);
  color:var(--pym-color-text-muted);
  text-transform:uppercase;
  letter-spacing:.04em;
  font-weight:var(--pym-fw-medium);
}
.tes-stat-value{
  font-size:var(--pym-fs-xl);
  font-weight:var(--pym-fw-semibold);
  color:var(--pym-color-text);
  margin-top:3px;
  font-feature-settings:"tnum";
  letter-spacing:-.01em;
  line-height:1.1;
}

/* ============================================================
   INPUTS / BUTTONS — homologar al DS pero conservar nombres .tes-*
   ============================================================ */
.tes-input,
.tes-shell input[type="text"],
.tes-shell input[type="number"],
.tes-shell input[type="date"],
.tes-shell select{
  padding:7px 10px;
  background:var(--pym-color-surface-2);
  border:1px solid var(--pym-color-border);
  border-radius:var(--pym-radius-md);
  font-size:var(--pym-fs-base);
  color:var(--pym-color-text);
  font-family:var(--pym-font-sans);
  transition:border-color var(--pym-trans-fast),box-shadow var(--pym-trans-fast);
  color-scheme:dark;
}
[data-theme="light"] .tes-input,
[data-theme="light"] .tes-shell input,
[data-theme="light"] .tes-shell select{color-scheme:light;background:var(--pym-color-surface)}

.tes-input:focus,
.tes-shell input:focus,
.tes-shell select:focus{
  outline:none;
  border-color:var(--pym-color-accent);
  box-shadow:0 0 0 3px var(--pym-color-accent-dim);
}

.tes-btn{
  padding:7px 14px;
  background:linear-gradient(180deg,var(--pym-color-accent-2),var(--pym-color-accent));
  color:#fff;
  border:none;
  border-radius:var(--pym-radius-md);
  cursor:pointer;
  font-size:var(--pym-fs-base);
  font-weight:var(--pym-fw-medium);
  font-family:inherit;
  box-shadow:var(--pym-shadow-accent);
  transition:filter var(--pym-trans-fast);
}
.tes-btn:hover{filter:brightness(1.1)}
.tes-btn:active{filter:brightness(.95)}
.tes-btn:disabled{opacity:.5;cursor:not-allowed;filter:none}

.tes-btn.ghost{
  background:transparent;
  color:var(--pym-color-accent-2);
  border:1px solid var(--pym-color-accent);
  box-shadow:none;
}
.tes-btn.ghost:hover{background:var(--pym-color-accent-dim)}

.tes-btn.danger{
  background:linear-gradient(180deg,var(--pym-color-danger),var(--pym-color-danger-strong));
  box-shadow:0 4px 12px rgba(229,72,77,.2);
}

/* ============================================================
   STATUS COLOR HELPERS (.deuda/.haber) — para libro mayor / asientos
   ============================================================ */
.deuda{color:var(--pym-color-danger);font-weight:var(--pym-fw-semibold);font-feature-settings:"tnum"}
.haber{color:var(--pym-color-success);font-weight:var(--pym-fw-semibold);font-feature-settings:"tnum"}

/* Cell tints para movimientos parciales (BCH cartola) */
.tes-table tr.row-parcial td{
  background:rgba(245,185,85,.05);
}
.tes-table tr.row-parcial:hover td{
  background:rgba(245,185,85,.1);
}

/* ============================================================
   EMPTY / LOADING STATES
   ============================================================ */
.tes-empty{
  text-align:center;
  color:var(--pym-color-text-muted);
  padding:var(--pym-space-10) var(--pym-space-5);
  font-size:var(--pym-fs-md);
}

.tes-error{
  color:var(--pym-color-danger);
  background:var(--pym-color-danger-dim);
  padding:var(--pym-space-3) var(--pym-space-4);
  border-radius:var(--pym-radius-md);
  font-size:var(--pym-fs-base);
  margin:var(--pym-space-2) 0;
}

/* ============================================================
   BANCOS — stats + cartola upload
   ============================================================ */
.tes-bancos-actions{
  display:flex;
  gap:var(--pym-space-2);
  margin-bottom:var(--pym-space-3);
  flex-wrap:wrap;
  align-items:center;
}

/* ============================================================
   DIARIO — formulario de asiento manual (modal o inline)
   ============================================================ */
.tes-asiento-form{
  display:grid;
  grid-template-columns:1fr 2fr 1fr 1fr 40px;
  gap:8px;
  align-items:start;
}
@media (max-width:780px){.tes-asiento-form{grid-template-columns:1fr 1fr}}

/* ============================================================
   REPORTES — balance / ER cards
   ============================================================ */
.tes-reporte-row{
  display:flex;
  justify-content:space-between;
  padding:6px 0;
  border-bottom:1px dashed var(--pym-color-border);
  font-size:var(--pym-fs-base);
}
.tes-reporte-row:last-child{border-bottom:none}
.tes-reporte-row .lbl{color:var(--pym-color-text-dim)}
.tes-reporte-row .val{color:var(--pym-color-text);font-family:var(--pym-font-mono);font-weight:var(--pym-fw-medium);font-feature-settings:"tnum"}
.tes-reporte-row.tot{border-top:1px solid var(--pym-color-border);margin-top:var(--pym-space-2);padding-top:var(--pym-space-2)}
.tes-reporte-row.tot .val{font-size:var(--pym-fs-md);font-weight:var(--pym-fw-semibold);color:var(--pym-color-text)}
