/* ===========================================================================
   Panel de Proveedores y Gastos (Gestión Administrativa › Proveedores)
   Todas las clases empiezan por «pv-» para no pisar al resto de la app.
   Colores: los del tema (tema.css); los de estado (verde / ámbar / rojo) son
   los mismos de la vista previa aprobada por Maria el 20/10/2026.
   =========================================================================== */
#subvista-proveedores, .pv-drawer, .pv-modal-extra {
  --pv-fg: var(--mg-carbon);
  --pv-muted: var(--mg-gris);
  --pv-faint: #78736e;
  --pv-line: var(--mg-linea);
  --pv-line-soft: var(--mg-linea-suave);
  --pv-surface: var(--mg-blanco);
  --pv-surface-2: #faf8f4;
  --pv-brand: #bd5518;
  --pv-brand-hover: #a1480f;
  --pv-brand-soft: var(--mg-ocre-suave);
  --pv-ocre: var(--mg-ocre);
  --pv-ok: #2f7d4f; --pv-ok-soft: #e7f3eb;
  --pv-warn: #85590c; --pv-warn-soft: #fff4d8;
  --pv-bad: #b93b2c; --pv-bad-soft: #fcf1ef;
  --pv-shadow: 0 1px 2px rgba(43, 43, 43, .05);
}
.pv-num { font-variant-numeric: tabular-nums; }
#subvista-proveedores [hidden], .pv-drawer[hidden], .pv-overlay[hidden] { display: none !important; }

