/* === Paleta === */
:root{
  --bg:#f5f5ee;          /* fondo general */
  --card:#ffffff;        /* paneles / tarjetas */
  --text:#1a1a1a;        /* texto principal */
  --muted:#666666;       /* texto secundario */
  --border:#dcd9ce;      /* bordes suaves */
  --brand-blue:#1c4ca4;  /* azul cabeceras */
  --brand-yellow:#faba1d;/* amarillo botones */
  --danger:#e34b4b;
  --danger-hover:#c83f3f;
}

/* Reset básico */
*{ box-sizing:border-box }

body{
  margin:0;
  font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  background:var(--bg);
  color:var(--text);
}

/* Layout contenedor para páginas PHP */
.wrap{ max-width:95%; margin:32px auto; padding:0 16px }

/* Tarjetas y áreas */
.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:16px;
  box-shadow:0 6px 24px rgba(0,0,0,.06);
}

header{ padding:24px 16px 8px; max-width:95%; margin:0 auto }

.toolbar{ display:flex; gap:12px; flex-wrap:wrap; align-items:center; padding:16px }

.pill{
  display:inline-block;
  padding:.2rem .5rem;
  border-radius:999px;
  background:#eef3ff;           /* suave sobre blanco */
  border:1px solid #d9e4ff;
  font-size:12px;
  color:#2a3654;
}

.hint{ font-size:12px; color:var(--muted) }

/* Tabla y filtros */
.table-wrap{
  overflow:auto;
  max-height:70vh;
  border-top:1px solid var(--border);
  border-bottom-left-radius:16px;
  border-bottom-right-radius:16px;
}

table{ width:100%; border-collapse:separate; border-spacing:0 }
th, td{
  padding:10px 12px;
  border-bottom:1px solid var(--border);
  vertical-align:top;
}

/* Cabecera principal: azul */
thead th{
  position:sticky;
  top:0;
  background:var(--brand-blue);
  color:#fff;
  z-index:2;
}

/* Fila de filtros debajo: sobre blanco para que destaquen los inputs */
thead tr.filters th{
  position:sticky;
  top:42px;
  background:var(--card);
  color:var(--text);
  border-bottom:1px solid var(--border);
}

.filter{
  width:100%;
  padding:8px;
  border-radius:8px;
  border:1px solid var(--border);
  background:#ffffff;
  color:var(--text);
}

/* Pie de tabla */
.footer{
  padding:10px 16px;
  color:var(--muted);
  font-size:13px;
  border-top:1px solid var(--border);
  display:flex;
  gap:12px;
  align-items:center;
  justify-content:space-between;
}

.count{ font-weight:600; color:var(--text) }

/* Botones */
.btn{
  appearance:none;
  border:none;
  border-radius:12px;
  padding:10px 14px;
  font-weight:600;
  color:#1a1a1a;              /* texto oscuro sobre amarillo */
  background:var(--brand-yellow);
  cursor:pointer;
  text-decoration:none;
  display:inline-block;
}
.btn:hover{ filter:brightness(0.95) }

.ghost{
  appearance:none;
  border:1px solid var(--brand-blue);
  border-radius:12px;
  padding:8px 12px;
  background:transparent;
  color:var(--brand-blue);
  cursor:pointer;
  text-decoration:none;
  display:inline-block;
}
.ghost:hover{ background:#eef3ff }

/* Inputs de archivo */
.row{ display:flex; gap:10px; align-items:center; flex-wrap:wrap }

input[type=file]{
  padding:10px;
  border:1px solid var(--border);
  border-radius:8px;
  background:#ffffff;
  color:var(--text);
}
#resetTotalsBtn{
  /* sobrescribe .ghost */
  background:var(--danger);
  color:#fff;
  border:1px solid var(--danger);
}
#resetTotalsBtn:hover{ background:var(--danger-hover); }
#resetTotalsBtn:focus{
  outline:2px solid rgba(227,75,75,.25);
  box-shadow:0 0 0 3px rgba(227,75,75,.12);
}

/* === Estilo del selector de versión === */
#verSelect{
  appearance:none;
  -webkit-appearance:none;
  -moz-appearance:none;
  border:1px solid var(--brand-blue);
  border-radius:12px;
  padding:8px 36px 8px 10px;
  background:#fff;
  color:var(--text);
  line-height:1.2;
  cursor:pointer;
  /* flecha ▼ en SVG inline para que no dependa de assets */
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%231c4ca4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat:no-repeat;
  background-position:right 10px center;
  background-size:18px 18px;
}
#verSelect:hover{ background-color:#f7f9ff; }
#verSelect:focus{
  outline:2px solid rgba(28,76,164,.25);
  box-shadow:0 0 0 3px rgba(28,76,164,.12);
}

/* (opcional) ajusta el label del selector para que no se pegue a los botones */
.toolbar label:has(#verSelect){ gap:6px; }
/* Mensajería */
.ok{ color:#16794c }
.err{ color:#b00020 }