.pv-ico { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Botones */
.pv-btn { border-radius: 12px; padding: 8px 14px; font-size: 13px; font-weight: 700; border: 1px solid var(--pv-line); background: var(--pv-surface); color: var(--pv-fg); display: inline-flex; align-items: center; gap: 6px; box-shadow: var(--pv-shadow); cursor: pointer; }
.pv-btn:hover { background: var(--pv-surface-2); }
.pv-btn.pv-primario { background: var(--pv-brand); border-color: var(--pv-brand); color: #fff; }
.pv-btn.pv-primario:hover { background: var(--pv-brand-hover); }
.pv-btn.pv-suave { box-shadow: none; background: none; border-color: transparent; color: var(--pv-brand); padding-inline: 8px; }
.pv-btn.pv-peligro { color: var(--pv-bad); }
.pv-acciones { display: flex; gap: 8px; flex-wrap: wrap; }
.pv-btn:focus-visible, .pv-chip:focus-visible, .pv-seg button:focus-visible, .pv-link:focus-visible, .pv-add:focus-visible,
.pv-toggle:focus-visible, .pv-fijo:focus-visible, .pv-lrow:focus-visible, .pv-mini:focus-visible, .pv-kpi:focus-visible { outline: 2px solid var(--pv-brand); outline-offset: 2px; }

/* Resumen */
.pv-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.pv-kpi { background: var(--pv-surface); border: 1px solid var(--pv-line); border-radius: 14px; padding: 14px 16px; display: grid; gap: 2px; box-shadow: var(--pv-shadow); text-align: left; color: var(--pv-fg); font: inherit; }
.pv-kpi-lab { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--pv-faint); }
.pv-kpi-val { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.pv-kpi-hint { font-size: 12px; color: var(--pv-muted); }
.pv-kpi.pv-alerta .pv-kpi-val { color: var(--pv-bad); }
button.pv-kpi { cursor: pointer; }
button.pv-kpi:hover { border-color: var(--pv-brand); }

/* Barra de herramientas */
.pv-tools { display: grid; gap: 10px; }
.pv-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pv-search { position: relative; flex: 1 1 280px; min-width: 0; display: block; }
.pv-search input { width: 100%; background: var(--pv-surface); border: 1px solid var(--pv-line); border-radius: 12px; padding: 9px 34px 9px 36px; font-size: 14px; }
.pv-search input:focus { outline: 2px solid var(--pv-brand); outline-offset: 0; border-color: transparent; }
.pv-search .pv-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--pv-faint); }
.pv-search-clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--pv-faint); font-size: 18px; padding: 2px 8px; cursor: pointer; }
.pv-sel { background: var(--pv-surface); border: 1px solid var(--pv-line); border-radius: 12px; padding: 8px 10px; font-size: 13px; font-weight: 600; }
.pv-seg { display: inline-flex; background: var(--pv-line-soft); border: 1px solid var(--pv-line); border-radius: 12px; padding: 3px; }
.pv-seg button { border: 0; background: none; border-radius: 9px; padding: 5px 10px; font-size: 13px; font-weight: 700; color: var(--pv-muted); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.pv-seg button[aria-pressed="true"] { background: var(--pv-surface); color: var(--pv-fg); box-shadow: var(--pv-shadow); }
.pv-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.pv-chip { border: 1px solid var(--pv-line); background: var(--pv-surface); border-radius: 999px; padding: 4px 11px; font-size: 13px; font-weight: 600; color: var(--pv-muted); display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.pv-chip-n { font-size: 12px; color: var(--pv-faint); font-weight: 700; }
.pv-chip[aria-pressed="true"] { background: var(--pv-fg); color: var(--mg-crema); border-color: var(--pv-fg); }
.pv-chip[aria-pressed="true"] .pv-chip-n { color: inherit; opacity: .75; }
.pv-dot { width: 8px; height: 8px; border-radius: 50%; background: hsl(var(--h) 60% 50%); flex: none; }

/* Secciones plegables */
.pv-sec { display: grid; gap: 10px; }
.pv-sec-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pv-sec-h h4 { font-size: 15px; font-weight: 800; margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pv-sec-h p { margin: 0; font-size: 12.5px; color: var(--pv-muted); }
.pv-toggle { border: 0; background: none; padding: 0; display: flex; align-items: center; gap: 8px; text-align: left; font-size: 15px; font-weight: 800; color: var(--pv-fg); cursor: pointer; }
.pv-tw { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; border: 1px solid var(--pv-line); background: var(--pv-surface); color: var(--pv-muted); flex: none; }
.pv-tw .pv-ico { transition: transform .15s; }
.pv-toggle[aria-expanded="false"] .pv-tw .pv-ico { transform: rotate(-90deg); }
.pv-toggle:hover .pv-tw { border-color: var(--pv-brand); color: var(--pv-brand); }
.pv-resumen-plegado { font-size: 12.5px; color: var(--pv-muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pv-sec.pv-plegada .pv-sec-desc { display: none; }
.pv-badge { font-size: 11.5px; font-weight: 800; color: var(--pv-brand); background: var(--pv-brand-soft); border-radius: 999px; padding: 2px 8px; letter-spacing: .02em; }
.pv-grupo-h { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--pv-faint); padding: 10px 2px 2px; display: flex; gap: 8px; align-items: center; }
.pv-grupo-h .pv-total { margin-left: auto; font-variant-numeric: tabular-nums; }
.pv-eyebrow { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--pv-faint); }

/* Tarjetas de gastos fijos */
.pv-fijos { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.pv-fijo { background: var(--pv-surface); border: 1px solid var(--pv-line); border-radius: 14px; padding: 12px 14px; display: grid; gap: 8px; text-align: left; box-shadow: var(--pv-shadow); cursor: pointer; }
.pv-fijo:hover { border-color: var(--pv-brand); }
.pv-fijo.pv-falta { border-color: var(--pv-bad); }
.pv-fijo-top { display: flex; gap: 10px; align-items: center; min-width: 0; }
.pv-fijo-top > div { min-width: 0; }
.pv-fijo-name { font-weight: 800; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-fijo-meta { font-size: 12px; color: var(--pv-muted); }
.pv-fijo-mid { display: flex; justify-content: space-between; align-items: end; gap: 8px; }
.pv-fijo-amt { font-size: 18px; font-weight: 800; line-height: 1.1; }
.pv-fijo-amt small { font-size: 12px; font-weight: 600; color: var(--pv-muted); }
.pv-fijo-foot { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-size: 12px; color: var(--pv-muted); flex-wrap: wrap; }
.pv-spark rect { fill: var(--pv-line); }
.pv-spark rect.pv-on { fill: var(--pv-ocre); }
.pv-spark rect.pv-last { fill: var(--pv-brand); }

.pv-pill { font-size: 11.5px; font-weight: 800; border-radius: 999px; padding: 2px 8px; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.pv-pill.pv-ok { color: var(--pv-ok); background: var(--pv-ok-soft); }
.pv-pill.pv-pend { color: var(--pv-warn); background: var(--pv-warn-soft); }
.pv-pill.pv-falta, .pv-pill.pv-sube { color: var(--pv-bad); background: var(--pv-bad-soft); }
.pv-pill.pv-frec { color: var(--pv-muted); background: var(--pv-line-soft); }
.pv-pill.pv-sinarchivo { color: var(--pv-warn); background: var(--pv-warn-soft); }

.pv-avatar { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none;
  background: hsl(var(--h) 70% 94%); color: hsl(var(--h) 50% 30%); }
.pv-cat { font-size: 11.5px; font-weight: 700; border-radius: 6px; padding: 1px 7px; white-space: nowrap;
  background: hsl(var(--h) 70% 94%); color: hsl(var(--h) 50% 30%); }

/* Lista compacta */
.pv-list { background: var(--pv-surface); border: 1px solid var(--pv-line); border-radius: 14px; overflow: hidden; box-shadow: var(--pv-shadow); }
.pv-lrow { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(0, 1.3fr) 80px 110px auto 18px; gap: 12px; align-items: center; padding: 9px 14px; border-top: 1px solid var(--pv-line-soft); cursor: pointer; }
.pv-lrow:first-child { border-top: 0; }
.pv-lrow.pv-hdr { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--pv-faint); background: var(--pv-surface-2); cursor: default; padding-block: 7px; }
.pv-lrow[data-pv-abrir]:hover { background: var(--pv-surface-2); }
.pv-lname { display: flex; gap: 10px; align-items: center; min-width: 0; }
.pv-lname > div { min-width: 0; }
.pv-lname b { font-size: 14px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-lname .pv-m { font-size: 12px; color: var(--pv-muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pv-lcell { font-size: 13px; color: var(--pv-muted); min-width: 0; }
.pv-lcell.pv-r { text-align: right; }
.pv-lcell b { color: var(--pv-fg); }
.pv-chev { color: var(--pv-faint); }
.pv-match { font-size: 12px; color: var(--pv-brand); }
.pv-add { border: 1px solid var(--pv-line); background: var(--pv-brand-soft); color: var(--pv-brand); border-radius: 9px; padding: 4px 10px; font-size: 12.5px; font-weight: 800; white-space: nowrap; flex: none; cursor: pointer; }
.pv-add:hover { background: var(--pv-brand); border-color: var(--pv-brand); color: #fff; }
.pv-fijo-top .pv-add { margin-left: auto; }

/* Cuadrícula reducida */
.pv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.pv-mini { background: var(--pv-surface); border: 1px solid var(--pv-line); border-radius: 14px; padding: 12px; display: grid; gap: 8px; text-align: left; box-shadow: var(--pv-shadow); cursor: pointer; }
.pv-mini:hover { border-color: var(--pv-brand); }
.pv-mini-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--pv-muted); }

.pv-vacio { text-align: center; padding: 28px 16px; color: var(--pv-muted); font-size: 14px; background: var(--pv-surface); border: 1px dashed var(--pv-line); border-radius: 14px; }

/* Panel lateral de detalle */
.pv-overlay { position: fixed; inset: 0; background: rgba(43, 43, 43, .35); z-index: 60; }
.pv-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100%); background: var(--mg-crema); border-left: 1px solid var(--pv-line); z-index: 65; display: flex; flex-direction: column; color: var(--pv-fg); }
.pv-dr-h { padding: 16px 18px 12px; border-bottom: 1px solid var(--pv-line); display: grid; gap: 8px; background: var(--pv-surface); position: relative; }
.pv-dr-x { position: absolute; right: 10px; top: 10px; border: 0; background: none; font-size: 22px; color: var(--pv-faint); padding: 4px 10px; cursor: pointer; }
.pv-dr-b { overflow-y: auto; padding: 16px 18px 24px; display: grid; gap: 16px; align-content: start; }
.pv-dr-title { display: flex; gap: 12px; align-items: center; padding-right: 30px; }
.pv-dr-title h3 { margin: 0; font-size: 18px; font-weight: 800; }
.pv-kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 13px; margin: 0; }
.pv-kv dt { color: var(--pv-faint); }
.pv-kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.pv-box { background: var(--pv-surface); border: 1px solid var(--pv-line); border-radius: 14px; padding: 12px 14px; display: grid; gap: 8px; }
.pv-box h5 { margin: 0; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--pv-faint); }
.pv-why { font-size: 13px; color: var(--pv-muted); margin: 0; }
.pv-why b { color: var(--pv-fg); }
.pv-switch { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; cursor: pointer; }
.pv-switch input { width: 18px; height: 18px; accent-color: var(--pv-brand); }
.pv-chart text { fill: var(--pv-faint); font-size: 10px; }
.pv-chart rect.pv-b { fill: var(--pv-ocre); }
.pv-chart rect.pv-b.pv-cur { fill: var(--pv-brand); }
.pv-chart line { stroke: var(--pv-line-soft); }
.pv-inv { display: grid; }
.pv-inv-y { font-size: 12px; font-weight: 800; color: var(--pv-faint); padding: 8px 0 2px; display: flex; justify-content: space-between; }
.pv-inv-r { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 7px 0; border-top: 1px solid var(--pv-line-soft); font-size: 13px; }
.pv-inv-r p { margin: 0; }
.pv-inv-r .pv-c { font-weight: 700; overflow-wrap: anywhere; }
.pv-inv-r .pv-d { font-size: 12px; color: var(--pv-faint); }
.pv-link { border: 0; background: none; color: var(--pv-brand); font-weight: 700; font-size: 13px; padding: 0; cursor: pointer; text-decoration: none; }
.pv-link:hover { text-decoration: underline; }
.pv-link.pv-borrar { color: var(--pv-faint); font-size: 16px; padding: 0 4px; }
.pv-aviso { font-size: 13px; background: var(--pv-warn-soft); color: var(--pv-warn); border-radius: 10px; padding: 8px 10px; font-weight: 600; }
.pv-aviso .pv-link.pv-peligro { color: var(--pv-bad); }

/* Modal «Subir factura»: ayudas extra */
.pv-sugerencias { display: grid; gap: 6px; }
.pv-sugerencias p { margin: 0; font-size: 12px; font-weight: 800; color: var(--pv-faint); text-transform: uppercase; letter-spacing: .06em; }
.pv-sugerencias button { text-align: left; border: 1px solid var(--pv-line); background: var(--pv-bad-soft); border-radius: 10px; padding: 7px 10px; font-size: 13px; cursor: pointer; }
.pv-ac { display: grid; border: 1px solid var(--pv-line); border-radius: 11px; overflow: hidden; margin-top: 4px; }
.pv-ac button { border: 0; border-top: 1px solid var(--pv-line-soft); background: var(--pv-surface); text-align: left; padding: 7px 10px; font-size: 13px; display: flex; gap: 8px; align-items: center; cursor: pointer; }
.pv-ac button:first-child { border-top: 0; }
.pv-ac button:hover { background: var(--pv-surface-2); }
.pv-drop { border: 1.5px dashed var(--pv-line); border-radius: 12px; padding: 12px; text-align: center; font-size: 13px; color: var(--pv-muted); background: var(--pv-surface-2); }
.pv-drop.pv-sobre { border-color: var(--pv-brand); background: var(--pv-brand-soft); }
.pv-drop input[type="file"] { margin-top: 6px; max-width: 100%; }

@media (max-width: 860px) {
  .pv-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pv-lrow { grid-template-columns: minmax(0, 1fr) auto auto 18px; gap: 8px; }
  .pv-lrow .pv-oculto-m { display: none; }
  .pv-lrow .pv-add { font-size: 16px; padding: 2px 10px; }
  .pv-lrow .pv-add-t, .pv-mini .pv-add-t, .pv-fijo .pv-add-t { display: none; }
  .pv-lname b { white-space: normal; }
  .pv-lrow.pv-hdr { display: none; }
}
@media (max-width: 600px) {
  .pv-fijos { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 82%; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; }
  .pv-fijo { scroll-snap-align: start; }
}
@media (max-width: 420px) { .pv-kpi-val { font-size: 19px; } }
@media (prefers-reduced-motion: no-preference) {
  .pv-drawer { animation: pv-desliza .22s ease-out; }
  @keyframes pv-desliza { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
}
